Weighted Distribution

The Weighted Distribution allows to split traffic randomly between the Vendor Connections but keeping the distribution in proportion to their weights. 

Example: 

Lets assume that there are three routing group entries: 


Route 1

Weight 3

Route 2

Weight 2

Route 3

Weight 3



For every call there is a chance that any of those routes will become the most preferred. The Route 2 will be preferred route in approximately 25% of calls as well as the Route 1, and the Route 3 will be most preferred in around 37.5% of calls. 

 There is a special value of weight - 'No Value'. This allows to apply a policy after the Weighted Distribution. 

Description of Routing Policy application. 

The policies are applied in three stages. 
The policies which come before Weighted Distribution are applied first
Then the entries with defined weight and No Value weight are split into groups keeping their positions after the first stage policies have been applied. And then the Weighted Distribution is applied to each group of entries with the defined weight. Groups with No Value weight are kept untouched. 
At the third stage the groups of No Value weight are sorted according the policies which come after the Weighted Distribution. The groups of already applied Weighted Distribution are kept untouched. 

Example: 

Let's assume we have a Routing group which have the following routing policy Preference -> Weighted Distribution -> Least Cost

The entries of the routing group are: 


 RoutePreference Weight Cost 
Route 1
2No Value1
Route 23No Value2
Route 3422

Route 4

422

Route 5

532

Route 6

542

Route 7

6No Value3

Route 8

6No Value1

Route 9

7No Value2



After first stage sort on preference the order of routes will be: 





 RoutePreferenceWeight Cost 
Route 97No Value2

Route 8

6No Value1

Route 7

6No Value3
Route 5532

Route 6

542

Route 3

422

Route 4

422

Route 2

3No Value2

Route 1

2No Value1


Please note that the Routes 7 and 8 have the same preference and thus the result of the preference sort is unpredictable. This also applies to pairs (Route 5, Route 6) and (Route 3, Route 4). 

The stage two of policy application begins now. The entries are split into groups of the entries to which the Weighted Distribution can be applied and those which are not affected by the distribution: 

Group 1: The Weighted Distribution is not applicable 

 RoutePreferenceWeight Cost 
Route 97No Value2
Route 86No Value1
Route 76No Value3


Group 2: The Weighted Distribution is applicable 


RoutePreferenceWeightCost
Route 5532
Route 6542



Group 3: The Weighted Distribution is applicable 



RoutePreferenceWeightCost
Route 3422
Route 4422


Group 4: The Weighted Distribution is not applicable 



 RoutePreferenceWeightCost
Route 23No Value2
Route 12No Value1


The groups 2 and 3 are distinct groups because they have different preferences. 

Then the weighted distribution is applied to the groups 2 and 3 independently. Let's assume that the order of the routes in those groups left unchanged after the weighted distribution. 

The stage three of policy application starts. The entries in groups 1 and 4 are sorted according to their costs. The groups 2 and 3 are kept unchanged. 


So the final routes order will be: 





RoutePreferenceWeightCost

Route 8

6No Value1

Route 9

7No Value2

Route 7

6No Value3

Route 5

532

Route 6

542

Route 3

422

Route 4

422

Route 1

2No Value1

Route 2

3No Value2



Note!  It's dangerous to use the same preference for No Value routes and routes with a weight because the sort on an equal values can distribute the entries randomly giving unwanted side effects. A rule of thumb is to create groups of No Value routes and routes with a weight by using a policy before the Weighted Distribution.