<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi,<br>
      <br>
      As Alex said, in failure_route (for calls via dispatcher) test for
      a 3xx reply and if the case simply set a new RURI (as you normally
      do when routing requests) and do t_relay() again - by sending the
      call out to a new destination, the received 3xx will be
      automatically discarded.<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 09/07/2017 08:34 PM, Blagovest
      Buyukliev wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:C41F82B1-37A7-4A86-AE99-9F719E0D86E6@voipfone.co.uk">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div class="">The onreply_route is never armed, but gets executed.</div>
      <div class=""><br class="">
      </div>
      <div class="">The failure_route[initial_request] is armed via
        t_on_failure("initial_request") and actually gets executed after
        the onreply_route (as per my last test).</div>
      <div class="">
        <div class="">
          <div style="font: 8pt arial,sans-serif; color: #888; width:
            680px" class=""> </div>
        </div>
      </div>
      <div class=""><br class="">
      </div>
      <div class="">Can we stop the propagation of the 302 from within
        failure_route, or is it considered already sent after the
        execution of onreply_route?</div>
      <br class="">
      <div>
        <blockquote type="cite" class="">
          <div class="">On Sep 7, 2017, at 8:12 PM, Alex Balashov <<a
              href="mailto:abalashov@evaristesys.com" class=""
              moz-do-not-send="true">abalashov@evaristesys.com</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <div class="">Don't arm the onreply_route. Doesn't the
              failure_route get called?<br class="">
              <br class="">
              On September 7, 2017 1:08:55 PM EDT, Blagovest Buyukliev
              <<a href="mailto:blagovest@voipfone.co.uk" class=""
                moz-do-not-send="true">blagovest@voipfone.co.uk</a>>
              wrote:<br class="">
              <blockquote type="cite" class="">Which functions need to
                be used for that?<br class="">
                <br class="">
                The current routing logic is roughly what's listed below
                and the<br class="">
                problematic issues are commented.<br class="">
                <br class="">
                How can it be modified to accomplish what you've
                described?<br class="">
                <br class="">
                route {<br class="">
                  ...<br class="">
                  loose_route();<br class="">
                  record_route();<br class="">
                  t_on_failure("initial_request");<br class="">
                  t_relay();<br class="">
                <br class="">
                  # We are okay here, the initial INVITE is passed to a
                local server.<br class="">
                }<br class="">
                <br class="">
                onreply_route {<br class="">
                  if ($rs == 302) {<br class="">
                # The 302 is caught here, but we are pretty much
                handicapped to do<br class="">
                anything in this block.<br class="">
                # The response is passed back to the external network,
                which is<br class="">
                undesired.<br class="">
                  }<br class="">
                }<br class="">
                <br class="">
                failure_route[initial_request] {<br class="">
                # How can we arrive here right upon the receipt of the
                302, not in<br class="">
                onreply_route?<br class="">
                }<br class="">
                <br class="">
                <blockquote type="cite" class="">On Sep 5, 2017, at 4:54
                  PM, Alex Balashov <<a
                    href="mailto:abalashov@evaristesys.com" class=""
                    moz-do-not-send="true">abalashov@evaristesys.com</a>><br
                    class="">
                </blockquote>
                wrote:<br class="">
                <blockquote type="cite" class=""><br class="">
                  Yes, failure_route is the answer to all your
                  objectives here. You can<br class="">
                  intercept the 302, extract what you want from it,
                  create a new branch<br class="">
                  and fork the call elsewhere.<br class="">
                  <br class="">
                  -- <br class="">
                  Alex Balashov | Principal | Evariste Systems LLC<br
                    class="">
                  <br class="">
                  Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) <br
                    class="">
                  Web: <a href="http://www.evaristesys.com/" class=""
                    moz-do-not-send="true">http://www.evaristesys.com/</a>,
                  <a href="http://www.csrpswitch.com/" class=""
                    moz-do-not-send="true">http://www.csrpswitch.com/</a><br
                    class="">
                  <br class="">
                  _______________________________________________<br
                    class="">
                  Users mailing list<br class="">
                  <a href="mailto:Users@lists.opensips.org" class=""
                    moz-do-not-send="true">Users@lists.opensips.org</a><br
                    class="">
<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><br class="">
                </blockquote>
              </blockquote>
              <br class="">
              -- Alex<br class="">
              <br class="">
              --<br class="">
              Sent via mobile, please forgive typos and brevity. <br
                class="">
              <br class="">
              _______________________________________________<br
                class="">
              Users mailing list<br class="">
              <a href="mailto:Users@lists.opensips.org" class=""
                moz-do-not-send="true">Users@lists.opensips.org</a><br
                class="">
              <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><br
                class="">
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <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>