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

Quy Pham Sy quyps at vega.com.vn
Wed Jul 21 10:40:29 CDT 2010


>> Exten => 1234,n,System(/bin/cp foobar.wav /tmp/foobar.alaw)

it actually works, I made a link to the .wav file instead of copying it
ln -s foobar.wav foobar.alaw, and it works well.


>>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.

My .wav files are alaw file indeed. Here is the output from file command

$file 53.wav
53.wav: RIFF (little-endian) data, WAVE audio, ITU G.711 A-law, mono 8000 Hz

they've just named as xxx.wav so I guess there is no problems with copying
or linking solutions.

Thanks all,

On Wed, Jul 21, 2010 at 9:50 PM, Kevin P. Fleming <kpfleming at digium.com>wrote:

> 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
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100721/7d240da0/attachment.htm 


More information about the asterisk-users mailing list