Freepbx 2.5 and Exchange 2010 MWI

I have intergrated Exchange 2010 with Asterisk 1.6 / Freepbx 2.5. Everything works without issue, except MWI. I have certain extensions using Asterisk for VM and the rest is getting forwarded to Exchange. I’m posting the code below incase it will help anyone else.

My actual question is; does anyone else have Exhange 2010 working with MWI?

Add to: /etc/asterisk/extensions_override_freepbx.conf
[macro-exten-vm]
exten => s,18,GotoIf($["${EXTTOCALL}"=“10”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“11”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“12”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“13”]?100)

exten => s,n,NoOp(Call Sent to Microsoft Exchange VM)
exten => s,n,SIPAddHeader(Diversion: ;reason=no-answer;screen=no;privacy=off)
exten => s,n,Dial(SIP/998::::[email protected])
exten => s,100,NoOp(Call Sent to Asterisk VM)
exten => s,101,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})

Hi,

could you please send me the configuration how you had connected asterisk to exchange 2010? i get everytime the following error, when i try to make a call to exchange:

[Dec 14 13:36:50] WARNING[26987]: chan_sip.c:16925 handle_response_invite: Received response: “Forbidden” from ‘“Robert Arbeit” sip:[email protected];tag=as1ad80f5b’

i have running Asterisk 1.6.1.11

Regards
Robert

I am fairly sure you need Asterisk 1.6.2 for the MWI to work.

https://issues.asterisk.org/view.php?id=13028

For my Exchange 2007 UM integration I use the following in sip_general_custom.conf

tcpbindaddr = 0.0.0.0
tcpenable = yes
promiscredir = yes

These settings my SIP trunk in FreePBX

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

And the below to override the macro-vm in 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,2,GotoIf($["${ARG2}" = “DIRECTDIAL”]?4)
exten => s,3,SIPAddHeader(Diversion: tel:${ARG1};reason=no-answer;screen=no;privacy=off)
exten => s,4,Dial(SIP/exchange-vm)
exten => s,5,Hangup

Also if using a version of Asterisk above 1.6.1.7-rc1 DTMF tones probably won’t work with Exchange.

https://issues.asterisk.org/view.php?id=16292

You can apply my patch asterisk-1.6.1.11-constantssrc.patch and add constantssrc = yes to sip_general_custom.conf.

jeffreywfinch,

One part of your post intrigues me…

“I have certain extensions using Asterisk for VM and the rest is getting forwarded to Exchange.” I have everything working, but ALL voicemails are going to Exchange. How did you make it work for just selective voicemails?

Use the code below and in the line #exten => s,n,GotoIf($["${EXTTOCALL}"=“10”]?100)# extention 10 will bypass Exchange. If you want to bypass extension 222 you would use #exten => s,n,GotoIf($["${EXTTOCALL}"=“222”]?100)#. I’m currently bypassing 10-13 in the below example. Hope this helps. If you get the WMI working for Exchange 2010 let me know…

[macro-exten-vm]
include => macro-exten-vm-custom
exten => s,1,Macro(user-callerid,)
exten => s,n,Set(RingGroupMethod=none)
exten => s,n,Set(VMBOX=${ARG1})
exten => s,n,Set(__EXTTOCALL=${ARG2})
exten => s,n,Set(CFUEXT=${DB(CFU/${EXTTOCALL})})
exten => s,n,Set(CFBEXT=${DB(CFB/${EXTTOCALL})})
exten => s,n,Set(RT=${IF($[$["${VMBOX}"!=“novm”] | $["${CFUEXT}"!=""]]?${RINGTIMER}:"")})
exten => s,n(checkrecord),Macro(record-enable,${EXTTOCALL},IN)
exten => s,n(macrodial),Macro(dial-one,${RT},${DIAL_OPTIONS},${EXTTOCALL})
exten => s,n,GotoIf($["${VMBOX}"!=“novm” & “${SCREEN}”!="" & “${DIALSTATUS}”=“NOANSWER”]?exit,return)
exten => s,n,Set(SV_DIALSTATUS=${DIALSTATUS})
exten => s,n(calldocfu),GosubIf($["${SV_DIALSTATUS}"=“NOANSWER” & “${CFUEXT}”!="" & “${SCREEN}”=""]?$
exten => s,n(calldocfb),GosubIf($["${SV_DIALSTATUS}"=“BUSY” & “${CFBEXT}”!=""]?docfb,1)
exten => s,n,Set(DIALSTATUS=${SV_DIALSTATUS})
exten => s,n,Noop(Voicemail is ‘${VMBOX}’)
exten => s,n,GotoIf($["${VMBOX}"=“novm”]?s-${DIALSTATUS},1)
exten => s,n,Noop(Sending to Voicemail box ${EXTTOCALL})

exten => s,n,GotoIf($["${EXTTOCALL}"=“10”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“11”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“12”]?100)
exten => s,n,GotoIf($["${EXTTOCALL}"=“13”]?100)

exten => s,n,NoOp(Call Sent to Microsoft Exchange VM)
exten => s,n,SIPAddHeader(Diversion: tel:${EXTTOCALL};reason=no-answer;screen=no;privacy=off)
exten => s,n,Dial(SIP/998::::[email protected])
exten => s,n,Macro(hangupcall)

exten => s,100,NoOp(Call Sent to Asterisk VM)
exten => s,101,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})

Asterisk MWI works with Exchange 2010 if you use the patch provided in https://issues.asterisk.org/jira/browse/18762

jeffreywfinch, thank you for your code.

I have Asterisk hooked up to Exchange so I can leverage the Exchange auto-attendant, have email and calendar read via phone, etc. I’m wondering though if it’s worth it to store the voicemails on Exchange. Here are the pros and cons that I can think of:

PRO of storing VM on Exchange 2010

  • Exchange will transcribe the voicemail as part of the email.
  • If you delete the emailed voicemail attachment, it deletes the voicemail on the system.

CONS

  • No web interface for the user.
  • Less of an ability to record alternate greetings?
  • Harder to set-up *97 to call voicemail

For the people that have done this or thinking of doing this, do you think you gain that much by having Exchange be the voicemail system?

Exchange UM is pretty cool but the licensing cost for my organization was outrageously high. I am currently looking at using FreePBX Vocemail with IMAP storage and using Exchange as the IMAP server.

I’ve been using Exchange 2010 since it was released. I would like to give another perspective on your CONS.

  1. From a pricing perspective, all you need for UM is an Enterprise CAL instead of a Standard. The cost difference is small and most medium to large organizations already need an enterprise call for other reasons.

http://www.microsoft.com/exchange/en-us/licensing-exchange-server-email.aspx#Exchange2010CAL

  1. For a web interface you can use OWA, which gives a feature rich GUI to configure all you UM features. You can simply configure many different option for call routing and custom recordings.

http://www.microsoft.com/exchange/en-us/outlook-web-app.aspx

  1. I’m not sure whats hard about the *97. If you having issues I can probably explain how I set it up.

PRO

  1. One really cool feature you didn’t mention is the voice control when you enter your voice-mail account. You can have it read email, reschedule meeting, assign tasks.

http://www.microsoft.com/exchange/en-us/unified-messaging.aspx

I agree that the Exchange UM is feature rich.

I am surprised to hear you say that the cost difference is small for an Enterprise CAL. From what I understand, you actually need a standard and an Enterprise CAL to achieve UM. Our price was high and it was recurring every year.

brendanh - We have the Enterprise CAL (no need to buy both), and it’s a one time purchase. Unless you buy “software assurance” it’s not a recurring fee.

jeffreywinch - thanks for the info. I have Asterisk connected with UM for Outlook Web Access, but I was trying to figure out if I should also use Exchange for the voicemail functionality. Based on your response, I will. Also, can you tell me how you set-up *97 to access the Exchange VM? I have some users that will still use Asterisk VM because they don’t have an exchange 2010 account. Thanks.

I used 998 and 999 for my two pilot points in Exchange.

Create a TRUNK to Exchange:
Trunk Name: TRK-MSX
Peer Details:
type=peer
host=192.168.0.58
qualify=yes
transport=tcp
context=from-internal
canreinvite=no
nat=no
insecure=very

Feature Code
Disable *97 and *98

Create Outbound Route and Place it first in Route Order
Trunk Name: OUT-MSX
Create 4 separate dial patterns

  1. Match Pattern: 998
  2. Match Pattern: 999
  3. Prepend: 998 Prefix: *97
  4. Prepend: 999 Prefix: *98
    Trunk Sequence: TRK-MSX

Create Two Misc Destination so you can use these in an IVR
MSX Attendant 999
MSX VoiceMail 998