Lync not populating contact cards phone numbers from Active Directory (Or: How to normalize AD phone numbers for Lync Server 2010 and 2013)

Standard

** This article also works for Lync Server 2013!

 

You’ve seen it. The contact card in Lync shows you everything you entered in Active Directory, except for phone numbers. even when you know you have them there!

This can be quite frustrating, especially if you’re not yet connected with enterprise voive and clients want to pull all the relevant information from Lync during an IM session, including the other side’s phone numbers.

Here’s what you get:

Instead of seeing the relevant phone numbers from Lync like here (sort of…)

You’re getting a card that has no phone info what so ever:

As you can see, ‘test’ Springsteen here, has no phone info in his contact card.

Let’s take a look at Active Directory, see what’s configured there:

This can’t be right! All the information is there! Home, Mobile, even the Office phone is there.

How can we resolve this issue, even without implenenting Lync Enterprise Voice?

Let’s take a look at the event viewer to get some help.

If you scroll down the Lync server logs in event viewer, you’ll probably see event number 21034 generated by LS Address Book Server. It will tell you something like this:

“One or more phone numbers failed to normalize.

‘X’ total numbers failed to normalize.  They are listed in the text file: ‘\\<Lync Server Name>\<Lync Share>\1-WebServices-1\ABFiles0000000-0000-0000-0000-0000000000000000000-0000-0000-0000-000000000000\Invalid_AD_Phone_Numbers.txt’ Cause: One or more phone number attributes in Active Directory contained text that could not be normalized.  Normalization rules are contained in the optional Company_Phone_Number_Normalization_Rules.txt file located in the output location or in the generic rules built into Address Book Server.  Refer to the documentation for a description of the built-in generic normalization rules.  Use the ABServer -dumpRules command to see all the rules that Address Book Server is currently configured with.”

It looks like this:

If you press the path in the event propertis or browse to the file location in your server (always in the same place, in the same name), you will see the following:

What you get here is a list of the users and they’re phone numbers you thought were ok.

Why is this happening?

Well, Lync expects all the phone numbers in your AD to be in the E.164 format, meaning they should be +1-111-11111111 etc. If they’re not like this (as the example above shows us), you will have to normalize them if you want Lync to publish them.

How can I fix this?

Quite easily, to be honest. If you continue reading in event  21034, you’ll see the following:

“Either create a Company_Phone_Number_Normalization_Rules.txt file in the output location and make sure it covers all cases found in your Active Directory deployment or fix the invalid phone number(s) in the Active Directory record(s).”

You get a free advice – you don’t throw it away, do you? What Lync actually tells you, is to create  a file called “Company_Phone_Number_Normalization_Rules.txt” in the root of the AB folder of your Lync shared folder (Not in a sub folder, not by a different name, EXACTLY this one) – like it shows you here:

In this file, you must enter normalization rules according to your country code and other variables.

I used to freak out when I heard normalization rules, but fortunately the guys at Lync made it quite simple for us: I use the Lync Server Control Panel to generate and test my normalization rules. It’s really easy and fun to use – Just enter the details and copy the results. In the next example I created a rule to normalize our internal numbers:

I copied the “Pattern to match” and the “Translation Rule” from the wizard and copied them one line below the other (in the order they appear at the wizard) to the txt file I created. Note you can add “##” at the beginning of each line if you want to write comments.

This is how my file looks like at the end:

Now, all I have to do is run the “Update-CsAddressbook” command from Lync Management Shell and that’s it.

If you configured the rules correctly – you will see the results in your clients. It might take a while for the clients to download the updates, but eventually you’ll see it works perfectly:

Now you can call Bruce 🙂

Advertisements

