Outbound route not used by extension

hi,
i have the problem that an outbound route which should be used by a dedicated extension is not chosen.
if i chose another extension registered to number 61 it works. this number is configured on a yealink t46s.

extension 66 is not working. this device is registered on a freeswitch server. registration works fine, calling works fine - but the default route is always chosen.

i guess it is caused by the contact-line the endpoint uses:

  Contact:  66/sip:[email protected]:59557;transp a92f971a71 Avail         0.665

i was able to tweak freeswitch to use 66 in its invite in the contact line. but nevertheless asterisk choses the wrong outbound route.

any idea?

Console verbose was OFF and is now 33.
  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio CoS mark 5
    -- Executing [01233999999@from-internal:1] Macro("PJSIP/66-0000058c", "user-callerid,LIMIT,EXTERNAL,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("PJSIP/66-0000058c", "TOUCH_MONITOR=1692634435.1528") in new stack
    -- Executing [s@macro-user-callerid:2] Set("PJSIP/66-0000058c", "CHANCONTEXT=") in new stack
    -- Executing [s@macro-user-callerid:3] Set("PJSIP/66-0000058c", "CHANCONTEXT=") in new stack
    -- Executing [s@macro-user-callerid:4] Set("PJSIP/66-0000058c", "CHANEXTENCONTEXT=66-0000058c") in new stack
    -- Executing [s@macro-user-callerid:5] Set("PJSIP/66-0000058c", "CHANEXTEN=66-0000058c") in new stack
    -- Executing [s@macro-user-callerid:6] Set("PJSIP/66-0000058c", "CALLERID(number)=0000000000") in new stack
    -- Executing [s@macro-user-callerid:7] Set("PJSIP/66-0000058c", "AMPUSER=0000000000") in new stack
    -- Executing [s@macro-user-callerid:8] Set("PJSIP/66-0000058c", "HOTDESCKCHAN=66-0000058c") in new stack
    -- Executing [s@macro-user-callerid:9] Set("PJSIP/66-0000058c", "HOTDESKEXTEN=66") in new stack
    -- Executing [s@macro-user-callerid:10] Set("PJSIP/66-0000058c", "HOTDESKCALL=0") in new stack
    -- Executing [s@macro-user-callerid:11] ExecIf("PJSIP/66-0000058c", "0?Set(HOTDESKCALL=1)") in new stack
    -- Executing [s@macro-user-callerid:12] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-user-callerid:13] GotoIf("PJSIP/66-0000058c", "0?report") in new stack
    -- Executing [s@macro-user-callerid:14] ExecIf("PJSIP/66-0000058c", "1?Set(REALCALLERIDNUM=0000000000)") in new stack
    -- Executing [s@macro-user-callerid:15] Set("PJSIP/66-0000058c", "AMPUSER=") in new stack
    -- Executing [s@macro-user-callerid:16] GotoIf("PJSIP/66-0000058c", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:17] Set("PJSIP/66-0000058c", "AMPUSERCIDNAME=") in new stack
    -- Executing [s@macro-user-callerid:18] ExecIf("PJSIP/66-0000058c", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
    -- Executing [s@macro-user-callerid:19] GotoIf("PJSIP/66-0000058c", "1?report") in new stack
    -- Goto (macro-user-callerid,s,28)
    -- Executing [s@macro-user-callerid:28] NoOp("PJSIP/66-0000058c", "Macro Depth is 1") in new stack
    -- Executing [s@macro-user-callerid:29] GotoIf("PJSIP/66-0000058c", "1?report2:macroerror") in new stack
    -- Goto (macro-user-callerid,s,30)
    -- Executing [s@macro-user-callerid:30] GotoIf("PJSIP/66-0000058c", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,48)
    -- Executing [s@macro-user-callerid:48] Set("PJSIP/66-0000058c", "CALLERID(number)=0000000000") in new stack
    -- Executing [s@macro-user-callerid:49] Set("PJSIP/66-0000058c", "CALLERID(name)=") in new stack
    -- Executing [s@macro-user-callerid:50] GotoIf("PJSIP/66-0000058c", "1?cnum") in new stack
    -- Goto (macro-user-callerid,s,52)
    -- Executing [s@macro-user-callerid:52] Set("PJSIP/66-0000058c", "CDR(cnum)=0000000000") in new stack
    -- Executing [s@macro-user-callerid:53] Set("PJSIP/66-0000058c", "CHANNEL(language)=de_DE") in new stack
    -- Executing [01233999999@from-internal:2] Gosub("PJSIP/66-0000058c", "sub-record-check,s,1(out,01233999999,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/66-0000058c", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/66-0000058c", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/66-0000058c", "NOW=1692634435") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/66-0000058c", "__DAY=21") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/66-0000058c", "__MONTH=08") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/66-0000058c", "__YEAR=2023") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/66-0000058c", "__TIMESTR=20230821-181355") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/66-0000058c", "__FROMEXTEN=0000000000") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/66-0000058c", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/66-0000058c", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/66-0000058c", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/66-0000058c", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/66-0000058c", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("PJSIP/66-0000058c", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("PJSIP/66-0000058c", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("PJSIP/66-0000058c", "Outbound Recording Check from 0000000000 to 01233999999") in new stack
    -- Executing [out@sub-record-check:2] Set("PJSIP/66-0000058c", "RECMODE=") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("PJSIP/66-0000058c", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("PJSIP/66-0000058c", "recordcheck,1(dontcare,out,01233999999)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/66-0000058c", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/66-0000058c", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("PJSIP/66-0000058c", "") in new stack
    -- Executing [out@sub-record-check:8] Return("PJSIP/66-0000058c", "") in new stack
    -- Executing [01233999999@from-internal:3] Set("PJSIP/66-0000058c", "_ROUTEID=5") in new stack
    -- Executing [01233999999@from-internal:4] Set("PJSIP/66-0000058c", "_ROUTENAME=Default_4000") in new stack
    -- Executing [01233999999@from-internal:5] Set("PJSIP/66-0000058c", "EMERGENCYROUTE=YES") in new stack
    -- Executing [01233999999@from-internal:6] Set("PJSIP/66-0000058c", "MOHCLASS=default") in new stack
    -- Executing [01233999999@from-internal:7] Set("PJSIP/66-0000058c", "_CALLERIDNAMEINTERNAL=") in new stack
    -- Executing [01233999999@from-internal:8] Set("PJSIP/66-0000058c", "_CALLERIDNUMINTERNAL=0000000000") in new stack
    -- Executing [01233999999@from-internal:9] Set("PJSIP/66-0000058c", "_EMAILNOTIFICATION=FALSE") in new stack
    -- Executing [01233999999@from-internal:10] Set("PJSIP/66-0000058c", "_NODEST=") in new stack
    -- Executing [01233999999@from-internal:11] Macro("PJSIP/66-0000058c", "dialout-trunk,9,01233999999,,on") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("PJSIP/66-0000058c", "DIAL_TRUNK=9") in new stack
    -- Executing [s@macro-dialout-trunk:2] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_OPTIONS=tr)") in new stack
    -- Executing [s@macro-dialout-trunk:3] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_OPTIONS=Tr)") in new stack
    -- Executing [s@macro-dialout-trunk:4] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_OPTIONS=tr)") in new stack
    -- Executing [s@macro-dialout-trunk:5] GosubIf("PJSIP/66-0000058c", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:6] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(num)=)") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("PJSIP/66-0000058c", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:8] Set("PJSIP/66-0000058c", "DIAL_NUMBER=01233999999") in new stack
    -- Executing [s@macro-dialout-trunk:9] Set("PJSIP/66-0000058c", "DIAL_TRUNK_OPTIONS=Ttr") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("PJSIP/66-0000058c", "OUTBOUND_GROUP=OUT_9") in new stack
    -- Executing [s@macro-dialout-trunk:11] Set("PJSIP/66-0000058c", "DIAL_TRUNK_OPTIONS=Tt") in new stack
    -- Executing [s@macro-dialout-trunk:12] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_TRUNK_OPTIONS=t)") in new stack
    -- Executing [s@macro-dialout-trunk:13] GotoIf("PJSIP/66-0000058c", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,15)
    -- Executing [s@macro-dialout-trunk:15] GotoIf("PJSIP/66-0000058c", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:16] Macro("PJSIP/66-0000058c", "outbound-callerid,9") in new stack
    -- Executing [s@macro-outbound-callerid:1] NoOp("PJSIP/66-0000058c", "0000000000") in new stack
    -- Executing [s@macro-outbound-callerid:2] NoOp("PJSIP/66-0000058c", "") in new stack
    -- Executing [s@macro-outbound-callerid:3] NoOp("PJSIP/66-0000058c", "all") in new stack
    -- Executing [s@macro-outbound-callerid:4] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:5] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:6] Set("PJSIP/66-0000058c", "HOTDESCKCHAN=66-0000058c") in new stack
    -- Executing [s@macro-outbound-callerid:7] Set("PJSIP/66-0000058c", "HOTDESKEXTEN=66") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("PJSIP/66-0000058c", "HOTDESKCALL=0") in new stack
    -- Executing [s@macro-outbound-callerid:9] ExecIf("PJSIP/66-0000058c", "0?Set(HOTDESKCALL=1)") in new stack
    -- Executing [s@macro-outbound-callerid:10] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-outbound-callerid:11] Set("PJSIP/66-0000058c", "ALLOWTHISROUTE=NO") in new stack
    -- Executing [s@macro-outbound-callerid:12] ExecIf("PJSIP/66-0000058c", "1?Set(ALLOWTHISROUTE=YES)") in new stack
    -- Executing [s@macro-outbound-callerid:13] ExecIf("PJSIP/66-0000058c", "0?Hangup()") in new stack
    -- Executing [s@macro-outbound-callerid:14] ExecIf("PJSIP/66-0000058c", "0?Set(REALCALLERIDNUM=0000000000)") in new stack
    -- Executing [s@macro-outbound-callerid:15] ExecIf("PJSIP/66-0000058c", "0?Set(AMPUSER=0000000000)") in new stack
    -- Executing [s@macro-outbound-callerid:16] GotoIf("PJSIP/66-0000058c", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,20)
    -- Executing [s@macro-outbound-callerid:20] Set("PJSIP/66-0000058c", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:21] Set("PJSIP/66-0000058c", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/66-0000058c", "0?Set(EMERGENCYCID=)") in new stack
    -- Executing [s@macro-outbound-callerid:23] Set("PJSIP/66-0000058c", "TRUNKOUTCID=<+4923684000>") in new stack
    -- Executing [s@macro-outbound-callerid:24] GotoIf("PJSIP/66-0000058c", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,30)
    -- Executing [s@macro-outbound-callerid:30] ExecIf("PJSIP/66-0000058c", "1?Set(CALLERID(all)=<+4923684000>)") in new stack
    -- Executing [s@macro-outbound-callerid:31] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [s@macro-outbound-callerid:32] ExecIf("PJSIP/66-0000058c", "1?Set(CALLERID(all)=<+4923684000>)") in new stack
    -- Executing [s@macro-outbound-callerid:33] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(all)=0000000000)") in new stack
    -- Executing [s@macro-outbound-callerid:34] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(all)=0000000000)") in new stack
    -- Executing [s@macro-outbound-callerid:35] Set("PJSIP/66-0000058c", "TIOHIDE=no") in new stack
    -- Executing [s@macro-outbound-callerid:36] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:37] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:38] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:39] ExecIf("PJSIP/66-0000058c", "0?Set(CALLERID(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [s@macro-outbound-callerid:40] Set("PJSIP/66-0000058c", "CDR(outbound_cnum)=+4923684000") in new stack
    -- Executing [s@macro-outbound-callerid:41] Set("PJSIP/66-0000058c", "CDR(outbound_cnam)=") in new stack
    -- Executing [s@macro-dialout-trunk:17] GosubIf("PJSIP/66-0000058c", "1?sub-flp-9,s,1()") in new stack
    -- Executing [s@sub-flp-9:1] ExecIf("PJSIP/66-0000058c", "0?Set(TARGET_FLP_9=0123801233999999)") in new stack
    -- Executing [s@sub-flp-9:2] GotoIf("PJSIP/66-0000058c", "0?match") in new stack
    -- Executing [s@sub-flp-9:3] ExecIf("PJSIP/66-0000058c", "0?Set(TARGET_FLP_9=0123801233999999)") in new stack
    -- Executing [s@sub-flp-9:4] GotoIf("PJSIP/66-0000058c", "0?match") in new stack
    -- Executing [s@sub-flp-9:5] ExecIf("PJSIP/66-0000058c", "0?Set(TARGET_FLP_9=0123801233999999)") in new stack
    -- Executing [s@sub-flp-9:6] GotoIf("PJSIP/66-0000058c", "0?match") in new stack
    -- Executing [s@sub-flp-9:7] Return("PJSIP/66-0000058c", "") in new stack
    -- Executing [s@macro-dialout-trunk:18] Set("PJSIP/66-0000058c", "OUTNUM=01233999999") in new stack
    -- Executing [s@macro-dialout-trunk:19] Set("PJSIP/66-0000058c", "custom=PJSIP") in new stack
    -- Executing [s@macro-dialout-trunk:20] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Tt)") in new stack
    -- Executing [s@macro-dialout-trunk:21] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_TRUNK_OPTIONS=TtM(confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:22] Macro("PJSIP/66-0000058c", "dialout-trunk-predial-hook,") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/66-0000058c", "") in new stack
    -- Executing [s@macro-dialout-trunk:23] GotoIf("PJSIP/66-0000058c", "0?bypass,1") in new stack
    -- Executing [s@macro-dialout-trunk:24] ExecIf("PJSIP/66-0000058c", "0?Set(CONNECTEDLINE(num,i)=01233999999)") in new stack
    -- Executing [s@macro-dialout-trunk:25] ExecIf("PJSIP/66-0000058c", "0?Set(CONNECTEDLINE(name,i)=CID:+4923684000)") in new stack
    -- Executing [s@macro-dialout-trunk:26] ExecIf("PJSIP/66-0000058c", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)+4923684000)") in new stack
    -- Executing [s@macro-dialout-trunk:27] GotoIf("PJSIP/66-0000058c", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:28] ExecIf("PJSIP/66-0000058c", "0?Set(DIAL_TRUNK_OPTIONS=t)") in new stack
    -- Executing [s@macro-dialout-trunk:29] Set("PJSIP/66-0000058c", "HASH(__SIPHEADERS,Alert-Info)=unset") in new stack
    -- Executing [s@macro-dialout-trunk:30] Dial("PJSIP/66-0000058c", "PJSIP/01233999999@pjsip_telekom_0123456789,300,Ttb(func-apply-sipheaders^s^1,(9))U(sub-send-obroute-email^01233999999^01233999999^9^1692634435^^+4923684000)") in new stack
    -- PJSIP/pjsip_telekom_0123456789-0000058d Internal Gosub(func-apply-sipheaders,s,1(9)) start
    -- Executing [s@func-apply-sipheaders:1] NoOp("PJSIP/pjsip_telekom_0123456789-0000058d", "Applying SIP Headers to channel PJSIP/pjsip_telekom_0123456789-0000058d") in new stack
    -- Executing [s@func-apply-sipheaders:2] Set("PJSIP/pjsip_telekom_0123456789-0000058d", "TECH=PJSIP") in new stack
    -- Executing [s@func-apply-sipheaders:3] Set("PJSIP/pjsip_telekom_0123456789-0000058d", "SIPHEADERKEYS=Alert-Info") in new stack
    -- Executing [s@func-apply-sipheaders:4] While("PJSIP/pjsip_telekom_0123456789-0000058d", "1") in new stack
    -- Executing [s@func-apply-sipheaders:5] Set("PJSIP/pjsip_telekom_0123456789-0000058d", "sipheader=unset") in new stack
    -- Executing [s@func-apply-sipheaders:6] ExecIf("PJSIP/pjsip_telekom_0123456789-0000058d", "1?Set(PJSIP_HEADER(remove,Alert-Info)=)") in new stack
