CrazyTux created an issue (kamailio/kamailio#4157)
### TOPOS removes via header ``` event_route[topos:msg-outgoing] { # Feature Flag is enabled ** problem occurs here ** if($sht(feature_flags=>kamailio-disable-internal-topos) == "true") { if(ds_is_from_list(KAM_SET_ID, 3, "sip:$sndto(ip):5060")) { drop; } } } ``` ### Troubleshooting - verified via exists in original 200 OK REPLY from Freeswitch - checked wire and verified via header is missing when forwarding 200 OK onward to next kamailio (B) node from Kamailio (A)
#### Reproduction Call drop in event route `topos:msg-outgoing`
- call flow: Freeswitch -> Kamailio A -> Kamailio B -> UAC - place incoming call into kamailio - put call on hold / reinvite
#### Debugging Data ``` Disabling topos entirely via header is correctly sent from A -> B. ```
#### Log Messages (Kamailio B)
``` 2025-02-25T00:19:08.545447+00:00 /usr/sbin/kamailio[3959021]: ERROR: {2 1 INVITE 995df181-4eae-40ae-8225-427ce8252250} <core> [core/receive.c:542]: receive_msg(): no via found in reply 2025-02-25T00:19:09.045917+00:00 /usr/sbin/kamailio[3959037]: ERROR: {2 1 INVITE 995df181-4eae-40ae-8225-427ce8252250} <core> [core/receive.c:542]: receive_msg(): no via found in reply 2025-02-25T00:19:10.046936+00:00 /usr/sbin/kamailio[3958995]: ERROR: {2 1 INVITE 995df181-4eae-40ae-8225-427ce8252250} <core> [core/receive.c:542]: receive_msg(): no via found in reply 2025-02-25T00:19:12.048099+00:00 /usr/sbin/kamailio[3959003]: ERROR: {2 1 INVITE 995df181-4eae-40ae-8225-427ce8252250} <core> [core/receive.c:542]: receive_msg(): no via found in reply ```
#### SIP Traffic `reinvite B -> A:` ``` INVITE sip:mod_sofia@54.245.XX.XX:5060 SIP/2.0 Record-Route: sip:35.161.XX.XX:5060;r2=on;lr;ftag=9vX27Um099jZS;did=a2b.7e62 Record-Route: sip:35.161.XX.XX:7443;transport=ws;r2=on;lr;ftag=9vX27Um099jZS;did=a2b.7e62 Via: SIP/2.0/UDP 35.161.XX.XX:5060;branch=z9hG4bK16be.085d2f3d83e8d939f7f1d3fbc4a5ff09.0 Via: SIP/2.0/WSS 74jssm3ooc66.invalid;received=209.160.251.114;branch=z9hG4bK3968143 To: sip:9496294444@54.245.XX.XX;tag=9vX27Um099jZS From: sip:Dff742e5340fDd93847e@9e3f4e45-01cf-1f66-8d70-8d14ec555153;tag=q1vfbk6o6q CSeq: 1 INVITE Call-ID: 995df181-4eae-40ae-8225-427ce8252250 Max-Forwards: 69 Allow: ACK,BYE,CANCEL,INFO,INVITE,MESSAGE,NOTIFY,OPTIONS,PRACK,REFER,REGISTER,SUBSCRIBE Contact: sip:tu0r7r7u@74jssm3ooc66.invalid;transport=ws Supported: outbound User-Agent: WebPhone/3.1740423483.87 Content-Type: application/sdp Content-Length: 1538 Route: sip:34.213.XX.XX:5060;r2=on;lr;ftag=9vX27Um099jZS;did=a2b.1142,sip:34.213.XX.XX;r2=on;lr;ftag=9vX27Um099jZS;did=a2b.1142 P-SR-XUID: atpsh-7cde-67bcbccd-3c68ef-1
v=0 o=- 4757376688759011024 3 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE 0 a=extmap-allow-mixed a=msid-semantic: WMS 35a33e17-dd80-46fa-afe9-72fdd03d4e41 m=audio 32999 UDP/TLS/RTP/SAVPF 0 102 101 103 63 9 8 13 c=IN IP4 209.160.251.114 a=rtcp:9 IN IP4 0.0.0.0 a=candidate:2845667355 1 udp 2122260223 10.82.226.218 54425 typ host generation 0 network-id 1 network-cost 10 a=candidate:1750280017 1 udp 1686052607 209.160.251.114 32999 typ srflx raddr 10.82.226.218 rport 54425 generation 0 network-id 1 network-cost 10 a=ice-ufrag:Eb9h a=ice-pwd:nQdfpsILiUI+YKSQT3eZy52x a=ice-options:trickle a=fingerprint:sha-256 BA:68:25:D5:66:70:A9:17:38:18:74:0A:B3:C2:3E:F9:3A:A0:7C:5F:18:0F:EB:B7:93:28:86:56:62:23:DF:E5 a=setup:actpass a=mid:0 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid a=sendonly a=msid:35a33e17-dd80-46fa-afe9-72fdd03d4e41 57910219-943b-4687-9511-b9a9d0a1ea6f a=rtcp-mux a=rtcp-rsize a=rtpmap:0 PCMU/8000 a=rtpmap:102 opus/48000/2 a=fmtp:102 minptime=10;useinbandfec=1 a=rtpmap:101 telephone-event/8000 a=rtpmap:103 telephone-event/48000 a=rtpmap:63 red/48000/2 a=fmtp:63 102/102 a=rtpmap:9 G722/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:13 CN/8000 a=ssrc:2604971680 cname:YEcJO5XrSKZor1jY a=ssrc:2604971680 msid:35a33e17-dd80-46fa-afe9-72fdd03d4e41 57910219-943b-4687-9511-b9a9d0a1ea6f ```
`200 OK Freeswitch -> A` ``` SIP/2.0 200 OK v:SIP/2.0/UDP 34.213.XX.XX:5060;branch=z9hG4bK16be.86ee5e1d4190783bd6a79bd21110d190.0 f:sip:Dff742e5340fDd93847e@9e3f4e45-01cf-1f66-8d70-8d14ec555153;tag=q1vfbk6o6q t:sip:9496294444@54.245.XX.XX;tag=9vX27Um099jZS i:995df181-4eae-40ae-8225-427ce8252250 CSeq:1 INVITE m:sip:mod_sofia@54.245.XX.XX:5060 Accept:application/sdp Allow:INVITE,ACK,BYE,CANCEL,OPTIONS,MESSAGE,INFO,UPDATE,REGISTER,REFER,NOTIFY,PUBLISH,SUBSCRIBE k:timer,path,replaces x:90;refresher=uas c:application/sdp Content-Disposition:session l:284
v=0 o=FreeSWITCH 1740424963 1740424965 IN IP4 54.245.XX.XX s=FreeSWITCH c=IN IP4 54.245.XX.XX t=0 0 m=audio 17776 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=recvonly a=ptime:20 a=rtcp-mux a=rtcp:17776 IN IP4 54.245.XX.XX ```
`200 OK A -> B`
``` SIP/2.0 200 OK f:sip:Dff742e5340fDd93847e@9e3f4e45-01cf-1f66-8d70-8d14ec555153;tag=q1vfbk6o6q t:sip:9496294444@54.245.XX.XX;tag=9vX27Um099jZS i:995df181-4eae-40ae-8225-427ce8252250 CSeq:1 INVITE m:sip:mod_sofia@54.245.XX.XX:5060 Accept:application/sdp Allow:INVITE,ACK,BYE,CANCEL,OPTIONS,MESSAGE,INFO,UPDATE,REGISTER,REFER,NOTIFY,PUBLISH,SUBSCRIBE k:timer,path,replaces x:90;refresher=uas c:application/sdp Content-Disposition:session l:315
v=0 o=FreeSWITCH 1740424963 1740424965 IN IP4 34.211.XX.XX s=FreeSWITCH c=IN IP4 34.211.XX.XX t=0 0 m=audio 20374 RTP/AVP 0 101 a=mid:0 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=recvonly a=rtcp:20374 a=rtcp-mux a=ptime:20 a=ice-options:trickle a=end-of-candidates ```
### Possible Solutions
TBD
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.8.2 (x86_64/linux) flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 10.2.1 ```
<img width="629" alt="Image" src="https://github.com/user-attachments/assets/fc46f76e-7a6f-431f-a00e-84fbbece0d4f" />
* **Operating System**: ``` No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye ```
I can provide PCAP as well if required. Let me know if additional information is required.