A Post from the Past: Normalizing Company Rules without the “+” Sign in OCS 2007 R2

jurassic-ocs

This is what I like to call a “Jurassic post”. Now that Lync is widely available, it’s uncool to still blog about OCS 2007 R2 :-)

But since there are still so many organizations using OCS 2007 R2 (I’m sure they all have plans to migrate to Lync) I decided to blog about one of the most common requests I (used to) get: how to normalize company rules without the plus sign?

Let me tell you that I recommend full E.164 normalization throughout all the OCS configuration settings. Nevertheless, I understand that user experience is a key factor for a success deployment, thus, if people are used to dial “0” to get an outside line and if they never used the “+” sign, that could be a good reason to configure similar normalization rules.

Another reason could be the fact that the legacy PBX is also configured that way, “0” for outside lines and no “+” signs accepted. Instead of configuring additional translation rules, we can make OCS provide the expected number configuration.

So, imagine our fictitious company Contoso, which has a location profile HQ.contoso.com.

jurassic-01

This location profile has 2 normalization rules, one for internal extensions (6-digit) and another one for external numbers (9-digit):

Rule name Number pattern Translation Example
6-digit ^(\d{6})$ $1 123456 is translated to 123456
9-digit ^(\d{9})$ 0$1 123456789 is translated to 0123456789

If a user on Communicator dials any of these number patterns, the translation result will still look familiar, much like what he/she has used his/her entire life:

jurassic-06jurassic-07

But besides the normalization rules from the location profile there is also the company normalization rules that convert the numbers stored in Active Directory. This set of translation rules is defined on the Company_Phone_Number_Normalization_Rules.txt file, stored on the Address Book share (more information at Configuring Address Book Server Phone Normalization).

The problem with configuring translation rules that don’t include the “+” sign is that they are not E.164 compliant, thus OCS will not import those numbers into the Address Book. So, what’s the trick? The trick is to prepend to the translation pattern “ ;phone-context=<location profile> ”.

Here’s what the rules might like in our example:

(\d{9})
0$1;phone-context=HQ.contoso.com

(\d{6})
$1;phone-context=HQ.contoso.com

Let’s take a look at the properties of the user Administrator in Active Directory:

jurassic-08

Notice the numbers all have 9-digit because they represent outside lines. With the previous rules on the Company_Phone_Number_Normalization_Rules.txt file, when the OCS Address Book service runs it will translate them appropriately and showing them to users as expected, as depicted in the following picture:

jurassic-02

By opening the local GalContacts.db file on the user’s computer, we can confirm that the translation rule was applied.

jurassic-04

And now the good news: this “trick” also works with Lync Server 2010. But beware with the changes regarding the translation patterns, certain type of expressions no longer work with Lync. For more information read Migrate Address Book.