| 1 | #/bin/bash |
| 2 | |
| 3 | # Script written by Trey Blancher ([email protected]) |
| 4 | |
| 5 | # This script is designed to convert all files of type $SRC to |
| 6 | # the $DST format, for the given $LANGUAGE. It traverses the given |
| 7 | # language directory (by default in /var/lib/asterisk/sounds/), and |
| 8 | # converts each file with filename extension $SRC, and converts them |
| 9 | # using Asterisk to files with type and extension $DST. |
| 10 | |
| 11 | LANGUAGE=en # change accordingly, if converting custom sounds you may want to omit this variable |
| 12 | SRC=gsm # change accordingly (e.g. to wav, etc.) |
| 13 | DST=g729 # change accordingly (e.g. to wav, etc.) |
| 14 | SOUNDS=/var/lib/asterisk/sounds # for custom sounds change this directory to your custom sound directory |
| 15 | |
| 16 | for file in $(find ${SOUNDS}/${LANGUAGE}/ -depth -type f -name *.${SRC}); |
| 17 | do |
| 18 | #echo $file |
| 19 | asterisk -rx "file convert $file $(dirname $file)/$(basename $file $SRC)$DST" |
| 20 | done |