Music on Hold Module - Deleting the .wav File Does Not Remove .ulaw Or .alaw, etc. Files



I'll type the issue first because I had a lengthy intro below. The issue is we use transcode music on hold files to our supported codecs. When removing the files from the music on hold module in FreePBX, the only files removed are the .wav files. Is there any way to configure the module to also remove .ulaw, .gsm, .alaw, .g722, .g729, etc files (if they exist)?

I think the subject line says it all, but essentially, when we are configuring a customer’s phone system, we run the following commands on a customer’s system to convert all custom and stock recordings and music on hold files to codecs that we support. You may feel free to use the script, but PLEASE know that I take NO responsibility for running a command with which you do not first understand the consequences of running incorrectly.

[b]
#convert custom and stock files to ulaw (change “$a”.ulaw to “$a”.g729, “$a”.g722, etc for your supported codecs)
cd /var/lib/asterisk/sounds/custom
for a in *.wav; do rasterisk -x “file convert “$a” /var/lib/asterisk/sounds/custom/”$a".ulaw"; done
for file in *.wav.ulaw; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done
cd /var/lib/asterisk/sounds
for a in *.wav; do rasterisk -x “file convert “$a” /var/lib/asterisk/sounds/”$a".ulaw"; done
for file in *.wav.ulaw; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done
cd /var/lib/asterisk/sounds/en
for a in *.wav; do rasterisk -x “file convert “$a” /var/lib/asterisk/sounds/en/”$a".ulaw"; done
for file in *.wav.ulaw; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done

################################################################

convert custom and stock moh files to ulaw, g722, and g729

if using a custom music on hold category, copy the

commands below, but be sure you cd into the

directory of your music on hold category if other

than the default

cd /var/lib/asterisk/moh
for moh in *.wav; do rasterisk -x “file convert /var/lib/asterisk/moh/”$moh" /var/lib/asterisk/moh/"$moh".ulaw"; done
for file in *.wav.ulaw; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done
for moh in *.wav; do rasterisk -x “file convert /var/lib/asterisk/moh/”$moh" /var/lib/asterisk/moh/"$moh".g722"; done
for file in *.wav.g722; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done
for moh in *.wav; do rasterisk -x “file convert /var/lib/asterisk/moh/”$moh" /var/lib/asterisk/moh/"$moh".g729"; done
for file in *.wav.g729; do mv “$file” “$(echo “$file” | sed -e s/”.wav"//)"; done

[/b]