Hosted Voice Mail in Office 365 Part 1



This article talks about how hosted voice mail works in hybrid environment. Hosted voice mail means voice mail in the cloud (Office 365) because the user’s mailbox is there. Hybrid means the user is using on premise Skype for Business.

The challenge now that the someone calls a hosted mailbox user (user with mailbox in Office 365) using the on premise Skype for Business infrastructure, and voice mail is to be invoked, how the on premise Skype for Business servers will route the call to Exchange Online (Office 365) and allow the caller to record a voice mail message that is stored on the hosted mailbox (in Office 365).

On premise Exchange UM servers cannot serve users who are hosted in Office 365. Office 365 mailbox users should use Exchange Online UM features and should be enabled for UM there.

Exchange Online UM Issues to solve

When we say hosted user, this means his mailbox is in Office 365. So hosted users cannot use Exchange UM on premise. If they are to use Exchange UM capabilities, then they should be enrolled in Exchange Online UM features.

Saying that, on hybrid model where we have users hosted in Office 365 and others on premise, it is a challenge to have Skype route voice mail messages sometimes to Exchange UM on premise and once to Exchange UM Online. There should be a flag in the user AD object that specifies weather Skype will route the voice mail traffic to on premise Exchange UM or to Exchange UM Online. This attribute is called [HostedVoiceMail].

So now, when Alice is calling Bob whose mailbox is hosted online, and Bob is not answering, Skype on premise will evaluate for voice mail possibilities. It will do that by inspecting the user’s HostedVoiceMail flag. If it is true, then Skype knows that the user is provisioned for voice mail in Office 365. If it is false, then Skype will start evaluate if the user is provisioned for on premise UM solution by trying to see if he is UM enabled and what UM dial plan he is member of.

So we have figured out how Skype can route to voice mail in the cloud and to voice mail on premise systems. Next is how will Skype initiate traffic to Exchange Online UM Services? There should be a way for Skype to know the server name for Exchange Online UM. This is where HostedVoiceMailPolicy comes to play. It tells Skype servers the DNS name to route the traffic to deliver voice mails in Office 365.

Finally, Skye front end servers do not manage SIP connections outside the corporate network, so there should be a way for the Skype front end servers to ask Skype Edge servers to open SIP traffic to Exchange Online  UM. A Hosting provider is Required in order for the Edge Server to forward Voice Mail calls to O365.

Condition to make hosted voice mail work

  1. User should have [HostedVoiceMail]equals to true usingSet-CSUser.
  2. The user should be enabled for Enterprise Voice on premise.
  3. User should havebeen assigned[HostedVoiceMailPolicy] using Set-CSUser. If this value is empty, then the global HostedVoiceMailPolicy will apply.
  4. Hosting provider Should be defined in Skype in order for Edge to route traffic to Office 365 using New-CsHostingProvider
  5. Configure EDGE for federation and DNS Server routing using Set-CsAccessEdgeConfiguration.
  6. Make sure is marked as Authoritative domain in Exchange Online Admin interface and not internal relay or nothing will work.
  7. Create at least one UM dial plan in Exchange Online.
  8. Enable the user for Exchange Online UM and assign him to UM dial plan.
  9. Connect Office 365 UMmailboxpolicy with On Premise Exchange UMmailboxpolicy. This will enable us to move already on premise Exchange UM enabled users to O365 without first disabling their UM settings, and also preserving the user’s PIN  settings.

Step 1

First thing to do is to give a tip to Skype for Business servers that this user has a voice mail in the cloud, so that Skype for Business will not waste time and try to allocate on premise UM servers to handle the voice mail traffic.

This is done by setting HostedVoiceMail attribute for the user:

Set-csuser –identity “ammarh” –hostedvoicemail $true

This will also light the voice mail icon on Skype client.

Note: You may run into an error when running this command [Set-CsUser : HostedVoiceMail property contains a value that is not recognized by Skype for Business Server.]

This will happen to users that are created after we installed the Skype for Business Server. The command will actually succeed, so if you run Get-CsUser you will find that the -HostedVoiceMail is now $true

The reason why this is happening is mentioned here.

