Home » Technology (Page 89)

Category Archives: Technology

The Most Versatile VoIP Provider: FREE PORTING

Weather, Weather, Everywhere: Asterisk Weather Forecasts at the Touch of a Button for Any U.S. City

I can remember as a kid how fascinating it was to be able to call a local number (611) and listen to the local weather forecast. Never mind, of course, that it was rarely accurate. Some things change and some things never do. Even as lousy as most weather forecasts are, most of us still are fascinated nonetheless which brings us to the topic of the day: An Enhanced Weather Application for Asterisk®. Last week, we finally got a reliable voice synthesizer installed for all the newer versions of Asterisk. So now we're ready to put it to good use with our first of several text-to-speech projects. We took a little different approach in building this weather module when it's compared to the default application which ships with Asterisk@Home. We wanted not only current conditions but also a 7-day forecast. And we wanted the caller to be able to choose the weather location rather than having to hard-code a specific city into the AGI script. Finally there's even a simple feature for those that don't want to listen to a full 7-day forecast: hang up.

How It Works. The design is pretty straightforward. You install the nv-weather.php script in your default Asterisk agi-bin directory and add a simple dialplan to your extensions_custom.conf file. Then you pick up an extension on your Asterisk system and dial 611 or the number you've designated for the new weather reports. You'll be prompted to enter the 3-character airport code of the city for which you want to hear the weather forecast. In a few seconds you'll be listening to the latest information from the National Weather Service using our pdaweather.org conversion tools. And apologies to our foreign friends. Yes, we know you have weather, too. We just don't know of an equivalent organization like the National Weather Service in every country. If you do, then it'll be fairly simple to adjust the code to meet your local needs. Here's a Canadian solution.

Prerequisites. For the Nerd Vittles Weather Application to work, you'll need an Internet connection to access pdaweather.org. We're using our weather site to convert the NWS weather reports to a text-to-speech-friendly format. Then you'll need an Asterisk@Home 2.x server and the new Flite voice synthesizer for Asterisk. Instead of a dedicated Asterisk server, you can use the VMware-version of Asterisk if you just want to experiment a bit. It runs in a window on your Windows XP/2000 desktop. Our Flite tutorial and the Flite application software are available here. And, as usual, everything you'll need for this project is free!

A Word About Airport Codes. Before we get everything installed and working, let's spend a minute discussing airport codes. At least for some U.S. cities, the folks that thought up airport codes did a pretty crappy job of coming up with three-character abbreviations. Take IAD, for example, which is the airport code for Dulles Airport outside of Washington, D.C. We've compounded the problem by trying to uniquely fit those codes into a telephone keypad consisting of 10 numbers which cover the 26 letters of the alphabet. You'll recall that even Ma Bell herself never considered that letters would actually be used for much of anything on telephones. Remember the Q and Z were originally missing. Times change. It happens. --Forrest Gump

The point of all this is to alert you that some airport codes when keyed in on a touchtone phone are not unique. For example, LAX (Los Angeles, CA) and JAX (Jacksonville, FL) both are keyed in as 529. How do it know? Well, it doesn't. So we were a little arbitrary with some of these. 529 is Jacksonville on this system while Los Angeles is LOS (567) or SNA (762). NYC and our made-up MYB share 692 so Myrtle Beach is 692 and JFK (535) and LGA (542) are used for New York (which happen to be the real airport codes and the locations of the weather stations anyway).

You also may find that your favorite airport is missing altogether. Not to worry! Keep reading! We entered a bunch of airport codes, and then we got tired and quit. As folks have requested other cities through our pdaweather.org web site, we've added them. But soon, all of that will be a thing of the past. How will you know if your town is missing? Well, it's easy. You'll get the Atlanta weather report whether you wanted it or not. So, if that happens, just hang in there for Part II ... coming soon! Here's the list of supported airport codes for today.

Dialplan Code. In order to activate extension 611 to answer calls for weather information, you'll need to drop the following code into your dialplan in the [from-internal-custom] context of extensions_custom.conf:

exten => 611,1,Answer
exten => 611,2,Wait(1)
exten => 611,3,DigitTimeout(7)
exten => 611,4,ResponseTimeout(10)
exten => 611,5,Flite("At the beep enter the three character airport code for the weather report you wish to retrieve.")
exten => 611,6,Read(APCODE,beep,3)
exten => 611,7,Flite("Please hold a moment while we contact the National Weather Service for your report.")
exten => 611,8,AGI(nv-weather.php|${APCODE})
exten => 611,9,NoOp(Wave file: ${TMPWAVE})
exten => 611,10,Playback(${TMPWAVE})
exten => 611,11,Hangup

For versions of AAH before 2.8, once you've added this code using AMP->Maintenance->ConfigEdit->extensions_custom.conf, click the Update button to save your changes, and then reload your Asterisk settings: AMP->Setup->IncomingCalls->SubmitChanges and click the Red Bar. If you'd prefer a different extension (rather than 611), just modify the number in each line of the code above. If you're curious how to pass variables back and forth to a PHP/AGI script, here's a good example. In line 8, we're passing the variable ${APCODE} to the PHP/AGI script with the airport code. In lines 9 and 10, the PHP/AGI script is returning the ${TMPWAVE} variable with the file name of the .wav file containing the weather report. Now let's add the PHP/AGI script to your default AGI directory, and we'll be ready to test things out.

Downloading and Installing nv-weather.php. To get the PHP/AGI script installed, you'll need to log into your Asterisk server as root. Then issue the following commands in order:

cd /var/lib/asterisk/agi-bin
wget http://nerdvittles.com/aah2/nv-weather.zip
unzip nv-weather.zip
rm -f nv-weather.zip
chown asterisk:asterisk nv-weather.php
chmod 775 nv-weather.php
amportal stop
amportal start

Taking NV-Weather for a Spin. Now we should be all set. Just pick up an extension on your system and dial 611. You'll be prompted to enter the three-character airport code. Choose one that's in the supported list of codes unless you just like the Atlanta weather report. If you want the rest of the world to be able to use your fancy new weather station, then just sign up for a free incoming line with Stanaphone and, using AMP or freePBX, point your new DID to extension 611 on your local Asterisk system. Piece o' cake! Enjoy!

Housekeeping 101. Temporary files in /tmp get cleaned up by Linux housekeeping automatically. Temporary files stored elsewhere don't. The weather scripts have to store .wav files in the /var/lib/asterisk/sounds path in order to play them from within your dialplan, but it's a good example of how not to design code on busy systems because it places all of the temporary sound files for each reading of these weather reports in /var/lib/asterisk/sounds/tts. So, from time to time, make a mental note to remove all of these files with a command like this:

