### 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"
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2850