[asterisk-dev] How to detect Asterisk failure

Olle E. Johansson oej at edvina.net
Thu Feb 25 08:53:43 CST 2010


25 feb 2010 kl. 15.20 skrev Benny Amorsen:

> I have a setup with two gateways to the PSTN, and a lot of customers
> each with their own Asterisk server. Should one of the PSTN gateways
> fail, I would like customers to automatically use the other one.
> 
> There are a number of challenges here.
> 
> The naïve solution is to simply Dial() the first gateway and if that
> returns CONGESTION, try the other one. This is not optimal, because
> calls may return CONGESTION for many reasons, e.g. when the dialed
> number is invalid. The invalid number is then tried on both gateways,
> which is a waste.
> 
> How can I determine that the call failed because the remote Asterisk is
> unreachable? I.e. the remote Asterisk either fails to reply to the SIP
> INVITE or the remote Asterisk is considered UNREACHABLE by qualify.
> 
This is not really an asterisk-dev question, Benny ;-)

I made a patch a while ago for a company that had multiple sip proxies and wanted automatic peer failover. That won't really work here, because we switched mid-call too - something you can do with proxies.

I would say that you should propably send a specific hangup cause from your gateway servers in the case of issues with the outbound trunk. that way you can separate an Asterisk-generated congestion (we can't reach the remote server with SIP) from errors generated on the remote end. This works when you control all ends. When interoperating with other players, it may cause confusion that you misuse hangup causes ;-)

/O


More information about the asterisk-dev mailing list