Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:

; freephoneline.ca
; voip.ms

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:

  1. Try calling the ${PRIMARY_PROVIDER} first.
  2. 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

share|improve this question
Including the VOIP server you are using and the version number in the body of your question would be helpful in answering. –  Tim Brigham Jun 1 '12 at 13:09

1 Answer 1

up vote 1 down vote accepted
exten => _NXXNXXXXXX,n,Set(dest=${EXTEN})
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@${PRIMARY_PROVIDER},20,); 20 is how much to call,in seconds
exten => _NXXNXXXXXX,n,Goto(s-${DIALSTATUS},1)

exten => s-ANSWER,1,Hangup
exten => s-ANSWERED,1,Hangup
exten => s-NOANSWER,1,Goto(dialnext,1)
exten => s-CHANUNAVAIL,1,Goto(dialnext,1)
exten => s-BUSY,1,Busy
exten => s-FAIL,1,Goto(dialnext,1)
exten => s-CONGESTION,1,Goto(dialnext,1)

exten =>dialnext,1,Dial(SIP/1${dest}@${SECONDARY_PROVIDER})
exten =>dialnext,n,Hangup()
share|improve this answer
Thanks for the helpful info, but that did not solve the problem. –  adaptive Jun 6 '12 at 20:15
This answer is technically correct but you need to detect CHANUNAVAIL. voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS –  jfalcon Jun 7 '12 at 21:40
2jfalcon user say he need NOANSWER. 2adaptive: please show output of asterisk verbose log. –  arheops Jun 9 '12 at 16:01
@arheops doesn't matter what he needs... it's what he gets back from the VSP. –  jfalcon Jun 11 '12 at 5:51
I haven't tested CHANUNAVAIL yet, but your answer was helpful. –  adaptive Jun 12 '12 at 18:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.