#!/bin/bash # Modified from script found here: http://www.thiscoolsite.com/?p=73 # Modified by Sanjay@IntuitInnovations.com # Created: 17 Nov 2009 # Important. Run this in /usr/src # When running in CRON ensure you have the command like this /usr/src/runconverter &> /dev/null # Set the dir - here below is asterisk default recorddir="${1:-/var/spool/asterisk/monitor}" cd $recorddir; for file in *.wav; do mp3=$(basename "$file" .wav).mp3; cd $recorddir $recorddir/mlame -f -o "-b 16 -m m -q 9 --resample 8" $file touch -r "$file" "$mp3"; chown www-data.www-data "$mp3"; chmod 600 "$mp3"; # Extras # To remove WAV files #rm -f "$file"; # To move WAV to /old_wav #mv "$file" /old_wav; # To move MP3 to somehere #mv *.mp3 /somewhere done