35 thoughts on “Lync not populating contact cards phone numbers from Active Directory (Or: How to normalize AD phone numbers for Lync Server 2010 and 2013)

  1. deep

    Hi, thanks for such a wonderfull document. so easy to follow.
    For some reason the normalisation rule wont acept number that are with brackets. For example we have our company number as (555)55555. can you please advise how can I create a normalisation pattern for this?

    • Hi Deep.
      I’m Glad this post was useful for you!
      Since brackets are used in regular expressions, it’s a bit tricky to bypass them… 🙂
      regarding your question: Concidering the only character you have is the brackets, you can use the wild card “[^0-9]” to have Lync read your (555)5555 numbers.
      For example:
      If my numbers are at least 7 digits long and begin with “(555)”, and I want to add a + to them, I will use the following regular expression:
      ^(([^0-9]555[^0-9])\d{3}\d+)$
      With the replace expression:
      +$1
      This will enable the system to read the numbers with the brackets, and will result in displaying the number:
      +(555)5555

      Hope this was helpful,

      y0av.

      • deep

        thanks so much for your help on this.
        I have run into another issue now. I have added the rules as below and it showes the number correctly as expected which is (XXX) XXXXX
        ^(818\d{5})$
        +$1
        ^(801\d{5})$
        +$1
        ^(810\d{5})$
        +$1
        ^(811\d{5})$
        +$1
        and so on…..as we have many site codes.

        The problem I am seeing it whilst getting this pattern correct I tried many options and because of that some Lync contacts are showing as +8181234XXXXXXX meaning it shows thier number but prefixed by other numbers.
        Can you please advise how can I correct this? Any help is greatly appreciated.

  2. deep

    HI,
    so when I click on the phone icon next to the contact I see “WORK” numbers displayed twice for some Lync contacts. (These are not contacts added to my Lync client or outlook)
    1 shows correct phone number with correct format as I was expecting and the other shows wrong number in wrong format.
    So if there is a way to remove or show the WORK phone number only once should fix all issues. Please help.

  3. hi there, i’m having trouble normalising the following number “(08) 6000 7000”, are spaces ignored by the expression?
    i want to remove the 0, and put +61 (so (08) 6000 7000 becomes +61860007000) is this possible at all?

    also deep, have you tried using the ABS config tool? this will allow you to choose which numbers lync displays from active directory.

    • Hi Bob,
      The regular expression for your question will be:
      ^(([^0-9]08[^0-9])(\d{4})(\s)(\d{4}))$
      considering your numbers are always beginning with “(08)”.
      The replace expression should be:
      +61$3$5
      This will take the first group of numbers after the “(08)” and translate it’s first 4 digits, then eliminate the blank space in the middle and paste the next 4 digits of the number, so the final outcome would be:
      +6112345678.
      Note that if the space is not the same in all numbers – it will not work.

      Let me know how this worked for you.

  4. Dr Alex Z

    thank you for that, The best part about it is you took the trouble at the top to remove your number…. unfortunately in the final picture you forgot… i’ll give you a call later 😉

  5. Eugene

    Hi Yoav, can you help me please translate 512-3456 and 5123456. our environtment used both formats in AD. your article helps me resolved this issue. user mobile numbers are now appearing on lync client. thank you.

  6. Tom

    Good afternoon sir. I am trying to get (xxx) xxx-xxxx numbers to display, and I am not sure how to get that to work. Please let me know at your earliest convenience…this is frustrating.

    • Hi Tom,

      If your numbers are presented exactly as you wrote them (for example:(555) 987-1234 with the brackets and the spaces you specified), Please use the following:
      This would be your regular expression:
      ^(([^0-9](\d{3})[^0-9]))(\s)(\d{3})(.)$
      And this the replace extension:
      +$3$5.
      This will result in turning (555) 987-1234 to +5559871234.

      Let me know how this worked for you.

      • Tom

        So far, not so good. I am still seeing the numbers in Lync at “xxxxxxxxxx”, and not (xxx) xxx-xxxx. I wish I understood this a bit more.

  7. Andreas

    Hi y0av! I have issues with translating some swedish national numbers / mobile numbers from the AD. They are not showing up in the Lync contact card.
    They look like this: 08-5555 5555 and I want to translate this into —> +46855555555
    And mobile number: 0734-111 1111 translate them into —> +46701111111
    I suppose they fail due to the spaces… Can you assist me in getting this sorted out with correct translation / Reg exp?
    Br
    Andreas

    • Hi Andreas,

      For your first group of numbers (08-5555 5555), use the following:
      Regular Expression:
      ((0)(\d{1}))(.)(\d{4})(\s)(\d{4})$
      Replace Expression:
      +46$3$5$7
      This will translate, for example, 07-1111 2222 to +46711112222.
      You can use this with any prefix (01, 02, 03… etc.).

      For your second group of numbers (0734-111 1111), use the following:
      Regular Expression:
      (0734)(.)(\d{3})(\s)(\d{4})$
      Replace Expression:
      +4670$3$5
      This will translate only numbers beginning with “0734” and that match the pattern you requested, from 0734-111 1111 to +46701111111.

      Let me know how this worked for you.

  8. Andreas

    Thanx for such a fast answer!
    I did some testing first with Regexhero.net/tester/ and it translated just fine the first group of numbers (08-5555 5555)
    However, when I set it into the “Company_Phone_Number_normalization_Rules.txt”
    I still get this result that is displayed in a file “Invalid_AD_Phone_Numbers.txt”
    Result:
    Unmatched number: User: ‘sip:user.username@domain.se’ AD Attribute: ‘mobile’ Number: ‘0734-55 5555’
    Unmatched number: User: ‘sip:user.username@domain.se’ AD Attribute: ‘telephoneNumber’ Number: ’08-5555 5555′

    Then I just had an overlook of that file to see f there was anything else I’ve done wrong….and found that the profile was not showing extensions for known filetypes…but I could see .txt in the end of the Company_Phone_Number_Normalization, and it was basically having the following name:
    Company_Phone_Number_Normalization.txt.txt
    Sort of double extensions…. 😐
    So I thought I´d found the problem…but I was wrong. Still not normalizing my phone numbers correctly.
    No other dial plans/normalizations are being done in inside of Lync Control Panel, I’m just using the Company -file…
    Running out of ideas here…What is more to check?
    / Andreas

  9. Andreas

    Yes, removed the old file: Invalid_AD_Phone_Numbers.txt
    And then I used : Update_CsAddressBook
    (waited a few minutes to fully apply)
    and…no. Still the same outcome. No normalization.

  10. Urooj

    Dear all i am not able to normalize number please help me in this regard,
    number is +97144056251
    +971 4 4056551
    mobile +971 509196835

  11. Alex

    Looking for help: we have numbers +1 (xxx) xxx – xxxx ext. 123
    How do I normalize this and get it to show up in lync, looking same way

    • You cannot show this kind of syntax in Lync.
      My suggestion to you is to show only the extension number in AD, and normalize the file to display this.

  12. MS Derp

    This is so frustrating, Why can’t the translation match pattern rules be explained, so I could create a custom rule without being flabbergasted. Why did MS Lync setup to normalize common number styles (555) 555-5555 or 555-555-555, and so forth should be auto normailzed, unless someone has really strange numbers then custom rules should have to be created. Another MS fail, out of hundreds I’ve come across in my short time of being a MS server admin. Thats all I want to normalize 555-555-5555… this should have been a default rule…

  13. Nicola

    Sadly in our org we don’t have such a think as a normalised number – staff can use anything from 4 numbers (xxxx), 8 numbers (8xxx-xxx) all the way up to full blown international users.
    Any suggestions?

    • Hi Nicola,
      You can’t (nor shouldn’t if you ask me!) cover every possible numbering types in the world.
      I know many organization struggle with that. What I suggest in this case is to decide what form of numbers you’ll be supporting (e.g. xxxx, 0x-xxxxxxxx, +xx x xxxxxxxx) or whichever you choose, and stick with that.
      Create either a dial plan rule or a number normalization rule for the ones you’ve chosen and align with that.
      That said, I think it will be a lot easier (and wiser) to switch everyone to E.164.

      • Nicola

        Thats fine – I thought I’d ask to see if you knew. I’ll keep plugging away at different variables 🙂

  14. Mac

    Hello Sir..
    I faced partial same issues.. in Office365. in case of E3 works well. but E1 user (they use Lync basic) were not works as like this blogs.

    would you help me?

  15. spragji

    Hi if my company has used the telephone number field in general tab in AD 0123456789 / 0789456123 and not utilised the Telephones tab what options do I have to fix this? This does not effect every person. Some people to not have any number. They are looking to implement Lync on premise. Any help regarding this would be appreciated…Thanks

    • Hi,

      The Telephone number field in the users’ general tab is exactly what you should be using. Only populate the other fields (Home, Mobile, Fax) if you’re actually using them.
      If the numbers are normalized correctly they will be displayed for every user in their contact card.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s