Tim Nelson
2010-Aug-31 14:52 UTC
[asterisk-users] Running System() after call completion, not in 'h'?
Greetings all- I have some dialplan code on an Asterisk 1.2.x box that basically dials a call, then after call completion, runs a command via System(). However, I'm finding that roughly 5% of the time, the System() command never executes and seems to be on specific destinations. Simplified/paraphrased example: exten => 1,1,Set(VARIABLE=SOMEVALUE) exten => 1,n,Dial(SIP/somepeer/1234567980) exten => 1,n,System(/bin/bash /root/bin/somescript.sh ${VARIABLE} It almost seems to be related to how fast the destination 'hangs up' and whether or not the dialplan has time to run the System command before jumping to 'h'. I have to believe there is a better way to do this, possibly using DeadAGI? All suggestions welcome. Thank you! --Tim
Steve Edwards
2010-Aug-31 15:11 UTC
[asterisk-users] Running System() after call completion, not in 'h'?
On Tue, 31 Aug 2010, Tim Nelson wrote:> I have some dialplan code on an Asterisk 1.2.x box that basically dials > a call, then after call completion, runs a command via System(). > However, I'm finding that roughly 5% of the time, the System() command > never executes and seems to be on specific destinations. > Simplified/paraphrased example: > > exten => 1,1,Set(VARIABLE=SOMEVALUE) > exten => > 1,n,Dial(SIP/somepeer/1234567980) > exten => 1,n,System(/bin/bash > /root/bin/somescript.sh ${VARIABLE} > > It almost seems to be related to how fast the destination 'hangs up' and > whether or not the dialplan has time to run the System command before > jumping to 'h'. > > I have to believe there is a better way to do this, possibly using > DeadAGI?I think you're on the right track -- moving from system() to [dead]agi(). I think you should be using agi() instead of deadagi() since the call isn't "dead" yet. IMO, trapping HUP is a prerequisite for a "well written AGI." -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000