Sunday, April 29, 2007

Accessing Exchange 2007 Unified Messaging: Troubleshooting

The most important thing to remember about troubleshooting this setup is to make sure you are only testing one part at a time. I learnt this the hard way! Don't bother trying to find out why you can't call the Exchange Server from Asterisk, if you aren't 100% sure that calls directly from the sipX server to the Exchange Server are working.

Packet Captures - Wireshark

The life saving tool for you is going to be Wireshark (available as a free download from http://wireshark.org/) which is a packet analyzer. Run it on your network to look at the SIP traffic going to and from each endpoint through both of the gateways. You can filter packets in Wireshark using the filter string sip.

When running wireshark, keep in mind that if you are on a switched network, you might only see packets going to and from the computer you are running it on. Using a hub instead is preferable, otherwise, you will need to run wireshark simultaneously on multiple PCs. If you are using VMWare, you can run wireshark in a Virtual Machine, and it will see the traffic going to all VMs on that are running on the host system (provided they are all operating in bridged mode).

Make sure you read my post on understanding the relationship between SIP and RTP. This will make troubleshooting packet captures a lot easier.

SipX Troubleshooting

Read my post on Understanding sipX dial plan configuration files. Make sure that you have confirmed that your dial plan has been merged successfully and ACTIVATED. The most common problems that people contact me about end up being caused by typos and other mistakes in the XML files. Check them all, then double check them, then active the dial plans again just to be sure.

SipX log files can be found in the folder /var/log/sipxpbx/ and the most helpful file here will be sipproxy.log. To get detailed information, you will need to change the logging level to debug from the sipX web interface.

To read the last 40 lines of these files from the command prompt, type

tail -40 /var/log/folder/filename

or to read the entire file, type

less /var/log/folder/filename

If sipX gives you some grief, you can always wipe the database. I had to do this a few times, when I made configuration changes that broke the system, but couldn't actually remember what I changed.

dropdb -U postgres SIPXCONFIG

If you need to restart the sipX services, you can type the following command

service sipxpbx restart

If you forget the superadmin password, you can reset it with the following command line

/usr/bin/sipxconfig.sh --database reset-superadmin

The sipX wiki is a good source of troubleshooting information. Specifically, the pages on configuring dial plans, and troubleshooting ConfigServer.

Asterisk Troubleshooting

Asterisk troubleshoot starts with the Asterisk log files located in /var/log/Asterisk/ with the most useful being the file called full. Use tail and less to view this log file as shown above.

Additionally, you can log onto the Asterisk console by typing

asterisk -vvvr

at the command prompt. Add more 'v's for more debugging information (verbosity).

The Asterisk support pages are a great source of information that I often use when troubleshooting or researching how to do new things with my set up. Voip-info.org has an Asterisk wiki that is also very helpful.

Troubleshooting the Microsoft Exchange Server

As always, the Exchange Server's event logs will contain valuable information in diagnosing problems. You can increase the level of logging by the Exchange UM services by running the following commands in the Exchange Management Console

set-eventloglevel -id "MSExchange Unified Messaging\UMClientAccess" -level expert

set-eventloglevel -id "MSExchange Unified Messaging\UMCore " -level expert

Check out the Technet library for more information on configuring and troubleshooting Exchange UM.

References

The following web sites were used as references for the information presented in this guide.


Feedback

If you have any feedback or comments about these instructions, please feel free to email me, ryan@lithiumblue.com, or leave a comment on this blog. If you have problems with your setup, and have gone through the troubleshooting steps above, email me with a description of your problem, and any relevant packet captures, etc.


Accessing Exchange 2007 Unified Messaging: Part 6 – Configuring Asterisk/Trixbox

------------------------------------------------------
Update: 28/7/2007
Updated with new screen shots, instructions for using Exchange UM for Voicemail and for more appropriately enabling two way communication between Exchange, sipX and Asterisk

Update: 4/10/2007
Changed SIP type definition in extensions from 'friend' to 'peer' to allow Play on Phone to work correctly
------------------------------------------------------

Initial Configuration

Start your Trixbox VMWare virtual machine. Log in as root, with the password trixbox (or password for an older Trixbox 2.0 VM) and change the root password by typing passwd at the command line. Remember this password, as you will not be able to log into the server without it. Unlike with the sipX server, you are not prompted to configure the network card at system start up. Instead, you will need to type netconfig at the command line. When prompted if you want to setup networking, choose Yes and assign a manual IP address to this PC.


You should now check for operating system and package updates by typing the following at the command line.

yum –y update

This may take some time depending on how many updates are needed. There are significantly fewer packages in this distribution, and the update process should only take a few minutes. Once the packages have been updated, restart the server using the following command:

reboot

After the server reboots, open your browser and navigate to the Trixbox server i.e http://asterisk.lithnet.local. You should now see the screen below

To get into administrative mode, click switch up in the top right corner. Enter the username maint and the password password when prompted.

Configuring Voicemail

The first thing you will want to do is configure Trixbox to use Exchange UM for voicemail, rather than its internal systems. To do this we need to install the voicemail module.

Once you have logged into the admin mode, click Asterisk in the top menu bar, and then click on FreePBX. Click Tools on the top menu of FreePBX, then on the left hand side, click Module Admin. Scroll down to the Basic section, and click on Voicemail. Select Install as the action, and press the Process button at the bottom of the screen. When the module has installed, click Setup at the top of the FreePBX menu to return to the main configuration screen.

Now we need to modify the Asterisk configuration file extensions.conf, and we can do this from the Trixbox Admin mode web page by clicking Asterix then Config Edit, followed by extensions.conf on the left hand side.

Locate the [macro-exten-vm] section and comment out the line:

exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS})

