I have use the following script to produce excellent sounding music on hold files.

You must download the files as a wav (RAW) file to the server first. then run the script.

You may use audacity to convert files to wav first before copying them to the server. You will also need to download 'lame for audacity' to convert mp3 files to wav.


Library Pluggins required for MP3 and FLAC



The script converts all the wav files to their correct format and also normalises the volume. (8000hz 16bit Mono)

You will also need sox installed on the server: eg yum install sox

for i in *.wav; do
    echo "** Checking volume levels for $i"
    ampl=`sox "$i" -t wav /dev/null stat -v 2>&1 | grep -v sox:`
    echo "** Amplifying volume by $ampl to fake a normalize and converting $val.wav to 16 bit 8000"
    sox -v "$ampl" "$i" -t wav -r 8000 -b 16 -c 1 -s -t wav "$val.converted.wav"
    echo "** Removing original file $val.wav"
    rm -f "$val.m4a"
    echo "** Reducing the volume and creating $val.wav"
    sox -v .5 "$val.converted.wav" "$val.wav"
    echo "** Removing $val.converted.wav"
    rm -f "$val.converted.wav"
    echo "** $i is complete"
when completed copy the files in to the /var/lib/asterisk/moh/ folder

Then run “asterisk -r”, and then type in “moh reload”

en/installation_guideline_and_setup/setup_moh.txt · Last modified: 2017/12/12 03:05 (external edit)
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki