Music on Hold

Music on Hold

Provided By: MonkeyTech.Net for use by FaktorTel.

Step 1
Frist off check your version of mpg123
mp123 -V

I found i needed version Version 0.59r to work with asterisk and after reading some forums found others to have same problem

get it here here




cd mpg123-0.59r
make <<-- to see list of supported os
make linux <<-- for linux systems
make install
ln -s /usr/local/bin/mpg123 /usr/bin/mpg123

Step 2
Now make a dir for your music (you can also steam a shoutcast stream, will get to that soon)



cd /var/lib/asterisk/mohmp3/
mkdir mymusic

Place some mp3 files in the folder we just made

Step 3
Edit the /etc/asterisk/zapata.conf and make sure the following line is uncommented (not sure if this is really needed by cant hurt)




Step 4
Now we need to tell Asterisk where to find the music to play while on hold

Rename musiconhold.conf



mv musiconhold.conf musiconhold.backup

Create new musiconhold.conf we your text editor (nano / pico)



nano /etc/musiconhold.conf

Add these lines


default => mp3:/var/lib/asterisk/mohmp3/mymusic,-z

*note the "-z" flag plays files randomly remove ,-z to play files in order

For streaming audio on musiconhold

make another dir in /var/lib/asterisk/mohmp3/ called stream
then create a empty file with a .mp3 extenstion



cd /var/lib/asterisk/mohmp3/
mkdir stream
cd stream
touch stream.mp3

nano /etc/musiconhold.conf and change the Default line above to something like this



default => mp3:/var/lib/asterisk/stream,

make sure you add the URL to the shoutcast server you wish to use
at asterisk prompt issue "reload" command or restart askterisk

Using Module Format_mp3 instead of mpg123

there are some issues with mp3 playback and mpg123
if you are having problems mite like to try this


cd /usr/src
cvs login      - the password is anoncvs.
cvs checkout asterisk-addons
cd asterisk-addons/format_mp3
make install

make sure "autoload" is enabled in /etc/asterisk/modules.conf

Create Dir


add Dir

add mp3 files into that dir

edit musiconhold.conf


nano /etc/asterisk/musiconhold.conf

uncomment the "default" conext we made above. make sure you have these lines

default => /var/lib/asterisk/moh-native

*note the smaller the filesize the better .. e,g dont need anything over 128k and really only needs to be mono

on your softphone u can place call all hold pressing the "1" button under the display

if this is any problems of typos please let me know

i will have a voicemail howto up soon, i am just setting up a different speech synth program and will include that in the example