Tired of mpg123 and wasted CPU?

THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

Simple run of the convertmp3 script or download of files can make things better.  

A. Try File-based (native) music on hold
Each call to music on hold will start playing file at beginning
then pause and pick back up where it left off if the same channel uses moh again.  

1. edit musiconhold.conf
[classes]
[moh_files]
default => /var/lib/asterisk/mohmp3/default/native,r

2. CONVERT FILES LIKE THIS:
http://5sn.net/asterisk/rawplayer/convertmp3
or
mpg123 -s --mono -r 8000 -f 4096 -b 10000 fpm-sunshine.mp3 | sox -t raw -r 8000 -s -w -c 1 - -r 8000 -c 1 -w fpm-sunshine.gsm

3. RESTART ASTERISK
/etc/init.d/asterisk restart


B. Use rawplayer
This has the same effect as the traditional MOH you are used to.

1. Create or download rawplayer
wget -O /etc/asterisk/rawplayer http://5sn.net/asterisk/rawplayer/rawplayer
chmod 700 /etc/asterisk/rawplayer

2. Edit /etc/asterisk/musiconhold.conf
[classes]
default => custom:/var/lib/asterisk/mohmp3/default/raw,/etc/asterisk/rawplayer

3. Convert or download .raw/.sln files.
http://5sn.net/asterisk/rawplayer/convertmp3
http://www.voip-info.org/wiki-Asterisk+mpg123+faking+it
mpg123 -s --mono -r 8000 -f 4096 junk.mp3 > quiet-junk.raw
mpg123 -s --mono -r 8000 junk.mp3 > junk.raw
mpg123 -w fpm-calm-river.WAV fpm-calm-river.mp3
sox -V fpm-calm-river.WAV -r 8000 -c 1 -w fpm-calm-river.raw

4. RESTART ASTERISK
/etc/init.d/asterisk restart
Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] convertmp3 23-Feb-2005 15:37 5.0K [DIR] mp3/ 17-Feb-2005 14:53 - [   ] musiconhold.conf 17-Feb-2005 15:09 2.0K [DIR] native/ 17-Feb-2005 14:53 - [DIR] raw/ 17-Feb-2005 14:53 - [   ] rawplayer 16-Feb-2005 12:52 375
Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-22 mod_ssl/2.0.54 OpenSSL/0.9.7e Server at 5sn.net Port 80