Thursday, November 11, 2004

Asterisk with MoH Patch on Debian Sarge

Music on hold is a nice feature of asterisk, implemented through res_musiconhold.so. To setup music on hold the standard way you need to download recompile and install mpg123 as voip-info suggests.

Note that on Debian there's a symlink between mpg123 and mpg321 (which is not supported currently). So, download mpg123-0.59r.tar.gz, compile it, and install it (by default the package is installed in /usr/local/bin, which is the first path searched by asterisk).

Another way to setup music on hold is to integrate MoH patch (the patch is bundled with chanspy) into the asterisk package, thus enabling native file format decoding and removing mpg123 dependancy. What follows are some simple steps to setup a MoH extension using ulaw encoded files.

0. Prerequisites

# apt-get install build-essential dh-make patch
# wget <url-to-chanspy-tar-gzip-archive>
# tar xzf chanspy.tar.gz

This command creates a directory named chanspy

1. Patch and rebuild asterisk

# apt-get source asterisk

This command creates a directory named asterisk-<current-version> (in my case asterisk-1.0.1)

# cd asterisk-1.0.1
# patch -p0 < ../chanspy/mohpatch.diff
# dpkg-buildpackage -D -b


If this last command fails, make sure to fulfill all the dependencies (don't be warned if more than 50 packages need to be installed).

# dpkg -i ../asterisk_*.deb

2. Add a sample extension to asterisk

First add the following lines to /etc/asterisk/extensions.conf

exten => 1234,1,Answer
exten => 1234,2,SetMusicOnHold(ulawfiles)
exten => 1234,3,MusicOnHold()

Then configure the ulawfiles class in /etc/asterisk/musiconhold.conf adding these lines

[moh_files]
ulawfiles => /usr/share/asterisk/sounds/ulawfiles

Make sure to have some files to be played in the right place

# mkdir -p /usr/share/asterisk/sounds/ulawfiles
# sox -V example.mp3 -t au -r 8000 -U -b -c 1 \
/usr/share/asterisk/sounds/ulawfiles/example.ulaw resample -ql

3. Restart asterisk and make a call to 1234 and enjoy the music on hold...

# /etc/init.d/asterisk restart

4. Fine tuning and audio improvements

With format_mp3.so module MoH can also play mp3 files. Some files may play scratchy due to the high volume level, you can adjust the amplitude with the "-v volume" flag of sox.

2 comments:

Unknown said...

Both sides also collectively released a 3 festivities to commemorate the tenth anniversary of cooperation
Nike Air Max Shoes
Nike Air Max 2011
Nike Air Max
Nike Air Max 2009
Nike Air Max 95
Nike Air Max 91
Nike Air Max 87
Nike Air Max 180
Nike Air Max Griffey Max 1
Nike Air Max 90
Nike Air Max 1
Nike Air Max Wildwood Supreme
Nike Air Max Turbulence
Nike Air Max Skyline
Nike Air Max Goadome
Nike Air Max Fitsole
Nike Air Max Zenyth
Nike Air Max Boots
Nike Air Max Zoom Kobe
Nike Air Max Tn
Nike Air Max LTD
Nike Air Max Presto
Nike Air Max BW
Nike Air Max 24 7
Nike Air Max 2010
Nike Air Max 2011
Abercrombie and Fitch London
Abercrombie & Fitch Clothes
Vibram Shoes
Cheap Air Max
Nike Air Max Shoes
I saw peach falling from the window in your house. Walking really happy, to ensure that all of the uncomfortable into simple

silence. I'm the only person who heard one's heart beat.

jelish said...

You wish for getting to create people nowadays worried about women? can you need a awesome coloring as women? We are Louboutin 2011store. we are able to provide you using a broad wide variety of Sale Louboutin. For example:Christian Louboutin Slingbacks,Christian Louboutin Peep Toe,Christian Louboutin Evenings,Christian Louboutin Pumps. andChristian Louboutin Mensis a very distinctive design, its design reflects its style. You put on it, that means you have its style.You put on it, that means you have its style.They are astonishingly psychological color. Please do not pass up an superb chance.
http://www.sale-louboutin-shoes.us