Add Key-Press Features to Communications Server when Asterisk is the Gateway

Microsoft Office Communications Server 2007 and Microsoft Office Communications Server 2007 R2 will reach end of support on January 9, 2018. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

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.

Tools You Might Need

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.

Configure Feature Keys

To configure a feature key, do the following:

  1. From the command line prompt of your Linux or Asterisk server, find your Asterisk configuration files (my configuration files were in /etc/asterisk).

  2. Edit the features.conf file. (I use the Linux editor ‘vi’.)

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

    1. Enter a new line after the [applicationmap] heading that contains the following text: sendtoreception => ##,self,Macro,toreception

    2. 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”.

    3. We have now created a feature. Save and exit from the features.conf file.

  4. Edit the extensions.conf file.

  5. In this example, our Communications Server Mediation server will be at IP address and the receptionist number within Communications Server is 4000.

    1. After the [general] and [globals] sections of the extensions.conf file, create the following new macro:


      exten => s,1,Dial(sip/

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

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


      In the previous line, replace XXXX with your extension number.

  7. Save and close the extensions.conf file. You may need to reload Asterisk to get these features in place.

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


    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.

Communications Server Resources

We Want to Hear from You