Make call with alternate provider if NOANSWER
- by adaptive
I have two voip providers, one free an the other paid. The free provider only allows local calls to certain area codes, so I need to fall back to the the paid provider if a call fails.
At the moment, I have the following context in my extensions.conf file:
[globals]
; freephoneline.ca
PRIMARY_PROVIDER=fpl
; voip.ms
SECONDARY_PROVIDER=voipms
[local]
exten => _NXXNXXXXXX,1,Set(CALLERID(name)=${OUTGOING_NAME})
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@${PRIMARY_PROVIDER})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${OUTGOING_NUMBER})
exten => _NXXNXXXXXX,n,Dial(SIP/1${EXTEN}@${SECONDARY_PROVIDER})
exten => _NXXNXXXXXX,n,Hangup()
I checked the logs and noticed that the free provider responds with NOANSWER if a call is not allowed (Even though it plays a message). What I want is to:
Try calling the ${PRIMARY_PROVIDER} first.
If NOANSWER is returned by provider (not that the callee did not answer), then call with ${SECONDARY_PROVIDER}
How can I modify my dial plan to get the desired results?
EDIT : The primary provider is freephoneline.ca, and I'm using asterisk v1.8.2.3-2