Routing Profiles
A routing profile is a set of rules allowing the extension to dial outside. It lists the rules to apply for selecting one or more providers, which changes to apply to the number and which restrictions. LCR can be enabled to allow the selection of the cheapest provider available. You may be familiar with the Asterisk dialing pattern _NXZ, but MiRTA PBX uses Regular Expression, more powerful, flexible and database supported.
Several routing profiles can be created to match your needs. You can assign a Routing Profile to each tenant or use the same Routing Profile for multiple tenants. You can even assign a Routing Profile to a single extension.
A Routing Profile is made of several rules.
- Name : This is the name of the rule
- Node : A rule can be applied for all calls made by any of your nodes (in case you have multiple servers acting in cluster) or for only single server
- Regex : This is the Regular Expression to be matched by the number dialed
- Provider : The provider to send the call to. Leaving the field empty makes the rule "blacklisted", so it cannot be dialed
- Digits to add : This is the digits to add when this regex is matched. So for example you can add 1 when you are dialing a number in the US or 00 when dialing an international number in EU
- Digits to del : This is the number of digits you want to remove from the start of the number matching the Regular Expression. So for example, if living in Europe, to remove the initial 00 digits for international numbers, you need to set the "Digits to del" to 2
- Use LCR : Activates the LCR
- Order / Priority : Lower these numbers, higher the priority of the rule to be applied. Rules are applied based on the Order first, Priority next, lower to higher.
- Weight : Allows to set round robin among multiple providers
When a number is dialed, the list of routing profile matching is selected. They are ordered based on Order then for Priority. When multiple providers are selected with the same priority and order, the penalty is taken into account and the call is sent to the provider with the lower penalty adjusted (multiplied) with the weight. Once a call is processed, the penalty for the provider selected is increased. Current penalty can be seen in the Admin/Provider section.
Let's make a simple example on how to round robin between two providers.
In this case we have two providers, Flowroute and SoTel. They have exactly the same matching rule and the same Order and Priority. When dialing a number matched by the Regex, which provider will be used? It will be used the Provider with the lesser penalty. After a call, the penalty for that provider will be increased, so at the next round, the other provider will be used.
This works perfectly when we want to use a perfect round robin, but let's make an example, just imagining I want to send more calls to Sotel than to Flowroute. Mind for example I want to sent 10 calls to Sotel and only 1 to Flowroute. To make it happen I'll set the weight for Flowroute to 10, so every time a call is sent to Flowroute, its penalty will be increased by 10. In this way, 10 calls to SoTel will be needed to match the penalty for Flowroute.
LCR can be enabled for a destination. In this case the call is routed using the provider with the lower price for that destination. It is important to notice the cost match is made without applying the Add Digits/Del Digits.