FreePBX is a widely used, open-source SIP/VoIP Server, developed by Sangoma. To configure Music on Hold (MoH) on a FreePBX we need to provide the audio stream in a certain Format. For that, we need to configure the Instreamer first, and then add the Stream to the Server configuration.
For further Information about FreePBX, check the documentation on https://www.freepbx.org/
To stream to a FreePBX Server we need to configure the Instreamer as following! In the Audio settings put in the following:
- Set the Input Source to "Line mono"
- Set the Audio Format to "MPEG1 / 48 kHz (MP3)"
- Set the MPEG Bitrate Mode to "CBR"
Set the MPEG Bitrate to "128 kbps"
On the Streaming Settings there is only 1 thing we need to configure:
- Set the Radio Path to /moh or the value you would like to have as a stream path!
The Audio Settings can be changed, as long as the Instreamer is providing an MP3 stream! When selecting the lowest mp3 codec, the stream will use less bandwidth when sent to the server.
The quality is not important since the Server will downsample the audio to 8khz anyway!
To receive the configured stream on the SIP Server, we need the Instreamer to be accessible from the Server and configure the Music on Hold like the following:
- Login to the FreePBX Server
- Navigate to Settings > Music on Hold
- Create a new Category or change the default Category
- Change the Type to Custom Application
- Enter the following in the Application field (change <instreamer-ip>, with the Instreamers IP address):
/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 1024 http://<instreamer-ip>/moh
As an alternative to mpg123 you can also use ffmpeg as an application! The application should be preinstalled at /usr/bin/ffmpeg