Description

Kamailio v5.5.6 with topos module and postgres DB.

UAC (A) -> Kamailio Registrar (B) -> Kamailio PSTN GW (C) -> PSTN (D)
Call goes from A to D, PSTN sends UPDATE, UPDATE is routed from C to A instead to B and then to A.

Reproduction

Caller calls callee and receives an UPDATE from callee.
In my case it was when the call was routed to voicemail.

Log Messages

Kamailio takes the wrong route in UPDATE (upstream) case.

May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: topos [tps_msg.c:882]: tps_request_received(): r-uri updated to: [sip:1234@<UAC-IP>;uniq=B0EB9A84A278626DA07219E2AE01C]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: topos [tps_msg.c:187]: tps_add_headers(): adding to headers(0) - [Route: sip:<<KamailioPSTNgwIP>>;lr=on;ftag=9945501E2B94B883;did=1fc.42f;nat=yes#015#012]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: topos [tps_msg.c:187]: tps_add_headers(): adding to headers(0) - [P-SR-XUID: atpsh-64527b0a-40362-1#015#012]

The right one would be the x_rr (a_rr), but it takes only the s_rr:

May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:234]: db_postgres_convert_rows(): PQgetvalue(0x7fcb4893db50,0,7)=[sip:<KamailioRegistrarIP>;lr=on;ftag=9945501E2B94B883;did=1fc.7b92]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:242]: db_postgres_convert_rows(): [0][7] Column[x_rr]=[sip:<KamailioRegistrarIP>;lr=on;ftag=9945501E2B94B883;did=1fc.7b92]

May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:234]: db_postgres_convert_rows(): PQgetvalue(0x7fcb4893db50,0,8)=[sip:<PSTNgw>:5060;transport=udp;lr;Hpt=8ef8_116;CxtId=3;TRC=ffffffff-ffffffff;X-HwB2bUaCookie=18614]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:242]: db_postgres_convert_rows(): [0][8] Column[y_rr]=[sip:<PSTNgw>:5060;transport=udp;lr;Hpt=8ef8_116;CxtId=3;TRC=ffffffff-ffffffff;X-HwB2bUaCookie=18614]

May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:234]: db_postgres_convert_rows(): PQgetvalue(0x7fcb4893db50,0,9)=[sip:<<KamailioPSTNgwIP>>;lr=on;ftag=9945501E2B94B883;did=1fc.42f;nat=yes]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263013]: DEBUG: db_postgres [km_res.c:242]: db_postgres_convert_rows(): [0][9] Column[s_rr]=[sip:<<KamailioPSTNgwIP>>;lr=on;ftag=9945501E2B94B883;did=1fc.42f;nat=yes]

May  3 15:23:12 sipproxy /usr/sbin/kamailio[263019]: DEBUG: db_postgres [km_res.c:242]: db_postgres_convert_rows(): [0][10] Column[a_rr]=[sip:<KamailioRegistrarIP>;lr=on;ftag=9945501E2B94B883;did=1fc.7b92]
May  3 15:23:12 sipproxy /usr/sbin/kamailio[263019]: DEBUG: db_postgres [km_res.c:234]: db_postgres_convert_rows(): PQgetvalue(0x7fcb4893dbd8,0,11)=[]

Possible Solutions

Respect Route headers for UPDATE messages.

Additional Information

Current running kamailio 5.5.6 but tried also latest 5.6.4 with same behavior.

version: kamailio 5.5.6 (x86_64/linux) 72dbb0
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, 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: 72dbb0 
compiled on 05:48:21 Apr 27 2023 with gcc 11.3.0
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy
Linux sipproxy 5.15.0-70-generic #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Possibly related bug: #3090


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3437@github.com>