[Asterisk-Users] SIP trunk rollover problem

Chris Miller asterisk at scratchspace.com
Wed Aug 24 20:33:38 MST 2005


Hello,
	I've got an Asterisk system with 3 SIP trunks configured. Each SIP 
trunk is actually a 4 port Mediatrix PSTN gateway. The current outbound 
call routing (via AMP 1.10.007a) uses the 3 trunks in descending order, 
all set with max channels to 4. Unfortunately, when the first trunk 
reports a "480 Service Unavailable" (all ports in use), Asterisk reports 
congestion without rolling to the next available trunk.

	I've looked at the AMP dialplan on this system, as well as a more 
recent system (1.10.009beta1), and although the dialplan has been 
improved, it still doesn't seem to account for this condition. As you 
can see below at step 7, if the max channels have been used on the 
current trunk, the call fails.

	What is the correct way to do fail over between trunks, and in an AMP 
friendly way that won't get clobbered during the next config change?

Regards,
	Chris

[macro-dialout-trunk]
exten => s,1,GotoIf($[foo${ARG3} = foo]?3:2))   ; arg3 is pattern password
exten => s,2,Authenticate(${ARG3})
exten => s,3,Macro(user-callerid)
exten => s,4,Macro(record-enable,${CALLERIDNUM},OUT)
exten => s,5,Macro(outbound-callerid,${ARG1})
exten => s,6,SetGroup(OUT_${ARG1})
exten => s,7,CheckGroup(${OUTMAXCHANS_${ARG1}})
; if we've used up the max channels, continue at 110 (n+101)
exten => s,8,SetVar(DIAL_NUMBER=${ARG2})
exten => s,9,SetVar(DIAL_TRUNK=${ARG1})
exten => s,10,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper 
dial string for this trunk
exten => s,11,SetVar(OUTNUM=${OUTPREFIX_${ARG1}}${DIAL_NUMBER})  ; 
OUTNUM is the final dial number
exten => s,12,Cut(custom=OUT_${ARG1},:,1)  ; Custom trunks are prefixed 
with "AMP:"
exten => s,13,GotoIf($[${custom} = AMP]?16)
exten => s,14,Dial(${OUT_${ARG1}}/${OUTNUM})  ; Regular Trunk Dial
exten => s,15,Goto(s-${DIALSTATUS},1)

exten => s,110,Noop(max channels used up)
exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})



More information about the asterisk-users mailing list