rm -f /var/lib/asterisk/sounds/tts/*

Following our article last week, there were a few suggestions on how to automate this with a cron job. Here's the one we like the best. Log into your Asterisk server as root and edit the following file: nano -w /etc/crontab. Move to the bottom of the file and insert the following code on a blank line:

3 0 * * * /usr/bin/find /var/lib/asterisk/sounds/tts -type f -mtime +14 | /usr/bin/xargs /bin/rm -f >/dev/null 2>&1

This code will delete all of the files in the tts every two weeks. If you'd prefer a shorter time, change the number 14 accordingly. Now save your changes: Ctrl-X, Y, then Enter.

Coming Attractions. Well, we're down to the wire on the family move to Charleston. Our next column will be coming to you from there. We'll be revving up our text-to-speech series with an article on using Flite to query and retrieve information from a MySQL database on your Asterisk server in our next episode. This will also be Part II of the Weather Application with the Mother of All Weather Apps. In Part II, we'll turn over complete control of the National Weather Service to you (well, almost!). There will be separate options for Current Conditions, Forecast-at-a-Glance, and 7-day Forecasts. The way it works is you'll get a MySQL database with every airport in the United States. There are about 3,500 of them. You can designate up to 1,000 of them for active use from your phones: 000 through 999. We've chosen a thousand, but you can change them in any way you like and as often as you like. After choosing your favorite 1,000 airports, you simply pick up a phone, dial 611 and enter the three-digit airport code. After giving you a quick current conditions summary, you'll be prompted for which detailed weather report you desire. The script will query the MySQL database for the matching code, contact the National Weather Service for the appropriate report, and presto: instant weather. And it'll all be done from Weather Central: Your Very Own Asterisk@Home Server. So think of today's episode as the appetizer. With the next version, you'll get complete control of the airport database and the types of weather forecasts you wish to listen to. We'll also have lots of tips on building MySQL applications with Asterisk and PHP to keep you busy for the rest of the summer dreaming up your own applications. We'll even publish the best ones here for the rest of the world to share.

Farewell to Asterisk@Home. It's also fitting that, as we leave Atlanta, we also bid farewell to Asterisk@Home this week. Version 2.8 marks the end of the line for Asterisk@Home. Why? Because the scope of use of the product now has far outstripped its name, Andrew Gillis has decided to change the name of the magic bundle we all know and love. But there's much more! The new product will have UPGRADE POWER and freePBX 2.1 and ... well, you'll just have to wait and see. Shouldn't be very long. So we'll all be very busy ... after the move. AdiĆ³s Atlanta!

Homework. For those that like to get a head start on things, you can go ahead and download the MySQL Airports IATA database and a web-based script to take a look at everything. You'll need Asterisk@Home 2.7 or earlier to edit the database because these versions include phpMyAdmin as part of the Asterisk Management Portal (AMP->Maintenance->phpMyAdmin). Download the zipped airports file to your desktop and unzip it. This database is licensed pursuant to a GNU General Public License. It was adapted from the AirSort application on SourceForge if you happen to be looking for a MySQL database containing worldwide airport (iata) codes. Now crank up phpMyAdmin and click on the SQL Query Window icon in the top of the left frame. Now click on the Import Files tab, select the airports.sql file on your Desktop, set the Character Set to ASCII, and click the Go button. Once the file is imported, click on the Home icon in the left panel, click on the Databases pull-down, and choose Airports. Then click on the USairports table below it. When the table opens, click on the Browse tab in the right frame to display the file's contents. Nome is the airport name, iata is the airport code, dialcode is the airport code converted to numbers on a touch-tone phone, citta is the city and state of the airport, and main is the field used to designate whether a particular airport can be accessed using a phone. An asterisk means Yes. Anything else means No. Now click on the DialCode column heading to sort the table by dialcode. As you scroll through the database, you'll see that every group of matching dialcodes has one entry with an asterisk in the main column. Remember that dialcodes are not unique while airport codes (iata) are. Because of the layout of the alphabet on touchtone phones, as many as a dozen airport codes may share the identical dialcode which is why we need the main field to pick one. As mentioned above, I've already picked one for each dialcode, but you may have your own ideas about which airports to make active depending upon where you live and what cities you care about. If you change the main entry for a dialcode, remember to also blank out the previous one for that dialcode. Otherwise, the last dialcode entry with an asterisk in the main column will win (i.e. that's the city whose weather report will be played) once the application is finished. So there's your homework. Get your airports database set up in a way that meets your needs so that the dialcodes 000 through 999 select the airport locations of interest to you. Don't mess with the iata codes. Even though the database doesn't enforce it, these are unique and need to stay that way.

In designing this new application for telephone use, it was tempting to support all of the airports in the United States rather than a measily 1,000 of your favorites. To do this, however, would have meant using either zip codes or giving callers a submenu of airport code cities matching a particular dialcode. We ruled out zip codes because nobody can remember more than a handful of them anyway. The dialcode submenu sounded straight-forward enough until we discovered there were some dialcodes with a dozen or more matching airport codes. To force callers to listen to a list of a dozen cities before ever getting to choose a weather report would have been P-A-I-N-F-U-L. So we've opted for the Fab 1,000 thinking that will meet the needs of most folks. As usual, you are free to make changes in the final software to meet your needs. And, if IVR Hell, long phone calls, and 3,500+ airports at the touch of (lots of) buttons are your thing, have at it!

To assist with your exploration of the airport codes and to give you some hints about how we use those to actually obtain weather reports from the National Weather Service, we're also providing our working prototype of a web page that retrieves weather reports. Keep in mind that it is our very rough, working prototype and does no text-to-speech magic at this point. But it'll show you how to build one and give you some great tips and tricks for retrieving, parsing, and manipulating web site data within a PHP script. Since your Asterisk@Home server has Apache running, you can simply drop this script into the web directory and access it using a web browser to call up http://YourServer'sIPaddress/airport.php?code=list or http://YourServer'sIPaddress/airport.php?dialcode=list. The former will display all the airports in the database while the latter displays only those in which the dialcodes are asterisk-enabled. When you click on a link, you should get a weather report or two suitably parsed for use in text-to-speech apps as well as some other options which we haven't yet finished. To install the script, log into your Asterisk server as root and execute the following commands in order:

cd /var/www/html
wget http://nerdvittles.com/wp-content/airport.zip
unzip airport.zip
rm -f airport.zip
chmod 775 airport.php

For Part II of this series, click here.


Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has continued their limited time special on hosting services. For $6.95 a month, you can host up to 6 domains with 15GB of disk storage and 400GB of monthly bandwidth. Free domain registration is included for as long as you have an account. It doesn't get any better than that, and their hosting services are flawless! We oughta know. We've tried the best of them. If you've never tried a web hosting provider, there's never been a better time. Just use this link, and we'll all be happy.


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.

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!

Introducing Flite: A Voice Synthesis System That Really Works With Asterisk@Home

One of the coolest features of Asterisk@Home 1.5 was the Festival voice synthesis module which allowed the creation of data-driven, text-to-speech telephony applications with minimal programming. Festival could actually "speak" information from a MySQL database to folks calling in with a Plain Old Telephone. When Asterisk® 1.2 and Asterisk@Home 2.x were released, everything changed at least on older systems with slower processors and less than several gigabytes of memory. What had been almost instantaneous voice messages in AAH 1.5 turned into 7-10 second periods of silence between each phrase being read to a caller. The former 10-second weather report sample application turned into a 70-second nailbiter. Painful doesn't begin to describe it. Worthless pretty much sums it up. It was so bad, in fact, that we've kept an Asterisk@Home 1.5 system chugging away just because the voice synthesizer worked so well. Pat West tipped us off last week that there was a "solution" but it didn't quite work with the last few month's of Asterisk@Home 2.x releases. So we put on our facilitator cap and went looking for a complete solution that easily could be integrated into Asterisk@Home ... even by Newbies.

And today our tip of the hat goes to Francois Aucamp from South Africa who has single-handedly reengineered Carnegie Mellon University's open source speech synthesis engine (Flite) to work with Asterisk@Home and restored voice synthesis to its rightful place as an indispensable component in the Asterisk@Home bundle. We'll show you how to install the necessary components in less than 15 minutes, and your Asterisk system will once again be speaking to callers whenever you need it to. This works with Asterisk@Home 2.x versions and Asterisk 1.2x. Earlier versions use the older Asterisk API. See the comments for more details. And, in a future column after our Big Move to Charleston (T minus two weeks and counting), we'll actually build a sample app for everyone to use in rolling your own future text-to-speech implementations. But, first, let's put a system in place that actually works again with Asterisk@Home.

One nice feature of Flite is that you can add other (better) synthesized voices down the road if you really want or need a first-class system. For home or small business use, the voice that comes with Flite is more than adequate. If you use this in business applications, we hope you'll consider making a modest donation to Francois Aucamp. He literally put this together in a couple of days for us. As with so many open source, university-inspired projects, Flite was a terrific idea. It's just that the Carnegie Mellon folks apparently lost interest at about the 90% completed mark, and never quite got things wrapped up for end-user implementation. Francois not only added the missing 10%, but he also single-handedly wrote the Asterisk interface to make it all work seamlessly from within the Asterisk dialplan without reliance upon external AGI scripts. As my old judge friend GBT used to say, "he put it down where the goats could get it." Now, with a single line of code, you can have Asterisk talking away. Here's the dialplan syntax: Flite("Thank you for reading Nerd Vittles. Have a nice day. Goodbye.") It doesn't get much simpler than that.

Downloading and Installing the Components. As mentioned above, there really are two pieces to the puzzle in order to use the Flite speech synthesis engine in your dialplan. First, you need to download and install Flite. And then you need to download and install the Asterisk application module, app_flite. Be advised that the Carnegie Mellon version of Flite will not work in your Asterisk dialplan. You'll need the modified version below which creates Flite as shared objects (aka dynamic libraries) rather than as a static library which would have made it resource hungry, the same problem now rearing its ugly head with Festival. The other advantage of the dynamic library approach is that the Flite library routines now can be called within Asterisk without physically loading Flite as an independent application which also reduces system overhead and load times. For the less technical, text-to-voice synthesis now works again without lengthy periods of silence between phrases and sentences.

To begin the download and installation process, log into your new Asterisk@Home 2.x server as root. Incidentally, this should work on any version up to and including 2.8! Then issue the following commands in order:

cd /root
wget http://nerdvittles.com/aah2/flite-1.3-1.aah.i386.rpm
rpm -ihv flite-1.3-1.aah.i386.rpm
wget http://nerdvittles.com/aah2/app_flite-0.3-1.aah.i386.rpm
rpm -ihv app_flite-0.3-1.aah.i386.rpm
amportal stop
amportal start

Testing Flite. Once you complete the installation process above, load the Asterisk Command Line Interface (CLI) while still logged in as root and be sure that the Flite application is loaded:

asterisk -r
show application flite
quit

You should get a response from Asterisk that looks something like the following:

-= Info about application 'Flite' =-

[Synopsis]
Say text to the user, using Flite

[Description]
Flite(text[|intkeys]): This will invoke the Flite TTS engine,
send a text string, get back the resulting waveform and play it to
the user, allowing any given interrupt keys to immediately terminate
and return.

Modifying the Weather AGI Script to Use Flite. A better test of how well Flite works can be demonstrated by making a slight change in the default AAH Weather Script to use Flite instead of Festival. Here's how. While still logged in as root, make a backup copy of the existing weather script:

cd /var/lib/asterisk/agi-bin
cp festival-weather-script.pl festival-weather-script.pl.bak

Now edit the original script (nano -w festival-weather-script.pl) and move the cursor down to line 23 in the script which looks like this:

my $execf=$t2wp."text2wave $sounddir/say-text-$hash.txt -F 8000 -o $wavefile";

Press Ctrl-K to delete the line, then press the Enter key, move up to the blank line, and insert the following new line:

my $execf=$t2wp."flite $sounddir/say-text-$hash.txt $wavefile";

Save your change to the file: Ctrl-X, y, then press the Enter key. Pick up a phone on your system now and dial *61 for the new weather report using Flite.

Integrating Flite and app_flite Into Your Dialplan. Now that you've seen the Perl way of doing things with Flite, let's do things the easy way. We'll make a quick change to extensions_custom.conf to complete our testing. While still logged in as root, do the following:

cd /etc/asterisk
nano -w extensions_custom.conf

Now use the down cursor to move down to the line which begins exten => *65,1,Answer and make the following changes and additions:

;exten => *65,1,Answer
;exten => *65,2,AGI(festival-script.pl|Your phone number is ${CALLERIDNUM}.)
;exten => *65,3,Hangup

exten => *65,1,Answer
exten => *65,2,Flite("Your phone number is ${CALLERIDNUM}. Have a nice day! Good bye.")
exten => *65,3,Hangup

Save your changes to the file: Ctrl-X, y, then press the Enter key. Restart Asterisk: amportal restart. Load the CLI: asterisk -r. Then pick up a phone on your system and dial *65 for the Flite rendition of your current phone number.

Housekeeping 101. Temporary files in /tmp get cleaned up by Linux housekeeping automatically. Temporary files stored elsewhere don't. The weather script is a good example of how not to write a script on a busy system because it places all of the temporary sound files for each reading of the weather report in /var/lib/asterisk/sounds/tts. So, from time to time, make a mental note to remove all of these files with a command like this:

rm -f /var/lib/asterisk/sounds/tts/*

Where To Go From Here. Finally, it's worth noting that Flite can also read text files. The syntax for your AGI script should look like this: flite -f filename.txt -o filename.wav. That pretty much covers everything you need to know to get started. For those that want to dig deeper, here's a link to the official Carnegie Mellon Flite 1.3 documentation which we've converted to HTML for ease of use. There's also a PDF version available. And the Texinfo version is available for nerd use only. As people add new voices, we'll let you know in the Comments to this post. In the meantime, enjoy!


Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has continued their limited time special on hosting services. For $6.95 a month, you can host up to 6 domains with 15GB of disk storage and 400GB of monthly bandwidth. It doesn't get any better than that, and their hosting services are flawless! We oughta know. We've tried the best of them. If you've never tried a web hosting provider, there's never been a better time. Just use this link, and we'll all be happy.


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. The little bug in the map display last week that wiped out everyone in the U.S. and Canada has been fixed. We're all back!

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!


Some Recent Nerd Vittles Articles of Interest...

The Next Frontier: Introducing Asterisk@Home 2.8 and freePBX

We've dragged our feet a bit on releasing a Newbie's Guide to Asterisk@Home 2.8 waiting for some of the dust to settle. This release includes not only an upgrade to CentOS Linux and Asterisk® but also introduces a revolutionary new user interface to Asterisk, freePBX 2.01. Of course, there is the usual collection of add-on products (SendMail, Asterisk Mail, PHP, PHPmyAdmin, MySQL, SugarCRM, the Festival Speech Engine, Flash Operator Panel, Open A2Billing, Digium card auto-configuration, loads of AGI scripts including weather forecasts and wakeup calls, xPL support, Microsoft File Sharing and Networking support through Samba and much more) which makes Asterisk@Home one of the most revolutionary products in the commercial or open source marketplace. And, yep, it's still free!

Let us begin by suggesting who shouldn't install this software: NEWBIE'S! If you're one of them or if this is your first Asterisk installation, do yourself a huge favor and cut your teeth on Asterisk@Home 2.7. Our complete Newbie's Guide to Asterisk@Home 2.7 will get you up and running in under an hour. It is a production-quality PBX that just plain works. And it will all but eliminate any new user frustrations that often accompany installation of bleeding edge open source software. Asterisk@Home 2.8 certainly qualifies, and we mean that as a compliment! If you already have an Asterisk@Home system in production, this is an excellent opportunity to leave it alone and either buy a new PC (here's a small-footprint Compaq unit that will set you back less than $150). We just bought several! Or you can run a VMware version of Asterisk@Home 2.8 in a window on your Windows XP desktop. Our instructions for installing the VMware versions are available here. Untested BitTorrent links are available here which will conserve bandwidth at vmwarez.com.

Having said all of that, let us hasten to add that WE LOVE ASTERISK@HOME 2.8! The main reason is that it finally provides an incredibly simple upgrade system in freePBX which will eliminate your having to reinstall every single component from scratch each time a bugfix to the freePBX shell is released. And freePBX, which replaces the Asterisk Management Portal (AMP), finally provides a web interface to virtually anything you'd want to do with Asterisk without having to dig into their code. Finally, freePBX introduces modules which make it easy to add OR upgrade one component without the rip-and-replace drill which has accompanied Asterisk@Home upgrades since Day One. In conclusion, there now are simple upgrade paths for CentOS and its applications, Asterisk, freePBX, and SugarCRM. That all but eliminates the need to continually reinstall Asterisk@Home from scratch and will allow most of us to concentrate on adding new functionality. That's a WIN, WIN deal in our book!

In this introductory article to Asterisk@Home 2.8, we're going to skip some of the hoops we normally walk you through in our Newbie's Guide and point you to some of the new resources which have been put in place to support freePBX. You may want to print out the Newbie's Guide to Asterisk@Home 2.7 if you need a refresher course on some of the basics. We'll refer you to sections of that tutorial as we move quickly through the basics and then get to the good stuff in Asterisk@Home 2.8. The most important tip today is getting your system set up correctly so that you can quickly upgrade when new freePBX releases come out. This has been an almost daily occurrence for the past several weeks and probably will continue that way for at least another month or so. Not to worry! It's brain-dead simple to upgrade once you have your system properly configured. So let's get started.

Basic Asterisk@Home Installation Steps. Download the ISO image of Asterisk@Home 2.8 from your favorite mirror site and make yourself an installation CD. Load it into a machine whose hard disk can be dedicated to Asterisk@Home (i.e. erased). Before booting the system with the new CD, be sure the machine has Internet connectivity or the installation will fail without much of a clue that that's what went wrong. You'll be prompted to choose your root user password for CentOS as part of the install. When the installation completes, log in as root and change your other passwords according to our previous tutorials. Then run yum -y update to get the latest CentOS patches. If you want https web support, do yum -y install mod_ssl. If you want Bluetooth support, perform the same steps outlined in our earlier Newbie's Guides. Then reboot. As we write this, there is no kernel update to the new version of CentOS so there's no need to rebuild the zaptel drivers. When that changes, you'll need to go through the zaptel source rebuild drill which is outlined in our last Newbie's Guide.

Configuring freePBX for Easy Updates. There have been any number of problems identified with Asterisk@Home 2.8 on the SourceForge forums. Most of these involve minor tweaks to freePBX source code. "Minor" is, of course, in the eye of the beholder. It's sorta like minor surgery. That's surgery other folks are having. As tempting as it may be to make changes to the internal code of freePBX, DON'T! If you do, you will jeopardize your ability to automatically update the freePBX modules as new source code is released because each module now has a checksum which is tested before an update is permitted. Bug fixes are released almost daily so you won't have to wait long for a fix. Just to repeat again for slow learners and tinkerers: By messing with the freePBX source code, you will have just destroyed the very best feature of Asterisk@Home 2.8: instantaneous upgrades in place! We're by no means the freePBX experts, but some of the experts do read our columns and will post corrections if we haven't gotten what follows quite right. The critical component to Asterisk@Home 2.8 is getting it set up so you can quickly install freePBX updates as they are released. The web interface will even tell you when something new is available once it is configured properly. But, for this to work, we need to get freePBX upgraded from version 2.01 to the version 2.1beta. Here's how. Log into your Asterisk@Home server as root and issue the following commands before you do any configuring using the freePBX web interface:

cd /usr/src
rm -rf /usr/src/freepbx
svn co https://svn.sourceforge.net/svnroot/amportal/freepbx/trunk freepbx
cd freepbx
./install_amp --force-version=2.0.1
amportal restart

You're now set up to download future updates whenever you need them using commands like this:

cd /usr/src/freepbx
svn update
./install_amp --force-version=2.0.1
amportal restart

Keep in mind that you only need to do this when the freePBX "engine" is replaced. All of the individual components which make up freePBX (think of them as spark plugs if you remember what those were) now can be updated from within the web interface itself. If you want more details about the process, click here but we think we've got it about right.

Getting Started with freePBX. You still access freePBX just as you accessed AMP, by pointing a web browser to the internal IP address of your new Asterisk system. The username is still maint. Just enter the password you assigned to freePBX/AMP when you configured your system. In the old days, AMP came preconfigured with everything they thought you'd need to use it. With the new freePBX architecture, you first have to install and enable the modules you want to use. And now others can write modules to expand the capabilities of freePBX without futzing around in the basic source code. You get to these modules by choosing Tools->Module Admin from the main freePBX menu. Unlike some applications, there's really no reason not to activate all of the available modules since they won't slow down Asterisk. The only performance hit is when you click the Red Bar to reload freePBX. The more modules you've activated, the longer it will take to reload freePBX since it queries each module to see if changes need to be applied.

The other thing you need to know about Modules is that there are two types: Local Modules and Online Modules. Local Modules are the pieces that make freePBX work on your local machine. Online Modules provides access to modules which are available for download over the Internet. And Online Modules even tells you which ones are newer than the ones currently on your system. To install new modules after an engine update, you first may need to Uninstall and Remove the old modules from within the Local Modules window if the modules appear to be corrupted. Otherwise, don't or you'll lose your existing configuration data. See the comments for more details. You can do it safely this time IF you haven't input any data yet. Next go back to the Online Modules window and click Download beside each module you want to obtain. When the downloads complete, return to the Local Modules window and click Install then Enable for each module. It sounds harder than it really is, but it's exactly the upgrade path that most of us have been clamoring for these past dozen or so months. Just check the Online Modules window from time to time to see what's new and install it. There were four new updates just today! Before too long, we wouldn't be surprised to see an option to email you notices when new modules are released or older ones are updated. This is nothing short of fantastic for the Asterisk community if we do say so.

Last but not least, for each Module, there now is online documentation. You can read about all the Module pieces by clicking here. Knock yourself out! Once you complete the above steps, you're ready to set up your new system.

Setting Up freePBX. When you click the new Setup tab in freePBX, the first thing you'll notice is there are a lot more options. Start by adding your Trunks. This works pretty much like it always has. Choose ZAP, IAX2, SIP, or ENUM for each trunk and proceed accordingly. Down the road, the grand plan is to have sample settings for each provider on line here. Very cool!

When you have your Trunks set up, you'll need a way to call in (Inbound Routes), call out (Outbound Routes), and a way to process incoming calls: a Digital Receptionist, a Call Queue, a Custom Application, DISA, or a phone to ring (Extensions). And you can add Follow Me routing now with the click of a button. And did we mention the incredible flexibility which has been added to manage calls at different times of the day, week, or month? Check out Time Conditions. The only piece that's still missing is a way to Monitor Inbound Routes by Channel rather than by DID since some providers don't pass DID information but hopefully that will come in due course. You can follow along in our previous tutorials for the basics. When you're ready to explore the new Configuration options, here's the link with all the latest and greatest information. Using freePBX at the moment is akin to laying track in front of a steaming locomotive, but the benefits are so enormous and the bug fixes are being released so quickly that you really won't find it very painful. We haven't! Having said that, I don't think you'd want to stake your business on it at the moment, but it's quickly getting there. And you'll find the adventure downright exhilarating. To our guiding light, Rob Thomas, and the entire freePBX development crew, our hats are off! You get an A+ in our book on this one. And, of course, our usual thanks and gratitude to Andrew Gillis for single-handedly producing nearly flawless versions of Asterisk@Home month after month after month.

Restoring the Asterisk@Home Maintenance Functions. If you're like us, you've become dependent upon the Maintenance functions previously included in the AAH web interface to AMP. You have two choices: either clone it from a system you already have or wait on Rob Thomas to finish his new one. It's easy to restore them if you have an existing Asterisk@Home system running in parallel. First, log in to your new AAH 2.8 server as root and issue this command: mkdir /var/www/html/maint. Then log in to your old AAH system as root and issue the following command substituting the IP address of your AAH 2.8 server for 192.168.0.128. Provide your root password to your new server when prompted.

scp -r /var/www/html/maint/*.* root@192.168.0.128:/var/www/html/maint

Now you can access the old Maintenance functions by pointing your web browser to http://192.168.0.128/maint/. Just ignore the Asterisk@Home version number unless you want to crank up Nano and edit /var/www/html/maint/index.php.

Where to Go From Here. This article is a bit of a work in progress for a couple of reasons. First, if you haven't heard, we're moving. In and of itself that wouldn't be a big deal except (1) the movers are coming in three weeks and (2) we're attempting to cram 5500 square feet of "stuff" into the new 3500 square foot house. With less than a month to go, the blog articles have temporarily moved down the priority list a bit ... unless you want to join me sleeping in the street. Second, the amount of new technology in Asterisk@Home 2.8 is truly mind numbing, and it's going to take the whiz kids and us some time to absorb and digest all of the changes and enhancements. Do yourself and everyone else a favor. As you find new features or problems, post them here or on SourceForge so that we all can benefit from the discoveries. We'll do our best to incorporate new changes into this article in the coming weeks so check back often and be sure to read the comments or subscribe to the Nerd Vittles Comments RSS feed. Enjoy!

Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, is running a special this month on hosting services. For $6.95 a month, you can host up to 6 domains with 15GB of disk storage and 400GB of monthly bandwidth. It doesn't get any better than that, and their hosting services are flawless! We oughta know. We've tried the best of them. If you've never tried a web hosting provider, there's never been a better time. Just use this link, and we'll all be happy.


Nerd Vittles User 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. You'll notice there's a little bug in the map display at the moment. It wipes out everyone in the U.S. and Canada. Is that loud cheering we hear? Not to worry! You can restore us all by moving east or west on the default display, or choose the Big Map Display option after you add yourself, and you can see the whole Nerd Vittles universe. frappr bug fixed: May 3.

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!

Introducing The Idolizer: Free Asterisk AutoDialer for American IdolĀ® Addicts

After a fun day of packing boxes for the Big Move, there's nothing quite as mind numbing as an hour of the FOX TVĀ® network's American IdolĀ® and 50 of your favorite commercials. The Little Mrs. doesn't mind the one hour break in production. It's the two additional hours voting for Kelly Pickler that drives her up the wall. She really can sang. Honest, honey! Enter, The Idolizer. Today's Asterisk® project is for those that have better things to do than dialing a tollfree number for two hours every Tuesday evening. And, no, the show's producers don't like autodialers. Too damn bad! We don't like commercials (especially ten at a time), but they're still showing those. Here's the deal. Cut out the commercials, and we'll turn off our autodialer. And I'll bet DialIdol.com will, too. And, no, we're not affiliated with the Fair and BalancedĀ® network nor the American IdolĀ® show. We just don't wanna waste two hours dialing the same phone number over and over ... when we could be packing boxes and making the Little Mrs. happy.

Prerequisites. To use The Idolizer autodialer with Asterisk, you'll need a free Asterisk@Home PBX or at least a copy of the VMware version of Asterisk@Home that runs in a Window on your Windows XP desktop. This works on versions of Asterisk@Home at least as far back as 1.5. Our tutorials will get you up and running in under an hour. Then you'll need an account with a hosting provider that gives you free calls to toll-free numbers or unlimited outbound calling in the U.S.

Installation. Using the Asterisk Management Portal (AMP) or freePBX, choose Maintenance->Config Edit->extensions_custom.conf and add the following custom context to the bottom of the file:

[custom-idolizer]
exten => s,1,SetGlobalVar(COUNTER=1)
exten => s,2,Answer
exten => s,3,Wait(2)
exten => s,4,Dial(sip/8664365701@telasip-gw|18|L(10000:2000:5000)) ; 18 for TelaSIP, 22 for FWD
;exten => s,4,Dial(iax2/*18664365701@fwd|22|L(10000:2000:5000)) ; 18 for TelaSIP, 22 for FWD
exten => s,5,Goto(h,1)
exten => s,105,NoOp(BUSY)
exten => s,106,Goto(h,1)
exten => h,1,SetGlobalVar(COUNTER=$[${COUNTER} + 1])
exten => h,2,NoOp(Counter: ${COUNTER})
exten => h,3,Wait(6)
exten => h,4,GotoIf($["${COUNTER}" < "999"]?s,2) exten => h,5,Hangup

Once you know the phone number of the contestant you wish to vote for, make the following adjustments to the code above:

  • Provider ... Replace telasip-gw with the trunk name of your VoIP provider in line s,4 (see samples)
  • Protocol ... Be sure you specify the correct protocol for your provider: sip or iax2 (see samples)
  • Dialing Prefix ... The dialing prefix must be added to match what your provider expects to receive before the 10-digit, toll-free number (see samples)
  • Toll-Free Number ... Enter the 10-digit number (default: 8664365701) of your favorite contestant in line s,4 (see samples)
  • AutoDial Counter ... Set the maximum number of times you want the call placed in line h,4 (999 is default)
  • Now move to the top of the file and insert the following code in the [from-internal-custom] context using an available extension number on your system (default=1234):

    exten => 1234,1,Goto(custom-idolizer,s,1)

    Click the Update button to save your changes, and then reload Asterisk: Setup->Incoming Calls->Submit Changes->Red Bar.

    Tweaking the Settings. If you find that your calls aren't being completed or that your votes aren't being registered (i.e. the call disconnects before you are thanked for voting), it's easy to fine tune the script. The number 18 in s,4 tells the dialer how many seconds to wait for an answer when placing calls. The number 10000 in s,4 (in thousandths of a second) tells Asterisk how long to stay connected once a call is answered. And the number 6 in h,3 tells Asterisk how many seconds to wait between placing calls.

    Using the AutoDialer. When you're ready to begin your dialing spree, pick up an extension on your system and dial the extension number you assigned to The Idolizer (default=1234). Put the receiver down (don't hang up!) and enjoy the rest of your evening while The Idolizer does the dialing for you. When you're ready to stop voting, hang up the phone. If you'd like to follow the progress of your calls, fire up the Command Line Interface (CLI) on your Asterisk system (asterisk -r) and enjoy the show!


    Nerd Vittles User 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." The map still isn't quite representative of where all of our visitors are coming from, but we're getting there. 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. We'll check it out one of these days.

    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!

    VoipDiscount.com: Free Asterisk Calling Returns to the VoIP Wild West

    We return to the VoIP Wild West again today with another free calling discovery. As most of you know, these don’t last forever, but they sure are great while they exist. VoipDiscount.com is one of the better deals to come along in quite a while because of the scope of the countries to which you can place free calls. As you can see from their banner, the list includes not only the United States and Canada, but also 50 49 OTHER COUNTRIES including Mexico and most of Europe, South America and the Far East! And calls to formerly expensive places such as Costa Rica are about a penny a minute. Click on the banner for their complete price schedule. The only (published) catch is you have to open an account with at least $15 to cover the upfront costs of calls to these other places. Be sure to read the comments for some others!

    Getting Started. To begin, you’ll need to download their softphone client from the VoipDiscount.com web site using a Windows PC. When you’ve installed the softphone, run the application and create a username and password for yourself. Once you’ve verified your email address, you can add 10 euros (about $15) to your account using a major credit card or PayPal, and you’re all set. Be sure you configure the client to NOT start up each time you start Windows since we’re going to be using the service with your Asterisk® server. And, when you shut down the client, be sure to look in the Windows Toolbar at the bottom of your display and REALLY exit from the softphone to shut it down. Otherwise, you won’t be able to connect to the service with Asterisk since you can’t have two clients logged in at the same time.

    Creating a VoipDiscount Trunk. If you’re using Asterisk@Home or the Asterisk Management Portal (AMP), or FreePBX, then getting things set up for VoipDiscount is a breeze. Open the management portal with your web browser pointed to the IP address of your Asterisk system and choose Setup->Trunks. Now create a SIP trunk for the service with a Trunk Name of voipdiscount and with Outgoing Dialing Rules in the U.S. that look like this:

    001+NXXNXXXXXX
    00+1NXXNXXXXXX
    001NXXNXXXXXX

    Add the following PEER Details in Outgoing Settings using your own username (in three places!) and password. Leave the Incoming Settings blank.

    allow=ulaw&alaw
    authuser=yourusername
    disallow=all
    fromdomain=sipdiscount.com
    fromuser=yourusername
    host=sip.sipdiscount.com
    insecure=very
    nat=yes
    qualify=yes
    secret=yourpassword
    sendrpid=yes
    type=peer
    username=yourusername

    For the Registration String, enter the following using your own username and password:

    yourusername:yourpassword@sip.sipdiscount.com

    Click the Submit Changes button and click the Red Bar to update Asterisk.

    Creating a VoipDiscount Outbound Route. Now choose the Outbound Routes option and click Add New Route. Fill in the blanks with something like the following:

  • Route Name: OutVoipDisc
  • Route Password: leave blank
  • Dial Patterns: 88|NXXNXXXXXX
  • Trunk Sequence: sip/voipdiscount
  • Now click the Add button and then the Submit Changes button. Then move the Dialing Route for OutVoipDisc to the top of your list of dialing priorities, and click the Red Bar to reload your new Asterisk settings.

    Making a Test Call. Once you complete the above steps, you should be able to make a test call to anywhere in the U.S. by dialing 88-678-1234567 where 88 is the dialing prefix you set up in the Outbound Route (make it anything you like!), 678 is the area code for the call, and 1234567 is the local phone number. For those in other countries or, if those in the U.S. wish to call outside the U.S., add the appropriate dial patterns for each country to both the Trunk Dialing Rules and the Outbound Route Dial Patterns. For example, for U.K. calls, the trunk rule would be 0044. and the outbound dial pattern would be 88|0044.! Dont’ forget the trailing period at the end of both of these entries. Enjoy!

    The Bait and Switch Begins. Well, it didn’t take long. It’s been a day, and Mexico already has disappeared from the free list. It’s now 6¢ a minute. That’s 40%-500% more than Voxee.com depending upon the city you call in Mexico. We’ll keep you posted with new "developments" each week. In the meantime, talk fast and check for current rates before you dial. This is going to be fun!


    Adding Automatic Callbacks to Your Asterisk Voice Mail System. Don’t you just love those Baby Bell phone messages that say "Press 1 and, for a charge of 75¢, we will place this call for you"? Well, now you can add similar functionality to your Asterisk Voicemail System minus the 75¢ charge. Sometimes it’s a lot more convenient to have the computer do the dialing after you’ve listened to a voicemail message particularly when you’re zipping down the highway at warp speed. To add the functionality to Asterisk using the Asterisk Management Panel (AMP) or freePBX, here’s how. Open the settings for the voicemail extension you wish to configure with this option: Settings->Extensions->ext#. Now scroll down to the vm options field and add the following: callback=from-internal. Save your changes and click the big Red Bar to update Asterisk. In the future, when you listen to a voicemail message on this extension and want to automatically return the call, choose 3 for Advanced Options and then 2 to Return the Call. Just be sure your Default Asterisk Outbound Route is configured to dial using the same number format as your received CallerID numbers, and you’re all set. And, by the way, this works with Asterisk@Home versions at least as far back as 1.5. Too bad no one ever bothered to document it. Very slick!


    Nerd Vittles User 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." The map still isn’t quite representative of where all of our visitors are coming from, but we’re getting there. Give it another week or two. Finally, 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. We’ll check it out one of these days.

    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.

    Coming Attractions. By the end of this summer, we’ll be ready to begin tackling some of the Asterisk hardware cards including the new Sangoma cards and the soon-to-be-released Digium cards. All of these new cards now support hardware echo cancellation. There’s just one catch: we don’t have any. If you’d like to make a small contribution to assist with the project, just click on the donate button in the top right corner of the main page. When the kitty grows sufficiently to fund the cards, we’ll begin our in-depth tutorials to assist everyone in making the right hardware choices. And, by the way, we’re not talking about huge individual donations. We’d much prefer 200 people donating $5 each rather than Bill Gates coughing up $1,000. But, heck, whatever works to get the hardware funded.

    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!


    Some Recent Nerd Vittles Articles of Interest…

    Upgrading Asterisk@Home 2.7 to Asterisk 1.2.6: Here’s How

    When you finish the Asterisk@Home 2.7 install and the yum updates for CentOS/4, you now are ready to load the latest, greatest version of Asterisk®: version 1.2.6. Here’s how. Make a backup of your system FIRST! Log in to your new Asterisk server as root, or better yet, use SSH to log in as root, and then cut and paste each command below in order. Be advised that, if you’re using Asterisk@Home, this update will break faxing capability and MP3 support built into the AAH bundle. But your phones will still ring! If you’re at all nervous about proceeding, don’t. Instead, you may wish to try your luck with yesterday’s release of Asterisk@Home 2.8 Beta 1 incorporating these updates … and much, much more. For Pioneers that opt to go the beta route, you may wish to refer back to our AAH 2.7 installation instructions as well as the 50 or so comments from the early adopters.

    Why update at all? Well, there are lots of reasons. Here’s the list. And there are loads of zaptel improvements as well. And AAH 2.8 brings a new version of CentOS (4.3), the latest release of SugarCRM with the Asterisk plug-in, and integrated support for freePBX, the next generation of the Asterisk Management Portal (AMP). If faxing is a critical requirement for you, be advised that either approach outlined here will probably break fax capabilities for the short term. One simple, short-term faxing solution is to sign up for a free fax number at faxdigits.com which we covered earlier this week. You can’t beat free!

    Upgrading to Asterisk 1.2.6.

    amportal stop

    cd /usr/src
    wget http://ftp.digium.com/pub/telephony/zaptel/zaptel-1.2.5.tar.gz
    wget http://ftp.digium.com/pub/telephony/libpri/libpri-1.2.2.tar.gz
    wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-1.2.6.tar.gz
    wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-addons-1.2.2.tar.gz
    wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-sounds-1.2.1.tar.gz

    tar -zxvf zaptel-1.2.5.tar.gz
    tar -zxvf libpri-1.2.2.tar.gz
    tar -zxvf asterisk-1.2.6.tar.gz
    tar -zxvf asterisk-addons-1.2.2.tar.gz
    tar -zxvf asterisk-sounds-1.2.1.tar.gz

    cd zaptel-1.2.5
    make clean
    make install
    cd ..

    cd libpri-1.2.2
    make clean
    make install
    cd ..

    cd asterisk-1.2.6
    make clean
    make install
    cd ..

    cd asterisk-addons-1.2.2
    make clean
    make install
    cd ..

    cd asterisk-sounds-1.2.1
    make clean
    make install
    cd /root

    amportal start


    Free Asterisk Calling Returns to the VoIP Wild West. Coming next Wednesday, April 5, don’t miss the latest Nerd Vittles discovery: a VoIP provider with unlimited FREE CALLS TO 52 COUNTRIES including all of the U.S., Canada, and Mexico as well as most of South America, Europe, and the Far East. And calls to Costa Rica and some of our other favorite island getaways are about a penny a minute. Works great with Asterisk, too! And, speaking of island getaways, we’re off to Pawleys Island today for a little R&R. Visit our Pawleys Island WebCam (which I promise will have live pictures by tomorrow!) and catch a wave!

    Nerd Vittles User 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." The map still isn’t quite representative of where all of our visitors are coming from, but we’re getting there. Give it another week or two. Finally, 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. We’ll check it out one of these days.

    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.

    Coming Attractions. By the end of this summer, we’ll be ready to begin tackling some of the Asterisk hardware cards including the new Sangoma cards and the soon-to-be-released Digium cards. All of these new cards now support hardware echo cancellation. There’s just one catch: we don’t have any. If you’d like to make a small contribution to assist with the project, just click on the donate button in the top right corner of the main page. When the kitty grows sufficiently to fund the cards, we’ll begin our in-depth tutorials to assist everyone in making the right hardware choices. And, by the way, we’re not talking about huge individual donations. We’d much prefer 200 people donating $5 each rather than Bill Gates coughing up $1,000. But, heck, whatever works to get the hardware funded.

    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!

    Don’t Guess Who’s Coming to Dinner: Use Asterisk

    With apologies to Sidney Poitier, yes, even your doorbell can now be part of your Asterisk® system. And it probably should. Kevin Flanagan and his wife run a ski lodge in Mt. Washington Valley, New Hampshire. For baseball fans, you’ll be interested in knowing that Babe Ruth spent a lot of time hanging out in Room #2 at the Cranmore Mountain Lodge primarily because his daughter owned it in the 1940’s. Anyway, Kevin wrote us about his DOORBELL several months ago, and we’ve been chomping at the bit to publish his article but were just waiting for a lull in the Asterisk updates. I hate to even say that for fear that Asterisk@Home 2.8 will hit the street in the morning. [Footnote: Guess what? It did!] So, today, we’re going to show you how to hook up your doorbell to Asterisk. And, we’ll throw in an intercom as well. When someone rings your doorbell, they’ll get music on hold or a prerecorded announcement while your phones go crazy!

    The product that makes all of this work is DoorBell Fon. You’ll need the controller and at least one Door Box, available now in white, ivory, or brass. Home Depot has this equipment as well if you prefer to window shop first. You connect the Door Box to the Controller using the existing doorbell wires. Then you add a cheap X100P card to your free Asterisk system and connect it to the controller. Check out eBay for the cheapest X100P deals. Next you adjust the zapata-auto.conf file in /etc/asterisk to point to a custom context to answer incoming calls from the Door Box. And finally, you set up a custom Call Queue to manage the incoming door bell rings. Once you have the equipment, it’s about a 60 minute project assuming you have an easy way to get a phone cord between your controller and your Asterisk system. Total cost: about $200-$250 depending upon the Door Box you select. Kevin’s step-by-step guide in PDF format can be downloaded here. Terrific idea, and thanks for sharing it with all of us, Kevin.


    Google PhoneBook CallerID Update. For those already using Google phonebook CallerID lookups which were part of our Enhanced CallerID System for Asterisk, there is an update to fix a change in the way Google displays phonebook results. Just execute the following commands after logging in as root on your Asterisk server to update your system:

    cd /var/lib/asterisk/agi-bin
    mv calleridname.agi calleridname.agi.old
    wget http://nerdvittles.com/wp-content/calleridname.agi
    chown asterisk:asterisk calleridname.agi
    chmod 775 calleridname.agi

    You’ll also need to reconfigure the settings in the script following the original instructions once you complete the download. Then try this slick trick.


    Another Provider With Free DIDs and Free Incoming Fax Numbers. There’s another new kid in town. FreeDigits.com not only offers free incoming DID’s in area code 515. That’s beautiful, downtown Des Moines, Iowa if you’re curious. You also get unlimited free incoming minutes with your free DID, unlimited free calls to other FreeDigits subscribers anywhere in the world, and 60 free outbound minutes to try out their service. And you can get a free incoming fax number, too. All of your incoming faxes will be delivered as PDF documents to your email account without tying up your phone line.

    For your VoIP calls, you can add another DID in your favorite area code or an 800 number for $4.95 a month. Inbound 800 number calls are 5¢ a minute (about double what we’ve paid for at least the last 10 years) and outbound calls in the U.S. and most of Canada are 3¢ a minute after you use up your freebies. That’s about three times the cost of voxee.com. International rates also are about triple those of voxee.com, but you can’t beat the free DID offer with free incoming calls. And the free number for incoming faxes is the only free service of its kind still remaining on the planet.

    Here’s the Asterisk SIP trunk setup that worked for us. Use AMP to create a new SIP trunk with freedigits as your trunk name and the following PEER Details using yourphonenumber and yourpassword as assigned by FreeDigits:


    canreinvite=no
    context=from-sip-external
    dtmfmode=rfc2833
    fromdomain=freedigits.net
    fromuser=yourphonenumber
    host=freedigits.net
    insecure=invite,port
    nat=yes
    secret=yourpassword
    type=friend
    username=yourphonenumber

    Leave the Incoming Settings blank, and enter your registration string in this format: yourphonenumber:yourpassword@freedigits.net. Sounds great! Works great!


    Nerd Vittles User 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." The map still isn’t quite representative of where all of our visitors are coming from, but we’re getting there. Give it another week or two. Finally, 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. We’ll check it out one of these days.


    Some Recent Nerd Vittles Articles of Interest…

    A Marriage Made in Heaven: Sprint Cellphone + Asterisk@Home = Unlimited U.S. Cell Phone Calls for $5

    Last week Sprint announced the availability (beginning today!) of a new add-on for existing and new Sprint cellphone customers. For $5 more a month and a little Yankee ingenuity, you now can make unlimited FREE calls between your Sprint cellphone (or multiple PCS phones if you’re on a shared plan) and your residential phone number regardless of the wireline carrier. In short, your home phone service need not be with Sprint. If you have Sprint home phone service, then the new PCS to Home service will be free. In either case, no cellphone minutes will be assessed for inbound (read comments!) or outbound calls between your Sprint cellphone and your home number … ever. In fact, they’ll show up on your statement as PCS-to-PCS calls which are also free.

    For Sprint business customers with a business plan of $50 or higher a month (that’s easy!), you can do the same thing with your business landline for $8 a month instead of $5. Later this year Sprint reportedly will offer business customers the opportunity to expand the plan to up to 30,000 business DID’s. Here’s a link to Sprint’s web site with a comprehensive FAQ and details on how to order the new PCS to Home service. Be aware that this is a new Sprint feature, and you now know more about it than most Sprint reps … so let the torture begin. The first rep we got indicated that it was $5 per PCS phone even on residential shared calling plans. The FAQ on the web site says otherwise, and you’ll probably need to walk them through it or ask for a supervisor.

    You might be asking what all this has to do with Asterisk®. Well, plenty! Some of our regular readers no doubt have already figured it all out. For the neophytes, here’s today’s lesson. Connect your home phone line to your Asterisk server with a Sipura SPA-3000 (click here for our tutorial on how to do it). Better yet, switch your home phone line to a VoIP BYOD Plan (see below) and save a bundle. Next, add a little code (which we’ll get to shortly) to extensions_custom.conf to answer incoming calls from your cellphone to your PSTN line, provide DISA dialtone to make an outbound call, and PRESTO! You now can phone home with your Sprint cellphone by pressing a single pre-programmed button on your phone and make outbound calls to anywhere in the U.S. through your home VoIP service without eating up a single cellphone minute on your plan. Your Asterisk system will answer on the first ring and give you dialtone to make the call. It’s that easy!

    Sprint PCS Residential Plan Costs. Here’s the math. A basic Sprint cellphone plan: $35. Sprint to Home service: $5. TelaSIP’s unlimited US48 VoIP calls: $15 a month. Home phone number transferred to BYOD plan at BroadVoice (here’s how) or AxVoice (here’s how) for unlimited incoming calls: $9. Unlimited nationwide Sprint cellphone calls: Priceless … and FREE. Total cost for residential home and cellphone service with unlimited nationwide calling: $64 a month plus about $4 in Sprint add-on fees. Remember this gets you unlimited nationwide calling BOTH from your cellphone and your home phones. And you can convert the BroadVoice BYOD plan to an all-purpose second line within your entire state for $4 more a month. This also provides some redundancy when one of your VoIP providers has problems. It happens! — Forrest Gump


    Sprint PCS Business Plan Costs. A basic Sprint PCS business plan cellphone: $50. Sprint to Home Office service: $8. Penny-a-minute calls through voxee.com. Unlimited nationwide Sprint cellphone calls: 1.1¢ per minute. Local business line from Ma Bell Jr.: $50. Total cost: $108 a month plus tip and taxes and 1.1¢ per minute in 6-second billing increments.

    It’s Not the NFL, But There Is A $25 Signing Bonus. So today your mission is to sign up for a Sprint PCS phone if you don’t already have one. Then sign up for the new PCS to Home service. Now we’ll show you how to hook everything up and begin enjoying unlimited cellphone calls with no per minute charges … ever. Just do us both a favor. If you sign up for new Sprint service, email us your new Sprint phone number the day after your service is activated. With Sprint’s Referral Program, we’ll both receive a free $25 debit card. Doesn’t get much easier than that to earn free bucks. And, if you tell us, we’ll keep your email address on file and pass along other user’s phone numbers for you to claim some referral credits if there are sufficient new subscribers to pass around once we exhaust our authorized dozen referrals for the year. Can’t help it. WE LOVE SPIFFS!

    Prerequisites. Before we get started, here’s what you should have already done. Yes, you need a Sprint PCS phone with PCS to Home service. And we’re assuming you’ve already set up your Asterisk@Home server with an SPA-3000 connecting your home phone line as well as a working VoIP trunk (SIP or IAX2) from TelaSIP or some other provider. TelaSIP setup instructions are available here. Instead of an SPA-3000, you can use a $10-$20 OEM version of Digium’s WildCard X100P PCI card to connect your home PSTN line, but read this first. You get what you pay for!

    Overview. Our Asterisk design to get this working goes like this. We’ll create a custom-disa context to manage our incoming calls from the Sprint cellphone. Then we’ll intercept all of your incoming calls and route them to this context to check and see if it’s a call from your Sprint cellphone. If it is, we’ll use a dialplan with the specific Sprint phone number to activate DISA and a dialtone for the caller. If it isn’t a call from your Sprint cellphone, we’ll pass it on to your default Incoming Call dialplan. If you’re using our Stealth AutoAttendant, you’d basically route calls which aren’t from your Sprint cellphone to the autoattendant. Otherwise, you let the custom-disa context process the call.

    Building the custom-disa Dialplan. Using the Asterisk Management Panel (AMP) from your web browser pointed to the IP address of your Asterisk server, choose AMP->Maintenance->Config Edit->extensions_custom. Move to the bottom of the file and insert the following code:

    [custom-disa]
    exten => 6781234567,1,Answer
    exten => 6781234567,2,Wait(1)
    exten => 6781234567,3,Authenticate(123)
    exten => 6781234567,4,DISA(no-password|from-internal)
    exten => i,1,Goto(from-pstn-timecheck,s,1)

    Replace 6781234567 in each of the four lines above with your Sprint phone number. If the little Mrs. has a Sprint phone, too, duplicate the first four lines and enter the next Sprint phone number for each of the four lines you added. Then renumber all of the lines so that they’re unique, i.e. 1,2,3,4 becomes 1,2,3,4,5,6,7,8. Replace the 123 password in each of the Authenticate lines with whatever you wish to use. Remember that it’s very easy to spoof CallerID numbers so you probably do want a password so you don’t sell the farm. If you prefer to live dangerously, delete the Authenticate lines and renumber. IT’S YOUR PHONE BILL! If you take out the Authenticate line, then you’ll get an immediate dialtone whenever you phone home from your Sprint cellphone. The exten=>i entry in the dialplan handles all the incoming calls that don’t match any Sprint phone number that you’ve entered in this context. So, if someone calls you from the White House (2024561414), the i entry in the custom-disa dialplan would process the call and send G.W. to your standard Incoming Calls context. Save your entries when you finish by clicking the Update button.

    Rerouting Incoming Calls to custom-disa. There are two places we need to adjust to reroute incoming calls to the custom-disa context we just built. Using AMP again, edit the from-sip-external context in the extensions.conf file: AMP->Maintenance->Config Edit->extensions.conf->from-sip-external. Comment out all the existing lines with a leading semicolon. Now add the following new line and then click the Update button:

    exten => _X.,1,Goto(custom-disa,${CALLERIDNUM},1)

    Now edit or create an Incoming Route for your home phone number using your real number instead of 6781234567: AMP->Setup->Inbound Routing. Click the Submit Changes button when you finish and then click the Red Bar to reload Asterisk.

  • DID Number: 6781234567
  • Caller ID Number: 6781234567
  • FAX Extension: AMP default
  • FAX Email: blank
  • Immediate Answer: No
  • Pause After Answer: 0
  • Privacy Manager: No
  • Destination: Custom App custom-disa,6781234567,1
  • Testing Our Masterpiece. We need to make two calls to be sure things are working properly. First, store your home phone number in your Sprint cellphone so you can push one button to phone home. Now place a call to your home phone number from your Sprint cell phone. When prompted for your password, enter it and then make your first free call. Second, place a call to your home phone number from some other phone that is not specified in [custom-disa]. This call will be routed to your default incoming call handler or autoattendant. Enjoy!

    Free Samples. Everybody loves free samples. Not sure about TelaSIP, you say. Well, take it for a test drive. Just call our Charleston number (shown in the inset) and wait for the fast busy to hang up. There’s no charge for the call because you’re never "connected." Within 15 seconds you’ll get a return call allowing you to make a FREE 10-minute phone call to almost anywhere in the U.S. All you have to do is key in the password you’re provided when you answer the return call. Keep in mind a few things. You have to call from a phone with CallerID so that we know where to call you back. Both legs of the call (to you and to the person you call) use GSM compression so you’re seeing TelaSIP at its most efficient but not necessarily with the best voice quality. You can set it differently on your own system if you like. And one final note. TelaSIP’s web site doesn’t rate as the fanciest on the planet, but they do have great VoIP phone service at rock bottom prices. And that’s what this drill is all about. But, if you’re still not sold on TelaSIP, check out our other VoIP Provider Reviews.

    Quick Tip. Here’s a final little trick. When you set up your TelaSIP account, tell Gene that you’d like your account set up on gw4.telasip.com so that you can only make calls in the 48 states covered by the free unlimited plan. That’s the way the One Ringy-Dingy service works. Once this is done, it’s pretty safe to remove the password from the DISA script which saves some dialing when making outbound calls from your cellphone. Then it’s just a matter of watching your call logs (AMP->Reports) regularly to make sure no one is spoofing your CallerID number to take advantage of free calling from your server. In short, free calls won’t hurt you financially, and it will take a pretty bright creep to figure out your cellphone number, your home phone number, and to know that you’ve got Asterisk configured to do this in the first place. HINT: Don’t brag about it! In reviewing the logs, if you see someone is spoofing your CallerID number and regularly making calls to places you don’t recognize, then you can always reinstate the DISA password step in your dialplan.


    A Word About Web Hosting Providers. You’ve no doubt seen the BlueHost ads on our site lately. And, as many of you know, we don’t advertise things we don’t believe in. We switched hosting providers for Nerd Vittles about a month ago. So let me just say BlueHost Rocks! If you’ve ever thought about building your own web site either for your business or for your family, do it right with the very best tools, servers, bandwidth, and price. BlueHost has all of that plus a special ingredient that really sets them apart: nice people. Read their ad if you want technical details. But let us save you hundreds of hours and hundreds of dollars comparing literally thousands of providers hoping to find just the right one. You can’t and won’t go wrong with BlueHost. Yes, we’ll be living it up Friday night if you sign up through our spiffy ad links. But, if vendor commissions bother you, go to their web site and sign up directly. It won’t hurt our feelings a bit. They’re that good! And you can get every dime back within 30 days if you’re not a happy camper. They say that professionalism is contagious in an organization. Have a look at the BlueHost CEO’s blog, sign up, and judge for yourself. You won’t be sorry.


    Another Move in the Works. Not to bore you with personal stuff, but … we had so much fun moving Nerd Vittles last month that we’ve decided to move the entire Mundy clan to the Charleston, South Carolina area. As a former Army brat, I was accustomed to annual moves, but we’ve called Atlanta home since the dawn of the PC era 25 years ago. So this one’s a little tougher. But the move gets us closer to my big girls, a great school for our little girl, an hour from the beach house, and an incredible neighborhood that was built the way all neighborhoods should be. Between now and June 1, we have three home closings and lots of packing and downsizing to do. And the Nerd Vittles articles may become (more) sporadic for a bit. But hang in there. We’ll keep our sense of humor, and one day soon everything will get back to normal … whatever that is.

    Nerd Vittles User Map. Nerd Vittles now supports well over 5,000 visitors a day. Two-thirds of you still use Windows. Try this! Over 1,000 a day find us in a Google search result. And about a third of you hang around for over an hour each visit. Wow! Who woulda thunk Asterisk and little Nerd Vittles could grow this big this fast. THANKS for visiting! We hope you’ll take a second and add yourself to our Frappr World Map compliments of Google. Australians and New Zealanders, don’t be shy! 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." The map still isn’t quite representative of where all of our visitors are coming from, but we’re getting there. Give it another week or two. Finally, 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. We’ll check it out one of these days.


    Some Recent Nerd Vittles Articles of Interest…