[asterisk-users] Re: FastAGI hangs up channel if server is not available

Sean Bright sean.bright at gmail.com
Thu May 17 13:54:04 MST 2007


Woops.  The documentation problem was my fault.  I was basing that on a
patched version of asterisk that jumped to another priority on FastAGI
failure.  I'll update the wiki.

Sean

On 5/17/07, Tony Mountifield <tony at softins.clara.co.uk> wrote:
>
> In article <464C8977.4020501 at datatrakpos.com>,
> Lee Jenkins <lee at datatrakpos.com> wrote:
> >
> > Running 1.2.14
> >
> > When I call a FastAGI script such as this script for an incoming call:
> >
> > [calldirect]
> > exten=>s,1,Answer()
> > exten=>s,2,AGI(agi://192.168.1.175/calldirect?check&${CALLERID(num)})
> > exten=>s,3,Goto(check_time,s,1)
> >
> > and the FastAGI server is not running (Asterisk gets "connection
> > refused" TCP error), Asterisk just terminates the call like so:
> >
> > May 17 12:58:00 WARNING[10154]: res_agi.c:210 launch_netscript: Connect
> > to 'agi://192.168.1.175/calldirect?check&NNNNNNNNNN' failed: Connection
> > refused
> >    == Spawn extension (remove_caller, s, 2) exited non-zero on
> > 'SIP/datatrak-0978b670'
> >
> > The text of the relevant wiki article
> > (http://www.voip-info.org/wiki-Asterisk+FastAGI) infers that execution
> > should roll through to the next executable line in the context where it
> > was called in the case of an error in executing the FastAGI:
> >
> > "Asterisk 1.2
> > Under Asterisk 1.2, if a request to a FastAGI service failed for any
> > reason, there was no way to determine this from the dialplan. The
> > recommended action is to set a channel variable before calling the
> > FastAGI, setting that variable to a known value within the FastAGI, and
> > then checking that variable once the AGI has returned..."
> >
> > Is there a setting/var that I am missing?
>
> No, the information is wrong. You need to make a small mod to
> res/res_agi.c
> in order to trap this case. Look for the second occurrence of
> LOCAL_USER_REMOVE, and add the lines just before it as show by this
> patch extract (ignore the line numbers; I have other mods too):
>
> @@ -2065,6 +2106,9 @@
>                         close(fds[1]);
>                 if (efd > -1)
>                         close(efd);
> +       } else {
> +               pbx_builtin_setvar_helper(chan, "AGISTATUS", "NOTFOUND");
> +               res = 0;
>         }
>         LOCAL_USER_REMOVE(u);
>         return res;
>
> With this change, a refused connection will not hang up the channel, but
> instead will set the AGISTATUS variable to "NOTFOUND".
>
> Cheers
> Tony
> --
> Tony Mountifield
> Work: tony at softins.co.uk - http://www.softins.co.uk
> Play: tony at mountifield.org - http://tony.mountifield.org
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> 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/20070517/8f3d6f98/attachment.htm


More information about the asterisk-users mailing list