Macro-trunkdial-failover-0.3 not behaving as expected

Dear All,

I’m running asterisk on a QNAP TS-119 NAS (ARM CPU). I’ve used the asterisk-gui - 2.0.4-1 for configuration.

I’ve configured the system to use an FXO gateway as primary trunk and a GSM gateway as fallback through the GUI. However, it’s not behaving as I’d expect: If a user makes a call (which goes through the FXO gateway, as it’s the default GW) and a second user dials a number, the second user gets a busy signal.

Here is the log of the second call attempt (coming from extension 14 trying to call 12345678):

-- Executing [12345678@DLPN_MiADialplan:1] Macro("SIP/14-0000058c", "trunkdial-failover-0.3,SIP/trunk_3/123456778,SIP/trunk_1/123456778,trunk_3,trunk_1") in new stack -- Executing [s@macro-trunkdial-failover-0.3:1] GotoIf("SIP/14-0000058c", "0?1-fmsetcid,1") in new stack -- Executing [s@macro-trunkdial-failover-0.3:2] GotoIf("SIP/14-0000058c", "0?1-setgbobname,1") in new stack -- Executing [s@macro-trunkdial-failover-0.3:3] Set("SIP/14-0000058c", "CALLERID(num)=") in new stack -- Executing [s@macro-trunkdial-failover-0.3:4] GotoIf("SIP/14-0000058c", "0?1-dial,1") in new stack -- Executing [s@macro-trunkdial-failover-0.3:5] Set("SIP/14-0000058c", "CALLERID(all)=") in new stack -- Executing [s@macro-trunkdial-failover-0.3:6] Goto("SIP/14-0000058c", "1-dial,1") in new stack -- Goto (macro-trunkdial-failover-0.3,1-dial,1) -- Executing [1-dial@macro-trunkdial-failover-0.3:1] Dial("SIP/14-0000058c", "SIP/trunk_3/123456778") in new stack == Using SIP RTP CoS mark 5 -- Called trunk_3/123456778 -- Got SIP response 486 "Busy here" back from -- SIP/trunk_3-0000058d is busy == Everyone is busy/congested at this time (1:1/0/0) is my FXO gatweay and so is trunk_3
It should use trunk_1 (GSM)

While digging around, I found the code for the macro-trunkdial-failover-0.3 in /etc/asterisk/extensions.conf. This is it’s code:

[macro-trunkdial-failover-0.3] exten = s,1,GotoIf($[${LEN(${FMCIDNUM})} > 6]?1-fmsetcid,1) exten = s,2,GotoIf($[${LEN(${GLOBAL_OUTBOUNDCIDNAME})} > 1]?1-setgbobname,1) exten = s,3,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} > 2]?${CID_${CALLERID(num)}}:)}) exten = s,n,GotoIf($[${LEN(${CALLERID(num)})} > 6]?1-dial,1) exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${CID_${ARG3}})} > 6]?${CID_${ARG3}}:${GLOBAL_OUTBOUNDCID})}) exten = s,n,Goto(1-dial,1) exten = 1-setgbobname,1,Set(CALLERID(name)=${GLOBAL_OUTBOUNDCIDNAME}) exten = 1-setgbobname,n,Goto(s,3) exten = 1-fmsetcid,1,Set(CALLERID(num)=${FMCIDNUM}) exten = 1-fmsetcid,n,Set(CALLERID(name)=${FMCIDNAME}) exten = 1-fmsetcid,n,Goto(1-dial,1) exten = 1-dial,1,Dial(${ARG1}) exten = 1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1) exten = 1-CHANUNAVAIL,1,Dial(${ARG2}) exten = 1-CHANUNAVAIL,n,Hangup() exten = 1-CONGESTION,1,Dial(${ARG2}) exten = 1-CONGESTION,n,Hangup() exten = 1-out,1,Hangup()

This is my outgoing call route

I’m not very proficient at reading this. However, it seems to me like the lines at the end say that the if the channel is unavailable use ${ARG2} which would be the failover trunk - i.e. trunk_1 / the GSM gateway.

exten = 1-CHANUNAVAIL,1,Dial(${ARG2}) exten = 1-CHANUNAVAIL,n,Hangup()

However, that’s not the case. Can anyone tell me what’s going wrong here ?


This is part of one of the GUIs, not part of Asterisk itself.

ok… Are you suggesting this post is in the wrong section ?