[Home]

Summary:ASTERISK-30100: res_pjsip: Path is ignored on INVITE to endpoint
Reporter:Yury Kirsanov (lt_flash)Labels:patch
Date Opened:2022-06-08 03:58:55Date Closed:2022-12-20 07:55:02.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip
Versions:18.7.0 18.12.0 18.12.1 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-27963 res_pjsip: ignore Path header on INVITE
Environment:Ubuntu 20.04.4 LTSAttachments:( 0) patch_path_support_URI_dial.diff
( 1) workarround_ASTERISK-30100.diff
Description:Intermediate proxy adds a SIP PATH header and it's accepted and stored by Asterisk fine:
{noformat}
/registrar/contact/T273842;@a1886a275e520d115781af8c62e6a7db: {"via_addr":"192.168.1.107","qualify_timeout":"3.000000","call_id":"ulFj_sEMIZ3ASt4t2M7udA..","reg_server":"au-mpbx-dev-cluster2","prune_on_boot":"no","path":"<sip:10.22.23.160;r2=on;lr>,<sip:103.242.182.180:7060;transport=tcp;r2=on;lr>","endpoint":"T273842","via_port":"63450","authenticate_qualify":"yes","uri":"sip:T273842@185.97.201.93:3766;transport=TCP;rinstance=97f9c0e29d88ed2e","qualify_frequency":"15","user_agent":"Zoiper rv2.10.8.2","expiration_time":"1654678226","outbound_proxy":""}
{noformat}
SIP OPTIONS are generated correctly, SIP packet is sent out to SIP proxy and not directly to Contact:
{noformat}
[Jun  8 18:31:39] <--- Transmitting SIP request (608 bytes) to UDP:10.22.23.160:5060 --->
[Jun  8 18:31:39] OPTIONS sip:T273842@185.97.201.93:3766;transport=TCP;rinstance=97f9c0e29d88ed2e SIP/2.0
[Jun  8 18:31:39] Via: SIP/2.0/UDP 10.22.23.172:7060;rport;branch=z9hG4bKPj3e1790e6-65b9-4750-bffa-26534c8b4ca3
[Jun  8 18:31:39] From: <sip:T273842@103.242.182.172>;tag=dfc08802-aee3-420f-bfc8-c817b12b7d36
[Jun  8 18:31:39] To: <sip:T273842@185.97.201.93;rinstance=97f9c0e29d88ed2e>
[Jun  8 18:31:39] Contact: <sip:T273842@10.22.23.172:7060>
[Jun  8 18:31:39] Call-ID: 1968ee89-5c74-4af9-9b9d-c0d4ba7a2a73
[Jun  8 18:31:39] CSeq: 30020 OPTIONS
[Jun  8 18:31:39] Supported: path
[Jun  8 18:31:39] Route: <sip:10.22.23.160;lr;r2=on>
[Jun  8 18:31:39] Route: <sip:103.242.182.180:7060;transport=tcp;lr;r2=on>
[Jun  8 18:31:39] Max-Forwards: 70
[Jun  8 18:31:39] User-Agent: mPBX/1.9.21
[Jun  8 18:31:39] Content-Length:  0
[Jun  8 18:31:39]
[Jun  8 18:31:39]
[Jun  8 18:31:39] <--- Received SIP response (924 bytes) from UDP:10.22.23.160:5060 --->
[Jun  8 18:31:39] SIP/2.0 200 OK
[Jun  8 18:31:39] Via: SIP/2.0/UDP 10.22.23.172:7060;received=10.22.23.172;rport=7060;branch=z9hG4bKPj3e1790e6-65b9-4750-bffa-26534c8b4ca3
[Jun  8 18:31:39] Record-Route: <sip:103.242.182.180:7060;transport=tcp;r2=on;lr;ftag=dfc08802-aee3-420f-bfc8-c817b12b7d36>
[Jun  8 18:31:39] Record-Route: <sip:10.22.23.160;r2=on;lr;ftag=dfc08802-aee3-420f-bfc8-c817b12b7d36>
[Jun  8 18:31:39] Contact: <sip:185.97.201.93:3766;transport=tcp>
[Jun  8 18:31:39] To: <sip:T273842@185.97.201.93;rinstance=97f9c0e29d88ed2e>;tag=cede251d
[Jun  8 18:31:39] From: <sip:T273842@103.242.182.172>;tag=dfc08802-aee3-420f-bfc8-c817b12b7d36
[Jun  8 18:31:39] Call-ID: 1968ee89-5c74-4af9-9b9d-c0d4ba7a2a73
[Jun  8 18:31:39] CSeq: 30020 OPTIONS
[Jun  8 18:31:39] Accept: application/sdp, application/sdp
[Jun  8 18:31:39] Accept-Language: en
[Jun  8 18:31:39] Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
[Jun  8 18:31:39] Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
[Jun  8 18:31:39] User-Agent: Zoiper rv2.10.8.2
[Jun  8 18:31:39] Allow-Events: presence, kpml, talk
[Jun  8 18:31:39] Content-Length: 0
{noformat}
If I use Dial to dial a contact in 'user' mode, not 'trunk', SIP PATH is used and honoured. But when I try to dial like in 'trunk' mode SIP PATH is ignored, SIP packet is sent out to Contact address, no Route headers are added:
{noformat}
[Jun  8 18:31:43] <--- Received SIP request (1537 bytes) from UDP:10.22.23.160:5060 --->
[Jun  8 18:31:43] INVITE sip:1008@10.22.23.172:7060;transport=TCP SIP/2.0
[Jun  8 18:31:43] Record-Route: <sip:10.22.23.160;r2=on;lr;ftag=2ec3c343;did=acc.e6df8051>
[Jun  8 18:31:43] Record-Route: <sip:103.242.182.180:7060;transport=tcp;r2=on;lr;ftag=2ec3c343;did=acc.e6df8051>
[Jun  8 18:31:43] Via: SIP/2.0/UDP 10.22.23.160:5060;branch=z9hG4bKefc4.0b926672.0;i=8d8f2836
[Jun  8 18:31:43] Via: SIP/2.0/TCP 192.168.1.38:50570;rport=1920;received=185.97.201.93;branch=z9hG4bK-524287-1---1904426299b272ff
[Jun  8 18:31:43] Max-Forwards: 69
[Jun  8 18:31:43] Contact: <sip:792543@185.97.201.93:1920;transport=tcp>
[Jun  8 18:31:43] To: <sip:1008@siptreg.au.voipcloud.online:7060>
[Jun  8 18:31:43] From: <sip:792543@siptreg.au.voipcloud.online:7060;transport=TCP>;tag=2ec3c343
[Jun  8 18:31:43] Call-ID: zgoni_E2Y8cLSe5edphwyA..
[Jun  8 18:31:43] CSeq: 2 INVITE
[Jun  8 18:31:43] Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
[Jun  8 18:31:43] Content-Type: application/sdp
[Jun  8 18:31:43] User-Agent: Zoiper v2.10.17.3
[Jun  8 18:31:43] Allow-Events: presence, kpml, talk
[Jun  8 18:31:43] Content-Length: 323
[Jun  8 18:31:43]
[Jun  8 18:31:43] v=0
[Jun  8 18:31:43] o=Z 7534386 1 IN IP4 10.22.20.49
[Jun  8 18:31:43] s=Z
[Jun  8 18:31:43] c=IN IP4 10.22.20.49
[Jun  8 18:31:43] t=0 0
[Jun  8 18:31:43] m=audio 30646 RTP/AVP 3 101 0 8 110 97
[Jun  8 18:31:43] a=rtpmap:3 GSM/8000
[Jun  8 18:31:43] a=rtpmap:101 telephone-event/8000
[Jun  8 18:31:43] a=rtpmap:0 PCMU/8000
[Jun  8 18:31:43] a=rtpmap:8 PCMA/8000
[Jun  8 18:31:43] a=rtpmap:110 speex/8000
[Jun  8 18:31:43] a=rtpmap:97 iLBC/8000
[Jun  8 18:31:43] a=fmtp:101 0-16
[Jun  8 18:31:43] a=fmtp:97 mode=30
[Jun  8 18:31:43] a=sendrecv
[Jun  8 18:31:43] a=rtcp:30647
[Jun  8 18:31:43]
[Jun  8 18:31:43] <--- Transmitting SIP response (613 bytes) to UDP:10.22.23.160:5060 --->
[Jun  8 18:31:43] SIP/2.0 100 Trying
[Jun  8 18:31:43] Via: SIP/2.0/UDP 10.22.23.160:5060;rport=5060;received=10.22.23.160;branch=z9hG4bKefc4.0b926672.0;i=8d8f2836
[Jun  8 18:31:43] Via: SIP/2.0/TCP 192.168.1.38:50570;rport=1920;received=185.97.201.93;branch=z9hG4bK-524287-1---1904426299b272ff
[Jun  8 18:31:43] Record-Route: <sip:10.22.23.160;lr;r2=on;ftag=2ec3c343;did=acc.e6df8051>
[Jun  8 18:31:43] Record-Route: <sip:103.242.182.180:7060;transport=tcp;lr;r2=on;ftag=2ec3c343;did=acc.e6df8051>
[Jun  8 18:31:43] Call-ID: zgoni_E2Y8cLSe5edphwyA..
[Jun  8 18:31:43] From: <sip:792543@siptreg.au.voipcloud.online>;tag=2ec3c343
[Jun  8 18:31:43] To: <sip:1008@siptreg.au.voipcloud.online>
[Jun  8 18:31:43] CSeq: 2 INVITE
[Jun  8 18:31:43] Server: mPBX/1.9.21
[Jun  8 18:31:43] Content-Length:  0
[Jun  8 18:31:43]
[Jun  8 18:31:43]
[Jun  8 18:31:43]   == Using SIP RTP Audio TOS bits 184
[Jun  8 18:31:43]   == Using SIP RTP Audio TOS bits 184 in TCLASS field.
[Jun  8 18:31:43]   == Using SIP RTP Audio CoS mark 5
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:1] NoOp("PJSIP/792543-00000045", ""Incoming call from sip device"") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:2] GotoIf("PJSIP/792543-00000045", "0?from-sip-device,1008,3") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:3] Set("PJSIP/792543-00000045", "__call_source=device") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:4] Set("PJSIP/792543-00000045", "__received-on-exten=1008") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:5] Set("PJSIP/792543-00000045", "__client-prefered-cid=") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:6] GotoIf("PJSIP/792543-00000045", "1?direct") in new stack
[Jun  8 18:31:43]     -- Goto (from-sip-device,1008,11)
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:11] NoOp("PJSIP/792543-00000045", "Incoming call from endpoint 792543") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:12] Set("PJSIP/792543-00000045", "__client-recieved-ip=10.22.23.160") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:13] Set("PJSIP/792543-00000045", "__received_PAI=") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:14] Set("PJSIP/792543-00000045", "__received_Privacy=") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:15] Set("PJSIP/792543-00000045", "__received_RPID=") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:16] Set("PJSIP/792543-00000045", "__endpoint=792543") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:17] GotoIf("PJSIP/792543-00000045", "1?notransfer") in new stack
[Jun  8 18:31:43]     -- Goto (from-sip-device,1008,27)
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:27] UserEvent("PJSIP/792543-00000045", "MPBX_NEW_CALL, callerid: 792543, callername: , callernumber: 792543, dest_number: 1008") in new stack
[Jun  8 18:31:43]     -- Executing [1008@from-sip-device:28] GotoIf("PJSIP/792543-00000045", "0?link-device,1008,1:844-from-user-1006,1008,1") in new stack
[Jun  8 18:31:43]     -- Goto (844-from-user-1006,1008,1)
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:1] NoOp("PJSIP/792543-00000045", "##### Incoming call from user 844-1006 ######") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:2] ExecIf("PJSIP/792543-00000045", "0?Set(__ext_cid=61370187563)") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:3] ExecIf("PJSIP/792543-00000045", "0?Set(__local_cid=1006)") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:4] ExecIf("PJSIP/792543-00000045", "0?Set(__name_cid=3)") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:5] Set("PJSIP/792543-00000045", "__outgoing=1") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:6] Set("PJSIP/792543-00000045", "__client-account-code=4183727567") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:7] Set("PJSIP/792543-00000045", "__tenant_id=844") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:8] ExecIf("PJSIP/792543-00000045", "0?Gosub(allowed-cid-list-844,s,1())") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:9] Set("PJSIP/792543-00000045", "CHANNEL(musicclass)=music-collection-1") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:10] Set("PJSIP/792543-00000045", "CALLERID(num)=1006") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:11] Set("PJSIP/792543-00000045", "CALLERID(name)=3") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:12] NoOp("PJSIP/792543-00000045", "##### 61370187563 1006 3 ######") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:13] UserEvent("PJSIP/792543-00000045", "MPBX_OUTBOUND_USER_CALL, tenant_id: 844, calling_user_callerid: 61370187563, callertype: device, caller_user_number: 1006, dest_number: 1008, needs_outbound_user_call_webhook: 0,is_webhook_enabled:0, caller_user_name: 3") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-from-user-1006:14] Goto("PJSIP/792543-00000045", "844-dialplan-11,1008,1") in new stack
[Jun  8 18:31:43]     -- Goto (844-dialplan-11,1008,1)
[Jun  8 18:31:43]     -- Executing [1008@844-dialplan-11:1] NoOp("PJSIP/792543-00000045", ""New incoming call to 1008 from "3" <1006>"") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-dialplan-11:2] Gosub("PJSIP/792543-00000045", "internal-incoming-call,1008,1") in new stack
[Jun  8 18:31:43]     -- Executing [1008@internal-incoming-call:1] NoOp("PJSIP/792543-00000045", ""1008"") in new stack
[Jun  8 18:31:43]     -- Executing [1008@internal-incoming-call:2] ExecIf("PJSIP/792543-00000045", "1?Set(__incoming_did=1008)") in new stack
[Jun  8 18:31:43]     -- Executing [1008@internal-incoming-call:3] Return("PJSIP/792543-00000045", "CONTINUE") in new stack
[Jun  8 18:31:43]     -- Executing [1008@844-dialplan-11:3] Goto("PJSIP/792543-00000045", "sip-trunk-844-151,s,1") in new stack
[Jun  8 18:31:43]     -- Goto (sip-trunk-844-151,s,1)
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:1] Gosub("PJSIP/792543-00000045", "check-context-loop,s,1") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:1] GotoIf("PJSIP/792543-00000045", "0?context_number_exists") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:2] NoOp("PJSIP/792543-00000045", "MASTER_CHANNEL variable CONTEXT_NUMBER does NOT exist!") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:3] Set("PJSIP/792543-00000045", "MASTER_CHANNEL(CONTEXT_NUMBER)=0") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:4] Set("PJSIP/792543-00000045", "MASTER_CHANNEL(CONTEXT_NUMBER)=1") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:5] NoOp("PJSIP/792543-00000045", "CONTEXT_NUMBER: 1") in new stack
[Jun  8 18:31:43]     -- Executing [s@check-context-loop:6] ExecIf("PJSIP/792543-00000045", "1?Return(CONTINUE)") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:2] Set("PJSIP/792543-00000045", "PJSIP_HEADER(remove,X-MyAcc)=") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:3] Set("PJSIP/792543-00000045", "__trunk_channel_limit=1") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:4] Set("PJSIP/792543-00000045", "GROUP()=T273842") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:5] NoOp("PJSIP/792543-00000045", ""Now 1, Limit 1"") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:6] GotoIf("PJSIP/792543-00000045", "0?decline") in new stack
[Jun  8 18:31:43]     -- Executing [s@sip-trunk-844-151:7] Dial("PJSIP/792543-00000045", "PJSIP/1008@T273842,30") in new stack
[Jun  8 18:31:43]     -- Called PJSIP/1008@T273842
[Jun  8 18:31:43]   == Using SIP RTP Audio TOS bits 184
[Jun  8 18:31:43]   == Using SIP RTP Audio TOS bits 184 in TCLASS field.
[Jun  8 18:31:43]   == Using SIP RTP Audio CoS mark 5
[Jun  8 18:31:43] <--- Transmitting SIP request (1061 bytes) to TCP:185.97.201.93:3766 --->
[Jun  8 18:31:43] INVITE sip:1008@185.97.201.93:3766;transport=TCP;rinstance=97f9c0e29d88ed2e SIP/2.0
[Jun  8 18:31:43] Via: SIP/2.0/TCP 103.242.182.172:7060;rport;branch=z9hG4bKPja75858f5-3c01-4270-a281-6d321d12af76;alias
[Jun  8 18:31:43] From: "3" <sip:1006@103.242.182.172>;tag=caca7af2-f20b-4a67-a929-c0cb56dd5cbc
[Jun  8 18:31:43] To: <sip:1008@185.97.201.93;rinstance=97f9c0e29d88ed2e>
[Jun  8 18:31:43] Contact: <sip:asterisk@103.242.182.172:7060;transport=TCP>
[Jun  8 18:31:43] Call-ID: 2acded7f-d758-4149-9f90-8cae79a5fec8
[Jun  8 18:31:43] CSeq: 5950 INVITE
[Jun  8 18:31:43] Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
[Jun  8 18:31:43] Supported: 100rel, replaces, norefersub, histinfo
[Jun  8 18:31:43] Max-Forwards: 70
[Jun  8 18:31:43] User-Agent: mPBX/1.9.21
[Jun  8 18:31:43] Content-Type: application/sdp
[Jun  8 18:31:43] Content-Length:   349
[Jun  8 18:31:43]
[Jun  8 18:31:43] v=0
[Jun  8 18:31:43] o=mPBX/1.9.21 259858751 259858751 IN IP4 103.242.182.172
[Jun  8 18:31:43] s=mPBX/1.9.21
[Jun  8 18:31:43] c=IN IP4 103.242.182.172
[Jun  8 18:31:43] t=0 0
[Jun  8 18:31:43] m=audio 16734 RTP/AVP 0 8 9 18 101
[Jun  8 18:31:43] a=rtpmap:0 PCMU/8000
[Jun  8 18:31:43] a=rtpmap:8 PCMA/8000
[Jun  8 18:31:43] a=rtpmap:9 G722/8000
[Jun  8 18:31:43] a=rtpmap:18 G729/8000
[Jun  8 18:31:43] a=fmtp:18 annexb=no
[Jun  8 18:31:43] a=rtpmap:101 telephone-event/8000
[Jun  8 18:31:43] a=fmtp:101 0-16
[Jun  8 18:31:43] a=ptime:20
[Jun  8 18:31:43] a=maxptime:150
[Jun  8 18:31:43] a=sendrecv
{noformat}
So the call can't be established as there's no direct communication between Asterisk and SIP client.
Comments:By: Asterisk Team (asteriskteam) 2022-06-08 03:58:55.850-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2022-06-08 04:12:33.379-0500

