Home » Technology » Googlicious: News, Weather, Stocks & Dictionary for Asterisk

The Most Versatile VoIP Provider: FREE PORTING

Googlicious: News, Weather, Stocks & Dictionary for Asterisk

Let’s face it. There are certain kinds of information you just don’t want to be without. And now a treasure trove of Google content is as close as your nearest Asterisk® telephone. Thanks to Google and Lefteris Zafiris, open source Asterisk text-to-speech (TTS) and speech-to-text (STT) tools are having a banner year. We wanted to join the party and offer a free collection of new Asterisk apps in conjunction with Lefteris’ new toolkits so you can take advantage of Google’s latest news, weather, and stock feeds as well as Google’s online dictionaries. Read all about the Google XML feeds here. As with most of Google’s experimental projects, there’s no guarantee that these feeds will work next year… or even next week.

With all of these new Nerd Vittles applications, you simply say what you want and leave the driving to us. To speed up the response time, just press # after saying what you’re looking for. For the weather application, get a current weather report and forecast for almost any city in the entire world. Just say the name of the city and the state, province, or country, e.g. Paris, France or Vancouver, British Columbia, or Huntsville, Alabama. You also can say the zip code or postal code for U.S. and Canadian cities if you prefer. And you can predefine 10 zip codes or postal codes for quick searches by just saying: "Number 2." We’ve predefined 0 through 9 for major Canadian cities to give you a head start. These can be changed in any way you like, including U.S. zip codes or even city and state (with no punctuation). And ignore the fact that the data array is named $canada. We were too lazy to change it to something more generic once we broadened the scope of the application. 🙄

But suppose you don’t want to choose a city and state or province. Instead you want to say a thorny Canadian mail code such as B2N 1X6. Well, now there’s a way to tell the software to let you do it phonetically. Just say: "phonetic bravo 2 nancy 1 xray 6" using any words that start with the same letters as the letters in the mail code.

The stock reports work in a similar way. Just say the name of the company’s ticker symbol and press #. Or you can predefine 10 companies to watch. Then quickly access the (almost) current trading price of your ten favorites by saying: "Number 9." We’ve predefined 10 stocks to watch to get you started. Change the entries to meet your needs by editing nv-stocks-google.php in /var/lib/asterisk/agi-bin.

What we’ve learned in building STT applications is that saying individual letters is not Google’s finest hour in speech-to-text transcription. The reason is that Google built their transcription service primarily to support conversational speech and voicemail transcription, and most folks don’t spell out words. They just say them. So… if you have problems getting good results by spelling out I-B-M, try this: "letter i, letter b, letter m." Or, better yet, just use the predefined stock option to set up your 10 favorite stocks. Then say "number 6″ whenever you want to retrieve the current trading price of Microsoft:

With the stock reports, we’ve also added the NATO phonetic alphabet to our bag of tricks. So, for I-B-M, you can simply say "India Bravo Mike" and the words will be converted to "IBM." If it’s been a while since your soldiering days, here’s a cheat sheet for you. Actually, the code is smart enough to understand any words that begin with the same letter as any particular character in the stock symbol so long as Google understands you. For example, saying "monkey smells furry things" would return the Microsoft (MSFT) stock report. Heh.

With the news headlines, you don’t have to do anything but dial the extension number and listen to the news. The number of news stories played can be adjusted by changing the 5 in line 6 of the 951 extension of /etc/asterisk/ extensions_custom.conf.

To access the online dictionaries, you have two choices. Either use Google’s own dictionary or you can open your search up to the entire web and take advantage of a much broader selection of information including Wikipedia, the Urban Dictionary, and the Free Encyclopedia. Just dial 333 and say one of the following: "define nerd" or "web define rocket scientist." You get the idea.

Prerequisites. There’s lots of Linux code necessary to make all of this work. Lucky for you, all of it comes preinstalled in the latest PBX in a Flash releases regardless of the flavor you’re running. You’ll also need activate at least one Google Voice account on your Asterisk server if you plan to use the dictionary application. If you’re using some other distribution, all we can suggest is that you peel our install script apart and attempt to install each piece. Linux is pretty good at telling you which dependencies are missing.

Installation. Installing these STT/TTS applications couldn’t be easier. It takes less than a minute on PBX in a Flash systems. Log into your server as root and issue the following commands:

cd /root
wget http://incrediblepbx.com/google-apps.tgz
tar zxvf google-apps.tgz

Using the STT/TTS Apps. From any telephone connected to your Asterisk server, just dial the following numbers to access the three Google STT/TTS applications:

  1. 333 – Dictionary
  2. 949 – Weather
  3. 950 – Stocks
  4. 951 – News Headlines

To meet your own needs, don’t forget to adjust the quick call entries in the weather and stocks AGI scripts. And remember to use the "letter" and "number" tricks to improve accuracy. There’s also some experimental code that you may wish to read about and take for a test drive.

Nerd’s Nugget: We’ve been wrestling with a new methodology to make it easy for folks to update Nerd Vittles apps by simply running the installer a second or third time. Today marks the beginning of this new approach. If you look at the dialplan code in extensions_custom.conf, you’ll see each TTS extension begins like this: ;# // BEGIN nv-weather-google. And the extension ends with a matching marker: ;# // END nv-weather-google. What this does is make it incredibly easy to remove the code using a single SED command:

sed -i ‘\:// BEGIN nv-weather-google:,\:// END nv-weather-google:d’ /etc/asterisk/extensions_custom.conf

We’ll post changes and additions for today’s scripts on the PIAF Forum. Join by clicking on the link below.

Originally published: Monday, May 14, 2012

Updated: Monday, May 28, 2012

Need help with Asterisk? Visit the PBX in a Flash Forum.

whos.amung.us If you’re wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new whos.amung.us statistical web site and check out what’s happening. It’s a terrific resource both for us and for you.


Special Thanks to Our Generous Sponsors

FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.

Some Recent Nerd Vittles Articles of Interest…


  1. Just a heads up. If you installed this app before August 31, 2012, then you will note that the Google Weather app no longer works. This is because Google, without notice, stopped supporting the Google Weather API. We have substituted a new weather API from Weather Underground; however, you will need to update your software and also register for a free Weather Underground API key. Details and step-by-step instructions are available on the PIAF Forum. Our apologies.

Comments are closed.