Configuring Exchange Server 2013 Unified Messaging With 3CX and Not AsteriskNOW

Posted on 11 CommentsPosted in 2010, 2013, asterisk, asterisknow, exchange, pbx, unified messaging, voicemail, voip

This article is an addendum to my blog series on configuring Exchange Server 2010 and Exchange Server 2013 with AsteriskNOW. AsteriskNOW is a easy to install version of Asterisk 1.8 in that it includes the underlying OS and the FreePBX software. The problem with Asterisk 1.8 is that it does not work well with the correct process of connecting to Exchange Server unified messaging servers.

Asterisk and Issues with Exchange Server and SIP Diversion

Exchange Server runs two unified messaging services, umservice.exe (on Exchange 2010 and Exchange Server 2013 Mailbox Servers) or Microsoft.Exchange.UM.CallRouter.exe (on Exchange Server 2013 Client Access Servers) that listens on TCP 5060 and UMWorkerProcess.exe (both versions of Exchange Server) that listens on TCP 5065 or TCP 5067. The correct process for connecting to Exchange Server unified messaging is to connect to TCP port 5060 and get back a SIP Redirect to either port TCP 5065 or TCP 5067. The reason for the redirect is that Exchange Server starts listening on 5065 and after a week starts a second process listening on 5067 and once the process on 5065 has finished all its call handling it will stop the process listening on 5065. This way Exchange Server manages the process, memory management, etc. without needing to restart the process if it goes bad – it just starts a process on the other port from the current process and directs all new calls at the new process.

The problem with Asterisk 1.8 is that is looses the caller ID during this redirect. Therefore all the posts you will see on the internet for Exchange and Asterisk use port 5065 directly and a few (very few) deal with the issue that this only works for a week before they need to change to port 5067 and so on.

On Exchange Server 2010, as both the umservice and the UMWorkerProcess are on the same machine, you can just connect to 5065&5067 at the same time and Asterisk will complete the call down the channel that answers.

Like Exchange Server 2010, the 2013 version allows you to direct voicemails at any unified messaging server and have them turn up in your inbox. You do not need to connect to that actual server your mailbox is located on – but ideally you would, as that will spread any load caused by voice across all the servers that store mailboxes. If you are connecting to a server in one location, your mailbox could be in another and so ideally you would connect to a mailbox server local to your mailbox, but as Asterisk does not manage the diversion correctly this will not happen.

On of the headline features of Exchange Server 2013 is the load-balancing without needing layer 7 hardware. This not going to work for Exchange Server 2013 and Asterisk as you will always get sent to the IP address of the trunk as configured in Asterisk and not the server your mailbox is located on.

The connectivity flow for Exchange UM is that the CAS role runs the Microsoft.Exchange.UM.CallRouter.exe process (port 5060) and the Mailbox role runs the umservice.exe (port 5062) and the UMWorkerProcess.exe (port 5065 or 5067)*. Therefore your PBX needs to talk to a CAS server on port 5060 (and can do this via a Layer 4 load balancer if they wish) and then the SIP call is redirected to the correct mailbox server for that user at that time. The following screenshot shows the error state in action:

image

From the above Asterisk console session you can see the following steps caused when the user at extension 8001 picks up the phone and calls the subscriber access number for the dialplan (8500):

  • Called SIP/TrunkName/8500
  • Got SIP response 302 “Moved Temporarily” back from CAS_Server_IP:5060
  • Now forwarding SIP/Call-ID to ‘SIP/8500::::TCP@mailboxserver_fqdn:5062’ (thanks to SIP/TrunkName-CallID)

The connection has been routed from the CAS server to the Mailbox server that holds the users mailbox and to the umservice.exe on that mailbox server. It is this service that knows the current port the UMWorkerProcess is running on on (5065 or 5067). So the connection flow continues with:

  • Got SIP response 302 “Moved Temporarily” back from mailbox_server_IP:5062
  • Now forwarding SIP/Call-ID to ‘SIP/8500::::TCP@mailboxserver_fqdn:5065’ (thanks to SIP/mailbox_server_fqdn:5062-CallID)
  • SIP/mailbox_server_fqdn:5065-CallID is ringing
  • SIP/mailbox_server_fqdn:5065-CallID answered SIP/8001-CallID

