onsdag den 13. juni 2018

Manage Tenant Dialplans in Microsoft Phone System (Denmark)

Ever since OCS/ LYNC server became Voice enabled we had the option to work with Normalization Rules - Normalization Rules is a way to enable users to maintain their existing dialing patterns, this could be 4 Digit shortnumbers within an organization, or simply the ability to type 8-digit numbers and see them "normalize" within the client to fully supported E.164 numbers with + and countrycode.
  • Hybrid with Skype for Business Server 2015 
    • Calls to/from users homed in Skype for Business Online route via an on-premises Skype for Business Server deployment to the PSTN network.
  • Hybrid with onprem or hosted CCE
    • Calls to/from users homed in Skype for Business Online route via on-premises CCE deployment to the PSTN network

If the Cloud PBX users is in Hybrid with an traditional on-premises Skype for Business Server, on-premises dial plans can be assigned to Cloud PBX users. This ensures that, when users are moved from on-premises to online, their dialing behavior remains unchanged.

If the Cloud PBX users utilize an on-premises Cloud Connector Edition, on-premises dial plans cannot be assigned. Instead, users are assigned a Tenant Country level dial plan from the Skype for Business Online tenant, which cannot be configured or customized. This presented some challenges, including:
Users that were moved from on-premises Skype for Business (Enterprise Voice), to Skype for Business Online (Cloud PBX) would experience a change in dialing behavior, as their dial plan would not move with them.
In Denmark, the dial plan is very basic. Only 2 normalization rules were contained within the dial plan See snooper trace below.
Some issues with this included incorrect normalization behavior when dialing emergency numbers, as well as no support for users dialing local 8 digit numbers,because users in one Denmark wanted +45 and users in other country with 8-digits had different requirement.

Snooper trace for standard Danish user with the Tenant wide default DK Dialplan - notice only two Normalization rules apply.

