Hello all,
I have a kamailio ( kamailio 5.5.3 (x86_64/linux)) with asterisk (Asterisk 16.2.1~dfsg-2ubuntu1) with following architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │ Asterisk ├───────┤ Kamailio │ 188.xxx.59.171 ───────── 103.xxx.xx.134 │ Linphone │ └─────────────┘ └─────────────┘ └─────────────────────┘ 10.10.1.13 10.10.1.9
In case the diagram is not displayed correctly its pasted at https://pastebin.com/b0UtE4Lj
Registrations are handled by Kamailio and calls from linphone are routed to Asterisk. Similarly all calls originating in asterisk are routed over to Kamailio which in turn looks up AOR and routes the calls over to Linphone.
Along with Linphone I also have a WebRTC endpoint at Kamailio.
When calls are sent to WebRTC from asterisk, it gets correctly routed over to Asterisk, but if the client is Linphone the ACK of 200OK is not routed correctly to Linphone.
I get this error in the logs:
[core/forward.c:229]: get_send_socket2(): protocol/port mismatch (forced tls:188.xxx.59.171:5061, to udp:188.xxx.59.171:5060)
Digging into the difference between WebRTC and Linphone, I could see that in 1800 Ringing packet from WebRTC has a Contact headers while its missing in the packet from Linphone
This is the 180 ringing from WebRTC:
tag: rcv pid: 695615 process: 17 time: 1644860126.209155 date: Mon Feb 14 23:05:26 2022 proto: wss ipv4 srcip: 103.xxx.xx.134 srcport: 52508 dstip: 188.xxx.59.171 dstport: 443 ~~~~~~~~~~~~~~~~~~~~ SIP/2.0 180 Ringing Via: SIP/2.0/WSS 188.xxx.59.171:443;branch=z9hG4bK730a.2cc7461b72f0c895e7cce5a0cedce4f7.0 Via: SIP/2.0/UDP 10.10.1.13:7000;received=10.10.1.13;rport=7000;branch=z9hG4bKPje4d8c7fc-3ecd-421c-b4bd-698097abb4c7 From: "Anonymous" sip:anonymous@erx-staging-q01.mydomain.com;tag=5589ec6e-8c68-44de-b03c-72751d9b9fa4 To: sip:user_jbjd@10.10.1.9;tag=611ql89jnj Call-ID: 895f3d45-5479-4603-9d38-6429ff77b06d CSeq: 16925 INVITE Contact: sip:user_jbjd@erx-staging-q01.mydomain.com;gr=urn:uuid:a8b474b8-1e18-43cb-ab17-f6bbe02c548d Supported: gruu, outbound User-Agent: SIP.js/0.7.8 Record-Route: sip:188.xxx.59.171:443;transport=ws;r2=on;lr=on;did=ad6.8121 Record-Route: sip:10.10.1.9;r2=on;lr=on;did=ad6.8121 Content-Length: 0
While this is from Linphone
tag: rcv pid: 695614 process: 16 time: 1644860097.970935 date: Mon Feb 14 23:04:57 2022 proto: tls ipv4 srcip: 103.xxx.xx.134 srcport: 25843 dstip: 188.xxx.59.171 dstport: 5061 ~~~~~~~~~~~~~~~~~~~~ SIP/2.0 180 Ringing Via: SIP/2.0/TLS 188.xxx.59.171:5061;branch=z9hG4bKb5b1.d3231367383d07b1063098dcb35cc2b0.0 Via: SIP/2.0/UDP 10.10.1.13:7000;received=10.10.1.13;rport=7000;branch=z9hG4bKPjd16f1379-1be7-448e-894a-c42d96f63146 From: "Anonymous" sip:anonymous@erx-staging-q01.mydomain.com;tag=cf7a7770-529d-4450-8bed-880382dce1dd To: sip:user_jbjp@10.10.1.9;tag=2ooYDia Call-ID: 8a025999-b096-4fe0-a623-9f6e6a69b8ae CSeq: 27838 INVITE User-Agent: Linphone Desktop/4.3.2 (Ubuntu 20.04.3 LTS, Qt 5.12.12) LinphoneCore/5.0.49 Supported: replaces, outbound, gruu Record-route: sip:188.xxx.59.171:5061;transport=tls;r2=on;lr=on;did=3b9.b1b2 Record-route: sip:10.10.1.9;r2=on;lr=on;did=3b9.b1b2 Content-Length: 0
When the 180 ringing is passed on to the Astrerisk it has the contact header modified with alias.
tag: snd pid: 695615 process: 17 time: 1644860126.210189 date: Mon Feb 14 23:05:26 2022 proto: udp ipv4 srcip: 10.10.1.9 srcport: 5060 dstip: 10.10.1.13 dstport: 7000 ~~~~~~~~~~~~~~~~~~~~ SIP/2.0 180 Ringing Record-Route: sip:188.xxx.59.171:443;transport=ws;r2=on;lr=on;did=ad6.8121 Record-Route: sip:10.10.1.9;r2=on;lr=on;did=ad6.8121 Via: SIP/2.0/UDP 10.10.1.13:7000;received=10.10.1.13;rport=7000;branch=z9hG4bKPje4d8c7fc-3ecd-421c-b4bd-698097abb4c7 To: sip:user_jbjd@10.10.1.9;tag=611ql89jnj From: "Anonymous" sip:anonymous@erx-staging-q01.mydomain.com;tag=5589ec6e-8c68-44de-b03c-72751d9b9fa4 Call-ID: 895f3d45-5479-4603-9d38-6429ff77b06d CSeq: 16925 INVITE Contact: sip:user_jbjd@erx-staging-q01.mydomain.com;alias=103.xxx.xx.134~52508~6;gr=urn:uuid:a8b474b8-1e18-43cb-ab17-f6bbe02c548d Supported: gruu, outbound User-Agent: SIP.js/0.7.8 Content-Length: 0
Now, I am not sure if this is the reason for routing the packets to wrong destination, but this is all I could figure out. Any clue to get this resolved will be much appreciated. My Kamailio config is pasted at https://pastebin.com/qyRS0usw
with regards,
X.
Sent with ProtonMail Secure Email.