Dan Fernandez
2003-Jul-23 15:04 UTC
[Asterisk-Users] executing an agi script after a successful Dial
I would like to run an agi script (to calculate the cost of a long distance or international call) right after I execute a Dial app. Can this be configured in extensions.conf? It seems the entries right after a Dial app get executed only if the Dial app was executed unsucessfully. Would I have to execute the dial app from the agi script? Thanks in advance. Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20030723/e0855fbf/attachment.htm
Tilghman Lesher
2003-Jul-23 15:18 UTC
[Asterisk-Users] executing an agi script after a successful Dial
On Wednesday 23 July 2003 05:04 pm, Dan Fernandez wrote:> I would like to run an agi script (to calculate the cost of a long > distance or international call) right after I execute a Dial app. > Can this be configured in extensions.conf? It seems the entriesIt cannot. If the Dial app succeeds in getting a connected channel, it will ALWAYS return -1, which signals a hangup to Asterisk. The only time Dial will ever return control to the dialplan is if either the channel is not available or if the channel does not get connected.> right after a Dial app get executed only if the Dial app was > executed unsucessfully. Would I have to execute the dial app from > the agi script?No, again, the Dial app won't return control to the AGI script until after the call is complete. You're pretty much going to have to do whatever you want to do prior to executing Dial or after the call is complete. Of course, you could create a separate thread which runs parallel to the channel thread and does various monitoring tasks, but that would require some C programming skills. -Tilghman
Dave Packham
2003-Jul-25 20:38 UTC
[Asterisk-Users] executing an agi script after a successful Dial
is there any way to keep those vars around until after h goes away? maybe move the "free" routiene to after h is done? Dave>>> kpj@junghanns.net 7/25/2003 5:32:55 PM >>>Hi Dan, no wonder. when the h extension is called the channel (including all the channel variables you want to read with get_var) is gone. pass the channel variables you need to acces as an argument to the agi script, e.g.: exten => h,1,AGI(myagi.agi,${EXTEN} ${CALLERIDNUM}) regards kapejod -- Klaus-Peter Junghanns CEO,CTO Junghanns.NET GmbH Breite Strasse 13 - 12167 Berlin - Germany fon: +49 30 79705392 fax: +49 30 79705391 iaxtel: 1-700-157-8753 email: kpj@junghanns.net http://www.junghanns.net/asterisk Am Sam, 2003-07-26 um 01.28 schrieb Dan Fernandez:> John > > Thanks for the response. This seems to be what I am looking. However, I > have discovered a problem with a simple perl script triggered from the h > extension. > > I am using perl-Asterisk and if I call the script from any extension in > works fine. However, if I call the same script from h the get_variable and > verbose functions don t work anymore. > > Rgds > Dan > ----- Original Message ----- > From: "John Todd" <jtodd@loligo.com> > To: <asterisk-users@lists.digium.com> > Sent: Wednesday, July 23, 2003 8:20 PM > Subject: Re: [Asterisk-Users] executing an agi script after a successful > Dial > > > > >On Wednesday 23 July 2003 05:04 pm, Dan Fernandez wrote: > > >> I would like to run an agi script (to calculate the cost of a long > > >> distance or international call) right after I execute a Dial app. > > >> Can this be configured in extensions.conf? It seems the entries > > > > > >It cannot. If the Dial app succeeds in getting a connected channel, > > >it will ALWAYS return -1, which signals a hangup to Asterisk. The > > >only time Dial will ever return control to the dialplan is if either > > >the channel is not available or if the channel does not get connected. > > > > Hmm... I'm not so sure about what the question was, and if perhaps > > there is some confusion about what is desired here. In my example > > configs, I use the "h" extension to clean up call recording after > > Dial has terminated. Seems to work for me, but perhaps it's not > > supposed to work. :) > > > > Dan - try putting your routines in an extension called "h". This may > > get executed after Dial terminates normally or abnormally. > > > > JT > > > > > > > > right after a Dial app get executed only if the Dial app was > > >> executed unsucessfully. Would I have to execute the dial app from > > >> the agi script? > > > > > >No, again, the Dial app won't return control to the AGI script until > > >after the call is complete. You're pretty much going to have to do > > >whatever you want to do prior to executing Dial or after the call is > > >complete. Of course, you could create a separate thread which > > >runs parallel to the channel thread and does various monitoring > > >tasks, but that would require some C programming skills. > > > > > >-Tilghman > > > > > >_______________________________________________ > > >Asterisk-Users mailing list > > >Asterisk-Users@lists.digium.com > > >http://lists.digium.com/mailman/listinfo/asterisk-users > > > > _______________________________________________ > > Asterisk-Users mailing list > > Asterisk-Users@lists.digium.com > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users_______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users