<p></p>
<h3>Description</h3>
<p>Seems that topos is not adding Record-Route headers in this scenario.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/63080/85021978-ea173900-b172-11ea-95dc-2b3be27378e3.png"><img src="https://user-images.githubusercontent.com/63080/85021978-ea173900-b172-11ea-95dc-2b3be27378e3.png" alt="topos" style="max-width:100%;"></a><br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/63080/85021983-eb486600-b172-11ea-8383-816799e6251b.png"><img src="https://user-images.githubusercontent.com/63080/85021983-eb486600-b172-11ea-8383-816799e6251b.png" alt="no_topos" style="max-width:100%;"></a></p>
<h4>Log Messages</h4>
<p>I've added some more debug to topos: <a href="https://paste.debian.net/1152674/" rel="nofollow">https://paste.debian.net/1152674/</a><br>
Full <a href="https://github.com/kamailio/kamailio/files/4798522/kamailio-lb.log">kamailio-lb.log</a></p>
<p>This is the part when processing of the 200 OK coming from PSTN(fake)</p>
<pre><code>Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:868]: tps_response_received(): handling incoming response
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:376]: tps_pack_message(): compacted headers - x_via1: [SIP/2.0/UDP 127.0.0.1:5064;branch=z9hG4bKcf3d.49d855e2b5f83b9dff62c8a6b0cf23f8.0](80) - x_via2: [](0) - x_vbranch1: [z9hG4bKcf3d.49d855e2b5f83b9dff62c8a6b0cf23f8.0](46)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:485]: tps_pack_message(): compacted headers - a_rr: [](0) - b_rr: [](0) - s_rr: [](0)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:490]: tps_pack_message(): compacted headers - as_contact: [](0) - bs_contact: [](0)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_storage.c:126]: tps_storage_lock_get(): tps lock get: 220
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:889]: tps_response_received(): loaded dialog a_uuid [atpsh-5eeb547f-3970-3]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_storage.c:391]: tps_storage_link_msg(): downstream: yes - acontact: [] - bcontact: [sip:127.0.2.1:50603;transport=UDP]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_storage.c:138]: tps_storage_lock_release(): tps lock release: 220
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKh2oO8aY.;rport=5080#015#012]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:910]: tps_response_received(): x_rr[] y_rr[] s_rr[<sip:127.0.0.1:5064;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>,<sip:127.0.0.1;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Record-Route: <sip:127.0.0.1:5064;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>,<sip:127.0.0.1;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>#015#012]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [P-SR-XBranch: z9hG4bKcf3d.49d855e2b5f83b9dff62c8a6b0cf23f8.0#015#012]
Jun 18 13:48:35 sp1 lb[14702]: NOTICE: REPLY_FROM_OUTBOUND <script>: Reply from Outbound - S=200 - OK M=INVITE IP=«udp»:«127.0.2.1»:«50603» ID=«NGCP%invite_peerout_outbound_socket%///1-15281@127.126.0.1_b2b-1» UA='<null>' DESTIP=«127.0.0.1»:«5064»
Jun 18 13:48:35 sp1 lb[14702]: NOTICE: REPLY_FROM_OUTBOUND <script>: NATed reply detected - ID=«NGCP%invite_peerout_outbound_socket%///1-15281@127.126.0.1_b2b-1» UA='<null>'
Jun 18 13:48:35 sp1 lb[14702]: NOTICE: REPLY_FROM_OUTBOUND <script>: Sending reply from outbound, fs='«udp:127.0.0.1:5060»' du='«127.0.0.1»:«5080»' - ID=«NGCP%invite_peerout_outbound_socket%///1-15281@127.126.0.1_b2b-1» UA='<null>'
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [topos_mod.c:514]: tps_execute_event_route(): executing event_route[topos:topos:msg-sending] (2)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:1038]: tps_response_sent(): handling outgoing response
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:376]: tps_pack_message(): compacted headers - x_via1: [SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKh2oO8aY.;rport=5080](79) - x_via2: [](0) - x_vbranch1: [z9hG4bKh2oO8aY.](15)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:485]: tps_pack_message(): compacted headers - a_rr: [](0) - b_rr: [<sip:127.0.0.1:5064;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>,<sip:127.0.0.1;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>](214) - s_rr: [](0)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:490]: tps_pack_message(): compacted headers - as_contact: [](0) - bs_contact: [](0)
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_storage.c:126]: tps_storage_lock_get(): tps lock get: 220
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:1068]: tps_response_sent(): loaded branch a_uuid [atpsh-5eeb547f-3970-3]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_storage.c:138]: tps_storage_lock_release(): tps lock release: 220
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:182]: tps_add_headers(): adding to headers(0) - [Contact: <sip:atpsh-5eeb547f-3970-3@127.0.0.1>#015#012]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_msg.c:1101]: tps_response_sent(): x_rr[] y_rr[] s_rr[<sip:127.0.0.1:5064;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>,<sip:127.0.0.1;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [tps_storage.c:391]: tps_storage_link_msg(): downstream: yes - acontact: [] - bcontact: [sip:127.0.2.1:50603;transport=UDP]
Jun 18 13:48:35 sp1 lb[14702]: DEBUG: <null> topos [topos_mod.c:454]: tps_msg_sent(): new outbound buffer generated
</code></pre>
<pre><code>topos [tps_msg.c:910]: tps_response_received(): x_rr[] y_rr[] s_rr[<sip:127.0.0.1:5064;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>,<sip:127.0.0.1;r2=on;lr=on;ftag=5A412B38-5EEB5492000D683F-C3258700;ngcplb=yes;socket=udp:127.0.0.1:5064>]
</code></pre>
<p>proper Record-Route value is on <code>s_rr</code></p>
<p>but <a href="https://github.com/kamailio/kamailio/blob/93ab0791b409b9a708a1c7ac5cc4f94f7537d2ca/src/modules/topos/tps_msg.c#L1097">here</a> uses <code>x_rr</code> that is empty in this case</p>
<h4>SIP Traffic</h4>
<p>pcap files for the same scenario with and without topos</p>
<p><a href="https://github.com/kamailio/kamailio/files/4798553/no_topos.zip">no_topos.zip</a><br>
<a href="https://github.com/kamailio/kamailio/files/4798577/topos.zip">topos.zip</a></p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<p>This is Sipwise version based on 5.3.4, no patches on topos apart of the debug one.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2364">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOZHFITGQUTNMWNRXTRXIGCHANCNFSM4OBR77SA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZNDXWMYNXQWRNWGHJLRXIGCHA5CNFSM4OBR77SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JRXZKGA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2364",
"url": "https://github.com/kamailio/kamailio/issues/2364",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>