[asterisk-users] play alaw file with .wav extension

Kevin P. Fleming kpfleming at digium.com
Wed Jul 21 09:50:06 CDT 2010


On 07/21/2010 04:35 PM, Danny Nicholas wrote:
> Asterisk won’t be “happy” trying to play foobar.wav if it is actually a
> .alaw file.   Since you can’t rename the existing files, there’s no law
> that says you can’t copy them and play them correctly.    Assuming that
> your calls are using the alaw codec, this snippet would do the trick
> 
>  
> 
> Exten => 1234,1,answer
> 
> Exten => 1234,n,System(/bin/cp foobar.wav /tmp/foobar.alaw)
> 
> Exten => 1234,n,playback(/tmp/foobar)
> 
> Exten => 1234,n,System(/bin/rm /tmp/foobar.alaw)

No, that won't work either, because a WAV file has a header, and a raw
alaw file does not... so Asterisk will try to play the contents of that
header as alaw data, presumably producing terrible noise.

The best you can do is to use sox to convert them from
alaw-in-WAV-container to raw-alaw.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list