Twilio Emergency Call Setting

Hello - Not sure if many of us here use twilio’s trunk and also for emergency calling, but I’m having issues getting to work. I thought I followed their instructions to the teeth in setting up request-uri and termination uri to match like how it should but still getting the “all circuits are busy” error. Attached is the log. Hope someone could help! Thank you in advance.

== Setting global variable 'SIPDOMAIN' to '172.16.XXX.XXX'
  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio TOS bits 184 in TCLASS field.
  == Using SIP RTP Audio CoS mark 5
    -- Executing [933@from-internal:1] Macro("PJSIP/4001-00002d52", "user-callerid,LIMIT") in new stack
    -- Executing [s@macro-user-callerid:1] Set("PJSIP/4001-00002d52", "TOUCH_MONITOR=1702307393.13786") in new stack
    -- Executing [s@macro-user-callerid:2] Set("PJSIP/4001-00002d52", "AMPUSER=4001") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("PJSIP/4001-00002d52", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("PJSIP/4001-00002d52", "1?Set(REALCALLERIDNUM=4001)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("PJSIP/4001-00002d52", "AMPUSER=4001") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("PJSIP/4001-00002d52", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("PJSIP/4001-00002d52", "AMPUSERCIDNAME=Dtr of Tech / Some Guy") in new stack
    -- Executing [s@macro-user-callerid:8] ExecIf("PJSIP/4001-00002d52", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
    -- Executing [s@macro-user-callerid:9] GotoIf("PJSIP/4001-00002d52", "0?report") in new stack
    -- Executing [s@macro-user-callerid:10] Set("PJSIP/4001-00002d52", "AMPUSERCID=4001") in new stack
    -- Executing [s@macro-user-callerid:11] Set("PJSIP/4001-00002d52", "__DIAL_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-user-callerid:12] Set("PJSIP/4001-00002d52", "CALLERID(all)="Dtr of Tech / Some Guy" <4001>") in new stack
    -- Executing [s@macro-user-callerid:13] GotoIf("PJSIP/4001-00002d52", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:14] ExecIf("PJSIP/4001-00002d52", "1?Set(GROUP(concurrency_limit)=4001)") in new stack
    -- Executing [s@macro-user-callerid:15] ExecIf("PJSIP/4001-00002d52", "0?Set(CHANNEL(language)=)") in new stack
    -- Executing [s@macro-user-callerid:16] NoOp("PJSIP/4001-00002d52", "Macro Depth is 1") in new stack
    -- Executing [s@macro-user-callerid:17] GotoIf("PJSIP/4001-00002d52", "1?report2:macroerror") in new stack
    -- Goto (macro-user-callerid,s,18)
    -- Executing [s@macro-user-callerid:18] GotoIf("PJSIP/4001-00002d52", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,37)
    -- Executing [s@macro-user-callerid:37] Set("PJSIP/4001-00002d52", "CALLERID(number)=4001") in new stack
    -- Executing [s@macro-user-callerid:38] Set("PJSIP/4001-00002d52", "CALLERID(name)=Dtr of Tech / Some Guy") in new stack
    -- Executing [s@macro-user-callerid:39] GotoIf("PJSIP/4001-00002d52", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:40] Set("PJSIP/4001-00002d52", "CDR(cnam)=Dtr of Tech / Some Guy") in new stack
    -- Executing [s@macro-user-callerid:41] Set("PJSIP/4001-00002d52", "CDR(cnum)=4001") in new stack
    -- Executing [s@macro-user-callerid:42] Set("PJSIP/4001-00002d52", "CHANNEL(language)=en") in new stack
    -- Executing [s@macro-user-callerid:43] GosubIf("PJSIP/4001-00002d52", "0?app-check-classofservce,s,1()") in new stack
    -- Executing [933@from-internal:2] Set("PJSIP/4001-00002d52", "ROUTEUSER=4001") in new stack
    -- Executing [933@from-internal:3] Set("PJSIP/4001-00002d52", "ROUTEUSER=4001") in new stack
    -- Executing [933@from-internal:4] GotoIf("PJSIP/4001-00002d52", "1?notblind") in new stack
    -- Goto (from-internal,933,7)
    -- Executing [933@from-internal:7] GotoIf("PJSIP/4001-00002d52", "1?restrictedroute-15059eade299c336a93365c17538c043,933,2:outbound-allroutes,933,2") in new stack
    -- Goto (restrictedroute-15059eade299c336a93365c17538c043,933,2)
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:2] Gosub("PJSIP/4001-00002d52", "sub-record-check,s,1(out,933,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/4001-00002d52", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/4001-00002d52", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/4001-00002d52", "NOW=1702307393") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/4001-00002d52", "__DAY=11") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/4001-00002d52", "__MONTH=12") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/4001-00002d52", "__YEAR=2023") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/4001-00002d52", "__TIMESTR=20231211-100953") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/4001-00002d52", "__FROMEXTEN=4001") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/4001-00002d52", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/4001-00002d52", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/4001-00002d52", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/4001-00002d52", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/4001-00002d52", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("PJSIP/4001-00002d52", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("PJSIP/4001-00002d52", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("PJSIP/4001-00002d52", "Outbound Recording Check from 4001 to 933") in new stack
    -- Executing [out@sub-record-check:2] Set("PJSIP/4001-00002d52", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("PJSIP/4001-00002d52", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("PJSIP/4001-00002d52", "recordcheck,1(dontcare,out,933)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/4001-00002d52", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/4001-00002d52", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("PJSIP/4001-00002d52", "") in new stack
    -- Executing [out@sub-record-check:8] Return("PJSIP/4001-00002d52", "") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:3] ExecIf("PJSIP/4001-00002d52", "0 ?Set(CDR(accountcode)=)") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:4] Set("PJSIP/4001-00002d52", "EMERGENCYROUTE=YES") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:5] Set("PJSIP/4001-00002d52", "MOHCLASS=default") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:6] ExecIf("PJSIP/4001-00002d52", "1?Set(TRUNKCIDOVERRIDE=933@mytrunk pstn twilio com)") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:7] Set("PJSIP/4001-00002d52", "_NODEST=") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:8] Macro("PJSIP/4001-00002d52", "dialout-trunk,5,+933,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("PJSIP/4001-00002d52", "DIAL_TRUNK=5") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("PJSIP/4001-00002d52", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERID(num)=4001)") in new stack
    -- Executing [s@macro-dialout-trunk:4] GotoIf("PJSIP/4001-00002d52", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("PJSIP/4001-00002d52", "DIAL_NUMBER=+933") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("PJSIP/4001-00002d52", "DIAL_TRUNK_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-dialout-trunk:7] Set("PJSIP/4001-00002d52", "OUTBOUND_GROUP=OUT_5") in new stack
    -- Executing [s@macro-dialout-trunk:8] Set("PJSIP/4001-00002d52", "DIAL_TRUNK_OPTIONS=T") in new stack
    -- Executing [s@macro-dialout-trunk:9] GotoIf("PJSIP/4001-00002d52", "0?nomax") in new stack
    -- Executing [s@macro-dialout-trunk:10] GotoIf("PJSIP/4001-00002d52", "0?chanfull") in new stack
    -- Executing [s@macro-dialout-trunk:11] GotoIf("PJSIP/4001-00002d52", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:12] Macro("PJSIP/4001-00002d52", "outbound-callerid,5") in new stack
    -- Executing [s@macro-outbound-callerid:1] NoOp("PJSIP/4001-00002d52", "4001") in new stack
    -- Executing [s@macro-outbound-callerid:2] NoOp("PJSIP/4001-00002d52", "") in new stack
    -- Executing [s@macro-outbound-callerid:3] NoOp("PJSIP/4001-00002d52", "off") in new stack
    -- Executing [s@macro-outbound-callerid:4] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:5] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:6] ExecIf("PJSIP/4001-00002d52", "0?Set(REALCALLERIDNUM=4001)") in new stack
    -- Executing [s@macro-outbound-callerid:7] GotoIf("PJSIP/4001-00002d52", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,11)
    -- Executing [s@macro-outbound-callerid:11] Set("PJSIP/4001-00002d52", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:12] Set("PJSIP/4001-00002d52", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:13] Set("PJSIP/4001-00002d52", "TRUNKOUTCID=+1XXXXXXXXXX@mytrunk pstn twilio com") in new stack
    -- Executing [s@macro-outbound-callerid:14] GotoIf("PJSIP/4001-00002d52", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,19)
    -- Executing [s@macro-outbound-callerid:19] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(all)=+1XXXXXXXXXX@mytrunk pstn twilio com)") in new stack
    -- Executing [s@macro-outbound-callerid:20] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:21] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(all)=933@mytrunk pstn twilio com)") in new stack
    -- Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:23] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:24] Set("PJSIP/4001-00002d52", "CDR(outbound_cnum)=") in new stack
    -- Executing [s@macro-outbound-callerid:25] Set("PJSIP/4001-00002d52", "CDR(outbound_cnam)=933@mytrunk pstn twilio com") in new stack
    -- Executing [s@macro-dialout-trunk:13] GosubIf("PJSIP/4001-00002d52", "0?sub-flp-5,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("PJSIP/4001-00002d52", "OUTNUM=+933") in new stack
    -- Executing [s@macro-dialout-trunk:15] Set("PJSIP/4001-00002d52", "custom=PJSIP") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("PJSIP/4001-00002d52", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
    -- Executing [s@macro-dialout-trunk:17] ExecIf("PJSIP/4001-00002d52", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:18] Macro("PJSIP/4001-00002d52", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/4001-00002d52", "") in new stack
    -- Executing [s@macro-dialout-trunk:19] GotoIf("PJSIP/4001-00002d52", "0?skipcrm") in new stack
    -- Executing [s@macro-dialout-trunk:20] Set("PJSIP/4001-00002d52", "__CRM_DIRECTION=OUTBOUND") in new stack
    -- Executing [s@macro-dialout-trunk:21] Set("PJSIP/4001-00002d52", "__CRM_DESTINATION=+933") in new stack
    -- Executing [s@macro-dialout-trunk:22] Set("PJSIP/4001-00002d52", "__CRM_SOURCE=4001") in new stack
    -- Executing [s@macro-dialout-trunk:23] AGI("PJSIP/4001-00002d52", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
sangomacrm.agi: LINKEDID: 1702307393.13786
sangomacrm.agi: SOURCE: 4001
sangomacrm.agi: DESTINATION: +933
sangomacrm.agi: DIRECTION: OUTBOUND
sangomacrm.agi: EXTTOCALL:
sangomacrm.agi: START
sangomacrm.agi: SCRIPT: php /var/www/html/admin/modules/sangomacrm/importOne.php 'eyJ1dWlkIjoiMTcwMjMwNzM5My4xMzc4NiIsInNvdXJjZSI6IjQwMDE2IiwiZGVzdGluYXRpb24iOiIrOTMzIiwiZGlyZWN0aW9uIjoiT1VUQk9VTkQiLCJ0eXBlIjoiU1RBUlQiLCJ6dWx1X3R5cGUiOiIiLCJleHR0b2NhbGwiOiIiLCJjbnVtIjoiIiwiY25hbSI6IjkzM0BiY25iY3MucHN0bi50d2lsaW8uY29tIiwiY2FsbHBvcCI6ZmFsc2UsInZvaWNlbWFpbCI6IiJ9' > /dev/null 2>&1 &
    -- <PJSIP/4001-00002d52>AGI Script sangomacrm.agi completed, returning 0
    -- Executing [s@macro-dialout-trunk:24] Set("PJSIP/4001-00002d52", "CHANNEL(hangup_handler_push)=crm-hangup,s,1") in new stack
    -- Executing [s@macro-dialout-trunk:25] NoOp("PJSIP/4001-00002d52", "CRM Finished") in new stack
    -- Executing [s@macro-dialout-trunk:26] GotoIf("PJSIP/4001-00002d52", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:27] ExecIf("PJSIP/4001-00002d52", "1?Set(CONNECTEDLINE(num,i)=+933)") in new stack
    -- Executing [s@macro-dialout-trunk:28] ExecIf("PJSIP/4001-00002d52", "1?Set(CONNECTEDLINE(name,i)=CID:)") in new stack
    -- Executing [s@macro-dialout-trunk:29] ExecIf("PJSIP/4001-00002d52", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden))") in new stack
    -- Executing [s@macro-dialout-trunk:30] GotoIf("PJSIP/4001-00002d52", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:31] Dial("PJSIP/4001-00002d52", "PJSIP/+933@Twilio-US1-North-America-Virginia,300,Tb(func-apply-sipheaders^s^1)") in new stack
    -- PJSIP/Twilio-US1-North-America-Virginia-00002d53 Internal Gosub(func-apply-sipheaders,s,1) start
    -- Executing [s@func-apply-sipheaders:1] ExecIf("PJSIP/Twilio-US1-North-America-Virginia-00002d53", "0?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)") in new stack
    -- Executing [s@func-apply-sipheaders:2] NoOp("PJSIP/Twilio-US1-North-America-Virginia-00002d53", "Applying SIP Headers to channel") in new stack
    -- Executing [s@func-apply-sipheaders:3] Set("PJSIP/Twilio-US1-North-America-Virginia-00002d53", "SIPHEADERKEYS=") in new stack
    -- Executing [s@func-apply-sipheaders:4] While("PJSIP/Twilio-US1-North-America-Virginia-00002d53", "0") in new stack
    -- Jumping to priority 8
    -- Executing [s@func-apply-sipheaders:9] Return("PJSIP/Twilio-US1-North-America-Virginia-00002d53", "") in new stack
  == Spawn extension (from-pstn-e164-us, 933, 1) exited non-zero on 'PJSIP/Twilio-US1-North-America-Virginia-00002d53'
    -- PJSIP/Twilio-US1-North-America-Virginia-00002d53 Internal Gosub(func-apply-sipheaders,s,1) complete GOSUB_RETVAL=
    -- Called PJSIP/+933@Twilio-US1-North-America-Virginia
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:32] NoOp("PJSIP/4001-00002d52", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 127") in new stack
    -- Executing [s@macro-dialout-trunk:33] GotoIf("PJSIP/4001-00002d52", "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/4001-00002d52", "RC=127") in new stack
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("PJSIP/4001-00002d52", "127,1") in new stack
    -- Goto (macro-dialout-trunk,127,1)
    -- Executing [127@macro-dialout-trunk:1] Goto("PJSIP/4001-00002d52", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [continue@macro-dialout-trunk:1] NoOp("PJSIP/4001-00002d52", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 127 - failing through to other trunks") in new stack
    -- Executing [continue@macro-dialout-trunk:2] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(number)=4001)") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:9] Macro("PJSIP/4001-00002d52", "dialout-trunk,6,+933,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("PJSIP/4001-00002d52", "DIAL_TRUNK=6") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("PJSIP/4001-00002d52", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:3] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERID(num)=4001)") in new stack
    -- Executing [s@macro-dialout-trunk:4] GotoIf("PJSIP/4001-00002d52", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("PJSIP/4001-00002d52", "DIAL_NUMBER=+933") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("PJSIP/4001-00002d52", "DIAL_TRUNK_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-dialout-trunk:7] Set("PJSIP/4001-00002d52", "OUTBOUND_GROUP=OUT_6") in new stack
    -- Executing [s@macro-dialout-trunk:8] Set("PJSIP/4001-00002d52", "DIAL_TRUNK_OPTIONS=T") in new stack
    -- Executing [s@macro-dialout-trunk:9] GotoIf("PJSIP/4001-00002d52", "0?nomax") in new stack
    -- Executing [s@macro-dialout-trunk:10] GotoIf("PJSIP/4001-00002d52", "0?chanfull") in new stack
    -- Executing [s@macro-dialout-trunk:11] GotoIf("PJSIP/4001-00002d52", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:12] Macro("PJSIP/4001-00002d52", "outbound-callerid,6") in new stack
    -- Executing [s@macro-outbound-callerid:1] NoOp("PJSIP/4001-00002d52", "4001") in new stack
    -- Executing [s@macro-outbound-callerid:2] NoOp("PJSIP/4001-00002d52", "") in new stack
    -- Executing [s@macro-outbound-callerid:3] NoOp("PJSIP/4001-00002d52", "off") in new stack
    -- Executing [s@macro-outbound-callerid:4] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:5] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:6] ExecIf("PJSIP/4001-00002d52", "0?Set(REALCALLERIDNUM=4001)") in new stack
    -- Executing [s@macro-outbound-callerid:7] GotoIf("PJSIP/4001-00002d52", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,11)
    -- Executing [s@macro-outbound-callerid:11] Set("PJSIP/4001-00002d52", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:12] Set("PJSIP/4001-00002d52", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:13] Set("PJSIP/4001-00002d52", "TRUNKOUTCID=+1XXXXXXXXXX@mytrunk pstn twilio com") in new stack
    -- Executing [s@macro-outbound-callerid:14] GotoIf("PJSIP/4001-00002d52", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,19)
    -- Executing [s@macro-outbound-callerid:19] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(all)=+1XXXXXXXXXX@mytrunk pstn twilio com)") in new stack
    -- Executing [s@macro-outbound-callerid:20] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:21] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(all)=933@mytrunk pstn twilio com)") in new stack
    -- Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:23] ExecIf("PJSIP/4001-00002d52", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:24] Set("PJSIP/4001-00002d52", "CDR(outbound_cnum)=") in new stack
    -- Executing [s@macro-outbound-callerid:25] Set("PJSIP/4001-00002d52", "CDR(outbound_cnam)=933@mytrunk pstn twilio com") in new stack
    -- Executing [s@macro-dialout-trunk:13] GosubIf("PJSIP/4001-00002d52", "0?sub-flp-6,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("PJSIP/4001-00002d52", "OUTNUM=+933") in new stack
    -- Executing [s@macro-dialout-trunk:15] Set("PJSIP/4001-00002d52", "custom=PJSIP") in new stack
    -- Executing [s@macro-dialout-trunk:16] ExecIf("PJSIP/4001-00002d52", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
    -- Executing [s@macro-dialout-trunk:17] ExecIf("PJSIP/4001-00002d52", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:18] Macro("PJSIP/4001-00002d52", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/4001-00002d52", "") in new stack
    -- Executing [s@macro-dialout-trunk:19] GotoIf("PJSIP/4001-00002d52", "1?skipcrm") in new stack
    -- Goto (macro-dialout-trunk,s,25)
    -- Executing [s@macro-dialout-trunk:25] NoOp("PJSIP/4001-00002d52", "CRM Finished") in new stack
    -- Executing [s@macro-dialout-trunk:26] GotoIf("PJSIP/4001-00002d52", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:27] ExecIf("PJSIP/4001-00002d52", "1?Set(CONNECTEDLINE(num,i)=+933)") in new stack
    -- Executing [s@macro-dialout-trunk:28] ExecIf("PJSIP/4001-00002d52", "1?Set(CONNECTEDLINE(name,i)=CID:)") in new stack
    -- Executing [s@macro-dialout-trunk:29] ExecIf("PJSIP/4001-00002d52", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden))") in new stack
    -- Executing [s@macro-dialout-trunk:30] GotoIf("PJSIP/4001-00002d52", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:31] Dial("PJSIP/4001-00002d52", "PJSIP/+933@Twilio-US2-North-America-Oregon,300,Tb(func-apply-sipheaders^s^1)") in new stack
    -- PJSIP/Twilio-US2-North-America-Oregon-00002d54 Internal Gosub(func-apply-sipheaders,s,1) start
    -- Executing [s@func-apply-sipheaders:1] ExecIf("PJSIP/Twilio-US2-North-America-Oregon-00002d54", "0?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)") in new stack
    -- Executing [s@func-apply-sipheaders:2] NoOp("PJSIP/Twilio-US2-North-America-Oregon-00002d54", "Applying SIP Headers to channel") in new stack
    -- Executing [s@func-apply-sipheaders:3] Set("PJSIP/Twilio-US2-North-America-Oregon-00002d54", "SIPHEADERKEYS=") in new stack
    -- Executing [s@func-apply-sipheaders:4] While("PJSIP/Twilio-US2-North-America-Oregon-00002d54", "0") in new stack
    -- Jumping to priority 8
    -- Executing [s@func-apply-sipheaders:9] Return("PJSIP/Twilio-US2-North-America-Oregon-00002d54", "") in new stack
  == Spawn extension (from-pstn-e164-us, 933, 1) exited non-zero on 'PJSIP/Twilio-US2-North-America-Oregon-00002d54'
    -- PJSIP/Twilio-US2-North-America-Oregon-00002d54 Internal Gosub(func-apply-sipheaders,s,1) complete GOSUB_RETVAL=
    -- Called PJSIP/+933@Twilio-US2-North-America-Oregon
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-dialout-trunk:32] NoOp("PJSIP/4001-00002d52", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 127") in new stack
    -- Executing [s@macro-dialout-trunk:33] GotoIf("PJSIP/4001-00002d52", "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/4001-00002d52", "RC=127") in new stack
    -- Executing [s-CHANUNAVAIL@macro-dialout-trunk:2] Goto("PJSIP/4001-00002d52", "127,1") in new stack
    -- Goto (macro-dialout-trunk,127,1)
    -- Executing [127@macro-dialout-trunk:1] Goto("PJSIP/4001-00002d52", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [continue@macro-dialout-trunk:1] NoOp("PJSIP/4001-00002d52", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 127 - failing through to other trunks") in new stack
    -- Executing [continue@macro-dialout-trunk:2] ExecIf("PJSIP/4001-00002d52", "1?Set(CALLERID(number)=4001)") in new stack
    -- Executing [933@restrictedroute-15059eade299c336a93365c17538c043:10] Macro("PJSIP/4001-00002d52", "outisbusy,") in new stack
    -- Executing [s@macro-outisbusy:1] Progress("PJSIP/4001-00002d52", "") in new stack
    -- Executing [s@macro-outisbusy:2] GotoIf("PJSIP/4001-00002d52", "1?emergency,1") in new stack
    -- Goto (macro-outisbusy,emergency,1)
    -- Executing [emergency@macro-outisbusy:1] Playback("PJSIP/4001-00002d52", "all-circuits-busy-now&please-try-call-later") in new stack
    -- <PJSIP/4001-00002d52> Playing 'all-circuits-busy-now.ulaw' (language 'en')
    -- <PJSIP/4001-00002d52> Playing 'please-try-call-later.ulaw' (language 'en')
    -- Executing [h@restrictedroute-15059eade299c336a93365c17538c043:1] Hangup("PJSIP/4001-00002d52", "") in new stack
  == Spawn extension (restrictedroute-15059eade299c336a93365c17538c043, h, 1) exited non-zero on 'PJSIP/4001-00002d52'
    -- PJSIP/4001-00002d52 Internal Gosub(crm-hangup,s,1) start
    -- Executing [s@crm-hangup:1] NoOp("PJSIP/4001-00002d52", "Sending Hangup to CRM") in new stack
    -- Executing [s@crm-hangup:2] NoOp("PJSIP/4001-00002d52", "HANGUP CAUSE: 127") in new stack
    -- Executing [s@crm-hangup:3] ExecIf("PJSIP/4001-00002d52", "0?Set(__CRM_VOICEMAIL=)") in new stack
    -- Executing [s@crm-hangup:4] NoOp("PJSIP/4001-00002d52", "MASTER CHANNEL: 1702307393.13786 = 1702307393.13786") in new stack
    -- Executing [s@crm-hangup:5] GotoIf("PJSIP/4001-00002d52", "0?return") in new stack
    -- Executing [s@crm-hangup:6] Set("PJSIP/4001-00002d52", "__CRM_HANGUP=1") in new stack
    -- Executing [s@crm-hangup:7] AGI("PJSIP/4001-00002d52", "sangomacrm.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
sangomacrm.agi: LINKEDID: 1702307393.13786
sangomacrm.agi: SOURCE: 4001
sangomacrm.agi: DESTINATION: +933
sangomacrm.agi: DIRECTION: OUTBOUND
sangomacrm.agi: EXTTOCALL:
sangomacrm.agi: START

Anyone with this knowledge? Please help!

Extension 4001 dialed 911, but a rule somewhere in the call flow prefixed the dial string with a + character which you don’t want.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.