Make call with alternate provider if NOANSWER

Posted by adaptive on Server Fault See other posts from Server Fault or by adaptive
Published on 2012-06-01T12:45:19Z Indexed on 2012/06/04 22:42 UTC
Read the original article Hit count: 150

Filed under:

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:

  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

© Server Fault or respective owner

Related posts about asterisk