I use AGI and AMI with Asterisk.
I create call with Dial and I need to manage time limitation. I know there is the “L(X:Y:Z)” parameters, but my problem is the time limit can change during the call.
ex: you have 1min credit in your wallet, you started a call but in the meantime a friend put 5min credit on your wallet, I have to extend the time limitation in realtime.
My first problem is to know the real answered time (without the ringing time) as quick as possible, I can’t wait the end of the call.
Any idea ?
to be honest, I’m totally new to the Asterisk’s world.
I’ve checked the G option for the Dial command, but I don’t undestand how I can solve my problem with this.
Could you detail a little bit ?
thank you !
G causes dial plan to be run when part B answers. You can then use Bridge() to complete the call. You need to put a Wait(), etc., on the other channel to keep it open until the bridge. The subroutine and macro options also cause dialplan to be run, but only on the party B channel.
I think you can not solve it with dial options. You should write a daemon what listen via AMI and check the credits.
If a call start the daemon note/save the start time and periodically check the phone number’s credits. If the nuber has no credit the daemon send a hangup via AMI.
I think you can not solve it with dial options. You should write a daemon what listen via AMI and check the credits.
If a call start the daemon note/save the start time and periodically check the phone number’s credits. If the nuber has no credit the daemon send a hangup via AMI.[/quote]
That was exaclty what i’ve tried to do, but no success.
I’ve tried a “GetVar” of “ANSWEREDTIME” to the desired channel, but it return no data.
I’ve read, that we can get the “ANSWEREDTIME” value only when the call is ended.
Sing up some basic event: Newstate (listen to the ChannelState: X attribute) and maybe the Hangup. If a Newstate event arrive u can create a timestamp for your own.
Finally got it working.
I first check the value of “CDR(DISPOSITION)” to check the aswered state of the channel.
If the state is “ANSWERED” then I check the value of “CDR(answer)” to get the asnwered time.
Thanks guy for your hints