<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, Rodrigo!<br>
    <br>
    Could you send me the system logs related to the BYE processing?<br>
    <br>
    Best regards,<br>
    <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/27/2016 10:09 PM, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote
cite="mid:DM5PR02MB27323D3124E1C6F21476C3AAB5AA0@DM5PR02MB2732.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 Razvan,</p>
        <p>Thank you very much again!</p>
        <p>See my comments and question in line, please.</p>
        <p>Best regards!<br>
        </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>
        <br>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <hr tabindex="-1" style="display:inline-block; width:98%">
          <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
              color="#000000" face="Calibri, sans-serif"><b>De:</b>
              <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org">&lt;users-bounces@lists.opensips.org&gt;</a> em nome de Răzvan
              Crainea <a class="moz-txt-link-rfc2396E" href="mailto:razvan@opensips.org">&lt;razvan@opensips.org&gt;</a><br>
              <b>Enviado:</b> quinta-feira, 27 de outubro de 2016 05:58<br>
              <b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
              <b>Assunto:</b> Re: [OpenSIPS-Users] OpenSIPS reopen TCP
              connectios and sends INVITE, but not BYE. How to change
              it?</font>
            <div> </div>
          </div>
          <div><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>
              <br>
              <font color="black" size="3"
                face="Calibri,Arial,Helvetica,sans-serif"><span
                  style="font-size:12pt;" id="divtagdefaultwrapper"><font
                    face="Courier New"><span style="color: rgb(0, 111,
                      201);">     The client will be always reachable.
                      Because in my specific case, the client(which <tt><font
                          color="black"><font face="Courier New"><span
                              style="color: rgb(0, 111, 201);"><tt><font
                                  color="black"><span style="color:
                                    rgb(0, 111, 201);">break</span></font></tt></span></font></font></tt>
                      down the TCP connection) is in the same hardware
                      as OpenSIPS. So, there will not be NATs here. </span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);"></span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     As I saw
                      in the log, OpenSIPS reopen the connection, like
                      this:</span></font><font face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);"></span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     </span></font><font
                    face="Courier New"><span style="color: rgb(0, 111,
                      201);">DBG:core:proto_tcp_send: no open tcp
                      connection found, opening new one, async = 1</span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);"></span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     And this
                      is opened in the moment after OpenSIPS trying to
                      pass the SIP BYE to the local client.</span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     As long
                      as OpenSIPS is already reopening the TCP
                      connection, when it needs to send the SIP BYE, why
                      the SIP BYE is not sent finally?</span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);"></span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     I
                      believe that I can use such new connection to send
                      the SIP BYE. In this case, I intend to force
                      OpenSIPS to send the SIP BYE after reopening such
                      TCP connection. Is it possible in terms of script?</span></font><font
                    face="Courier New"><br>
                    <span style="color: rgb(0, 111, 201);">     I have
                      just checked my script and I'm not using the flag
                    </span></font><font face="Courier New"><span
                      style="color: rgb(0, 111, 201);">tcp_no_new_conn_bflag</span></font><font
                    face="Courier New"><span style="color: rgb(0, 111,
                      201);">.</span></font><font face="Courier New"><br>
                  </font></span></font><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" previewremoved="true"
                id="LPlnk433216" 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 moz-do-not-send="true" previewremoved="true" id="LPlnk76188" class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
            <div style="margin-bottom: 20px; overflow: auto; width:
              100%; text-indent: 0px;"
              id="LPBorder_GT_14775842364630.4428380276875088">
              <table style="width: 90%; background-color: rgb(255, 255,
                255); position: relative; overflow: auto; padding-top:
                20px; padding-bottom: 20px; margin-top: 20px;
                border-top: 1px dotted rgb(200, 200, 200);
                border-bottom: 1px dotted rgb(200, 200, 200);"
                id="LPContainer_14775842364600.4446744049481457"
                cellspacing="0">
                <tbody>
                  <tr style="border-spacing: 0px;" valign="top">
                    <td colspan="2" style="vertical-align: top;
                      position: relative; padding: 0px; display:
                      table-cell;"
                      id="TextCell_14775842364610.14114040070308387">
                      <div style="top: 0px; color: rgb(0, 120, 215);
                        font-weight: 400; font-size: 21px; font-family:
                        &quot;wf_segoe-ui_light&quot;,&quot;Segoe UI
                        Light&quot;,&quot;Segoe WP
                        Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; line-height:
                        21px;"
                        id="LPTitle_14775842364610.31737448547010394">
                        <a moz-do-not-send="true" target="_blank"
                          href="http://www.opensips-solutions.com/"
                          style="text-decoration: none;"
                          id="LPUrlAnchor_14775842364620.03940740253802266">Home
                          — OpenSIPS Solutions</a></div>
                      <div style="margin: 10px 0px 16px; color: rgb(102,
                        102, 102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 14px;"
                        id="LPMetadata_14775842364620.4971878814569197">
                        <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
                      <div style="display: block; color: rgb(102, 102,
                        102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 20px; max-height: 100px;
                        overflow: hidden;"
                        id="LPDescription_14775842364630.1861542979967321">
                        OpenSIPS is a mature Open Source implementation
                        of a SIP server. OpenSIPS is more than a SIP
                        proxy/router as it includes application-level
                        functionalities.</div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="moz-cite-prefix">On 10/26/2016 10:59 PM, Rodrigo
              Pimenta Carvalho wrote:<br>
            </div>
            <blockquote type="cite">
              <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>_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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>
          </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>