Encoding audio for Asterisk

If you are sent a .wav file from a customer to be used as an announcement in the call flow, you must first ensure that it has been encoded properly.

Our voicemail traffic uses the same encoding used on the PSTN.  The attributes for this audio are as follows:

bitrate: 16 bit
channels: mono
sample rate: 8000Hz

When uploading audio to be used in the call flow, always double check it by phone.  If you are confused you can also check from the command line to determine if it’s been encoded correctly.

To check from the command line, go to /var/lib/asterisk/sounds/custom/ and use the file command against the file you’re testing and inspect the output.

 # file 02112016_Temp_IVR.wav
 02112016_Temp_IVR.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz
 # file IVR_20160218.wav
 IVR_20160218.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz

If you notice, the file IVR_20160218.wav has been encoded at a sample rate of 48000 Hz.  Because of this, Asterisk will not play this file when used.  Likewise, with any of the attributes deviating from mono 16bit 8000Hz encoding, Asterisk will not play the file.