For Enterprise Voice, Lync requires a Dial Plan to be defined. The Dial Plan will have a number of normalization rules that convert the number typed in by the user (or selected by them from an Office application) and convert it to E.164 format. Normalization rules use .Net regular expressions. The objective is to match what the user has typed in and apply a translation to convert it to E.164. The dial plan is configured under Voice Routing in the Lync Control Panel. The dial plan can be scoped at the Site, Pool or User level.
Regex Basics
There are a small number of Regex elements used in Lync Normalization rules are these are described here.element | Meaning | Example | Explanation of example |
^ | Match at beginning of string | ^123 | Match the digits 123 at the beginning of the string |
() | Captures the matched subexpression | (456) | Capture what is between the parentheses into a numbered variable, starting at 1 which can be accessed as $n, eg $1 |
* | Specifies zero or more matches | \d(*) | |
+ | Specifies one or more matches | \d(+) | |
? | Specifies zero or one matches | \d(+) | |
{n} | Specifies exactly n matches | \d{4} | Match 4 digits |
{n,} | Specifies at least n matches | \d{3,} | Match at least 3 digits (with no limit to number of digits matched |
{n,m} | Specifies at least n, but no more than m, matches. | \d{3,6} | Match at least 3 digits but no more than 6 digits |
\d | Matches any decimal digit | ^\d | Match any decimal digit (at the beginning of a string) |
| | Matches any one of the terms separated by the | (vertical bar) character | 134 | 135 | Match either the string 134 or the string 135 |
$ | The match must occur at the end of the string | ^(123)$ | Match exactly digits 123 (and not 1234) |
Translation
Regex is used for translations following matches. In the case of Lync, this allows the addition of a leading + symbol and the insertion of digits, either from the matched string (S1) or fixed digits.Lync provides a normalization rule builder that guides you through the process of defining regular expressions that will cater for most circumstances. The generated regular expression can be hand modified to handle more complex situations.
The normalization rule builder has four steps, steps 1 and 2 match the pattern and steps 3 and 4 perform the translation.
- Starting digits: (Optional) Indicate the leading digits of dialed numbers you want the pattern to match. For example, type 234 if you want the pattern to match dialed numbers beginning with 234. This will result in a match pattern of ^(234)
- Length: Indicate the number of digits in the matching pattern and select whether you want the pattern to match this length exactly \d{4}, match dialed numbers that are at least this length (\d{3}\d+), or match dialed numbers of any length (\d*).
- Digits to remove: (Optional) Indicate the number of starting digits to be removed from dialed numbers you want the pattern to match. This will change how digits are captured into variables.
- Digits to add: (Optional) Indicate digits to be added to dialed numbers you want the pattern to match.
The normalisation rules are checked in order from top down, the first match is the only translation performed.
Example Normalization Rules
Name | Starting Digits | Length | Digits to remove | Digits to add | Pattern to match | Translation rule |
4 Digit Extension | 3 | Exactly 4 | 0 | +35320911 | ^(3\d{3})$ | +35320911$1 |
International Numbers | 00 | At least 2 | 2 | + | ^00(\d*)$ | +$1 |
National Numbers | 0 | At least 1 | 1 | +353 | ^0(\d*)$ | +353$1 |
Emergency Number | NA | NA | NA | NA | ^(999$|112$) | +$1 |
Dial Plan Testing
In the Lync Control Panel, we can test individual normalization rules or we can create a series of tests that can be saved and run to ensure our normalization and routing functions correctly.Name | Dialed number to test | Expected translation |
Local extension | 3001 | +353209113001 |
International Number | 0018095556789 | +18095556789 |
National Number | 0209113002 | +353209113001 |
Emergency Number | 112 | +112 |
Emergency Number | 999 | +999 |
No comments:
Post a Comment