You need to also provide the PJSIP configuration. The rewrite_contact option, for example, will alter the behavior.

By: Yury Kirsanov (lt_flash) 2022-06-08 04:17:24.959-0500

[device-template-aor](!)
authenticate_qualify = yes
qualify_timeout = 3
qualify_frequency = 15
maximum_expiration = 3600
minimum_expiration = 30
default_expiration = 120
max_contacts = 2
support_path = yes
remove_existing = yes

[device-template-endpoint](!)
dtmf_mode = rfc4733
disallow = all
allow = ulaw
allow = alaw
allow = g722
allow = g729
allow = h264
trust_id_inbound = yes
rtp_symmetric = yes
media_use_received_transport = yes
force_rport = yes
rewrite_contact = no
rtp_timeout = 30
timers = no
direct_media = no
inband_progress = no
tos_audio = ef
tos_video = af41
cos_audio = 5
cos_video = 4
sdp_owner = mPBX/{MPBX_VERSION}
sdp_session = mPBX/{MPBX_VERSION}
tone_zone = {MPBX_COUNTRY}
language = {MPBX_LANGUAGE}
t38_udptl = no
t38_udptl_ec = none
context = from-customer
allow_transfer = yes
refer_blind_progress = yes
notify_early_inuse_ringing = yes
send_pai = no
send_rpid = no
set_var = max-calls=1

