The rules will use the "Regular Expression" mechanism (also called RegEx) to perform "find and replace" operations on the phone numbers dialed.
Note: If no rule is defined Rainbow default behavior is to analyze automatically a phone number using an integrated phone number library and the country defined in the user profile. For example, if the number is identified as a national phone number it will add the outbound prefix defined in the PBX configuration.
How does it work?
If numbering rules are defined then the dialed number will be first sent through these rules and if it matches a rule then the default behavior (phone number library and country analysis) will be skipped and the rule applied. If no rule matches then the default phone number analysis (see note above) will apply.
If the dialed phone number is matching a rule do not forget to add the outbound prefix in the replace field if the resulting number is a public phone number.
Let's give some examples:
1- Numbers with exactly 5 digits are internal numbers
Rule= ^(\d{1,5})$
Replace= $1
e.g. input 54321 = dialed 54321 (outbound prefix is not added)
e.g. input 654321 = more than 5 digits, rule does not match:
A number is a valid number according to the integrated phone number library then the outbound prefix is added and 0654321 is dialed (which may result in invalid number)
the number is not a valid number according to the integrated phone number library then 654321 is dialed and will result in an invalid number
2- Numbers starting with 258 and with exactly 8 digits are internal numbers
This rule is especially relevant in countries with open DDI numbering plans, where internal extensions might conflict with national numbers. Germany is one such example..
Rule= ^((?=(258))[0-9]{8})$
Replace= $1
e.g. input 25845678 = dialed 25845678
e.g. input 2584567890 = more than 8 digits, rule does not match
e.g. input 25745678 = not starting with 258, rule does not match
3- Change a national number from same area to local number (e.g. area code = 321)
Rule = ^0321
Replace= 00
e.g. input 0321456789 = dialed 00456789
4- Forbid special rate numbers starting with 0800
Rule = ^0800
Replace = empty
e.g. input 0800123456 = nothing is dialed
e.g. input 0801654321 = rule does not match, 0801654321 may be recognized by default phone number recognition and 00801654321 sent to the PBX
5- Add an outbound prefix to special services numbers (e.g. road and traffic condition or speaking clock)
Rule = ^3699$
Replace = 03699
or
Rule = (^3699$)
Replace = 0$1
e.g. input 3699 = dialed 03699
6- Exclude some specific public numbers that matches internal numbers
This rule is especially relevant when some country specific numbers (Social Services number, Pager numbers, etc....) matches with internal numbers.
But note that the best is to cover internal numbering with a rule as describe in the first example.
Germany pager number e.g. 1640
Rule = (^1640$)
Replace = $1
e.g. input 1640 = dialed 1640
Austria health advice number 1450
Rule = (^1450$)
Replace = $1
e.g. input 1450 = dialed 1450
Configuration view
Note: Once a number is matching a rule, the modified number is sent to the PBX and no other rule will apply to this number. Therefore the rule order is important.