### Description
When call routed to WebRTC client and used `record_route()`, then Record-Router header does not contain port of socket where WebRTC client connected. When used `tcp_reuse_port = yes`, then `ACK` cannot be delivered to WebRTC client (#2849).
#### Reproduction
I prepared a minimal config that allows reproduce the issue and attached a log file for the test call. ``` # use compact IPv6 addresses ipv6_hex_style = "c" enable_tls=1 tcp_accept_no_cl=yes
######## Kamailio control connector module ######## loadmodule "ctl.so" modparam("ctl", "binrpc_buffer_size", 4096) loadmodule "pv.so" loadmodule "sl.so" loadmodule "xlog.so" loadmodule "tls.so" loadmodule "nathelper.so" modparam("tls", "config", "/etc/kamailio/tls.cfg") loadmodule "xhttp.so" loadmodule "websocket.so" loadmodule "ipops.so" loadmodule "siputils.so" loadmodule "rr.so"
loadmodule "debugger.so" modparam("debugger", "cfgtrace", 1) modparam("debugger", "log_level_name", "exec") log_stderror=yes
# IPv4 listeners listen=udp:eth0:5060 listen=tcp:eth0:5060 listen=tls:eth0:5061 listen=tls:eth0:7001
# IPv6 listeners listen=udp:[2600:1f18:578:5701::7e]:5060 listen=tcp:[2600:1f18:578:5701::7e]:5060 listen=tls:[2600:1f18:578:5701::7e]:5061 listen=tls:[2600:1f18:578:5701::7e]:7001
request_route { if (!has_totag()) { record_route(); }
if (is_ipv4($si)) { route(WEBRTC_PBX); } else { route(PBX_WEBRTC); } }
route[WEBRTC_PBX] { set_contact_alias(); $du = "sip:[2600:1f14:6d8:5409::100]:5080;transport=tcp"; forward(); exit; }
route[PBX_WEBRTC] { handle_ruri_alias(); forward(); exit; }
event_route[xhttp:request] { if (!($hdr(Upgrade)=~"websocket" && $hdr(Connection)=~"Upgrade" && $rm=~"GET")) { $var(status_code) = 400; $var(reason_phrase) = "Bad Request"; xhttp_reply("$var(status_code)", "$var(reason_phrase)", "text/plain", "$var(reason_phrase)"); exit; }
if (!ws_handle_handshake()) { $var(status_code) = 400; $var(reason_phrase) = "Bad Request"; xhttp_reply("$var(status_code)", "$var(reason_phrase)", "text/plain", "$var(reason_phrase)"); exit; }
exit; } ``` #### Log Messages
For Call-ID: a8c7450a-131c-11ec-9546-a727fc4b684e
``` INVITE sips:safarov@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=wss SIP/2.0^M Record-Route: sips:3.236.25.254;transport=ws;r2=on;lr;ftag=FNBFNvy0atDeK^M Record-Route: sips:[2600:1f18:578:5701::7e];transport=tcp;r2=on;lr;ftag=FNBFNvy0atDeK^ ``` Client connected to socket `tls:3.236.25.254:7001` but using `record_route()` generated ``` Record-Route: sips:3.236.25.254;transport=ws;r2=on;lr;ftag=FNBFNvy0atDeK ``` Full logs at [kam.log](https://github.com/kamailio/kamailio/files/7148185/kam.log)
### Additional Information
* **Kamailio Version** - output of `kamailio -v` used master branch with small customization, base commit c503d2bd31a580138a67f1d4a265ccde5791d271
* **Operating System**: aarch64
``` [root@tmp kamailio]# cat /etc/os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" ```
I understand this happens when `tcp_reuse_port = yes`? Or does it happen when `tcp_reuse_port = no` as well?
Be also careful with using `sips` in the URIs, I see it even for transport TCP, which is not a secure transport and can result on failing to route in some cases. You better use `sip` and the `transport` parameter takes care of setting the transport layer.
yes, call failed when `tcp_reuse_port = yes` and works when `tcp_reuse_port = no`. Thanks Daniel @miconda for `sips` warning.
Hello, In my case the record_route() function does not write address where the actual web client registered at, instead it is setting up the server IP address. That is causing unstable call setup and may be due to that voice also not working. Please help and guide on this.
@ankitjayswal87 please do not add your (other) problem to a ticket. The record_route function works like this as you describe. Please address your question to our sr-users mailing list.
OK, I removed my post from that issue.
On Thu, Mar 17, 2022 at 10:06 PM Henning Westerholt < ***@***.***> wrote:
@ankitjayswal87 https://github.com/ankitjayswal87 please do not add your (other) problem to a ticket. The record_route function works like this as you describe. Please address your question to our sr-users mailing list.
— Reply to this email directly, view it on GitHub https://github.com/kamailio/kamailio/issues/2850#issuecomment-1071060939, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJOCANM2KH7AFPWMTE3HKLVANNRLANCNFSM5D3D5SAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: ***@***.***>
This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.
Closed #2850 as not planned.