Trunk Failover not Working - Help

Hi,

I have FreePBX 13.0.190.12, with the following setup:

Trunk A: International Calls - Only Outbound, set to Continue if Busy, Trunk Dial Plan=left blank.
Trunk B: National Calls - Only Outbound, not set to Continue if Busy, Trunk Dial Plan=left blank
Trunks are ordered B on top and A the next down to it. When I click the + button on Route Priority, inside each Trunk (A and B), it will show Route Priority 0 (Zero).
Outbound Route A, linked to Trunk A only, Dial Plan 00.
Outbound Route B, linked to Trunk B only, Dial Plan X.
Outbound Routes are orderered Route A on top and below it Route B.

Issue:

  1. When I dial any international number (00+country code+phone number), it will route properly through Trunk A.
  2. When I dial a local number (0+region code+phone number), it will not fail over from Trunk A to Trunk B and play the congestion message (The Number You Have Dialed in Not in Service).

Any advice is welcome! :slight_smile:

I don’t think you are having a failover problem - the way you have it above, you are selecting the trunk directly. My guess is your B trunk is actually not working - Post a Call Trace (obscure the sensitive stuff) and we can see. But your dialplan looks right to me.

1 Like

Thank you Greg.

Sorry, I am new to FreePBX. I looked for the procedure and found out this:

og in to shell…

‘asterisk -r’ this enters asterisk CLI
’core set verbose 0’ this turns dial plan logging off
’core set debug 0’ this turns system debugging off
’sip set debug ip x.x.x.x’ where x is source or destination IP you want to capture.

Now place your calls

‘sip set debug off’
‘exit’

Your capture is in var/log/asterisk/full

Where the IP number is the FreePBX IP in the network, right?

Rgs

IM

Here’s what you do.
SSH to your pbx
use the command
asterisk -cvvvvvvvr
(you want at least 3 or 4 "V"s)

Now, make a test call.
the log will scroll. Paste that log bit so we can see it. Make sure you review it and change any passwords/phone numbers. (replace it with 55555 or something)

1 Like

Thanks! Much easier! :slight_smile: Here you have the log. Dialed number in this case has 12 digits starting with 0. I replaced it by 555…