[2023-08-21 18:13:55] ERROR[31352]: res_pjsip_header_funcs.c:717 remove_header: No headers had been previously added to this session.
    -- Executing [s@func-apply-sipheaders:7] ExecIf("PJSIP/pjsip_telekom_0123456789-0000058d", "0?Set(sipheader=<http://127.0.0.1>;info=unset)") in new stack
    -- Executing [s@func-apply-sipheaders:8] ExecIf("PJSIP/pjsip_telekom_0123456789-0000058d", "0?Set(sipheader=<http://127.0.0.1>unset)") in new stack
    -- Executing [s@func-apply-sipheaders:9] ExecIf("PJSIP/pjsip_telekom_0123456789-0000058d", "0?Set(PJSIP_HEADER(add,Alert-Info)=unset)") in new stack
    -- Executing [s@func-apply-sipheaders:10] EndWhile("PJSIP/pjsip_telekom_0123456789-0000058d", "") in new stack
    -- Executing [s@func-apply-sipheaders:4] While("PJSIP/pjsip_telekom_0123456789-0000058d", "0") in new stack
    -- Executing [s@func-apply-sipheaders:11] Return("PJSIP/pjsip_telekom_0123456789-0000058d", "") in new stack
  == Spawn extension (func-apply-sipheaders, s, 11) exited non-zero on 'PJSIP/pjsip_telekom_0123456789-0000058d'
    -- PJSIP/pjsip_telekom_0123456789-0000058d Internal Gosub(func-apply-sipheaders,s,1(9)) complete GOSUB_RETVAL=
    -- Called PJSIP/01233999999@pjsip_telekom_0123456789
       > 0x7ff63808c1c0 -- Strict RTP learning after remote address set to: a.b.c.d:55876
    -- PJSIP/pjsip_telekom_0123456789-0000058d answered PJSIP/66-0000058c
    -- PJSIP/pjsip_telekom_0123456789-0000058d Internal Gosub(sub-send-obroute-email,s,1(01233999999,01233999999,9,1692634435,,+4923684000)) start
    -- Executing [s@sub-send-obroute-email:1] GotoIf("PJSIP/pjsip_telekom_0123456789-0000058d", "0?sendEmail") in new stack
    -- Executing [s@sub-send-obroute-email:2] NoOp("PJSIP/pjsip_telekom_0123456789-0000058d", "email notifications disabled..exiting.") in new stack
    -- Executing [s@sub-send-obroute-email:3] Return("PJSIP/pjsip_telekom_0123456789-0000058d", "") in new stack
  == Spawn extension (sub-send-obroute-email, s, 3) exited non-zero on 'PJSIP/pjsip_telekom_0123456789-0000058d'
    -- PJSIP/pjsip_telekom_0123456789-0000058d Internal Gosub(sub-send-obroute-email,s,1(01233999999,01233999999,9,1692634435,,+4923684000)) complete GOSUB_RETVAL=
       > 0x7ff6280076a0 -- Strict RTP learning after remote address set to: 10.x.y.66:30760
    -- Channel PJSIP/pjsip_telekom_0123456789-0000058d joined 'simple_bridge' basic-bridge <07e2735d-e647-456c-a3fa-07593f2aa6ce>
    -- Channel PJSIP/66-0000058c joined 'simple_bridge' basic-bridge <07e2735d-e647-456c-a3fa-07593f2aa6ce>
       > 0x7ff6280076a0 -- Strict RTP switching to RTP target address 10.x.y.66:30760 as source
       > 0x7ff63808c1c0 -- Strict RTP switching to RTP target address a.b.c.d:55876 as source
       > 0x7ff63808c1c0 -- Strict RTP learning complete - Locking on source address a.b.c.d:55876
       > 0x7ff6280076a0 -- Strict RTP learning complete - Locking on source address 10.x.y.66:30760
