Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

topos_redis: update record-route set on re-invite #2554

Closed
balajeesv opened this issue Nov 18, 2020 · 3 comments
Closed

topos_redis: update record-route set on re-invite #2554

balajeesv opened this issue Nov 18, 2020 · 3 comments

Comments

@balajeesv
Copy link
Contributor

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)

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)

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.

Log Messages

(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>






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/topos_redis_storage.c#L1270

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:
(paste your output here)
@balajeesv balajeesv changed the title topos_redis: record-route not updated in dialog key redis during re-invite topos_redis: record-route not updated in dialog key (redis) during re-invite Nov 18, 2020
@miconda
Copy link
Member

miconda commented Nov 18, 2020

The behaviour is according SIP specs, see RFC 3261, section 12.2 Requests within a Dialog:

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 miconda changed the title topos_redis: record-route not updated in dialog key (redis) during re-invite topos_redis: update record-route set on re-invite Nov 18, 2020
@balajeesv
Copy link
Contributor Author

@miconda Thanks for the suggestion. I will soon create PR for this with a modparam.

@henningw
Copy link
Contributor

henningw commented Jan 8, 2021

As the pull request has been merged, close this one. If there is something left, just re-open the issue.

@henningw henningw closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants