Play online Radio Station as Music on Hold in Asterisk

Image contains Asterisk music on hold file and extensions file

You have an asterisk system that works and you want to play online radio station as Music on Hold; And when you have the radio stream as music on hold, you want to setup it to have a number that people can call in to listen to live radio talk shows, or anything like your playlist, live music, live church services, etc.


This post provides information you need to configure music on hold using mp3 live stream radio, and set up a number that people can call to listen to live radio.


To set up live radio music on hold in asterisk using this post, you need to install mpg123 and edit the musiconhold.conf file
On Ubuntu, to install mpg123 application, type the command below, then press enter.
sudo apt install mpg123


To open the Music On Hold file, type the command below, then press Enter.

sudo nano /etc/asterisk/musiconhold.conf


To have the live radio at http://192.168.1.10:7040 as music on hold, change the default class to look like below.

[default]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 800 -b 0 -@ http://192.168.1.10:7040/


If you want to have the local playlist at /var/lib/asterisk/mp3/playlist.m3u as music on hold, change the default class to look like below.

[default]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 800 -b 0 -@ /var/lib/asterisk/mp3/playlist.m3u


When you’re done, press Ctrl + X, type y, and then press Enter.


To listen to live radio via number 8080, you must edit the extensions.conf file.

Type the command below and press Enter.

sudo nano /etc/asterisk/extensions.conf


add the information below in your context.

exten => 8080,1,Answer()
same => n,MusicOnHold(default)


Whenever someone dials the number 8080, they listen to live radio.


What To Read Next


If you like the content of this post or if it has been useful to you, please consider sharing it on your social media and follow me on Facebook and Twitter for more exclusive content.