<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body 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="emphasis"><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 class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.2.x/dialog.html#id297400">http://www.opensips.org/html/docs/modules/2.2.x/dialog.html#id297400</a><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/02/2017 10:31 PM, Stas Kobzar
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAMYcjopfMt-4kvjH58LhYBgJ9ADS3RQMic1xBkwyB8jpA4UtWg@mail.gmail.com"
      type="cite">
      <div dir="ltr"><font face="monospace, monospace">Hello List,</font>
        <div><font face="monospace, monospace"><br>
          </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"><br>
          </font></div>
        <div><font face="monospace, monospace">UA                
            OpenSIPS          PSTN GW</font></div>
        <div><font face="monospace, monospace">-------------------------------------------</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"><br>
          </font></div>
        <div><font face="monospace, monospace">(UA sends ACK then new
            INVITE)</font></div>
        <div><font face="monospace, monospace"><br>
          </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"><br>
          </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"><br>
          </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"><br>
          </font></div>
        <div><font face="monospace, monospace">My question is:<br>
          </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">      <br>
          </font></div>
        <div>
          <div><font face="monospace, monospace">Thank you,</font></div>
          -- <br>
          <div class="gmail_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"><br>
                              </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>
      <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>