[asterisk-users] Asterisk 1.4 Call Recording

Steve Johnson stevej456 at gmail.com
Mon Jan 14 10:51:23 CST 2008


You might take a few ideas from this combine.sh script which works for
me.  It uses the combine_wave program from
http://panteltje.com/panteltje/dvd/combine_wave-0.3.tgz and the lame
program to convert to mp3.

It converts the entire directory /var/spool/asterisk/monitor/*-in.wav
files to mp3 where the mp3 file doesn't already exist.

S.


File: combine.sh
---------------------------
#!/bin/sh

cd /var/spool/asterisk/monitor

for f in *-in.wav
do
        in=$f
        out=`echo $f | sed -e 's/-in.wav/-out.wav/'`
        tmpwav=`echo $f | sed -e 's/-in.wav/-both.wav/'`
        mp3=`echo $f | sed -e 's/-in.wav/.mp3/'`

        if [ -e "$mp3" ]
        then
                continue
        fi

        # combine the two tracks into one stereo file
        /usr/local/bin/combine_wave -l $in -r $out -o $tmpwav 2>/dev/null

        /usr/bin/lame --silent -h -b 96 $tmpwav $mp3

        # Remove temporary .wav files
        test -w $tmpwav && rm $tmpwav

        # Remove input files if successful
        test -s $mp3 && rm $in $out
done

exit 0



More information about the asterisk-users mailing list