Wednesday, February 9, 2011

Asterisk with Exchange 2010 SP1 Unified Messaging

Today I decided I wanted to play with using Microsoft Exchange Server Unified Messaging for voicemail in our Digium Asterisk 1.6.2 deployment.  Already having an Exchange 2010 Deployment all I needed to do was install the UM Component in our Exchange infrastructure and configure everything.

Unified messaging provides voicemail transcription support and automatically delivers the voicemail to the users mailbox with as much information about the caller as possible.  If it is another Unified Messaging enabled user it will include all of their contact info based on their callerid. For example when I call somebody from extension 1593 in asterisk and leave another UM user a voicemail, and I have 1593 configured in UM, they will get my cell phone number, email address, and title along with the transcription of the email and an MP3 of the voicemail.  Slick.

One thing to note is the transcription uses a fair amount of CPU power, it took about 30 seconds for it to transcribe a 30 second voicemail, while fully utilizing a core of a Xeon E5430 processor and 250 megabytes of memory.  If you have a lot of voicemail messages being recorded you may need to watch your system utilization closely.

Install Unified Messaging Component
  • UM Requires the desktop experience pack in Windows Server 2008 R2, so I installed that and rebooted
  • Next, you need to have the Microsoft Server Speech Platform Runtime (X64) installed.  If you run the installer it will tell you to install it, and provides you this link to download and install it.  You must use this link, if you just search for and download the platform run time you will not get the right version and the check will still fail.
  • Finally, if the Windows Firewall service is disabled the install will fail with the following message so make sure the service is set to automatic or manual start.  Thanks to this blog post for helping me figure this one out:
    • The following error was generated when "$error.Clear(); install-UMService " was run: "There are no more endpoints available from the endpoint mapper. (Exception from HRESULT: 0x800706D9)".

    • There are no more endpoints available from the endpoint mapper. (Exception from HRESULT: 0x800706D9)
    • Click here for help...
  • Once you have the prerequisites installed you can install the UM component using your installation media.
  • Once the installation is complete you need to configure UM.
Configure Unified Messaging
  • First you need to create a Dial Plan
  • We use 4 digit extensions and we are in the United States, so I configured the settings accordingly.

  • Now create a UM IP Gateway to point at your Asterisk server, entering the IP Address of your Asterisk box and selecting the Dial Plan you just created.
  • Next I configured the UM Mailbox Policies to use 4 digit pin length instead of the default 6.
  • Finally I configured my Auto Attendant with an extension to provide directory lookups, etc.
Configure Asterisk
  • Next configure your Asterisk server.  You need to add a SIP Peer to sip.conf:
    • [exchangeum]
    • host= <-- IP of your exchange server w/ UM Installed
    • type=friend
    • insecure=very
    • transport=tcp
    • port=5065
    • context=from-ocs <-- Context you want calls that come from exchange to go to.  I pointed it at the same context we use for our OCS/Lync deployment
  • Configure your dial plan to use Unified Messaging for voicemail instead of Asterisk's Voicemail() App.
  • This dialplan will call my phone whenever somebody dials 1593, and if I don't answer on my desk phone, or on Lync (OCS_TRUNK_R2) it will send the call to my unified messaging mailbox.
    • exten => 1593,1,Dial(SIP/1593&SIP/OCS_TRUNK_R2/+2593,25)
    • exten => 1593,n,SipAddHeader(Diversion:<tel:1593>)
    • exten => 1593,n,Dial(SIP/1593@exchangeum)
    • exten => 1593,n,Hangup
Configure Users
  • You can manually configure one user at a time in the Exchange Console, or you can use a powershell script to do it in bulk. I found a useful tool available here to allow you to bulk add users to Unified Messaging.  
  • I modified his tool a little bit to make it simplify deployment, making it take username,extension in a CSV delimited file.  
  • You can see the sample CSV here, and download the modified powershell script here


  1. Hi Andrew, Thanks for the script. Do you Know how to define a specific domain controller for a child domain?

  2. SpanjeR you should be able to specify it.

  3. This comment has been removed by a blog administrator.