Customizing the Music On Hold (MOH) message on Asterisk

incoming calls on your standard lines are handled and the greeting message is played ( the_welcome_ class being specified for the queue welcome); let us see how it is defined. MOH is described in /etc/asterisk/musiconhold.conf.

When installing Asterisk, this file contains this:

[general]

[default]
mode=files
directory=moh

You will need to append the following section to it:

[welcome]
mode=files
sort=alpha
directory=/etc/asterisk/moh1

By this record, you tell the Asterisk server to play files from the directory /etc/asterisk/moh1 by alphabetic order. The recorded message is put in this directory. To decrease server load, you should first convert the message with ffmpeg@ (the package media-video/ffmpeg is pre-installed in Calculate Linux Desktop) to the most commonly used codecs: _alaw, ulaw, g722, g729, gsm and in Asterisk Native SLN, for Asterisk to be able to convert immediately.

For instance, to convert to Native SLN with ffmpeg, execute:

ffmpeg -i "[input file]" -ar 8000 -ac 1 -acodec pcm_s16le -f s16le "[output file].sln"

To convert the existing mp3 files to mono wav and ulaw pcm, enter:

for f in `ls *.mp3` ; do FILE=$(basename $f .mp3) ; ffmpeg -i $FILE.mp3 -ar 8000 -ac 1 -ab 64 $FILE.wav -ar 8000 -ac 1 -ab 64 -f mulaw $FILE.pcm -map 0:0 -map 0:0 ; done

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: