#!/bin/bash mkdir weather cd weather wget http://nerdvittles.com/wp-content/airports.zip unzip airports.zip rm -f airports.zip mysql -uroot -ppassw0rd < airports.sql #cd /var/lib/asterisk/agi-bin wget http://nerdvittles.com/wp-content/nv-weather2.zip unzip nv-weather2.zip rm -f nv-weather2.zip cp nv-weather.php /var/lib/asterisk/agi-bin/nv-weather.php chmod 775 /var/lib/asterisk/agi-bin/nv-weather.php chown asterisk:asterisk /var/lib/asterisk/agi-bin/nv-weather.php mkdir /var/lib/asterisk/sounds/tts chown asterisk:asterisk /var/lib/asterisk/sounds/tts chmod 777 /var/lib/asterisk/sounds/tts sed -i ' /cron.monthly/ { a\ \ 01 0 * * * root rm -f /var/lib/asterisk/sounds/tts/tts* }' /etc/crontab sed -i ' /\[from-internal-custom\]/ { a\ exten => 611,1,Answer\ exten => 611,2,Wait(1)\ exten => 611,3,Set(TIMEOUT(digit)=7)\ exten => 611,4,Set(TIMEOUT(response)=10)\ exten => 611,5,Flite("At the beep enter the three character airport code for the weather report you wish to retrieve.")\ ;exten => 611,5,Swift("At the beep enter the three character airport code for the weather report you wish to retrieve.")\ exten => 611,6,Read(APCODE,beep,3)\ exten => 611,7,Flite("Please hold a moment while we contact the National Weather Service for your report.")\ ;exten => 611,7,Swift("Please hold a moment while we contact the National Weather Service for your report.")\ exten => 611,8,AGI(nv-weather.php|${APCODE})\ exten => 611,9,NoOp(Wave file: ${TMPWAVE})\ exten => 611,10,Playback(${TMPWAVE})\ exten => 611,11,Hangup\ }' /etc/asterisk/extensions_custom.conf echo Weather by Airport Code installation completed. To use, dial 611. Before first use, execute this command: amportal restart