如果没有接听,请拨打其他服务提供商的电话

如果没有接听,请拨打其他服务提供商的电话

我有两个 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}

我如何修改拨号计划以获得期望的结果?

编辑 :主要供应商是免费电话热线,我使用星号v1.8.2.3-2

答案1

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

答案2

下面是我如何使用 google voice 和 trunk 执行此操作的示例。在我的设置中,我必须想办法将 gv 限制为 1 个通道,还要设置一个轮换,这样第一个 gv trunk 就不会总是被击穿,因为它是第一个。还有很多事情要做,但对于仅显示故障转移,我认为这已经足够了:

exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = ""]?15:)


exten => _1NXXNXXXXXX,15,Set(goto=$[${PRIORITY} + 15])
exten => _1NXXNXXXXXX,n,Set(thetrunk=feliciesmaty)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/[email protected]/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)



exten => _1NXXNXXXXXX,30,Set(goto=$[${PRIORITY} + 20])
exten => _1NXXNXXXXXX,n,Set(thetrunk=bettyrobertson169gmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/bettyrobertson169gmailcom/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)




exten => _1NXXNXXXXXX,50,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=swigartjosephgmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/swigartjosephgmailcom/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)



exten => _1NXXNXXXXXX,75,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=bettyrobertson169gmailcom)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/bettyrobertson169gmailcom/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)



exten => _1NXXNXXXXXX,100,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=sandralanago)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/[email protected]/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)



exten => _1NXXNXXXXXX,125,Set(goto=$[${PRIORITY} + 25])
exten => _1NXXNXXXXXX,n,Set(thetrunk=sofiadugal)
exten => _1NXXNXXXXXX,n,GotoIf($[${${thetrunk}}  > 0]?${goto})
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=1)
exten => _1NXXNXXXXXX,n,Dial(Motif/[email protected]/${EXTEN}@voice.google.com,,r)
exten => _1NXXNXXXXXX,n,Set(GLOBAL(${thetrunk})=0)
exten => _1NXXNXXXXXX,n,Verbose(0, getting staus ${DIALSTATUS} );
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "SUCCESS"]?hangup:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "FAILED"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "HANGUP"]?${goto}:)
exten => _1NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "UNKNOWN"]?${goto}:)

相关内容