Well, we're on a roll adding new tricks to our TrixBox. In the last month, we've added Weather Reports for 1,000 U.S. Airports. And last week, we taught our TrixBox system to read email over the telephone with MailCall for Asterisk®. Today, we add another 'Speak-And-Spell' application: an RSS newsreader for your phone. With today's free software and any phone that can connect to your Asterisk system, you get access to all of the RSS News Feeds from Yahoo. There are dozens available with more to come. The news feeds include the latest headlines, sports, health, technology, show biz, politics, business, and many more. NewsClips for Asterisk joins dozens of other RSS newsreaders with a couple of important differences. First, of course, our app is FREE! And second, you can use a Plain Old Telephone to get your one-minute news fix whenever you like. And the feeds are always current. Yahoo!
How does it work? It's simple. You pick up a telephone and dial an extension on your TrixBox or Asterisk system. And NewsClips for Asterisk reads you the latest news headlines in your choice of news categories. Can it handle multiple news feeds? Absolutely. Do I need a Yahoo account? Nope. Are there any restrictions on its use? Yep. You have to abide by Yahoo's Terms of Use for their news feeds. After all, it's their news, and they paid the license fees to the Big Boys to access it. In a nutshell, the news feeds are for personal, non-commerical use. Non-profit organizations also can freely use the news feeds. If you happen to be running a current version of TrixBox, then deploying NewsClips for Asterisk will take you about 15 minutes. For other versions of Asterisk, you'll need to install Apache, PHP, and the Flite voice processing system. You can scratch around on Nerd Vittles for most of the tutorials. But the easiest way to get this up and running quickly is to install TrixBox and get the most recent updates using our latest tutorial.
Try It, You'll Like It. At the risk of bringing our clunker TrixBox development server (with a whopping 128MB of RAM) to its knees, we decided to make it easy for you to see how NewsClips for Asterisk works. You can call our Stanaphone number and take it for a spin. Just dial the number shown in the left margin. And understand that the sound quality may not be perfect due to performance limitations of this ancient Intel 386 machine. We'll show you how to set up something similar toward the end of this article... hopefully with better hardware.
Getting Started. Let's take first things first. Before proceeding with the installation, make sure you are running at least TrixBox 1.1.1 by pointing a web browser at the IP address of your TrixBox server. If you're running an earlier version, log into your server as root, and type trixbox-update.sh update twice to get everything current. Then reboot. If you're running pure Asterisk on some other type of Linux box, come back the day after tomorrow when you finish installing and configuring Apache, PHP, SendMail, and the Flite speech synthesis engine. Once you get all of the pieces properly configured and talking to each other, you'll be in the same place as those that used our tutorial last week to install TrixBox 1.1.1 at no cost in about an hour.
Modifying Your TrixBox Dialplan. We need to add a little code to the extensions_trixbox.conf file for each news feed you want to access. The basic code looks like this:
exten => 511,1,Answer
exten => 511,2,Wait(1)
exten => 511,3,AGI(nv-news.php|topstories)
exten => 511,4,Flite("Thank you for calling. Good bye.")
exten => 511,5,Hangup
The only change you need to make is in the extension number (511) on each line and the default news category (topstories) in line 3. The extension number tells Asterisk what number you'll be calling to access your news headlines. If you want to access more than one news feed, then you simply duplicate the above code with different extension numbers and a different news feed category in line 3. Or you can run NewsClips for Asterisk in demo mode and choose from ten different news feeds each time you call. Here are some of the news categories that Yahoo News currently supports. For the complete list of Yahoo RSS News feeds, go here. By the way, there's no error checking for typos so type the category name exactly and carefully.
topstories
world
tech
showbiz
oped
business
politics
elections
iraq
mideast
sept11
sports
nasashuttle
science
health
education
hurricanes
oddlyenough
hotzone
adventures
obits
mostemailed
mostviewed
highestrated
mostblogged
Just be sure that all 5 lines of each code snippet above have the same extension number. Now open up the TrixBox web interface by pointing a web browser at your TrixBox server. Then choose Config Edit on the main Configuration and Administration screen. Once phpconfig opens, click on extensions_trixbox.conf. Add the above code in the [from-internal-trixbox] context (section) of the file. And click the Update button once you've adjusted the extension numbers and news feed category to meet your needs.
Installing NewsClips for Asterisk. Now we're ready to install the actual application. Log into your server as root and issue the following commands in order:
cd /var/lib/asterisk/agi-bin
wget http://nerdvittles.com/trixbox11/newsclips.zip
unzip newsclips.zip
rm -f newsclips.zip
chown asterisk:asterisk nv*.php
chmod 775 nv*.php
The zip file contains the NewsClips application: nv-news.php. Once you install the application, restart Asterisk: amportal restart. Now pick up a phone on your Asterisk system and dial 511. Presto! Your news has arrived ... on your telephone! If you want to play the same news feed each time you call a particular extension instead of the menu giving you a choice of ten different news feeds, then you'll need to make one change in the nv-news.php application file using your favorite editor (nano -w /var/lib/asterisk/agi-bin/nv-news.php). Just edit the line which reads $demomode=1 ; and change it to $demomode=0;. After saving this change (Ctrl-X, Y, then Enter), you won't get the news group options when the NewsClips app swings into action. Instead you can set up multiple extensions to handle different news feeds.
Remote Access to NewsClips for Asterisk. You may or may not want access to NewsClips for Asterisk from phones outside your Asterisk system. If you do, here's a simple way to implement it. In a nutshell, you'll want to set up an account with a provider such as Stanaphone which provides a free DID number and free incoming calls. Or just add an extra DID number to your TelaSIP account. Then add a miscellaneous destination to your system using freePBX and configure it for extension 511 or whatever number you used for NewsClips for Asterisk. Finally, create an Incoming Route in freePBX which sends incoming calls on the Stanaphone or TelaSIP DID number to misc destination: NewsClips. Why not just forward the calls to 511 directly? Until you set up a miscellaneous destination for NewsClips, freePBX doesn't know about the 511 extension since it's embedded in the extensions_trixbox.conf file.
First, add a miscellaneous destination to your system using Setup->Misc Destinations->Add Misc Destination. Name it NewsClips and enter the extension number you assigned to this application, e.g. 511. Next, add a trunk for your StanaPhone number. We covered the Stanaphone setup process in our TrixBox tutorial. Finally, choose Setup->Inbound Routes->Add Incoming Route in freePBX. Add entries that look like this using your new StanaPhone DID number:
DID Number 3473451234
CallerID Number [leave blank]
Zaptel Channel [leave blank]
FAX Extension freePBX default
FAX Email [leave blank]
FAX Detection Type nvfax
Pause After Answer 2
Privacy Manager no
Alert Info [leave blank]
Misc Destinations: NewsClips
Click the Submit button when you finish and then the Red Bar to reload Asterisk. Now you can dial your Stanaphone number from any phone anywhere to access your news. This is exactly how the Nerd Vittles NewsClips demo works.
Adding Additional News Feeds to NewsClips for Asterisk. Here's a refresher on adding an additional news category to your system. Step 1 is to add 5 more lines of dialplan code (as we did above) to your extensions_trixbox.conf file using a new extension number, e.g. 512, and a different news category from the list above. Second, restart Asterisk: amportal restart. Now dial the extension and be sure it works. Reminder: Be sure to turn off demomode if you want to use different news feeds on different extensions.
NewsClips for Asterisk Wish List. This is just version 1 of what we hope will be a helpful addition to your Asterisk applications collection. Your feedback can help us with future versions. If there are news feeds that don't get decoded properly, post a comment and let us know the details. And leave a valid email address so that we can get back to you if we need additional information. Your email address does NOT get published in the comment. We'd also appreciate your posting a comment if you have a suggestion for version two down the road. Enjoy!
Nerd Vittles Fan Club Map. Thanks for visiting! We hope you'll take a second and add yourself to our Frappr World Map compliments of Google. In making your entry, you can choose an icon: guy, gal, nerd, or geek. For those that don't know the difference in the last two, here's the best definition we've found: "a nerd is very similar to a geek, but with more RAM and a faster modem." We're always looking for the best BBQ joints on the planet. So, if you know of one, add it to the map while you're visiting as well.
Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has raised the bar again on hosting services. For $6.95 a month, you can host up to 6 domains with 30GB of disk storage and 750GB of monthly bandwidth. Free domain registration is included for as long as you have an account. That almost doubles last month's deal, and it really doesn't get any better than that. Their hosting services are flawless! We oughta know. We've tried the best of them. If you haven't tried a web hosting provider, there's never been a better time. Just use our link. You get a terrific hosting service, and we get a little lunch money.
Want More Projects? For a complete catalog of all our previous Asterisk projects, click here. For the most recent articles, click here and just scroll down the page.
Headline News for the Busy Executive and the Lazy Loafer. Get your Headline News the easy way: Planet Asterisk, Planet Gadget, Planet Mac, and Planet Daily. Quick read, no fluff.
Got a PDA or Web-Enabled Smartphone? Check out our new PDAweather.org site and get the latest weather updates and forecasts from the National Weather Service perfectly formatted for quick download and display on your favorite web-enabled PDA, cellphone, or Internet Tablet. And, of course, it's all FREE!
Another way of accessing this remotly (or locally) by using Misc Destinations and the Digital Receptionist (aka IVR)
Add a Misc Destination:
Description: NewsClips
Dial: 511
Add it to one of the Options on an IVR.
Tie the IVR to a number that is available remotely.
Thanks for the great work – Jay
[WM: Jay, Thanks for the tip. I forgot this was now part of freePBX. I’ve adjusted the article as well.]
Hey gang,
I wanted to pass this along — http://serge.mankovski.com/. His latest blog entry is Asterisk voicemail via RSS. Pretty neat stuff!
Another winner Ward!! BTW, Have you played with Prophecy 2006 from http://www.voxeo.com/prophecy/ — at present it requires a windowz box to run… Mac & linux coming — I am not much of a programmer –but 2 free ports —this stuff looks good!!!
I am still enjoying your blog, thanks.
Have you got round to encorporating flite into Asteridex speed dials yet? The old speech prog is painfully slow announcing the called number (aah 2.7)
[WM: That’s next on my list of rewrites.]
Very neat. Ward, how can I modfy the PHP script so that I can get RSS feeds from a diferent location, not Yahoo. It will be great if I can get news from a newspaper in my home country (Ecuador) that is already supporting RSS. Two main challenges that I will face, modify the script, and have flite reading the RSS feed in Spanish….mmmm…..Hope you can help a little.