[asterisk-users] [1.4 + FreeBSD 6.2] Playing WAV PCM file?

MatsK mkn0014 at gmail.com
Tue Jan 1 09:10:47 CST 2008


Vincent wrote:
> On Tue, 1 Jan 2008 17:23:29 +0530, "Godson Gera" <godson.g at gmail.com>
> wrote:
>> s,2,Playback(/usr/local/lib/asterisk/test_wav_out)
>>
>> And asterisk will automatically pickup the file that it can play with any
>> asterisk supported format from the specified path.
> 
> OK. Is there a way to tell Asterisk which codec to use so it doesn't
> try figuring out the file format used? Thanks.

The codec is specified (for a sip device) in sip.conf, like this:

[general]
disallow=all
allow=ulaw
allow=alaw
allow=gsm


And you know that you can convert the files to every codec format that
is in use then will the cpu load be minimalized !

To convert between different codec formats can you use the asterisk CLI
command:
file convert <file_in.format> <file_out.format>

To convert from a shell script can you do like this:

#!/bin/bash
# Converts a audio file from alaw to a ulaw
rasterisk -x "file convert /tmp/file_in.alaw /tmp/file_out.ulaw"


More examples:
The old way:
http://www.voip-info.org/tiki-index.php?page=Convert+WAV+audio+files+for+use+in+Asterisk
I will try to update this page with "convert".

As a final touch, I have heard that sln should be the prefered format
where you dont have the same format as the codec used in a channel.
"Asterisk native format is sln"

/Mats



More information about the asterisk-users mailing list