Using Asterisk to Supply Standardized On-Hold Music for Office Communications Server 2007 R2

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 describes how to use Asterisk to supply standardized, company-wide, on-hold music for all your Microsoft Office Communications Server 2007 R2 end-points (softphone or Voice over Internet Protocol (VoIP) phones). Configuring each end-point in Office Communications Server 2007 R2 can be time-consuming. This scenario is intended for configurations where incoming calls pass through Asterisk first before they reach Office Communications Server, (essentially when using Asterisk as an Office Communications Server gateway).

Author: Paul Adams

Publication date: June 2010

Product version: Microsoft Office Communications Server 2007 R2 and Asterisk 1.6

During a Microsoft Office Communications Server 2007 R2 implementation, I used Asterisk 1.6 as a gateway for Office Communications Server 2007 R2 to connect to the outside world. For more information about creating a gateway, see Geoff Clark’s blog post Asterisk 1.6 with Office Communications Server 2007. On the desktops, I rolled out a mix of snom 300 series phones (with Office Communications Server firmware) and the Office Communicator 2007 R2 desk clients.

When it came to addressing the issue of on-hold music, I started thinking about how much work it would be to deploy on-hold music to each client and then change that on-hold music every time we wanted to add a new promotion or switch to “holiday tunes”—lots of work.

I remembered that Asterisk responds to requests in the call stream for on-hold music, but there is a catch—this would only work for calls that pass through Asterisk to reach Office Communications Server. This was acceptable to me because the most important people who needed to hear our on-hold music were our customers, calling in from the outside world (the on-hold music was interjected with useful company information).

In this article, I’ll show you how to get your company’s on-hold music configured in Asterisk. I’ll also cover some useful lessons that I’ve learned during my on-hold journey. I assume that if you’re using Asterisk as a gateway, you probably know how to perform most of the administrative tasks that I’ll cover here in Linux and Asterisk. I’ve tried to offer as much guidance as possible.

Tools You Might Need

Assuming that you’re working in a mainly Microsoft Windows environment, with Asterisk running on a Linux server, you might find the following tools useful. If you use Asterisk, you may already be familiar with some of them. If needed, download the following tools:

  • PuTTY (used to connect securely to a Linux server command prompt).

  • Pscp (used to transfer files to and from a Linux server).

  • Audacity (a free, cross-platform sound recording and editing tool; useful for re-sampling, adjusting the volume, and so on, of your on-hold music).

Implement Your On-Hold Music

  1. Open your on-hold music in your preferred sound editing tool (I used Audacity). Convert your on-hold music files to Ulaw, mono, 8000 Hz, 8-bit. Save them as .wav files (PCM-encoding). Copy your new .wav files.

    Note

    Asterisk works with other formats for on-hold music, but the calls to and from Office Communications Server are in Ulaw. Formatting the on-hold music files to Ulaw means that Asterisk doesn’t need to convert the music in real time to use it.

  2. Transfer the file to your Asterisk server by using the following command as shown:

    **pscp –pw password <filename> root@10.10.10.10:/var/lib/asterisk/moh/<filename>**This example transfers a file to a Linux server at IP address 10.10.10.10, using the user ”root” and a password of ”password”. This then transfers the file to the /var/lib/asterisk/moh directory (for reference, this is where my files are stored).

    There are several ways to transfer this file, and although pscp syntax can be a little tricky, I found that it was the easiest way for me to do the transfer.

  3. Use PuTTY to connect to your Asterisk server, and then go to a Command Prompt window.

  4. From the command prompt, navigate to your music on-hold directory (for me, that was /var/lib/asterisk/moh), and then delete all the other on-hold music files except the files that you just transferred.

    • If you want to save the other files first, make a directory by using the mkdir command, and then copy the files into it by using the cp command.

    • Delete the other on-hold music files by using the rm command.

  5. Using PuTTY, navigate to your Asterisk configuration files (mine were in /etc/asterisk), and then edit the musiconhold.conf file. (I used vi, the Linux text-based editor tool.)

    My musiconhold.conf file contained a very simple configuration. Beneath the section header, called [default], there were two lines:

    mode = files

    directory=/var/lib/asterisk/moh

  6. You may need to reload the on-hold music in Asterisk to use the new configuration.

Test Your Implementation

  1. Place a call that flows into Asterisk, then to Communications Sever, and then reaches a Communications Server end point.

  2. Answer it and then put it on hold.

  3. If the music is too loud or too quiet, open the original sound file in your sound editor and adjust the volume.

  4. In Audacity, use the Amplify feature. You can use a negative amplify number to lower the volume.

  5. Go back to step 2 in the previous section, and then work through the steps again.

    Tip

    When you’re testing, make calls from different devices, such as a regular telephone and a cell phone. I discovered that a volume setting that sounded acceptable on a regular telephone could be a little loud on a cell phone.

Summary

This solution saves me time and effort because I don’t have to maintain my clients individually—including their on-hold music files. I hope that this solution proves useful to you, too.

Communications Server Resources

We Want to Hear from You