Page 1 of 2
Is there a way to limit the minutes for an account ?
Posted: Fri Jul 10, 2009 12:10 am
by akhater
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
Posted: Fri Jul 10, 2009 9:20 am
by jvwelzen
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
Posted: Fri Jul 10, 2009 4:18 pm
by jvwelzen
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
Posted: Sat Jul 11, 2009 8:08 am
by akhater
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"
Posted: Sat Jul 11, 2009 1:05 pm
by jvwelzen
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
Posted: Sat Jul 11, 2009 1:18 pm
by akhater
this is great!
Now how will you feed back your php page about the number of credits used etc...?
Posted: Sat Jul 11, 2009 1:22 pm
by jvwelzen
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
Posted: Sat Jul 11, 2009 2:34 pm
by jvwelzen
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}")
Posted: Sat Jul 11, 2009 3:59 pm
by akhater
thanks for that !
I will give it a try
Posted: Sat Jul 11, 2009 5:09 pm
by akhater
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}")