Is there a way to limit the minutes for an account ?

Catalog of dial plans
akhater
Posts: 20
Joined: Fri Mar 06, 2009 9:07 am

Is there a way to limit the minutes for an account ?

Post by akhater » Fri Jul 10, 2009 12:10 am

I have switched to SipSorcery and I was wondering if there is a way to communicate between the dial plan and the call logs I want to restrict the number of minutes to a specific country to x minutes

Can this be done ?

thanks

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Fri Jul 10, 2009 9:20 am

I think this can be done but never tryed it

the new dial string format will alow it i think

If you can do it for a country I don't know

maybe if you can combine it with

DBWrite(string key, string value)
Writes a keyed value to the database.

DBRead(string key)
Reads a keyed value from database.
- Answered call limit, this option would set the limit on the duration of an answered call. It would cause the call manager to keep track of the length of the call and once the limit was reached it would automatically generate the BYE requests to hang up each end of the call,
sys.Dial("${dst}@provider[al=300]

dt: Delay call initialisation time,
nt: No response timeout,
pt: Processing (ringing) timeout,
al: Answered call time limit,
rm: Redirect mode, a=Add to current call, r=replace current call.

take a look at this treat

http://www.mysipswitch.com/forum/viewtopic.php?t=1180

Hope this helps

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Fri Jul 10, 2009 4:18 pm

I was trying something today with

WebGet(string)


if you have access to a website and a database

you problaby keep track for it yourself

but you have to write some scripts for it

akhater
Posts: 20
Joined: Fri Mar 06, 2009 9:07 am

Post by akhater » Sat Jul 11, 2009 8:08 am

jvwelzen wrote:I think this can be done but never tryed it

the new dial string format will alow it i think

If you can do it for a country I don't know

maybe if you can combine it with

DBWrite(string key, string value)
Writes a keyed value to the database.

DBRead(string key)
Reads a keyed value from database.
- Answered call limit, this option would set the limit on the duration of an answered call. It would cause the call manager to keep track of the length of the call and once the limit was reached it would automatically generate the BYE requests to hang up each end of the call,
sys.Dial("${dst}@provider[al=300]

dt: Delay call initialisation time,
nt: No response timeout,
pt: Processing (ringing) timeout,
al: Answered call time limit,
rm: Redirect mode, a=Add to current call, r=replace current call.

take a look at this treat

http://www.mysipswitch.com/forum/viewtopic.php?t=1180

Hope this helps
thank you but this looks more like a way to limit the number of minutes per call rather than the total number of minutes.

Thanks
jvwelzen wrote: was trying something today with

WebGet(string)


if you have access to a website and a database

you problaby keep track for it yourself

but you have to write some scripts for it
This looks interesting did you reach anything with this ? I have access to a DB and website. Maybe we can share our efforts


To both,

I haven't found anything regarding the DBWrite and DBread methods, I have tried them and it is giving me "Dial Plan Missing Method"

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Sat Jul 11, 2009 1:05 pm

I was playing with a sort of prepaid system

example (I am not using a database for now I just made a php page)

Code: Select all

saldo = sys.WebGet("http://www.huizenwireless.nl/new/saldo.php") # Saldo = 111 for testing

if "#{saldo}" >= "099"

  sys.Dial("${dst}@provider1")

else

   sys.Respond("You do not have enough credit !")

end 

But I don't know If you can detect the duration of a call

akhater
Posts: 20
Joined: Fri Mar 06, 2009 9:07 am

Post by akhater » Sat Jul 11, 2009 1:18 pm

this is great!

Now how will you feed back your php page about the number of credits used etc...?

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Sat Jul 11, 2009 1:22 pm

That's the next step

We have to detect what the duration is for a call

and then the price for the country you are calling to

so we can open a new page that send back the minutes left

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Post by jvwelzen » Sat Jul 11, 2009 2:34 pm

I haven't found anything regarding the DBWrite and DBread methods, I have tried them and it is giving me "Dial Plan Missing Method"
This is working

Code: Select all

write = sys.DBWrite("1", "opgeslagen") 
sys.Log("write : #{write}")

read = sys.DBRead("1") 
sys.Log("read : #{read}") 

akhater
Posts: 20
Joined: Fri Mar 06, 2009 9:07 am

Post by akhater » Sat Jul 11, 2009 3:59 pm

thanks for that !

I will give it a try

akhater
Posts: 20
Joined: Fri Mar 06, 2009 9:07 am

Post by akhater » Sat Jul 11, 2009 5:09 pm

That's great !

I think it will work,

what I also found out is that you need to cast your variable to integers to be able to perform on them math operations

read = sys.DBRead("1")
sys.Log("read : #{read}")

read = read.to_i + 1 #casting to int

sys.DBWrite("1","#{read}")

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest