Hi,
I'm trying to use topos module but I have a problem with record-route header in re-invite for on hold.

Uac is a subscriber of sipwise platfrom (vm open source version);

my kamailio version is:
# kamailio -v
version: kamailio 5.1.0-dev7 (ppc/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, 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
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB

and uas is a subscriber of kamailio.

The call flow is:

UAC                     Sipwise                     Kamailio                          UAS
|                                 |                       (topos active)                        |
|-------- Invite -------->|---------- (1)Invite ----->|------- (2)Invite ----->|
|<------- 180/200 ------|<--- (4)180/(4)200 ----|<------- 180/200 ------|
|---------- Ack --------->|----------- (5)Ack ------>|-------- (6)Ack ------->|
|--- Invite (hold) ----->|-- (7)ReInvite(hold)-->|-- (8)Invite (hold)--->|
|<--------- 200 ----------|<--------- (9)200 -------|<--------- 200 ----------|
|             corrupt         |              corrupt        |                                 |
|---- No Ack Sent-------|---- No Ack Sent-------|---- No Ack Sent-------|

The problem:
the 200 ok of re-invite is corrupt by topos, it hasn't via header and contact isn't modified, then the uac can't send the ack.

In the kamailio trace I see the ERROR below:
E!: U 22/09/2017 10:24:19:880 proxy0: ERROR: topos [tps_storage.c:1254]: tps_db_update_dialog(): no valid dlg uuid

The questions are:
Can I use topos for this scenario?
Is it possible that topos have bug when receive a re-invite with record-route headers? Infact, in simple scenario without record-route (call and hold between tow subscriber) everything works!

My opinion is: when topos receive a request with record-route generates from record-route the new aleg and bleg tags (atpsh-xxxxx, btpsh-yyyyyy) but don't save their in internal database if the request is internal at dialog. Then a reintive whit record-route headers, generate new aleg/bleg tags but they aren't in database, then the response 200 ok it isn't elaborate.

below messages details, attached kamailio log and pcap trace.

tanks in advance for support,

Giuseppe


(1)Invite:
INVITE sip:100@192.168.110.79:5060;transport=udp SIP/2.0
Record-Route: <sip:192.168.110.132;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Via: SIP/2.0/UDP 192.168.110.132;branch=z9hG4bK1a43.6c8d17d29887a0078c2cb6aca8684a27.0
Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKPa3L8art;rport=5080
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>
CSeq: 10 INVITE
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, MESSAGE, OPTIONS, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, X-cisco-serviceuri
P-Asserted-Identity: <sip:390735594284@192.168.110.132>
Content-Type: application/sdp
Content-Length: 276
Contact: <sip:ngcp-lb@192.168.110.132:5060;ngcpct=7369703a3132372e302e302e313a35303830>
 
[sdp]

(2)Invite:
INVITE sip:100@192.168.1.73:5080;line=4d3148ee1d889aa SIP/2.0
Via: SIP/2.0/UDP 192.168.110.79;branch=z9hG4bK1a43.c9b996baf80be68d288d2de06cd9b212.0
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>
CSeq: 10 INVITE
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, MESSAGE, OPTIONS, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, X-cisco-serviceuri
P-Asserted-Identity: <sip:390735594284@192.168.110.132>
Content-Type: application/sdp
Content-Length: 276
Contact: <sip:btpsh-59c55b4a-4fa6-1@192.168.110.79>
 
[sdp]

(3) 180 Ringing
SIP/2.0 180 Ringing
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
CSeq: 10 INVITE
User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
Content-Length: 0
Via: SIP/2.0/UDP 192.168.110.132;branch=z9hG4bK1a43.6c8d17d29887a0078c2cb6aca8684a27.0,SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKPa3L8art;rport=5080
Contact: <sip:atpsh-59c55b4a-4fa6-1@192.168.110.79>
Record-Route: <sip:192.168.110.132;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>,<sip:127.0.0.1;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
 
(4) 200 OK
SIP/2.0 200 OK
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
CSeq: 10 INVITE
Content-Type: application/sdp
User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
Content-Length:   181
Via: SIP/2.0/UDP 192.168.110.132;branch=z9hG4bK1a43.6c8d17d29887a0078c2cb6aca8684a27.0,SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKPa3L8art;rport=5080
Contact: <sip:atpsh-59c55b4a-4fa6-1@192.168.110.79>
Record-Route: <sip:192.168.110.132;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>,<sip:127.0.0.1;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
 
[sdp]

(5) ACK
ACK sip:atpsh-59c55b4a-4fa6-1@192.168.110.79 SIP/2.0
Record-Route: <sip:192.168.110.132;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Via: SIP/2.0/UDP 192.168.110.132;branch=z9hG4bK1a43.4446035c867218358dbd848f773b5d09.0
Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKspF2zas~;rport=5080
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
CSeq: 10 ACK
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Content-Length: 0
Contact: <sip:ngcp-lb@192.168.110.132:5060;ngcpct=7369703a3132372e302e302e313a35303830>
 
(6) ACK
ACK sip:100@192.168.1.73:5080 SIP/2.0
Via: SIP/2.0/UDP 192.168.110.79;branch=z9hG4bK1a43.b1cce71dc1b004e442faca53cd6d8994.0
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
CSeq: 10 ACK
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Content-Length: 0
Contact: <sip:atpsh-59c55b4a-4fa6-2@127.0.0.1>
 

(7) Re-Invite
INVITE sip:atpsh-59c55b4a-4fa6-1@192.168.110.79 SIP/2.0
Record-Route: <sip:192.168.110.132;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=6D91D5F4-59C53F38000E3F0A-D551C700;ngcplb=yes>
Via: SIP/2.0/UDP 192.168.110.132;branch=z9hG4bK2a43.3723a1a3f343f1f1974a66f4a62f41a9.0
Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKf6peiap7;rport=5080
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
CSeq: 11 INVITE
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, MESSAGE, OPTIONS, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Content-Type: application/sdp
Content-Length: 276
Contact: <sip:ngcp-lb@192.168.110.132:5060;ngcpct=7369703a3132372e302e302e313a35303830>
 
[sdp]


(8) Re-Invite
INVITE sip:100@192.168.1.73:5080 SIP/2.0
Via: SIP/2.0/UDP 192.168.110.79;branch=z9hG4bK2a43.a4e5f5baf85414d4471a1e817bdc1e00.0
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
CSeq: 11 INVITE
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
Max-Forwards: 69
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, MESSAGE, OPTIONS, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Content-Type: application/sdp
Content-Length: 276
Contact: <sip:atpsh-59c55b4a-4fa6-3@127.0.0.1>
 
[sdp]

(9) 200 OK
SIP/2.0 200 OK
From: <sip:390735594284@192.168.110.132>;tag=6D91D5F4-59C53F38000E3F0A-D551C700
To: <sip:100@192.168.110.79>;tag=856281851
Call-ID: OTkwMTdlNjEyYTQ2NWFiNTJkN2U1YTA2YWY1ZGI5YmE._b2b-1
CSeq: 11 INVITE
Contact: <sip:100@192.168.1.73:5080>
Content-Type: application/sdp
User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
Content-Length:   211
 
[sdp]