#!/bin/sh
#convert wav to mp3 asterisk recordings
cdrdb="asteriskcdrdb"
user="root" #пользователь субд для отчетов
pass="" #пароль пользователя субд
for i in `find /home/asterisk/monitor -type f -name "*.wav"`
do
if [ -e "$i" ]; then
file=`basename "$i" .wav`;
dir=`dirname "$i"`;
lame -h -b 32 "$i" "$dir/$file.mp3";
rm -f "$dir/$file.wav";
mysql -u $user -p$pass --execute='use asteriskcdrdb;UPDATE cdr SET recordingfile="'$file'.mp3" WHERE recordingfile="'$file'.wav";';
fi
done
If you liked my post, feel free to subscribe to my rss feeds