[OpenSIPS-Users] Drouting failover by carrier only
    Alex A 
    alex.a at gtanetworkconsulting.com
       
    Wed Apr 29 18:38:42 EST 2020
    
    
  
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200429/d85fc6c2/attachment.html>
    
    
More information about the Users
mailing list