Difference between revisions of "M4 Quality Routing"
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Quality Routing allows | Quality Routing allows ordering Terminators by quality. This is a very flexible way of routing because quality is determined by mathematical formulas that contain various parameters. | ||
These parameters are used to calculate the Quality Index by which Terminators are ordered in a Dial Peer. | |||
Quality is calculated for Dial Peer - Terminator pair that means single Terminator can have different Quality Index values in different Dial Peers.<be> | |||
=Enabling Quality Routing in core module= | |||
By default, Quality Routing is disabled in the core module which is responsible for routing all calls. To enable Quality Routing, please use these commands: | |||
In a server where Radiusd service is located, in file /etc/m2/system.conf change disable_advanced_routing value from 0 to 1 | |||
disable_advanced_routing=0 | |||
After the value has been changed, reload the settings: | |||
m2 reload | |||
More information about core settings can be found [[System.conf|here]]. | |||
<br><br> | <br><br> | ||
Line 8: | Line 23: | ||
[[File:Quality routing list.png]] | [[File:Quality routing list.png]] | ||
In the Quality Routing list you can see how many Originators have a specific Quality Routing Rule assigned to them in a '''USED''' column. Routing Rules can be assigned in Originator settings.<br> | In the Quality Routing list, you can see how many Originators have a specific Quality Routing Rule assigned to them in a '''USED''' column. Routing Rules can be assigned in Originator settings.<br> | ||
Press '''ADD NEW''' and you will be redirected to a page where you will be able to define your own Quality Routing Rules.<br><br> | Press '''ADD NEW''' and you will be redirected to a page where you will be able to define your own Quality Routing Rules.<br><br> | ||
Line 16: | Line 31: | ||
'''General'''<br> | '''General'''<br> | ||
* '''Name''' - name for your Quality Routing Rule | * '''Name''' - name for your Quality Routing Rule | ||
* '''Quality''' Index Formula - formula by which [http://wiki.kolmisoft.com/index.php/ | * '''Quality''' Index Formula - formula by which [http://wiki.kolmisoft.com/index.php/M4_Quality_Routing#Quality_Index Quality Index] is calculated (if the entered formula is incorrect input borders will turn red) <br><br> | ||
[[File:Quality routing edit parameters.png]] | [[File:Quality routing edit parameters.png]] | ||
Line 22: | Line 37: | ||
'''Quality Index Parameters'''<br> | '''Quality Index Parameters'''<br> | ||
Quality Index Parameter value represents | The Quality Index Parameter value represents how many last Calls each Parameter is calculated. The lower amount of last Calls used in Quality Index Parameters will result in a faster response to Quality Index change but it will be less accurate. A higher amount of last Calls used in Quality Index Parameters will result in a more accurate Quality Index but it will change slower. Currently, each Quality Index Parameter can be calculated for maximum of 200 last Calls.<br><br> | ||
[[File:Quality routing edit info.png]] | [[File:Quality routing edit info.png]] | ||
Line 33: | Line 48: | ||
=Quality Index= | =Quality Index= | ||
Quality Index is an evaluation of Quality Index Formula that is calculated for each Dial Peer - Terminator pair. When Quality Routing Algorithm is in use Terminators are ordered by Quality Index in a Dial Peer. | Quality Index is an evaluation of the Quality Index Formula that is calculated for each Dial Peer - Terminator pair. When Quality Routing Algorithm is in use Terminators are ordered by Quality Index in a Dial Peer. | ||
To calculate Quality Index, these Parameters can be used:<br> | To calculate Quality Index, these Parameters can be used:<br> | ||
* '''TOTAL_CALLS''' - number of total Calls | * '''TOTAL_CALLS''' - number of total Calls | ||
* '''TOTAL_ANSWERED''' - number of answered Calls | * '''TOTAL_ANSWERED''' - number of answered Calls | ||
* '''TOTAL_FAILED''' - number of failed Calls (read [http://wiki.kolmisoft.com/index.php?title= | * '''TOTAL_FAILED''' - number of failed Calls (read [http://wiki.kolmisoft.com/index.php?title=M4_Quality_Routing#Failed_Calls section] about failed Calls) | ||
* '''TOTAL_BILLSEC''' - total Call duration (in seconds) | * '''TOTAL_BILLSEC''' - total Call duration (in seconds) | ||
* '''ASR''' - answer seizure ratio (%) | * '''ASR''' - answer seizure ratio (%) | ||
Line 56: | Line 71: | ||
''This formula is just an example to show how formulas are written and is not intended to be used in production for Quality Routing.''<br> | ''This formula is just an example to show how formulas are written and is not intended to be used in production for Quality Routing.''<br> | ||
For each Quality Index Parameter you can set a specific amount of last Calls used in the calculation. For example if you set 50 Calls for ASR then the last 50 Calls made through a Dial Peer - Terminator pair will be used to calculate ASR. | For each Quality Index Parameter, you can set a specific amount of last Calls used in the calculation. For example, if you set 50 Calls for ASR then the last 50 Calls made through a Dial Peer - Terminator pair will be used to calculate ASR. The lower amount of last Calls used in Quality Index Parameters will result in a faster response to Quality Index change but it will be less accurate. A higher amount of last Calls used in Quality Index Parameters will result in a more accurate Quality Index but it will change slower. Currently, each Quality Index Parameter can be calculated for a maximum of 200 last Calls. | ||
<br><br> | |||
=Quality Routing Stats= | =Quality Routing Stats= | ||
Quality Routing Stats page allows to check current quality statistics for | The Quality Routing Stats page allows you to check current quality statistics for selected Dial Peer. You can select specific Quality Formula and it will be applied to a Dial Peer. The quality Routing Statistics table can be ordered by Quality Index so that you could know which Terminators will be dialed first. | ||
[[File:M2_Quality_Routing_Stats.png]] | [[File:M2_Quality_Routing_Stats.png]] | ||
Note that if your formula contains a PRICE variable, you will be asked to enter a Destination number in a Destination input field. This number will be used to calculate the PRICE variable. Terminator’s rate will be assigned to the PRICE variable. If the Rate is not found or the Destination number is not entered, PRICE variable will have a value of 0.<br> | Note that if your formula contains a PRICE variable, you will be asked to enter a Destination number in a Destination input field. This number will be used to calculate the PRICE variable. Terminator’s rate will be assigned to the PRICE variable. If the Rate is not found or the Destination number is not entered, the PRICE variable will have a value of 0.<br> | ||
This page is useful if you just want to know quality statistics in a Dial Peer or if you want to experiment with different Quality Routing formulas. You can even check Quality Routing formulas that are not assigned to any Originator.<br> | This page is useful if you just want to know quality statistics in a Dial Peer or if you want to experiment with different Quality Routing formulas. You can even check Quality Routing formulas that are not assigned to any Originator.<br> | ||
Another way to test your Quality Routing formulas is to create a test Originator, assign Quality Routing and do Call Tracing. In the output you will find useful information on how Terminators are ordered. | Another way to test your Quality Routing formulas is to create a test Originator, assign Quality Routing, and do Call Tracing. In the output, you will find useful information on how Terminators are ordered. | ||
<br><br> | <br><br> | ||
=Order= | =Order= | ||
Terminators are ordered by Quality Index (QI) in a '''descending''' order (Terminators with higher QI will be dialed first). If two or more Terminators '''in the same''' Dial Peer have equal QI, then these Terminators will be ordered by TP priority in Dial Peer‘s settings. If two or more Terminators '''in the same''' Dial Peer have equal QI and TP priority, then these Terminators will be ordered randomly. This is default behavior for any Routing Algorithm – order by Originator‘s Routing Algorithm and reorder matching Terminators by TP priority in Dial Peer‘s settings.<br> | Terminators are ordered by Quality Index (QI) in a '''descending''' order (Terminators with higher QI will be dialed first). If two or more Terminators '''in the same''' Dial Peer have equal QI, then these Terminators will be ordered by TP priority in Dial Peer‘s settings. If two or more Terminators '''in the same''' Dial Peer have equal QI and TP priority, then these Terminators will be ordered randomly. This is the default behavior for any Routing Algorithm – order by Originator‘s Routing Algorithm and reorder matching Terminators by TP priority in Dial Peer‘s settings.<br> | ||
Note that Terminators are ordered | Note that Terminators are ordered at Dial Peer‘s level. There may be situations where lower-quality Terminators are dialed first. For example, we have two Dial Peers - Standard DP and Premium DP. Standard DP has priority 0 in the Routing Group and Premium DP has priority 1 in the Routing Group. Both are selected when routing a call but Standard DP has a lower priority numbed therefore it will be used first. Terminators in both DP are ordered by quality and Premium DP might have better quality Terminators but Standard DP has a lower priority value so Terminators from this DP are used first. Terminators in Standard DP are still ordered by quality.<br> | ||
Division can be used to achieve '''ascending''' order. For example, you want to order Terminators by lowest total call duration so that Terminators with lowest call duration are called first. One way to do this is to use this formula:<br> | Division can be used to achieve '''ascending''' order. For example, you want to order Terminators by lowest total call duration so that Terminators with the lowest call duration are called first. One way to do this is to use this formula:<br> | ||
<pre> | <pre> | ||
1 / TOTAL_BILLSEC | 1 / TOTAL_BILLSEC | ||
</pre> | </pre> | ||
<br><br> | |||
=Situation when quality is unknown= | =Situation when quality is unknown= | ||
Quality is calculated for a Dial Peer – Terminator pair. That means that the same Terminator can have different quality in different Dial Peers. But what happens when you create new Dial Peer and assign some Terminators to it? What is the quality | Quality is calculated for a Dial Peer – Terminator pair. That means that the same Terminator can have a different quality in different Dial Peers. But what happens when you create a new Dial Peer and assign some Terminators to it? What is the quality of each Terminator in this particular Dial Peer? We don‘t know since there are no calls made through this new Dial Peer.<br> | ||
In this case | In this case, M4 will generate initial quality stats for each Terminator by retrieving calls from the database that were made through any Dial Peer. In the database, there is no relationship between Terminator and Dial Peer. Just by looking in a database, we don‘t know which Dial Peer was used when making a call therefore each time the quality is calculated from the database it will be more general and may differ from what it is, in particular, Dial Peer. In practice, this is not a big problem since quality is calculated by most recent calls and these calls are differentiated between Dial Peer. Initial general quality statistics will be eventually replaced by Dial Peer-specific quality statistics.<br> | ||
Another case is when we add completely new Terminator that does not have any calls. We can not calculate initial quality from the database since there are no calls made through this Terminator. In this case the initial Quality Index will be 0 and there is a risk that this Terminator will always be at the end of routing list.<br> | Another case is when we add a completely new Terminator that does not have any calls. We can not calculate the initial quality from the database since there are no calls made through this Terminator. In this case, the initial Quality Index will be 0 and there is a risk that this Terminator will always be at the end of the routing list.<br> | ||
There is a way to temporarily force higher Quality Index | There is a way to temporarily force a higher Quality Index on Terminators that have none or few calls. Let’s analyze a situation where we are routing calls by ASR (for the last 50 Calls) and adding a new Terminator. In this case, our Quality Routing Formula is:<br> | ||
<pre> | <pre> | ||
Line 97: | Line 116: | ||
</pre> | </pre> | ||
Quality Index (QI) is ASR - Terminators with higher ASR will be dialed first. If we add a new Terminator it will have an initial QI 0 (ASR 0) and it will be at the end of routing list. Let’s modify our Quality Routing Formula by including TOTAL_CALLS variable:<br> | Quality Index (QI) is ASR - Terminators with higher ASR will be dialed first. If we add a new Terminator it will have an initial QI 0 (ASR 0) and it will be at the end of the routing list. Let’s modify our Quality Routing Formula by including TOTAL_CALLS variable:<br> | ||
<pre> | <pre> | ||
Line 103: | Line 122: | ||
</pre> | </pre> | ||
Now QI will depend not only on ASR but on total Calls made as well. If Terminator has 0 Calls then Formula is ASR + 5000 but when Terminator has 50 Calls, Formula is ASR. Note that number 50 here is chosen by the number of last Calls variable will hold so variable TOTAL_CALLS will have | Now QI will depend not only on ASR but on total Calls made as well. If Terminator has 0 Calls then Formula is ASR + 5000 but when Terminator has 50 Calls, Formula is ASR. Note that the number 50 here is chosen by the number of last Calls the variable will hold so variable TOTAL_CALLS will have a minimum value of 0 and the maximum value of 50. When every Terminator in a Dial Peer makes 50 or more calls our modified formula will represent only ASR. This way we can force all Terminators to be dialed at least N times (similar to the Round-robin algorithm) and after enough Calls are accumulated we can do routing by quality.<br> | ||
<br><br> | <br><br> | ||
=Failed Calls= | =Failed Calls= | ||
Calls may fail due to various reasons, for example code 327 Terminator's capacity reached. This particular hangup reason does not reflect Terminator’s quality since this is an internal reason why a Call failed. These | Calls may fail due to various reasons, for example, code 327 Terminator's capacity reached. This particular hangup reason does not reflect Terminator’s quality since this is an internal reason why a Call failed. These M4 specific hangup reasons (codes between 300 and 399) are not calculated in Quality Routing. One exception is code 312 Caller canceled the call. This code is accepted in Quality Routing as it may reflect Terminator’s quality. Each real attempt to dial Terminator is calculated in Quality Routing.<br> | ||
Note that most statistics in | Note that most statistics in M4 count internal hangup reasons (codes between 300 and 399) as FAILED calls. |
Latest revision as of 10:59, 29 November 2022
Quality Routing allows ordering Terminators by quality. This is a very flexible way of routing because quality is determined by mathematical formulas that contain various parameters.
These parameters are used to calculate the Quality Index by which Terminators are ordered in a Dial Peer.
Quality is calculated for Dial Peer - Terminator pair that means single Terminator can have different Quality Index values in different Dial Peers.<be>
Enabling Quality Routing in core module
By default, Quality Routing is disabled in the core module which is responsible for routing all calls. To enable Quality Routing, please use these commands:
In a server where Radiusd service is located, in file /etc/m2/system.conf change disable_advanced_routing value from 0 to 1
disable_advanced_routing=0
After the value has been changed, reload the settings:
m2 reload
More information about core settings can be found here.
Quality Routing Rules
You can view and create Quality Routing Rules in ROUTING -> Quality Routing
In the Quality Routing list, you can see how many Originators have a specific Quality Routing Rule assigned to them in a USED column. Routing Rules can be assigned in Originator settings.
Press ADD NEW and you will be redirected to a page where you will be able to define your own Quality Routing Rules.
General
- Name - name for your Quality Routing Rule
- Quality Index Formula - formula by which Quality Index is calculated (if the entered formula is incorrect input borders will turn red)
Quality Index Parameters
The Quality Index Parameter value represents how many last Calls each Parameter is calculated. The lower amount of last Calls used in Quality Index Parameters will result in a faster response to Quality Index change but it will be less accurate. A higher amount of last Calls used in Quality Index Parameters will result in a more accurate Quality Index but it will change slower. Currently, each Quality Index Parameter can be calculated for maximum of 200 last Calls.
Information on Formula's Parameters
Here you can find a list of Quality Index Parameters that can be used in formulas.
Quality Index
Quality Index is an evaluation of the Quality Index Formula that is calculated for each Dial Peer - Terminator pair. When Quality Routing Algorithm is in use Terminators are ordered by Quality Index in a Dial Peer.
To calculate Quality Index, these Parameters can be used:
- TOTAL_CALLS - number of total Calls
- TOTAL_ANSWERED - number of answered Calls
- TOTAL_FAILED - number of failed Calls (read section about failed Calls)
- TOTAL_BILLSEC - total Call duration (in seconds)
- ASR - answer seizure ratio (%)
- ACD - average Call duration (in seconds)
- PRICE - Terminator’s Call price (Tariff Rate) in default Currency
- WEIGHT - Terminator’s weight in a Dial Peer
- PERCENT - Terminator’s percent in a Dial Peer
Note that each variable is calculated for a Dial Peer - Terminator pair. This means that the same Terminator can have X total Calls in one Dial Peer and Y total Calls in another Dial Peer.
Quality Index Formula is written in mathematical expressions, for example:
WEIGHT + (ASR * ACD * PRICE) / 2
This formula is just an example to show how formulas are written and is not intended to be used in production for Quality Routing.
For each Quality Index Parameter, you can set a specific amount of last Calls used in the calculation. For example, if you set 50 Calls for ASR then the last 50 Calls made through a Dial Peer - Terminator pair will be used to calculate ASR. The lower amount of last Calls used in Quality Index Parameters will result in a faster response to Quality Index change but it will be less accurate. A higher amount of last Calls used in Quality Index Parameters will result in a more accurate Quality Index but it will change slower. Currently, each Quality Index Parameter can be calculated for a maximum of 200 last Calls.
Quality Routing Stats
The Quality Routing Stats page allows you to check current quality statistics for selected Dial Peer. You can select specific Quality Formula and it will be applied to a Dial Peer. The quality Routing Statistics table can be ordered by Quality Index so that you could know which Terminators will be dialed first.
Note that if your formula contains a PRICE variable, you will be asked to enter a Destination number in a Destination input field. This number will be used to calculate the PRICE variable. Terminator’s rate will be assigned to the PRICE variable. If the Rate is not found or the Destination number is not entered, the PRICE variable will have a value of 0.
This page is useful if you just want to know quality statistics in a Dial Peer or if you want to experiment with different Quality Routing formulas. You can even check Quality Routing formulas that are not assigned to any Originator.
Another way to test your Quality Routing formulas is to create a test Originator, assign Quality Routing, and do Call Tracing. In the output, you will find useful information on how Terminators are ordered.
Order
Terminators are ordered by Quality Index (QI) in a descending order (Terminators with higher QI will be dialed first). If two or more Terminators in the same Dial Peer have equal QI, then these Terminators will be ordered by TP priority in Dial Peer‘s settings. If two or more Terminators in the same Dial Peer have equal QI and TP priority, then these Terminators will be ordered randomly. This is the default behavior for any Routing Algorithm – order by Originator‘s Routing Algorithm and reorder matching Terminators by TP priority in Dial Peer‘s settings.
Note that Terminators are ordered at Dial Peer‘s level. There may be situations where lower-quality Terminators are dialed first. For example, we have two Dial Peers - Standard DP and Premium DP. Standard DP has priority 0 in the Routing Group and Premium DP has priority 1 in the Routing Group. Both are selected when routing a call but Standard DP has a lower priority numbed therefore it will be used first. Terminators in both DP are ordered by quality and Premium DP might have better quality Terminators but Standard DP has a lower priority value so Terminators from this DP are used first. Terminators in Standard DP are still ordered by quality.
Division can be used to achieve ascending order. For example, you want to order Terminators by lowest total call duration so that Terminators with the lowest call duration are called first. One way to do this is to use this formula:
1 / TOTAL_BILLSEC
Situation when quality is unknown
Quality is calculated for a Dial Peer – Terminator pair. That means that the same Terminator can have a different quality in different Dial Peers. But what happens when you create a new Dial Peer and assign some Terminators to it? What is the quality of each Terminator in this particular Dial Peer? We don‘t know since there are no calls made through this new Dial Peer.
In this case, M4 will generate initial quality stats for each Terminator by retrieving calls from the database that were made through any Dial Peer. In the database, there is no relationship between Terminator and Dial Peer. Just by looking in a database, we don‘t know which Dial Peer was used when making a call therefore each time the quality is calculated from the database it will be more general and may differ from what it is, in particular, Dial Peer. In practice, this is not a big problem since quality is calculated by most recent calls and these calls are differentiated between Dial Peer. Initial general quality statistics will be eventually replaced by Dial Peer-specific quality statistics.
Another case is when we add a completely new Terminator that does not have any calls. We can not calculate the initial quality from the database since there are no calls made through this Terminator. In this case, the initial Quality Index will be 0 and there is a risk that this Terminator will always be at the end of the routing list.
There is a way to temporarily force a higher Quality Index on Terminators that have none or few calls. Let’s analyze a situation where we are routing calls by ASR (for the last 50 Calls) and adding a new Terminator. In this case, our Quality Routing Formula is:
ASR
Quality Index (QI) is ASR - Terminators with higher ASR will be dialed first. If we add a new Terminator it will have an initial QI 0 (ASR 0) and it will be at the end of the routing list. Let’s modify our Quality Routing Formula by including TOTAL_CALLS variable:
ASR + 100 * (50 - TOTAL_CALLS)
Now QI will depend not only on ASR but on total Calls made as well. If Terminator has 0 Calls then Formula is ASR + 5000 but when Terminator has 50 Calls, Formula is ASR. Note that the number 50 here is chosen by the number of last Calls the variable will hold so variable TOTAL_CALLS will have a minimum value of 0 and the maximum value of 50. When every Terminator in a Dial Peer makes 50 or more calls our modified formula will represent only ASR. This way we can force all Terminators to be dialed at least N times (similar to the Round-robin algorithm) and after enough Calls are accumulated we can do routing by quality.
Failed Calls
Calls may fail due to various reasons, for example, code 327 Terminator's capacity reached. This particular hangup reason does not reflect Terminator’s quality since this is an internal reason why a Call failed. These M4 specific hangup reasons (codes between 300 and 399) are not calculated in Quality Routing. One exception is code 312 Caller canceled the call. This code is accepted in Quality Routing as it may reflect Terminator’s quality. Each real attempt to dial Terminator is calculated in Quality Routing.
Note that most statistics in M4 count internal hangup reasons (codes between 300 and 399) as FAILED calls.