How To Add a Remote MP3 Stream for Music on Hold

Walter Moon

Walter Moon

These instructions are intended to be used as a How-To guide. Using a remote streaming source is NOT RECOMMENDED FOR PRODUCTION SERVERS. See the bottom of this post for more information.

As much as we all love using the default selection of installed Music on Hold tracks, let’s take a look at using an audio stream from a remote source.

The first step is to get the URL to a stream. For this example, we will be using a very basic setup where we just have a remote CentOS install that is hosting an mp3 over Apache. The url to this stream will be referenced as:
http:// example.ip.address/stream.mp3

After attaining the streaming source URL, try loading it in a web browser to make sure audio is being played. Some web browsers might not support this, but Chrome and Firefox typically will.

Now that we have our source, open the Music on Hold section from the FreePBX web admin by going to Settings -> Music on Hold. Choose the option to “Add Category”. Give the new category a valid name, and for the Type, choose Custom Application, then Submit to create the new category.

Next, click the action to Edit the new category. On the edit page, we will be using mpg123 as our application with the following parameters, and our stream’s URL:

/usr/bin/mpg123 -q -r 8000 -f 8192 -b 1024 --mono -s http://example.ip.address/stream.mp3

Optional Format will remain blank. Submit the settings, and click the Apply Config button.

Although Music on Hold can be selected in various areas, we will use a Call Queue for this example. While creating a Call Queue or editing an existing one, the new category should be selectable from the dropdown. Select it, Submit the Queue settings, and click Apply Config to make sure Asterisk is reloaded.

That should do it. Try calling the queue. You should be hearing the streamed audio as the Music on Hold.

While having the remote server stream a single mp3 file works as a basic example, a more powerful application of this could be to set up a managed Shoutcast, or Icecast server to provide the mp3 stream.

If you are already using a stream for Music on Hold with your FreePBX, and have any suggestions on setting up and managing a stream, please share in our Community forums!

As noted at the beginning of this post, this type of streaming is not recommended for production systems.  More info can be found on the FreePBX wiki.

Share this Blogpost

Start the Discussion

Sign up for our Newsletter

Scroll to Top

Flash Summer Sale

All Commercial Modules & Bundles

50% OFF *

* Terms and Conditions apply, Click here to read more.