;----------------------------------------------------------------------
; SIP trunk 55 definition (mode C)
[T273842](device-template-aor)
type = aor
max_contacts = 1
remove_existing = Yes

[T273842]
type = auth
username = T273842
password = XXXXXXXXXXXXXXXXXX

[T273842](device-template-endpoint)
type = endpoint
auth = T273842
aors = T273842
accountcode = 0379318280
context = from-sip-trunk
trust_id_inbound = yes
trust_id_outbound = yes
identify_by = username,auth_username
set_var = __trunk_channel_limit=1
set_var = __trunk_context=844-dialplan-11
disallow = all
allow = g722
allow = g729
allow = ulaw
allow = alaw



By: Yury Kirsanov (lt_flash) 2022-06-08 07:51:04.834-0500

I'd like to add that this behaviour only happens when dialing into PJSIP trunk with '@' in it. When I just simply dial an endpoint with Dial(PJSIP/${EXTEN},30) for example - everything works fine. It only fails when dialing Dial(PJSIP/${EXTEN}@some_trunk,30).

By: Kevin Harwell (kharwell) 2022-06-08 16:59:34.253-0500

I was able to replicate this as well. There is difference in what's sent when using different dial strings, e.g.
{noformat}
exten => alice,1,NoOp()
same => n,Dial(${TECH}/${EXTEN},30)
same => n,Hangup()
{noformat}
vs.
{noformat}
exten => alice,1,NoOp()
same => n,Dial(${TECH}/temp@alice,30)
same => n,Hangup()
{noformat}
_pjsip.conf_:
{noformat}
[endpoint_t](!)
type=endpoint
context=default
direct_media=no
allow=!all,ulaw
rtcp_mux=yes

