[asterisk-users] AGI script exits non-zero when running system command

Charles Solar charlessolar at gmail.com
Wed Feb 2 15:43:13 CST 2011


Thanks for the useful information, I had forgotten about SIGHUP since I
usually work with asterisk 1.6.
I think however that it would be more acurate to say that the channel is
hanging up due to the script crash.  I tried moving the command around in
the script and it crashes exactly on the system call.  Also if I remove the
system call it works perfectly.  I have a feeling calling the system command
is producing the condition to crash the script and hang up the channel.
You did remind me of DeadAGI however, and that actually worked.  I was using
AGI ( again, thanks to asterisk 1.6 experience ) and I forgot asterisk 1.4
is a little more picky.  Once I changed to DeadAGI the script worked.
I did try adding an ignore handler for SIGHUP but that did not work.  It is
very strange, but I would say from this experience that it is not wise to
use a system call from a script started with AGI() in asterisk 1.4.

Thanks for the lead, it helped greatly.

On Wed, Feb 2, 2011 at 1:13 PM, Tilghman Lesher <tilghman at meg.abyt.es>wrote:

> On Tuesday 01 February 2011 23:43:34 Charles Solar wrote:
> > Hey guys I was hoping I could get a few pointers on a problem I have
> > been trying to debug for the last couple of months regarding asterisk
> > AGI scripts and unexpected termination.
> > I have this agi script that accepts incoming faxes using RxFax on the
> > latest asterisk 1.4 branch. Its written with perl and it works fine
> > except for one line that causes the entire script to terminate
> > unexpectedly.
> <snip>
> > AGI Tx >> 200 result=0
> > AGI Rx << VERBOSE "Converting /tmp/1296624119.53.tiff to
> > /tmp/1296624119.53.pdf" 1
> >   fax.agi: Converting /tmp/1296624119.53.tiff to /tmp/1296624119.53.pdf
> > AGI Tx >> 200 result=1
> > Really destroying SIP dialog '371b80c6324ece0c779653c34d2e88a2 at XXX'
> > Method: INVITE
> >   == Spawn extension (from-trunk, XXXXXXXXXX, 3) exited non-zero on
> > 'SIP/trunk-00000035'
>
> This isn't the script terminating non-zero.  It's the channel hanging up.
>
> One possible problem might be that your script is not properly handling the
> SIGHUP signal sent to the AGI process when a hangup occurs.  If that is the
> case, then your script may be terminating early due to the signal.  The
> best way to handle that is to set a signal handler in your script (this is
> dependent upon the language you're using), although there's also a
> workaround for people who are unwilling or unable to set a signal handler.
>
> Just remember that prior to Asterisk 1.6.2, once you receive the SIGHUP,
> you may no longer interact with the Asterisk process.  That includes
> setting and retrieving variables and using the VERBOSE command.  Starting
> with Asterisk 1.6.2, an AGI is free to continue interacting with Asterisk
> (the setting of final variables is likely the most productive task).
>
> --
> Tilghman
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110202/daf27f6c/attachment.htm>


More information about the asterisk-users mailing list