<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Record route is used for coming transactions on the same dialog and needs to be something<div class="">the server is listening to.</div><div class=""><br class=""></div><div class="">The server (on the other side) for a TCP connection may reuse the TCP connection (if outbound is used) or</div><div class="">setup a new connection to the port advertised in Record-route/Route-headers.</div><div class=""><br class=""></div><div class="">As 5060 is the port Kamailio listens to, that is the one to be advertised. The other one</div><div class="">is just a source port used for outbound connections and nothing Kamailio listens on for</div><div class="">inbound connections.</div><div class=""><br class=""></div><div class="">/O<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 12 May 2020, at 11:39, Michal Popovic <<a href="mailto:michal.popovic@cloudtalk.io" class="">michal.popovic@cloudtalk.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Daniel,<div class=""><br class=""></div><div class="">thank you for your help.</div><div class=""><br class=""></div><div class="">I have found out that reason for this behaviour was that kamailio relay UDP connection to TCP connection and tm module adds two record-routes.</div><div class="">This is correct behaviour, but I am not sure if it is correct that first record-route advertised port 5060 if kamailio opens random port for the connection.</div><div class="">Shouldn't there be a port that was used for outgoing connection?</div><div class=""><br class=""></div><div class=""><div class="">Record-Route: <<a href="sip:xx.xx.xx.xx:" class="">sip:xx.xx.xx.xx:</a><b class="">5060</b>;transport=tcp;r2=on;lr=on;ftag=as1f9ba470></div><div class="">Record-Route: <sipxx.xx.xx.xx;r2=on;lr=on;ftag=as1f9ba470></div><div class=""><br class="webkit-block-placeholder"></div><div class="">Bye,</div><div class="">Michal</div><div class="">
<div style="caret-color: rgb(0, 0, 0); font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: Verdana; color: rgb(12, 12, 24);" class=""><br class=""></div>
</div>
<div class=""><br class=""><blockquote type="cite" class=""><div class="">On 11 May 2020, at 13:39, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" class="">miconda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello,<br class=""><br class="">the nature of tcp protocol makes local ports on connect (as well<br class="">accepted connection ports) ephemeral. Kamailio has for that reason<br class="">"connection aliases", so the matching is also done based on advertised<br class="">attributes, not only on connection source ip/port. The interconnect<br class="">provider should do it also for tcp/tls. I am not sure now, but I think<br class="">there is also in the RFC specs something about.<br class=""><br class="">Then, the alternative, with the latest kernels and kamailio, you can try<br class="">to reuse the tcp port:<br class=""><br class="">  * <a href="https://www.kamailio.org/wiki/cookbooks/5.3.x/core#tcp_reuse_port" class="">https://www.kamailio.org/wiki/cookbooks/5.3.x/core#tcp_reuse_port</a><br class=""><br class="">On the other hand, the firewall may associate a different extern port<br class="">for connections originated from the same source ip/port, you will have<br class="">to test and see what happens.<br class=""><br class="">Cheers,<br class="">Daniel<br class=""><br class="">On 11.05.20 12:23, Michal Popovic wrote:<br class=""><blockquote type="cite" class="">Hello,<br class=""><br class="">so it looks like kamailio used random port for opening connections to our partners but did not updates record-route port properly. AWS has symmetric NAT and that works fine.<br class=""><br class="">Is there any way how to identify port and rewrite record-route?<br class=""><br class="">Thanks.<br class=""><br class="">Bye,<br class="">Michal<br class=""><br class=""><blockquote type="cite" class="">On 7 May 2020, at 17:25, Michal Popovic <<a href="mailto:michal.popovic@cloudtalk.io" class="">michal.popovic@cloudtalk.io</a>> wrote:<br class=""><br class="">Hello,<br class=""><br class="">our kamailio used for sip trunk interconnections is behind NAT and our cloud provider opens random outgoing ports for outbound connections.<br class="">Our record-route is set to our external address and port 5060, that is probably incorrect, but we did not had any issues.<br class="">One of our partners suddenly begin sending BYEs to the port advertised in record-route instead of port from where he received call.<br class=""><br class="">What is a correct approach here if we are not able to determine open port behind NAT?<br class=""><br class="">Bye,<br class="">Michal<br class="">_______________________________________________<br class="">Kamailio (SER) - Users Mailing List<br class=""><a href="mailto:sr-users@lists.kamailio.org" class="">sr-users@lists.kamailio.org</a><br class=""><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" class="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class=""></blockquote><br class="">_______________________________________________<br class="">Kamailio (SER) - Users Mailing List<br class=""><a href="mailto:sr-users@lists.kamailio.org" class="">sr-users@lists.kamailio.org</a><br class=""><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" class="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class=""></blockquote><br class="">-- <br class="">Daniel-Constantin Mierla -- <a href="http://www.asipto.com/" class="">www.asipto.com</a><br class=""><a href="http://www.twitter.com/miconda" class="">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" class="">www.linkedin.com/in/miconda</a><br class="">Funding: <a href="https://www.paypal.me/dcmierla" class="">https://www.paypal.me/dcmierla</a><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">Kamailio (SER) - Users Mailing List<br class=""><a href="mailto:sr-users@lists.kamailio.org" class="">sr-users@lists.kamailio.org</a><br class="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<br class=""></div></blockquote></div><br class=""></div></body></html>