IAX2 trunk connected but not passing calls

I have two FreePBX systems (one Distro 13 and the other on CentOS running 13)
I’ve setup two IAX2 trunks

Internal PBX (Distro)
Trunk Name: azsc-tie

host=xxxx
username=6301pbx
secret=xxxx
type=peer
qualify=yes
trunk=yes
insecure=port,invite
context=from-internal
auth=md5
requirecalltoken=no

Cloud PBX (CentOS FreePBX 13)
Trunk Name: 6301pbx

host=xxxx
username=azsc-tie
secret=xxxx
type=peer
qualify=yes
trunk=yes
insecure=port,invite
context=from-internal
auth=md5
requirecalltoken=no

I’m seeing the trunks connected:

iax2 show peers
Name/Username Host Mask Port Status Description
azsc-tie/6301pb 10.30.3.52 (S) 255.255.255.255 4569 (T) OK (13 ms)
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

and I have outgoing routes on both taking calls that match extension numbers on the opposite systems and push them down the IAX trunks.

I have no specific incoming routes since it’s just for station-to-station calling.

If I test calling one system to the other I get a busy/congestion message and I’m not seeing any activity on the other system’s console. Same behavior on both systems.

Executing [s@macro-dialout-trunk:23] Dial(“SIP/6000-0000000a”, “IAX2/6301tie/5331,300,T”) in new stack
– Called IAX2/6301tie/5331
– Hungup ‘IAX2/6301tie-22104’
== Everyone is busy/congested at this time (1:0/0/1)

These systems are appearing internal to each other and don’t have any external firewalls blocking. (internal IP connectivity only)

It almost appears that they trunks are not connected even though the IAX2 show peers indicates that they are.

I had these system half connected with SIP and was getting calls back and forth that way. Just can’t seam to get the same results with IAX.

You still need inbound and outbound routes.

As I stated there is already outbound routes for the 4 digit dial patterns sending those calls down the IAX trunks.

I make a test inbound route anyway for the DID 6000 going to extension 6000 but it’s still behaving the same.

OK, you’ve been here long enough to know the logs will tell you what the problem is.

We need to see the call in the logs from the receiving system, at the very least. Both would provide a complete view and would also probably give you the answer before you even get a chance to post them.

yeah, and that’s why i’m thinking i have something misconfigured. As i said regarding the receiving side " I’m not seeing any activity on the other system’s console" This is happening in either direction. Log detail is generated on the side i’m placing the call but nothing on the opposite end.

