Andrew Kohlsmith
2004-Jun-09 12:10 UTC
[Asterisk-Users] failover for voip providers (i.e. Dial() doesn't give enough options)
I'm looking for a way to detect when a VOIP provider is unable to complete a call and thus try another VOIP provider (failover/backup type situation). using qualify is NOT sufficient, since the provider could very well be reachable but not be able to complete the call for other reasons. A perfect example: setting my caller ID number to my real number and calling a local number causes the switch for the called number to fail the call since the destination number is not a long distance call from the number in the caller ID. Yes, a proper dial plan will help with that, but that's not the point. The VOIP provider could be out of channels or have connection problems to their telco -- the point is that they are reachable so qualify passes, but they can't complete the call for me for whatever reason. Dial() will jump to n+101 if the call is busy OR if it can't be completed. I don't want to try calling the number again if it really was busy, only if the VOIP provider couldn't complete the call. Is there some way to access the call failure reason in the dialplan and branch based on that? i.e. something like exten => _NXXNXXXXXX,1,SetCIDNum(${MYNUM}) exten => _NXXNXXXXXX,2,Dial(${VOIP_PREFERRED}/${EXTEN}) exten => _NXXNXXXXXX,3,Congestion exten => _NXXNXXXXXX,103,GotoIf($[${CALLFAILREASON} == BUSY]?:202) exten => _NXXNXXXXXX,104,Busy exten => _NXXNXXXXXX,202,Dial(${VOIP_BACKUP}/${EXTEN}) exten => _NXXNXXXXXX,203,Congestion exten => _NXXNXXXXXX,303,GotoIf($[${CALLFAILREASON} == BUSY]?:402) exten => _NXXNXXXXXX,304,Busy exten => _NXXNXXXXXX,402,Congestion ... kind of thing. Regards, Andrew