<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Ravi,<br>
      <br>
      I have to admit I did not understand your whole scenario, but you
      can read SIP headers in failure route, for sure. I think you are
      more fighting how the changes are done per-branch in OpenSIPS -
      whatever you change in request route (as changes) will be
      inherited by all branches/forks of that transaction. What you
      change in failure route will propagate only for that new branch.<br>
      <br>
      IF you want to count the number of serial forking attempts, better
      use an $avp(_name_) variable - you can init it to 0 in request
      route and increment it each time you do a new t_relay().<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>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a>
</pre>
    <div class="moz-cite-prefix">On 08/02/2017 11:46 AM, Ravi Patel
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEh7C86M+r_Bnt7cevBr6jDVNMz7WSw6WCzAACK7d96iLVTrwg@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>Dear Bogdan and Ben,<br>
                      Thanks for your replies.<br>
                      <br>
                    </div>
                    Previously, I set t_on_failure() when forwarded call
                    came back to OpenSIPS(not in failure_route) , Now
                    after your suggestion I set <b>t_on_failure()</b>
                    before <b>t_relay()</b> in <b>failure_route</b>. <br>
                    <br>
                  </div>
                  That Indeed solved the issue of forwarding and
                  timeout, but faced another issue after this change.<br>
                  <br>
                </div>
                Here is the brief of issue: <br>
                <br>
              </div>
              in failure_route, I fetched some <b>headers</b> from <b>SIP
                Message,</b> that checks the number of forwarding and if
              not exceeded max count, it proceed to forward the
              call(t_relay()).<br>
            </div>
            Now in this logic I added <b>t_on_failure()</b> before <b>t_relay()</b>
            , now here I am not able to get the headers from SIP Message
            in failure_route where I am checking the max forwarding
            count.<br>
            <br>
          </div>
          Is there any way to get the headers in failure_route after
          using t_on_failure in failure_route ??<br>
          <br>
        </div>
        Hope I explained well.<br>
        <div><br>
        </div>
        <div>Let me know If you need anything else from my side.<br>
        </div>
        <div><br>
        </div>
        <div>Regards,<br>
        </div>
        Ravi Patel</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Jul 28, 2017 at 9:09 PM, Ben
          Newlin <span dir="ltr"><<a
              href="mailto:Ben.Newlin@genesys.com" target="_blank"
              moz-do-not-send="true">Ben.Newlin@genesys.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="white" link="blue" vlink="purple" lang="EN-US">
              <div class="m_4169767360024003508WordSection1">
                <p class="MsoNormal">Ravi,</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">Are you sure you are arming the
                  failure route after each step using t_on_failure? It
                  sounds like you are only doing this on the call to
                  2222, which allows you to failover to 3333. But when
                  you send to 3333 you have to arm the failure route
                  again.</p>
                <p class="MsoNormal"> </p>
                <p class="MsoNormal">Ben Newlin</p>
                <p class="MsoNormal"> </p>
                <div style="border:none;border-top:solid #b5c4df
                  1.0pt;padding:3.0pt 0in 0in 0in">
                  <p class="MsoNormal"><b><span
                        style="font-size:12.0pt;color:black">From: </span></b><span
                      style="font-size:12.0pt;color:black">Users <<a
                        href="mailto:users-bounces@lists.opensips.org"
                        target="_blank" moz-do-not-send="true">users-bounces@lists.opensips.<wbr>org</a>>
                      on behalf of Ravi Patel <<a
                        href="mailto:ravi.patel@ecosmob.com"
                        target="_blank" moz-do-not-send="true">ravi.patel@ecosmob.com</a>><br>
                      <b>Reply-To: </b>OpenSIPS users mailling list
                      <<a href="mailto:users@lists.opensips.org"
                        target="_blank" moz-do-not-send="true">users@lists.opensips.org</a>><br>
                      <b>Date: </b>Friday, July 28, 2017 at 11:36 AM<br>
                      <b>To: </b>Bogdan-Andrei Iancu <<a
                        href="mailto:bogdan@opensips.org"
                        target="_blank" moz-do-not-send="true">bogdan@opensips.org</a>><br>
                      <b>Cc: </b>OpenSIPS users mailling list <<a
                        href="mailto:users@lists.opensips.org"
                        target="_blank" moz-do-not-send="true">users@lists.opensips.org</a>><span
                        class=""><br>
                        <b>Subject: </b>Re: [OpenSIPS-Users] OpenSIPS
                        reseting issue with $T_fr_inv_timeout while
                        forwarding</span></span></p>
                </div>
                <div>
                  <p class="MsoNormal"> </p>
                </div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <p class="MsoNormal"
                                        style="margin-bottom:12.0pt">Dear
                                        Bogdan,</p>
                                    </div>
                                    <div>
                                      <div class="h5">
                                        <p class="MsoNormal"
                                          style="margin-bottom:12.0pt">I
                                          am Grateful for your reply.</p>
                                      </div>
                                    </div>
                                  </div>
                                  <div>
                                    <div class="h5">
                                      <p class="MsoNormal"
                                        style="margin-bottom:12.0pt">I
                                        applied <b>$T_fr_inv_timeout</b>
                                        before doing each
                                        <b>t_relay().</b> by applying it
                                        , I am able to achieve it at 1st
                                        forwarding but unfortunately not
                                        working for 2nd forwarding.</p>
                                    </div>
                                  </div>
                                </div>
                                <div>
                                  <div class="h5">
                                    <p class="MsoNormal"
                                      style="margin-bottom:12.0pt">The
                                      scenario is:<br>
                                      1111<br>
                                      2222 (fr_inv_timeout 10 sec)<br>
                                      3333 (fr_inv_timeout 5 sec)<br>
                                      4444 (fr_inv_timeout 20 sec)</p>
                                  </div>
                                </div>
                              </div>
                              <div>
                                <div class="h5">
                                  <p class="MsoNormal"
                                    style="margin-bottom:12.0pt">when
                                    1111 calls 2222 : OpenSIPS generates
                                    CANCEL at 10 secs and forwards call
                                    to 3333.<br>
                                    now --> 3333 : OpenSIPS generates
                                    CANCEL at 5 secs<b> </b>but does
                                    not forward call to 4444 instead it
                                    sends
                                    <b>408 to Caller(1111)</b> and drops
                                    call.</p>
                                </div>
                              </div>
                            </div>
                            <div>
                              <div class="h5">
                                <p class="MsoNormal"
                                  style="margin-bottom:12.0pt">I am
                                  attaching packets where <a
                                    href="http://sip.client.com"
                                    target="_blank"
                                    moz-do-not-send="true">
                                    sip.client.com</a> refers to the SIP
                                  clients and <a
                                    href="http://sip.server.com"
                                    target="_blank"
                                    moz-do-not-send="true">
                                    sip.server.com</a> refers to the
                                  OpenSIPS Server.</p>
                              </div>
                            </div>
                          </div>
                          <div>
                            <div class="h5">
                              <p class="MsoNormal"
                                style="margin-bottom:12.0pt">Also find
                                the attached snapshots of the call flow.
                              </p>
                            </div>
                          </div>
                        </div>
                        <div>
                          <div class="h5">
                            <p class="MsoNormal">Please guide what can
                              be done or where I am doing wrong ? </p>
                          </div>
                        </div>
                      </div>
                      <div>
                        <div class="h5">
                          <p class="MsoNormal"
                            style="margin-bottom:12.0pt">Let me know if
                            you need any other information.</p>
                        </div>
                      </div>
                    </div>
                    <p class="MsoNormal">Best Regards,</p>
                  </div>
                  <div>
                    <div class="h5">
                      <p class="MsoNormal">Ravi Patel</p>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <p class="MsoNormal"> </p>
                                  <div>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                      <div>
                                        <div>
                                          <div>
                                            <p class="MsoNormal"> </p>
                                            <div>
                                              <p class="MsoNormal"> </p>
                                              <div>
                                                <p class="MsoNormal">On
                                                  Tue, Jul 25, 2017 at
                                                  9:07 PM, Bogdan-Andrei
                                                  Iancu <<a
                                                    href="mailto:bogdan@opensips.org"
                                                    target="_blank"
                                                    moz-do-not-send="true">bogdan@opensips.org</a>>
                                                  wrote:</p>
                                                <blockquote
                                                  style="border:none;border-left:solid
                                                  #cccccc
                                                  1.0pt;padding:0in 0in
                                                  0in
                                                  6.0pt;margin-left:4.8pt;margin-right:0in">
                                                  <div>
                                                    <p class="MsoNormal"><tt><span
style="font-size:10.0pt">Hi Ravi,</span></tt><span
                                                        style="font-size:10.0pt;font-family:"Courier
                                                        New",serif"><br>
                                                        <br>
                                                        <tt>Before each
                                                          t_rely() you
                                                          have to set
                                                          the your
                                                          custom
                                                          $T_fr_inv_timeout
                                                          and
                                                          $T_fr_timeout,
                                                          otherwise the
                                                          default values
                                                          will be used. 
                                                          As you have a
                                                          serial forking
                                                          scenario, you
                                                          do a new
                                                          t_relay() at
                                                          each step.</tt><br>
                                                        <br>
                                                        <tt>Regards,</tt><br>
                                                        <br>
                                                      </span></p>
                                                    <pre>Bogdan-Andrei Iancu</pre>
                                                    <pre>  OpenSIPS Founder and Developer</pre>
                                                    <pre>  <a href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">http://www.opensips-solutions.<wbr>com</a></pre>
                                                    <pre> </pre>
                                                    <pre>OpenSIPS Bootcamp 2017, Houston, US</pre>
                                                    <pre>  <a href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html" target="_blank" moz-do-not-send="true">http://opensips.org/training/<wbr>OpenSIPS_Bootcamp_2017.html</a></pre>
                                                    <div>
                                                      <div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal">On
                                                          07/25/2017
                                                          05:34 PM, Ravi
                                                          Patel wrote:</p>
                                                        </div>
                                                      </div>
                                                    </div>
                                                    <blockquote
                                                      style="margin-top:5.0pt;margin-bottom:5.0pt">
                                                      <div>
                                                        <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">Hi Team,<br>
                                                          <br>
                                                          What is the
                                                          right way to
                                                          reset timers <b>$T_fr_inv_timeout</b>
                                                          and <b>$T_fr_timeout</b>
                                                          ??<br>
                                                          <br>
                                                          I am using
                                                          OpenSIPS-2.2
                                                          version<br>
                                                          The below
                                                          scenario will
                                                          help to
                                                          understand
                                                          issue,<br>
                                                          <br>
                                                          There are 4
                                                          SIP users,<br>
1111,2222,3333,4444 <br>
                                                          <br>
                                                          What I want to
                                                          achieve is:<br>
                                                          1111 --->
                                                          2222 (FORWARD
                                                          ON NOANSWER)
                                                          ---> 3333
                                                          (FORWARD ON
                                                          NOANSWER)
                                                          ---> 4444<br>
                                                          <br>
                                                          <b>1st Test
                                                          Case Scenario:</b><br>
                                                          <br>
                                                          1111<br>
                                                          2222
                                                          (fr_inv_timeout
                                                          20 sec)<br>
                                                          3333
                                                          (fr_inv_timeout
                                                          25 sec)<br>
                                                          4444
                                                          (fr_inv_timeout
                                                          30 sec)<br>
                                                          <br>
                                                          <br>
                                                          when 1111
                                                          calls 2222 :
                                                          OpenSIPS
                                                          generates
                                                          CANCEL at 20
                                                          secs (thats
                                                          working proper
                                                          as expexted)
                                                          and forwards
                                                          call to 3333
                                                          as per my
                                                          configuration.<br>
                                                          so in -->
                                                          3333 :
                                                          OpenSIPS
                                                          generates
                                                          CANCEL at <b>20
                                                          secs instead
                                                          of 25 secs</b>
                                                          and send 408
                                                          to 1111. and
                                                          not processing
                                                          the 2nd
                                                          forwarding.<br>
                                                          <br>
                                                          <b>2nd Test
                                                          Case Scenario:</b><br>
                                                          1111<br>
                                                          2222
                                                          (fr_inv_timeout
                                                          20 sec)<br>
                                                          3333
                                                          (fr_inv_timeout
                                                          15 sec)<br>
                                                          4444
                                                          (fr_inv_timeout
                                                          30 sec)<br>
                                                          <br>
                                                          when 1111
                                                          calls 2222 :
                                                          OpenSIPS
                                                          generates
                                                          CANCEL at 20
                                                          secs (that is
                                                          working proper
                                                          as expexted)
                                                          and forwards
                                                          call to 3333
                                                          as per my
                                                          configuration.<br>
                                                          now -->
                                                          3333 :
                                                          OpenSIPS
                                                          generates
                                                          CANCEL at 15
                                                          secs and
                                                          forwards the
                                                          call to 4444,
                                                          Here OpenSIPS
                                                          generates
                                                          CANCEL
                                                          <b>after 5
                                                          secs instead
                                                          of 30 secs.</b><br>
                                                          <br>
                                                          <br>
                                                          We set timeout
                                                          by using
                                                          $T_fr_inv_timeout.<br>
                                                          ------------<br>
route[ring_timeout]{<br>
                xlog("L_INFO","---------------<wbr>---- RING_TIMEOUT
                                                          ---------------\n");<br>
                if (!is_method("INVITE"))<br>
                        return;<br>
                avp_db_load("$rU","$avp(<wbr>ringtimeout)/usr_preferences")<wbr>;
                                                          <br>
                if($avp(ringtimeout)!=null)   <wbr>  <br>
                {<br>
                        $T_fr_inv_timeout = NULL;<br>
                        xlog("L_INFO","$rU: Ring timeout :
                                                          $avp(ringtimeout)");<br>
                        $T_fr_inv_timeout =$(avp(ringtimeout){<a
                                                          href="http://s.int"
target="_blank" moz-do-not-send="true">s.int</a>}) ;<br>
                        xlog("L_INFO","$rU: Ring timeout is setted:
                                                          [$T_fr_inv_timeout]");<br>
                }<br>
                else<br>
                {<br>
                        xlog("L_INFO","$rU: Ring timeout is NOT
                                                          setted");<br>
                }<br>
                                                          }<br>
------------------<br>
                                                          <br>
                                                          From both the
                                                          scenarios what
                                                          we found, it
                                                          sticks to the
                                                          first timeout
                                                          of 2222,that
                                                          is 20secs in
                                                          our case.<br>
                                                          In first
                                                          scenario it
                                                          generates
                                                          CANCEL on 3333
                                                          at 20 secs
                                                          instead of 25
                                                          that is 2222's
                                                          Timeout.<br>
                                                          In second
                                                          scenario it
                                                          generates
                                                          CANCEL on 3333
                                                          at 15sec and
                                                          on 4444 at 5
                                                          sec (15 + 5 =
                                                          20 sec) that
                                                          is also 2222's
                                                          timeout.<br>
                                                          <br>
                                                          <br>
                                                          Can I know the
                                                          right method
                                                          to set
                                                          $T_fr_inv_timeout
                                                          ?</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">Let me know if any other information is
                                                          needed.<br>
                                                          <br>
                                                          </p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">Thanks,</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">Ravi</p>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"><br>
                                                          <br>
                                                          </p>
                                                        </div>
                                                      </div>
                                                      <pre>______________________________<wbr>_________________</pre>
                                                      <pre>Users mailing list</pre>
                                                      <pre><a href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a></pre>
                                                      <pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a></pre>
                                                    </blockquote>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                </blockquote>
                                              </div>
                                              <p class="MsoNormal"> </p>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            Users mailing list<br>
            <a href="mailto:Users@lists.opensips.org"
              moz-do-not-send="true">Users@lists.opensips.org</a><br>
            <a
              href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>