<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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>
    <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 04:05 PM, Federico Edorna
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAKi1vHhztuCbE_rwk9dqR18qndo8+Qn0WPitwjz5cY30Uu-qaQ@mail.gmail.com"
      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-Apple-tab-span" style="white-space:pre">                                                        </span>opensips<span class="gmail-Apple-tab-span" style="white-space:pre">                                                        </span>B</div>
          <div><br>
          </div>
          <div>---<span class="gmail-Apple-tab-span" style="white-space:pre">                </span>INVITE<span class="gmail-Apple-tab-span" style="white-space:pre">                </span>---&gt;</div>
          <div><br>
          </div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                        </span>---<span class="gmail-Apple-tab-span" style="white-space:pre">                </span>INVITE<span class="gmail-Apple-tab-span" style="white-space:pre">                                </span>---&gt;</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                        </span></div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                        </span>&lt;---<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>100
            Trying<span class="gmail-Apple-tab-span" style="white-space:pre">                        </span>---</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                </span></div>
          <div>&lt;---<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>100
            Trying<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>---</div>
          <div><br>
          </div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                        </span>&lt;---<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>183
            Session Progress---</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>&lt;---<span class="gmail-Apple-tab-span" style="white-space:pre">        </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-Apple-tab-span" style="white-space:pre">                                                                        </span>&lt;---<span class="gmail-Apple-tab-span" style="white-space:pre">                </span>200
            OK<span class="gmail-Apple-tab-span" style="white-space:pre">                        </span>---</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Thanks!</div>
        <div class="gmail_extra"><br clear="all">
          <div>
            <div class="gmail_signature"
              data-smartmail="gmail_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">&lt;<a
                moz-do-not-send="true" href="mailto:razvan@opensips.org"
                target="_blank">razvan@opensips.org</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div 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 moz-do-not-send="true"
                    class="m_-2659467867638395094moz-txt-link-freetext"
href="http://www.opensips.org/Documentation/Script-CoreParameters-2-2#toc101"
                    target="_blank">http://www.opensips.org/<wbr>Documentation/Script-<wbr>CoreParameters-2-2#toc101</a><br>
                </tt>
                <pre class="m_-2659467867638395094moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a moz-do-not-send="true" class="m_-2659467867638395094moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
                <div>
                  <div class="h5">
                    <div class="m_-2659467867638395094moz-cite-prefix">On
                      10/26/2016 10:59 PM, Rodrigo Pimenta Carvalho
                      wrote:<br>
                    </div>
                  </div>
                </div>
                <blockquote type="cite">
                  <div>
                    <div class="h5">
                      <div
                        id="m_-2659467867638395094divtagdefaultwrapper"
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="m_-2659467867638395094Signature">
                          <div name="divtagdefaultwrapper">
                            <div
                              class="m_-2659467867638395094BodyFragment"><font
                                size="2">
                                <div
                                  class="m_-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="m_-2659467867638395094mimeAttachmentHeader"></fieldset>
                      <br>
                    </div>
                  </div>
                  <pre>______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" class="m_-2659467867638395094moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="m_-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">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>