Thursday, 2 July 2015

Skype for Business Address Book Normalisation Tool

The release of Skype for Business brings a new set of Powershell commands for controlling Address Book Normalisation rules. In previous versions of Lync, these rules were configured in the Company_Phone_Number_Normalization_Rules.txt file that was stored in the address book storage on the Lync share. This previous method was not particularly intuitive and prone to issues because of the text file format used.

So now in Skype for Business we have Powershell commands to make everything easier, right? Well, yes and no. I am not a big fan of having to memorise Powershell commands that will only be used rarely. Also, ideally it should be easy to see and change the priority order of the rules as well as test the rules with commands. However, the new commands don’t offer any testing facilities as yet; they require multiple list ups and are not intuitive for priority changes. So as Tim Allen used to say on Home Improvement: it’s Tool Time again…

Skype4B Address Book Normalisation Tool

Tool Features:
  • Import Existing “Company_Phone_Number_Normalization_Rules.txt” files into the system.
  • Add/Edit address book rules to the system. If the rule you are setting has a name that matches an existing rule, then the existing rule will be edited. If the rule’s name does not match an existing rule then it will be added as a new rule to the list.
  • Delete rules from the system.
  • Create new Site based Address Book Normalisation Rules policies.
  • Change the priority of rules.
  • Custom written rule testing code for testing pattern and translation matches as well as the resultant number.
  • Export rules back into a “Company_Phone_Number_Normalization_Rules.txt” file format.
  • Test the rules! Skype for Business currently (at the time of writing this) doesn’t have Address Book Normalisation testing capabilities. So I wrote a custom testing engine into the tool providing this feature. By entering a number into the Test textbox and pressing the Test Number button, the tool will highlight all of the rules that match in the currently selected Global/Site level Policy patterns in blue. The rule that has the highest priority and matches the tested number will be highlighted in red. The pattern and translation of the highest priority match (the one highlighted in red) will be used to do the translation on the Test Number and the resultant translated number will be displayed by the Test Result label.
Version 1.01 Update (13/10/2015):
  • Added warning message on the Remove policy button to save you from yourself :)
  • Removed second .txt from the export name.
Version 1.02 Update (20/1/2015):
  • Script now doesn't strip ";" char before applying regex. (Thanks Daniel Appleby for reporting)

Available on the TechNet Gallery:


Importing Company_Phone_Number_Normalization_Rules

The new Skype for Business address book normalisation Powershell commands offer a way to import previous Normalisation Rule files.  The command is called Import-CsCompanyPhoneNormalizationRules and will import the Pattern and Translation Rule directly into the new Skype for Business commands. In doing so, the import process will create a random GUID to be used as a unique name for each normalisation rule.

Import File Example:
# Internal 13 Extension numbers
# Internal 17 Extension numbers

Get-CsAddressBookNormalizationRule after import:
Identity    : Site:Melbourne/d8209928-5b07-44fa-9642-56285dbe72d1
Priority    : 0
Description :
Pattern     : ^13(\d{2})$
Translation : +6139999$1
Name        : d8209928-5b07-44fa-9642-56285dbe72d1

Identity    : Site:Melbourne/3cfd51ad-2be9-43ce-a87d-f223bdc755c6
Priority    : 1
Description :
Pattern     : ^(17\d{2})$
Translation : +6139999$1
Name        : 3cfd51ad-2be9-43ce-a87d-f223bdc755c6

The Address Book Normalisation Tool uses this same command to import address book files. As a result, you can expect to see the same operation as shown above. When the rules are imported into an existing scope that already contains rules the new normalisation rules will be added in addition to the existing rules. No existing rules will be deleted by the import process.

Rule Testing

In previous versions of Lync you used to be able to test rules using the Abserver.exe using the testPhoneNorm flag. The output of this command would tell you which Pattern in the Normalisation Rules file would be used by the system for the test number you supplied. The Address Book Normalisation Tool has a similar testing feature that will highlight all of the rules that match the tested number in blue and highlight the highest priority (ie. the actual rule the system will use to do the normalisation) rule in red. It will also show you the Pattern, Translation Rule, and exactly what the resultant number will be after translation.

Test Example:

The Wrap Up

Now Skype for Business Address Book Normalisation couldn't be any easier! I hope you find this tool useful and continue normalising for many years to come. Enjoy!

Read more →

Popular Posts