[OpenSIPS-Users] Question about qrouting module

Liviu Chircu liviu at opensips.org
Thu Feb 27 15:43:01 EST 2020


On 27.02.2020 17:26, Abdoul Osséni wrote:
> I want to test qrouting module.
> Do you have some qrouting configs examples?
> Regards
>
Hey, Abdoul!

It's quite an "out-of-the-box" solution, you'd be surprised. Here are 
some provisioning tips:

* provision any qrouting profiles you want to play with in the 
"qr_profiles" table [1]
* in dr_rules, make sure to set the "sort_alg" column to 'Q' in order to 
enable qrouting for each rule
* in dr_rules, for each 'Q'-enabled rule, set the "sort_profile" to your 
desired profile "id" taken from the "qr_profiles" table

 From here on, it's just a matter of loading up the modules and setting 
up the "db_url" modparams.  The modules will complain if something is 
missing and tell you what to load anyway! :)

Regarding the script: nothing changes.  Just call do_routing() [2] as 
usual, and it will both collect stats and sort the destinations based on 
quality.  If you want to integrate with custom stats, check out the 
module docs [3], there is plenty of help.  Below is the module 
configuration -- everything else is just drouting!

Best regards,

[1]: 
https://github.com/OpenSIPS/opensips/blob/master/scripts/mysql/qrouting-create.sql

[2]: https://opensips.org/docs/modules/3.1.x/drouting.html#func_do_routing

[3]: https://opensips.org/docs/modules/3.1.x/qrouting.html

--- qrouting.cfg

loadmodule "db_mysql.so"

loadmodule "drouting.so"
modparam("drouting", "use_partitions", 1)
modparam("drouting", "rule_id_avp", "$avp(ruleid)")
modparam("drouting", "gw_id_avp", "$avp(gwid)")
modparam("drouting", "db_partitions_url", 
"mysql://root:xxxxxxxxxx@10.0.0.10/opensips")

loadmodule "qrouting.so"
modparam("qrouting", "algorithm", "dynamic-weights")
modparam("qrouting", "history_span", 30)
modparam("qrouting", "extra_stats", "+mos/1; +r_factor/1")

# for fast testing
modparam("qrouting", "min_samples_asr", 0)
modparam("qrouting", "min_samples_ccr", 0)
modparam("qrouting", "min_samples_pdd", 0)
modparam("qrouting", "min_samples_ast", 0)
modparam("qrouting", "min_samples_acd", 0)
modparam("qrouting", "decimal_digits", 3)

modparam("qrouting", "db_url", "mysql://root:xxxxxxxxxx@10.0.0.10/opensips")

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

OpenSIPS Summit, Amsterdam, May 2020
   www.opensips.org/events
OpenSIPS Bootcamp, Miami, March 2020
   www.opensips.org/training

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200227/1a951ab3/attachment.html>


More information about the Users mailing list