Add Key-Press Features to Communications Server when Asterisk is the Gateway
This article explains how to use Asterisk to monitor the call flow to Office Communications Server 2007 R2 for certain key presses, and then respond to those key presses. Initially, key-press features were intended to enable callers to press keys while they are being held in a response group queue. For example, "At any time, press the pound key twice to leave a voicemail.” But key presses have also been used for other features, such as call parking. The procedures in this article are intended for configurations where incoming calls pass through Asterisk before reaching Communications Server, essentially using Asterisk as a gateway.
Author: Paul Adams
Publication date: June 2010
Product version: Microsoft Office Communications Server 2007 R2, Asterisk 1.6
During a Communications Server 2007 R2 implementation, I used Asterisk 1.6 as a gateway for Communications Server to the outside world.
For some departments, I used the response group feature to manage incoming customer calls. We received comments from customers that sometimes they would like to leave a voicemail for the department or talk to a receptionist rather than wait in the call queue.
One option I thought of was to use the timeout feature of the response group to present the caller with a menu choice. For example, “Press 1 to leave a voicemail or press 2 to continue holding.” However, this configuration would remove the person from the response group queue, register their response to the prompt, and then place them back into the queue. In addition, this has the negative side effect of placing the person at the back of the queue, rather than into their original spot.
Another option was to create multiple response group queues, and then name the queues to reflect how long the caller was holding to reach that queue, for example, callers – no hold, callers – 2 mins on hold, callers – 4 mins on hold. Incoming calls would then hold for up to 2 minutes, then hear a menu for options, then move into the next queue. I could then instruct my end users to answer calls in the highest hold time queues first; however, this proved to be confusing for my users.
While reading about Asterisk configuration for a different project, I learned that Asterisk can be configured to monitor the live call stream for key presses that match “feature keys”, and then configured to respond. I experimented with this feature and found that it could enable callers to press keys while being held in a response group queue within Communications Server. I’ve used this feature to add “call parking” and “call parking retrieval” for my Communications Server users.
In the following sections I’ll explain how to configure Asterisk to enable these feature keys along with some tips on amending the Asterisk dial-plan to respond after the keys are pressed.
While I have tried to explain some concepts as clearly as possible, I have made the assumption that you have some basic experience with editing an Asterisk dial plan.
Access to the command prompt on the Linux or Asterisk server is required. If you are working from your computer that is running Windows and connecting to the Linux or Asterisk server, I suggest the excellent free terminal program PuTTY.
To configure a feature key, do the following:
From the command line prompt of your Linux or Asterisk server, find your Asterisk configuration files (my configuration files were in /etc/asterisk).
Edit the features.conf file. (I use the Linux editor ‘vi’.)
After the heading [applicationmap], you can define custom key-press features. Let’s use ## as an example and define it to run a macro (we’ll use the macro later in our Asterisk dialplan). We will use this feature to send the caller to the receptionist (extension 1234).
Enter a new line after the [applicationmap] heading that contains the following text:
sendtoreception => ##,self,Macro,toreception
The basic explanation of the previous line is that the first section, sendtoreception, gives a name to the feature that we can reference from our dial plan. The ## section defines the key strokes that will be used to activate the feature. The Macro section states that the next parameter is the name of a macro to run when this feature is used. The name of our macro is “toreception”.
We have now created a feature. Save and exit from the features.conf file.
- Enter a new line after the [applicationmap] heading that contains the following text: sendtoreception => ##,self,Macro,toreception
Edit the extensions.conf file.
In this example, our Communications Server Mediation server will be at IP address 10.10.10.10 and the receptionist number within Communications Server is 4000.
After the [general] and [globals] sections of the extensions.conf file, create the following new macro:
exten => s,1,Dial(sip/10.10.10.10/+4000)
- After the [general] and [globals] sections of the extensions.conf file, create the following new macro:
After creating the macro that will be used by our feature, we must tell Asterisk where to use it in the dial plan. In this example, a department’s customer information line in Communications Server will be 5000. (In my actual Communications Server implementation, the number I used was a response group contact object in Communications Server.)
In the extensions.conf file, edit your dial plan and add an extra line at the start of the section that passes the call to your customer information line in Communications Server. This extra line informs Asterisk to use the feature at this point in the dial plan:
exten => XXXX,1,Set(__DYNAMIC_FEATURES=sendtoreception)
Note: In the previous line, replace XXXX with your extension number.
- In the extensions.conf file, edit your dial plan and add an extra line at the start of the section that passes the call to your customer information line in Communications Server. This extra line informs Asterisk to use the feature at this point in the dial plan:
Save and close the extensions.conf file. You may need to reload Asterisk to get these features in place.
Test it! Call your Communications Server response group queue from the outside world. Try pressing ##, and you should be redirected to the receptionist (extension 4000 in Communications Server).
Warning: Be careful what keys you select for your features. Asterisk will monitor for these key presses and respond to them. Therefore, it is possible to set a feature to work on ALL calls that flow through Asterisk.
For example, you define a feature as key strokes ‘11’. You receive a call from a customer who asks you to transfer their call to another number, for example, 115. When you attempt to transfer the call to 115, Asterisk detects the key strokes ‘11’ and responds by implementing the feature that you configured for ‘11’.
By using this configuration feature of Asterisk, I was able to redirect customers from Communications Server response group queues to voicemail or to the receptionist.
I also found I could configure the call parking features in Asterisk and use it from within Communications Server to park calls and then retrieve them again. (If you want to implement this, read about the Asterisk features.conf file and the dial command using the lower case ‘k’ switch).
While this solution might not be ideal, it did achieve the end result of offering a way for customers to press keys and be redirected while held in a Communications Server response group queue.
Visit the Communications Server main page at http://go.microsoft.com/fwlink/?LinkId=132607.
View the complete Communications Server documentation library at http://go.microsoft.com/fwlink/?LinkId=132106.
Download the Communications Server content as Word documents at http://go.microsoft.com/fwlink/?LinkId=133609.
Download the Communications Server documentation as a compiled help file at http://go.microsoft.com/fwlink/?LinkId=160355. (Scroll down to the Additional Information section and download OCSDocumentation.chm.)
Read weekly articles for Communications Server IT professionals on NextHop at http://go.microsoft.com/fwlink/?LinkId=181907.
Read NextHop articles in the Technical Library at http://go.microsoft.com/fwlink/?LinkId=185344.
Subscribe to NextHop feeds on the OPML List for NextHop page at http://go.microsoft.com/fwlink/?LinkId=185345.
Read weekly articles for Communications Server developers on UCode at http://go.microsoft.com/fwlink/?LinkId=177892.
Follow tweets from the Communications Server team at http://go.microsoft.com/fwlink/?LinkId=167909.