[asterisk-bugs] [JIRA] (ASTERISK-30100) res_pjsip: Path is ignored on INVITE to endpoint

Igor Goncharovsky (JIRA) noreply at issues.asterisk.org
Fri Nov 4 02:50:09 CDT 2022


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Goncharovsky updated ASTERISK-30100:
-----------------------------------------

    Attachment: workarround_ASTERISK-30100.diff

> res_pjsip: Path is ignored on INVITE to endpoint
> ------------------------------------------------
>
>                 Key: ASTERISK-30100
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30100
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip
>    Affects Versions: 18.7.0, 18.12.0, 18.12.1
>         Environment: Ubuntu 20.04.4 LTS
>            Reporter: Yury Kirsanov
>            Assignee: Unassigned
>            Severity: Major
>              Labels: patch
>         Attachments: workarround_ASTERISK-30100.diff
>
>
> 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 at 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 at 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 at 103.242.182.172>;tag=dfc08802-aee3-420f-bfc8-c817b12b7d36
> [Jun  8 18:31:39] To: <sip:T273842 at 185.97.201.93;rinstance=97f9c0e29d88ed2e>
> [Jun  8 18:31:39] Contact: <sip:T273842 at 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 at 185.97.201.93;rinstance=97f9c0e29d88ed2e>;tag=cede251d
> [Jun  8 18:31:39] From: <sip:T273842 at 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 at 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 at 185.97.201.93:1920;transport=tcp>
> [Jun  8 18:31:43] To: <sip:1008 at siptreg.au.voipcloud.online:7060>
> [Jun  8 18:31:43] From: <sip:792543 at 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 at siptreg.au.voipcloud.online>;tag=2ec3c343
> [Jun  8 18:31:43] To: <sip:1008 at 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 at from-sip-device:1] NoOp("PJSIP/792543-00000045", ""Incoming call from sip device"") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:2] GotoIf("PJSIP/792543-00000045", "0?from-sip-device,1008,3") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:3] Set("PJSIP/792543-00000045", "__call_source=device") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:4] Set("PJSIP/792543-00000045", "__received-on-exten=1008") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:5] Set("PJSIP/792543-00000045", "__client-prefered-cid=") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at from-sip-device:11] NoOp("PJSIP/792543-00000045", "Incoming call from endpoint 792543") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at from-sip-device:13] Set("PJSIP/792543-00000045", "__received_PAI=") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:14] Set("PJSIP/792543-00000045", "__received_Privacy=") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:15] Set("PJSIP/792543-00000045", "__received_RPID=") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at from-sip-device:16] Set("PJSIP/792543-00000045", "__endpoint=792543") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at 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 at 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 at 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 at 844-from-user-1006:2] ExecIf("PJSIP/792543-00000045", "0?Set(__ext_cid=61370187563)") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:3] ExecIf("PJSIP/792543-00000045", "0?Set(__local_cid=1006)") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:4] ExecIf("PJSIP/792543-00000045", "0?Set(__name_cid=3)") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:5] Set("PJSIP/792543-00000045", "__outgoing=1") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:6] Set("PJSIP/792543-00000045", "__client-account-code=4183727567") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:7] Set("PJSIP/792543-00000045", "__tenant_id=844") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at 844-from-user-1006:9] Set("PJSIP/792543-00000045", "CHANNEL(musicclass)=music-collection-1") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:10] Set("PJSIP/792543-00000045", "CALLERID(num)=1006") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:11] Set("PJSIP/792543-00000045", "CALLERID(name)=3") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 844-from-user-1006:12] NoOp("PJSIP/792543-00000045", "##### 61370187563 1006 3 ######") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at 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 at 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 at 844-dialplan-11:2] Gosub("PJSIP/792543-00000045", "internal-incoming-call,1008,1") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at internal-incoming-call:1] NoOp("PJSIP/792543-00000045", ""1008"") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at internal-incoming-call:2] ExecIf("PJSIP/792543-00000045", "1?Set(__incoming_did=1008)") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at internal-incoming-call:3] Return("PJSIP/792543-00000045", "CONTINUE") in new stack
> [Jun  8 18:31:43]     -- Executing [1008 at 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 at sip-trunk-844-151:1] Gosub("PJSIP/792543-00000045", "check-context-loop,s,1") in new stack
> [Jun  8 18:31:43]     -- Executing [s at check-context-loop:1] GotoIf("PJSIP/792543-00000045", "0?context_number_exists") in new stack
> [Jun  8 18:31:43]     -- Executing [s at 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 at check-context-loop:3] Set("PJSIP/792543-00000045", "MASTER_CHANNEL(CONTEXT_NUMBER)=0") in new stack
> [Jun  8 18:31:43]     -- Executing [s at check-context-loop:4] Set("PJSIP/792543-00000045", "MASTER_CHANNEL(CONTEXT_NUMBER)=1") in new stack
> [Jun  8 18:31:43]     -- Executing [s at check-context-loop:5] NoOp("PJSIP/792543-00000045", "CONTEXT_NUMBER: 1") in new stack
> [Jun  8 18:31:43]     -- Executing [s at check-context-loop:6] ExecIf("PJSIP/792543-00000045", "1?Return(CONTINUE)") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:2] Set("PJSIP/792543-00000045", "PJSIP_HEADER(remove,X-MyAcc)=") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:3] Set("PJSIP/792543-00000045", "__trunk_channel_limit=1") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:4] Set("PJSIP/792543-00000045", "GROUP()=T273842") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:5] NoOp("PJSIP/792543-00000045", ""Now 1, Limit 1"") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:6] GotoIf("PJSIP/792543-00000045", "0?decline") in new stack
> [Jun  8 18:31:43]     -- Executing [s at sip-trunk-844-151:7] Dial("PJSIP/792543-00000045", "PJSIP/1008 at T273842,30") in new stack
> [Jun  8 18:31:43]     -- Called PJSIP/1008 at 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 at 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 at 103.242.182.172>;tag=caca7af2-f20b-4a67-a929-c0cb56dd5cbc
> [Jun  8 18:31:43] To: <sip:1008 at 185.97.201.93;rinstance=97f9c0e29d88ed2e>
> [Jun  8 18:31:43] Contact: <sip:asterisk at 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list