Exchange then answers with “Sorry, the person you are trying to reach does not have a valid voice mailbox on our system. Goodbye”. This is because in all the diversions (SIP 302) Asterisk looses the From: header which shows which phone the user is calling from and replaces it with the subscriber access number. Configure Asterisk to connect directly to 5065&5067 on a mailbox server and it all works fine, but latency for offsite mailboxes is not catered for, nor is any degree of HA.

So, as Asterisk has issues doing an Exchange Server 2013 multi server deployment that it could do with Exchange 2010, I have added this article to the blog series to explain why this is so and the steps for another IP PBX to solve the issue. Therefore we will look at configuring 3CX instead as an example IPPBX. 3CX with Exchange Server support is a paid for product, but at the time of writing you get a 2 call demo licence when you register to get a download – and a two concurrent call licence is enough for a lab.

Configuring 3CX for Exchange Server 2013

As the process for installation of 3CX is well documented, all I am going to do here is call out the steps that you need to do to get the system working with Exchange Server.

  • Download the free version
  • You will get an email with a licence key for 2 concurrent calls
  • Install the free version on a Windows Server, but not on any of the Exchange Server 2013 machines as both Exchange and 3CX will want to open port 5060.
  • During installation I choose to go for IIS as the web server.
  • Create two extensions during installation. I went for 5001 and 5002, one for each of my SIP phones. Note that if you configure your phones at the same time as you create the extensions they will not register with the server until after installation is complete.
  • Ensure that you enable voicemail for the extension.
  • Activate the software with the demo licence key you have (Settings > Activate Licence)
  • Configure your VoIP Provider settings including an Outbound Rule for sending calls to this provider.
  • Configure Exchange dialplan and UM gateway and UM enable mailboxes with the same extension number as used in 3CX
  • On Settings > Advanced choose the Exchange Server tab and enter the IP address of your Exchange CAS Server or CAS server load-balanced virtual IP. Set the port to 5060 and tick the box to use voicemail on your Exchange Server

You should now be able to place calls between your handsets and have the call forwarded to Exchange for voicemail.

 

 

* Note that if you are using TLS protected SIP (SIP Secure) then the port numbers in the above article are incorrect and are all +1. Therefore Microsoft.Exchange.UM.CallRouter.exe listens on 5061, umservice.exe on 5063 and UMWorkerProcess.exe listens on 5066 or 5068.

Building An Exchange Unified Messaging Lab (Part 8)

Posted on 6 CommentsPosted in 2010, 2013, asterisk, asterisknow, exchange, pbx, unified messaging, voicemail, voip

In the extended series of blog posts we are looking at creating a unified messaging lab for Exchange Server. So far we have looked at installing a software PBX (AsteriskNOW) and configuring Exchange Server (both 2010 and 2013) to accept calls from our PBX. We have also looked and configuring our PBX to send and receive calls to a SIP provider on the internet.

In this post we will configure our PBX to forward calls for our voicemail access number (8000 and 8500 in the blog series) to the Exchange Servers in the lab. Dialling 8000 will call my Exchange Server 2010 lab and dialling 8500 will call my Exchange Server 2013 lab. If you only have one lab environment, then you only need one set of trunks configured.

Configuring SIP Trunks To Exchange Server 2010 from Asterisk

Login to your FreePBX website and click Connectivity > Trunks and click Add SIP Trunk.

imageThis trunk will be configured with the settings of your Exchange Server unified messaging server and have a name such as “ToExchangeUM5065” for both Trunk Name fields (at the top of the screen and under Outgoing Settings). There are no settings needed under Incoming Settings or Registration. Note that the name of this trunk must match the name you selected when configuring the config file in the previous post. If you set the voicemail macro in Asterisk to use the wrong name it will not be able to forward the call anywhere.

The main part of the settings for the trunk is the PEER Details field. For my lab this reads as follows:

host=w.x.y.z ;IP address of the Exchange UM Server
type=peer
transport=tcp
port=5065
context=from-internal
qualify=yes

This creates a trunk with the IP address of the Exchange UM server, using TCP, over one of the ports that the UMWorkerProcess on Exchange listens on and has the qualify=yes setting to tell Asterisk to check if the server is up and running by connecting to it occasionally and sending an SIP OPTIONS header.

Once your first trunk is created you need to create a second trunk. This trunk has a different name and port. The name (following the above example) can be “ToExchangeUM5067” and the port value reads port=5067. All the other settings are the same.

