Simone Cittadini
2005-Sep-02 07:26 UTC
[Asterisk-Users] how to execute something after Dial() ?
let's suppose I have this dialplan : exten => _X.,1,Playtones(ring) exten => _X.,2,Dial(CAPI/contr1/${EXTEN},,g) exten => _X.,3,AGI(update) where "update" updates some db tables we have based on the type of extension Now, from the wiki : If the /g/ option is specified, and the called party hangs up before the calling party, then Dial exits with a return code of 0 to continue execution at priority n+1. Dial returns -1 if the originating channel hangs up, or if the call is bridged and either of the parties in the bridge terminate the call. So I may use the "h" extension, but also from the wiki : Use with great care: Apparently some channel variables get destroyed when the call is hung up, and those variables aren't available anymore (or have inconsistent values) when the h extension is being called. Therefore you shouldn't rely on this special extension for billing/calling card purposes. So? how can I have the update AGI reliably executed even if the calling hangups first ?
Tony Mountifield
2005-Sep-02 08:25 UTC
[Asterisk-Users] Re: how to execute something after Dial() ?
In article <431860FF.6040903@gmail.com>, Simone Cittadini <mymailforlists@gmail.com> wrote:> So I may use the "h" extension, but also from the wiki : > > Use with great care: Apparently some channel variables get destroyed > when the call is hung up, and those variables aren't available anymore > (or have inconsistent values) when the h extension is being called. > Therefore you shouldn't rely on this special extension for > billing/calling card purposes. > > So? how can I have the update AGI reliably executed even if the calling > hangups first ?That warning looks too non-specific and based on fearful hearsay. I would respond to it: "show me the code, and say which variables are affected." If it's true, it is a bug that needs fixing. Or perhaps it just used to be, and got fixed. I have used DeadAGI in the h extension to do tidyup and logging with no problems at all. The channel variables I created while the call was being set up (e.g. CALLID) have always been available while processing h, and h is invoked even if it is the caller that hangs up. The thing that you should *never* do in the 'h' extension is call Hangup itself, since I have found that can cause 'h' to get invoked again. I have seen the incorrect and unnecessary example of "exten => h,1,Hangup" far too many times. Cheers Tony -- Tony Mountifield Work: tony@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org