The Hitchhiker's Guide to Asterisk | ||
---|---|---|
<<< Previous | Next >>> |
Before using Asterisk's Music On Hold feature, mpg123 and a timing system must be in place.
Music on Hold requires mpg123. Note that mpg321, which is often linked to /usr/bin/mpg123, will not work. Additionally, mpg123 must be installed in /usr/bin.
![]() | The latest release of mpg123 is mpg123 0.59r. The latest development release of mpg123 is mpg123 pre0.59s. Please use mpg123 0.59r. Using mpg123 pre0.59s can/may/will result in crashes and/or unreliable playback. |
mpg123 can be downloaded from http://www.mpg123.de. Before compiling mpg123, change the line in the Makefile that reads
PREFIX=/usr/local |
PREFIX=/usr |
Asterisk's Music On Hold application requires a timing source to work correctly. There are three possible timing sources that can be used:
The Zaptel drivers, which run Digium's Wildcard cards, can be used as a timing source. If you have a Zaptel card, there is no special setup needed other than loading the standard kernel module for the card. Simply set up the Zaptel interface as described previously in this guide.
ztdummy is a Zaptel driver designed for use as a timing source without having a Wildcard board. It uses the USB devices for timing, so the usb-ohci kernel module must be installed (lsmod can be used to check). ztdummy is included with the zaptel tree of Asterisk CVS. By default, however, it is not compiled. To enable the compilation of ztdummy, open the Makefile in zaptel source directory for editing. Find the line that reads
MODULES=zaptel.o tor2.o torisa.o wcusb.o wcfxo.o wcfxs.o \ ztdynamic.o ztd-eth.o wct1xxp.o wct4xxp.o # ztdummy.o |
ztrtc uses the system clock rather than the USB subsystem to get timing information. Note, however, that ztrtc does not work on multiprocessor systems. ztrtc does not come with Asterisk but is available from http://www.junghanns.net/asterisk/.
The musiconhold.conf syntax is simple and similar to other Asterisk files. Here is a sample configuration file:
[classes] default => quietmp3:/var/lib/asterisk/mohmp3 nirvana => quietmp3:/usr/share/mp3/nirvana-music random-nirvana => quietmp3:/usr/share/mp3/nirvana-music,-z loud-nirvana => mp3:/usr/share/mp3/nirvana-music |
Adding Music on Hold to the dial plan is fairly straightforward and simple. Just add MusicOnHold(class) as you would Dial() or Voicemail(). For example:
exten => 6789,1,Answer() exten => 6789,2,MusicOnHold(nirvana) |
In the United States and other countries, playing copyrighted music to strangers who call into your PBX (without a proper license) is illegal. However, high-quality, royalty free music does exist. An excellent source for it is http://www.openmusicregistry.org.
Licensing music from well-known artists is not terribly expensive, however. For sites with 10 or fewer incoming telco lines, a license from BMI (the largest licensor of popular music) can be had for a little less than $200 per annum. With this license, you may use any of BMI's 4.4 million songs for a Music on Hold application. More details are available at http://www.bmi.com.
<<< Previous | Home | Next >>> |
Auto-Dialout (Call Files) | DTMF over SIP |