pbx-sys-1*CLI> 

What are your outbound routes in FreePBX?

this one is chosen:

[ Context 'outrt-5' created by 'pbx_config' ]
  '_+Z.' =>         1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:3978]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:3979]
                    3. Set(_ROUTEID=5)                            [extensions_additional.conf:3980]
                    4. Set(_ROUTENAME=Default_4000)               [extensions_additional.conf:3981]
                    5. Set(EMERGENCYROUTE=YES)                    [extensions_additional.conf:3982]
                    6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [extensions_additional.conf:3983]
                    7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:3984]
                    8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:3985]
                    9. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:3986]
                    10. Set(_NODEST=)                             [extensions_additional.conf:3987]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:3988]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:3989]
  '_004.' =>        1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:3991]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:3992]
                    3. Set(_ROUTEID=5)                            [extensions_additional.conf:3993]
                    4. Set(_ROUTENAME=Default_4000)               [extensions_additional.conf:3994]
                    5. Set(EMERGENCYROUTE=YES)                    [extensions_additional.conf:3995]
                    6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [extensions_additional.conf:3996]
                    7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:3997]
                    8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:3998]
                    9. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:3999]
                    10. Set(_NODEST=)                             [extensions_additional.conf:4000]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:4001]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:4002]
  '_0ZX.' =>        1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:4004]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:4005]
                    3. Set(_ROUTEID=5)                            [extensions_additional.conf:4006]
                    4. Set(_ROUTENAME=Default_4000)               [extensions_additional.conf:4007]
                    5. Set(EMERGENCYROUTE=YES)                    [extensions_additional.conf:4008]
                    6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [extensions_additional.conf:4009]
                    7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:4010]
                    8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:4011]
                    9. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:4012]
                    10. Set(_NODEST=)                             [extensions_additional.conf:4013]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:4014]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:4015]
  '_Z.' =>          1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:4030]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:4031]
                    3. Set(_ROUTEID=5)                            [extensions_additional.conf:4032]
                    4. Set(_ROUTENAME=Default_4000)               [extensions_additional.conf:4033]
                    5. Set(EMERGENCYROUTE=YES)                    [extensions_additional.conf:4034]
                    6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [extensions_additional.conf:4035]
                    7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:4036]
                    8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:4037]
                    9. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:4038]
                    10. Set(_NODEST=)                             [extensions_additional.conf:4039]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:4040]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:4041]
  '_XZ.' =>         1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:4017]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:4018]
                    3. Set(_ROUTEID=5)                            [extensions_additional.conf:4019]
                    4. Set(_ROUTENAME=Default_4000)               [extensions_additional.conf:4020]
                    5. Set(EMERGENCYROUTE=YES)                    [extensions_additional.conf:4021]
                    6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [extensions_additional.conf:4022]
                    7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:4023]
                    8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:4024]
                    9. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:4025]
                    10. Set(_NODEST=)                             [extensions_additional.conf:4026]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:4027]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:4028]
  Include =>        'outrt-5-custom'                              [pbx_config]

