<div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">> Having a similar setup with failover for the loadbalancers, I take for
> granted that TCP/TLS will fail in case of a failover (but UDP will keep
> working after failover due to the stateless nature of it).</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Well, your routing servers use PJSIP for NAPTR resolving?
If so, how have you made it working?</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">I mean, did you find a solution for TCP connections?</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-07 11:03 GMT+03:00 Donat Zenichev <span dir="ltr"><<a href="mailto:donat.zenichev@gmail.com" target="_blank">donat.zenichev@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi.</div><div><br></div><div>Recently I've come across with TCP connection problem.</div><div>The topology is as following:</div><div><br></div><div>DNS srv load balancer - two kamailio proxy servers - one routing server.</div><div><br></div><div>Client appeals to NAPTR record like: <a href="http://sip.domain.com" target="_blank">sip.domain.com</a></div><div>So dns returns one of the proxy servers to client (depending on weight/priority). Now both kamailio have the same priority and weight (the goal is load balancing).</div><div><br></div><div>Routing server (now it is asterisk) working with chan_pjsip.so, that supports NAPTR/SRV records.</div><div>He is able to resolve Record-Route / Route headers with value - <a href="http://sip.domain.com" target="_blank">sip.domain.com</a> (that proxy servers add to record-route headers while relaying requests to him).</div><div>This topology is done to support present dialogs, even if proxy that recently processed it, is dead.<br></div><div><br></div><div>But the problem comes, when routing server (asterisk) sends in-dialog requests to the proxy, that wasn't used to establish the dialog.</div><div>Example, routing server obtains 200 OK from endpoint (relayed by kamailio1 to him) and he sends back ACK, but not to the kamailio1, he sends it to kamailio2 (because he resolves NAPTR <a href="http://sip.domain.com" target="_blank">sip.domain.com</a> and gets ip of second kamailio). Kamailio2 processes the request as usual, because both kamailio have the same db for dialog module, but when he tries to relay the request to endpoint, he gots the error:</div><div>ERROR: <core> [tcp_main.c:4070]: handle_tcpconn_ev(): connect XXX.XXX.XXX.XXX:52185 failed</div><div><br></div><div>The port that kamailio2 tries to use to relay the ACK, is port that endpoint used to establish the dialog with kamailio1 and actually his TCP connection is now established with kamailio1.</div><div>So kamailio2 tries to use the same port and gets the error.</div><div><br></div><div>And this is proper behavior I think.</div><div><br></div><div>There is no problem with UDP transport.</div><div><br></div><div>Has anyone seen the similar problem? That indeed is not a problem, but proper behavior.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div><br></div>-- <br><div class="m_-5081520753671448311gmail_signature"><div dir="ltr"><span>-- <br></span>BR, Donat Zenichev
<br>Wnet VoIP team
<br>Tel: +380(44) 5-900-808
<br><a href="http://wnet.ua" target="_blank">http://wnet.ua</a></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span>-- <br></span>BR, Donat Zenichev
<br>Wnet VoIP team
<br>Tel: +380(44) 5-900-808
<br><a href="http://wnet.ua" target="_blank">http://wnet.ua</a></div></div>
</div>