Here is the complete log on the sending side, this from the “remote” system.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [5331@from-internal:1] Macro(“SIP/6000-0000000c”, “user-callerid,LIMIT”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/6000-0000000c”, “TOUCH_MONITOR=1497464457.18”) in new stack
– Executing [s@macro-user-callerid:2] Set(“SIP/6000-0000000c”, “AMPUSER=6000”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“SIP/6000-0000000c”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“SIP/6000-0000000c”, “1?Set(REALCALLERIDNUM=6000)”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/6000-0000000c”, “AMPUSER=6000”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/6000-0000000c”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/6000-0000000c”, “AMPUSERCIDNAME=Cloud”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“SIP/6000-0000000c”, “0?report”) in new stack
– Executing [s@macro-user-callerid:9] Set(“SIP/6000-0000000c”, “AMPUSERCID=6000”) in new stack
– Executing [s@macro-user-callerid:10] Set(“SIP/6000-0000000c”, “__DIAL_OPTIONS=Ttr”) in new stack
– Executing [s@macro-user-callerid:11] Set(“SIP/6000-0000000c”, “CALLERID(all)=“Cloud” <6000>”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“SIP/6000-0000000c”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:13] ExecIf(“SIP/6000-0000000c”, “1?Set(GROUP(concurrency_limit)=6000)”) in new stack
– Executing [s@macro-user-callerid:14] GotoIf(“SIP/6000-0000000c”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,27)
– Executing [s@macro-user-callerid:27] Set(“SIP/6000-0000000c”, “CALLERID(number)=6000”) in new stack
– Executing [s@macro-user-callerid:28] Set(“SIP/6000-0000000c”, “CALLERID(name)=Cloud”) in new stack
– Executing [s@macro-user-callerid:29] GotoIf(“SIP/6000-0000000c”, “0?cnum”) in new stack
– Executing [s@macro-user-callerid:30] Set(“SIP/6000-0000000c”, “CDR(cnam)=Cloud”) in new stack
– Executing [s@macro-user-callerid:31] Set(“SIP/6000-0000000c”, “CDR(cnum)=6000”) in new stack
– Executing [s@macro-user-callerid:32] Set(“SIP/6000-0000000c”, “CHANNEL(language)=en”) in new stack
– Executing [s@macro-user-callerid:33] GosubIf(“SIP/6000-0000000c”, “0?app-check-classofservce,s,1()”) in new stack
– Executing [5331@from-internal:2] Set(“SIP/6000-0000000c”, “ROUTEUSER=6000”) in new stack
– Executing [5331@from-internal:3] GotoIf(“SIP/6000-0000000c”, “1?notblind”) in new stack
– Goto (from-internal,5331,6)
– Executing [5331@from-internal:6] GotoIf(“SIP/6000-0000000c”, “1?restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2:outbound-allroutes,5331,2”) in new stack
– Goto (restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2)
– Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:2] Gosub(“SIP/6000-0000000c”, “sub-record-check,s,1(out,5331,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“SIP/6000-0000000c”, “0?initialized”) in new stack
– Executing [s@sub-record-check:2] Set(“SIP/6000-0000000c”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:3] Set(“SIP/6000-0000000c”, “NOW=1497464457”) in new stack
– Executing [s@sub-record-check:4] Set(“SIP/6000-0000000c”, “__DAY=14”) in new stack
– Executing [s@sub-record-check:5] Set(“SIP/6000-0000000c”, “__MONTH=06”) in new stack
– Executing [s@sub-record-check:6] Set(“SIP/6000-0000000c”, “__YEAR=2017”) in new stack
– Executing [s@sub-record-check:7] Set(“SIP/6000-0000000c”, “__TIMESTR=20170614-132057”) in new stack
– Executing [s@sub-record-check:8] Set(“SIP/6000-0000000c”, “__FROMEXTEN=6000”) in new stack
– Executing [s@sub-record-check:9] Set(“SIP/6000-0000000c”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:10] NoOp(“SIP/6000-0000000c”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“SIP/6000-0000000c”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“SIP/6000-0000000c”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“SIP/6000-0000000c”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“SIP/6000-0000000c”, “3?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“SIP/6000-0000000c”, “1?sub-record-check,out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [out@sub-record-check:1] NoOp(“SIP/6000-0000000c”, “Outbound Recording Check from 6000 to 5331”) in new stack
– Executing [out@sub-record-check:2] Set(“SIP/6000-0000000c”, “RECMODE=dontcare”) in new stack
– Executing [out@sub-record-check:3] ExecIf(“SIP/6000-0000000c”, “1?Goto(routewins)”) in new stack
– Goto (sub-record-check,out,7)
– Executing [out@sub-record-check:7] Gosub(“SIP/6000-0000000c”, “recordcheck,1(dontcare,out,5331)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“SIP/6000-0000000c”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“SIP/6000-0000000c”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“SIP/6000-0000000c”, “”) in new stack
– Executing [out@sub-record-check:8] Return(“SIP/6000-0000000c”, “”) in new stack
– Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:3] Set(“SIP/6000-0000000c”, “MOHCLASS=default”) in new stack
– Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:4] Set(“SIP/6000-0000000c”, “_NODEST=”) in new stack
– Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:5] Macro(“SIP/6000-0000000c”, “dialout-trunk,1,5331,off”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/6000-0000000c”, “DIAL_TRUNK=1”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/6000-0000000c”, “0?sub-pincheck,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/6000-0000000c”, “0?disabletrunk,1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/6000-0000000c”, “DIAL_NUMBER=5331”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/6000-0000000c”, “DIAL_TRUNK_OPTIONS=Ttr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/6000-0000000c”, “OUTBOUND_GROUP=OUT_1”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/6000-0000000c”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/6000-0000000c”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/6000-0000000c”, “DIAL_TRUNK_OPTIONS=T”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/6000-0000000c”, “outbound-callerid,1”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERPRES(name-pres)=)”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERPRES(num-pres)=)”) in new stack
– Executing [s@macro-outbound-callerid:3] ExecIf(“SIP/6000-0000000c”, “0?Set(REALCALLERIDNUM=6000)”) in new stack
– Executing [s@macro-outbound-callerid:4] GotoIf(“SIP/6000-0000000c”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,7)
– Executing [s@macro-outbound-callerid:7] Set(“SIP/6000-0000000c”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/6000-0000000c”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:9] Set(“SIP/6000-0000000c”, “TRUNKOUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:10] GotoIf(“SIP/6000-0000000c”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,15)
– Executing [s@macro-outbound-callerid:15] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:16] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:17] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:18] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERPRES(name-pres)=prohib_passed_screen)”) in new stack
– Executing [s@macro-outbound-callerid:19] ExecIf(“SIP/6000-0000000c”, “0?Set(CALLERPRES(num-pres)=prohib_passed_screen)”) in new stack
– Executing [s@macro-outbound-callerid:20] Set(“SIP/6000-0000000c”, “CDR(outbound_cnum)=6000”) in new stack
– Executing [s@macro-outbound-callerid:21] Set(“SIP/6000-0000000c”, “CDR(outbound_cnam)=Cloud”) in new stack
– Executing [s@macro-dialout-trunk:12] GosubIf(“SIP/6000-0000000c”, “0?sub-flp-1,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/6000-0000000c”, “OUTNUM=5331”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/6000-0000000c”, “custom=IAX2/6301tie”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/6000-0000000c”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)”) in new stack
– Executing [s@macro-dialout-trunk:16] ExecIf(“SIP/6000-0000000c”, “0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))”) in new stack
– Executing [s@macro-dialout-trunk:17] Macro(“SIP/6000-0000000c”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/6000-0000000c”, “”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/6000-0000000c”, “0?bypass,1”) in new stack
– Executing [s@macro-dialout-trunk:19] ExecIf(“SIP/6000-0000000c”, “1?Set(CONNECTEDLINE(num,i)=5331)”) in new stack
– Executing [s@macro-dialout-trunk:20] ExecIf(“SIP/6000-0000000c”, “1?Set(CONNECTEDLINE(name,i)=CID:6000)”) in new stack
– Executing [s@macro-dialout-trunk:21] ExecIf(“SIP/6000-0000000c”, “0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)6000)”) in new stack
– Executing [s@macro-dialout-trunk:22] GotoIf(“SIP/6000-0000000c”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:23] Dial(“SIP/6000-0000000c”, “IAX2/6301tie/5331,300,T”) in new stack
– Called IAX2/6301tie/5331
– Hungup ‘IAX2/6301tie-21845’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:24] NoOp(“SIP/6000-0000000c”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 50”) in new stack
– Executing [s@macro-dialout-trunk:25] GotoIf(“SIP/6000-0000000c”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set(“SIP/6000-0000000c”, “RC=50”) in new stack
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto(“SIP/6000-0000000c”, “50,1”) in new stack
– Goto (macro-dialout-trunk,50,1)
– Executing [50@macro-dialout-trunk:1] Goto(“SIP/6000-0000000c”, “continue,1”) in new stack
– Goto (macro-dialout-trunk,continue,1)
– Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/6000-0000000c”, “TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 50 - failing through to other trunks”) in new stack
– Executing [continue@macro-dialout-trunk:2] ExecIf(“SIP/6000-0000000c”, “1?Set(CALLERID(number)=6000)”) in new stack
– Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:6] Macro(“SIP/6000-0000000c”, “outisbusy,”) in new stack
– Executing [s@macro-outisbusy:1] Progress(“SIP/6000-0000000c”, “”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“SIP/6000-0000000c”, “0?emergency,1”) in new stack
– Executing [s@macro-outisbusy:3] GotoIf(“SIP/6000-0000000c”, “0?intracompany,1”) in new stack
– Executing [s@macro-outisbusy:4] Playback(“SIP/6000-0000000c”, “all-circuits-busy-now&please-try-call-later, noanswer”) in new stack
– <SIP/6000-0000000c> Playing ‘all-circuits-busy-now.g722’ (language ‘en’)
> 0x7fa0c40210d0 – Probation passed - setting RTP source address to 12.246.227.38:10875
– <SIP/6000-0000000c> Playing ‘please-try-call-later.g722’ (language ‘en’)
– Executing [s@macro-outisbusy:5] Congestion(“SIP/6000-0000000c”, “20”) in new stack
[2017-06-14 13:21:02] WARNING[34889][C-0000000a]: channel.c:4991 ast_prod: Prodding channel ‘SIP/6000-0000000c’ failed
== Spawn extension (macro-outisbusy, s, 5) exited non-zero on ‘SIP/6000-0000000c’ in macro ‘outisbusy’
== Spawn extension (restrictedroute-c4ca4238a0b923820dcc509a6f75849b, 5331, 6) exited non-zero on ‘SIP/6000-0000000c’
– Executing [h@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:1] Hangup(“SIP/6000-0000000c”, “”) in new stack
== Spawn extension (restrictedroute-c4ca4238a0b923820dcc509a6f75849b, h, 1) exited non-zero on ‘SIP/6000-0000000c’

Firewall? Enable IAX2? there should be an IAX2 DEBUG command.

Good idea. Turned it on and found
CAUSE : No authority found
CAUSE CODE : 50
I wonder if i have a registration probably even though it’s show that the IAX connection is up.

Complete Log:

