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
Here is an example of how I do this with google voice and trunks. With my setup I had to make a way to limit gv to 1 channel, also setup a rotation so the first gv trunk is not always hammered since it is first. There is a lot more to this but for just displaying failover I thought this was more than enough: