<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi, Ravi!<br>
    <br>
    What do you mean "main route"? - the main route should be called
    only once, when the INVITE comes from 1111. Are you looping the
    message back to you?<br>
    <br>
    PS: your message was detected to be too large - when you receive
    back errors related to this, please revise them and then send the
    message in a reasonable format.<br>
    <br>
    Best regards,<br>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 08/22/2017 05:15 PM, Ravi Patel
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEh7C87wN4Rh1OBaxL-=a2t7LHwMZXibAQYtORCtz267iUhJ_Q@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>Dear Bogdan,<br>
            <br>
            Apologize for the late reply.<br>
            <br>
            I was checking my logic and your suggestions in lab.<br>
            <br>
            Finally what my observation is,<br>
            1)<br>
            I set an avp variable in main route. say for example:
            $avp(test)=0<br>
            <br>
            that I found it in failure_route and I am incrementing it by
            1 and call forwarded to OpenSIPS again.<br>
            Now in main route I am not able to get that variable, but
            yes when call went again to failure_route on failure case ,
            I got its value 1 and able to increment it by 1.<br>
            <br>
            <br>
            2)<br>
            Second thing I found is:<br>
            <br>
            Say for example my call scenarios is: <br>
            1111 --> 2222 --Forward on No Answer--> 3333
            --Foraward on No Answer--> 4444<br>
            <br>
            -----------------------<br>
            <br>
            1111 -> 2222 : 2222 did not answer.<br>
            in Failure_route, I set append_hf("test: 1\r\n"); and call
            forwarded to OpenSIPS again with $rU=3333.<br>
            <br>
            2222 -> 3333 :<br>
            In Main Route I am able to get its value.<br>
            ***** Now I use remove_hf("test"); before forwarding call to
            3333.<br>
            3333 did not pick up the call.<br>
            call lands on  failure_route.<br>
            in Failure_route, I set append_hf("test: 2\r\n"); and call
            forwarded to OpenSIPS again with $rU=4444.<br>
            <br>
            3333 -> 4444 :<br>
            In Main Route when I fetch $hdr(test), I got the value 1
            instead of 2. When I check its SIP trace, I found two
            headers with name "test" with values 1 and 2.<br>
            <br>
            ------------------<br>
            <br>
            So, remove_hf at ***** removes it from the OutBound SIP
            packet, but it is not removed at failure_route.<br>
            <br>
            <br>
            I hope I explained well(It is a bit complex).<br>
            <br>
            Let me know if you need anything else to debug it.<br>
            <br>
          </div>
          Regards,<br>
        </div>
        Ravi Patel<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Aug 2, 2017 at 7:23 PM,
          Bogdan-Andrei Iancu <span dir="ltr"><<a
              href="mailto:bogdan@opensips.org" target="_blank"
              moz-do-not-send="true">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 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><span class="">
                <pre class="m_-5762453927518166684moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="m_-5762453927518166684moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">http://www.opensips-solutions.<wbr>com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="m_-5762453927518166684moz-txt-link-freetext" 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>
              </span>
              <div>
                <div class="h5">
                  <div class="m_-5762453927518166684moz-cite-prefix">On
                    08/02/2017 11:46 AM, Ravi Patel wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <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_-5762453927518166684m_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><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="m_-5762453927518166684h5">
                                                      <p
                                                        class="MsoNormal"
style="margin-bottom:12.0pt">I am Grateful for your reply.</p>
                                                    </div>
                                                  </div>
                                                </div>
                                                <div>
                                                  <div
                                                    class="m_-5762453927518166684h5">
                                                    <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="m_-5762453927518166684h5">
                                                  <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="m_-5762453927518166684h5">
                                                <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="m_-5762453927518166684h5">
                                              <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="m_-5762453927518166684h5">
                                            <p class="MsoNormal"
                                              style="margin-bottom:12.0pt">Also
                                              find the attached
                                              snapshots of the call
                                              flow. </p>
                                          </div>
                                        </div>
                                      </div>
                                      <div>
                                        <div
                                          class="m_-5762453927518166684h5">
                                          <p class="MsoNormal">Please
                                            guide what can be done or
                                            where I am doing wrong ? </p>
                                        </div>
                                      </div>
                                    </div>
                                    <div>
                                      <div
                                        class="m_-5762453927518166684h5">
                                        <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="m_-5762453927518166684h5">
                                    <p class="MsoNormal">Ravi Patel<br>
                                    </p>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>