imageOnce the trunks are complete you need to make the Outbound Routes that will be used to forward calls down this trunk. Click Connectivity > Outbound routes and provide a Route Name and a Dial Pattern and finally the Trunk Sequence for Matched Routes value.

For the Dial Pattern you just need to enter the number that users will call to access their voicemail and for the Trunk Sequence you just need to select the two Exchange trunks that you made earlier. Finally, click Apply Config to have all the changes submitted to the Asterisk config files and to have Asterisk reloaded.

As Asterisk does not do Diversion headers correctly (it looses the caller ID during diversion) I have an another article in this series looks an using 3CX. This different IPPBX does the diversion correctly.

Testing Your Unified Messaging Lab

You should now be able to call another extension, wait or reject that call at the destination, and be routed to Exchange Server voicemail. Once the message has been left the recipient of the call should receive an email with your message. If they click the Play on Phone option in Outlook, then their phone should ring and the message be played to them.

If you get an errors or unexpected results then make your calls whilst watching the server console. Run asterisk -Rv from the console and then make calls. You should see many messages and scrolling back through them, using screen before running asterisk –Rv and CTRL+A and [ to access the screen log, will show you messages containing “SIP/ext is ringing”, “Got SIP response 486 Busy Here”, and many lines further on “Executing [s-BUSY@macro-vm:4] Dial(‘SIP/ext-callID’,’SIP/xxxx&SIP/yyyy’) in new stack”. Either trunk xxxx or yyyy will answer with “SIP/yyyy-CallID answered SIP/ext-CallID”. Four or five more lines should take you to the end of the call log.

My final post in this series looks at doing all the same again, but using a different IP PBX – a commercial one called 3CX, but one that has a fully functioning demo licence for two concurrent calls and so is ideal for building labs with. This is covered in Using 3CX and Not Asterisk and Exchange Server.

Building An Exchange Unified Messaging Lab (Part 6)

Posted on Leave a commentPosted in 2010, 2013, asterisk, asterisknow, exchange, pbx, unified messaging, voicemail, voip

Earlier parts in this blog have talked about VoIP, configured AsteriskNOW software PBX and configured inbound and outbound calls via the PBX. Now it is time to configure voicemail to be provided by Exchange Server 2013 and for the telephone users to be able to call Exchange an listen to their voicemail. In addition to listening to voicemail, when a user logs into Exchange Server via their telephone handset Exchange can read and the user change items in their mailbox (i.e. delete email, change calendar bookings) and direct calls to other users.

This blog article will look specifically at Exchange Server 2013. The preceding article repeats the steps here, but for Exchange Server 2010. So lets start by configuring all the required pieces on the Exchange Server.

Configuring Exchange Server 2013 Unified Messaging

The first thing to set up in Exchange Server 2013 with regards to Unified Messaging is the mailbox server role. Unified Messaging is automatically installed on the mailbox role. Once the role is installed go to the Voice area of Exchange Control Panel.

image

By default Exchange is installed with the United States language pack. Download and install the correct unified messaging language packs for your country before you proceed further or Exchange will answer you in the wrong language. 

The first thing that you need to create is the UM Dial Plan with the correct number of digits (four in the case of this blog), set Unsecured for VoIP Security, enter your Country/Region code (for example 44 for the UK) and choose the language you want the server to answer callers in. Unlike Exchange Server 2010 you do not associate dial plans with servers unless you are using Lync Server as the PBX.

On the UM IP Gateways screen add a gateway for the IP address of your PBX.  Exchange requires TCP support and we covered the steps for configuring Asterisk in Step 3 to support SIP over TCP.

image

If you are using a PBX that supports custom ports for SIP over TCP (Asterisk 1.8 does not support changing the TCP port for SIP) then remember to adjust the port in Exchange Server. You set the port if different from 5060 using Exchange Management Shell: Set-UMIPGateway –identity BlogGateway -Port 5065 for example.

You also need to select the dial plan you just created and a display name for the UM Gateway.

Unlike Exchange 2010, there will be nothing in the Event Viewer upon successful creating an IP Gateway. Also you are not required to associated the dial plan with a UM Server. The PBX should be configured to forward all calls to the front-end CAS array and CAS redirects the call to the Mailbox server that holds the users mailbox for answering by the Unified Messaging service.

Now that you have the initial configuration complete, go back to the UM Dial Plans screen and open the dial plan that you created earlier. You will need to associate a subscriber access number with this dial plan. This is the number that users will call to listen to their voicemail. Exchange Server will be informed of the dialled number when the PBX forwards the call to it, and so the number called must be associated with a mailbox or be the subscriber number. In other PBX systems, this number is often called the Pilot Number. In the lab we are building here, with a four digit dial plan, the chosen subscriber number is 8500.

To add the subscriber number click the configure UM dial plan button on the UM Dial Plan properties screen and change to Outlook Voice Access tab

image

Change any of the the remaining properties as required before saving your changes.

Back on the UM Dial Plan screen edit the default UM Mailbox Policy as required. I would suggest for a lab environment that you have a 4 digit PIN and no requirement to reset it.

image

For the purposes of the lab we are not going to configure the UM Auto Attendants and we will just use the default hunt group created.

The previous blog post covered these same settings for Exchange Server 2010. The next part, Part 7 will look at configuring users (mailboxes) to have valid unified messaging settings and then Part 8 will look at the configuration on the PBX to create a trunk to reach your Exchange Server and the settings to forward voicemail messages to the Exchange Server. These following posts look at the configuration mainly from an Exchange 2010 viewpoint, but will work for Exchange Server 2013.

Building An Exchange Unified Messaging Lab (Part 5)

Posted on Leave a commentPosted in 2010, asterisk, asterisknow, exchange, unified messaging, voicemail, voip

Earlier parts in this blog have talked about VoIP, configured AsteriskNOW software PBX and configured inbound and outbound calls via the PBX. Now it is time to configure voicemail to be provided by Exchange Server and for the telephone users to be able to call Exchange an listen to their voicemail. In addition to listening to voicemail, when a user logs into Exchange via their telephone handset Exchange can read and the user change items in their mailbox (i.e. delete email, change calendar bookings) and direct calls to other users.

This blog article will look specifically at Exchange Server 2010. The following article will repeat the steps here, but for Exchange Server 2013. So lets start by configuring all the required pieces on the Exchange Server.

Configuring Exchange Server 2010 Unified Messaging

The first thing to set up in Exchange Server 2010 is to ensure that you have the Unified Messaging role installed on at least one Exchange Server. This role can be shared with any other role apart from the Edge Server role is you need to. Once the role is installed go to the Unified Messaging area under Organization Configuration in EMC.

By default Exchange is installed with the United States language pack. Download and install the correct unified messaging language packs for your country. These are service pack dependent, so install the correct one.

For Exchange 2010 create a UM Dial Plan with the correct number of digits (four in the case of this blog), set Unsecured for VoIP Security and enter your Country/Region code (44 for the UK).

image

Click Next and associate the server on which you installed the UM role with this dialplan.

In the UM IP Gateways dialog add a gateway for the IP address of your PBX. Exchange requires TCP support and we covered the steps for configuring Asterisk in Step 3 to support SIP over TCP.

image_thumb3

If you are using a PBX that supports custom ports for SIP over TCP (Asterisk 1.8 does not support this for TCP) then remember to adjust the port in Exchange Server. You set the port if different from 5060 using Exchange Management Shell: Set-UMIPGateway –identity BlogGateway -Port 5065 for example.

The application event log will show if there are errors in the IP Gateway configuration. If there are no errors and Exchange is able to communicate successfully with your PBX over TCP then it will report Event ID 1401

The following UM IP gateways responded promptly to a SIP OPTIONS request.
Transport = TCP, Address = 192.168.5.100, Port = 5060, Response Code = 200, Message = OK

If you change your view to the UM Mailbox Policies tab then you can see the default mailbox policy that has been created for you. You might want to change this, but at the very least you need to check its settings. For a lab environment I suggest a 4 character PIN, no PIN lifetime and 1 previous PINs to disallow.

image

For now you do not need to create a UM Auto Attendant and so we will skip this section of the configuration for you to return to in your own time later.

Now that you have the initial configuration complete, go back to the UM Dial Plans tab and open the dial plan that you created earlier. You will need to associated a subscriber access number with this dial plan. This is the number that users will call to listen to their voicemail. Exchange Server will be informed of the dialled number when the PBX forwards the call to it, and so the number called must be associated with a mailbox or be the subscriber number. In other PBX systems, this number is often called the Pilot Number. In the lab we are building here, with a four digit dial plan, the chosen subscriber number is 8000:

image

Finish the remaining tabs in this dialog by entering valid Dial Codes and other options as you need to:

image

Change to Server Configuration > Unified Messaging in the Exchange Management Console and double-click your unified messaging server. Ensure the UM Settings properties reads TCP for startup mode and if you change this ensure that you restart the Microsoft Exchange Unified Messaging service.

The next blog post will cover these settings for Exchange Server 2013 and then the two following will look at the mailbox configuration and the configuration on the PBX to create the trunks to reach Exchange Server and the settings to forward voicemail messages to the Exchange Server.

Building An Exchange Unified Messaging Lab (Part 4)

Posted on Leave a commentPosted in 2010, asterisk, asterisknow, exchange, pbx, voicemail, voip

This blog post series is the steps to build a working unified messaging lab for Exchange Server. I thought I would write it all down as I found a lack of end to end documentation for the process and what I thought would be a days work turned into many as I worked at finding all the settings and configurations having no experience on the subject before this.

This part will look at taking the already installed AsteriskNOW server (in Part 2 and Part 3) and configuring a few telephone extensions and external calls. Part 5 will look at configuring unified messaging in Exchange Server 2010 and Part 6 the same for Exchange Server 2013. Later parts will look at connecting Asterisk to Exchange for voicemail.

Configuring Extensions

For this part you will either need to download a softphone (a SIP phone running as software on your PC) or have two physical SIP phones – EBay is a good source of SIP phones. I have two Draytek Vigor 350 phones which are a basic office phone that can connect to any SIP based IP PBX.

First we need to create two extensions based on your already determined dialplan (see Part 3 for more). In this lab 8xxx is the dialplan, so extension 1 will be 8001 and extension 2 will be 8002. Both extensions will have similar settings, just things like display name and extension number will change.

These changes can be made in FreePBX or directly in the config files. To do this in FreePBX click the Applications menu and select Generic SIP Device from the Device drop-down.

imageEnter the following as a minimum: Extension number, Display Name, a complex password for the secret (containing two letters and two numbers) and voicemail should be enabled and a voicemail password set (but the remaining voicemail settings can be ignored). Unless the phone will be used outside the firewall, set NAT to No-RFC3581. The secret will be the password the phone uses to register with the PBX. The user of the phone does not need this value and therefore make it very complex and you can copy and paste it into the phone’s configuration pages. If it is simple then you might find external connections being made to your PBX, logging in as your extension and making paid calls on your behalf and using up your credit with the SIP Trunk provider.

Repeat these steps for each extension you have and click Apply Config when finished. Remember that you made direct changes to sip.conf file (or the sip_general_custom.conf file) and the rtp.conf file and you have not yet applied these changes to Asterisk. Clicking Apply Config in FreePBX does all this for you. Use amportal restart from the Linux console if you made all the changes directly in the config files.

Connecting Telephones To Asterisk PBX

The exact steps for this will depend upon your actual phones, but you will need to have the IP address of the PBX, the SIP port, the extension number and the secret to hand. If your phone has a voicemail button then enter the pilot number as the number to call, as that is the number you chose for voicemail when looking at the dialplan.

The Draytek Vigor 350 phones that I am using have a web interface to them and the IP address can be determined from the phone menu button. From the phones web GUI I select SIP Account Settings and then select one of the available accounts, as this phone supports multiple SIP based IP PBX’s. The required information is then filled in:

imageIn my case I am using port 5065 for SIP (over UDP) so I needed to mention it on the Registration Server line. If I was using 5060 I would not have needed it for this phone. Notice that once the information has been entered the phone shows that the connection is registered.

I repeat the configuration for all the other phones I have, just using the correct secret, display name and extension and once registration is complete the phone displays the SIP account by its display name on the LCD panel. I need to select this account to make calls using it on this phone.

You should now be able to dial the other extensions in your telephone network.

Configuring Trunks

Trunks are the name given to connections to other telephone systems and we need to configure a trunk to the outside world to enable us to make and receive calls from other phone systems. We will also in a later part of the blog make a trunk to Exchange Server for unified messaging.

To configure a trunk to the internet for making and receiving SIP based calls or for a SIP based call to be placed onto the classic telephone network you need an account with a SIP Trunk provider. There are a number of providers that are approved by Microsoft for use with Lync Server, but for now any that you have used before or can find via a web search should do. For this blog I am going to use Voipfone in the UK. Once I registered I got an email and 5 minutes of free outbound calls. The email contains my account details, inbound telephone number (UK starting 0560 in this case). Instructions for configuring Asterisk with Voipfone are at http://www.voipfone.co.uk/Asterisk_Setup.php and so I will not repeat them here apart from stating that you need to ensure that the settings go in the correct file.

imageIf you have FreePBX installed as we do in this blog then you need to put the register value in sip_general_custom.conf and the [voipfone] section in sip_additional.conf or use the FreePBX web GUI directly. This is what we have done in the screenshot to the right:

The SIP Trunk settings are configured in FreePBX by going to Connectivity menu > Trunks. Add SIP Trunk and entering the required details. In the screenshot 12345678 is the account number and XXXXXX is the secret/password for the SIP trunk (which may or may not be the password for your account depending upon the provider). Don’t reveal this information, as it will allow others to use your credit at the SIP provider.

The settings entered into the trunk configuration are a simple as the name of the trunk under General Settings and again under Outgoing Settings and the following for PEER Details:

type=friend
secret=XXXXXX ;your voip password
username=12345678 ;your account number
fromuser=12345678 ;accont number again
fromdomain=sip.voipfone.net
host=sip.voipfone.net
insecure=very
dtmfmode=rfc2833
context=from-pstn
deny=0.0.0.0/0.0.0.0
permit=195.189.173.27/255.255.255.255
qualify=yes

And finally the following for the Register String:

12345678:XXXXXX@sip.voipfone.net/12345678

PEER Details and Register String values are available from your SIP Provider. You do not need to set an Outbound CallerID as per the warning you get in FreePBX. In addition to the settings I was provided by the SIP Trunk provider, I added qualify=yes to the PEER settings. This allows me to monitor connections to this trunk with the “sip show peers” command from the Asterisk console.

Configuring Outbound Routes

Before you can make any calls you need to set an Outbound Route and before you can receive any calls you need to make an Inbound Route. For the Outbound Route (Connectivity menu > Outbound Routes) create a new route for your SIP provider. At the very least you can give a name for the route and select the trunk you just created for Trunk Sequence 0. It is possible to add dial patterns to improve the functionality of the route. For example in the UK it is possible to dial six or seven digits when ringing within the same town or city. For this call to be handled by a UK SIP provider we need to automatically add the area code and for a non-geographic SIP provider we would need to add the international code as well. In the below screenshot the Outbound Route contains entries for handling emergency calls (route 999 and others via this SIP provider) and if I dial a local Oxford number (01865 being the area code) then all I need do is dial six digits and Asterisk converts this to 00441865XXXXXX.

image

The (0044)+0|[XXXXXXXXXX]/ entry will match any eleven digit number starting with 0 (X=any digit), remove the 0 and add 0044 before sending down this route. This allows for UK wide national calling. Miss any valid route (or place the numbers against a non-existent route) and you stop calls being placed to those numbers. A simple way to bar calls to premium rate numbers or international numbers. The 00. route matches all numbers starting 00 of any length and routes them via the trunk – this is to allow international calls. The full-stop/period symbol indicates any number and any number of numbers.

Apply Config to make your changes and then check in the Asterisk console if the connection is working okay by typing asterisk -Rv to enter the console for Asterisk and then sip show peers to see who is online.

Whilst you have the Asterisk console open (asterisk -Rv entered) if you make an external call it will show you the connection and any errors should there be any. Use the screen command before you enter the Asterisk console to allow you to scroll back through any messages reported to the console. Use ! to exit the Asterisk console and CTRL+A then [ to allow you to access the screen mode and allow the use of the arrow keys to scroll up and down the console output.

image

image

You should now be able to make outbound calls. Things like CallerID and so on are typically configured at your SIP provider, and in the case of Voipfone the default is to withhold them. It is also UK law to enter your physical address should you route an emergency call via a UK SIP Trunk from a UK address, and so if this applies to you then do this now – you don’t want to have to call an emergency and find you need to reconfigure your telephone first! Similar conditions will probably apply in your country too.

Configuring Inbound Routes

This blog will not go into the process of setting up an IVR (telephone answering menu) and will just route inbound calls to a single telephone extension. If you have a full telephone number per extension (DDI) then you can set up a number per physical device or you can create an IVR by adding that module to Asterisk.

To route all inbound calls to the primary extension (in this blog that is 8001) you need to enter the following config file entries:

imageOr use FreePBX and Connectivity menu > Inbound Routes and enter a name, your account number and a destination of going to a selected Extension.

Finally, dial the inbound number your VoIP provider has given you from another telephone system and see if your extension rings and that you can answer it and have audio going in both directions. One way audio typically means ports blocked on your firewall. If you extension does not ring then look on the Asterisk server console for any error messages. A common one is about context, and for this make sure that the Trunk configuration contains context=from-pstn and no other context values. Advanced configuration can change the context later, but this is outside of the scope of this blog.

So now we have a PBX that support IP (and specifically TCP) and you are able to make and receive telephone calls. Now its time to move to Part 5 to configure Exchange Server to provide your voicemail service and voice access to your email and calendar.

Building An Exchange Unified Messaging Lab (Part 2)

Posted on 1 CommentPosted in 2010, 2013, asterisk, asterisknow, exchange, sip, unified messaging

This series of blog posts started with Part 1 where we discussed the requirements of the lab and what you would need from any PBX that you might have to hand. Part 2 (and the next few parts) will look at installing AsteriskNOW to provide a software PBX to support the Exchange Server unified messaging environment.

Installing AsteriskNOW Software IP PBX

Start by downloading the latest version of AsteriskNOW from http://www.asterisk.org/downloads. This is a easy to install version of the open source Asterisk IP PBX. AsteriskNOW installs the underlying Linux OS it needs with very little initial configuration and is especially easy for non Linux people like myself! This blog is based on AsteriskNOW 2.0.2

While AsteriskNOW is downloading create yourself a new virtual machine with the following configuration:

  • 512Mb RAM (dynamic memory not required)
  • 1 Processor
  • 1 Legacy Network Card (that is, remove the standard NIC that Hyper-V adds to new virtual machines and add a legacy network adapter). AsteriskNOW runs on CentOS and this does not have an easy to install Hyper-V Integration Services that would provide support for the standard network card.
  • Connect this network card to a physical network with internet access.
  • 1 new virtual hard disk, dynamically expanding is fine. 15GB should be plenty, though no harm is making its maximum size larger if you need to.
  • Once the AsteriskNOW iso is downloaded attach this to the virtual machine.

The settings for the virtual machine should similar to the below screenshot:

image_thumb1

Start the virtual machine and then connect to it to see the installation proceed.

First, select option 1 to install Asterisk 1.8 and the FreePBX web interface for the PBX:

image_thumb2

CentOS (a Linux distribution) will install automatically followed by an installation of AsteriskNOW and FreePBX. You will be asked to create the disk partition, wiping all data – and your answer will be Yes:

image_thumb3

Then you will need to partition the hard disk. Choose the option to Use free space on selected drives and create default layout and click Next.

image_thumb4

Select your timezone and check the box System clock uses UTC and click Next.

image_thumb5

Enter the password that you want to use for the root account. Click Next and go and get a coffee. A long coffee! And come back in about 30 minutes.

image_thumb7

Finally, and before you reboot the server at the end of the installation, change the virtual machine settings so that the ISO is not mounted as a DVD.

The Initial Configuration of AsteriskNOW

After the installation has completed and the new software PBX has been restarted you can complete the initial configuration of the server. This includes network and other settings such as NTP time sync and keyboard changes is you are not based in the US.

To make some of these changes you will need to either have experience of using Linux text editors or install WinSCP and use this to edit the config files from Windows. WinSCP can be downloaded from www.winscp.net

First change is the network settings. The Setup Agent screen appears, and you can exit from this (or wait and it will disappear shortly). You will be presented with the login screen:

image_thumb8

Enter root and the password you choose during setup. Make a note of the IP address that is currently assigned to the server. This is shown above the login prompt. If you forget the IP address you can type ifconfig at the prompt in the console to be reminded of it.

Type system-config-network to allow you to change the IP address and DNS on the server. Note that DNS changes will not work until after the network is restarted (or the server rebooted).

image_thumb9

Tab until Edit Devices is selected and press Enter.

Your current network card will be highlighted. Press Enter to let you make changes. If this virtual server is clustered you will need to change the IP address and reboot, then switch the virtual server over to the other node(s) and configure an identical set of network settings and reboot on each node. If you don’t then the server will have different IP addresses per node that it runs on.

image_thumb10

image_thumb11

Tab to change fields, use space to deselect the * under Use DHCP and then enter a valid fixed IP for your network, and valid mask and gateway settings. Tab to OK and space to action this.

Tab to select Save and then select Edit DNS Configuration. This DNS configuration will only take effect after you restart the network upon changing the IP address (or use /etc/init.d/network restart to restart the network). So after reboot run system-config-network to make these changes. Do not set the primary DNS IP as 127.0.0.1 as a DNS server is not installed on the AsteriskNOW box.

image_thumb12

Reboot your server with shutdown –r now and upon restart connect to the server’s fixed IP address with WinSCP to do some other initial configuration.

Start WinSCP and click New to create a new session. Enter the IP address (or DNS name if you have made one) for the server. Enter root and your password where needed and set the File Protocol to SCP:

image_thumb14

Click Save and then Login. Accept the prompt about the server’s key and then you will see the local file system and server’s file system:

image_thumb15

Edit the file /etc/sysconfig/keyboard so that KEYTABLE=”xx” where xx is the name of the keytable file located in /lib/kbd/keymaps/i386 not including the .map.gz bit of the filename. For example my value would be uk.

Navigate to /usr/share/zoneinfo and find the folder names that match your timezone. Mine is Europe/London.

In the AsteriskNOW server console login and type the following where Europe/London matches the folder and filenames you located.

ln -sf ../usr/share/zoneinfo/Europe/London /etc/localtime

Then enter the following to see the time on the hardware clock and change it if needed. The last command set the hardware clock to the value of the system clock:

hwclock
date mmddhhmm
/sbin/hwclock --systohc

Finally to set automatic updating of time to an NTP clock (port UDP 123 outbound is needed if going to the internet, or just enter the IP of a domain controller) you need to enter the following commands:

yum install ntp 
chkconfig ntpd on
ntpdate pool.ntp.org
/etc/init.d/ntpd start

Update CentOS to the latest updates

Get the latest updates for CentOS and Asterisk with the command yum update.

On completion of the updates reboot the server with:

shutdown –r now

After the reboot check that the DNS values have been set correctly. To avoid a reboot use:

/etc/init.d/network restart

Install the Hyper-V Integration Tools

To allow for time sync and other integration with Hyper-V download the Linux Integration Services Version 3.4 for Hyper-V from http://www.microsoft.com/en-GB/download/details.aspx?id=34603.

This download is an ISO file. Attach the ISO to the Asterisk virtual machine.

In the Linux console type the following:

mount /dev/cdrom /media
cd /media/RHEL58
./install-rhel58.sh

Allow the installation to complete and reboot with shutdown –r now.

Initial Configuration of FreePBX

Login to http://your_IP and use admin and admin as the username and password.

If the webpage looks like it is broken and the following links don’t work (it keeps logging you out) then from the server console type the following command to fix the issue.

amportal restart

Once you are logged into the FreePBX console without issue, if there is a retrieve_conf error towards the top left the run the following commands from the console

rm -rf /etc/asterisk/logger.conf
ln -s /var/www/html/admin/modules/core/etc/logger.conf /etc/asterisk/logger.conf #ln to here is one entire line
amportal reload

Click Admin menu > Administrators and select admin user on the right. Change the admin user password and click Submit Changes button. Don’t click the Apply Config button that has just appeared on the toolbar. You have other changes to make first.

Click Admin menu > Module Admin > Check Online > Click the Upgrade All link to the right and the click Process > Confirm and finally the Return link once you scroll all the way down the update popup screen.

Click the red Apply Config and after the configuration has reloaded, logout and back in again with your new password.

Change the default ARI Admin password from Advanced Settings menu. To do this click Display Readonly Settings and Override Readonly Settings to True. Click the Green save icon and then Apply Changes. Find the User Portal Admin Password field and change it. Click Save and then Apply Config. Change the two Readonly settings back to False, Save and Apply Config.

The next part of this blog series will look at further configuration of Asterisk PBX to support Exchange Server (TCP needs to be enabled amongst other settings) and to configure the firewall to allow external calls to and from the PBX.