Converting Audio Files for Asterisk

Today the most common file format for music is mp3. Mp3’s are heavily compressed audio files and require a lot of CPU power to uncompress and play the files. Audio files can be converted into a more Asterisk friendly format to conserve CPU power. In this lesson we will convert an mp3 file to an sln file suitable for Asterisk playback.

We will need to install sox and libsox-fmt-all to covert the format of a .mp3 (include many other audio formats) to .sln. This can be done on the Asterisk server itself using command line. To install the necessary packages use the following command:

sudo apt install sox libsox-fmt-all

If you are in need of moving audio files from a desktop computer to the Asterisk server I would recommend using an application like WinSCP (for Windows) and FileZilla (for Linux , Mac, or Windows).

To convert a file named music.mp3 to a suitable format for Asterisk use the following command:

sudo sox music.mp3 -t raw -r 8000 -e signed-integer -b 16 -c 1 music.sln

If you are looking for some royalty free music to download and use here is a link to a few audio files: https://www.starface.de/en/Downloads/moh.php