<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Brett,<br>
    <br>
    <br>
    On 03/30/2012 09:46 PM, Brett Nemeroff wrote:
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">Hello List,<br>
      <br>
      Upon looking at the enhancements of drouting in 1.8, I'm a bit
      confused at all the new options for the gwlist fields. I found
      this snippet on the list:<br>
      <pre>&gt;&gt;&gt;&gt;     gateways :  g1, g2, g3, g4, g5
&gt;&gt;&gt;&gt;     carriers :  c1 = g1=75,g2=25  (a premium carrier), ordering based
&gt;&gt;&gt;&gt; on weight
&gt;&gt;&gt;&gt;                 c2 = g3,g4  (a standard carrier), ordering based on
&gt;&gt;&gt;&gt; given order
&gt;&gt;&gt;&gt;     rules:   prefix= 004021 ; list = #c1,#c2,g5  - first we will try do
&gt;&gt;&gt;&gt; distribute 75/25 the traffic
&gt;&gt;&gt;&gt;                   between the gws from carrier c1 and if all fail, we
&gt;&gt;&gt;&gt; will try gws from carrier c2
&gt;&gt;&gt;&gt;                   (according the ordering defined for c2), and so on
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;              prefix= 004072 ; list = #c2=50,g5=50  - all traffic will
&gt;&gt;&gt;&gt; be weight balanced between carrier
&gt;&gt;&gt;&gt;                   c2 and gw g5; of course, if carrier c2 is to be used,
&gt;&gt;&gt;&gt; the corresponding traffic will
&gt;&gt;&gt;&gt;                   routed over the c2 gateways according to its
&gt;&gt;&gt;&gt; definition
&gt;&gt;&gt;&gt;
&gt;&gt;&gt;&gt;

Which seems to indicate the new "weights" option can be used by specifying a gateway_id followed by an "=&lt;0-100&gt;" where &lt;0-100&gt; is weight.
</pre>
    </blockquote>
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.8.x/drouting.html#id249152">http://www.opensips.org/html/docs/modules/1.8.x/drouting.html#id249152</a><br>
    <br>
    I admit the doc is not fully detailed, but I plan to put down a DR
    tutorial to explain everything in all details.<br>
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">
      <pre>
I can't really find how this is documented anywhere. Also what gets picked first? 0 weight? or 100 weight?
</pre>
    </blockquote>
    weight doesn't say which is picked first - it is not a priority;
    weight tells what is the probability of that element to be select ;
    and of course, higher weight, higher chances to be select - exactly
    as with the weight in DNS records.<br>
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">
      <pre>


What if I just want it to try 1 gateway for each carrier and not roll from gateway to gateway to gateway? For
example, I'd like to see where I can do something like this in the CARRIER definition:
g1=75,g2=25

and then every time I pick that carrierid, 75% of the time g1 will get picked, and 25% of the time g2 will be 
picked. But it will never go from g1, then g2 (rather I'd like it to proceed in my script logic so I can pick

another carrier).
</pre>
    </blockquote>
    When doing weight-based selection, all the entries of a carrier will
    be used (of course, based on weight). To be honest I haven;t
    foreseen this case - IMO, I supposed that if one GW of the carrier
    is down, you will always want to try the rest of the GWs from the
    same carrier, rather than falling to another carrier.<br>
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">
      <pre>
Or does it already do that? If I don't specify weights, does it try them in serial order? 
</pre>
    </blockquote>
    yes, but this is not triggered by the lack of weights, but from the
    carrier definition (see the wright flag in the carrier;s flag) or
    the do_routing() "W" flag.<br>
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">
      <pre>

Is this documented somewhere that I'm missing? The regular module docs dont' seem to show it. 
</pre>
    </blockquote>
    Well, you need to read the entire doc in order to get the big
    picture. But if something is found to be missing, I will take care
    of&nbsp; it :)<br>
    <br>
    Regards,<br>
    Bogdan<br>
    <br>
    <blockquote
cite="mid:CAPwC5wwW4DHaVdWoUuR8CjWtJ6orCXOEXZSRtwcwgiXy3BLQrg@mail.gmail.com"
      type="cite">
      <pre>


Thanks,
-Brett

</pre>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
  </body>
</html>