Defining dial plans

As we mentioned before, for Enterprise Voice, Lync requires a dial plan that contains normalization rules that elaborate the phone number typed in by the user and standardizes it to the E.164 format. Normalization rules use .NET regular expressions (http://msdn.microsoft.com/en-us/library/hs600312.aspx).

Getting ready

As a starting point, I have used the UK-London-Lync.ps1 script generated with Ken Lasko's Lync Dialing Rule Optimizer.

How to do it...

  1. To generate normalization rules, it is necessary to have at least an existing dial plan. We can create a site-level dial plan with the following cmdlet:
    New-CsDialPlan -identity Site:Site001
  2. The normalization rules created with the following cmdlets will be associated with the previously mentioned dial plan:
    New-CsVoiceNormalizationRule -Name "UK-London-Local" -Parent "Site:Site001" -Pattern '^([378]d{7})$' -Translation '+4420$1' -Description "Local number normalization for London, United Kingdom"
    New-CsVoiceNormalizationRule -Name 'UK-TollFree' -Parent "Site:Site001" -Pattern '^0((80(0d{6,7}|8d{7}|01111)|500d{6}))$' -Translation '+44$1' -Description "TollFree number normalization for United Kingdom"
    New-CsVoiceNormalizationRule -Name 'U  K-Premium' -Parent "Site:Site001" -Pattern '^0((9[018]d|87[123]|70d)d{7})$' -Translation '+44$1' -Description "Premium number normalization for United Kingdom"
    New-CsVoiceNormalizationRule -Name 'UK-Mobile' -Parent "Site:Site001" -Pattern '^0(7([1-57-9]d{8}|624d{6}))$' -Translation '+44$1' -Description "Mobile number normalization for United Kingdom"
    New-CsVoiceNormalizationRule -Name 'UK-National' -Parent "Site:Site001" -Pattern '^0((1[1-9]d{7,8}|2[03489]d{8}|3[0347]d{8}|5[56]d{8}|8((4[2-5]|70)d{7}|45464d)))(D+d+)?$' -Translation '+44$1' -Description "National number normalization for United Kingdom"
    New-CsVoiceNormalizationRule -Name 'UK-Service' -Parent "Site:Site001" -Pattern '^(1(47d|70d|800d|1[68]d{3}|dd)|999|[*#][*#d]*#)$' -Translation '+$1' -Description "Service number normalization for United Kingdom"
    New-CsVoiceNormalizationRule -Name 'UK-International' -Parent "Site:Site001" -Pattern '^(?:00)((1[2-9]dd[2-9]d{6})|([2-9]d{6,14}))(D+d+)?$' -Translation '+$1' -Description "International number normalization for United Kingdom" 
  3. Now, we can look at some of the rules to understand the logic:
    • We can think of rules being made up by a Pattern part and a Translation part. The pattern contains designators and variables that represent a specific set and quantity of numbers; for example, in the UK-London-Local rule, ('^([378]d{7})$') is a pattern that matches any phone number that starts with 3,7, or 8 (and the following 7 digits). Then, for the translation, the $ symbol captures the digits from the pattern (which were included inside the parentheses) and normalizes them into the E.164 format prefix with +4420 ('+4420$1'). The rule normalizes local calls in London; for example, a call to 70405060 will be translated to +44 20 70405060.
    • The UK-TollFree rule ('^0((80(0d{6,7}|8d{7}|01111)|500d{6}))$') standardizes to E.164 tool-free numbers in the UK (starting with 0800, 0808, and 0500), removing the initial 0 and adding the CC of United Kingdom, +44 ('+44$1').

      In the following image, we can see a schema of the phone numbers that we are going to manage with this rule:

      How to do it...
    • The UK-Premium rule ('^0((9[018]d|87[123]|70d)d{7})$') standardizes numbers that are mainly used for horoscopes, chat lines, TV voting and other services (090, 091, and 098), customer service lines (0871, 0872, and 0873), and numbers used to divert calls to another phone number (070). Again, the initial 0 is removed and the CC of United Kingdom, +44, is added ('+44$1').
    • The UK-International rule ('^(?:00)((1[2-9]dd[2-9]d{6})|([2-9]d{6,14}))(D+d+)?$') normalizes international calls (the first half of the rule takes care of North American numbers, and the second half takes care of the rest of the world). The rule acts by removing the initial 00 and capturing all the calls to numbers with a pattern like the one in the following schema (the + sign is added, '+$1'):
      How to do it...

There's more...

To read (and edit) the regular expressions used in Lync normalization rules, I suggest that you use a free tool, Expresso 3.0 (http://www.ultrapico.com/ExpressoDownload.htm). As we can see in the following screenshot, using this tool makes it easier to understand complex regex strings, like the ones we need to manipulate phone numbers:

There's more...

Please note that Expresso requires a (free) registration to keep using it after 60 days.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.135.175