Connected to Asterisk 13.11.2 currently running on pbx (pid = 2124)
– Executing [555555555555@from-internal:1] Macro(“PJSIP/222-00000032”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“PJSIP/222-00000032”, “TOUCH_MONITOR=1486182713.50”) in new stack
– Executing [s@macro-user-callerid:2] Set(“PJSIP/222-00000032”, “AMPUSER=222”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“PJSIP/222-00000032”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“PJSIP/222-00000032”, “1?Set(REALCALLERIDNUM=222)”) in new stack
– Executing [s@macro-user-callerid:5] Set(“PJSIP/222-00000032”, “AMPUSER=222”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“PJSIP/222-00000032”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:7] Set(“PJSIP/222-00000032”, “AMPUSERCIDNAME=GGG”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“PJSIP/222-00000032”, “0?report”) in new stack
– Executing [s@macro-user-callerid:9] Set(“PJSIP/222-00000032”, “AMPUSERCID=222”) in new stack
– Executing [s@macro-user-callerid:10] Set(“PJSIP/222-00000032”, “__DIAL_OPTIONS=r”) in new stack
– Executing [s@macro-user-callerid:11] Set(“PJSIP/222-00000032”, “CALLERID(all)=“GGG” <222>”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“PJSIP/222-00000032”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:13] ExecIf(“PJSIP/222-00000032”, “1?Set(GROUP(concurrency_limit)=222)”) in new stack
– Executing [s@macro-user-callerid:14] ExecIf(“PJSIP/222-00000032”, “0?Set(CHANNEL(language)=)”) in new stack
– Executing [s@macro-user-callerid:15] GotoIf(“PJSIP/222-00000032”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,29)
– Executing [s@macro-user-callerid:29] Set(“PJSIP/222-00000032”, “CALLERID(number)=222”) in new stack
– Executing [s@macro-user-callerid:30] Set(“PJSIP/222-00000032”, “CALLERID(name)=GGG”) in new stack
– Executing [s@macro-user-callerid:31] GotoIf(“PJSIP/222-00000032”, “0?cnum”) in new stack
– Executing [s@macro-user-callerid:32] Set(“PJSIP/222-00000032”, “CDR(cnam)=GGG”) in new stack
– Executing [s@macro-user-callerid:33] Set(“PJSIP/222-00000032”, “CDR(cnum)=222”) in new stack
– Executing [s@macro-user-callerid:34] Set(“PJSIP/222-00000032”, “CHANNEL(language)=en”) in new stack
– Executing [555555555555@from-internal:2] Gosub(“PJSIP/222-00000032”, “sub-record-check,s,1(out,555555555555,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“PJSIP/222-00000032”, “0?initialized”) in new stack
– Executing [s@sub-record-check:2] Set(“PJSIP/222-00000032”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:3] Set(“PJSIP/222-00000032”, “NOW=1486182713”) in new stack
– Executing [s@sub-record-check:4] Set(“PJSIP/222-00000032”, “__DAY=04”) in new stack
– Executing [s@sub-record-check:5] Set(“PJSIP/222-00000032”, “__MONTH=02”) in new stack
– Executing [s@sub-record-check:6] Set(“PJSIP/222-00000032”, “__YEAR=2017”) in new stack
– Executing [s@sub-record-check:7] Set(“PJSIP/222-00000032”, “__TIMESTR=20170204-053153”) in new stack
– Executing [s@sub-record-check:8] Set(“PJSIP/222-00000032”, “__FROMEXTEN=222”) in new stack
– Executing [s@sub-record-check:9] Set(“PJSIP/222-00000032”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:10] NoOp(“PJSIP/222-00000032”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“PJSIP/222-00000032”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“PJSIP/222-00000032”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“PJSIP/222-00000032”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“PJSIP/222-00000032”, “3?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“PJSIP/222-00000032”, “1?sub-record-check,out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [out@sub-record-check:1] NoOp(“PJSIP/222-00000032”, “Outbound Recording Check from 222 to 555555555555”) in new stack
– Executing [out@sub-record-check:2] Set(“PJSIP/222-00000032”, “RECMODE=dontcare”) in new stack
– Executing [out@sub-record-check:3] ExecIf(“PJSIP/222-00000032”, “1?Goto(routewins)”) in new stack
– Goto (sub-record-check,out,7)
– Executing [out@sub-record-check:7] Gosub(“PJSIP/222-00000032”, “recordcheck,1(dontcare,out,555555555555)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“PJSIP/222-00000032”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“PJSIP/222-00000032”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“PJSIP/222-00000032”, “”) in new stack
– Executing [out@sub-record-check:8] Return(“PJSIP/222-00000032”, “”) in new stack
– Executing [555555555555@from-internal:3] ExecIf(“PJSIP/222-00000032”, “0 ?Set(CDR(accountcode)=)”) in new stack
– Executing [555555555555@from-internal:4] Set(“PJSIP/222-00000032”, “MOHCLASS=default”) in new stack
– Executing [555555555555@from-internal:5] ExecIf(“PJSIP/222-00000032”, “0?Set(TRUNKCIDOVERRIDE=06132977197)”) in new stack
– Executing [555555555555@from-internal:6] Set(“PJSIP/222-00000032”, “_NODEST=”) in new stack
– Executing [555555555555@from-internal:7] Macro(“PJSIP/222-00000032”, “dialout-trunk,1,555555555555,off”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“PJSIP/222-00000032”, “DIAL_TRUNK=1”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“PJSIP/222-00000032”, “0?sub-pincheck,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“PJSIP/222-00000032”, “0?disabletrunk,1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“PJSIP/222-00000032”, “DIAL_NUMBER=555555555555”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“PJSIP/222-00000032”, “DIAL_TRUNK_OPTIONS=r”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“PJSIP/222-00000032”, “OUTBOUND_GROUP=OUT_1”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“PJSIP/222-00000032”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“PJSIP/222-00000032”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“PJSIP/222-00000032”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“PJSIP/222-00000032”, “outbound-callerid,1”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“PJSIP/222-00000032”, “0?Set(CALLERPRES(name-pres)=)”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“PJSIP/222-00000032”, “0?Set(CALLERPRES(num-pres)=)”) in new stack
– Executing [s@macro-outbound-callerid:3] ExecIf(“PJSIP/222-00000032”, “0?Set(REALCALLERIDNUM=222)”) in new stack
– Executing [s@macro-outbound-callerid:4] GotoIf(“PJSIP/222-00000032”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,7)
– Executing [s@macro-outbound-callerid:7] Set(“PJSIP/222-00000032”, “USEROUTCID=+496132977197”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“PJSIP/222-00000032”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:9] Set(“PJSIP/222-00000032”, “TRUNKOUTCID=06132977197”) in new stack
– Executing [s@macro-outbound-callerid:10] GotoIf(“PJSIP/222-00000032”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,15)
– Executing [s@macro-outbound-callerid:15] ExecIf(“PJSIP/222-00000032”, “1?Set(CALLERID(all)=06132977197)”) in new stack
– Executing [s@macro-outbound-callerid:16] ExecIf(“PJSIP/222-00000032”, “1?Set(CALLERID(all)=+496132977197)”) in new stack
– Executing [s@macro-outbound-callerid:17] ExecIf(“PJSIP/222-00000032”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:18] ExecIf(“PJSIP/222-00000032”, “0?Set(CALLERPRES(name-pres)=prohib_passed_screen)”) in new stack
– Executing [s@macro-outbound-callerid:19] ExecIf(“PJSIP/222-00000032”, “0?Set(CALLERPRES(num-pres)=prohib_passed_screen)”) in new stack
– Executing [s@macro-outbound-callerid:20] Set(“PJSIP/222-00000032”, “CDR(outbound_cnum)=+496132977197”) in new stack
– Executing [s@macro-outbound-callerid:21] Set(“PJSIP/222-00000032”, “CDR(outbound_cnam)=”) in new stack
[2017-02-04 05:31:53] WARNING[2156]: func_cdr.c:377 cdr_write_callback: CDR requires a value (CDR(variable)=value)
– Executing [s@macro-dialout-trunk:12] GosubIf(“PJSIP/222-00000032”, “0?sub-flp-1,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“PJSIP/222-00000032”, “OUTNUM=555555555555”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“PJSIP/222-00000032”, “custom=PJSIP”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“PJSIP/222-00000032”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))”) in new stack
– Executing [s@macro-dialout-trunk:16] ExecIf(“PJSIP/222-00000032”, “0?Set(DIAL_TRUNK_OPTIONS=M(confirm))”) in new stack
– Executing [s@macro-dialout-trunk:17] Macro(“PJSIP/222-00000032”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“PJSIP/222-00000032”, “”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“PJSIP/222-00000032”, “0?bypass,1”) in new stack
– Executing [s@macro-dialout-trunk:19] ExecIf(“PJSIP/222-00000032”, “1?Set(CONNECTEDLINE(num,i)=555555555555)”) in new stack
– Executing [s@macro-dialout-trunk:20] ExecIf(“PJSIP/222-00000032”, “1?Set(CONNECTEDLINE(name,i)=CID:+496132977197)”) in new stack
– Executing [s@macro-dialout-trunk:21] ExecIf(“PJSIP/222-00000032”, “0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)+496132977197)”) in new stack
– Executing [s@macro-dialout-trunk:22] GotoIf(“PJSIP/222-00000032”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:23] Dial(“PJSIP/222-00000032”, “PJSIP/555555555555@FB622-977197-InOut,300,”) in new stack
– Called PJSIP/555555555555@FB622-977197-InOut
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:24] NoOp(“PJSIP/222-00000032”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 1”) in new stack
– Executing [s@macro-dialout-trunk:25] GotoIf(“PJSIP/222-00000032”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set(“PJSIP/222-00000032”, “RC=1”) in new stack
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto(“PJSIP/222-00000032”, “1,1”) in new stack
– Goto (macro-dialout-trunk,1,1)
– Executing [1@macro-dialout-trunk:1] Goto(“PJSIP/222-00000032”, “s-INVALIDNMBR,1”) in new stack
– Goto (macro-dialout-trunk,s-INVALIDNMBR,1)
– Executing [s-INVALIDNMBR@macro-dialout-trunk:1] NoOp(“PJSIP/222-00000032”, “Dial failed due to trunk reporting Address Incomplete - giving up”) in new stack
– Executing [s-INVALIDNMBR@macro-dialout-trunk:2] Progress(“PJSIP/222-00000032”, “”) in new stack
– Executing [s-INVALIDNMBR@macro-dialout-trunk:3] Playback(“PJSIP/222-00000032”, “ss-noservice,noanswer”) in new stack
– <PJSIP/222-00000032> Playing ‘ss-noservice.ulaw’ (language ‘en’)
> 0x7fd0cc915a10 – Probation passed - setting RTP source address to 192.168.178.31:18862
– Executing [s-INVALIDNMBR@macro-dialout-trunk:4] Busy(“PJSIP/222-00000032”, “20”) in new stack
== Spawn extension (macro-dialout-trunk, s-INVALIDNMBR, 4) exited non-zero on ‘PJSIP/222-00000032’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 555555555555, 7) exited non-zero on ‘PJSIP/222-00000032’
– Executing [h@from-internal:1] Macro(“PJSIP/222-00000032”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“PJSIP/222-00000032”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“PJSIP/222-00000032”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] Hangup(“PJSIP/222-00000032”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘PJSIP/222-00000032’ in macro ‘hangupcall’
== Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/222-00000032’
pbx*CLI>

Yes your trunk to your provider is not configured properly.
This could be any number of reasons from just a goofed up config to a bad password or anything in between.

Executing [s@macro-dialout-trunk:23] Dial(“PJSIP/222-00000032”, “PJSIP/555555555555@FB622-977197-InOut,300,”) in new stack
– Called PJSIP/555555555555@FB622-977197-InOut
== Everyone is busy/congested at this time (1:0/0/1)

1 Like

@dickson didn’t point it out, but this is the indication that trunk failover is actually working just fine.

1 Like

Many thanks Dickson and Cynjut. I will delete the trunk and set it again. I keep you posted about the results. :slight_smile:

Thank you all! That was indeed a trunk authentication problem. Issue solved. Many thanks!