Asterisk say real time weather condition in your town.
Today, 2006-01-20 we have -29C in Vilnius, Lithuania.
I write weather_metar.agi in 15 min, please check for errors before use.
But it very simple, and work fine for me.
1) Install Asterisk 🙂
2) Install Festival (https://www.voip-info.org/wiki-Asterisk+festival+installation)
3) Install metar (apt-get install metar) other (http://packages.debian.org/unstable/utils/metar)
4) Get sh-agi.inc from LCDial.sh package https://www.voip-info.org/lcdialsh-agi-script/ (Thanks Enzo Michelangeli <enzomich (at) gmail.com>)
5) Put weather_metar.agi and sh-agi.inc in /var/lib/asterisk/agi-bin
6) Make integration in dial plan:
Sample for Lithuania, Vilnius (METAR code “eyvi”):
exten => 699,1,AGI(weather_metar.agi,eyvi)
exten => 699,2,Hangup()
7) Test it (dial 699). If all OK find your METAR town code in http://weather.noaa.gov/international.html
8) Enjoy!
Regards,
Gool
- !/bin/sh
- weather_metar.agi V-0.1a
- Writen by Marat Gulevich <gool (at) gool.dyndns.biz> JAN 2006
- Say weather report for your town.
- Dependences:
- 1) Asterisk (http://www.asterisk.org) + Festival
- 2) sh-agi.inc (Thanks Enzo Michelangeli <enzomich (at) gmail.com>) from LCDial.sh package https://www.voip-info.org/lcdialsh-agi-script/
- 3) metar utility (For Debian distr.: apt-get install metar)
- 4) METAR town code (See: http://weather.noaa.gov/international.html)
- Sample for Lithuania, Vilnius (METAR code “eyvi”) in extensions.conf
- exten => 699,1,AGI(weather_metar.agi,eyvi)
- exten => 699,2,Hangup()
. /var/lib/asterisk/agi-bin/sh-agi.inc
WEATHER=$(metar -d $1)
T1=$(echo $WEATHER | cut -d “:” -f10 | sed ‘s/ Dewpoint/,/’ | sed ‘s/C/celsium degree/’)
T2=$(echo $WEATHER | cut -d “:” -f14 | sed ‘s/ //’)
SP=\”$T1$T2\”
sh_agi_log “$SP”
sh_agi_cmd EXEC Festival “$SP”