Streaming MOH

From KlavoWiki
Jump to navigationJump to search

What is MOH

Music on hold (MOH) refers to the business practice of playing pre-recorded music to fill the silence that would be heard by telephone callers that have been placed on hold. It is especially common in situations involving customer service.

Streaming MOH with Asterisk

mpg123 is the application to be used to stream internet radio into Asterisk.

Installing mpg123

The first thing we need to do is to download the application mpg123. Go to the source forge site for the latest version.

http://sourceforge.net/project/showfiles.php?group_id=135704

I'll use mpg123 Version 1.6.3 as an example.

cd /tmp
wget http://downloads.sourceforge.net/mpg123/mpg123-1.6.3.tar.gz
tar xvzf mpg123-1.6.3.tar.gz
cd mpg123-1.6.3
./configure
make
make install

Configuring Asterisk

Edit the file musiconhold.conf and use the following as an example.
/etc/asterisk/musiconhold.conf

[SkyFM-80s]
mode=custom
application=/usr/local/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s http://shoutcast01.edpnet.net:8766/
[SkyFM-HotHits]
mode=custom
application=/usr/local/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s http://160.79.128.62:6628/

Reload MOH Module

From the CLI reload the MOH Module.

Asteerisk 1.6.x

module reload res_musiconhold.so

Asterisk 1.2.x, 1.4.x

reload res_musiconhold.so

NOTE

When Asterisk first starts there is no connection to the configured radio stream. When the stream first started there is about a 30 to 35 second pause before any sound is heard. Once the channel is established the stream stops and starts when required.

Even though the connection is permanently kept alive there is no data transmitted while there is no one using the MOH stream.