#9 carrier flags within dynamic routing are calculated faulty

v1.0_(example)
closed-fixed
nobody
None
5
2014-07-02
2012-10-23
Marco Hierl
No

The carrier flags within dynamic routing in opensips_cp 5.0 are calculated in a faulty manner and can lead to disabling carriers when applying any change.

In opensips 1.8 "Dynamic Routing Module" Doc we'll find: 1.1.4.2. Carriers - 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

But when changing the "Use weights" in the opensips cp this will end up increasing/decreasing the flags value in the dr_carrier table by 4. Changing the "Enabled" option in the opensips cp this will inrease/decrease the flags value by 1. So this is vice versa to what opensips expects.

As a workaround I did the following:
in /web/tools/system/drouting/carriers.php
change $flags = bindec($useweights.$useonlyfirst.$enabled);
to $flags = bindec($enabled.$useonlyfirst.$useweights);
and in /web/tools/system/drouting/lib/carriers.functions.inc.php
change return ltrim($rtnval[$retbit]);
to return ltrim($rtnval[$numbits+1-$retbit]);

finally the header "enabled" will not fit to the flags value in the dr_table. I just change the header to "disabled"
in /web/tools/system/drouting/template/carriers.main.php
change <td class="dataTitle">Enabled</td>
to <td class="dataTitle">Disabled</td>

Discussion

  • Alex Ionescu
    Alex Ionescu
    2014-07-02

    This is an old bug - it has been fixed but not closed. Closing now.

     
  • Alex Ionescu
    Alex Ionescu
    2014-07-02

    • status: open --> closed-fixed
    • Group: --> v1.0_(example)