Asterisk sound files

From Wildsong
Jump to navigationJump to search

If you copy a generic WAV file into /var/lib/asterisk/sounds and try to play it you might see this:

[2017-08-19 09:09:25] WARNING[3667][C-00000002]: format_wav.c:113 check_header_fmt: Unexpected frequency mismatch 11025 (expecting 8000)
[2017-08-19 09:09:25] WARNING[3667][C-00000002]: file.c:468 fn_wrapper: Unable to open format wav

You have to convert it.

Conversion

The input file can be any format as long as sox can read it. The parameters convert from any format to one that Asterisk can use.

GSM format sounds bad so I avoid it. Usually I keep the files in WAV format and let Asterisk transcode them. On a heavily loaded or small server it might make sense to keep them in ULAW or SLIN format instead????

You can install several formats for each file and let Asterisk choose, too.

Some options

-r 8000            samples per second
-e signed-integer
-b 16              bits per sample
-c 1               one channel
-t raw             just a raw audio file, no header

Convert to WAV for Asterisk

sox infile.wav -r 8000 -e signed-integer -b 16 -c 1 outfile.wav

Convert to ULAW

rasterisk -x "file convert bdb-login.wav vm-login.ulaw"

Convert to SLN

Basically the same format without a header

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