MOR Number Manipulation
Number Manipulation is used to change number formats.
Main RULES
MOR works with numbers that are in E.164 format.
That is, numbers coming to MOR SHOULD BE in E.164 format. Numbers leaving MOR ARE in E.164 format.
From this, the actions below follow:
1. The incoming destination number should be converted to E.164 (done by MOR Localization)
2. The outgoing number may be made out of an E.164 number (done by MOR Provider Rules)
Definitions
- E.164 format - In short, it's the number without an international prefix that starts with a country code. For more details, check Wikipedia.
- MOR Localization
- The main idea of MOR Localization: No matter how the user dials the number (destination), when localized it should be in E.164 format.
- MOR Localization has nothing in common with the numbers you send to providers. It operates with numbers received from the caller.
- MOR Provider Rules
- MOR operates with numbers in E.164 format, but the provider often asks for a differently formatted number - so MOR Provider Rules formats the E.164 number to a provider-acceptable format.
How Number Manipulation works
The first part, which makes any incoming number E164-compatible, is handled by MOR Localization. The second part, which changes the E.164 number, is MOR Provider Rules. The basic schema for this process can be simplified as:
MOR works only with E.164 numbers. That means MOR accepts only standard numbers. If a number is not in E.164, it must be converted to an E.164-compatible number.
For this task, MOR has a feature, Localization (found in Billing -> Functions -> Localization), for "standardizing non E.164 numbers to correct E.164 numbers".
If requested by an outgoing call provider, MOR can add or remove a special prefix to the number to send it to the provider in the requested format. This can be done using MOR Provider Rules.
Localization and MOR Provider Rules follow the same logic.
An example of how MOR Localization works:
Number from Caller -> MOR Localization -> Number from Caller in E.164 format -> MOR -> MOR Provider Rules -> Number for Callee.
- International prefixes and local number formats are handled by Localization.
- Provider technical prefixes and special number formats for providers are handled by MOR Provider Rules.
This means:
- If MOR receives a number with an international prefix, you need to strip it and make the number E.164 compatible.
- If MOR receives a number in some local number format with some special digit(s) in front of it, you need to strip it, add the country code -> make it E.164 compatible using Localization
- If your provider requests some fancy technical prefix, you need to add this prefix using MOR Provider Rules. Add the prefix to the E.164 number. You may need to remove some digits (e.g., the country code) before adding the technical prefix. Do this with MOR Provider Rules.
Let's repeat, because it is extremely important:
When MOR receives a number, make sure it is E.164 compatible or make it E.164 compatible with Localization. When you send a number to a provider, use MOR Provider Rules to convert the E.164 number to the format the provider expects.
Work flow to set up Localization and Provider Rules
To set up correct Localization and Provider Rules, you need to do the following:
- Know what number format the user will be dialing.
- Create an appropriate Location and assign the user to that Location.
- Create rules for the specific Location to handle user-entered numbers.
- Know what number provider expects.
- Create rules for the provider that handle the number transformation to the provider's expected number.
For training, let's cover the full example using the scheme we had before:
- The user dials a number: 863042438.
- The number is made E.164 compatible by Localization: we cut 86 and add 3706 to get 37063042438.
- Billing: MOR uses 37063042438 to find the correct destination and rates.
- An E.164 number is transformed to the provider format by Provider Rules: number 37063042438 is transformed into a format the provider expects by adding 89765#, so we have: 89765#37063042438.
- The call is sent to the provider as: 89765#37063042438.
HINT: We should remind you to use Call Tracing to debug all this.
HINT: World Telephone Numbering Guide can help a lot in handling different number formats.
Rule Ordering
Rules for MOR Localization and for MOR Provider Rules take the following order:
- Device/Provider Location.
- Global Location.
This means that Global location rules are applied to every device but have lower priority than specific Locations. That means - if a device belongs to Location X, then rules in Location X are reviewed first. If none of the rules from Location X can be applied, then rules in Location Global are checked.
Once a rule is applied, no further rules will be applied.
How an exact rule for a dialed number is selected from many rules
How does MOR select a rule that should be applied to the number?
Three steps are taken for all rules (for MOR Localization & MOR Provider Rules).
1. MOR checks for number length and rejects these rules if the dialed number's length does not fall into the described intervals of MIN and MAX, e.g., the number's length is less than MIN or greater than MAX.
2. Next, these rules are rejected if the beginning of the number does not match the Cut value of these rules.
3. In the last step, MOR selects the rule that has the longest Cut length.
For example, the rule selected at step 3 will be used to transform the dialed number.
Example
Let's say that '012337068111543' is a caller to the MOR system.
We have the following rules:
# CUT ADD MIN MAX 1 01 11 11 14 2 012 22 12 15 3 123 33 15 16 4 0123 44 11 20
1. MOR checks the number length against the available min/max settings. So if the incoming number's length (number length = 15 in our example) is more than or equal to MIN and less than or equal to MAX, this rule will not be rejected. The rule will be rejected if the number length is less than MIN or greater than MAX.
We reject rule #1 because 15 is > MAX(14). After the first step, we have:
# CUT ADD MIN MAX 2 012 22 12 15 3 123 33 15 16 4 0123 44 11 20
2. MOR checks for all remaining rules that haven't been rejected by the first and second rules, and selects the rule that has the longest CUT.
# CUT ADD MIN MAX 3 123 33 15 16 4 0123 44 11 20
3. MOR proceeds to look for the CUT value that matches the beginning of the dialed number. MOR rejects all rules that do not match the beginning of the dialed number.
In this step, we reject rule #3, because its CUT value (123) is NOT the beginning of the dialed number: 012337068111543.
After the second step, we have:
This step selects the rule with the longest CUT, so our result is:
# CUT ADD MIN MAX 4 0123 44 11 20
4. This rule is applied to the dialed number. For example, if the dialed number is 012337068111543, we first cut the CUT value (0123) from it (giving us 37068111543), and then we add the ADD value (44), so that the final result is 4437068111543.
