Monday, December 20, 2010

Lync Enterprise Voice Best Practices - E.164 Formatting

For all the strengths of Lync in the Enterprise Voice department, there doesn't seem to be a lot of practical advice is how to properly design voice routing. Everytime I have to design voice routing for a client, I constantly end up second-guessing myself on the best way to go about it.  Microsoft's assistance in this area has improved since the OCS R2 days, but administrators are still left to their own devices when it comes down to the nitty-gritty details like:
  • Internal phone number formatting and normalization
  • How to best configure routes and PSTN usages
For the first bullet point, administrators can struggle with questions like "What format should I store numbers in Active Directory?", and "How should I normalize phone numbers inputted by users"


For storing numbers in Active Directory, you should save every number in E.164 format.  E.164 is an internationally recognized standard for phone numbers.  The standard is:
+<CountryCode><City/AreaCode><LocalNumber>;ext=<ext>
The country code is 1-3 digits long, while the city/area code and local number length can vary. The ext= portion is usually only used for companies with internal extensions. Public phone numbers in E.164 format look something like this:
+14162223333 for Toronto, Canada
+60321345678 for Kuala Lumpur, Malaysia
The Canada country code (and also for US and a good portion of the Caribbean) is 1, while Malaysia's country code is 60.  The area code for Toronto is 416 (and 905, 647, 289), while Kuala Lumpur's city code is 3.  Local numbers in Canada are 7 digits long, while KL's are 8 digits long (but are 6 or 7 digits long in other parts of Malaysia).

When inputting phone numbers in Active Directory, you can add separators as you see fit for readability. So, +1 (416) 222-3333 is OK, as is +60.3.2134.5678.

Users with internal extensions, and no direct number (DID) should use the ;ext= component. Start with the central number for the office and add the extension, like +19052223333;ext=555.  Don't store the number as just the extension.

Do not add country-specific routing codes for international calls in your Active Directory, like 011 or 00. These routing codes are not part of the E.164 standard. Also, do not exclude the country code from your numbers using the rationale that all your users are in the same city.

If you don't use E.164, you're likely going to have issues.  One real-world example is a Canadian company that stored their international numbers with 011 at the start (the international routing code for Canada). While it made clicking-to-dial from Communicator/Lync easier, it meant that users from other countries that used different international routing codes couldn't dial the number without throwing an error.

Another North American company had a PSTN carrier that required that local calls not include the long distance code 1. Since all their Enterprise Voice users were located in one city, they felt it was easiest to just not include the 1 in all their Active Directory users phone properties.  Once they expanded Enterprise Voice to other locations in another province, they found that the new users couldn't dial the original users due to the lack of a leading 1 (which is required for long distance calls in North America).

Even if you never plan on expanding to a different city or country, it's important to stick with E.164 formatting. If you federate with another company and publish your phone numbers, its entirely likely they won't be able to click-to-dial if you don't use E.164 phone numbers, simply because the other company can't anticipate whatever internal numbering scheme you came up with.

When you can assume that every incoming phone number will be formatted consistently, its relatively trivial to create trunk translation rules to add any required routing digits such as 011 for international calls, or removing the 1 for local calls before passing the call to the PSTN or next gateway.

"But wait!" you say.  "I have to remove the 1 for local calls and the list of local numbers is way too long to work with. How do I go about getting over that hurdle?" Simple! Use the Lync Dialing Rule Optimizer as discussed in Dialing Rule Optimizer for E.164 Phone Numbers and Least Cost Routing in Lync.

If you don't want to go through the hassle of fixing your internal phone numbers in Active Directory, I suggest using the Company_Phone_Number_Normalization_Rules.txt.  This file is filled with regular expressions that will convert any invalid phone numbers found in Active Directory to properly formatted E.164 numbers during the address book generation phase. You have to create the rules yourself based on your requirements, but there is lots of help out there to get you started (plus there are samples in the Sample_Company_Phone_Number_Normalization_Rules.txt).  You can find it in C:\Program Files\Microsoft Lync Server 2010\Web Components\Address Book Files\Files.  For a good overview of the Company_Phone_Number_Normalization_Rules.txt, see Jeff Schertz's blog entry on the topic.

At pretty much every deployment I ever do, I start with these basic normalization rules in the Company_Phone_Number_Normalization_Rules.txt file, which tends to capture many styles of AD phone numbers:
\+?1(\d{10})+1$1
\+?1(\d{10})\D+(\d+)+1$1;ext=$2
\+?(\d{6,14})+$1 
\+?(\d{6,14})\D+(\d+)+$1;ext=$2


If you stick with E.164 from the start, you will avoid the potential for dialing issues down the road.

My next post will discuss how to handle phone number normalization in Lync.  After that, I'll discuss route building.

For another great post on this topic (relating to OCS, but still very applicable to Lync), see this post on Doug's DTMF blog.

