#!/bin/bash
# Filename update_language_sounds-en_GB.sh
# Credits: PIAF Forum @Rrrr and @ostridge from pbxinaflash.com/community/
echo "To install Asterisk core sound files (_GB english) to directory /var/lib/asterisk/sounds/en_GB"
echo "for codecs alaw, ulaw, g722, g729, gsm, siren7, siren14, sln16, ulaw, and wav"
echo "This script is provided as is, and NO WARRANTY EXPRESS OR IMPLIED IS PROVIDED.
echo "Asterisk sound files are downloadable according to the language/country and according to the sound codecs required."
echo "The available downloads can be seen at https://downloads.asterisk.org/pub/telephony/sounds/ from your browser"
echo "It is strongly recommended to keep the default sounds located in /var/lib/asterisk/sounds/en/ directory because if "
echo "a particular sound file is unavailable in the appropriate language, asterisk will play the english en/*.gsm file as fallback."
echo "Language differences may cause errors."
echo "E.g. software 'en' usage requiring play 'the pound key' would for 'en_GB' require to play 'the hash key'."
echo "Thus the need to the play the hash sound by changing the *custom.conf or rather rename files but then '15 pound' means what?.
mkdir -p /var/lib/asterisk/sounds/en_GB
cd /var/lib/asterisk/sounds/en_GB
# Download the core-sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-alaw-current.tar.gz
tar -xzf asterisk-core*alaw*.gz && rm asterisk-core-sounds-en_GB-alaw-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-g722-current.tar.gz
tar -xzf asterisk-core*g722*.gz && rm asterisk-core-sounds-en_GB-g722-current.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-g729-current.tar.gz
# tar -xzf asterisk-core*g729*.gz && rm asterisk-core-sounds-en_GB-g729-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-gsm-current.tar.gz
tar -xzf asterisk-core*en_GB-gsm*.gz && rm asterisk-core-sounds-en_GB-gsm-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-slren7-current.tar.gz
# tar -xzf asterisk-core*siren7*.gz && rm asterisk-core-sounds-en_GB-slren7-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-siren14-current.tar.gz
# tar -xzf asterisk-core*siren14*.gz && rm asterisk-core-sounds-en_GB-siren14-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-sln16-current.tar.gz
tar -xzf asterisk-core*sln16*.gz && rm asterisk-core-sounds-en_GB-sln16-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-ulaw-current.tar.gz
tar -xzf asterisk-core*ulaw*.gz && rm asterisk-core-sounds-en_GB-ulaw-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_GB-wav-current.tar.gz
# tar -xzf asterisk-core*wav*.gz && rm asterisk-core-sounds-en_GB-wav-current.tar.gz
echo "Install of Asterisk extra sound files (_GB english) to directory /var/lib/asterisk/sounds/en_GB"
echo "These language files will still need to be enabled in the FreePBX dialplan files as necessary.
echo "Several FreePBX files are marked as 'Do not edit' in which case; its generally the *-custom.conf file
echo "that should provide the corrected dialplan context."
echo "One will generally need to change 'language=en' to 'language=en_GB' (without the quotes) where en_GB represents
echo "the ISO_639-2_code language_plus ISO 3166 country code e.g. en_AU = english_AUSTRALIA (uk is ukranian and not United Kingdom)"
echo "extra-sounds for codecs alaw, ulaw, g722, g729, gsm, siren7, siren14, sln16, ulaw, and wav"
## Uncomment line pairs as required
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-alaw-current.tar.gz
tar -xzf asterisk-extra*alaw*.gz && rm asterisk*sounds*gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-g722-current.tar.gz
tar -xzf asterisk-extra*g722*.gz && rm asterisk*sounds*gz
#wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-g729-current.tar.gz
#tar -xzf asterisk-extra*g729*.gz && rm asterisk*sounds*gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-gsm-current.tar.gz
tar -xzf asterisk-extra*-gsm*.gz && rm asterisk*sounds*gz
# wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-siren7-current.tar.gz
# tar -xzf asterisk-extra*siren7*.gz && rm asterisk*sounds*gz
# wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-siren14-current.tar.gz
# tar -xzf asterisk-extra*siren14*.gz && rm asterisk*sounds*gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-sln16-current.tar.gz
tar -xzf asterisk-extra*sln16*.gz && rm asterisk*sounds*gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-ulaw-current.tar.gz
tar -xzf asterisk-extra*ulaw*.gz && rm asterisk*sounds*gz
# wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en_GB-wav-current.tar.gz
# tar -xzf asterisk-extra*wav*.gz && rm asterisk*sounds*gz
cd /root/
echo "Install of extra-sounds files (_GB english) to directory /var/lib/asterisk/sounds/en_GB"
echo "Done"
# end of script