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: 


 Route Preference  Weight  Cost 
Route 1
2 No Value 1
Route 2 3 No Value 2
Route 3 4 2 2

Route 4

4 2 2

Route 5

5 3 2

Route 6

5 4 2

Route 7

6 No Value 3

Route 8

6 No Value 1

Route 9

7 No Value 2



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



 Route Preference Weight  Cost 
Route 9 7 No Value 2

Route 8

6 No Value 1

Route 7

6 No Value 3
Route 5 5 3 2

Route 6

5 4 2

Route 3

4 2 2

Route 4

4 2 2

Route 2

3 No Value 2

Route 1

2 No Value 1



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

 Route Preference Weight  Cost 
Route 9 7 No Value 2
Route 8 6 No Value 1
Route 7 6 No Value 3


Group 2: The Weighted Distribution is applicable 


Route Preference Weight Cost
Route 5 5 3 2
Route 6 5 4 2



Group 3: The Weighted Distribution is applicable

Route Preference Weight Cost
Route 3 4 2 2
Route 4 4 2 2



Group 4: The Weighted Distribution is not applicable

 Route Preference Weight Cost
Route 2 3 No Value 2
Route 1 2 No Value 1



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:



Route Preference Weight Cost

Route 8

6 No Value 1

Route 9

7 No Value 2

Route 7

6 No Value 3

Route 5

5 3 2

Route 6

5 4 2

Route 3

4 2 2

Route 4

4 2 2

Route 1

2 No Value 1

Route 2

3 No Value 2



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.