[asterisk-users] Re: Missing Fast AGI calling 'h' exten without hanging up

Tony Mountifield tony at softins.clara.co.uk
Tue Aug 1 08:48:37 MST 2006


In article <44CF6F82.6010109 at routers.com>,
Rich Adamson <radamson at routers.com> wrote:
> Tony Mountifield wrote:
> > Using the 1.2 branch of SVN, I've been experimenting with FastAGI.
> > I want to do something useful for the caller (e.g. play a message)
> > if the FastAGI server is not running, i.e. AGI gets connect refused.
> > 
> > What I have found is that when AGI gets connect refused, it returns -1,
> > and control is passed to the 'h' extension WITHOUT hanging up the channel!
> > My SIP phone thinks it is still connected, but "show channels" displays
> > no active channels.
> > 
> > Putting a Hangup in the 'h' extension doesn't help - the SIP phone still
> > doesn't hang up.
> > 
> > I suppose the problem is that AGI would be better returning an AGISTATUS
> > variable instead of just a return valoue of -1.
> > 
> > What is the best way to approach this?
> 
> What sip phone?

It's a Grandstream BT102. I did a SIP debug, and whereas calling Hangup from
the dialplan generates a SIP BYE, which hangs up the phone normally, if I
call AGI(agi://localhost/foo) and the server isn't running, there is no
SIP BYE, only a SIP CANCEL.

Actually, writing that made me wonder. My dialplan was like this:

exten => 8008,1,Answer
exten => 8008,n,AGI(agi://localhost/foo)
exten => 8008,n,Playback(vm-goodbye)
exten => 8008,n,Hangup
exten => h,1,NoOp(Hangup in context ${CONTEXT})

I've just gone back and added a Wait(0.5) between the Answer and AGI, and
now the phone gets correctly hung up when AGI returns -1. So the SIP issue
was presumably that the call setup hadn't completed when it was hung up,
and nothing to do with AGI. I get exactly the same effect with this:

exten => 8009,1,Answer
exten => 8009,n,Hangup

The remaining issue is probably just a design change in AGI: if it gets
a connection refused, or even some other error, it would be more useful
to set a channel variable instead of just hanging up, so that the dialplan
could take a fallback path with the call still live.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list