<div dir="ltr">Hello,<div><br><div>Finally, I came up with something that works as I want it.</div></div><div><br></div><div>I have tried to drop re-INVITE when DLG_lifetime is < 1sec. I worked. But, as the re-INVITEs were the part of direct media negotiation, I had some "cuts" in the audio in very beginning of the call.</div><div><br></div><div>So, I do following:</div><div>if ($DLG_lifetime < 2) usleep("200000");</div><div><br></div><div>This actually works fine for me.</div><div><br></div><div>Thank you for your help and ideas!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 8:45 AM, Stas Kobzar <span dir="ltr"><<a href="mailto:stas.kobzar@modulis.ca" target="_blank">stas.kobzar@modulis.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bogdan,<div><br></div><div>It seems like $DLG_status will not work in my case.</div><div><br></div><div>But $DLG_lifetime probably can work. 5 seconds might be too long in my case, though. </div><div>I have re-INVITE almost immediately after initial INVITE (it is Asterisk, trying to renegotiate SDP media IP/port for direct media).<br></div><div><br></div><div>I guess 1 second might work fine here.</div><div><br></div><div>Thank you for your help!</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 5:10 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></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 Stas,<br>
      <br>
      If the ACK git the loose_route() / match_dialog(), then the state
      will move to 4. <br>
      <br>
      You may also use the $DLG_lifetime when handling the re-INVITE -
      if it is less than 5 seconds, drop the re-INVITE :)<br>
      <br>
      Regards,<br>
    </tt><span>
    <pre class="m_2397412347747255373m_4288935020655814574moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="m_2397412347747255373m_4288935020655814574moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre>
    </span><div><div class="m_2397412347747255373h5"><div class="m_2397412347747255373m_4288935020655814574moz-cite-prefix">On 02/06/2017 09:46 PM, Stas Kobzar
      wrote:<br>
    </div>
    <blockquote type="cite">
      <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">On Sun, Feb 5, 2017 at 11:15 AM,
          Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank"></a><a class="m_2397412347747255373m_4288935020655814574moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></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 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_2397412347747255373m_4288935020655814574m_-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 class="m_2397412347747255373m_4288935020655814574m_-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_2397412347747255373m_4288935020655814574m_-8994335413096070854moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="m_2397412347747255373m_4288935020655814574m_-8994335413096070854moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre><span>
    <div class="m_2397412347747255373m_4288935020655814574m_-8994335413096070854moz-cite-prefix">On 02/02/2017 10:31 PM, Stas Kobzar
      wrote:

    </div>
    </span><blockquote type="cite"><div><div class="m_2397412347747255373m_4288935020655814574h5">
      <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_2397412347747255373m_4288935020655814574m_-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 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 href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a 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 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_2397412347747255373m_4288935020655814574m_-8994335413096070854mimeAttachmentHeader"></fieldset>
      

      </div></div><span><pre>______________________________<wbr>_________________
Users mailing list
<a class="m_2397412347747255373m_4288935020655814574m_-8994335413096070854moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_2397412347747255373m_4288935020655814574m_-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 class="m_2397412347747255373m_4288935020655814574gmail_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 href="tel:(514)%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 href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a 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 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>



</blockquote>
</div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_2397412347747255373gmail_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: <a href="tel:(514)%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 href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a 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 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></blockquote></div><br><br clear="all"><div><br></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 href="http://firstname.lastname" style="text-decoration:none" target="_blank">s</a>tas.kobzar</span><a 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 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>