AstLinux

AstLinux Add-Ons



 

Weather Asterisk AGI:

The Weather AGI is an extremely low overhead, XML -> voice, to speak the current weather conditions. Only what is happening now, no forecast. The result is a short and sweet (approx. 15 second) current weather conditions. Of course no speech synthesis, just asterisk extras sounds.
I have an IP phone on the way out to the garage, standard practice now is to dial extension 1199 (your choosing) and find out whether your coat is thick enough or your shirt sleeves are short enough.

Note non-USA readers, the XML data comes from the US National Weather Service. The script would have to modified to support other Weather Service Agencies.

Download:

Download last updated on: Tuesday, Oct 18 18:51 UTC 2016
Untar's into current (./) directory: weather.agi.tar.gz
install via "tar xzvf weather.agi.tar.gz -C /var/lib/asterisk/agi-bin/"

The weather.agi file should have "chmod 755" permissions.
View the source as text: weather.agi.txt

Asterisk extensions.conf:

The first step is to add an extension in a context accessible by your local phones. I chose 1199 in this example, but it is your choice.

exten => 1199,1,Answer
exten => 1199,n,Playback(weather)
exten => 1199,n,AGI(weather.agi,http://www.weather.gov/xml/current_obs/KMLE.xml)
exten => 1199,n,Hangup

You will want to replace the above KMLE with an observation point closer to your home. Use the following link to find the proper observation point.
US National Weather Service XML Feeds

The good news is this data seems to be updated about every 20 minutes, much fresher data than some weather sources.

The only other thing you might need to change is the location of your extras sound files, the following snippet in the weather.agi bash script:

# Define the location of the "extras" sound files.
# Use an empty string (EXTRAS="") if they are not in a separate directory.
EXTRAS=""
# A person could also define a custom set of sounds just for weather.agi.
#EXTRAS="extras/"

If you don't have the extras sounds installed, look at the less than 25 sound files that are required and copy them over to your system.