How to integrate Exchange 2010 (or 2007) with Trixbox 2.8
I previously mentioned that integrating OCS 2007 R2 was now possible given that Asterisk 1.6 now supports TCP SIP trunking. I also found myself in a position where I wanted to start testing Exchange 2010 UM without touching my production PBX (which in this case is a Nortel CS1000).
After scouring the blogosphere I found some examples of partial Exchange 2007 UM implementations (some with sipX proxies) and others with subscriber access only.
I decided that I would attempt to undertake the following tasks:
· A full and directly attached Exchange 2010 integration with Trixbox 2.8 – 100% complete
· PSTN breakout with an analogue terminal adaptor – 0% complete
· Finally an OCS 2007 R2 integration with Trixbox 2.8 – 0% complete
In addition I wanted to make a straight forward guide that any Exchange administrator could follow.
Now before I start part one of three (fingers crossed I get to complete the others!) I want to give credit to:
· Ryan Newington – your blog helped me get on my way to voicemail forwarding
· Claude Tambu – also a great source of information
So firstly let me go into the goal in more detail, using Hyper-V R2 (built into Windows Server 2008 R2), I will be running Exchange 2010 UM and Trixbox 2.8 – illustrated below.
Installing Trixbox:
Trixbox comes in a variety of flavours, the “CE” is the community edition and it is free with no commercial support (a support plan can be purchased separately at a later date if you wish). I have written this guide whilst testing against version 2.8.0.1 (stable).
Firstly download the ISO from http://www.trixbox.org/downloads
Next create your virtual machine, whilst Trixbox will run with 256mb of memory I would recommend 512mb. After the VM is created go to settings and remove the network adaptor and replace it with a legacy network adaptor – the default NIC does not function as there are no integration services for CentOS (this is the flavour of Linux used by Trixbox).
Mount the Trixbox ISO previously downloaded and let the install begin…
You should now be presented with the screen illustrated above, press enter to continue.
Next you are asked your keyboard type, then time zone and finally to set a root password (this is the Linux equivalent of “Administrator”). Now sit back, relax and resist the temptation to twitter what you are doing – save that for when it is up and running!
Approximately 30mins later you will be presented with the screen above (for the second time around), this is because during a reboot it has booted again off the mounted ISO. At this point turn off your newly created VM and remove the installation ISO – you can set your media to none. Now re-start the VM and your Trixbox PBX will perform its initial start-up normally.
Congratulations, your Trixbox install has now completed and you will hopefully be presented with the login screen illustrated above.
Your login is “root” with the password you created during the installation.
After login change your IP configuration from DHCP to static by typing “system-config-network”, edit device params, eth0, de-select DHCP and enter a static address – I am using 192.168.10.251. Don’t forget your netmask (mine is 255.255.255.0) and finally default gateway IP (mine is 192.168.10.1). Save, Save&Quit. To run using the new network settings type “shutdown –r now” – this tells your system to shutdown and restart immediately.
No more command line, its web interface from here on in! When you are presented with the login screen your web address should now be displayed correctly – in my case http://192.168.10.251.
Open your browser (I am using IE8 and compatibility view is required); connect to your Trixbox web GUI. To make the required changes switch the admin mode by clicking “switch” on the top right of the web GUI. The default username is “maint” and password “password” – this can of course be changed later.
Before you do anything let’s set Asterisk to allow SIP over TCP, go to PBX and config file editor. This is a method of editing your config files without having to use Linux command line tools such as “nano”. You’ll need to edit the sip_general_custom.conf file located in /etc/asterisk. This file is blank and the following needs to be added:
tcpenable=yes
tcpbindaddr=0.0.0.0
Click update and then go to PBX, PBX Settings, Trunks, Add SIP Trunk. Enter the following details in “Outgoing Settings”:
Trunk Name: Exchange
PEER Details:
host=[IP Address of Exchange 2010 UM Server]
type=friend
insecure=very
transport=tcp
port=5065
context=from-internal
Mine looks like this (so remove any default settings):
Click save and ignore the message telling you that the user context was left blank. Now we will add an associated outbound route. Click “Outbound Routes” and add:
Route Name: Exchange
Intra Company Route: Checked
Dial Patterns:
6666
8800
8888
Trunk Sequence:
SIP/Exchange
My example is below:
Submit your changes and voila, we now have an interconnect between our Trixbox and Exchange.
Setup SIP Extension(s):
I want to now configure two SIP extensions, in my first diagram you can see two X-Lite clients with extension numbers 1001 and 1002. To configure these extensions go to Extensions, Generic SIP Device, Submit. You will now be presented with a whole host of options, the important settings are:
User Extension: [Your telephone extension number – mine is 1001]
Display Name: [Users name – mine is Adam Jacobs]
secret: [a password used by the SIP client]
type: peer
(without this Asterisk will not permit Exchange “play on phone”) Update, this field is not available until you add the extension and go back later and edit the details – Thanks to Benson for this one!
Voicemail & Directory:
Status: “Enabled”
Voicemail Password: 1234
(any password can be used, this is unused but necessary even though we are using Exchange)
Click submit and then follow the same procedure when you create additional extensions destined for Exchange UM.
To test your extension you need a SIP client, as previously mentioned I am using a soft SIP phone called X-Lite. Download from http://www.counterpath.net and configure as follows:
Display Name: [Your display name – mine is Adam Jacobs]
User Name: [Your SIP extension number – mine is 1001]
Password: [Your “secret” set earlier]
Authorization User name: [Your SIP extension number – mine is 1001]
Domain: [The IP address of your Trixbox – mine is 192.168.10.251]
The rest can be left as default and if all goes well your client will register successfully. (see my example below)
Configure Exchange 2010 UM:
As this guide as aimed at Exchange administrators my assumption is that you have already got your base install up and running, I will therefore only cover off your Unified Messaging settings.
In the Exchange Management Console (EMC) go to Organization Configuration, Unified Messaging , New UM Dial Plan.
Name: UM Dial Plan
Number of digits in extension numbers: 4
(I have used 4 but change to suit your needs)
URI type: Telephone Extension
(this type ensures automatic mailbox recognition for your Trixbox)
VoIP security: Unsecured
Country/Region code: 44 [44 is for UK]
My example below:
After creating this plan you need to change some settings, go to properties, Subscriber access and add extension 8800. Then in the Settings tab change the Audio codec to G711.
Now create a new UM IP Gateway:
Name: Trixbox
IP address: 192.168.10.251
(my Trixbox IP)
Dial plan: UM Dial Plan
(this is the plan just created)
Please note upon submitting your UM IP Gateway settings a Default Hunt Group will be automatically created – you do not need to touch this.
Next a UM Mailbox Policy is created:
Name: Trixbox
Associated dial plan: UM Dial Plan
(this is the plan just created)
Almost there, let’s create the Auto Attendant.
Name: Trixbox AA
Associated dial plan: UM Dial Plan
(this is the plan just created)
Pilot identifiers: 6666 click add, then 8888
Check both, create auto attendant as enabled and create auto attendant as speech-enabled.
Within the EMC go to Server Configuration, Unified Messaging, double click your server and go to the UM Settings tab. Add your Dial Plan “UM Dial Plan”
and click ok.
Finally you need to enable one of your mailboxes for Unified Messaging. Go to Recipient Configuration within the EMC and enable Unified Messaging for your intended mailbox. Browse to your Mailbox Policy “Trixbox” and enter the extension number – mine is 1001.
If everything went to plan you should now be able to dial your subscriber access number 8800 from the X-Lite client and get automatically forwarded to your Exchange voicemail box. Likewise if you dial your Auto Attendant on either 6666 or 8888 you should be greeted by “Thank you for calling the Microsoft Exchange Auto Attendant” – if you do then you have followed my guide successfully and you can soon break out the champagne (or tweet your good fortune)!
All you need to do to complete the integration by ensuring Trixbox routes unanswered calls to Exchange and not to its own voicemail system.
Head back into your Trixbox web GUI, PBX, Config File Editor, you need to edit the extensions.conf file located in /etc/asterisk. Specifically the section [macro-exten-vm].
You need to change:
exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
to:
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
exten => s,n,SIPAddHeader(Diversion: <tel:${EXTTOCALL}>\;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
This tells Trixbox to no longer route unanswered calls to its own voicemail but instead send them down the SIP trunk “Exchange” extension “8800” aka the subscriber access number.
So there we have it, Trixbox (or Asterisk 1.6) fully integrated with Exchange 2010. If you have any questions or comments please let me know!
Nice post! Looking forward to giving this a try.
Thanks Adam!!.. this is just what I was looking for..
I installed trixbox 2.8 and clicked on Packages to check for any new updates. I got an error:
The XML response that was returned from the server is invalid
Received: Cannot write to file (cache/outputYumAvailList.txt)
I also saw a notification on the System status window.
Cronmanager encountered 1 Error:
The following commands failed with the listed error
/var/lib/asterisk/bin/module_admin listonline (255)
Added 8 hours, 9 minutes ago
(cron_manager.EXECFAIL)
Would these errors cause any problems in communicating with the Exchange?
Finally, in the section where you’ve given the steps to Setup SIP Extension(s), I couldn’t find the “type” field inorder to set it to “peer”. Is this field listed under Extensions??
-Benson
Hi Benson, thanks for your feedback!
The errors you are experiencing will not have an impact on your Exchange integration – I believe this error is because no update e-mail address is applied. To add one go to PBX, PBX Settings, General Settings (it is located at the bottom of the page and you may need to restart Trixbox for it to kick in!)
The field you are looking for is unavailable until you create the extension. Once created go back and the “type” field becomes available – totally my fault, well spotted!
– Adam
http://blog.allanglesit.com/Blog/tabid/66/EntryId/36/Hyper-V-Guests-Linux-Integration-Components-on-RHEL-and-CentOS.aspx
How to install Linux IC on HyperV
Great Blog. Does anyone know how to configure trixbox to forward an incoming call from an additional trunk i.e Sipgate to Exchange AA??
Hi Adam,
I just finished setting up Exchange 2007 and your guidelines to integrate Trixbox worked superbly!! Thanks a million!!
I used X-Lite and made calls to the Exchange AA to access my email, calendar, contacts etc…
But I couldn’t get the voicemail part working. I modified the extensions.conf file just like you mentioned.\;reason=no-answer\;screen=no\;privacy=off)
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
exten => s,n,SIPAddHeader(Diversion:
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
But all the VMs were still being stored on Trixbox instead of being routed to Exchange.
Did I miss something here? Please help…
Thanks in advance…
-Benson
Hi Adam,
About the comments I just posted, it was actually a stupid mistake I made… I didn’t reboot my Trixbox after editing the extensions.conf file.
Everything works perfectly now as expected. VM’s are being routed to Exchange!
Thanks you so much for posting this. It really made my work a lot easier… 🙂
-Benson
i get a “registration error: 404 – not found” on the softphone any idea?
I configured everythink like the tutorial, but when i call number 8800 ik keep getting the message “the number you’ve dailed is not in service” any ideas?
Thanks
Hi Jeroen,
Thanks for your feedback, now let me see if I can help!
RE: registration error 404, this usually occurs when an extension being registered is not found by Trixbox. Are you using the correct username/extension number and have you committed your Trixbox changes/reloaded?
RE: number you have dialled is not is service, this is a Trixbox error that usually occurs when the remote end of the SIP gateway is not answering. Have you been able to dial any Exchange attendants?
Keep trying and remember Network Monitor/Wireshark is your friend!
is it possible to do this with FreePBX?
Hi Tony,
The PBX component within Trixbox is Asterisk, FreePBX is also based on this open source platform. Providing it has v1.6 for TCP support you should be able to replicate this setup with no issues.
Hi Adam,
the call gets accepted by the exchange server but no Greeting Speech is transfered via the line and Get-UMActiveCalls doesn’t list any calls.
Any idea what’s wrong here?
thanks!
Henrik
Hi Henrik,
Is this still an issue, I saw your thread on the TechNet forums? Here http://tinyurl.com/yj9jase
Hi Adam.
Really thanks a lot a lot for this nice helpful post, in which I can see a lot of good work and thinking, but I’m just like you interested in integrating OCS 2007 with Asterisk as well, please did you get any progress so far in this.
Thanks.
Hi Fady, I have hit a few snag with part 2, the first issue is time! The second was due to voice clarity issues when using a PSTN TA.
I am thinking of reworking this to support Skype for Asterisk. Stay tuned (heopfully we won’t be old and grey by the time I get it done!)
This almost worked for me, except I got 1 way audio…..ONLY when the system transferred the call to voicemail. Dialing the voicemail directly worked just fine. I finally figured out that something Trixbox does in it’s Macro’s is different than just dialing “SIP/Exchange/8800” so I replaced the line:
exten => s,n,Dial(SIP/Exchange/8800)
with:
exten => s,n,Macro(dialout-trunk,4,8800,,)
and now it is working perfectly. The dialout-trunk would ovbiously be different depending on which trunk number your Exchange trunk is assigned by Trixbox, but easy to find in the Global Variables in the extensions_additional.conf file.
Hi Adam,
I just got trixbox 2.8.0.1 and I installed the backup tool package. But when I go there, there is no Restore button that I can do a restore from the backup that I got with my 2.6.
Can you just help me out with this.
Thanks
Truyen
Hi Adam,
When i dial 8800, it is telling me “ALL CERCUITS ARE BUSY NOW”
What is that…
Thanks
Hariom Jindal
I’ve used your advice for forwarding to the Exchange for Voicemail, but I like to see the missed call notifications and to have the exchange AA as the first point of contact. I’ve done this simply by adding the MISC Destination Called ‘Exchange AA’ and 8888 as the Dial entry. Works great as Exchange will go to Trixbox for any call forwarding/routing set in exchange. Now I’m purely using Trixbox for extensions, and Exchange for everything else.
I went through the guide (excellent BTW) and everything seems to be working perfectly except for one thing, after a VM is left for a user through the MS interface it is never delivered or available when the user tries to retrieve it, it keeps saying no new messages. I verified that the message is indeed being recorded by the caller (i.e. playback and UI confirmation that it was sent before hanging up). I was expecting to see the message show up in the users mailbox and be available through the phone for playback. I am 100% sure the message is being left through Exchange UM but as I said it seems to mysteriously disappear after apparently being sent / saved.
Anyone else having this issue?
I get a “Please enter the channel number followed by the pound key” when I dial my UM Auto Attendant extension. I’m pretty sure I followed the setup to a T. Any ideas? Thank you.
Hello,
Thank You for this Manual.
I have a little problem. My Trixbox say “This number is not in Service, please Check your number and try again.
I try all variations of numbers and settings.
have any Ideas ?
Thank You
Best Greetings
Hi there!
The root cause is likely to be related to Exchange not answering the call. Check your Exchange settings and consider running a diagnostic tool such as MS network monitor or ethereal on the Exchange server.
I have set up everything you have outlined and all is working internal with VOIP Phones. I have an issue when someone dials from a PSTN connection it just hangs up and say SIP/Exchange – is busy
Has any body been able to go to VoiceMail from the PSTN?
I have fixed the pstn issue, the only item left that is not working is MWI.
Can anyone help with this?
Thanks,
Cliff
Hi Cliff,
What was the PSTN issue you were experiencing?
Regarding MWI, I’m not sure that Trixbox (or Asterisk) supports the Exchange SIP messaging used for MWI – anyone else care to offer some assistance on this?
Works like a charm! Thanks a ton!
Very cool. Thank you very much for this. It makes demonstrating the complete Exchange 2010 package very easy.
Wheres part 2? Part 1 was great got it up and working no problems with both my 2007 and 2010 UM servers!
Hi Adam,
First off – many thanks for this guide. I finally upgraded my beta version of Trixbox 2.8 to the release version and was dreading trying to get my Exchange UM back up and running but the guide made it really easy.
I did have one real frustrating issue that I thought I would feed back. Having followed the guide to the letter (and checked it a half-dozen times!), I was still getting the “The number you have dialled is not in service” for both my extensions and the Exchange auto-attendant.
Eventually I tracked down the problem to my X-Lite configuration and the fact that the “Register with domain and receive incoming calls” checkbox was unchecked.
As soon as I ticked that box, everything came to life! Perhaps my X-Lite configuration wasn’t “default” as a result of the previous install but I just thought I would draw attention to this in case it helps anyone else struggling.
Thanks again for your efforts.
Scott
RE: PSTN – Asterisk and Exchange
Sorry, for the late reply, but my problem with the PSTN issue was due to CallerID. It appears that you need to have CallerID or either HARD-CODE a number in the extension that DIALS to Exchange.
RE: Asterisk and Exchange
I have discovered another issue that I have no idea on how to correct. It appears that after a few days, the Exchange 2010 UM servers does not answer when dialing any extensions such as 8888, 8800 or 6666. It shows in Asterisk as unreachable and gives a BUSY. As soon as I reboot the Exchange 2010 Server everything works just fine.
Has anybody else experienced this issue?
The exchange 2010 listening port changes from 5065 to 5067 after about a week. I have tried everything I know to add a second trunk that connects on 5067 then set the route to go to 5065 then 5067 in order. After the week goes by and exchange listens on 5067 you have to wait 6 rings before the AA or VM picks up. If there is an easy way to speed up the way Trix goes through the trunks that would great, if anyone knows an easy way to do this, please share. If you know a way to add the voicemail redirect outside of the actual extensions.conf file that would be great because each time you update the core that setting will get wiped.
Figured out a solution, use with caution as your results may vary. Tried with 2 different TrixBoxCE 2.8 servers and it worked well with both.
Instead of naming your trunk Exchange name it Exch5065 and use these settings
host=Your Exchange IP
type=friend
insecure=very
transport=tcp
port=5065
context=from-internal
qualify=yes
Then add a second trunk named Exch5067 and use these settings
host=Your Exchange IP
type=friend
insecure=very
transport=tcp
port=5067
context=from-internal
Make sure NOT to use qualify=yes on Exch5067 or all of your SIP phones will fail to register and if you have a SIP trunk it will fail as well. Not sure why but verified on 2 Trixbox servers and it happened on both.
Now go to your outbound route named Exchange and put the new trunks in at the bottom with Exch5065 first in the list. I was able to make exchange change ports by changing a setting that made the worker process expire sooner and these new settings instantly failed over to 5067 and back without any issues. I did not see it use any ports other than 5065 and 5067.
Now if anyone can help me figure out how to move the voicemail redirect “exten=>” settings from extensions.conf to extensions_custom.conf that would be great. Tried a few things and could not get it to work. Until we figure that our DO NOT update your core in the module manager or you will have to enter those settings again.
Found a solution to both problems hope this helps others out there having problems.
Follow this helpful guide to get your Exchange server ready to receive calls.
When you get to the part where you setup your new trunk use these settings instead.
Name the trunk Exchange
type=peer
host=Your Exchange Server IP
transport=tcp
qualify=yes
In the sip_general_custom.conf file make sure you have all of this.
tcpbindaddr=0.0.0.0
tcpenable=yes
promiscredir=yes
constantssrc=yes
Now instead of doing anything to the extensions.conf file you will edit the extensions_override_freepbx.conf file and add all of the following.
[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:\;reason=no-answer\;screen=no\;privacy=off)
exten => vmx,3,Dial(SIP/Exchange)
exten => vmx,4,Hangup
Now it won’t matter when the helper process changes ports and all of your settings will be in a safe place so they will not get overwritten when you do updates.
I really want to thank the original author for getting us all started in the right direction and the hundreds of forums and blogs that have all the bits and pieces I used to build these settings.
Fantastic article, Adam; thanks a million.
Anyone know of a good starter Gateway device (available in the UK) to allow integration with the PSTN?
Thanks… great tutorial..
Got all working. Call my phone… leave voicemail on the UM server….
Nothing ever hits the inbox. Where does it go?
I can use the voice features to send email within the UM and those messages seem to work okay, but not the voicemails left via a call into the system.
Any quick troubleshooting tips for that?
Ran into a problem with respect to having a queue. Once the changes are made calls to normal extensions work perfect. But calls to a queue play the queue msg and then sends the call straight to one of the extensions that is set to DND.
Any thoughts on how correct that?
Another great thing to add is to setup a DID that will allow you to get direct access to Exchange UM or Outlook Voice Access. This is done by creating an Misc Destination in Trix that points to the number for Exchange such as 8800 in the above setup. Then create a Inbound Route that maps the DID to that Misc Destination.
Here is the link for the quickstart guide for end users for Exchange 2007:
http://www.microsoft.com/downloads/details.aspx?FamilyId=836C5D3C-4C62-414F-B637-AEC14F1D13F1&displaylang=en
Here is the link for the quickstart guide for end users for Exchange 2010:
http://www.microsoft.com/downloads/details.aspx?FamilyID=77f1f82e-5da1-4ab5-9969-d1eb72b2ee0f&displaylang=en
This provides a very powerful demonstration for customers!The following link shows some great demos also for what can be done.
http://www.simplesignal.com/hosted_exchange.php
@Ben
Hi Ben,
I could not get the extensions_override_freepbx.conf file to forward to voice mail. Do any variables need to be provided?
Everything else is working using, and editing the extensions.conf directly worked, although I know that is not the best way. I am using Exchange 2007 if that matters.
Thanks
@Ben
Ben,
I made the changes you suggested on your last post, but when you call another internal extensions and they are not there, it gets a service unavailable (ALL TRUNKS BUSY), and does not go to voicemail?
Have you had this problem?
@Ben
Ben,
I added the below to extensions.conf and the Internal VoiceMail is working:
You need to change:
exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
to:
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
exten => s,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
I have your settings in the trunk setup and the override.conf and added the above and all seems to work for both internal calling and going to vm and external calling going to vm. I no longer gets the BUSY on internal calls going to vm. I can now only wait a week and see if the port changes and if everything continues to work.
Doesn’t the extensions.conf file get overwritten by freepbx? Which is why Ben is suggesting to edit the extensions_override_freepbx.conf file.
@Cliff Larson
Just wanted to post an update, everything is working great now that both of the last two post were done. Thanks for the info.
Anyone get the MWI indicator working? Using Polycom phones and can’t figure this one out. Any info would be appreciated.
Ok I successfully got it to connect and it seems exchange is answering the calls but I can not get logged in. I enter the pin and it keeps telling me invalid pin. Even if i manually set a pin it still tells me invalid. If i dial into the auto attendant and say may name it doesnt recognize the name.
just for the record,
vmx in
extensions_override_freepbx.conf file and add all of the following.
[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:\;reason=no-answer\;screen=no\;privacy=off)
exten => vmx,3,Dial(SIP/Exchange)
exten => vmx,4,Hangup
should be vmbox for this to work properly.
nevermind, this forwards to the trixbox vmail.
ok, I got it working. the config should be
[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: \;reason=no-answer\;screen=no\;privacy=off)
exten => vmx,3,Dial(SIP/Exchange)
exten => vmx,4,Hangup
the was missing from the equation.
Hmmm. the site seems to think that the fix is code I’ll try to post a few more times in different ways to see if i can get it posted.
if this is visiable, remove the \
this goes in front of \;reason=no-answer\;screen=no\;privacy=off)
ok, just add an opening and closing angle bracket to tel:${EXTTOCALL}
Hi,
Very nice post, but I have gone through the steps several times now (vanilla install) and end with the same result – “all circuits are busy”.
Trixbox connects to Exchange the Linksys phones I have connect to Trixbox but when I dial any of the numbers 6666 8800 8888 I receive “all circuits are busy”.
I have installed with Trixbox 2.8.0.3 stable and Exchange 2010 which I have installed from scratch several times with the same result.
Any thoughts/help would be great.
Thanks,
Jeff
@Jeff
You need to change the extension of the users to use peer context instead of friend.
Jeff,
I have run into the same problem you are having, but have since resolved it. Make sure that the firewall on your Exchange server is turned off. (I’m assuming it’s not public facing) I suggest employing network monitoring software if this does not fix your problem. Wireshark came to be my friend today, as I couldn’t figure out why Exchange wasn’t picking up the calls – turns out i needed to restart the UM Service… I just remembered that if you use a FQDN on the trunk, you need to add it to your linux hosts file. (Use the IP of your Exchange server instead)
Best of luck,
Dan
I have set this up as specified, except I have used 3 digit codes 880, 888, 666 as that matches my extenstion (100)
When I left 100 as type friend, I got “all circuits are busy.” When I changed the type of 100 to peer, and then dialed 880 from extension 100, it activated my inbound route: “any DID / any CID” and rang all extensions rather than going across to Exchange.
Any ideas?
Why use port 5065, the UM seams to open up 5060 on the exchnage server ?
I have the same problem, all busy, but have tracked it down to an exchange error
“The Telephony Manager declined a call with Call Id ‘2bac7feb4fa7b74735e44cbb78e0b97c@192.168.0.150’ for the following reason in component speech session: ‘The speech session failed to open: No common audio formats found..’. ”
I did set the Dial Plan to 711, and ive tried the others, what am i missing !
@Smeird
Found the solution, i’m using asterixnow, and needed to unselect all the codecs other than the 711 ones
I have finally got this working, but if the caller’s number is unknown the calls are dropped before going to voicemail. How do I fix this?
Hello Adam,
Great tutorial. However I’m having a problem that is mentioned two times earlier. My voicemails never reach my mailbox.
See a reply from januari 11th in the comment section:
I went through the guide (excellent BTW) and everything seems to be working perfectly except for one thing, after a VM is left for a user through the MS interface it is never delivered or available when the user tries to retrieve it, it keeps saying no new messages. I verified that the message is indeed being recorded by the caller (i.e. playback and UI confirmation that it was sent before hanging up). I was expecting to see the message show up in the users mailbox and be available through the phone for playback. I am 100% sure the message is being left through Exchange UM but as I said it seems to mysteriously disappear after apparently being sent / saved.
Anyone else having this issue?
And a comment posted on april 8th:
Thanks… great tutorial..
Got all working. Call my phone… leave voicemail on the UM server….
Nothing ever hits the inbox. Where does it go?
I can use the voice features to send email within the UM and those messages seem to work okay, but not the voicemails left via a call into the system.
Any quick troubleshooting tips for that?
I’m having the same problem, and I have no idea where to look, because it looks to me that it’s all internal behavior of Exchange. I phone a logged off extension, trixbox nicely forwards the caller to the UM voicemailbox of the logged off extension. Everything seems to be ok, because there’s no errors or nothing. In the end UM even tells me that the message is sent, hoewever it never reaches my mailbox.
Thanks for your help!
Wesley
Hi,
I have followed your guide and all is working apart from VM. I have changed my extentions.conf file to refelect the below but when I ring my extention it is still going through to the Trixbox VM and not Exchange. Any ideas?
; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
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”] | $[“foo${CFUEXT}”!=”foo”]]?${RINGTIMER}:””)})
exten => s,n,Macro(record-enable,${EXTTOCALL},IN)
exten => s,n,Macro(dial,${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,GosubIf($[$[“${SV_DIALSTATUS}”=”NOANSWER”] & $[“${CFUEXT}”!=””] & $[“${SCREEN}” = “”]]?docfu,1) ; check for CFU in use on no answer
exten => s,n,GosubIf($[$[“${SV_DIALSTATUS}”=”BUSY”] & $[“${CFBEXT}”!=””]]?docfb,1) ; check for CFB in use on busy
exten => s,n,Set(DIALSTATUS=${SV_DIALSTATUS})
exten => s,n,NoOp(Voicemail is ‘${VMBOX}’)
exten => s,n,GotoIf($[“${VMBOX}” = “novm”]?s-${DIALSTATUS},1) ; no voicemail in use for this extension
exten => s,n,NoOp(Sending to Voicemail box ${EXTTOCALL})
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
exten => s,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
Hi I have been trying this all week. I am unable to find sip_general_custom.conf I was using the latest stable release and tried 2.8.0.2 but still could not find the file to edit
Got it all sorted reverted to trying some command and just found it. Cheers anyway Guys I will report how i go
I encountered the same problem; i couldnt reach exchange. I looked into the ex2010 configuration and noticed that you have to Add an enrty on server lvl. Navigate in EMC to server configuration/unified messaging and click on your server -> properties -> and go to the UM Settings Tab; click add and select the appropiate dial plan.
Very good tutorial ! thnx
I had the same experience, Instead of excluding the IPs for the servers. I addded the following to the Receive Connector.
• Under Authentication check “Exchange Server authentication”
• under Permssion Groups check “Exchange servers”
This gave the UM server permssion to send via the connector as it attempts to authenticate each time and Anonymous users does not apply.
I am able to dial the exchange um server fine. The um attandant picks up a vm call for an extension and allows the caller to leave a message but i am not getting the message in my mailbox fot that extension. what could be missing?
Awesome tutorial, I was easily able to follow it and adapt it to AsteriskNow. I have the Asterisk/Exchange 2010 system up and running, but I am having 2 issues.
The first issue, is that from Outlook Voice Access, if I ask the system to dial an external PSTN number (i.e. mobile, or home number) from the directory, I get “All circuits are busy”. When looking at the logs everything looks good, until it tries to place the call over our SIP trunk. It receives a SIP 604 response “Does not exist anywhere”, followed up with “Everyone is busy/congested at this time”. I am able to place calls to the PSTN without issue from any endpoint on the system over the same SIP trunk.
The second issue that I am having is that if a user forwards their extension to another extension or external number and someone calls in from the PSTN it always goes straight to the Exchange Vmail. However, if someone calls the same user internally from another extension it forwards properly.
I am working on pulling some logs that I can post to show both of these issues. In the meantime if anyone has any suggestions on these issues I would appreciate the help!
Thanks!
@Stuart
The place where you put that macro is under extension_override_freepbx.conf. Also, there is one line that needs to be commented out or exchange 2010 has a fit when negotiating media. Here’s the correct macro:
; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
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”] | $[“foo${CFUEXT}”!=”foo”]]?${RINGTIMER}:.”)})
exten => s,n,Macro(record-enable,${EXTTOCALL},IN)
exten => s,n,Macro(dial,${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,GosubIf($[$[“${SV_DIALSTATUS}”=”NOANSWER”] & $[“${CFUEXT}”!=””] & $[“${SCREEN}” = “”]]?docfu,1) ; check for CFU in use on no answer
exten => s,n,GosubIf($[$[“${SV_DIALSTATUS}”=”BUSY”] & $[“${CFBEXT}”!=””]]?docfb,1) ; check for CFB in use on busy
exten => s,n,Set(DIALSTATUS=${SV_DIALSTATUS})
exten => s,n,NoOp(Voicemail is .${VMBOX}.)
exten => s,n,GotoIf($[“${VMBOX}” = “novm”]?s-${DIALSTATUS},1) ; no voicemail in use for this extension
exten => s,n,NoOp(Sending to Voicemail box ${EXTTOCALL})
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
;exten => s,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
Superb article………Cleared most of the doubts…………
Thanks buddy…………
@Wesley Levels
hi, Im having the same issue, i never get voicemail in exchange..did you get it to work ?
thank you
Hello,
Great Walk though, i have been able to get 6666, and 8888 to answer just fine, but it seems i cannot get the 8800 to answer i get “all circuits are busy now, please try your call again later”
i have checked everything i can think of, and tried everything from this post, do you have any other ideas??
Thank you
You best starting point would be the Asterisk command line, open a command prompt and type “asterisk -r”. This is excellent for realtime diagnostics.
– Adam
@Karnith
@Dan
Thanks for your input.
It turned out to be a faulty NIC, I replaced it and it all came alive.
Excellent blog, thanks again.
Is there any way to set the Voicemail Desitination options Voicemail-Busy and Voicemail-Unavail to go to the Exchange UM as well?
I would like to introduce IVR/Queue/Ringgroups that when they are unanswered they are transferred into the Exchange Voicemail for the specified mailbox (busy/unavailable). At the moment they transfer to Exchange, but you get the generic welcome “Please enter the extension” instead of “To leave a message for ……”
@Michael
Just worked this out for anyone else that needs this …
You need to copy and past the entire [macro-vm] from extensions_additional.conf into extensions_override_freepbx.conf from PBX -> Config File Editor
Next edit extensions_override_freepbx.conf and make the following modifications:
At the very top of the file below
“exten => s,n,Set(VMGAIN=${IF($[“foo${VM_GAIN}”!=”foo”]?”g(${VM_GAIN})”:””)})”
you add a line
“exten => s,n,Set(EXTTOCALL=${ARG1})”
This should make the beginning of you macro look like the following:
[macro-vm]
include => macro-vm-custom
exten => s,1,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(VMGAIN=${IF($[“foo${VM_GAIN}”!=”foo”]?”g(${VM_GAIN})”:””)})
exten => s,n,Set(EXTTOCALL=${ARG1})
Next, you go further into the macro and look for the s-BUSY s-NOMESSAGE and s-DIRECTDIAL sections and comment out their respective VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}b${VMGAIN}) elements, so each of those lines will look like the following:
; exten => s-BUSY,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}b${VMGAIN})
….
; exten => s-NOMESSAGE,n,VoiceMail(${ARG1}@${VMCONTEXT},s${VM_OPTS}${VMGAIN})
….
; exten => s-DIRECTDIAL,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}${VM_DDTYPE}${VMGAIN})
And below each of those lines add the following
exten => s-BUSY,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s-BUSY,n,Dial(SIP/Exchange/xxxx) /* xxxx here is the extension you configured for exchange, in the examples on this site its 8800 */
exten => s-BUSY,n,Hangup
Chance the s-BUSY to match the NOMESSAGE and DIRECTDIAL elements. It will finish looking something like the following:
exten => s-BUSY,1,Noop(BUSY voicemail)
exten => s-BUSY,n,Macro(get-vmcontext,${ARG1})
;exten => s-BUSY,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}b${VMGAIN})
exten => s-BUSY,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s-BUSY,n,Dial(SIP/Exchange/998)
exten => s-BUSY,n,Hangup
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)
exten => s-NOMESSAGE,1,Noop(NOMESSAGE (beeb only) voicemail)
exten => s-NOMESSAGE,n,Macro(get-vmcontext,${ARG1})
;exten => s-NOMESSAGE,n,VoiceMail(${ARG1}@${VMCONTEXT},s${VM_OPTS}${VMGAIN})
exten => s-NOMESSAGE,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s-NOMESSAGE,n,Dial(SIP/Exchange/998)
exten => s-NOMESSAGE,n,Hangup
exten => s-NOMESSAGE,n,Goto(exit-${VMSTATUS},1)
exten => s-DIRECTDIAL,1,Noop(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
;exten => s-DIRECTDIAL,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}${VM_DDTYPE}${VMGAIN})
exten => s-DIRECTDIAL,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s-DIRECTDIAL,n,Dial(SIP/Exchange/998)
exten => s-DIRECTDIAL,n,Hangup
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)
With all of that set you will be able to create a mailbox under Exchange and enable a UM extension (use the same extension number that you designate for it under Trixbox), set full permissions to the staff members to access that mailbox. And configure your timeout in the IVR/Queue/Group Dial to use the Voicemail -> busy/unavail/no-msg drop down box matching the extension you configured in UM.
I am sure thats all as clear as mud, so hey if anyone wants to rewrite any of that go for it if it makes sense to you 🙂
@Michael
In the examples above, the HTML stripping removes some critical elements. Replace the [ and ] brackets with in this [tel:${EXTTOCALL}] Now that should go on each line after Diversion and before the \;reason so it looks like:
exten => s-BUSY,n,SIPAddHeader(Diversion: [tel:${EXTTOCALL}]\;reason=no-answer\;screen=no\;privacy=off)
(remember in the above example the [ before tel and the ] before \;reason should be replaced with their respective to work.
Screw it, I am talking about angle brackets (greater/less than) above.
Very well done. I have followed the guide in full. without considering the content and its suggestions, all worked fine. Even the voice mail “part”, I am able to leave messages and they transferred/routed to user’s exchange clients.
>> trixbox somehow required a reboot after editing the extensions.conf
Again, thanks.
Hi,
I have an active VoIP (astrisk 2.6.2.2) system in my office and I am using exchange 2010 without any problem, I have done exchange UM configuring follow the guide and review it 3 times but it seems exchange server doesn’t listen to my call from my extension, I had a look at PBX Setting > Panel, there is a list of extensions and trunks, when I pick up the phone and dial a number my extension and mytel trunk’s green light going to become red which means they are busy, but when I dial 8800 my extension turns red but nothing happen to exchnage trunk, I think exchange server doesnt listen to my dial or something wrong in my trixbox
I have tried to use exchange trunk port to 5060,5065 and 5067, unsuccessful.
I changed my extension type to peer, unsuccessful.
I have used IP address in exchange trunk.
I have disabled firewall in my exchange server
I had a look at Msexchangeum.config file and there is just one setting for SIP (UM worker process)key=”WorkerSIPPort” value=”5065 and no setting for SIP (Microsoft Exchange Unified Messaging service)
In netstat -a table seems my exchange server doent listen to any 506X ports.
Please help me.
Cheers,
Ali
Hello.
Great tutorial. I have used it as the solid foundations for my czech version. Have you ever tried to create an IAX extension? I wanted to avoid NAT issues, but IAX account cannot call to SIP or to trunk. SIP can call to IAX. Not sure why. Log says:
[Jul 24 13:59:46] DEBUG[3077] pbx.c: FONALITY: This thread has already held the conlock, skip locking [Jul 24 14:00:06] NOTICE[3109] chan_iax2.c: Host 192.168.2.25 failed to authenticate as 1003
I assume that it must have authenticated itself when it is able to accept calls …
Bye
Jan
Hi Jan,
Thanks for the feedback, I’d love to link to your Czech version? (perhaps you could provide the link). Regarding IAX, I actually have not really tinkered with these, although it seems that IAX extensions have additional parameters within the IAX.conf. Could you share this and I might be able to make some suggestions?
– Adam
Hi Adam,
i can’t get this to work. I tried almost every suggestion in the comments but i can’t get the voicemail redirected to Exchange. I’ve added these lines to the extensions.conf file:
;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS},${IVR_RETVM})
exten => s,n,SIPAddHeader(Diversion: \;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/Exchange/8800)
exten => s,n,Hangup
but when i call an extention, leave it to timeout, then it should go to the voicemail but then i get an “invalid number” tone, and no voicemail. The configured Exchange UM extentions are working just fine, i can call 8800 and 6666 and 8888 and get a voice response from Exchange. But i’m not able to forward the voicemail to Exchange UM (I’m using Exchange UM 2010). Please help! Thanks in advance.
Could you by any chance have the sip.conf and extensions.conf files that were generated as a result of this setup?
Would be most helpful for those of us not using FreePBX (or, in my case, any GUI at all!)
Hi Kamil,
Sorry I don’t and to be honest the Trixbox version of Asterisk does some very stage things to the config files, hence the reason I went for AsteriskNOW. It takes a few hours to get up to speed on the config but once you do it gives you a lot more flexibility and less grief!
– Adam
Hi, there are lots of comments above that talk about what should go in the extensions_override_freepbx.conf file, with subsequent corrections, etc.
Could someone please post or upload what they have? I have everything working, but FreePBX is still taking the voicemail, not Exchange. Thanks in advance!!
I have the setting all configured, and exchange voicemail works well when dialing from a trunk, but when dialing the subscriber access number from internal, exchange doesn’t recognize the extension I’m calling from. Instead it thinks i’m dialing from the subscriber access number after it hands the call off to one of the listening ports.
any ideas?
Hi Steve,
Is the extension defined correctly within A/D?
– Adam
@Ben hi Ben, can you please tell me how did you make Exchange to expire worker process sooner? I added the two trunks that you suggested, but it wouldn’t failover. I supposed it’s the setting that you did on Exchange that did the trick. Please help. thanks in advance.
Hi Adam[master of this Blog],
Thanks a lot for your nice post!
According to the instructions in this site, I could integrate my own Unified Communication environment consists of several Cisco IP Phones and Asterisk with Exchange 2010 UM through trixbox 2.8 successfully, modifying extensions.conf a little and making an additional SIP Trunk setting for A on t.
@topdatbahamas, @JP, @Domenic – Regarding non delivery of voice mail messages left for a user from an outside caller. The issue may be that you need to have the Hub Transport Service installed. This is true even if you do recieve voicemails from inside callers (other extensions) This is definately true if you installed the UM role on a seperate Exchange Server than your Mailbox server. Check the Application Event Log on the UM role server and check http://www.microsoft.com/technet/support/ee/transform.aspx?ProdName=Exchange&ProdVer=8.0&EvtID=1082&EvtSrc=MSExchange%20Unified%20Messaging&LCID=1033 if you’re getting error 1082. I had this problem and rhetorically echoed your frustration for lack of reply on that issue.
You can also check my blog that contains useful tidbits of info for getting various portions of the Exchange UM integration working. http://itwurx.net/blog/?p=116