This means that normalizations for neither emergency or normal 8 digit numbers work at all. :(



Luckily this was the past, with TenantDialplans this is actually customizable to fit your organizations needs.

Worth mentioning is that the Online Dial Plan hierarchy (scope) is working differently if a Tenant Dial Plan is activated.
So theTenant Dial Plan hierarchy differs from On-Premise scopes. On-Premise you could define Dial Plan based on Global, Site, Pool and User level, where the lowest (closer to the effective user) Dial Plan will be effective. 
With Online Dial Plans you merge the Service Country with the Global or User applied Dial Plan. 
Note: The Tenant Dial Plan always comes first! 
Illustration is copyed from Thomas Poetts great article on the subject.:

Article found here: https://gallery.technet.microsoft.com/Tenant-Dial-Plans-in-Skype-c80a7dfd


So lets get configuring via powershell.

To find the tenant level dialplan

The following cmdlet will list default dial plan entries that apply to a region. In this example, the region is DK: (Get-CsDialPlan DK).NormalizationRules | FT Name,Description,Pattern,Translation
As you see only two rules.
If you only have users in one single country - the easiest way to achieve correct normalization is simply to modify this Service Level Dialplan

$NR1 = New-CsVoiceNormalizationRule -Name 'DK-TollFree' -Parent Global -Pattern '^(80\d{6})\d*$' -Translation '+45$1' -InMemory -Description "DK-TollFree"
$NR2 = New-CsVoiceNormalizationRule -Name 'DK-Premium' -Parent Global -Pattern '^(90\d{6})$' -Translation '+45$1' -InMemory -Description "DK-Premium"
$NR3 = New-CsVoiceNormalizationRule -Name 'DK-Mobile' -Parent Global -Pattern '^(((2\d|3[01]|4[0-2]|5[0-3]|6[01]|[78]1|9[1-3])\d{6}))$' -Translation '+45$1' -InMemory -Description "DK-Mobile"
$NR4 = New-CsVoiceNormalizationRule -Name 'DK-National' -Parent Global -Pattern '^((3[2-689]|4[3-9]|5[4-9]|6[2-69]|7[02-9]|8[26-9]|9[6-9])\d{6})\d*(\D+\d+)?$' -Translation '+45$1' -InMemory -Description "DK-8digit"
$NR5 = New-CsVoiceNormalizationRule -Name 'DK-Service' -Parent Global -Pattern '^(11[24]|1\d{3,5})$' -Translation '+45$1' -InMemory -Description "DK-service"
$NR6 = New-CsVoiceNormalizationRule -Name 'DK-International' -Parent Global -Pattern '^(?:\+|00)(1|7|2[07]|3[0-46]|39\d|4[013-9]|5[1-8]|6[0-6]|8[1246]|9[0-58]|2[1235689]\d|24[013-9]|242\d|3[578]\d|42\d|5[09]\d|6[789]\d|8[035789]\d|9[679]\d)(?:0)?(\d{6,14})(\D+\d+)?$' -Translation '+$1$2' -InMemory -Description "DK-International"

Set-CsTenantDialPlan -Identity Global -NormalizationRules @{Add=$NR1,$NR2,$NR3,$NR4,$NR5,$NR6}

The same logic applyes when removing rules from Global - simply change ADD to Remove and put the rules you want to remove in a variable

Lets say you want to remove the DK-Service rules.

$NR1 = New-CsVoiceNormalizationRule -Name 'DK-Service' -Parent Global -Pattern '^(11[24]|1\d{3,5})$' -Translation '$1' -InMemory -Description "DK-service"
Set-CsTenantDialPlan -Identity Global -NormalizationRules @{Remove=$NR1}

 Most common is to create user level tenant dialplan - so we can manage pr site or country.
Theese are the rules and commands needed for Denmark.

$NR1 = New-CsVoiceNormalizationRule -Name 'DK-TollFree' -Parent Global -Pattern '^(80\d{6})\d*$' -Translation '+45$1' -InMemory -Description "DK-TollFree"
$NR2 = New-CsVoiceNormalizationRule -Name 'DK-Premium' -Parent Global -Pattern '^(90\d{6})$' -Translation '+45$1' -InMemory -Description "DK-Premium"
$NR3 = New-CsVoiceNormalizationRule -Name 'DK-Mobile' -Parent Global -Pattern '^(((2\d|3[01]|4[0-2]|5[0-3]|6[01]|[78]1|9[1-3])\d{6}))$' -Translation '+45$1' -InMemory -Description "DK-Mobile"
$NR4 = New-CsVoiceNormalizationRule -Name 'DK-National' -Parent Global -Pattern '^((3[2-689]|4[3-9]|5[4-9]|6[2-69]|7[02-9]|8[26-9]|9[6-9])\d{6})\d*(\D+\d+)?$' -Translation '+45$1' -InMemory -Description "DK-8digit"
$NR5 = New-CsVoiceNormalizationRule -Name 'DK-Service' -Parent Global -Pattern '^(11[24]|1\d{3,5})$' -Translation '$1' -InMemory -Description "DK-service"
$NR6 = New-CsVoiceNormalizationRule -Name 'DK-International' -Parent Global -Pattern '^(?:\+|00)(1|7|2[07]|3[0-46]|39\d|4[013-9]|5[1-8]|6[0-6]|8[1246]|9[0-58]|2[1235689]\d|24[013-9]|242\d|3[578]\d|42\d|5[09]\d|6[789]\d|8[035789]\d|9[679]\d)(?:0)?(\d{6,14})(\D+\d+)?$' -Translation '+$1$2' -InMemory -Description "DK-International"

New-CsTenantDialPlan  -Identity DK -NormalizationRules @{Add=$NR1,$NR2,$NR3,$NR4,$NR5,$NR6}

Grant-CsTenantDialPlan -PolicyName DK -Identity tjo@xxx.dk

 Then after logging in we can see a clear change i numbers rules in the snooper trace.
And now we see the normalizations working perfectly



Now you just need to define and add custom rules for other contries


If you want to see which dialplan a certain user is affected by run this:
Get-CsEffectiveTenantDialPlan -Identity tjo@xxx.dk | Select-Object -ExpandProperty NormalizationRules


As always Happy SKYPE'ing

Ingen kommentarer: