<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>I got you now: so you are trying to set the tcp_no_new_conn_bflag
in the reply_route, but OpenSIPS still tries to connect to the
client?<br>
After you added the code in reply_received function, OpenSIPS
still tries to connect?<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 11/14/2016 06:06 PM, Federico Edorna
wrote:<br>
</div>
<blockquote
cite="mid:CAKi1vHi9CqxMW2F3Jy5CO=rx_UJZbpQtzv1g68R7fT_czt1LAg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">Hi Razvan, thanks for your response</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">I agree that it is dangerous to try to
open a new tcp connection, that's why we want to set always
the flag and never try to open a new tcp connection to the
UAC.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">What I'm trying to say is that
setting tcp_no_new_conn_bflag doesn't seem to work for a
reply, for example what I've described in my previous email.
When opensips receives a reply from the callee (and has to do
the relay to the caller) but the caller tcp connection has
gone, opensips will try to open a new connection, even with
the flag set. It is not a common scenario, but it happens
sometimes, that the tcp connection is reseted before the call
is answered.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Maybe I cannot explain the problem in
my English :(, please let me know...</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Best Regards</div>
<div class="gmail_extra">Federico</div>
<div class="gmail_extra"> </div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Nov 14, 2016 at 11:24 AM,
Răzvan Crainea <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:razvan@opensips.org"
target="_blank">razvan@opensips.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"> <tt>Hi, Federico!<br>
<br>
Not sure I understand your problem. That flag
indicates OpenSIPS to avoid opening a new connection
if he doesn't have one available. Therefore, if the
connection to the caller closes between INVITE and 200
OK, that flag prevents OpenSIPS from opening a new
one.<br>
Why would you like to get rid of the TCP SYN message?
That happens and the TCP layer, saying that the data
arrived successfully. Why would you like to prevent
that?<br>
<br>
Best regards,<br>
</tt><span class="gmail-">
<pre class="gmail-m_-3105548140052468827moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
</span>
<div>
<div class="gmail-h5">
<div
class="gmail-m_-3105548140052468827moz-cite-prefix">On
11/14/2016 04:05 PM, Federico Edorna wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi Răzvan,
<div><br>
</div>
<div>related to this topic, it seems that
tcp_no_new_conn_bflag is not working on
"on_reply" routes</div>
<div><br>
</div>
<div>I've tried changing modules/tm/t_reply.c
(opensips 2.2), using something like this:</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>if (tcp_no_new_conn_bflag)</div>
<div> tcp_no_new_conn = 1;</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>in "relay_reply" function and now opensips
doesn't try to open a new tcp connection.
Without this code I cannot manage to avoid the
TCP SYN from opensips to client when receiving
a reply and tcp connection is not available.</div>
<div><br>
</div>
<div><br>
</div>
<div>Just to clarify, the scenario is something
like this:</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>A<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                        </span>opensips<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                        </span>B</div>
<div><br>
</div>
<div>---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>INVITE<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>---></div>
<div><br>
</div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                        </span>---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>INVITE<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                </span>---></div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                        </span></div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                        </span><---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>100
Trying<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>---</div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                </span></div>
<div><---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>100
Trying<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>---</div>
<div><br>
</div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                        </span><---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>183
Session Progress---</div>
<div><br>
</div>
<div><br>
</div>
<div><---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>183
Session Progress---</div>
<div><br>
</div>
<div><br>
</div>
<div>--- At this point I wait opensips to
close tcp connection
(tcp_connection_lifetime=10) and then "B"
answers the call ----</div>
<div><br>
</div>
<div><br>
</div>
<div><span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                                                                        </span><---<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>200
OK<span class="gmail-m_-3105548140052468827gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>---</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks!</div>
<div class="gmail_extra"><br clear="all">
<div>
<div
class="gmail-m_-3105548140052468827gmail_signature">
<div>Federico</div>
</div>
</div>
<br>
<div class="gmail_quote">On Thu, Oct 27, 2016
at 4:58 AM, Răzvan Crainea <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:razvan@opensips.org"
target="_blank">razvan@opensips.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"> <tt>Hi, Rodrigo!<br>
<br>
Having OpenSIPS opening TCP
connections towards client is a bit
dangerous, especially if the clients
are behind NAT. That's because most
likely you will not be able to reach
them, and opensips will get stuck
trying to connect (until it triggers a
timeout). That's why the best way to
go is to try to keep the connection
(ideally opened by the client at
REGISTER) as much as possible. This is
usually done by pinging (as discussed
in a previous email). So my suggestion
is to try to avoid opening new TCP
connections with clients, unless you
really know they will always be
reachable.<br>
<br>
The behavior you are describing
(INVITE vs BYE handling), might be
related to the fact that you are
setting the tcp_no_new_conn_bflag[1]
flag for BYE messages, but not for
INVITEs. Is this correct? If not, do
you see any errors in the script?<br>
<br>
[1] <a moz-do-not-send="true"
class="gmail-m_-3105548140052468827m_-2659467867638395094moz-txt-link-freetext"
href="http://www.opensips.org/Documentation/Script-CoreParameters-2-2#toc101"
target="_blank">http://www.opensips.org/Docume<wbr>ntation/Script-CoreParameters-<wbr>2-2#toc101</a><br>
</tt>
<pre class="gmail-m_-3105548140052468827m_-2659467867638395094moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827m_-2659467867638395094moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
<div>
<div
class="gmail-m_-3105548140052468827h5">
<div
class="gmail-m_-3105548140052468827m_-2659467867638395094moz-cite-prefix">On
10/26/2016 10:59 PM, Rodrigo
Pimenta Carvalho wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div
class="gmail-m_-3105548140052468827h5">
<div
id="gmail-m_-3105548140052468827m_-2659467867638395094divtagdefaultwrapper"
style="font-size:12pt;color:rgb(0,0,0);font-family:calibri,arial,helvetica,sans-serif">
<p>Hi.</p>
<p><br>
</p>
<p>After some log debug I have
observed the following
behavior in the OpenSISP
(2.2.1):</p>
<p><br>
</p>
<p>When OpenSIPS has to send a
SIP INVITE to a peer through a
TCP connection that was closed
before by some way, OpenSIPS
open a new one and then sends
the SIP message to the peer
successfully.</p>
<p><br>
</p>
<p>However, <span>when OpenSIPS
has to send a SIP BYE to a
peer through a TCP
connection that was closed
before, OpenSIPS open a new
one, but doesn't send the
SIP BYE. In this case SIP
BYE is discarded.</span></p>
<p><span><br>
</span></p>
<p><span>How to change the
behavior of OpenSIPS to make
it to send the SIP BYE is
such case?</span></p>
<p><span><br>
</span></p>
<p><span>I'm looking for ways of
fix or workaround of a TCP
tear down connection that
happens during dialogs.<br>
</span></p>
<p><span><br>
</span></p>
<p><span>Any hint will be very
helpful!<br>
</span></p>
<p><br>
</p>
<div
id="gmail-m_-3105548140052468827m_-2659467867638395094Signature">
<div
name="divtagdefaultwrapper">
<div
class="gmail-m_-3105548140052468827m_-2659467867638395094BodyFragment"><font
size="2">
<div
class="gmail-m_-3105548140052468827m_-2659467867638395094PlainText">RODRIGO
PIMENTA CARVALHO<br>
Inatel Competence
Center<br>
Software<br>
Ph: +55 35 3471 9200
RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
<br>
<fieldset
class="gmail-m_-3105548140052468827m_-2659467867638395094mimeAttachmentHeader"></fieldset>
<br>
</div>
</div>
<pre>______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827m_-2659467867638395094moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827m_-2659467867638395094moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</blockquote></div>
</div></div>
<fieldset class="gmail-m_-3105548140052468827mimeAttachmentHeader"></fieldset>
<pre>______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="gmail-m_-3105548140052468827moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div></div></div>
______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</blockquote></div>
</div></div>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</body></html>