Vale Company_Phone_Number_Normalization_Rules

Since upgrading the Front End to Skype for Business Server last week it’s become apparent (thanks Ken!) that our old friend “Company_Phone_Number_Normalization_Rules.txt” has been retired. It’s been replaced by PowerShell and with some generic rules to hopefully get you started.

Thankfully as before, Event 21034 will tell us if we have numbers in our AD that weren’t able to be normalised:

Event21034-Edit

… and point us to where we can find them on the Share in the traditional “Invalid_AD_Phone_Numbers.txt” file:

InvalidNumbers-edit

Two ways around it

There are two ways to deal with this: either import your old rule-set, or start afresh!

Import your old rules

Microsoft has kindly provided a means to import the contents of the old file. First off we’ll flush the defaults:

Get-CsAddressBookNormalizationRule | Remove-CsAddressBookNormalizationRule


Now import your old ones:

Import-CsCompanyPhoneNormalizationRules -FileName .\Company_Phone_Number_Normalization_Rules.txt -Verbose

ImportRulez-edit

And here they are:

(Get-CsAddressBookNormalizationConfiguration).AddressBookNormalizationRules | ft pattern,translation -auto

ImportedRulez-edit

Create new rules

I thought now’s as good a time as any to discard my old ones and see if I can do any better, so I’m going with this collection. A benefit of taking this approach over the import is that it’s easy to add some descriptive text to explain the intent of each rule. Clearly these are tuned for AU, but you should be easily able to modify them for your environment:

Get-CsAddressBookNormalizationRule | Remove-CsAddressBookNormalizationRule

New-CsAddressBookNormalizationRule -Parent Global -Name 'E.164 AU' -Description 'Correct E.164 format. Strip common incorrect 0 if present' -Pattern '(\+?)61(0?)(\d{9})' -Translation '+61$3' -Priority 0
New-CsAddressBookNormalizationRule -Parent Global -Name 'E.164 Passthrough' -Description 'Passthrough other foreign E.164 format numbers' -Pattern '\+(\d*)' -Translation '+$1' -Priority 1
New-CsAddressBookNormalizationRule -Parent Global -Name 'E.164 IDD Prefix' -Description 'Strip overseas calling prefix (e.g. 0011, 0018, etc)' -Pattern '001(\d)(\d*)' -Translation '+$2' -Priority 2
New-CsAddressBookNormalizationRule -Parent Global -Name 'E.164 10-digit AU' -Description '10-digit AU number, starts with 0' -Pattern '0(\d{9})' -Translation '+61$1' -Priority 3
New-CsAddressBookNormalizationRule -Parent Global -Name 'E.164 4-10-digit AU' -Description '4-10-digit AU number, starts with 1' -Pattern '1(\d{3,9})' -Translation '+611$1' -Priority 4


 

(Get-CsAddressBookNormalizationConfiguration).AddressBookNormalizationRules | ft description,pattern,translation -auto

NewRules-After-edit

Use James’ Script

James in Melbourne has written a script to make this process a little easier for you too. Check it out:

SfbABSNormzToolScript

Testing?

Alas there doesn’t appear to be a "Test-CsAddressBookNormalizationRule" commandlet (yet?), and whilst "Abserver.exe" still resides in \server\core, it no longer has the "-testPhoneNorm" switch of its predecessor:

Abserver.exe

As such, testing your new rules is likely to be a bit hit-and-miss, requiring a loop through “Update-CsAddressBook” and “Invalid_AD_Phone_Numbers.txt” with each attempt.

The “Test-CsVoiceNormalizationRule” cmdlet has some potential but I’ve not been able to put it to use here – not without writing a script to pull apart the AddressBook rule-set and then run the whole shebang rule-by-rule until you find the first one that matches.

If I find a way of testing the rules I’ll post it here. If you beat me to it, please post it in the comments below!

BTW don’t forget there are plenty of awesome apps and websites out there to help you craft clever RegEx. I like the .NET Regular Expression Designer.

Revision History

15th Nov 2015: Corrected faulty rule (as pointed out by Mike below) & added reference to James’ "SKYPE FOR BUSINESS ADDRESS BOOK NORMALISATION TOOL"

 

All credit goes to Ken Lasko for bringing this to my attention.

– G.

4 Comments

Leave a Reply

Your email address will not be published.

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.