<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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 class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-CoreParameters-2-2#toc101">http://www.opensips.org/Documentation/Script-CoreParameters-2-2#toc101</a><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 10/26/2016 10:59 PM, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote
cite="mid:BN6PR02MB2721E6C946FD5AAF09D44001B5AB0@BN6PR02MB2721.namprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;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="Signature">
          <div name="divtagdefaultwrapper"
            style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
            <div class="BodyFragment"><font size="2">
                <div class="PlainText">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="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <br>
  </body>
</html>