<div dir="ltr">Hi,<div>if a new connection is created and you don't specify $fs or use force_send_socket, again is the OS choosing the port.</div><div>The point is understanding here why a new connection is created instead of reusing the one created for the INVITE.</div><div>Could please paste the logs, possibly at DEBUG level, when kamailio sends the ACK?</div><div><br></div><div>Cheers,</div><div><br></div><div>Federico</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 18, 2018 at 3:39 PM, Wilkins, Steve <span dir="ltr"><<a href="mailto:swwilkins@mitre.org" target="_blank">swwilkins@mitre.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-1796956159402413263WordSection1">
<p class="MsoNormal">The INVITE has no port assigned in ruri, so I assume it is using the default port of 5060; the ACK does have 5060 in the ruri.  Even if a new connection is created shouldn’t it be using the listen tcp port since I have tcp_reuse_port=yes?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you!<u></u><u></u></p>
<p class="MsoNormal"><a name="m_-1796956159402413263__MailEndCompose"><u></u> <u></u></a></p>
<span></span>
<p class="MsoNormal"><span class=""><b>From:</b> sr-users [mailto:<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@<wbr>lists.kamailio.org</a>]
<b>On Behalf Of </b>Federico Cabiddu<br>
</span><b>Sent:</b> Friday, May 18, 2018 8:49 AM</p><div><div class="h5"><br>
<b>To:</b> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
<b>Subject:</b> Re: [SR-Users] Transport issue thought<u></u><u></u></div></div><p></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Can you print the logs when it tries to send the ACK?<u></u><u></u></p>
<div>
<p class="MsoNormal">Check also that the ACK ruri contains the same destination port which was used for the INVITE, otherwise a new connection will be created.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Federico<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Fri, May 18, 2018 at 2:31 PM, Wilkins, Steve <<a href="mailto:swwilkins@mitre.org" target="_blank">swwilkins@mitre.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Thank you Alex and Federico,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I verified, and SO_REUSEPORT is defined on my OS.  I am using Kamailio 5.2 and I set ‘tcp_reuse_port=yes;’ and $fs;  this has been to no avail as ‘ACK’s’ are still using the high
 port number randomly assigned by Kamailio.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thank you all for sharing your knowledge!<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><a name="m_-1796956159402413263_m_-8244761320131250806__MailEndCompose"> </a><u></u><u></u></p>
<p class="MsoNormal"><b>From:</b> sr-users [mailto:<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@<wbr>lists.kamailio.org</a>]
<b>On Behalf Of </b>Federico Cabiddu<br>
<b>Sent:</b> Friday, May 18, 2018 12:57 AM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
<b>Subject:</b> Re: [SR-Users] Transport issue thought<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">You are right Alex, Linux kernel didn't support SO_REUSEPORT, which allows a socket to be used as source for a tcp connection while is already bound, until version 3.9.<u></u><u></u></p>
<div>
<p class="MsoNormal">Kamailio's parameter tcp_reuse_port, if enabled and your OS has support for SO_REUSEPORT (so not only Linux but FreeBSD, OSX and others), allows you to use force_send_socket (or
 $fs) to send messages from a TCP port kamailio is listening to.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Federico<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Fri, May 18, 2018 at 12:28 AM, Alex Balashov <<a href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">When an outgoing TCP connection is opened, either a port can be<br>
explicitly bound, or it is auto-assigned by the OS's networking stack. I<br>
believe Kamailio does the latter and does not offer options to constrain<br>
the range. If it does, I'm not aware of any apart from this one:<br>
<br>
<a href="https://www.kamailio.org/wiki/cookbooks/5.1.x/core#tcp_reuse_port" target="_blank">https://www.kamailio.org/wiki/<wbr>cookbooks/5.1.x/core#tcp_<wbr>reuse_port</a><br>
<br>
Not sure if it would help in this case, you'd have to give it a try.<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
On Thu, May 17, 2018 at 10:21:34PM +0000, Wilkins, Steve wrote:<br>
<br>
> It appears that the bottom line of my TCP transport not working is that Kamailio is randomly assigning large port numbers to send the TCP traffic out on.<br>
> I am not able to randomly open high ports for this purpose.  Is there a way to tell Kamailio to only use specific ports for this.  I have tried using<br>
> force_send_socket() with Kamailio' s IP, and the port I want to send out on, but this did not work either.  Does this sound like I am on the right track?<br>
> <br>
> Thank you,<br>
> -<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">> ______________________________<wbr>_________________<br>
> Kamailio (SER) - Users Mailing List<br>
> <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">
https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<span style="color:#888888"><br>
<br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">-- </span><br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">Alex Balashov | Principal | Evariste Systems LLC</span><br>
<br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
</span><br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">Web: <a href="http://www.evaristesys.com/" target="_blank">
http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/" target="_blank">
http://www.csrpswitch.com/</a></span><br>
<br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">______________________________<wbr>_________________</span><br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb">Kamailio (SER) - Users Mailing List</span><br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb"><a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a></span><br>
<span class="m_-1796956159402413263m-8244761320131250806hoenzb"><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a></span></span><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>

<br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br></blockquote></div><br></div>