Hi Alex,

Have you tried the "use only the first GW" flag in the carrier definition? See https://opensips.org/html/docs/modules/3.0.x/drouting.html#idp25339408, "Carriers" subsection:

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

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com

On 4/29/20 9:38 PM, Alex A wrote:
Hi Everyone,

Is it possible to failover to next carrier (instead next gateway) while using drouting?


I got the below to work; however currently, use_next_gw gets the next gateway in the list, so
if gwlist= #0,#3

and one of the carriers has multiple gateway IPs, the retry happens many times to the same carrier:


route[droute] {

        xlog("DRoute GATEWAY: source:$si - $fU -> $rU\n");
        if (!do_routing(0,"F")) {
                xlog("DRoute GATEWAY: Failed. source:$si -$fU -> $rU\n");
                send_reply(500, "No Gateway to Route found");
                exit;
        }
        route(relay);
        exit;

        }

route[relay] {

        if (is_method("INVITE")) {
                t_on_failure("missed_call");
        }

        if (!t_relay()) {
                if (use_next_gw()) {
                      xlog("L_INFO","Next Gateway: From=$fu, To=$tu,RU=$ru, CI=$ci IP=$si\n");
                      t_on_failure("missed_call");
                      route(relay);
                      exit;
                }
                else {
                        send_reply(503, "Service not available, no more gws");
                        exit;
                }
        };
        exit;
}


failure_route[missed_call] {

                #if (use_next_gw(, , $var(carrier_attrs))) {
                if (use_next_gw(, $avp(gw_id),$avp(carrier_id))) {
                      xlog("MissedCall--Next Gateway: From=$fu, To=$tu,RU=$ru, CI=$ci IP=$si\n");                       xlog("Carrier attributes of current gateway: $avp(gw_id). carrier: $avp(carrier_id)\n");

                      t_on_failure("missed_call");
                      route(relay);
                      exit;
                }
                else {
                        send_reply(503, "Service not available, no more gws");
                        exit;
                }




Thank you.





_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to