NOTE: It may not be legal in your jurisdiction to stream music for commercial purposes from services you have not explicitly licensed for such a purpose.
Implementing this is actually fairly straightforward. We will use:
Shoutcast.com (to find a stream)
The first step is to actually find the stream you want to use. We’re going to keep it very easy and use an MP3 stream and the basic MPG123 command-line player. (MPG123 is included in AWS FreePBX by default.) Choose a lower-bitrate stream if you can… No need to waste bandwidth on a hi-def 256kbps stream when we’re going to resample it down anyway. 32kbps is plenty good enough. So, I’m going to go to Shoutcast.com and click the Jazz category. The top result is SmoothJazz.com, so we’ll use the 32kbps version of that stream. Click the download button and choose Winamp to get the .pls file and then open that using a text editor. We want the part that looks like this:
[playlist] numberofentries=2 File1=http://184.108.40.206:80 Title1=(#1 - 41/5000) SmoothJazz.com Global Radio - The World's First 24/7 Since 2000 - KJAZ.DB Length1=-1
Grab the URL on the File1 line (highlighted above). This will be the streaming URL. The next step is to log into your FreePBX interface and navigate to Settings > Music on Hold and click ‘Add Category’. The Category Name is arbitrary, so here we can use the radio station name. Choose Custom Files as the type and click Submit. You will be taken back to the main Music on Hold category page. Click the edit pencil icon to the right of the new category you just created. For Application, we’re going to use MPG123 to play the steam here. Make a note of this command line, as you’ll need to get the resampling parameters right. Replace the "http://" part with your URL from above.
/usr/bin/mpg123 -q -r 8000 -f 8192 --mono -s http://220.127.116.11:80
Leave the Optional Format field blank.
That’s it! Submit and Apply Changes and you’ve now got a MOH class ready to use wherever you want on your system.