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:
Implement Your On-Hold Music
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.
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.
Transfer the file to your Asterisk server by using the following command as shown:
**pscp –pw password <filename> email@example.com:/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.
Use PuTTY to connect to your Asterisk server, and then go to a Command Prompt window.
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.
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
You may need to reload the on-hold music in Asterisk to use the new configuration.
Test Your Implementation
Place a call that flows into Asterisk, then to Communications Sever, and then reaches a Communications Server end point.
Answer it and then put it on hold.
If the music is too loud or too quiet, open the original sound file in your sound editor and adjust the volume.
In Audacity, use the Amplify feature. You can use a negative amplify number to lower the volume.
Go back to step 2 in the previous section, and then work through the steps again.
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.
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.
To learn more, check out the following articles:
Communications Server Resources
Visit the Communications Server main page at https://go.microsoft.com/fwlink/?LinkId=132607.
View the complete Communications Server documentation library at https://go.microsoft.com/fwlink/?LinkId=132106.
Download the Communications Server content as Word documents at https://go.microsoft.com/fwlink/?LinkId=133609.
Download the Communications Server documentation as a compiled Help file at https://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 https://go.microsoft.com/fwlink/?LinkId=181907.
Read NextHop articles in the Technical Library at https://go.microsoft.com/fwlink/?LinkId=185344.
Subscribe to NextHop feeds on the OPML List for NextHop page at https://go.microsoft.com/fwlink/?LinkId=185345.
Read weekly articles for Communications Server developers on UCode at https://go.microsoft.com/fwlink/?LinkId=177892.
Follow tweets from the Communications Server team at https://go.microsoft.com/fwlink/?LinkId=167909.