[OpenSIPS-Users] Drouting failover by carrier only

Johan De Clercq Johan at democon.be
Thu Apr 30 13:55:25 EST 2020


Can you please send your routing rules. Mine don't work in 3.0.2. Although
they were good in 3.0

On Thu, 30 Apr 2020, 15:31 Alex A, <alex.a at gtanetworkconsulting.com> wrote:

> 3.0.2
> On Apr 30, 2020, at 9:12 AM, Johan De Clercq <johan at democon.be> wrote:
>>
>> on what version is this ?
>>
>> Op do 30 apr. 2020 om 15:09 schreef Alex A <
>> alex.a at gtanetworkconsulting.com>:
>>
>>> Setting the "First Only" flag on the carrier seem to be done the trick
>>> for me.
>>> It round-robins, while failing over to another carrier directly.
>>>
>>>
>>> Thank you for your help.
>>>
>>>
>>>
>>>
>>> ---- On Thu, 30 Apr 2020 07:12:04 -0400 *Alex A
>>> <alex.a at gtanetworkconsulting.com <alex.a at gtanetworkconsulting.com>>*
>>> wrote ----
>>>
>>> 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
>>> <Ben.Newlin at genesys.com <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 <users-bounces at lists.opensips.org> on behalf of Alex A <
>>> alex.a at gtanetworkconsulting.com>
>>> *Reply-To: *OpenSIPS users mailling list <users at lists.opensips.org>
>>> *Date: *Wednesday, April 29, 2020 at 2:40 PM
>>> *To: *users <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
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>> ------------------------------
>>
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
> Users mailing list
> 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/0620b4bc/attachment-0001.html>


More information about the Users mailing list