Asterisk

如果 NOANSWER,請與替代提供商聯繫

  • July 21, 2015

我有兩個 voip 提供商,一個是免費的,另一個是付費的。免費提供商僅允許撥打某些區號的本地電話,因此如果呼叫失敗,我需要退回到付費提供商。目前,我的extensions.conf文件中有以下上下文:

[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()

我檢查了日誌並註意到NOANSWER如果不允許呼叫,免費提供商會做出響應(即使它播放消息)。我想要的是:

  1. 嘗試呼叫第${PRIMARY_PROVIDER}一個。
  2. 如果NOANSWER由提供者返回(不是被呼叫者沒有回答),則呼叫${SECONDARY_PROVIDER}

如何修改我的撥號計劃以獲得所需的結果?

編輯:主要提供商是freephoneline.ca,我使用星號v1.8.2.3-2

[local]
exten => _NXXNXXXXXX,1,Set(CALLERID(name)=${OUTGOING_NAME})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${OUTGOING_NUMBER})
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()

引用自:https://serverfault.com/questions/394694