[aor_t](!)
type=aor
max_contacts=10
support_path=yes

[alice](aor_t)
mailboxes=alice@default

[alice](endpoint_t)
aors=alice
{noformat}

By: Yury Kirsanov (lt_flash) 2022-06-16 11:47:38.346-0500

Hi,
I know there are no time frames, but is this going to be addressed any time soon? Any smallest chance? Does it worth to try to compile non-bundled PJSIP project or is this a pure Asterisk issue? Thanks.

By: Joshua C. Colp (jcolp) 2022-06-16 11:51:04.538-0500

It's an Asterisk issue. I know of noone working on the issue.

By: Igor Goncharovsky (igorg) 2022-11-04 02:47:32.349-0500

I am trying to help Yuri with this issue. Currently made dirty workarround that prevent setting user part of RURI and this prevend Asterisk send INVITE directly.

I have now impression that the real issue in the PJSIP code, becasue there no additional logic that could selectively add Route header to the INVITE before calling pjsip_inv_invite(). Could you confirm that?

By: Igor Goncharovsky (igorg) 2022-11-04 03:08:19.157-0500

Ok, found an issue. In the path_outgoing_request code look for the aor to check if there is path support using RURI and unable to find it:
aor = find_aor(endpoint, tdata->msg->line.req.uri)

By: Igor Goncharovsky (igorg) 2022-11-04 04:27:40.341-0500

Currenly I see a way to fix that case: add default_support_path option to the endpoint and in case of aor does not found use this opton to decide whether to add Route header or not.

By: Friendly Automation (friendly-automation) 2022-12-20 07:55:04.657-0600

Change 19693 merged by Friendly Automation:
res_pjsip: Fix path usage in case dialing with '@'

[https://gerrit.asterisk.org/c/asterisk/+/19693|https://gerrit.asterisk.org/c/asterisk/+/19693]

By: Friendly Automation (friendly-automation) 2022-12-20 08:52:48.971-0600

Change 19471 merged by George Joseph:
res_pjsip: Fix path usage in case dialing with '@'

[https://gerrit.asterisk.org/c/asterisk/+/19471|https://gerrit.asterisk.org/c/asterisk/+/19471]

By: Friendly Automation (friendly-automation) 2022-12-20 08:52:51.109-0600

Change 19692 merged by George Joseph:
res_pjsip: Fix path usage in case dialing with '@'

[https://gerrit.asterisk.org/c/asterisk/+/19692|https://gerrit.asterisk.org/c/asterisk/+/19692]