[asterisk-users] Re : Controlling calls
Steve Edwards
asterisk.org at sedwards.com
Sun Jun 6 17:37:36 CDT 2010
On Sat, 5 Jun 2010, Adil Zaaraoui wrote:
> I want to write an AGI script doing this:
>
> 1-user call a number.
> 2-asterisk call the agi script
> 3-the script dial the peer
> 4-if the call is answered, let the call up for 1min
> 5-then the script hangs up the channel.
On Sun, 6 Jun 2010, Steve Edwards wrote:
> Can you lookup the peer and the remaining minutes in your AGI, set these
> values in channel variables and then set the timeout and dial your peer
> in your dialplan?
On Sun, 6 Jun 2010, Adil Zaaraoui wrote:
> Yes i can get the user remaining minutes from my database, the scrips
> runs; but when i run exec("Dial","IAX2/400") then geting the
> channelStatus if is answer it does not hangup using either
> getChannel().hangup() or just hangup().
>
> note: when running Dial from my script, it blocks for a period about
> 13seconds then the program continue to the next statment.
Are you saying that when you execute the dial application from your AGI
Asterisk dials the peer and when peer answers they get dead air for 13
seconds before being bridged with the caller?
> I think you get what i want to achieve. dialing from the script, if the
> channel is answered, set a timer, if the caller consumed his minutes,
> from the script i hangup.
Did you try setting channel variables in your AGI and then doing an
absolute timeout and the dial command in the dialplan? What happened?
What happens if you try something like this:
exten = 777,n, set(TIMEOUT(absolute)=30)
exten = 777,n, dial(iax2/400)
exten = 777,n, hangup()
What is supposed to happen if the call is not answered?
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list