Sorry my prevision comment is wrong.
I do not knows whats is prevents forward message to Cisco phone.

ср, 27 сент. 2017 г. в 11:05, Sergey Safarov <s.safarov@gmail.com>:
Please look packets #3010 and #4867
Then look ticket #1215 and Daniel comments 
By RFC, the R-URI in ACK (and the other requests within dialog) has to be the URI from the Contact of 200ok. But there is the address of kamailio, making everything look like a strict routing and actually breaking the sip routing.

According PCAP file kamailio froward reINVITE as strict router. Think need to revert back R-URI header.

Sergey

ср, 27 сент. 2017 г. в 9:28, Giuseppe Pandolfi <giuseppe.pandolfi@aethra.com>:

Hi,
the rr header for loopback is added by sipwise... and I don't think that it's a problem.
I tested the same scenario without topos and with same sip flow it's all ok.
Anyway, I created a simple scenario without sipwise and I have the same problem with topos.
I think (but ask you) topos have a bug when receive a request (in my case re-invite) into dialog with rr.
It seems that wen topos receive a request into dialog with rr it generate a new aLeg tag different about aLeg tag of initial dialog.
When topos receive the response it can't match the leg tags and then send corrupt response, in my case a 200 Ok without via header.

New simple call flow:

    UAC                                 Kamailio1                           Kamailio2 (topos ON)                              UAS
192.168.110.195         192.168.110.124:5062           192.168.110.124:5060                   192.168.110.124:5080
     |                                           |                                                 |                                                      |
     | ----------- Invite ------------> | --------------- Invite -------------> | ------------------ Invite --------------> |
     |                                           |              record-route:...           |    a/btpsh-59ca2ba0-3e9e-71      |
     |                                           |                                                 |                                                      |
     | <----- 100/180/200 --------- | <-------- 100/180/200 ---------- | <------------ 100/180/200 ----------- |
     |                                           |                                                 |                                                      |
     | ------------ Ack --------------> | --------------- Ack ---------------> | ------------------- Ack ---------------->|
     |                                            |             record-route: ...          |      a/btpsh-59ca2ba0-3e9e-81    |
     |                                           |                                                 |                                                      |
     | --------- Re-Invite ----------> | ------------ Re-Invite -----------> | ---------------- Re-Invite ------------> |
     |                                           |              record-route: ...         |        a/btpsh-59ca2ba0-3e9e-91   |
     |                                           |                                                 |                                                      |
     | <----------- 200 --------------- | <------------- 200 ----------------- | <----------------- 200 ----------------- |
                     corrupt                                  corrupt

From trace I see:

handing outgoing request topos receive rr and generate as_contact/bs_contact a uuid (tpsh-59ca2ba0-3e9e-71) and add the headers to Invite:
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(1) - [Via: SIP/2.0/UDP 192.168.110.124;branch=z9hG4bK1666.2c45551ca5e8d1f3bd8663aed5e6a186.0#015#012]
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Contact: <sip:btpsh-59ca2ba0-3e9e-71@192.168.110.124>#015#012]

and it has an error (?????):
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: ERROR: topos [tps_storage.c:1254]: tps_db_update_dialog(): no valid dlg uuid

handing inbound response without rr and load dialog from db by aLeg tag:
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:889]: tps_response_received(): loaded dialog a_uuid [atpsh-59ca2ba0-3e9e-71]

handling outgoing responses (180 and 200ok) and add headers with aLeg:
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Contact: <sip:atpsh-59ca2ba0-3e9e-71@192.168.110.124>#015#012]
Sep 26 13:07:15 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Record-Route: <sip:192.168.110.124:5062;lr>#015#012]

handling incoming request Ack with rr and generate as_contact and bs_contact and add the headers to Ack:
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Route: <sip:192.168.110.124;lr>#015#012]
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [P-SR-XUID: atpsh-59ca2ba0-3e9e-71#015#012]

when handling outgoing request Ack with rr generate as_contact/bs_contact generate a new different uuid (tpsh-59ca2ba0-3e9e-81) and add the headers to Ack:
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_storage.c:915]: tps_db_load_branch(): no stored record for <z9hG4bK1666.bc447c312d7ae301d42a66dd2fa60913.0>
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_storage.c:1056]: tps_db_load_dialog(): no stored record for <atpsh-59ca2ba0-3e9e-81>
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(1) - [Via: SIP/2.0/UDP 192.168.110.124;branch=z9hG4bK1666.bc447c312d7ae301d42a66dd2fa60913.0#015#012]
Sep 26 13:07:18 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Contact: <sip:atpsh-59ca2ba0-3e9e-81@192.168.110.124:5062>#015#012]

handling incoming request in dialog (re-invite) with rr and generate as_contact/bs_contact and add the headers to Invite:
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Route: <sip:192.168.110.124;lr>#015#012]
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [P-SR-XUID: atpsh-59ca2ba0-3e9e-71#015#012]

when handling outgoing request in dialog (re-invite) with rr generate as_contact/bs_contact generate a new different uuid (tpsh-59ca2ba0-3e9e-91) and add the headers to Invite:
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_storage.c:915]: tps_db_load_branch(): no stored record for <z9hG4bKe566.fadda68e524002051ed440aa035f13d9.0>
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_storage.c:1056]: tps_db_load_dialog(): no stored record for <atpsh-59ca2ba0-3e9e-91>
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(1) - [Via: SIP/2.0/UDP 192.168.110.124;branch=z9hG4bKe566.fadda68e524002051ed440aa035f13d9.0#015#012]
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Contact: <sip:atpsh-59ca2ba0-3e9e-91@192.168.110.124:5062>#015#012]

during update dialog it has an error (?????):
Sep 26 13:07:24 Pandolfinbk ./kamailio[16030]: ERROR: topos [tps_storage.c:1254]: tps_db_update_dialog(): no valid dlg uuid

Now receive del response 200ok, and topos can't match the dialog and can't add headers for outgoing handing:
Sep 26 13:07:25 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:889]: tps_response_received(): loaded dialog a_uuid [atpsh-59ca2ba0-3e9e-91]
Sep 26 13:07:25 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_storage.c:1056]: tps_db_load_dialog(): no stored record for <atpsh-59ca2ba0-3e9e-91>
Sep 26 13:07:25 Pandolfinbk ./kamailio[16030]: ERROR: topos [tps_storage.c:1254]: tps_db_update_dialog(): no valid dlg uuid

when handing outgoing response, don't find x-branch header and send corrupt 200ok
Sep 26 13:07:25 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:1031]: tps_response_sent(): handling outgoing response
Sep 26 13:07:25 Pandolfinbk ./kamailio[16030]: DEBUG: topos [tps_msg.c:1038]: tps_response_sent(): no x-branch header - nothing to do



attached kamailio log and pcap trace.

is welcom any suggestions,
thanks


Il 23/09/2017 10:30, Sergey Safarov ha scritto:
Packet 19

сб, 23 сент. 2017 г. в 11:32, Sergey Safarov <s.safarov@gmail.com>:
Think issue on host 192.168.110.132 - wrong record-route headers, used loopback IP.

сб, 23 сент. 2017 г. в 9:20, Giuseppe Pandolfi <giuseppe.pandolfi@aethra.com>:

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]


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--
Giuseppe Pandolfi
R&D NTW - SW Design - Voice Services


A TLC S.r.l.
Via 1° Maggio, 26
60131 Ancona - Zona Baraccola (Italy)
T: +39 071 2506566
F: +39 071 2506518
Email: giuseppe.pandolfi@aethra.com
Website: www.aethra.com


NOTA BENE: Le informazioni contenute ed allegate alla presente sono strettamente confidenziali ed indirizzate unicamente al destinatario indicato. Ove non foste il destinatario Vi invitiamo a cancellare il messaggio ed ogni documento allegato e a volerci avvisare a mezzo posta elettronica. Grazie. A TLC S.r.l. tratta i vostri dati personali ai sensi del D.lgs. n.196/03.
PLEASE NOTE: This e-mail and any attachments are confidential and may contain privileged information. If you are not the intended recipient, you are kindly requested to cancel it, not to disclose the contents to any other person and to notify the sender immediately by return e-mail. Thanks. A TLC S.r.l. processes your personal data as per italian law (legislative decree No.196/2003).
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users