<div dir="ltr">First of all what this article:  <ul style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial"><li style="margin-left:15px"><a href="https://superuser.com/questions/1118735/how-are-source-ports-determined-and-how-can-i-force-it-to-use-a-specific-port" rel="nofollow" target="_blank" style="color:rgb(17,85,204)">https://superuser.com/<wbr>questions/1118735/how-are-<wbr>source-ports-determined-and-<wbr>how-can-i-force-it-to-use-a-<wbr>specific-port</a></li></ul><div><span style="font-size:12.8px">Fails to mention very simple way to force local port number on outgoing tcp connections:   the bind(...)  call</span></div><div><span style="font-size:12.8px">Second why don't kamalio do not re-use an existing connection to a given destination is  also interesting question</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-06-20 14:01 GMT+02:00 Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:notifications@github.com" target="_blank">notifications@github.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>If you refer that the local port of a tcp connection initiated by kamailio is sort of random number, not the port on which kamailio listens, then this is how the TCP stack works. Homer likely takes the internal socket used to receive the packet or the one specific for the interface to send out.</p>
<p>In tcp, it is not possible (or better said, rather impossible) to force local socket for a tcp connection, you can search more on google about, for example a discussion at:</p>
<ul>
<li><a href="https://superuser.com/questions/1118735/how-are-source-ports-determined-and-how-can-i-force-it-to-use-a-specific-port" rel="nofollow" target="_blank">https://superuser.com/<wbr>questions/1118735/how-are-<wbr>source-ports-determined-and-<wbr>how-can-i-force-it-to-use-a-<wbr>specific-port</a></li>
</ul>
<p>I am going to close this issue -- if you want to discuss more on this topic, the right place is <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a> mailing list.</p>
<p>If I misunderstood what you reported and you still think it is an issue of kamailio, reopen and try to describe from another angle, like what it is happening for a specific case and what you expected to happen.</p><div class="HOEnZb"><div class="h5">

<p style="font-size:small;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/1532#issuecomment-398724607" target="_blank">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZTnPeEFpbsX3WC7CisFNUaLYTXLCks5t-jmzgaJpZM4UAV3q" target="_blank">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZagNJcBsU45mueT6dnlMfLgQUQidks5t-jmzgaJpZM4UAV3q.gif" height="1" width="1" alt=""></p>


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