Monday, October 29, 2007

OCS/Asterisk integration work in progress

UPDATE 17/12/2007: This information has been superseded by a more detailed post.

So I have finally gotten my act together and started my OCS/Asterisk integration. For those of you that don't want to wait for the full guide, you can start by configuring your dial plans in Asterisk and sipX to point to your mediation server. Add the following code into extensions_custom.conf

exten => s,1,NoOp(Entering custom-exchangevm for a call to ${DNID})
exten => s,n,Set(EXTTOCALL=${BLKVM_BASE})
exten => s,n,NoOp(Sending to Voicemail box ${EXTTOCALL})
exten => s,n,SIPAddHeader(Diversion: <tel:${EXTTOCALL}>\;reason=no-answer\;screen=no\;privacy=off)
exten => s,n,Dial(SIP/222@sipx.lithnet.local|30)

You will need to install the "Follow me" module in FreePBX. Then configure the follow me settings for each extension as shown so that both the Asterisk extension and the OCS phone ring at the same time. Note for each number that is external to the Asterisk system, you must append a hash (#) to the end of the number as shown below for 800 - my OCS extension.


More to come.

Microsoft Unified Communications Australian Launch Events

If your in Melbourne or Sydney in November, the I highly recommend that you come along to the Microsoft UC product launch. I've booked in for the following sessions;

Office Communications Server 2007 Deployment

This demonstration will walk through deployment of Office Communications Server 2007 (OCS 2007) starting with the planning & deployment guide, standard edition installation, user provisioning and entitlement, configuration, and finally validation. OCS 2007 will be the main emphasis of this demonstration. This session can be broken down into three parts. In the first part of the demonstration, we show the easy setup of Standard Edition 2007, which allows an organisation to provide IM, peer to peer voice call capabilities immediately. The second part of the session will include an overview of complex installation topologies recommended for OCS 2007, including considerations for Enterprise Edition deployment, Edge server roles, various MCU roles, Mediation server and the Archiving server role. The third part of the session focuses on federation and public internet connectivity features of OCS 2007. This includes setup of Edge server roles for Public Internet Connectivity and Federation capabilities. It will also cover integration with Exchange Server 2007 SP1 Unified Messaging which enables an exciting set of features for end-users.

Exchange Server 2007 SP1 Overview

This demonstration will walk through the feature enhancements introduced in Exchange Server 2007 SP1. The demo will cover a range of new technologies, from Windows Server 2008, Standby Continuous Replication and Outlook Web Access 2007, to enhanced functionalities such as Mobility, end user experience and administrator management.

Unified Communications Journey, A real customers experience

HP began deploying Exchange Server 2007 and Office Communications Server 2007 in live internal and customer environments long before these products came to market. In this session you will hear about the trials, tribulations and ultimate success of implementing a consolidated Exchange Server 2007 environment across multiple geographies, complete with Unified Messaging and then Office Communications Server 2007 integrated with Cisco Call Manager. Understand the business objectives and requirements that lead to this implementation including the unexpected benefits as highlighted in the case study. Learn from our mistakes, understand the real value, and pre-requisites for full functionality and ultimately streamline your own deployment!

Mobility & Anywhere Access

This presentation will demonstrate the benefits of remote access and mobility features for Office Communicators Server 2007 and Exchange Server 2007. The scenario will focus on how users stay connected and can work without interruption while travelling and on the go. Users continue to have access to presence and contact information and choice of communication options including mail, instant messaging, voice and multi-party conferencing. They can view documents and access Microsoft Office SharePoint sites remotely. All these features increase productivity for the organisation and are easy to set up by IT professionals. We will talk about implicit benefits of cost saving and lower help-desk calls.

Use the following links to register. It's a free event. Send me an email if you are coming!

Make sure you check out the new Australian UC product site, and if you haven't already subscribed to Johann's Unified Communications blog, do it now!

Saturday, October 27, 2007

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

One of the great features of Outlook Voice Access is the ability to lookup a person in the directory or your personal contacts list and have OVA connect you to that person. This obviously requires support some form of connection to the PSTN. The guide will take you through the steps of configuring the systems to allow OVA to make calls to the PSTN.

A big thanks to Sander de Rijk who provided the basis of these instructions earlier this year.

This guide assumes you have configured Asterisk to connect to your PSTN provider. If not, see my earlier post, then come back when your done.

The first thing you need to do is decide if you want to configure an 'outside line' access code. The most common numbers used for access to the trunk are 0 and 9. However, its becoming increasingly popular not to use such a code, and configure appropriate rules in the various dial plans instead. The following instructions will be based on NOT using a trunk access code, but adding this functionality is very straightforward.

Open the Exchange Management Console, and in the left hand pane, select Organization Configuration, Unified Messaging. Right click on your dial plan, and select Properties. On the Dial Codes tab, enter the dial codes relevant to your location. This can be a little confusing, but the Help button will reveal some information that can guide you through this process. Note that all this information is optional, and if you are only have one dial plan, and are going to making calls within our country/region, you can leave all the fields on this tab blank.


Next, click on the Dialing Rule Groups tab, and add a new In-Country/Region Rule. Give your rule a name, and enter a number mask. In my example below, I take a local 8 digit phone number, and add my state's extension (03) to it.


If I have a number in my contacts or directory that contains the country code (61 for Australia), this rule will remove it, and replace it with a 0 which is used for In-Country dialing.


Continue adding rules for your numbers as required, unfortunately I can't include all the various country and region codes in this guide, but I'm sure you will work them out without too much trouble. Once completed, you should have a list similar to that below.


That completes the Exchange portion of this configuration. Now we need to configure the appropriate rules on the sipX server. Visit the sipXconfig web site, and open the Asterisk dial plan (System->Dial plans->AsteriskDialPlan). Add the dial rules required for your area. If you configured an outside line access number, then you can simply enter that number as the prefix, and select "Any number of digits" from the drop down list.


Save the dial plan, and click Activate above the list of dial plans. Finally, we need to configure the route in Asterisk to send these calls through our PSTN provider. Visit the asterisk configuration page, and from within FreePBX, select Outbound Routes from the left menu. If you have already configured a route to the PSTN, then use that, otherwise add a new route. Add your dial patterns, and select the trunk you configured for your PSTN provider, and save.


Note that I have used different dial patterns on the sipX and Asterisk server. This is just to demonstrate the various ways you can go about configuring these systems. Both sets of rules work and are valid. You can choose less specific rules to make administration easier, or you might need more control over where your calls go (i.e certain calls need to be routed over a specific trunk). All are valid - adjust as needed for your requirements.

Apply your changes to the server, and you are done!

Monday, October 22, 2007

sipX 3.8 Released - Exchange UM Guide updated

sipX 3.8 was released last week, and as such I have updated the Exchange UM guide with instructions on setting up version 3.8. This resolves the random timeout issue in version 3.6 that I described in an earlier post.

The VM that we used previously was quite old. It was based on Centos 4 and sipX 3.0, and contained a lot of other useless junk.

In the new instructions we use a bare-bones Centos 5 Virtual Machine, and install sipX 3.8 ourselves. This results in a faster more efficient VM.

Because the last VM was so dodgy, I'm not going to provide instructions for upgrading your old 3.0/3.6 servers to 3.8. You can perform a yum update if you really want, but I strongly recommend dropping that old VM and starting again. It will only take a short amount of time, and will be well worth it in the long run.

If anyone has had any experience with the SIP/TCP patch for Asterisk, please get in contact with me. I would like to hear about your results.

Accessing Exchange 2007 Unified Messaging: Part 4 – Configure the sipX Server (sipX 3.8/Centos 5)

Update: 22/10/2007 - Replaced the old post with instructions for a new Centos 5 VM and sipX 3.8

Initial Configuration

Download the Centos 5 Minimal Installation VMware Appliance from the VMWare Appliance Marketplace.

Start your sipX VMWare virtual machine. Log in as root, with the password password and change the password by typing passwd at the command line. Type netconfig, and select Configure and assign a fixed manual IP address to this PC.

Now 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. When done, press Ctrl-X, then Y, then enter to save the file.

nano /etc/sysconfig/network

In order for sipX to install, we need to disable SELinux. Edit the SELinux config file by typing nano /etc/selinux/config and change SELINUX=ENABLED to SELINUX=DISABLED.

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).