Step 2

Hosted Voice Mail is ONLY supported for users who are Enabled for Enterprise Voice. In order to ensure all Voice Mail features for Users work accurately you need to ensure they are enabled for EV on Premise.

Step 3

Now that the Skype for Business knows that Ammarh has hosted voice mail, the next thing to do is to know how to reach that voice mail. The way to do that is via using Hosted Voice Mail Policy. This is nothing but a routing information to tell Skype how to each cloud voice mail system.

Hosted Voice Mail Policies can be Created at Global level, Site level, and at user level. The good news is that in every organization, there is an existing Global Hosted Voice Mail Policy created in advance for us. By default, each SIP user is already assigned to the Global Hosted Voice Mail Policy. If we type Get-CSUser and we inspect the HostedVoiceMailPolicy, we will find that it is empty. This means that the user is using the default global hosted voice mail policy.

There can be only on Global hosted voice mail policy, and in our case, we will just configure it instead of creating user based policy and having to apply it individually to users.

To configure the default global HostedVoiceMailPolicy:

Set-CshostedVoiceMailPolicy -Identity Global -Description “Global Hosted VM Policy for All Users” -Destination -Organization

Note that:

  • Destination should always be, as this is Office 365 UM service.
  • Organization should be and not

Claude is using cloud hosted voice mail, and he is using the default global hosted voice mail policy because the value is empty

Step 4

We need to help Skype EDGE route traffic to Office 365. To do that, we need to configure a hosted provider.

When running Get-CSHostingProvider, we found that there is already hosting provider for both Exchange Online and Lync Online, so what we did is we configure it to match the following:

It is worth noticing that the previous value for the Exchange Hosting Provider (Verification Level) was AlwaysVerifiable, but we change it to UseSourceVerification according to Microsoft documentation.

The Proxy FQDN Field should always be pointing to for every customer. The Enabled and EnabledSharedAddressSpace parameters should always be set to TRUE for every customer.

Reference article is here.

Step 5

Now it is time to configure the Skype Edge servers to support connecting to Exchange Online.

Type: Get-CsAccessEdgeConfiguration

Then run:

Set-CsAccessEdgeConfiguration -AllowFederatedUsers $true -EnablePartnerDiscovery $true -UseDnsSrvRouting

Edge Configuration to support hosted voice mail.

Step 6

Make sure is marked as Authoritative domain in Exchange Online. It took us coupe of days trying everything just to find out that it was set to InternalRelay. By default, is configured as authoritative domain. We changed it to Internal Relay because we opened a case with Microsoft regarding Email moderation problem between people in O365 and on premise. The escalation engineer started to talk about arbitration mailboxes and advise us to convert that domain to InternalRelay.

Once we changed the domain back to Authoritative domain, everything start working. The devil is in the details indeed !

Step 7

Now it is time to create a dial plan in Office 365. This is easy step, and we decided to create UM dial plans on O365 that matches the name of UM dial plans on premises.

Now, it is not a requirement to have same names between UM dial plans in Office 365 and on premise, but doing that has one and only one advantage that I will discuss here.

As we are in the case of migrating user from Exchange On Premise to Exchange Online and since the user is already enabled for UM On Premise, then to Enable him for UM in O365 you have two options.

Option 1: You can disable UM for the User on the ON Premise Exchange server and then Move his mailbox to O365 and then Enable him again For UM on the O365 Portal following the same instructions as described above.

Option 2: If you Do not wish to Disable and Re-enable the user for UM and would instead like him to stay UM Enabled while you are moving the users Mailbox then to do this you have to create the same Dial plan and Mailbox policies as you use on the ON Premise Exchange UM set up in O365 and then you can move the User with his UM settings to O365, this way his UM extension and Pin will remain the same.

The procedure for this is described very well here 

So How to create the dial plan?

I have a script that can do this:

New-UMDialplan -Name “LOC801” `
-URIType SipName `
-NumberOfDigitsInExtension 4 `
-CountryOrRegionCode 1 `
  -AccessTelephoneNumbers “+88118801”

sleep 10

