Thursday 25 October 2018

Tenant dialplan for Danish users

The default Office 365 dialplan doesn't offer a correct national translation for the Danish based user (based on location in Office 365) to E.164.

Example:

The official Danish numbering plan has the following general properties:
00 - International Access Code (rule3)
0[1-9] - Not in use
10 - Operator specific routing codes 
1[1-9] - 3-5 digit short dials (like emergency service 112, police 114 etc.) (rule1)
2-9 - 8 digit landline and mobile phonenumbers (rule2)

Special numbers are numbers starting with 80 (toll-free) and 90 (overpriced).

For more information on the numbering plant, please visit Energistyrelsen (Danish Energy Agency): https://ens.dk/ansvarsomraader/telefoni/numre/den-danske-nummerplan 

To support the Danish numbering dialplan, a tenant dialplan has to be created.

These cmdlets will support a Global tenant dialplan:
$rule1 = New-CsVoiceNormalizationRule -Name 'DK - service' -Parent 'Global' -Pattern '^(1\d{2,4})$' -Translation '+45$1' -Priority 2 -InMemory
$rule2 = New-CsVoiceNormalizationRule -Name 'DK - national' -Parent 'Global' -Pattern '^([2-9]\d{7})$' -Translation '+45$1' -Priority 3 -InMemory
$rule3 = New-CsVoiceNormalizationRule -Name 'DK - international' -Parent 'Global' -Pattern '^00(\d+)' -Translation '+$1' -Priority 4 -InMemory
Set-CsTenantDialPlan -Identity 'Global' -NormalizationRules @{add=$rule1,$rule2,$rule3}

And grant this dialplan to the user:
Grant-CsTenantDialPlan -Identity <userid> -PolicyName 'DK'

You could also include a voice normalization rule for internal numbers (old telephony style) - this one will support 4 digits in the range of 4200-4399 and translate to +457874xxxx:
$rule = New-CsVoiceNormalizationRule -Name 'DK - intern' -Parent 'Global' -Pattern '^(4[2-3]\d{2})$' -Translation '+457874$1' -Priority 1 -InMemory

If you have users in multiple countries, you should create a country specific tenant dialplan.
$rule1 = New-CsVoiceNormalizationRule -Name 'DK - service' -Parent 'Global' -Pattern '^(1\d{2,4})$' -Translation '+45$1' -Priority 2 -InMemory
$rule2 = New-CsVoiceNormalizationRule -Name 'DK - national' -Parent 'Global' -Pattern '^([2-9]\d{7})$' -Translation '+45$1' -Priority 3 -InMemory
$rule3 = New-CsVoiceNormalizationRule -Name 'DK - international' -Parent 'Global' -Pattern '^00(\d+)' -Translation '+$1' -Priority 4 -InMemory
New-CsTenantDialPlan -Identity 'DK' -NormalizationRules @{add=$rule1,$rule2,$rule3}

This could also be scripted based on the user location:
Connect-MsolService
$users = Get-MsolUser | Where-Object {$_.UsageLocation -eq 'DK'}
foreach ($user in $users)
{
Grant-CsTenantDialPlan -Identity $user.UserPrincipalName -PolicyName 'DK'
}

As always, please share your thoughts, on this topic, below.

No comments:

Post a Comment