so that it reads:

;exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS})

Beneath the newly commented-out line, add the following two lines, replacing 222 and sipx.lithnet.local with the Exchange Subscriber Access number and your sipX FQDN respectively (note the following text has wrapped because of my blog's template, but it should be all on one line in your config file):

exten => s,n,SIPAddHeader(Diversion: <tel:${EXTTOCALL}>\;reason=no-answer\;screen=no\;privacy=off)

exten => s,n,Dial(SIP/222@sipx.lithnet.local|30)

Click the Update button and then Re-load Configs.

Thanks to James Brooks for providing us with these voicemail configuration steps.

Configure the sipX Trunk

When talking about telephony, a trunk is basically a connection between two separate systems. In a traditional PBX, a trunk line is an external line to the PSTN, and an extension is an internal line to a handset. Trunks can be one way, or bidirectional. We need to configure a trunk for each connection we make to another system. In this guide, we will configure a trunk to the sipX system, as well as a trunk to our VoIP provider. Once we have our trunks setup and in place, we can then create routes, which tell the IP-PBX which trunk to use for various types of calls.

Once you have logged into the admin mode, click Asterisk in the top menu bar, and then click on FreePBX. In the FreePBX screen, click Setup in the top menu bar, followed by Trunks on the left hand side. The right hand side has a list of the trunks configured on the system. Click Add SIP Trunk. Enter the details shown below.

Leave Outbound Caller ID blank
Tick Never Override Caller ID
Leave Maximum Channels blank
Leave the Dial Rules box blank
Leave Outbound Dial Prefix blank
In the Trunk Name box, type sipXTrunk
In the Peer Details box type
host=
sipx.lithnet.local
type=peer
canreinvite=no
insecure=invite

context=from-internal 

image

Leave the User Context, User Details and Register String blank, and click Submit Changes.

Please note that while we are leaving the 'incoming settings' section blank, setting the value 'type=peer' above, allows the trunk to be used for both incoming and outgoing calls.

There is a default trunk ZAP/g0 that we do not need. Click on ZAP/g0, and click Delete Trunk g0 on the next screen

Note that after every change you make to the Asterisk configuration, a red box will appear at the top that you click to Apply Configuration Changes. Before testing any call to Asterisk, please make sure you press this button. You don't have to press it after every single change, but the changes you made since you last 'Applied Changes' won't take effect until you do. I'm not going to tell you every time you make a change to press this, so I'll leave it up to you to do this as appropriate.

Configure the sipX Outbound Route

Now we have our trunk (connection) to the sipX server setup, we need to tell Asterisk what type of calls it should forward to it. We do this by means of an outbound route. On the left hand menu, click Outbound Routes, followed by Add Route on the right of the screen. Enter the following information

Type sipXRoute for the Route Name
Leave Route Password blank
Leave Emergency Dialing unticked
Leave Intra company route unticked
In the Dial Patterns box, type [2-3]XX, which tells Asterisk to use this route for any 3 digit numbers starting with 2 or 3.
Select SIP/sipXTrunk in the first Trunk Sequence drop down box.

  
Click Submit Changes, and we are done.

Add an Extension

Now we create the extension we will use. On the left hand menu, click Extensions, then select Generic SIP Device and click Submit. Enter the following information.

User Extension: 400
Display Name: Your Name
Direct DID: 400
DID Alert Info: Leave blank
Outbound CID: Leave blank
Emergency CID: Leave blank
Secret: your password
Dtmfmode: rfc2833
canreinvite: no
context: from-internal
host: dynamic
type: peer
nat: yes
port: 5060
qualify: yes
callgroup: leave blank
pickupgroup: leave blank
disallow: leave blank
allow: leave blank
dial: leave as default (should be SIP/ext#)
accountcode: leave blank
mailbox: leave as default
Fax extension: freepbx default
Fax email: leave blank
Fax detection type: none
Pause after answer: 0
Privacy Manager: No
Record Incoming: On Demand
Record Outgoing: On Demand
Voicemail & Directory
Status: Enabled
Password: 12345 - not used but must not be blank
Leave the remain voicemail options at their default, they are not used. We only use the 'Status' value to see if voicemail is enabled for a particular user, and FreePBX won't let us save the extension without specifying a password.

ext config

Configure X-Lite to log onto the Asterisk server

Now that Asterisk is configured, we can change X-Lite to log onto the Asterisk server, and test the new routes we configured. At the top of the X-Lite screen, there are 3 buttons. The left button shows a drop down menu, which gives us the SIP Account settings option. Press the Properties button, and change the username to 400, and enter the password you entered above. Change the domain to asterisk.lithnet.local, and ensure the option to Register with domain and receive incoming calls is selected.

 

Press OK when done, and return to the main screen. The phone will now register with the Asterisk server, and be ready to make and receive calls. Make a test call to the OVA number (222) to make sure the routing works fine. When you have confirmed that is working, call the Auto Attendant, and when asked who you wish to contact, say your name. The Auto Attendant will then transfer your call to your extension, and X-Lite should start ringing on Line 2.

Other fun things you might like to do

Enabling inbound calls to Exchange UM from the PSTN using Asterisk and an external VoIP service provider

Enabling outbound calls from Exchange UM (OVA) to the PSTN using Asterisk

Adding SIP Aliases to Asterisk Extensions

Configure Asterisk to receive incoming SIP calls

 

Next: Troubleshooting
Previous: Part 5 - Configuring the SIP Client

Accessing Exchange 2007 Unified Messaging: Part 5 – Configure the SIP client

Now that we have configured the Exchange UM Services and the basic sipX services, we can test to see if our configuration is working. In fact, if all you need is soft phone (SIP) access to the Exchange Server, then you don't need to configure the Asterisk server. Forward the appropriate ports on your router to the sipX server instead. The next part of this guide, Configuring Asterisk, will allow us to dial into the Exchange Server from a PSTN or a SIP phone.

You can use any SIP compatible client, but for our testing, we will use X-Lite from CounterPath. X-Lite is the freeware version of CounterPath's EyeBeam soft phone. Both versions can be downloaded from http://www.counterpath.com/.

When you first start X-Lite, you are given the opportunity to setup a SIP account. Press the Add button and enter the information below.

Display Name: Your Name
User name: 300
Password: SIP Password you entered in sipX for the test extension
Authorization user name Leave Blank
Domain: sipX.lithnet.local


Click OK on the properties page, and Close on the accounts list page. The information display in the X-Lite main window will show the process of registering with the server, and if all goes well, the display should say Ready as per the image below.


Now in order to test that what we have setup so far is working, dial extension 300. This tests that we have correctly registered with sipX for incoming calls. You should see an incoming call on line 2.

In order to test the connection to the Exchange Server, dial 222, and the UM server should pick up and say "Welcome, you are connected to Microsoft Exchange". As long as you set your extension to 300 when you enabled your mailbox from UM, Exchange will detect that you are calling from 300, greet you by name, and simply prompt for your PIN. Now you can test the capabilities of Outlook Voice Access and navigate through the menus. This great guide is available for download from Microsoft and shows you all the commands available for Outlook Voice Access - http://go.microsoft.com/fwlink/?linkid=64645.

The sipX server passes the User ID of the connected user (in our case, '300') to the Exchange server by means of Caller ID. If Exchange can match the Caller ID of the incoming call to an extension specified on a UM enabled mailbox, then it will assume that user is calling, and just ask for the PIN. If it can't match the Caller ID, then it will ask you for your extension number, followed by PIN.

If you get a 404 Not Found error when trying to dial 222, go back and check that the gateway and dial plans are correctly configured in sipX. Just to be sure, activate your dial plans again. This error tells us that either the Exchange Server rejected the call because it could not find extension 222 on its system, or that sipX rejected the call because a dial plan could not be found to route the call through.

If you get a 408 Timeout error, try dialing again. This is actually a better error to get than the one above. Provided you get the message when attempting to make a call, it generally means the sipX server was able to find a dial rule through which to route the call, but the gateway did not respond in time. See the troubleshooting section for information on capturing packets using Wireshark, and have a look at where the packets are being directed to.

To confirm that we have setup the auto attendant correctly, dial 299, and the UM server should pick up and say "Welcome to the Microsoft Exchange Auto Attendant. To reach a specific person, just tell me their name". If you speak the name of someone in the directory, it will try to call them. As we have not completed our setup, it will divert to voicemail. If you leave a voicemail, it will appear in your Outlook inbox. If OVA and the AutoAttendant are working, our sipX and Exchange configuration is complete, and we can move onto configuring the Trixbox server.


Accessing Exchange 2007 Unified Messaging: Part 4 – Configure the sipX Server

--------------------------------------
STOP! This page has been replaced by a new version based on sipX 3.8 and Centos 5. This page will no longer be updated, and is kept for reference only. Please see the replacement page for updated instructions.
-------------------------------------

Initial Configuration

Start your sipX VMWare virtual machine. During start up, the OS will detect that a network card has been removed. Select Remove Config to remove this card. You will then be prompted with a message that a new network card has been detected. Select Configure and assign a fixed manual IP address to this PC.


Log in as root, with the password voipjots and change the root password by typing passwd at the command line. Remember this password, as you will not be able to log into the server without it. First thing we need to do is install operating system updates, then we will download the updated sipX repositories, and upgrade sipX to the latest version (I had lots of issues getting version 3.0 – the installation in the VM – to work, but 3.6 (the latest stable release at the time I wrote this works much better). Run the following commands in this order, and to all the Windows kids like me, remember that Linux is case sensitive, so take note of the uppercase X in the URL below (yes I stuffed it up myself and it took me about 20 minutes to work out why it was failing – silly muppet).

yum –y update
wget -P /etc/yum.repos.d/ http://sipxecs.sipfoundry.org/pub/sipXecs/sipxecs-stable-centos.repo
yum –y update sipxpbx

This may take some time depending on how many updates are needed. There seems to be a lot of packages installed, that I'm sure could be removed. However, being an MCSE who spends very little time using Linux, I have no idea what's what. If someone who knows what they are talking about wants to suggest the packages that can be removed, I'll include them in this documentation.

Once the packages have been updated, we need to set the hostname for this server. Use the nano editor to edit the network configuration file, and change HOSTNAME to sipX.lithnet.local

nano /etc/sysconfig/network


When done, press Ctrl-X, then Y, then enter to save the file.

Now we need to fix the SSL certificates. If you have a CA on your network, you can have it generate a certificate for these purposes. Otherwise, we can just generate a self signed certificate using the following commands.

cd $HOME/sslkeys
rm –f *
/usr/bin/ssl-cert/gen-ssl-keys.sh

This will prompt you for several pieces of information. Enter the appropriate information, and the following values when prompted.

CA Common Name: SelfSigned
SIP domain name: lithnet.local - The domain name of your installation
Full DNS name for the server: sipx.lithnet.local - Enter fully qualified hostname of your sipX server

Type the following to install the certificate.

/usr/bin/ssl-cert/install-cert.sh sipx.lithnet.local

Now we need to configure the Exchange gateway and rules. Normally, this XML is generated automatically by the web interface as we modify the gateway and dial plan options. We have to do this manually, because the web interface doesn't provide us a way to force sipX to use TCP for a particular gateway. If we configure our dial plans through the web interface, sipX tries to contact Exchange first using UDP, which more often than not results in a timed-out call. The sipX team is working to more natively support Exchange configuration through the web interface in the future. I will keep you posted.

At the sipx command prompt, type

wget -P /etc/sipxpbx/ http://lithiumblue.com/config/external_mappingrules.xml

to download the preconfigured mappingrules file needed to force TCP communication with Exchange. Type nano /etc/sipxpbx/external_mappingrules.xml to modify the file and replace the hostname values with your own. If for some reason you cannot download the file with wget, you can type it out manually as it appears below.

<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="
http://www.sipfoundry.org/sipX/schema/xml/urlmap-00-00">
<hostMatch>
<hostPattern>${SIPXCHANGE_DOMAIN_NAME}</hostPattern>
<hostPattern>${MY_FULL_HOSTNAME}</hostPattern>
<hostPattern>${MY_HOSTNAME}</hostPattern>
<hostPattern>${MY_IP_ADDR}</hostPattern>
<userMatch>
<!--ExchangeDialRule-->
<userPattern>2xx</userPattern>
<permissionMatch>
<transform>
<host>dc1.lithnet.local</host>
<urlparams>transport=tcp</urlparams>
<fieldparams>q=0.9</fieldparams>
</transform>
</permissionMatch>
</userMatch>
<userMatch>
<!--ExchangeVoicemailRule-->
<!--Note this is only to handle diversions for local sipX 3xx extentions-->
<userPattern>3xx</userPattern>
<permissionMatch>
<permission>Voicemail</permission>
<transform>
<user>222</user>
<host>dc1.lithnet.local</host>
<urlparams>transport=tcp</urlparams>
<headerparams>Diversion=&lt;tel:{digits}&gt;;reason=no-answer;screen=no;privacy=off</headerparams>
<fieldparams>q=0.9</fieldparams>
</transform>
</permissionMatch>
</userMatch>
</hostMatch>
</mappings>

The above rule ensures that calls for 2xx are sent to the Exchange server, and that sipX only communicates with it using SIP/TCP. It also enables diversion to Voicemail for calls to the sipX extensions (3xx). This is independant of the procedure to setup Trixbox/Asterisk to divert to voicemail. The sipX and Asterisk diversion configurations are completely independant of each other.

Now we need to tell sipX that it is responsible for routing calls to 2xx. Without this the calls would be rejected. At the sipx command prompt, type

wget -P /etc/sipxpbx/ http://lithiumblue.com/config/external_authrules.xml

to download the preconfigured authrules file. Type nano /etc/sipxpbx/external_authrules.xml to modify the hostname in this file.

<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://www.sipfoundry.org/sipX/schema/xml/urlauth-00-00">
<hostMatch>
<!--ExchangeDialRule-->
<hostPattern>dc1.lithnet.local</hostPattern>
<userMatch>
<userPattern>2xx</userPattern>
<permissionMatch/>
</userMatch>
</hostMatch>
</mappings>

In order for sipX to use these files we created, we need to add some lines into the config file. Type nano /etc/sipxpbx/sipxconfig.properties.in, scroll through the file, and locate the following lines or add them to the end of the file.

mappingRules.externalRulesFileName=/etc/sipxpbx/external_mappingrules.xml
authRules.externalRulesFileName=/etc/sipxpbx/external_authrules.xml

Restart the server using the following command

reboot

After the server reboots, open your browser and navigate to the sipX server i.e. http://sipx.lithnet.local. If all goes well, you should be presented with the screen below


Click Configuration, and accept the SSL certificate warning.
NOTE: There is approximately a 2 minute delay between the sipX services starting and being available. If you get an error message when loading the page, wait 2 minutes and try again.
Login with the username superadmin, no password is required. First things first, let's set the superadmin password. Click on Users on the top menu, the Users submenu, then on superadmin. Change the value for PIN to something secure. We won't be using the superadmin account to connect to the sipX server over the phone, so it's ok to use an alphanumeric password. Press OK when you are done.

Gateway Configuration

Now we need to add a gateway to allow sipX to communicate with the Exchange Server. Click Devices on the top menu, Gateways, and select Unmanaged Gateway from the Add New Gateway drop down list. Type the following information and press OK.

Name: ExchangeUMServer
Address: dc1.lithnet.local
Serial Number: Leave Blank – not used for unmanaged gateways


If you want to make calls out of Exchange then we need to add another unmanaged gateway back to the Asterisk server. Type the following information and press OK.

Name: AsteriskServer
Address: asterisk.lithnet.local
Serial Number: Leave Blank – not used for unmanaged gateways

Dial Plans

Now we need to configure the dial plan. Dial rules are used to route incoming calls to the appropriate gateway. Click System on the top menu, followed by Dial Plans. In the Add New Rule drop down box, select Custom as our dialing rule type. Enter the following information and press OK.

Tick the Enabled box
Name: AsteriskDialRule
Description: Forward calls for 4xx-8xx to the Asterisk Server
Dialed Number, prefix: 4, and select 2 digits from the drop down list. Click Add to add new lines.
Dialed Number, prefix: 5, and select 2 digits from the drop down list
Dialed Number, prefix: 6, and select 2 digits from the drop down list
Dialed Number, prefix: 7, and select 2 digits from the drop down list
Dialed Number, prefix: 8, and select 2 digits from the drop down list
Resulting Call, Prefix: Leave the prefix blank, and select Entire Dialed Number from the drop down list
In the More Actions drop down box, select AsteriskServer under Existing Gateways.


Press OK to save and return to the dial plans list. Move the new dial plan to the top of the list, by ticking the box next to the new plan, and pressing Move up repeatedly. Order does matter, so it is at the top. If you don't plan on using the sipX server for any other SIP traffic, you can delete the other dial plans.

Activate the new plans by clicking the Activate button, and pressing OK when prompted for confirmation.

Add an Extension

We will now add an extension for testing purposes. This will help in your troubleshooting efforts should something not work. Click on Users on the top menu, click the Users menu item, and click Add User. Click Show Advanced Settings at the top of the page. Change the user ID to 300, assign a first name, last name, PIN, and SIP password to the account. Take note of the SIP password or change it to something you are going to remember. Press OK when you are done.


Configure the Fully Qualified Domain Name

Click the System menu and the Domain menu item, and enter the fully qualified domain name that the sipX server will use. When prompted, ensure you activate the new dial plans for our configuration changes to take effect.

Please note that the FQDN must be the same as the value you configured for the gateway on the Exchange Server. When Exchange sends a request to the gateway, it appends the given hostname or IP address to form a SIP address. I'll use the example of the Exchange Server making an outbound call to extension 400. If you have the sipX server's IP of 192.168.0.50 configured in the Exchange Server as the gateway address, then Exchange will address the SIP packets to
400@192.168.0.50
If you have the hostname configured, it will address the SIP packets to
400@sipx.lithnet.local

If sipX is configured with the domain name sipX.lithnet.local, but the packet is addressed to 400@192.168.0.50, sipX will NOT recognize that it should process the packet. Your Exchange Server's event log will contain "483 Too Many Hops" error events logged by the Unified Messaging Service, and calls to the Exchange Server will fail.

This took me DAYS to work out what was going on here, so please, save your sanity by going back now and double-checking this.

We have now completed the configuration of the sipX server.



Accessing Exchange 2007 Unified Messaging: Part 3 - Configuring the Exchange Server

This guide assumes you have installed the Unified Messaging Role, either at the initial installation of the server, or at a later time, using the Add/Remove Programs control panel applet and clicking the Change button on the Exchange 2007 program entry. The following tasks all use the Exchange Management Shell, but can just as easily be configured using the Exchange Management Console GUI.

  1. Create the Dial Plan, using a 3 digit internal numbering scheme. You can use as many digits as you like (just be sure to adjust all the extension numbers in the rest of the document to use that amount). We will use the number '222' as the extension subscribers (the term for users with UM enabled Mailboxes) to access Outlook Voice Access.

    new-UMDialPlan -Name:'3DigitDialPlan' -NumberOfDigitsInExtension:'3' -AccessTelephoneNumbers 222

  2. Create the gateway entry to the sipX server. Note that you can use an IP address instead, but I i strongly discourage it. Using IP addresses tends to break functionality. For the most reliable experience, use DNS or host files. (FYI - If you emailing me with a problem, and your using IP addresses, the first thing I'm going to tell you to go is configure your DNS or host files)

    new-UMIPGateway -Name:'sipXServer' -Address:'sipX.lithnet.local' -UMDialPlan:'3DigitDialPlan'

  3. Create the AutoAttendant, and make it accessible on extension '299'

    new-UMAutoAttendant -Name:'AutoAttendant' -UMDialPlan:'3DigitDialPlan' -PilotIdentifierList:'299' -Status:'Enabled' -SpeechEnabled:$true

  4. Modify the settings of the AutoAttendant. These can be customised as you desire. We will set the operator/receptionist extension to what will be your Asterisk extension (400), but if you want these calls transferred to another extension, enter it here.

    Set-UMAutoAttendant -Identity AutoAttendant -AfterHoursTransferToOperatorEnabled $true -AllowExtensions $true -BusinessHoursTransferToOperatorEnabled $true -CallSomeoneEnabled $true -NameLookupEnabled $true -SendVoiceMsgEnabled $true -OperatorExtension '400' -ContactScope GlobalAddressList

  5. Associate the dial plan with the server to make it active. Replace the server shown below with the FQDN of your UM server

    Set-UMServer –Identity:'dc1.lithnet.local' -DialPlans 3DigitDialPlan

  6. Enable UM for your mailbox users, and associate an extension for them. Associate yourself the 300 and 400 extensions to allow testing and to receive calls that are transferred to the operator. Replace DOMAIN\Username with your own user account details, and the 'Pin' value with one of your choosing. The default PIN policy is 6 numbers, and this can be changed by modifying the UM Mailbox Policy associated with the dial plan. To edit these policy settings, open the Exchange Management Console, expand Organisation Configuration, Unified Messaging, and click the UM Mailbox Policies tab.

    Enable-UMMailbox -Identity:'DOMAIN\yourusername' -UMMailboxPolicy:'3DigitDialPlan Default Policy' –Extensions 400,300 -Pin 893465 -PinExpired $false

So in summary, we have configured:

  • Subscriber access (Outlook Voice Access) on extension 222
  • The Exchange AutoAttendant on extension 299
  • Extension 400 for us to use for testing
  • Calls for the operator are sent to extension 400


Accessing Exchange 2007 Unified Messaging: Part 2 - Implementation Plan

All successful projects need to start with a plan...

Extension Pools
Firstly, we need to determine how many digits are in our internal extensions. We will use a 3 digit extension code in this guide, but feel free to increase it to as many as you need. We will break up our extensions into the following ranges, for ease of routing:
  • 2xx – Extensions handed by the Exchange Server. Used for auto attendants and subscriber access.
  • 3xx – Extensions handled by the sipX server. We will only use these for testing and troubleshooting.
  • 4xx – 5xx – Extensions handled by Asterisk. This is our usable pool that end users will be assigned extensions from.
I purposely excluded the ranges 0xx, 1xx and 9xx so as not to conflict with emergency numbers in various locations (000, 112, 911), other than that, there are no restrictions on what extension ranges you use.

IP Addresses and Hostnames
The following IP addresses and hostnames are in use on my network. Substitute your own addresses as appropriate throughout this guide.

Server

IP

Hostname

sipX server

192.168.0.50

sipx.lithnet.local

Asterisk/Trixbox server

192.168.0.60

asterisk.lithnet.local

Exchange server

192.168.0.200

dc1.lithnet.local

You must configure the appropriate DNS host (A) records as shown above. The use of host files is not supported in this guide. If you are using host files, and run into problems, the first thing I am going to tell you to do is configure DNS.

PLEASE NOTE: sipX is VERY picky when it comes to name resolution. If you have configured sipX to be responsible for SIP traffic coming to 192.168.0.50, it will not correctly handle SIP traffic addressed to sipX.lithnet.local, even through the domain name translates to the correct IP address. I will cover this later in more detail, but at this stage, just make sure that the same hostname resolves to the same IP address on each server.


Accessing Exchange 2007 Unified Messaging: Part 1 - Requirements

You
Although this process involves setting up and working with Linux servers, you don’t actually need any Linux experience. I provide the step by step instructions, and most of the configuration we do is through a browser. In the Troubleshooting section, I provide some information about troubleshooting issues that may arise. I have very little hands on Linux experience myself, so if I can put these instructions together, you’ll have no problems following them. I do make the assumption that you are familiar with Exchange technology and terminology, and know how to install an Exchange server. I won’t be providing any information about the setup of the Exchange Server itself, although it’s a fairly straight forward process. For troubleshooting purposes, you will need to know a bit about network monitoring, and be able to make sense of packet captures. Hopefully if all goes well, you won’t need to worry about this part.

Exchange Server 2007
First thing you are going to need is a Microsoft Exchange Server. You have two options here. Firstly, you can download the trial version from http://www.microsoft.com/downloads/details.aspx?FamilyID=444c259e-605f-4a82-96d5-a2f448c9d4ff&DisplayLang=en. This gives you a 120-day fully functional trial version that can be upgraded to a full version at any time. That’s more than enough time to get a system up and running and do some testing. Alternatively, (and I highly recommend this option) you can purchase a subscription to Microsoft TechNet (http://technet.microsoft.com/subscriptions/). For about AU$500 a year, you get access to full versions of almost all Microsoft products (servers, applications, operating systems, etc) for testing and evaluation purposes. They are the same products you get if you purchase them at retail, just with a different End User License Agreement. Basically, you can’t use them as ‘production’ systems. But for testing purposes, you have no worries. This subscription is a must have for any Windows engineer who wants to stay on top of Microsoft technology.

sipX
sipX is a Linux based IP-PBX system. It provides gateway and call routing functionality between VoIP systems. It does not have functionality to connect directly to the PSTN. For that task we need Asterisk. It does, however, handle SIP/TCP, which Asterisk does not. So in our case, we will not utilise the PBX features of sipX, and merely use it as a translation service. These instructions are based on the VMWare virtual machine that can be downloaded from the VMware Appliance Marketplace. You can download VMware Server for free from http://www.vmware.com/products/server/. Alternatively, you can download sipX and install it manually from http://www.sipfoundry.org/.

Asterisk
Asterisk is also a Linux based IP-PBX package. It a highly customisable system, that provides all traditional PBX functionality, as well as the ability to connect to the PSTN by various means. We will connect via an external PSTN/VoIP gateway, but there is lot of documentation out there for connecting your own PSTN hardware to the Asterisk system. Once again, these instructions are based on the preconfigured VMware virtual machine downloaded from http://www.trixbox.org/. Trixbox is a preconfigured distribution of Asterisk with several easy to use management tools running on CentOS. Once again, if you prefer you can download the installation package and do a clean install, but these instructions will not cover that process. The memory requirements for the Asterisk/Trixbox and sipX server are fairly low at around 300 MB each. I have all 3 servers running in VMWare virtual machines on a Pentium D with 4GB RAM, and it runs acceptably for testing purposes.

Optional – a PSTN-VoIP service
If you want to be able to call your Exchange server from the PSTN, you will need a VOIP/PSTN gateway service. You can use an over-the-counter hardware device to make use of your existing physical phone line, or obtain a PSTN number from a VoIP provider. These instructions will detail the latter. Most ISPs these days will offer a VoIP service, and in the case of my ISP, it comes bundled with my ADSL connection. If your ISP doesn’t offer this service, there are plenty of companies out there that will. Fire up your favourite search engine and have a look in your area for VoIP providers. If you don’t want to dial in to your Exchange server from the public phone network, you can still use a soft phone from any internet connected PC to access Outlook Voice Access. Follow the instructions, but you can stop after you have installed the sipX server. Asterisk is only required if you want PSTN access.

Document Conventions
Throughout this documentation, I will use the following color codes.
Information or code you have to enter will appear in blue
Where you need to substitute information relevant for your network, for example, where one of my IP addresses appears, that text will appear in green.
Where I reference something that appears verbatim on the screen, that text will appear in red.


Accessing Exchange 2007 Unified Messaging: Introduction

This how-to guide takes you through the steps required to access Exchange 2007 Unified Messaging features, such as Outlook Voice Access, using the open source tools Asterisk/Trixbox and sipX.

I’ve worked in several IT departments over the years, and thankfully, I have never been required to provide support for a company’s telephony systems. It has been an arrangement that has served me well over time. As an IT Pro, I have never seen the need to know or care about how telephony systems worked. As long as I could configure the odd ADSL modem, as far as I was concerned, I didn’t need to know any more. In most organisations, PBX support is usually outsourced to an external company. Sometimes the IT department manages this relationship, but in my experience, wherever possible, the IT department tries to stay as far away from the phone system as possible.

Recently, I’ve come to the realisation that my telephony-ignorance is unavoidably going to have to go. The rapid expansion of VoIP technologies is seeing more and more businesses replace their aging legacy PBXs with IP based PBXs and handsets. Telephony systems will be integrated into our physical networks, run on our servers, and even integrate with our desktop PCs. There’s just no escaping it.

The IP-PBX does provide an array of benefits over traditional systems. It provides integration with existing infrastructure, lower overheads and allows for a high level of customisation. By making use of standards based technologies, businesses have a lot more options available to them for managing their internal and external business communications. The Unified Messaging features integrated into Microsoft Exchange Server 2007 highlight the industry trend of moving to IP-PBXs. A company can integrate their IP-PBX with Microsoft Exchange, and truly unify their business communications in a single place, which is accessible through all the well-known interface of Microsoft Outlook.

This means that it is time for IT Pros, especially those that work with Microsoft Exchange, to start getting familiar with the technologies associated with VoIP. Traditional telephony will eventually be replaced in the workplace, and I’m afraid the IT department will not be able to weasel its way out of it this time. :)

Fortunately, we can get experience working with VoIP and Exchange UM without an existing IP-PBX or Exchange 2007 infrastructure, and we can do so at little or no cost. Leveraging the power of virtualisation, we can setup a working system on a single PC. These instructions will detail how to set up a system that will allow you to make use of Exchange UM and familiarise yourself with the VoIP protocols, giving you a valuable heads-up for when VoIP makes its way into your workplace. This guide will take you though the steps required to connect to your Exchange Server via a SIP based phone, or through a standard PSTN telephone connection.

We will use two open source products, Asterisk and sipX, to access Exchange UM. Exchange utilises SIP (Session Initiation Protocol) over TCP to provide access to its Unified Messaging features. The IP-PBX software we will use is called Asterisk, and it uses SIP over UDP for communications. We will use a third product, sipX which handles both SIP/TCP and SIP/UDP and acts as a gateway between the two systems.

Wednesday, April 25, 2007

It Starts....

OK, so I've been saying to myself for the last 12 months or so that I was going to start a blog. I've finally gotten around to it. I'll be posting primarily on IT related issues. I'm starting a new job on Monday, so this is probably a good way to let my past and future colleagues know what I am up to.

The first topic I'll be posting about is how to get Exchange 2007 Unified Messaging and Outlook Voice Access working over a VoIP telephony system. I've collated the information I found from a few sites I came across to produce an easy to follow step by step guide. I'm still working on the content, and should have it up in a day or two. Comments and feedback are welcome!