Set-UMDialPlan -Identity  “LOC801” `
-DialByNamePrimary FirstLast `
-DialByNameSecondary LastFirst `
-PilotIdentifierList  “+88118801”

 Get-UMMailboxPolicy -UMDialPlan “LOC801”  | Set-UMMailboxPolicy -PINLifetime Unlimited

Step 8

From Exchange Online, you can enable the user for Exchange UM.

Step 9

Now, if a user is on premise mailbox user with Exchange UM enabled. If we want to move his mailbox to Office 365, we need to disable his UM settings, move him to Office 365, and then enable him again in Exchange Online UM.

This does not be the case if we do an extra step. For this to work correctly, you need to “map” the UMMailboxPolicy objects in the source forest to the UMMailboxPolicy objects in the target forest

We can avoid that if we have the same name for the UMMailboxPolicy in both source and target environment. Else, we need to do the mapping by running the following command in Exchange Online:

Set-UMMailboxPolicy -identity “Policy B” -SourceForestPolicyNames “Policy A”

Where Policy B is the UMMailboxPolicy in Exchange Online, and Policy A is the UMMailboxPolicy on Exchange on Premise.

Reference Article is here.

Outlook Voice Access and Subscriber Access

In order to have Outlook Voice Access capabilities for hosted users (in Office 365) we need to assign a subscriber number in each Exchange UM Dial Plan in Office 365. Each Exchange Dial Plan should have unique subscriber access number.

Saying that, we need a contact (a.k.a RTC Contact) to be created on premise to map to each subscriber number we create in Office 365. To do that, two steps need to be done:

  1. Create contact object on premise using New-CsExUmContact
  2. Assign hosted voice mail policy to that contact.

If you read previous related article about how Exchange and Lync integrates, you know that those contacts are using to map an extension to SIP URI, and to enable Skype to discover where to route the traffic going to the subscriber number.

Suppose we have a dial plan in Exchange Online with Subscriber number +9626551333. Now we need to create on our on premise system a contact using this command: from Skype on premise Shell:

New-CSExumContact -displaynumber +9626551333 –sipaddress -registrarpool -ou “OU=RTC Special Accounts,OU=Lync Accounts,OU=Service Accounts,OU=Network Management,DC=contoso,dc=com”

Going to AD, we can see that object getting created.

You can see the display name is an ugly GUID number but this is fine.

Now, remember when we talked about hosted voice mail policy, and we decided not to create one because we will be using the built in already created default global policy? Well I am not sure if this default policy will apply to this newly created object, so what I did, is to create a user based hosted voice mail policy and apply it to that contact by running:

New-CsHostedVoicemailPolicy -identity Office365UM -Destination -Description “Office 365 Voicemail” -Organization “”

and then assign it to the created contact:

Grant-cshostedvoicemailpolicy –identity “CN={9522170e-9140-462e-b0f5-5efde255d355},OU=RTC Special Accounts,OU=Lync Accounts,OU=Service Accounts,OU=Network Management,DC=contoso,DC=com” –policyname Office365UM


So all looks good, but to change the name of the contact instead of this ugly GUID, I have created the following script to do that:

$DisplayNumber = “+88118801”

$Sipaddress = “”

$Pool = “”

$Description = “O365 EXO Subscriber Access Number [OVA] for 801”

$UMContact = New-CSExumContact  -Description $Description `
-DisplayNumber $DisplayNumber `
-SipAddress $SipAddress `
-RegistrarPool  $Pool `

Start-Sleep 20

Set-ADObject -Identity $($UMContact.Identity.DistinguishedName) `
-DisplayName “Outlook Voice Access $code”

Rename-ADObject -Identity $UMContact.Identity.DistinguishedName `
-NewName “Outlook Voice Access $code”

Start-Sleep 20

Grant-CsHostedVoicemailPolicy -Identity “Outlook Voice Access $code” `
-PolicyName Office365UM

Auto Attendant

This is now an easy one to configure. It is the same as Outlook Voice Access subscriber number, but now when creating the contact object using New-CSExumContact , we will use the [-AutoAttendant $true]

Reference article for this command is here.

Leave a Reply

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

You are commenting using your 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