file.convert.sh 882 B

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