<p>The dispatcher table has a weight column that is not currently used by the round-robin algorithm.</p>

<p>I think this would be useful to have as currently the only way to do, for example, a 2:1 ratio of traffic between gateways with dispatcher in round-robin is to enter one of the gateways into the table twice. While this works for a small number of gateways its does not scale well and becomes cumbersome to manage with a large number of gateways. I also think it offers a good, simple alternative to the hashing methods for weighted call distribution.</p>

<p>Proposed behavior:<br>
When selecting a new destination set  (ds_select_<em>) the weight should multiply the number of times a gateway will be selected and chosen as the first destination. However each gateway, regardless of weight should only be tried once in event of a fail-over. So, ds_next_</em> should immediately skip to the next unique gateway, regardless of weight.</p>

<p>Example:<br>
gw1 - weight of 2<br>
gw2 - weight of 2<br>
gw3 - weight of 1</p>

<p>For the first two calls to ds_select_* gw1 would be selected as the initial gateway, with the fail-over set for ds_next_* being gw2 and gw3 with each only appearing once. The next two calls to ds_select_* would select gw2, with a fail-over set of gw3 and gw1. The fifth call to ds_select_* would select gw3 with a fail-over of gw1 and gw2. Finally the sixth call to ds_select_* would wrap back around to gw1.</p>

<p>Thank you for your time.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/508">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciba85OJQ6PCfdFPFIM7sjX1zKFctks5oIlzBgaJpZM4EYWWK.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/508"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>