<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Alex,<br>
      <br>
      Have you tried the "use only the first GW" flag in the carrier
      definition? See
      <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.0.x/drouting.html#idp25339408">https://opensips.org/html/docs/modules/3.0.x/drouting.html#idp25339408</a>,
      "Carriers" subsection:<br>
      <br>
    </tt><tt>flags : 0x1 - use weight for sorting the list and not
      definition order; 0x2 - use only the first gateway from the
      carrier (depending on the sorting); 0x4 - disable the usage of
      this carrier<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="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>

</pre>
    <div class="moz-cite-prefix">On 4/29/20 9:38 PM, Alex A wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:171c73bdfcf.f647ce1b105300.4293922564087136871@gtanetworkconsulting.com">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div style="font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 10pt;">
        <div>Hi Everyone,<br>
        </div>
        <div><br>
        </div>
        <div>Is it possible to failover to next carrier (instead next
          gateway) while using drouting? <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I got the below to work; however currently, use_next_gw
          gets the next gateway in the list, so <br>
        </div>
        <div>if gwlist= #0,#3  <br>
        </div>
        <div><br>
        </div>
        <div>and one of the carriers has multiple gateway IPs, the retry
          happens many times to the same carrier: <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>route[droute] {<br>
          </div>
          <div><br>
          </div>
          <div>        xlog("DRoute GATEWAY: source:$si - $fU ->
            $rU\n");<br>
          </div>
          <div>        if (!do_routing(0,"F")) {<br>
          </div>
          <div>                xlog("DRoute GATEWAY: Failed. source:$si
            -$fU -> $rU\n");<br>
          </div>
          <div>                send_reply(500, "No Gateway to Route
            found");<br>
          </div>
          <div>                exit;<br>
          </div>
          <div>        }<br>
          </div>
          <div>        route(relay);<br>
          </div>
          <div>        exit;<br>
          </div>
          <div><br>
          </div>
          <div>        }<br>
          </div>
          <div><br>
          </div>
        </div>
        <div>route[relay] {<br>
        </div>
        <div><br>
        </div>
        <div>        if (is_method("INVITE")) {<br>
        </div>
        <div>                t_on_failure("missed_call");<br>
        </div>
        <div>        }<br>
        </div>
        <div><br>
        </div>
        <div>        if (!t_relay()) {<br>
        </div>
        <div>                if (use_next_gw()) {<br>
        </div>
        <div>                      xlog("L_INFO","Next Gateway:
          From=$fu, To=$tu,RU=$ru, CI=$ci IP=$si\n");<br>
        </div>
        <div>                      t_on_failure("missed_call");<br>
        </div>
        <div>                      route(relay);<br>
        </div>
        <div>                      exit;<br>
        </div>
        <div>                }<br>
        </div>
        <div>                else {<br>
        </div>
        <div>                        send_reply(503, "Service not
          available, no more gws");<br>
        </div>
        <div>                        exit;<br>
        </div>
        <div>                }<br>
        </div>
        <div>        };<br>
        </div>
        <div>        exit;<br>
        </div>
        <div>}<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>failure_route[missed_call] {<br>
        </div>
        <div><br>
        </div>
        <div>                #if (use_next_gw(, , $var(carrier_attrs)))
          {<br>
        </div>
        <div>                if (use_next_gw(,
          $avp(gw_id),$avp(carrier_id))) {<br>
        </div>
        <div>                      xlog("MissedCall--Next Gateway:
          From=$fu, To=$tu,RU=$ru, CI=$ci IP=$si\n");<br>
        </div>
        <div>                      xlog("Carrier attributes of current
          gateway: $avp(gw_id). carrier: $avp(carrier_id)\n");<br>
        </div>
        <div><br>
        </div>
        <div>                      t_on_failure("missed_call");<br>
        </div>
        <div>                      route(relay);<br>
        </div>
        <div>                      exit;<br>
        </div>
        <div>                }<br>
        </div>
        <div>                else {<br>
        </div>
        <div>                        send_reply(503, "Service not
          available, no more gws");<br>
        </div>
        <div>                        exit;<br>
        </div>
        <div>                }<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Thank you.<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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>