<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). -->
### Description Kamailio not updating record-route value stored in redis (topos module) during re-invite
config:
modparam("ndb_redis", "server", "name=srv1;addr=localhost;port=6379;db=1") modparam("topos", "storage", "redis") modparam("topos_redis", "serverid", "srv1") modparam("topos", "branch_expire", 300) modparam("topos", "dialog_expire", 10800) modparam("topos", "sanity_checks", 1) modparam("topos", "clean_interval", 20)
<!-- Explain what you did, what you expected to happen, and what actually happened. -->
### Troubleshooting
#### Reproduction 1. Initial Invite from Kamailio to Server1 (Transaction complete) 2. Server1 is down 3. Re-invite from Kamailio to Server2 4. 200 OK contains record-route of Server2 5. ACK is forwarded to Server1 (record-route stored in dialog Key still has old record-route)
<!-- If the issue can be reproduced, describe how it can be done. -->
#### Debugging Data b_rr value remains same even after 200 OK for re-invite has a different record-route
``` **redis data after Initial Invite:** 127.0.0.1:6379[1]> hgetall d:z:atpsh-5fb50084-5b44-1 1) "b_rr" 2) "sip:10.130.74.130;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes" 3) "as_contact" 4) "sip:atpsh-5fb50084-5b44-1@3.225.0.56" 5) "s_rr" 6) "sip:3.225.0.56;lr;ftag=11368SIPpTag091;nat=yes" 7) "b_tag" 8) "2" 9) "bs_contact" 10) "sip:btpsh-5fb50084-5b44-1@3.225.0.56" 11) "rectime" 12) "1605698163" 13) "a_tag" 14) "11368SIPpTag091" 15) "s_cseq" 16) "1" 17) "s_method" 18) "INVITE" 19) "b_contact" 20) "sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1" 21) "a_callid" 22) "1-11368@10.130.74.171" 23) "a_uuid" 24) "atpsh-5fb50084-5b44-1" 25) "b_uuid" 26) "btpsh-5fb50084-5b44-1" 27) "a_contact" 28) "sip:sipp@10.130.74.171:5060;alias=10.130.74.171~5060~1" 29) "iflags" 30) "2"
**redis data after re-Invite:**
127.0.0.1:6379[1]> hgetall d:z:atpsh-5fb50084-5b44-1 1) "b_rr" 2) "sip:10.130.74.130;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes" 3) "as_contact" 4) "sip:atpsh-5fb50084-5b44-1@3.225.0.56" 5) "s_rr" 6) "sip:3.225.0.56;lr;ftag=11368SIPpTag091;nat=yes" 7) "b_tag" 8) "2" 9) "bs_contact" 10) "sip:btpsh-5fb50084-5b44-1@3.225.0.56" 11) "rectime" 12) "1605698163" 13) "a_tag" 14) "11368SIPpTag091" 15) "s_cseq" 16) "1" 17) "s_method" 18) "INVITE" 19) "b_contact" 20) "sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1;alias=10.130.72.145~5060~1" 21) "a_callid" 22) "1-11368@10.130.74.171" 23) "a_uuid" 24) "atpsh-5fb50084-5b44-1" 25) "b_uuid" 26) "btpsh-5fb50084-5b44-1" 27) "a_contact" 28) "sip:sipp@10.130.74.171:5060;alias=10.130.74.171~5060~1" 29) "iflags" 30) "2"
```
same issue seen for a_rr value in redis.
<!-- If you got a core dump, use gdb to extract troubleshooting data - full backtrace, local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile bt full info locals list
If you are familiar with gdb, feel free to attach more of what you consider to be relevant. -->
#### Log Messages
<!-- Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` (paste your log messages here) ```
#### SIP Traffic ``` **Initial Invite Incoming:** INVITE sip:+919535346001@10.130.72.228:5060 SIP/2.0 Via: SIP/2.0/UDP 10.130.74.171:5060;branch=z9hG4bK-11368-1-0 From: sipp sip:9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228 Call-ID: 1-11368@10.130.74.171 CSeq: 1 INVITE Contact: sip:sipp@10.130.74.171:5060 Supported: timer, 100rel , replaces Max-Forwards: 70 Subject: Performance Test Content-Type: application/sdp Content-Length: 208
**Initial Invite outgoing:** INVITE sip:919535346001@10.130.74.130:5060 SIP/2.0 Via: SIP/2.0/UDP 3.225.0.56:5060;branch=z9hG4bK7afa.d2d1cbb7e8c7a99adf854ba4d854a467.0 From: sipp sip:9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228 Call-ID: 1-11368@10.130.74.171 CSeq: 1 INVITE Supported: timer, 100rel , replaces Max-Forwards: 69 Subject: Performance Test Content-Type: application/sdp Content-Length: 208 Contact: sip:btpsh-5fb50084-5b44-1@3.225.0.56
**response incoming** SIP/2.0 200 OK From: sipp sip:+9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 1 INVITE Content-Type: application/sdp Content-Length: 162 Via: SIP/2.0/UDP 3.225.0.56:5060;rport=5060;received=10.130.72.228;branch=z9hG4bK7afa.d2d1cbb7e8c7a99adf854ba4d854a467.0 Contact: sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1 Record-Route: sip:10.130.74.130;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes Accept: application/sdp Allow: INVITE,ACK,CANCEL,BYE,UPDATE
**response outgoing** SIP/2.0 200 OK From: sipp sip:+9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 1 INVITE Content-Type: application/sdp Content-Length: 162 Accept: application/sdp Allow: INVITE,ACK,CANCEL,BYE,UPDATE Via: SIP/2.0/UDP 10.130.74.171:5060;rport=5060;branch=z9hG4bK-11368-1-0 Contact: sip:atpsh-5fb50084-5b44-1@3.225.0.56
**ACK Incoming** ACK sip:atpsh-5fb50084-5b44-1@3.225.0.56 SIP/2.0 Via: SIP/2.0/UDP 10.130.74.171:5060;branch=z9hG4bK-11368-1-5 From: sipp sip:sipp@10.130.74.171:5060;tag=11368SIPpTag091 To: sut sip:service@10.130.72.228:5060;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 1 ACK Contact: sip:sipp@10.130.74.171:5060 Max-Forwards: 70 Subject: Performance Test Content-Length: 0
**ACK outgoing** ACK sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1 SIP/2.0 Via: SIP/2.0/UDP 3.225.0.56:5060;branch=z9hG4bK7afa.5b31cae6abf9db84bc4197496dd24951.0 From: sipp sip:sipp@10.130.74.171:5060;tag=11368SIPpTag091 To: sut sip:service@10.130.72.228:5060;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 1 ACK Max-Forwards: 69 Subject: Performance Test Content-Length: 0 Route: sip:10.130.74.130;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes Contact: sip:btpsh-5fb50084-5b44-1@3.225.0.56
**re-invite incoimg** INVITE sip:atpsh-5fb50084-5b44-1@3.225.0.56 SIP/2.0 Via: SIP/2.0/UDP 10.130.74.171:5060;branch=z9hG4bK-11368-1-7 From: sipp sip:9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 INVITE Contact: sip:sipp@10.130.74.171:5060 Supported: timer, 100rel , replaces Max-Forwards: 70 Subject: Performance Test Content-Type: application/sdp Content-Length: 208
**re-invite outgoing** INVITE sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1 SIP/2.0 Via: SIP/2.0/UDP 3.225.0.56:5060;branch=z9hG4bK4afa.168b5e5898c0e5586bbbe73c71d2f089.1 From: sipp sip:9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 INVITE Supported: timer, 100rel , replaces Max-Forwards: 69 Subject: Performance Test Content-Type: application/sdp Content-Length: 208 Route: sip:10.130.72.145;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes Contact: sip:btpsh-5fb50084-5b44-1@3.225.0.56
**response incoming** SIP/2.0 200 OK From: sipp sip:+9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 INVITE Content-Type: application/sdp Content-Length: 162 Via: SIP/2.0/UDP 3.225.0.56:5060;rport=5060;received=10.130.72.228;branch=z9hG4bK4afa.168b5e5898c0e5586bbbe73c71d2f089.1 Contact: sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1 Record-Route: sip:10.130.72.145;lr;ftag=11368SIPpTag091;did=07f.8fa Accept: application/sdp Allow: INVITE,ACK,CANCEL,BYE,UPDATE
**response outgoing** SIP/2.0 200 OK From: sipp sip:+9535346001@10.130.72.228;tag=11368SIPpTag091 To: sut sip:9535346001@10.130.72.228;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 INVITE Content-Type: application/sdp Content-Length: 162 Accept: application/sdp Allow: INVITE,ACK,CANCEL,BYE,UPDATE Via: SIP/2.0/UDP 10.130.74.171:5060;rport=5060;branch=z9hG4bK-11368-1-7 Contact: sip:atpsh-5fb50084-5b44-1@3.225.0.56
**ACK Incoming** ACK sip:atpsh-5fb50084-5b44-1@3.225.0.56 SIP/2.0 Via: SIP/2.0/UDP 10.130.74.171:5060;branch=z9hG4bK-11368-1-11 From: sipp sip:sipp@10.130.74.171:5060;tag=11368SIPpTag091 To: sut sip:service@10.130.72.228:5060;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 ACK Contact: sip:sipp@10.130.74.171:5060 Max-Forwards: 70 Subject: Performance Test Content-Length: 0
**ACK outgoing** ACK sip:atpsh-5fb3efba-4a95-1@52.55.224.188;alias=10.130.72.128~5060~1 SIP/2.0 Via: SIP/2.0/UDP 3.225.0.56:5060;branch=z9hG4bK4afa.773266b9ff87b7e02982aef7cafa13e7.0 From: sipp sip:sipp@10.130.74.171:5060;tag=11368SIPpTag091 To: sut sip:service@10.130.72.228:5060;tag=2 Call-ID: 1-11368@10.130.74.171 CSeq: 2 ACK Max-Forwards: 69 Subject: Performance Test Content-Length: 0 Route: sip:10.130.74.130;lr;ftag=11368SIPpTag091;did=07f.8fa;nat=yes Contact: sip:btpsh-5fb50084-5b44-1@3.225.0.56
```
<!-- If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
### Possible Solutions
I checked code for topos_redis module, looks like only duiring initial transaction b_rr and a_rr values are stored https://github.com/kamailio/kamailio/blob/master/src/modules/topos_redis/top...
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.2.8 (x86_64/linux) 5a7f5b flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, 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_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_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: 5a7f5b compiled on 09:15:42 Nov 16 2020 with gcc 7.5.0 ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` (paste your output here) ```
The behaviour is according SIP specs, see `RFC 3261`, section `12.2 Requests within a Dialog`:
* https://tools.ietf.org/html/rfc3261#section-12.2
Relevant snippet:
``` Requests within a dialog MAY contain Record-Route and Contact header fields. However, these requests do not cause the dialog's route set to be modified, although they may modify the remote target URI. ```
I am not aware of any newer RFC amending that, if you know such, point it here.
Now, if one needs such behaviour out of SIP specs, I am fine to accept a contribution that makes it configurable with a modparam.
For the moment, I am going to label this as a request for enhancement. If nobody commits to implement it, it will be closed in the near future.
@miconda Thanks for the suggestion. I will soon create PR for this with a modparam.
As the pull request has been merged, close this one. If there is something left, just re-open the issue.
Closed #2554.