Guys,
We've developed a module called lcr_rate.so, which acts on top of the existing lcr.so module and performs real cost-based least cost routing. It's quite Sipwise specific, so I wanted to ask whether there is any interest in - or it makes sense to - pushing it to upstream.
The module is really simple from its functionality point of view. You call load_gws() as usual from the existing lcr.so module, and the lcr_rate.so module takes the resulting AVP and reorders the entries based on the cost per gateway:
loadmodule "lcr.so" modparam("lcr", "gw_uri_avp", "$avp(s:lcr_uri_list)") loadmodule "lcr_rate.so" modparam("lcr_rate", "gw_uri_avp", "$avp(s:lcr_uri_list)")
load_gws(...); lcr_rate("$rU", "$rd"); while(...) { next_gw(); ... }
The actual cost per destination is calculated using libswrate, which we will publish as GPL along with the module.
However, the whole inner workings are specific to our sip:provider CE/PRO platforms though, which means we are using the lcr_gw.flags column to store the gateway id from another table, which maps to gateway groups, which in turn reference to a billing profile id where the actual fees per destination are attached to. So to get any practical use out of this, you'd need to use the Sipwise provisioning and billing databases, or adapt your backend to reflect that.
A way out of this lock-in would be to use diameter or radius to get the actual cost for a call, as this might be a standardized interface to do so (IMS?), but we currently don't use that. However, the module could later be modified to take advantage of that, once a diameter client is available in the main branch.
If you say it doesn't make any sense at all (which might be likely), we're going to provide the source on our github page for people interested in it.
Any comments/opinions? Andreas