[asterisk-users] sound file length

Raphael Jacquot sxpert at esitcom.org
Tue Sep 12 22:54:18 MST 2006


Time Bandit wrote:
>> At some point in my dial plan, I need to find out the length of a sound
>> file in seconds (to weed out things that are way too short)
>>
>> the record application doesn't seem to have any facilities to do that.
>>
>> any ideas ?
> use "sox beep.wav -e stat" and parse the output
> 
> man is your friend
> google also :)

something like this works... but is rather inefficient ...

#!/bin/bash
LENGTH=`sox /home/asterisk/$1.wav -e stat 2>&1 | grep Length | sed -e 
s/[^0-9]*//`;
psql -c "update conferences set message_length=$LENGTH where 
conf_serial=12" -U asterisk asterisk


More information about the asterisk-users mailing list