[Asterisk-Dev] FastAGI Bug/Problem/Feature Request

Matt King m at orderlysoftware.com
Thu Jun 16 04:43:40 MST 2005

Hello all,

Somebody advised that I should discuss this issue here first before 
posting a bug/feature request.

So, FastAGI can be used to perform automatic call-handling with a remote 
FastAGI server.

When the FastAGI Server is available (accepting connections), the call 
is handled, and unless the FastAGI Server specifies otherwise, Asterisk 
will continue at the next priority in extensions.conf when the FastAGI 
Server closes the connection.

However, when the FastAGI server is not available (because it's down, or 
network issues), Asterisk does *not* simply proceed to the next priority 
- instead it hangs up the call.

This means that if you're supplying a service over FastAGI, then when 
your FastAGI Server is down, Asterisk will hang up on all your callers.

I'd like to suggest/request that this behaviour be changed so that 
Asterisk prints out a warning message (indicating that the server could 
not be found), then proceeds to the next priority in extensions.conf as 
normal, instead of just hanging up.  This would allow people who are 
using FastAGI to build contingency plans into extensions.conf in case 
their AGI server goes down.

If Asterisk does manage to find the FastAGI server, it can easily be 
told to skip the next priority (to avoid the contingency).  Here's an 
example of how one might deploy graceful-fail contingency in this scheme:

In extensions.conf:

exten => 1000,1,Answer
exten => 1000,2,agi(agi://

; This is the contingency - AGI will skip it when found.
exten => 1000,3,Goto(contingency, 1)

; This is where the AGI Server continues.
exten => 1000,4,Dial(SIP/12345,60,r)
exten => 1000,5,Hangup

exten => contingency,1,Playback(we-are-experiencing-technical-difficulties)
exten => contingency,2,Playback(please-call-us-later)
exten => contingency,3,Hangup

In the AGI Processor (code based on JAGIServer/OrderlyCalls):

//Do some logic and/or CTI stuff
//Skip the contingency
String priStr=agi.getAGIProperty("agi_priority");
int pri=Integer.parseInt(priStr);
//Close the connection to Asterisk.

People who do not choose to build in contingency plans would be 
unaffected by this change, unless the next priority in extensions.conf 
depends on a successful FastAGI call *and* their FastAGI server is down.

An alternative method of doing this would be to add an argument to the 
AGI application command to specify what should happen if the FastAGI 
server cannot be reached.

Any thoughts before I make my bug post?

Oh, and are priorities *always* numbers?

Many thanks,

Matt King, M.A. Oxon.
Managing Director, Orderly Software Ltd.
Author, JAGIServer, OrderlyCalls and OrderlyQ.

More information about the asterisk-dev mailing list