Asterisk sound files: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Created page with "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_he..."
 
Brian Wilson (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
If you copy a generic WAV file into /var/lib/asterisk/sounds and try to play it you might see this:
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]: 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
[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.
You have to convert it.
== Conversion ==


The input file can be any format as long as sox can read it.
The input file can be any format as long as sox can read it.
Line 17: Line 19:
Some options
Some options


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


-- Convert to WAV for Asterisk --
=== Convert to WAV for Asterisk ===


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


-- Convert to ULAW
=== Convert to ULAW ===


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


-- Convert to SLN --
=== Convert to SLN ===


Basically the same format without a header
Basically the same format without a header


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


[[Category: VOIP]]
[[Category: Telephones]]

Latest revision as of 15:48, 31 August 2022

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