Voip Phreak

Cool sh!t about Asterisk, VOIP, XMPP 'n stuff

Even More Asterisk Weather – Now Cepstral

What’s the deal with weather?

It’s funny that as nerds, we probably have more weather apps on our desktops than actually going outside or looking out a window. I admit I do it myself. On the laptop I have the Enlightenment Weather Module loaded up, as well as ForeCastFox on all of my desktops and laptop with continual popup reminders letting me know down to the minute barometer pressure and current ceiling height.

All facts that I absolutely desperately need to know, now!.

So, being the enlightened asterisk user I am, I decided to search about and find what I could about making a cool little extension to call up my asterisk server and deliver me the weather for my local city of Ottawa, Canada.

I noticed that there seems to be a flurry of chatter going on lately on sites such as Nerd Vittles and SineApps about weather scripts. Most of these use free software such as Festival or the Voice Synthesizer. However, I have a license for this wonderful product called Cepstral. I decided I wanted to use Cepstral because I prefer the voice quality to that of the free ones, and it was only like 30 bucks to register.

So, what you’ll find below is a very quick and dirty hack of what I found already available, but instead to use Cepstral to play back the weather on your home system:

  1. Note this is for a Stock Asterisk Installation, no FreePBX or AAH or AMP or any of that GUI stuff.
  2. Note this also assumes you have cepstral integrated. If not Follow this howto.
  3. Then you’ll want to install Asterisk::AGI Perl Module using CPAN or downloading it manually and installing it.
  4. Now you’re going to want to create the AGI. I found a similar copy to this one on Nerd Vittles, and modified it for my use with Cepstral.
  5. Edit /var/lib/asterisk/agi-bin/weather.agi, and make the contents be the following:
    • Get the modified Cepstral Weather AGI here:weather.agi
  6. Then you’re going to want to give the file the proper permissions
    • chown asterisk:asterisk /var/lib/asterisk/agi-bin/weather.agi
    • chmod +x /var/lib/asterisk/agi-bin/weather.agi
    • chmod 755 /var/lib/asterisk/agi-bin/weather.agi
  7. Then you want to download the weatherscript from Nerd Vittles.
    • wget “http://www.offshack.com/astweather/weatherscript” -O /usr/local/bin/weatherscript
    • chmod +x /usr/local/bin/weatherscript
  8. Now edit your asterisk extensions to include this somewhere proper (outside menu? common extensions? etc)
  9. ; weather script
    exten => 7601,1,Answer
    exten => 7601,2,AGI(weather.agi)
    exten => 7601,3,Hangup

  10. Reload Asterisk
  11. Call 7601 to verify that it reads your weather
  12. Now just create a cronjob to run /usr/local/bin/weatherscript every hour, and you’re set!

Author: Voip Phreak

Matt is VOIP phreak!. Matt took an early adoption to telephony as a young BBS user, using pbx's and other fun toys that he could get his hands on to progress eventually into a love of internet telephony. These are his thoughts, views, and little articles about mostly nothing, but something.

3 Comments

  1. I wasn’t able to make it work, could I ask you a question?

  2. Hi Steve,

    Sure, shoot me an email flewid [at] flewid [dot] ca :)

    Thanks,
    flewid

  3. Pingback: Found our missing posts!