-= 5 extensions (60 priorities) in 1 context. =-

this one should be used (and it works, if i use “61” as cid and call from extension 61):

pbx-hno*CLI> dialplan show outrt-7
[ Context 'outrt-7' created by 'pbx_config' ]
  '_XXX.' (CID match '66') =>  1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:3879]
                    2. Gosub(sub-record-check,s,1(out,${EXTEN},dontcare)) [extensions_additional.conf:3880]
                    3. Set(_ROUTEID=7)                            [extensions_additional.conf:3881]
                    4. Set(_ROUTENAME=02368692860-fax)            [extensions_additional.conf:3882]
                    5. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?none:${MOHCLASS})}) [extensions_additional.conf:3883]
                    6. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [extensions_additional.conf:3884]
                    7. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [extensions_additional.conf:3885]
                    8. Set(_EMAILNOTIFICATION=FALSE)              [extensions_additional.conf:3886]
                    9. Set(_NODEST=)                              [extensions_additional.conf:3887]
                    10. Macro(dialout-trunk,2,${EXTEN},,on)       [extensions_additional.conf:3888]
                    11. Macro(dialout-trunk,9,${EXTEN},,on)       [extensions_additional.conf:3889]
                    12. Macro(outisbusy,)                         [extensions_additional.conf:3890]
  '_XXX.' =>        1. Macro(user-callerid,LIMIT,EXTERNAL,)       [extensions_additional.conf:3877]
  Include =>        'outrt-7-custom'                              [pbx_config]

-= 2 extensions (13 priorities) in 1 context. =-

kind regards,
andre

Can you do a full log of a call from 66 and a call from 61, to the same destination?

great debug freepbx

anon3.tgz (4.6 KB)
C-00000369 call from extension 61 to 02XXXXXXXX8 via correct route (routename 023686XXXX0-fax)
C-0000036b call from extension 66 to 02XXXXXXXX8 via wring route (routename default_4000)

the outgoing route has been changed to the relevant xetension in callerid (C-0000369 → callerid 61, C-000036b → callerid 66)

Can you follow the instructions and post to pastebim?

sure, excuse, wasn’t aware that pastebin was the desired way.
here you are:
https://pastebin.freepbx.org/view/c9780a74

i assume that the issue is something with the registration of extension 66. this extension is used by an external application. all “internal” extensions (all are yealinks) are working without any problems using the outbound route based on cid.

any further idea how to debug this? i need my fax-extension to use another trunk for allowing only g711a. other trunks are using g722 (preferred). but this might cause some issues in fax-transfer so.

regards,
andre

Check the pastebin you posted and search for “CALLERID(number)” and see the difference… There’s your problem.

Your freeswitch server sends no/wrong callerid so that’s why it’s not hitting the route.