Building An Exchange Unified Messaging Lab (Part 8)

Posted on Posted in 2010, 2013, asterisk, asterisknow, exchange, pbx, unified messaging, voicemail, voip

In the extended series of blog posts we are looking at creating a unified messaging lab for Exchange Server. So far we have looked at installing a software PBX (AsteriskNOW) and configuring Exchange Server (both 2010 and 2013) to accept calls from our PBX. We have also looked and configuring our PBX to send and receive calls to a SIP provider on the internet.

In this post we will configure our PBX to forward calls for our voicemail access number (8000 and 8500 in the blog series) to the Exchange Servers in the lab. Dialling 8000 will call my Exchange Server 2010 lab and dialling 8500 will call my Exchange Server 2013 lab. If you only have one lab environment, then you only need one set of trunks configured.

Configuring SIP Trunks To Exchange Server 2010 from Asterisk

Login to your FreePBX website and click Connectivity > Trunks and click Add SIP Trunk.

imageThis trunk will be configured with the settings of your Exchange Server unified messaging server and have a name such as “ToExchangeUM5065” for both Trunk Name fields (at the top of the screen and under Outgoing Settings). There are no settings needed under Incoming Settings or Registration. Note that the name of this trunk must match the name you selected when configuring the config file in the previous post. If you set the voicemail macro in Asterisk to use the wrong name it will not be able to forward the call anywhere.

The main part of the settings for the trunk is the PEER Details field. For my lab this reads as follows:

host=w.x.y.z ;IP address of the Exchange UM Server
type=peer
transport=tcp
port=5065
context=from-internal
qualify=yes

This creates a trunk with the IP address of the Exchange UM server, using TCP, over one of the ports that the UMWorkerProcess on Exchange listens on and has the qualify=yes setting to tell Asterisk to check if the server is up and running by connecting to it occasionally and sending an SIP OPTIONS header.

Once your first trunk is created you need to create a second trunk. This trunk has a different name and port. The name (following the above example) can be “ToExchangeUM5067” and the port value reads port=5067. All the other settings are the same.

imageOnce the trunks are complete you need to make the Outbound Routes that will be used to forward calls down this trunk. Click Connectivity > Outbound routes and provide a Route Name and a Dial Pattern and finally the Trunk Sequence for Matched Routes value.

For the Dial Pattern you just need to enter the number that users will call to access their voicemail and for the Trunk Sequence you just need to select the two Exchange trunks that you made earlier. Finally, click Apply Config to have all the changes submitted to the Asterisk config files and to have Asterisk reloaded.

As Asterisk does not do Diversion headers correctly (it looses the caller ID during diversion) I have an another article in this series looks an using 3CX. This different IPPBX does the diversion correctly.

Testing Your Unified Messaging Lab

You should now be able to call another extension, wait or reject that call at the destination, and be routed to Exchange Server voicemail. Once the message has been left the recipient of the call should receive an email with your message. If they click the Play on Phone option in Outlook, then their phone should ring and the message be played to them.

If you get an errors or unexpected results then make your calls whilst watching the server console. Run asterisk -Rv from the console and then make calls. You should see many messages and scrolling back through them, using screen before running asterisk –Rv and CTRL+A and [ to access the screen log, will show you messages containing “SIP/ext is ringing”, “Got SIP response 486 Busy Here”, and many lines further on “Executing [s-BUSY@macro-vm:4] Dial(‘SIP/ext-callID’,’SIP/xxxx&SIP/yyyy’) in new stack”. Either trunk xxxx or yyyy will answer with “SIP/yyyy-CallID answered SIP/ext-CallID”. Four or five more lines should take you to the end of the call log.

My final post in this series looks at doing all the same again, but using a different IP PBX – a commercial one called 3CX, but one that has a fully functioning demo licence for two concurrent calls and so is ideal for building labs with. This is covered in Using 3CX and Not Asterisk and Exchange Server.

6 thoughts on “Building An Exchange Unified Messaging Lab (Part 8)

  1. Interested to know why the two trunks are needed.. since both are setup in the outbound? Is it to ensure that you connect on one or the other port?? If so.. is it really necessary?

  2. @Anon, you need an outbound route so that you can ring the Exchange Server(s) (that is ring it to collect voicemail etc.). But for Asterisk to forward calls to Exchange you need to create a trunk and forward to that trunk. Except Exchange listens on port 5065 for a week and then 5067 for a week, so at any given time Asterisk does not know which port to connect to. Exchange does, and if you connect to 5060 it will redirect you with a SIP redirection to 5065 or 5067, but in the redirection Asterisk looses the recipient number. Therefore Asterisk forwards the call for ext 1234 to 5060, gets redirected to 5067 (say) and then talks to Exchage – but by now its forgotten that its for ext 1234, so Exchange cannot answer the call as it does not know who the call is for.

    So you need to configure voicemail to try 5065 and 5067 trunks at the same time. Whichever one is up will answer, no redirections, so no loss of recipient mailbox number.

    3CX on another page of this blog has a similar issue, it just does not allow redirections to unknown servers and so it fails on redirections from 2013 CAS server to other 2013 Mailbox servers.

  3. Brian,

    You’ve provided good information for getting exchange UM working with Asterisk.

    I’ve got most features working except the Play on Phone. When I click dial for play on phone, Exchange Unified Messaging give me an error that the IP PBX returned the error “Peer to peer endpoint does not support authentication”

    I was wondering if you had any insight into this? They are able to communicate as Asterisk passes unanswered call to exchange for voice mail and my auto attendant is able to dial extension on the PBX.

    1. @Christian,

      I never really tried to get this working. I too had it fail and then other things took over. If you get it working, please feel free to post the answer here.

      Brian

    2. Christian – did you ever find a solution to the issue with peer to peer endpoint does not support authentication? I am experiencing the same issue now. I know it has been over a year, but hopefully you have something!

      I am also seeing an issue where when I call a phone, when the call gets passed off to Exchange UM, there is about a 10 second delay before the voicemail greeting/message plays. If I watch Asterisk logs, I am seeing it create the bridge and then after 10 seconds I get the message about probation passed and setting the RTP source addresses properly which is when the message starts playing. Can’t seem to figure that one out either.

      Any help would be much appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.