pbx1*CLI> iax2 set debug peer 6301tie 
IAX2 Debugging Enabled for IP: 4569
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [5331@from-internal:1] Macro("SIP/6000-00000017", "user-callerid,LIMIT") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/6000-00000017", "TOUCH_MONITOR=1497467037.40") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/6000-00000017", "AMPUSER=6000") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/6000-00000017", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/6000-00000017", "1?Set(REALCALLERIDNUM=6000)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/6000-00000017", "AMPUSER=6000") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/6000-00000017", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/6000-00000017", "AMPUSERCIDNAME=Cloud") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("SIP/6000-00000017", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/6000-00000017", "AMPUSERCID=6000") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/6000-00000017", "__DIAL_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/6000-00000017", "CALLERID(all)="Cloud" <6000>") in new stack
    -- Executing [s@macro-user-callerid:12] GotoIf("SIP/6000-00000017", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:13] ExecIf("SIP/6000-00000017", "1?Set(GROUP(concurrency_limit)=6000)") in new stack
    -- Executing [s@macro-user-callerid:14] GotoIf("SIP/6000-00000017", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,27)
    -- Executing [s@macro-user-callerid:27] Set("SIP/6000-00000017", "CALLERID(number)=6000") in new stack
    -- Executing [s@macro-user-callerid:28] Set("SIP/6000-00000017", "CALLERID(name)=Cloud") in new stack
    -- Executing [s@macro-user-callerid:29] GotoIf("SIP/6000-00000017", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:30] Set("SIP/6000-00000017", "CDR(cnam)=Cloud") in new stack
    -- Executing [s@macro-user-callerid:31] Set("SIP/6000-00000017", "CDR(cnum)=6000") in new stack
    -- Executing [s@macro-user-callerid:32] Set("SIP/6000-00000017", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:33] GosubIf("SIP/6000-00000017", "0?app-check-classofservce,s,1()") in new stack
    -- Executing [5331@from-internal:2] Set("SIP/6000-00000017", "ROUTEUSER=6000") in new stack
    -- Executing [5331@from-internal:3] GotoIf("SIP/6000-00000017", "1?notblind") in new stack
    -- Goto (from-internal,5331,6)
    -- Executing [5331@from-internal:6] GotoIf("SIP/6000-00000017", "1?restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2:outbound-allroutes,5331,2") in new stack
    -- Goto (restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2)
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:2] Gosub("SIP/6000-00000017", "sub-record-check,s,1(out,5331,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("SIP/6000-00000017", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("SIP/6000-00000017", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("SIP/6000-00000017", "NOW=1497467037") in new stack
    -- Executing [s@sub-record-check:4] Set("SIP/6000-00000017", "__DAY=14") in new stack
    -- Executing [s@sub-record-check:5] Set("SIP/6000-00000017", "__MONTH=06") in new stack
    -- Executing [s@sub-record-check:6] Set("SIP/6000-00000017", "__YEAR=2017") in new stack
    -- Executing [s@sub-record-check:7] Set("SIP/6000-00000017", "__TIMESTR=20170614-140357") in new stack
    -- Executing [s@sub-record-check:8] Set("SIP/6000-00000017", "__FROMEXTEN=6000") in new stack
    -- Executing [s@sub-record-check:9] Set("SIP/6000-00000017", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("SIP/6000-00000017", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("SIP/6000-00000017", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("SIP/6000-00000017", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("SIP/6000-00000017", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("SIP/6000-00000017", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("SIP/6000-00000017", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("SIP/6000-00000017", "Outbound Recording Check from 6000 to 5331") in new stack
    -- Executing [out@sub-record-check:2] Set("SIP/6000-00000017", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("SIP/6000-00000017", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("SIP/6000-00000017", "recordcheck,1(dontcare,out,5331)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("SIP/6000-00000017", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("SIP/6000-00000017", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("SIP/6000-00000017", "") in new stack
    -- Executing [out@sub-record-check:8] Return("SIP/6000-00000017", "") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:3] Set("SIP/6000-00000017", "MOHCLASS=default") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:4] Set("SIP/6000-00000017", "_NODEST=") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:5] Macro("SIP/6000-00000017", "dialout-trunk,1,5331,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/6000-00000017", "DIAL_TRUNK=1") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/6000-00000017", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/6000-00000017", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/6000-00000017", "DIAL_NUMBER=5331") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/6000-00000017", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/6000-00000017", "OUTBOUND_GROUP=OUT_1") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/6000-00000017", "0?nomax") in new stack
    -- Executing [s@macro-dialout-trunk:8] GotoIf("SIP/6000-00000017", "0?chanfull") in new stack
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/6000-00000017", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("SIP/6000-00000017", "DIAL_TRUNK_OPTIONS=T") in new stack
    -- Executing [s@macro-dialout-trunk:11] Macro("SIP/6000-00000017", "outbound-callerid,1") in new stack
    -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/6000-00000017", "0?Set(CALLERPRES(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/6000-00000017", "0?Set(CALLERPRES(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:3] ExecIf("SIP/6000-00000017", "0?Set(REALCALLERIDNUM=6000)") in new stack
    -- Executing [s@macro-outbound-callerid:4] GotoIf("SIP/6000-00000017", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,7)
    -- Executing [s@macro-outbound-callerid:7] Set("SIP/6000-00000017", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("SIP/6000-00000017", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:9] Set("SIP/6000-00000017", "TRUNKOUTCID=4693245400") in new stack
    -- Executing [s@macro-outbound-callerid:10] GotoIf("SIP/6000-00000017", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,15)
    -- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/6000-00000017", "1?Set(CALLERID(all)=4693245400)") in new stack
    -- Executing [s@macro-outbound-callerid:16] ExecIf("SIP/6000-00000017", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:17] ExecIf("SIP/6000-00000017", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:18] ExecIf("SIP/6000-00000017", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:19] ExecIf("SIP/6000-00000017", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:20] Set("SIP/6000-00000017", "CDR(outbound_cnum)=4693245400") in new stack
    -- Executing [s@macro-outbound-callerid:21] Set("SIP/6000-00000017", "CDR(outbound_cnam)=") in new stack
[2017-06-14 14:03:57] WARNING[15641]: func_cdr.c:383 cdr_write_callback: CDR requires a value (CDR(variable)=value)
    -- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/6000-00000017", "0?sub-flp-1,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/6000-00000017", "OUTNUM=5331") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/6000-00000017", "custom=IAX2/6301tie") in new stack
    -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/6000-00000017", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/6000-00000017", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:17] Macro("SIP/6000-00000017", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/6000-00000017", "") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/6000-00000017", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/6000-00000017", "1?Set(CONNECTEDLINE(num,i)=5331)") in new stack
    -- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/6000-00000017", "1?Set(CONNECTEDLINE(name,i)=CID:4693245400)") in new stack
    -- Executing [s@macro-dialout-trunk:21] ExecIf("SIP/6000-00000017", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)4693245400)") in new stack
    -- Executing [s@macro-dialout-trunk:22] GotoIf("SIP/6000-00000017", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:23] Dial("SIP/6000-00000017", "IAX2/6301tie/5331,300,T") in new stack
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00003ms  SCall: 25647  DCall: 00000 10.255.100.230:4569
   VERSION         : 2
   CALLED NUMBER   : 5331
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 4693245400
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : 
   LANGUAGE        : en
   USERNAME        : azsc-tie
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  14:03:56

    -- Called IAX2/6301tie/5331
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN 
   Timestamp: 00003ms  SCall: 00001  DCall: 25647 10.255.100.230:4569
   CALLTOKEN       : 51 bytes

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00012ms  SCall: 25647  DCall: 00000 10.255.100.230:4569
   VERSION         : 2
   CALLED NUMBER   : 5331
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 4693245400
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : 
   LANGUAGE        : en
   USERNAME        : azsc-tie
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  14:03:56
   CALLTOKEN       : 51 bytes

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00012ms  SCall: 12892  DCall: 25647 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00012ms  SCall: 12892  DCall: 25647 10.255.100.230:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x39\x38\x32\x30\x38\x34\x34\x36\x33
   USERNAME        : azsc-tie

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00024ms  SCall: 25647  DCall: 12892 10.255.100.230:4569
   MD5 RESULT      : 259d30deb52522ae8bcb5e3171eda3a3

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 00024ms  SCall: 12892  DCall: 25647 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT 
   Timestamp: 01024ms  SCall: 12892  DCall: 25647 10.255.100.230:4569
   CAUSE           : No authority found
   CAUSE CODE      : 50

Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 01024ms  SCall: 25647  DCall: 12892 10.255.100.230:4569
    -- Hungup 'IAX2/6301tie-25647'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:24] NoOp("SIP/6000-00000017", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 50") in new stack
    -- Executing [s@macro-dialout-trunk:25] GotoIf("SIP/6000-00000017", "0?continue,1:s-CHANUNAVAIL,1") in new stack
    -- Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set("SIP/6000-00000017", "RC=50") in new stack
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("SIP/6000-00000017", "50,1") in new stack
    -- Goto (macro-dialout-trunk,50,1)
    -- Executing [50@macro-dialout-trunk:1] Goto("SIP/6000-00000017", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [continue@macro-dialout-trunk:1] NoOp("SIP/6000-00000017", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 50 - failing through to other trunks") in new stack
    -- Executing [continue@macro-dialout-trunk:2] ExecIf("SIP/6000-00000017", "1?Set(CALLERID(number)=6000)") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:6] Macro("SIP/6000-00000017", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Progress("SIP/6000-00000017", "") in new stack
    -- Executing [s@macro-outisbusy:2] GotoIf("SIP/6000-00000017", "0?emergency,1") in new stack
    -- Executing [s@macro-outisbusy:3] GotoIf("SIP/6000-00000017", "0?intracompany,1") in new stack
    -- Executing [s@macro-outisbusy:4] Playback("SIP/6000-00000017", "all-circuits-busy-now&please-try-call-later, noanswer") in new stack
    -- <SIP/6000-00000017> Playing 'all-circuits-busy-now.g722' (language 'en')
       > 0x7fa0c4021e80 -- Probation passed - setting RTP source address to 12.246.227.38:27053
    -- <SIP/6000-00000017> Playing 'please-try-call-later.g722' (language 'en')
    -- Executing [h@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:1] Hangup("SIP/6000-00000017", "") in new stack
  == Spawn extension (restrictedroute-c4ca4238a0b923820dcc509a6f75849b, h, 1) exited non-zero on 'SIP/6000-00000017'
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE   
   Timestamp: 00002ms  SCall: 00219  DCall: 00000 10.255.100.230:4569

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG   
   Timestamp: 00002ms  SCall: 00001  DCall: 00219 10.255.100.230:4569
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00002ms  SCall: 00219  DCall: 00001 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE   
   Timestamp: 00010ms  SCall: 12150  DCall: 00000 10.255.100.230:4569

Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG   
   Timestamp: 00010ms  SCall: 00001  DCall: 12150 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00010ms  SCall: 12150  DCall: 00001 10.255.100.230:4569

Asterisk No authority found - VoIP-Info looks like a good place to start.

Ok so after removing both trunk entries and reentering them i’m able to place calls from PBX 2 to PBX 1 but not from PBX 1 to PBX 2

Here is the log from PBX 1 when trying to dial PBX 2 (ext 5331 to 6000)

Connected to Asterisk 13.15.0 currently running on pbx2 (pid = 13218)
  == Setting global variable 'SIPDOMAIN' to '10.255.100.230'
    -- Executing [6000@from-internal:1] Macro("PJSIP/5331-00000044", "user-callerid,LIMIT") in new stack
    -- Executing [s@macro-user-callerid:1] Set("PJSIP/5331-00000044", "TOUCH_MONITOR=1497474002.1087") in new stack
    -- Executing [s@macro-user-callerid:2] Set("PJSIP/5331-00000044", "AMPUSER=5331") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("PJSIP/5331-00000044", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("PJSIP/5331-00000044", "1?Set(REALCALLERIDNUM=5331)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("PJSIP/5331-00000044", "AMPUSER=5331") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("PJSIP/5331-00000044", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("PJSIP/5331-00000044", "AMPUSERCIDNAME=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("PJSIP/5331-00000044", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("PJSIP/5331-00000044", "AMPUSERCID=5331") in new stack
    -- Executing [s@macro-user-callerid:10] Set("PJSIP/5331-00000044", "__DIAL_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-user-callerid:11] Set("PJSIP/5331-00000044", "CALLERID(all)="John Munoz" <5331>") in new stack
    -- Executing [s@macro-user-callerid:12] GotoIf("PJSIP/5331-00000044", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:13] ExecIf("PJSIP/5331-00000044", "1?Set(GROUP(concurrency_limit)=5331)") in new stack
    -- Executing [s@macro-user-callerid:14] ExecIf("PJSIP/5331-00000044", "0?Set(CHANNEL(language)=)") in new stack
    -- Executing [s@macro-user-callerid:15] GotoIf("PJSIP/5331-00000044", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,29)
    -- Executing [s@macro-user-callerid:29] Set("PJSIP/5331-00000044", "CALLERID(number)=5331") in new stack
    -- Executing [s@macro-user-callerid:30] Set("PJSIP/5331-00000044", "CALLERID(name)=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:31] GotoIf("PJSIP/5331-00000044", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:32] Set("PJSIP/5331-00000044", "CDR(cnam)=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:33] Set("PJSIP/5331-00000044", "CDR(cnum)=5331") in new stack
    -- Executing [s@macro-user-callerid:34] Set("PJSIP/5331-00000044", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:35] ExecIf("PJSIP/5331-00000044", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-user-callerid:36] GosubIf("PJSIP/5331-00000044", "0?app-check-classofservce,s,1()") in new stack
    -- Executing [6000@from-internal:2] Set("PJSIP/5331-00000044", "ROUTEUSER=5331") in new stack
    -- Executing [6000@from-internal:3] GotoIf("PJSIP/5331-00000044", "1?notblind") in new stack
    -- Goto (from-internal,6000,6)
    -- Executing [6000@from-internal:6] GotoIf("PJSIP/5331-00000044", "1?restrictedroute-629c4319b3fc6dd3129f678476729437,6000,2:outbound-allroutes,6000,2") in new stack
    -- Goto (restrictedroute-629c4319b3fc6dd3129f678476729437,6000,2)
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:2] Gosub("PJSIP/5331-00000044", "sub-record-check,s,1(out,6000,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/5331-00000044", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/5331-00000044", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/5331-00000044", "NOW=1497474002") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/5331-00000044", "__DAY=14") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/5331-00000044", "__MONTH=06") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/5331-00000044", "__YEAR=2017") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/5331-00000044", "__TIMESTR=20170614-160002") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/5331-00000044", "__FROMEXTEN=5331") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/5331-00000044", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/5331-00000044", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/5331-00000044", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/5331-00000044", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/5331-00000044", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("PJSIP/5331-00000044", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("PJSIP/5331-00000044", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("PJSIP/5331-00000044", "Outbound Recording Check from 5331 to 6000") in new stack
    -- Executing [out@sub-record-check:2] Set("PJSIP/5331-00000044", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("PJSIP/5331-00000044", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("PJSIP/5331-00000044", "recordcheck,1(dontcare,out,6000)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/5331-00000044", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/5331-00000044", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("PJSIP/5331-00000044", "") in new stack
    -- Executing [out@sub-record-check:8] Return("PJSIP/5331-00000044", "") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:3] ExecIf("PJSIP/5331-00000044", "0 ?Set(CDR(accountcode)=)") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:4] Set("PJSIP/5331-00000044", "INTRACOMPANYROUTE=YES") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:5] Set("PJSIP/5331-00000044", "MOHCLASS=default") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:6] Set("PJSIP/5331-00000044", "_NODEST=") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:7] Macro("PJSIP/5331-00000044", "dialout-trunk,3,6000,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("PJSIP/5331-00000044", "DIAL_TRUNK=3") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("PJSIP/5331-00000044", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("PJSIP/5331-00000044", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("PJSIP/5331-00000044", "DIAL_NUMBER=6000") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("PJSIP/5331-00000044", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("PJSIP/5331-00000044", "OUTBOUND_GROUP=OUT_3") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("PJSIP/5331-00000044", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,9)
    -- Executing [s@macro-dialout-trunk:9] GotoIf("PJSIP/5331-00000044", "1?skipoutcid") in new stack
    -- Goto (macro-dialout-trunk,s,13)
    -- Executing [s@macro-dialout-trunk:13] GosubIf("PJSIP/5331-00000044", "0?sub-flp-3,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("PJSIP/5331-00000044", "OUTNUM=6000") in new stack
    -- Executing [s@macro-dialout-trunk:15] Set("PJSIP/5331-00000044", "custom=IAX2/PBX1") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("PJSIP/5331-00000044", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Ttr)") in new stack
    -- Executing [s@macro-dialout-trunk:17] ExecIf("PJSIP/5331-00000044", "0?Set(DIAL_TRUNK_OPTIONS=TtrM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:18] Macro("PJSIP/5331-00000044", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/5331-00000044", "") in new stack
    -- Executing [s@macro-dialout-trunk:19] GotoIf("PJSIP/5331-00000044", "0?skipcrm") in new stack
    -- Executing [s@macro-dialout-trunk:20] Set("PJSIP/5331-00000044", "__CRM_DIRECTION=OUTBOUND") in new stack
    -- Executing [s@macro-dialout-trunk:21] Set("PJSIP/5331-00000044", "__CRM_DESTINATION=6000") in new stack
    -- Executing [s@macro-dialout-trunk:22] Set("PJSIP/5331-00000044", "__CRM_SOURCE=5331") in new stack
    -- Executing [s@macro-dialout-trunk:23] AGI("PJSIP/5331-00000044", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
    -- <PJSIP/5331-00000044>AGI Script sangomacrm.agi completed, returning 0
    -- Executing [s@macro-dialout-trunk:24] Set("PJSIP/5331-00000044", "CHANNEL(hangup_handler_push)=crm-hangup,s,1") in new stack
    -- Executing [s@macro-dialout-trunk:25] NoOp("PJSIP/5331-00000044", "CRM Finished") in new stack
    -- Executing [s@macro-dialout-trunk:26] GotoIf("PJSIP/5331-00000044", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:27] ExecIf("PJSIP/5331-00000044", "1?Set(CONNECTEDLINE(num,i)=6000)") in new stack
    -- Executing [s@macro-dialout-trunk:28] ExecIf("PJSIP/5331-00000044", "1?Set(CONNECTEDLINE(name,i)=CID:5331)") in new stack
    -- Executing [s@macro-dialout-trunk:29] ExecIf("PJSIP/5331-00000044", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)5331)") in new stack
    -- Executing [s@macro-dialout-trunk:30] GotoIf("PJSIP/5331-00000044", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:31] Dial("PJSIP/5331-00000044", "IAX2/PBX1/6000@AZSC-Trunk,300,Ttr") in new stack
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00018ms  SCall: 29110  DCall: 00000 10.30.3.52:4569
   VERSION         : 2
   CALLED NUMBER   : 6000
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 5331
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : John Munoz
   LANGUAGE        : en
   CALLED CONTEXT  : AZSC-Trunk
   USERNAME        : PBX2
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  16:00:02

    -- Called IAX2/PBX1/6000@AZSC-Trunk
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN 
   Timestamp: 00018ms  SCall: 00001  DCall: 29110 10.30.3.52:4569
   CALLTOKEN       : 51 bytes

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00031ms  SCall: 29110  DCall: 00000 10.30.3.52:4569
   VERSION         : 2
   CALLED NUMBER   : 6000
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 5331
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : John Munoz
   LANGUAGE        : en
   CALLED CONTEXT  : AZSC-Trunk
   USERNAME        : PBX2
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  16:00:02
   CALLTOKEN       : 51 bytes

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00031ms  SCall: 14940  DCall: 29110 10.30.3.52:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00003ms  SCall: 14940  DCall: 29110 10.30.3.52:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x31\x33\x37\x35\x38\x36\x34\x30\x32
   USERNAME        : PBX2

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00044ms  SCall: 29110  DCall: 14940 10.30.3.52:4569
   MD5 RESULT      : f064ef7655d66262cd2d1866b9c4d8d5

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 00044ms  SCall: 14940  DCall: 29110 10.30.3.52:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT 
   Timestamp: 01015ms  SCall: 14940  DCall: 29110 10.30.3.52:4569
   CAUSE           : No authority found
   CAUSE CODE      : 50

Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 01015ms  SCall: 29110  DCall: 14940 10.30.3.52:4569
    -- Hungup 'IAX2/PBX1-29110'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:32] NoOp("PJSIP/5331-00000044", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 50") in new stack
    -- Executing [s@macro-dialout-trunk:33] GotoIf("PJSIP/5331-00000044", "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/5331-00000044", "RC=50") in new stack
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("PJSIP/5331-00000044", "50,1") in new stack
    -- Goto (macro-dialout-trunk,50,1)
    -- Executing [50@macro-dialout-trunk:1] Goto("PJSIP/5331-00000044", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [continue@macro-dialout-trunk:1] NoOp("PJSIP/5331-00000044", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 50 - failing through to other trunks") in new stack
    -- Executing [continue@macro-dialout-trunk:2] ExecIf("PJSIP/5331-00000044", "1?Set(CALLERID(number)=5331)") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:8] Macro("PJSIP/5331-00000044", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Progress("PJSIP/5331-00000044", "") in new stack
    -- Executing [s@macro-outisbusy:2] GotoIf("PJSIP/5331-00000044", "0?emergency,1") in new stack
    -- Executing [s@macro-outisbusy:3] GotoIf("PJSIP/5331-00000044", "1?intracompany,1") in new stack
    -- Goto (macro-outisbusy,intracompany,1)
    -- Executing [intracompany@macro-outisbusy:1] Playback("PJSIP/5331-00000044", "all-circuits-busy-now&please-try-call-later, noanswer") in new stack
    -- <PJSIP/5331-00000044> Playing 'all-circuits-busy-now.g722' (language 'en')
       > 0x7f0e548c8850 -- Probation passed - setting RTP source address to 10.255.100.121:12120
    -- <PJSIP/5331-00000044> Playing 'please-try-call-later.g722' (language 'en')
    -- Executing [h@restrictedroute-629c4319b3fc6dd3129f678476729437:1] Hangup("PJSIP/5331-00000044", "") in new stack
  == Spawn extension (restrictedroute-629c4319b3fc6dd3129f678476729437, h, 1) exited non-zero on 'PJSIP/5331-00000044'
    -- PJSIP/5331-00000044 Internal Gosub(crm-hangup,s,1) start
    -- Executing [s@crm-hangup:1] NoOp("PJSIP/5331-00000044", "Sending Hangup to CRM") in new stack
    -- Executing [s@crm-hangup:2] NoOp("PJSIP/5331-00000044", "HANGUP CAUSE: 50") in new stack
    -- Executing [s@crm-hangup:3] ExecIf("PJSIP/5331-00000044", "0?Set(__CRM_VOICEMAIL=)") in new stack
    -- Executing [s@crm-hangup:4] NoOp("PJSIP/5331-00000044", "MASTER CHANNEL: 1497474002.1087 = 1497474002.1087") in new stack
    -- Executing [s@crm-hangup:5] GotoIf("PJSIP/5331-00000044", "0?return") in new stack
    -- Executing [s@crm-hangup:6] Set("PJSIP/5331-00000044", "__CRM_HANGUP=1") in new stack
    -- Executing [s@crm-hangup:7] AGI("PJSIP/5331-00000044", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
pbx2*CLI> 
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

and here is the log from PBX 2 when Dialing PBX 1 (6000 to 5331)

  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [5331@from-internal:1] Macro("SIP/6000-0000002b", "user-callerid,LIMIT") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/6000-0000002b", "TOUCH_MONITOR=1497473959.76") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/6000-0000002b", "AMPUSER=6000") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/6000-0000002b", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/6000-0000002b", "1?Set(REALCALLERIDNUM=6000)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/6000-0000002b", "AMPUSER=6000") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/6000-0000002b", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/6000-0000002b", "AMPUSERCIDNAME=Cloud") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("SIP/6000-0000002b", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/6000-0000002b", "AMPUSERCID=6000") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/6000-0000002b", "__DIAL_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/6000-0000002b", "CALLERID(all)="Cloud" <6000>") in new stack
    -- Executing [s@macro-user-callerid:12] GotoIf("SIP/6000-0000002b", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:13] ExecIf("SIP/6000-0000002b", "1?Set(GROUP(concurrency_limit)=6000)") in new stack
    -- Executing [s@macro-user-callerid:14] GotoIf("SIP/6000-0000002b", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,27)
    -- Executing [s@macro-user-callerid:27] Set("SIP/6000-0000002b", "CALLERID(number)=6000") in new stack
    -- Executing [s@macro-user-callerid:28] Set("SIP/6000-0000002b", "CALLERID(name)=Cloud") in new stack
    -- Executing [s@macro-user-callerid:29] GotoIf("SIP/6000-0000002b", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:30] Set("SIP/6000-0000002b", "CDR(cnam)=Cloud") in new stack
    -- Executing [s@macro-user-callerid:31] Set("SIP/6000-0000002b", "CDR(cnum)=6000") in new stack
    -- Executing [s@macro-user-callerid:32] Set("SIP/6000-0000002b", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:33] GosubIf("SIP/6000-0000002b", "0?app-check-classofservce,s,1()") in new stack
    -- Executing [5331@from-internal:2] Set("SIP/6000-0000002b", "ROUTEUSER=6000") in new stack
    -- Executing [5331@from-internal:3] GotoIf("SIP/6000-0000002b", "1?notblind") in new stack
    -- Goto (from-internal,5331,6)
    -- Executing [5331@from-internal:6] GotoIf("SIP/6000-0000002b", "1?restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2:outbound-allroutes,5331,2") in new stack
    -- Goto (restrictedroute-c4ca4238a0b923820dcc509a6f75849b,5331,2)
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:2] Gosub("SIP/6000-0000002b", "sub-record-check,s,1(out,5331,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("SIP/6000-0000002b", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("SIP/6000-0000002b", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("SIP/6000-0000002b", "NOW=1497473959") in new stack
    -- Executing [s@sub-record-check:4] Set("SIP/6000-0000002b", "__DAY=14") in new stack
    -- Executing [s@sub-record-check:5] Set("SIP/6000-0000002b", "__MONTH=06") in new stack
    -- Executing [s@sub-record-check:6] Set("SIP/6000-0000002b", "__YEAR=2017") in new stack
    -- Executing [s@sub-record-check:7] Set("SIP/6000-0000002b", "__TIMESTR=20170614-155919") in new stack
    -- Executing [s@sub-record-check:8] Set("SIP/6000-0000002b", "__FROMEXTEN=6000") in new stack
    -- Executing [s@sub-record-check:9] Set("SIP/6000-0000002b", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("SIP/6000-0000002b", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("SIP/6000-0000002b", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("SIP/6000-0000002b", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("SIP/6000-0000002b", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("SIP/6000-0000002b", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("SIP/6000-0000002b", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("SIP/6000-0000002b", "Outbound Recording Check from 6000 to 5331") in new stack
    -- Executing [out@sub-record-check:2] Set("SIP/6000-0000002b", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("SIP/6000-0000002b", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("SIP/6000-0000002b", "recordcheck,1(dontcare,out,5331)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("SIP/6000-0000002b", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("SIP/6000-0000002b", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("SIP/6000-0000002b", "") in new stack
    -- Executing [out@sub-record-check:8] Return("SIP/6000-0000002b", "") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:3] Set("SIP/6000-0000002b", "INTRACOMPANYROUTE=YES") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:4] Set("SIP/6000-0000002b", "MOHCLASS=default") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:5] Set("SIP/6000-0000002b", "_NODEST=") in new stack
    -- Executing [5331@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:6] Macro("SIP/6000-0000002b", "dialout-trunk,1,5331,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/6000-0000002b", "DIAL_TRUNK=1") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/6000-0000002b", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/6000-0000002b", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/6000-0000002b", "DIAL_NUMBER=5331") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/6000-0000002b", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/6000-0000002b", "OUTBOUND_GROUP=OUT_1") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/6000-0000002b", "0?nomax") in new stack
    -- Executing [s@macro-dialout-trunk:8] GotoIf("SIP/6000-0000002b", "0?chanfull") in new stack
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/6000-0000002b", "1?skipoutcid") in new stack
    -- Goto (macro-dialout-trunk,s,12)
    -- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/6000-0000002b", "0?sub-flp-1,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/6000-0000002b", "OUTNUM=5331") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/6000-0000002b", "custom=IAX2/PBX2") in new stack
    -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/6000-0000002b", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Ttr)") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/6000-0000002b", "0?Set(DIAL_TRUNK_OPTIONS=TtrM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:17] Macro("SIP/6000-0000002b", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/6000-0000002b", "") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/6000-0000002b", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/6000-0000002b", "1?Set(CONNECTEDLINE(num,i)=5331)") in new stack
    -- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/6000-0000002b", "1?Set(CONNECTEDLINE(name,i)=CID:6000)") in new stack
    -- Executing [s@macro-dialout-trunk:21] ExecIf("SIP/6000-0000002b", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)6000)") in new stack
    -- Executing [s@macro-dialout-trunk:22] GotoIf("SIP/6000-0000002b", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:23] Dial("SIP/6000-0000002b", "IAX2/PBX2/5331,300,Ttr") in new stack
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00016ms  SCall: 31312  DCall: 00000 10.255.100.230:4569
   VERSION         : 2
   CALLED NUMBER   : 5331
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 6000
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : Cloud
   LANGUAGE        : en
   USERNAME        : PBX1
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  15:59:18

    -- Called IAX2/PBX2/5331
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN 
   Timestamp: 00016ms  SCall: 00001  DCall: 31312 10.255.100.230:4569
   CALLTOKEN       : 51 bytes

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00029ms  SCall: 31312  DCall: 00000 10.255.100.230:4569
   VERSION         : 2
   CALLED NUMBER   : 5331
   CODEC_PREFS     : (g722|ulaw)
   CALLING NUMBER  : 6000
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : Cloud
   LANGUAGE        : en
   USERNAME        : PBX1
   FORMAT          : 4096
   FORMAT2         : g722
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-14  15:59:18
   CALLTOKEN       : 51 bytes

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00029ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00010ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x34\x39\x30\x38\x34\x36\x37\x38\x32
   USERNAME        : PBX1

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00042ms  SCall: 31312  DCall: 12447 10.255.100.230:4569
   MD5 RESULT      : 8ed3b2a459ce04df1a4868c73bffef6a

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 00042ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACCEPT 
   Timestamp: 00023ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
   FORMAT          : 4096
   FORMAT2         : g722

    -- Call accepted by 10.255.100.230:4569 (format g722)
    -- Format for call is (g722)
Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 00023ms  SCall: 31312  DCall: 12447 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: CONTROL Subclass: RINGING
   Timestamp: 00303ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 003 Type: IAX     Subclass: ACK    
   Timestamp: 00303ms  SCall: 31312  DCall: 12447 10.255.100.230:4569
    -- IAX2/PBX2-31312 is ringing
Rx-Frame Retry[ No] -- OSeqno: 003 ISeqno: 002 Type: CONTROL Subclass: RINGING
   Timestamp: 00306ms  SCall: 12447  DCall: 31312 10.255.100.230:4569
Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 004 Type: IAX     Subclass: ACK    
   Timestamp: 00306ms  SCall: 31312  DCall: 12447 10.255.100.230:4569
    -- IAX2/PBX2-31312 is ringing
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE   
   Timestamp: 00011ms  SCall: 12952  DCall: 00000 10.255.100.230:4569

Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG   
   Timestamp: 00011ms  SCall: 00001  DCall: 12952 10.255.100.230:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00011ms  SCall: 12952  DCall: 00001 10.255.100.230:4569
Tx-Frame Retry[000] -- OSeqno: 002 ISeqno: 004 Type: IAX     Subclass: HANGUP 
   Timestamp: 01464ms  SCall: 31312  DCall: 12447 10.255.100.230:4569
   CAUSE CODE      : 0

    -- Hungup 'IAX2/PBX2-31312'
  == Spawn extension (macro-dialout-trunk, s, 23) exited non-zero on 'SIP/6000-0000002b' in macro 'dialout-trunk'
  == Spawn extension (restrictedroute-c4ca4238a0b923820dcc509a6f75849b, 5331, 6) exited non-zero on 'SIP/6000-0000002b'
    -- Executing [h@restrictedroute-c4ca4238a0b923820dcc509a6f75849b:1] Hangup("SIP/6000-0000002b", "") in new stack
  == Spawn extension (restrictedroute-c4ca4238a0b923820dcc509a6f75849b, h, 1) exited non-zero on 'SIP/6000-0000002b'
Rx-Frame Retry[ No] -- OSeqno: 004 ISeqno: 003 Type: IAX     Subclass: ACK    
   Timestamp: 01464ms  SCall: 12447  DCall: 31312 10.255.100.230:4569

I’m seeing that PBX 1 is adding CALLED CONTEXT : AZSC-Trunk where PBX 2 isn’t. That’s an old trunk name that i don’t even have specified in my system anymore. Not sure where it’s coming from or if it’s even the issue.

Quick guess, don’t use chan_pjsip (yet)

Here is a thread I created a few months ago with the same problem.
IAX trunk suddenly failing in one direction with CAUSE : No authority found CAUSE CODE : 50
Used to work before.

One system is Asterisk 13, the one the call is failing to is Asterisk 11.
What are your Asterisk versions?

Also try type=friend instead of peer.

Can’t offer a solution, just looking for things we have in common in our setups.

Changed the PJSIP extension to SIP but still failing on call attempts.

Connected to Asterisk 13.15.0 currently running on pbx2 (pid = 13218)
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [6000@from-internal:1] Macro("SIP/5331-000001e7", "user-callerid,LIMIT") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/5331-000001e7", "TOUCH_MONITOR=1497540529.1585") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/5331-000001e7", "AMPUSER=5331") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/5331-000001e7", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/5331-000001e7", "1?Set(REALCALLERIDNUM=5331)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/5331-000001e7", "AMPUSER=5331") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5331-000001e7", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/5331-000001e7", "AMPUSERCIDNAME=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("SIP/5331-000001e7", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/5331-000001e7", "AMPUSERCID=5331") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/5331-000001e7", "__DIAL_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/5331-000001e7", "CALLERID(all)="John Munoz" <5331>") in new stack
    -- Executing [s@macro-user-callerid:12] GotoIf("SIP/5331-000001e7", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:13] ExecIf("SIP/5331-000001e7", "1?Set(GROUP(concurrency_limit)=5331)") in new stack
    -- Executing [s@macro-user-callerid:14] ExecIf("SIP/5331-000001e7", "0?Set(CHANNEL(language)=)") in new stack
    -- Executing [s@macro-user-callerid:15] GotoIf("SIP/5331-000001e7", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,29)
    -- Executing [s@macro-user-callerid:29] Set("SIP/5331-000001e7", "CALLERID(number)=5331") in new stack
    -- Executing [s@macro-user-callerid:30] Set("SIP/5331-000001e7", "CALLERID(name)=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:31] GotoIf("SIP/5331-000001e7", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:32] Set("SIP/5331-000001e7", "CDR(cnam)=John Munoz") in new stack
    -- Executing [s@macro-user-callerid:33] Set("SIP/5331-000001e7", "CDR(cnum)=5331") in new stack
    -- Executing [s@macro-user-callerid:34] Set("SIP/5331-000001e7", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:35] ExecIf("SIP/5331-000001e7", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-user-callerid:36] GosubIf("SIP/5331-000001e7", "0?app-check-classofservce,s,1()") in new stack
    -- Executing [6000@from-internal:2] Set("SIP/5331-000001e7", "ROUTEUSER=5331") in new stack
    -- Executing [6000@from-internal:3] GotoIf("SIP/5331-000001e7", "1?notblind") in new stack
    -- Goto (from-internal,6000,6)
    -- Executing [6000@from-internal:6] GotoIf("SIP/5331-000001e7", "1?restrictedroute-629c4319b3fc6dd3129f678476729437,6000,2:outbound-allroutes,6000,2") in new stack
    -- Goto (restrictedroute-629c4319b3fc6dd3129f678476729437,6000,2)
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:2] Gosub("SIP/5331-000001e7", "sub-record-check,s,1(out,6000,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("SIP/5331-000001e7", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("SIP/5331-000001e7", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("SIP/5331-000001e7", "NOW=1497540529") in new stack
    -- Executing [s@sub-record-check:4] Set("SIP/5331-000001e7", "__DAY=15") in new stack
    -- Executing [s@sub-record-check:5] Set("SIP/5331-000001e7", "__MONTH=06") in new stack
    -- Executing [s@sub-record-check:6] Set("SIP/5331-000001e7", "__YEAR=2017") in new stack
    -- Executing [s@sub-record-check:7] Set("SIP/5331-000001e7", "__TIMESTR=20170615-102849") in new stack
    -- Executing [s@sub-record-check:8] Set("SIP/5331-000001e7", "__FROMEXTEN=5331") in new stack
    -- Executing [s@sub-record-check:9] Set("SIP/5331-000001e7", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("SIP/5331-000001e7", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("SIP/5331-000001e7", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("SIP/5331-000001e7", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("SIP/5331-000001e7", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("SIP/5331-000001e7", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("SIP/5331-000001e7", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("SIP/5331-000001e7", "Outbound Recording Check from 5331 to 6000") in new stack
    -- Executing [out@sub-record-check:2] Set("SIP/5331-000001e7", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("SIP/5331-000001e7", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("SIP/5331-000001e7", "recordcheck,1(dontcare,out,6000)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("SIP/5331-000001e7", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("SIP/5331-000001e7", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("SIP/5331-000001e7", "") in new stack
    -- Executing [out@sub-record-check:8] Return("SIP/5331-000001e7", "") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:3] ExecIf("SIP/5331-000001e7", "0 ?Set(CDR(accountcode)=)") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:4] Set("SIP/5331-000001e7", "INTRACOMPANYROUTE=YES") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:5] Set("SIP/5331-000001e7", "MOHCLASS=default") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:6] Set("SIP/5331-000001e7", "_NODEST=") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:7] Macro("SIP/5331-000001e7", "dialout-trunk,3,6000,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/5331-000001e7", "DIAL_TRUNK=3") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5331-000001e7", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5331-000001e7", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/5331-000001e7", "DIAL_NUMBER=6000") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/5331-000001e7", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/5331-000001e7", "OUTBOUND_GROUP=OUT_3") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5331-000001e7", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,9)
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5331-000001e7", "1?skipoutcid") in new stack
    -- Goto (macro-dialout-trunk,s,13)
    -- Executing [s@macro-dialout-trunk:13] GosubIf("SIP/5331-000001e7", "0?sub-flp-3,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/5331-000001e7", "OUTNUM=6000") in new stack
    -- Executing [s@macro-dialout-trunk:15] Set("SIP/5331-000001e7", "custom=IAX2/PBX1") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/5331-000001e7", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Ttr)") in new stack
    -- Executing [s@macro-dialout-trunk:17] ExecIf("SIP/5331-000001e7", "0?Set(DIAL_TRUNK_OPTIONS=TtrM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:18] Macro("SIP/5331-000001e7", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5331-000001e7", "") in new stack
    -- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/5331-000001e7", "0?skipcrm") in new stack
    -- Executing [s@macro-dialout-trunk:20] Set("SIP/5331-000001e7", "__CRM_DIRECTION=OUTBOUND") in new stack
    -- Executing [s@macro-dialout-trunk:21] Set("SIP/5331-000001e7", "__CRM_DESTINATION=6000") in new stack
    -- Executing [s@macro-dialout-trunk:22] Set("SIP/5331-000001e7", "__CRM_SOURCE=5331") in new stack
    -- Executing [s@macro-dialout-trunk:23] AGI("SIP/5331-000001e7", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
    -- <SIP/5331-000001e7>AGI Script sangomacrm.agi completed, returning 0
    -- Executing [s@macro-dialout-trunk:24] Set("SIP/5331-000001e7", "CHANNEL(hangup_handler_push)=crm-hangup,s,1") in new stack
    -- Executing [s@macro-dialout-trunk:25] NoOp("SIP/5331-000001e7", "CRM Finished") in new stack
    -- Executing [s@macro-dialout-trunk:26] GotoIf("SIP/5331-000001e7", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:27] ExecIf("SIP/5331-000001e7", "1?Set(CONNECTEDLINE(num,i)=6000)") in new stack
    -- Executing [s@macro-dialout-trunk:28] ExecIf("SIP/5331-000001e7", "1?Set(CONNECTEDLINE(name,i)=CID:5331)") in new stack
    -- Executing [s@macro-dialout-trunk:29] ExecIf("SIP/5331-000001e7", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)5331)") in new stack
    -- Executing [s@macro-dialout-trunk:30] GotoIf("SIP/5331-000001e7", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:31] Dial("SIP/5331-000001e7", "IAX2/PBX1/6000@AZSC-Trunk,300,Ttr") in new stack
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00019ms  SCall: 28401  DCall: 00000 10.30.3.52:4569
   VERSION         : 2
   CALLED NUMBER   : 6000
   CODEC_PREFS     : (ulaw|g722)
   CALLING NUMBER  : 5331
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : John Munoz
   LANGUAGE        : en
   CALLED CONTEXT  : AZSC-Trunk
   USERNAME        : PBX2
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-15  10:28:48

    -- Called IAX2/PBX1/6000@AZSC-Trunk
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: CTOKEN 
   Timestamp: 00019ms  SCall: 00001  DCall: 28401 10.30.3.52:4569
   CALLTOKEN       : 51 bytes

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW    
   Timestamp: 00032ms  SCall: 28401  DCall: 00000 10.30.3.52:4569
   VERSION         : 2
   CALLED NUMBER   : 6000
   CODEC_PREFS     : (ulaw|g722)
   CALLING NUMBER  : 5331
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    : John Munoz
   LANGUAGE        : en
   CALLED CONTEXT  : AZSC-Trunk
   USERNAME        : PBX2
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 4100
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2017-06-15  10:28:48
   CALLTOKEN       : 51 bytes

Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: ACK    
   Timestamp: 00032ms  SCall: 07612  DCall: 28401 10.30.3.52:4569
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00004ms  SCall: 07612  DCall: 28401 10.30.3.52:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x31\x33\x33\x34\x37\x33\x39\x30\x37
   USERNAME        : PBX2

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00045ms  SCall: 28401  DCall: 07612 10.30.3.52:4569
   MD5 RESULT      : d2f0d7565879cc295a8a6755b415fb45

Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 00045ms  SCall: 07612  DCall: 28401 10.30.3.52:4569
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 002 Type: IAX     Subclass: REJECT 
   Timestamp: 01016ms  SCall: 07612  DCall: 28401 10.30.3.52:4569
   CAUSE           : No authority found
   CAUSE CODE      : 50

Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 002 Type: IAX     Subclass: ACK    
   Timestamp: 01016ms  SCall: 28401  DCall: 07612 10.30.3.52:4569
    -- Hungup 'IAX2/PBX1-28401'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:32] NoOp("SIP/5331-000001e7", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 50") in new stack
    -- Executing [s@macro-dialout-trunk:33] GotoIf("SIP/5331-000001e7", "0?continue,1:s-CHANUNAVAIL,1") in new stack
    -- Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] Set("SIP/5331-000001e7", "RC=50") in new stack
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("SIP/5331-000001e7", "50,1") in new stack
    -- Goto (macro-dialout-trunk,50,1)
    -- Executing [50@macro-dialout-trunk:1] Goto("SIP/5331-000001e7", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [continue@macro-dialout-trunk:1] NoOp("SIP/5331-000001e7", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 50 - failing through to other trunks") in new stack
    -- Executing [continue@macro-dialout-trunk:2] ExecIf("SIP/5331-000001e7", "1?Set(CALLERID(number)=5331)") in new stack
    -- Executing [6000@restrictedroute-629c4319b3fc6dd3129f678476729437:8] Macro("SIP/5331-000001e7", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Progress("SIP/5331-000001e7", "") in new stack
    -- Executing [s@macro-outisbusy:2] GotoIf("SIP/5331-000001e7", "0?emergency,1") in new stack
    -- Executing [s@macro-outisbusy:3] GotoIf("SIP/5331-000001e7", "1?intracompany,1") in new stack
    -- Goto (macro-outisbusy,intracompany,1)
    -- Executing [intracompany@macro-outisbusy:1] Playback("SIP/5331-000001e7", "all-circuits-busy-now&please-try-call-later, noanswer") in new stack
    -- <SIP/5331-000001e7> Playing 'all-circuits-busy-now.ulaw' (language 'en')
       > 0x7f0e80370650 -- Probation passed - setting RTP source address to 10.255.100.121:12106
    -- <SIP/5331-000001e7> Playing 'please-try-call-later.ulaw' (language 'en')
    -- Executing [h@restrictedroute-629c4319b3fc6dd3129f678476729437:1] Hangup("SIP/5331-000001e7", "") in new stack
  == Spawn extension (restrictedroute-629c4319b3fc6dd3129f678476729437, h, 1) exited non-zero on 'SIP/5331-000001e7'
    -- SIP/5331-000001e7 Internal Gosub(crm-hangup,s,1) start
    -- Executing [s@crm-hangup:1] NoOp("SIP/5331-000001e7", "Sending Hangup to CRM") in new stack
    -- Executing [s@crm-hangup:2] NoOp("SIP/5331-000001e7", "HANGUP CAUSE: 50") in new stack
    -- Executing [s@crm-hangup:3] ExecIf("SIP/5331-000001e7", "0?Set(__CRM_VOICEMAIL=)") in new stack
    -- Executing [s@crm-hangup:4] NoOp("SIP/5331-000001e7", "MASTER CHANNEL: 1497540529.1585 = 1497540529.1585") in new stack
    -- Executing [s@crm-hangup:5] GotoIf("SIP/5331-000001e7", "0?return") in new stack
    -- Executing [s@crm-hangup:6] Set("SIP/5331-000001e7", "__CRM_HANGUP=1") in new stack
    -- Executing [s@crm-hangup:7] AGI("SIP/5331-000001e7", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
    -- <SIP/5331-000001e7>AGI Script sangomacrm.agi completed, returning 0
    -- Executing [s@crm-hangup:8] Return("SIP/5331-000001e7", "") in new stack
  == Spawn extension (restrictedroute-629c4319b3fc6dd3129f678476729437, h, 1) exited non-zero on 'SIP/5331-000001e7'
    -- SIP/5331-000001e7 Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=

I’m not sure where the context, AZSC-Trunk, is coming from. I don’t have that defined anywhere in my trunk settings. Is there a IAX.conf file somewhere that might have some state info?

Go to the /etc/asterisk folder and user the following command

grep AZSC *

See if you get any file that contains the specified pattern.