wget -P /etc/yum.repos.d/
yum -y install sipxpbx sipxconfig sipxproxy sipxregistry

(If you want to use sipx as the main PBX (without using Asterisk - not recommended), then install additional modules as required as specified on the sipfoundry web site)

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.


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/ 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/

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 as shown below 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="">
<!--Note this is only to handle diversions for local sipX 3xx extentions-->

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 independent of the procedure to setup Trixbox/Asterisk to divert to voicemail. The sipX and Asterisk diversion configurations are completely independent 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/

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="">

In order for sipX to use these files we created, we need to add some lines into the config file. Type nano /etc/sipxpbx/, 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


After the server reboots, open your browser and navigate to the sipX server i.e. http://sipx.lithnet.local.

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.

If all goes well, you should be presented with an SSL certificate warning (if you used a self signed certificate). Accept this warning, and when prompted, enter a new PIN for the superadmin account. You will use this to log into sipXconfig on the next screen.

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 SIP Trunk from the Add New Gateway drop down list. Type the following information and press OK.

Name: ExchangeUMServer
Address: dc1.lithnet.local

Now we need to add another SIP trunk for the Asterisk server. Type the following information and press OK.

Name: AsteriskServer
Address: asterisk.lithnet.local

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-5xx 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. Add as many extension ranges as you require for your setup.

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. Remember that whenever you make any changes to your dial plan, or modify your mapping and auth rule XML files, you must reactivate your dial plan for the change to take effect.

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 as the UM IP Gateway address on the Exchange UM Server.

We have now completed the configuration of the sipX server.

Next: Part 5 - Configuring the SIP Client
Previous: Part 3 - Configuring the Exchange Server

Saturday, October 6, 2007

Asterisk/SipX bugs and modifications for UM

There are a few problems people have been running into with their UM setups.

Intermittent Timouts

The first is a problem where a timeout occurs intermittently when trying to call the Exchange UM server (approx 1 in 4 calls fails). This is caused by a bug in sipX 3.6 sending a malformed SIP header. The good news is that this has been fixed in sipX 3.8, however this version is still in beta (RC2). I have been waiting for a few months for the final release which is apparently 'just around the corner' to update the guide, but it seems to be causing people enough grief to justify posting about this issue now. I have been using 3.8 RC2 myself for some time, and have not run into any problems. The repo can be downloaded from As soon as 3.8 is released, I will update the instructions accordingly.

Play on Phone

The other issue people have been encountering is 'Play on Phone' not working from Outlook or OWA. A SIP trace reveals that Asterisk is sending a 407 Proxy Auth Required to the Exchange server, which it is unable to respond to. In order to get this working, we need to change the SIP connection type settings in each extension definition from friend or user to peer.

If you are using Trixbox (2.2 and above), then using FreePBX, go through each extension in the extension configuration menu, and change the 'type' option to peer as shown below.


If you are not using Trixbox, then you will need to manually modify your extension definitions in sip.conf and ensure the type is specified as 'peer'.