<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Nick,<br>
      <br>
      It is risky to do a sync sleep as you keep the process blocked, so
      the ability of OpenSIPS to handle new messages will decrease . <br>
      <br>
      Either do async sleep, either simple drop it to force a
      retransmissions in 500ms - much simpler :)<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 02/07/2017 12:22 PM, Nick Altmann
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJOe1EOMZg=Xmeq218k0t1g=+ydTRQ_cwZGvxk76suXe2OPMtg@mail.gmail.com"
      type="cite">
      <div dir="ltr">The easies way we use in such cases is:<br>
        if (is_method("INVITE")) usleep("500");<br>
        for in-dialog INVITEs (inside loose_route() / match_dialog()
        section).<br>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">It will delay slightly all reINVITES,
          but also will guarantee correct order of packets.</div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">2017-02-06 22:46 GMT+03:00 Stas
            Kobzar <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:stas.kobzar@modulis.ca" target="_blank">stas.kobzar@modulis.ca</a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Hello Bogdan,
                <div><br>
                </div>
                <div>In my case, ACK for previous INVITE has already
                  been received by OpenSIPS, but not sent yet. </div>
                <div>In this case, will the variable $DLG_status still
                  equals 3 ?</div>
                <div><br>
                </div>
                <div>Thanks</div>
              </div>
              <div class="gmail_extra"><br>
                <div class="gmail_quote"><span class="">On Sun, Feb 5,
                    2017 at 11:15 AM, Bogdan-Andrei Iancu <span
                      dir="ltr"><<a moz-do-not-send="true"
                        href="mailto:bogdan@opensips.org"
                        target="_blank">bogdan@opensips.org</a>></span>
                    wrote:<br>
                  </span>
                  <div>
                    <div class="h5">
                      <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
                            Stas,<br>
                            <br>
                            Such races may happen at application level
                            or even at network level (when using UDP) -
                            so if you have 2 packets very close as time,
                            they may swap. That is SIP :)<br>
                            <br>
                            The full guilt is in the UAC device, IMHO -
                            it should let some time gap between the ACK
                            and re-INVITE, to eliminate any possible
                            races.<br>
                            <br>
                            Now, what you can do is to use the dialog
                            module and to check the dialog state when
                            receiving the re-invite. If $DLG_status is </tt><tt><span
class="m_9125869299888279809m_-8994335413096070854emphasis"><em>3</em></span>
                            (Confirmed by a final reply but no ACK
                            received yet), drop with no reply the
                            re-INVITEs (to force a later retransmission)
                            :<br>
                                <a moz-do-not-send="true"
                              class="m_9125869299888279809m_-8994335413096070854moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/2.2.x/dialog.html#id297400"
                              target="_blank">http://www.opensips.org/html/d<wbr>ocs/modules/2.2.x/dialog.html#<wbr>id297400</a><br>
                            <br>
                            Regards,<br>
                          </tt>
                          <pre class="m_9125869299888279809m_-8994335413096070854moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" class="m_9125869299888279809m_-8994335413096070854moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre><span>
    <div class="m_9125869299888279809m_-8994335413096070854moz-cite-prefix">On 02/02/2017 10:31 PM, Stas Kobzar
      wrote:

    </div>
    </span><blockquote type="cite"><div><div class="m_9125869299888279809h5">
      <div dir="ltr"><font face="monospace, monospace">Hello List,</font>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">My call flow has initial
            INVITE and re-INVITE to update RTP IP/port.</font></div>
        <div><font face="monospace, monospace">Usually everything works
            well, but sometimes OpenSIPS come up with following example:</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">UA                
            OpenSIPS          PSTN GW</font></div>
        <div><font face="monospace, monospace">------------------------------<wbr>-------------</font></div>
        <div><font face="monospace, monospace">INV(CSeq: 100) ----->
            | ---> INV(CSeq: 100)</font></div>
        <div><font face="monospace, monospace"><---- 200 OK        
             | <--- 200 OK</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">(UA sends ACK then new
            INVITE)</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">ACK(CSeq: 100) ----->
            |</font></div>
        <div><font face="monospace, monospace">reINV(Cseq: 101) --->
            |</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">(OpenSIPS relays first
            INVITE then ACK)</font></div>
        <div><font face="monospace, monospace">                      |
            ---> reINV(CSeq: 101)</font></div>
        <div><font face="monospace, monospace">                      |
            --->   ACK(CSeq: 100)</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">When PSTN gateway
            receives re-INVITE before ACK for previous INVITE</font></div>
        <div><font face="monospace, monospace">it responds 500 with
            Retry-After header. </font></div>
        <div><font face="monospace, monospace">This is correct behaviour
            which conforms to the RFC 3261 section 14.2</font></div>
        <div><font face="monospace, monospace">

          </font></div>
        <div><font face="monospace, monospace">My question is:

          </font></div>
        <div><font face="monospace, monospace">Is it possible to assure
            order of received and relayed messages within the same SIP
            session? Is there any configuration parameter?</font></div>
        <div><font face="monospace, monospace">      

          </font></div>
        <div>
          <div><font face="monospace, monospace">Thank you,</font></div>
          -- 

          <div class="m_9125869299888279809m_-8994335413096070854gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr"><span>
                              <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,112,192);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Stas Kobzar</span></p>
                              <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12px;font-family:Arial;color:rgb(166,166,166);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Developeur VoIP / VoIP Developer</span></p>
                              <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">

                              </p>
                            </span>
                            <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,112,192);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Modulis­.ca Inc.</span></p>
                            <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12px;font-family:Arial;color:rgb(0,0,0);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"># Bureau / Office: <a moz-do-not-send="true" href="tel:%28514%29%20284-2020" value="+15142842020" target="_blank">514-284-2020 x 246</a></span></p>
                            <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Email</span><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">: </span><span style="text-decoration:underline;font-size:11px;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a moz-do-not-send="true" href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a moz-do-not-send="true" style="text-decoration:none"><span style="font-size:11px;font-family:Arial;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">@modulis.ca</span></a></p>
                            <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> </span></p>
                            <p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="text-decoration:underline;font-size:11px;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a moz-do-not-send="true" href="https://www.modulis.com/" style="text-decoration:none" target="_blank">https://www.modulis.com</a></span></p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      

      <fieldset class="m_9125869299888279809m_-8994335413096070854mimeAttachmentHeader"></fieldset>
      

      </div></div><span><pre>______________________________<wbr>_________________
Users mailing list
<a moz-do-not-send="true" class="m_9125869299888279809m_-8994335413096070854moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="m_9125869299888279809m_-8994335413096070854moz-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>
    </span></blockquote>
    

  </div>

</blockquote></div></div></div><div><div class="h5">

<div>
</div>-- 
<div class="m_9125869299888279809gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,112,192);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Stas Kobzar</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12px;font-family:Arial;color:rgb(166,166,166);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Developeur VoIP / VoIP Developer</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">
</p></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,112,192);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Modulis­.ca Inc.</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12px;font-family:Arial;color:rgb(0,0,0);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"># Bureau / Office: 514-284-2020 x 246</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:bold;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Email</span><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">: </span><span style="text-decoration:underline;font-size:11px;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a moz-do-not-send="true" href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a moz-do-not-send="true" style="text-decoration:none"><span style="font-size:11px;font-family:Arial;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">@modulis.ca</span></a></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> </span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="text-decoration:underline;font-size:11px;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a moz-do-not-send="true" href="https://www.modulis.com/" style="text-decoration:none" target="_blank">https://www.modulis.com</a></span></p></div></div></div></div></div></div></div></div></div>
</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>



</blockquote>
</body></html>