One of the first things we did after setting up our phone system was to experiment with the different ways that you could extend its capabilities. By using Asterisk we have relatively easy access to the internals of the system and can tweak the behaviour without totally rewriting the software. The easiest way to extend the system is by using the basic functions built into Asterisk itself. However, if you want to get really fancy you need to think outside the box. Asterisk makes this easy too. It includes a feature known as AGI scripts which allow you to write other programs or scripts to interact with Asterisk.
The Weather Channel
Being a weather freak I decided to experiment with getting the weather by dialing an extension on our new phone system. I started by writing up a quick shell script to download the weather from the internet and parse it. Basically I just strip out all the formatting and leave the basic forecast. That was easy and works well but how do we transfer this information to us over the phone.
Speak to me
While looking into how to get the system to read the weather to us we had a quick look at text to speech software. As it turns out there is a free text-to-speech system available for use with Asterisk. Cool! The Festival
text-to-speech engine is relatively easy to setup and seems to work reasonably well. You feed it a text file and it spits out an audio file (wav). In the end it makes for a really slick system. You dial an extension and the phone reads you the current forecast. Of course the next obvious step is to extend the same concept to read you anything else you can imagine.
If you want to try the script out for yourself feel free. You will most likely need to make some adjustments to get it to work for your environment / location. Download
the script and give it a whirl.