<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 27.02.2020 17:26, Abdoul Osséni
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABc7nxtLq2o2UQFATnxqYAMmWt0W-Qt8d8_BodUVRKUCF7iQRQ@mail.gmail.com">I
      want to test qrouting module.<br>
      Do you have some qrouting configs examples?<br>
      Regards<br>
      <div>
        <div dir="ltr" class="gmail_signature"
          data-smartmail="gmail_signature">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div><span style="font-size:12.8px"><br>
                  </span></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><tt>Hey, Abdoul!<br>
      </tt></p>
    <p><tt>It's quite an "out-of-the-box" solution, you'd be surprised. 
        Here are some provisioning tips:<br>
      </tt></p>
    <p><tt>* provision any qrouting profiles you want to play with in
        the "qr_profiles" table [1]<br>
        * in dr_rules, make sure to set the "sort_alg" column to 'Q' in
        order to enable qrouting for each rule<br>
        * in dr_rules, for each 'Q'-enabled rule, set the "sort_profile"
        to your desired profile "id" taken from the "qr_profiles" table<br>
      </tt></p>
    <p><tt>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! :)</tt></p>
    <p><tt>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!<br>
      </tt></p>
    <p><tt>Best regards,</tt></p>
    <p><tt>[1]: </tt><tt><a
href="https://github.com/OpenSIPS/opensips/blob/master/scripts/mysql/qrouting-create.sql">https://github.com/OpenSIPS/opensips/blob/master/scripts/mysql/qrouting-create.sql</a></tt></p>
    <p><tt>[2]: </tt><tt><a
href="https://opensips.org/docs/modules/3.1.x/drouting.html#func_do_routing">https://opensips.org/docs/modules/3.1.x/drouting.html#func_do_routing</a></tt></p>
    <p><tt>[3]: </tt><tt><a
          href="https://opensips.org/docs/modules/3.1.x/qrouting.html">https://opensips.org/docs/modules/3.1.x/qrouting.html</a></tt></p>
    <p><tt>--- qrouting.cfg<br>
      </tt></p>
    <p><tt>loadmodule "db_mysql.so"<br>
        <br>
        loadmodule "drouting.so"<br>
        modparam("drouting", "use_partitions", 1)<br>
        modparam("drouting", "rule_id_avp", "$avp(ruleid)")<br>
        modparam("drouting", "gw_id_avp", "$avp(gwid)")<br>
        modparam("drouting", "db_partitions_url",
        <a class="moz-txt-link-rfc2396E" href="mailto:mysql://root:xxxxxxxxxx@10.0.0.10/opensips">"mysql://root:xxxxxxxxxx@10.0.0.10/opensips"</a>)<br>
        <br>
        loadmodule "qrouting.so"<br>
        modparam("qrouting", "algorithm", "dynamic-weights")<br>
        modparam("qrouting", "history_span", 30)<br>
        modparam("qrouting", "extra_stats", "+mos/1; +r_factor/1")<br>
        <br>
        # for fast testing<br>
        modparam("qrouting", "min_samples_asr", 0)<br>
        modparam("qrouting", "min_samples_ccr", 0)<br>
        modparam("qrouting", "min_samples_pdd", 0)<br>
        modparam("qrouting", "min_samples_ast", 0)<br>
        modparam("qrouting", "min_samples_acd", 0)<br>
        modparam("qrouting", "decimal_digits", 3)<br>
        <br>
        modparam("qrouting", "db_url",
        <a class="moz-txt-link-rfc2396E" href="mailto:mysql://root:xxxxxxxxxx@10.0.0.10/opensips">"mysql://root:xxxxxxxxxx@10.0.0.10/opensips"</a>)<br>
        <br>
      </tt></p>
    <pre class="moz-signature" cols="72">-- 
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a>

OpenSIPS Summit, Amsterdam, May 2020
  <a class="moz-txt-link-abbreviated" href="http://www.opensips.org/events">www.opensips.org/events</a>
OpenSIPS Bootcamp, Miami, March 2020
  <a class="moz-txt-link-abbreviated" href="http://www.opensips.org/training">www.opensips.org/training</a></pre>
  </body>
</html>