Home > Asterisk, Linux, VOIP > Asterisk 1.6, FreePBX and Exchange UM

Asterisk 1.6, FreePBX and Exchange UM

February 28th, 2010

Setting up Asterisk 1.6.1 and FreePBX 2.5 or 2.6 to work with Exchange 2007 UM is easier than Asterisk 1.4 thanks to Asterisk 1.6 including support for SIP over TCP. However only Asterisk 1.6.1.4 and lower work without modification.

The ability to redirect according to Moved Temporarily response from Exchange UM broken in version 1.6.1.5, and security releases 1.6.1.6, 1.6.1.8, and 1.6.1.9. It was resolved in version 1.6.1.7-rc1, but the “when changing sources, don’t generate a new SSRC” commit broke DTMF in 1.6.1.7-rc2. You are supposed to be able to set constantssrc=yes in sip.conf to bring back the old behavior, but that setting is lost after the redirect from the moved temporarily response. I submitted an issue and came up with a patch against 1.6.1.11 that is pending testing. It should apply against version 1.6.1.10 or newer and the 1.6.2 branch.

If using Asterisk 1.6.1.10 or newer start by applying the patch

cd /usr/src
wget http://www.excaliburtech.net/wp-content/uploads/2010/02/asterisk-1.6.1.11-constantssrc.patch
cd /usr/src/asterisk-version
patch -p1 < ../asterisk-1.6.1.11-constantssrc.patch

Open the FreePBX WebGUI and create a new SIP trunk. For outgoing enter exchange-vm as the trunk name and paste the following into the peer details. Make sure to change the host to your Exchange UM server. Leave the incoming settings blank.

type=peer
host=10.9.1.13
transport=tcp
qualify=yes

You will also want to make an Outbound Route with the internal extension you wish to use to dial into voicemail. Make sure to check Intra Company Route and select SIP/exchange-vm for the trunk. For external access create a Misc Destination that dials that extension and point an Inbound Route to it.

Next we need to enable TCP SIP, redirects, and constant ssrc support in Asterisk.

vim /etc/asterisk/sip_general_custom.conf
tcpbindaddr = 0.0.0.0
tcpenable = yes
promiscredir = yes
constantssrc = yes

Since we won’t be using the FreePBX voicemail we need to override the macro to forward calls to Exchange UM. When creating users in FreePBX you still need to select Enabled for voicemail and supply a dummy password.

vim /etc/asterisk/extensions_override_freepbx.conf
[macro-vm]
; ARG1 - extension
; ARG2 - DIRECTDIAL/BUSY
; ARG3 - RETURN makes macro return, otherwise hangup
exten => s,1,Macro(user-callerid,SKIPTTL)
 
exten => s,n,GotoIf($["foo${DB(${BLKVM_OVERRIDE})}" != "fooTRUE"]?vmx,1)
exten => s,n,Noop(CAME FROM: ${NODEST} - Blocking VM cause of key: ${DB(BLKVM_OVERRIDE)})
exten => s,n,Hangup
 
exten => vmx,1,GotoIf($["${ARG2}" = "DIRECTDIAL"]?3)
exten => vmx,2,SIPAddHeader(Diversion:<tel:${ARG1}>\;reason=no-answer\;screen=no\;privacy=off)
exten => vmx,3,Dial(SIP/exchange-vm)
exten => vmx,4,Hangup

If you would like to be able to transfer calls directly to somebody voicemail box you can add the following. It works by pressing ##407, the 4 digit extension, then wait a few seconds or press #. If you have differently length extensions you will need to modify it slightly.

vim /etc/asterisk/extensions_custom.conf
[from-internal-custom]
; Blind transfer call to voicemail with ##407XXXX
exten => _407NXXX,1,Noop(Transfering call to voicemail box ${EXTEN:3:4})
exten => _407NXXX,n,SIPAddHeader(Diversion: <tel:${EXTEN:3:4}>\;reason=no-answer\;screen=no\;privacy=off)
exten => _407NXXX,n,Dial(SIP/exchange-vm)
exten => _407NXXX,n,Hangup

If you are using FreePBX lower than 2.7 you might want to apply my FreePBX Caller Initiated Blind Transfers patch.

Lastly we need to configure Exchange UM. I’m not going to go into detail as there are numerous articles on this. Just make sure that you have added a UM IP Gateway that points to your Asterisk box’s IP.

Asterisk, Linux, VOIP , , ,

  1. Ryan S
    | #1

    Do you know how to get transfers working with asterisk 1.8? Everything works for me except for transfers. It says it is going to transfer and then just hangs up.

  2. | #2

    @Ryan S

    SIP REFER transfers are broken in Asterisk 1.8. See issue 18185 for the solution. I am using the patch from reporter job for now. Asterisk 1.8.2 should have the official fix as 1.8.1 missed the SVN commit.

  3. A Ghatit
    | #3

    So, not everyone of my users has an exchange mailbox, so I don’t want Exchange picking up all the voicemail – I want Exchange to pick up most, and I want Asterisk to pick up the rest. Do you know how that could be configured?

    Thanks.

  4. | #4

    This artical was helpful. I’ve also written a blog with a collection of tidbits of information to assist you with integrating Exchange 2007 or 2010 with Elastix, FreePBX and/or just plain ol’ Asterisk
    http://itwurx.net/blog/elastix-2-2-with-exchange-2007-sp3-unified-messaging-integration-asterisk/

  1. | #1