[Asterisk-Users] NuFone + VoIPJet = busy busy busy

Cirelle Internet Products gcirino at cirelle.com
Wed Mar 9 13:59:25 MST 2005


Andrew Kohlsmith wrote:

>On March 9, 2005 10:43 am, Cirelle Internet Products wrote:
>  
>
>>How are you determining a fallback condition from one voip to another?
>>    
>>
>
>Mine's rather simple but it works well:
>
>[macro-nufone-dial]
>exten => s,1,GotoIf($[$ACCOUNTCODE != ""],s,gotac)
>exten => s,n,SetVar(ACCOUNTCODE=${ARG2})
>exten => s,n,GotoIf($[{$ARG2} != ""],s,gotac)
>exten => s,n,SetVar(ACCOUNTCODE=benshaw)
>exten => s,n(gotac),SetAccount(${ACCOUNTCODE})
>exten => s,n,GotoIf($[${LEN(${ARG1})} = 10]?s,add1)
>exten => s,n,Dial(IAX2/USER at nufone/${ARG1},,g)
>exten => s,n,NoOp(NUFONE: HANGUPCAUSE is ${HANGUPCAUSE} and DIALSTATUS is 
>${DIALSTATUS})
>exten => s,n,Goto(dial-${DIALSTATUS},1)
>exten => s,n(add1),Dial(IAX2/USER at nufone/1${ARG1},,g)
>exten => s,n,NoOp(NUFONE: HANGUPCAUSE is ${HANGUPCAUSE} and DIALSTATUS is 
>${DIALSTATUS})
>exten => s,n,Goto(dial-${DIALSTATUS},1)
>
>exten => dial-CANCEL,1,Hangup
>exten => dial-ANSWER,1,Hangup
>exten => dial-NOANSWER,1,Hangup
>exten => dial-BUSY,1,Busy
>exten => dial-CONGESTION,1,Macro(pri-dial,${ARG1},${ARG2})
>exten => dial-CHANUNAVAIL,1,Macro(pri-dial,${ARG1},${ARG2})
>
>; handle NXX-NXX-XXXX, 1-NXX-NXX-XXXX and 011...
>[nufone]
>exten => _NXXNXXXXXX,1,Macro(nufone-dial,${EXTEN})
>exten => _1NXXNXXXXXX,1,Macro(nufone-dial,${EXTEN:1})
>exten => _011.,1,Macro(nufone-dial,${EXTEN})
>
>You can ignore the accountcode stuff, we handle calls for several businesses 
>so I sort the accounting out that way.  
>
>For contexts that I want to have calls go out to Nufone I include the 'nufone' 
>context.  As you can see, it handles 10-digit, 11-digit and international 
>(variable-digit) extensions.
>
>Basically if it's a 10-digit #, add a '1' to it.  Then attempt to Dial() 
>through my Nufone account.  You'll notice the 'g' flag to the Dial() 
>application which tells it to go on in context after a hangup.  I then check 
>the status of DIALSTATUS and if the result was CONGESTION or CHANUNAVAIL I 
>fall back and dial out my PRI.
>
>Personally I think that CONGESTION should never be returned unless the other 
>side SAYS "piss off, I'm too busy to handle your call" but IAX will throw 
>back a CONGESTION status if it can't reach the other side, which is why I 
>have to check for both CONGESTION and CHANUNAVAIL.
>
>-A.
>  
>
Thanx Andrew

greg



More information about the asterisk-users mailing list