30 comments:

  1. Great post Ken, tested your online rule optimizer. Good stuff!! Your blog is a godsend

    ReplyDelete
  2. Hi, Is it possible tho add South Africa +27 to the Lync Optimiser?

    thanks

    ReplyDelete
    Replies
    1. Hi Anonymous,
      I can absolutely add South Africa to the Lync Optimizer. I will post a comment here when its ready. Either that or keep checking back.

      Ken

      Delete
    2. South Africa is now added to the list of countries supported by the Dialing Rule Optimizer.

      Ken

      Delete
  3. Can you add Pakistan on that list ..?

    ReplyDelete
    Replies
    1. Farrukh,
      I can do create Pakistan dialing rules, but I would need you to create translations for words/phrases I use for rule names etc. If you provide your email address, I will send you what I need.

      Ken

      Delete
  4. HI Ken, can you add also add China to the supported list? Thanks!

    ReplyDelete
    Replies
    1. Hi Anonymous,
      I can create China dialing rules, but I would need you to create translations for words/phrases I use for rule names etc. If you provide your email address, I will send you what I need.

      Ken

      Delete
  5. Hi Ken,
    Can you please add India dialing rules? Please let me know if you want any information.
    Thanks

    ReplyDelete
  6. Hi Ken
    When I press for Malaysia, it shows error messenge as below
    ==================================
    Microsoft VBScript runtime error '800a01a8'
    Object required: 'Node'
    /process.asp, line 2272
    =================================
    Currently I am planning to use my home phone as the test lab, you think is ok?

    ReplyDelete
    Replies
    1. Which area are you trying to use? I've tried a few different areas in Malaysia and the Optimizer ran fine.

      Ken

      Delete
    2. I'm in Selangor area but we share the same city code with Kuala Lumpur with is 3
      For normal home user with single phone number, is it possible to apply with this dialing rules?
      Thanks in advance, Ken

      Delete
    3. Did you see a big warning message show up on the screen that said "WARNING: JAVASCRIPT NOT DETECTED! THIS WEB PAGE REQUIRES JAVASCRIPT FOR PROPER FUNCTIONALITY"??? That's why it didn't work for you. Try adding lyncoptimizer.com to your Trusted Sites zone in Internet Explorer or enable Javascript. You should have seen a drop-down list of all the area codes in Malaysia.

      And yes you can use the Optimizer in your home lab.

      As a total aside, my wife's Malaysian father just visited us. He lives in Petaling Jaya. Was there 3-4 years ago.

      Ken

      Ken

      Delete
    4. Hi Ken
      I think I mess up with my Lync server, I will redo my Lab again.
      When I first visit your website, I was thinking how come you assign Malaysia in the list instead of Singapore.
      Singapore is a well known country, lots of time when I introdue to some foreigner friends, they will only understand that Malaysia is a country North to Singapore.
      But now I understand why.
      I also marry a foreigner, but is from China

      Delete
  7. Hi,

    is it possible to add Saudi Arabia(+966) in lync optimizer..?

    nadeem@tadawigroup.com

    ReplyDelete
  8. Hi Ken,

    can you please Mexico to your Lync Rule Optimizer country list?
    Would be great!

    Thanks a lot

    ReplyDelete
    Replies
    1. I've looked into it in the past, and Mexico is a very special case with the way that mobile numbers are dialed. I do have an idea on how to manage it, but I haven't had the time to implement it yet.

      Ken

      Delete
  9. Hi Ken,

    Could you possibly add New Zealand (+64) to your Optimizer please?

    Regards

    Duncan

    ReplyDelete
    Replies
    1. Hi Duncan,
      New Zealand is one of those countries like US/Canada where there isn't any rhyme or reason to whether or not a number is local or long distance (correct me if I'm wrong). So, unless there's a good source out there that keeps track of it, like localcallingguide.com, there isn't much I can do. If there is a way to do it easier, please enlighten me and I'll do what I can.

      Ken

      Delete
  10. can you please add oman (+968) in lync optimizer..?
    prasad

    ReplyDelete
    Replies
    1. Sure thing,
      Shouldn't take all that long either. :)

      Ken

      Delete
  11. We are implementing Lync 2013 in house and it's been an interesting learning experience. Your blog has been a great help. Could you please add Kenya (+254)

    ReplyDelete
  12. Thanks ken! Ive done a load of Lync EV deployments now and for some reason have not used your optimizer before. I just gave it a try and its saved me soooooooo much work. Thank you !!!

    ReplyDelete
  13. Dear Ken, could you please add Azerbaijan +994 country and Baku (12) city , to the lyncoptimizer.com site. We have some problems on defining dialing plans

    ReplyDelete
  14. Dear Ken, Thanks for the great post. In the article you mention using e.164 format in AD. Is it worth clarifying which fields you are referring to e.g work tel number field in AD or line uri field in Lync control panel or indeed both. Thanks

    ReplyDelete
    Replies
    1. Hi there,
      The LineURI field in Lync should always be in E.164 format. While it isn't critical that the numbers in AD are formatted to E.164 format, you should use the Company_Phone_Number_Normalization_Rules.txt to make sure they are stored in the address book as E.164.

      Delete
  15. Hi,

    I am trying to save phone numbers in the same format in both places (lineuri and AD), but I get event 21034 for numbers with format:

    +54119999(\d{4})$;ext=3(\d{4})$

    ReplyDelete
    Replies
    1. You have too many $. The $ should be at the end of the string:
      +54119999(\d{4});ext=3(\d{4})$

      Delete