[OpenSIPS-Users] Drouting failover by carrier only
Alex A
alex.a at gtanetworkconsulting.com
Thu Apr 30 11:12:04 EST 2020
Thank you for the tip, Ben.
Do you by chance have a script snipped for this scenario?
For some reason, the drouting part:
if (!do_routing(0,"F")) {
xlog("DRoute GATEWAY: Failed. source:$si -$fU -> $rU\n");
send_reply(500, "No Gateway to Route found");
exit;
}
xlog("Before Entering Relay\n CarrierID_avp: $avp(carrier_id), GW ID avp: $avp(gw_id)");
route(relay);
Both AVPs return a single value instead of the a list for me, so I must be missing something.
Thanks.
---- On Wed, 29 Apr 2020 14:50:38 -0400 Ben Newlin <mailto:Ben.Newlin at genesys.com> wrote ----
We also had a need to do this and did not find a way to do it via drouting directly, but it will work with drouting with a little help.
First, we specify the carrier_id_avp param [1]. After we call do_routing, we copy out the carrier IDs from that avp into our own AVP. Then we use route_to_carrier [2] for each carrier ID in the list. To continue routing within the carrier,
you can still do use_next_gw. When that returns false (no more gateways), or if you want to skip to the next carrier you just call route_to_carrier again with the next ID in your list.
This solved two problem for us:
* allows us to fail over by carrier instead of just by gateway
* allows us to call do_routing multiple times for a call with different groups and aggregate the results
[1] - https://opensips.org/docs/modules/3.0.x/drouting.html#param_carrier_id_avp
[2] - https://opensips.org/docs/modules/3.0.x/drouting.html#func_route_to_carrier
Ben Newlin
From: Users <mailto:users-bounces at lists.opensips.org> on behalf of Alex A <mailto:alex.a at gtanetworkconsulting.com>
Reply-To: OpenSIPS users mailling list <mailto:users at lists.opensips.org>
Date: Wednesday, April 29, 2020 at 2:40 PM
To: users <mailto:users at lists.opensips.org>
Subject: [OpenSIPS-Users] Drouting failover by carrier only
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
mailto:Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200430/08a518f1/attachment-0001.html>
More information about the Users
mailing list