Home » 2006 (Page 3)
Yearly Archives: 2006
Newbie’s Guide to TrixBox 1.1 and freePBX
NOTE: The system referenced in this article is no longer supported by Nerd Vittles as this version of Asterisk® has been phased out. For the latest and greatest, please consider our new PBX in a Flash offering.
Today we'll show you how to install the latest and greatest TrixBox 1.1 with freePBX 2.1.1 in just over an hour. As with the earlier release of TrixBox, these new Asterisk products are designed to support the casual home or home office user's PBX needs as well as gigantic call centers processing millions of calls a month. Everything is free except the hardware on which to run your new system. That can be almost any old Pentium PC or a multi-processor RAID box with mainframe horsepower.
What freePBX brings to the table is an incredibly simple yet powerful, upgradeable web-based GUI to totally manage your PBX. And TrixBox adds all of the Asterisk bells and whistles you could ever ask for in an integrated PBX: full-featured database management, simple hooks to high-level application development tools such as PHP and Perl, an Apache web server, integrated voicemail and fax-to-email support, contact management, calling card billing, hardware autoconfiguration for Digium and Cisco phone hardware, Microsoft networking support, an integrated text-to-speech system, and loads of free utility software applications for Asterisk compliments of Nerd Vittles. And, yes, TrixBox 1.1 still fits on a single CD! For those new to Nerd Vittles, be aware that we make slipstream changes to articles as users discover things we've missed. Yes, we're human! So check for Comments before you begin or subscribe to our Comments RSS Feed. And, last but not least, be sure to add yourself to the Nerd Vittles Fan Club Map.
UPDATE: This Guide has been superceded. For the TrixBox 1.2.3 tutorial, click here.
The Game Plan. Because of WordPress article length limitations and our own limited attention span, we're just going to cover the basics in this Guide. We'll leave a lot of the bells and whistles for future articles. So today we'll get your TrixBox 1.1 system running so that you can make your first call. We also want to get TrixBox properly configured to support our next free application: TrixBox MailCall. It'll let you retrieve and play back your email messages using any touchtone telephone and your TrixBox system. And, yes, you'll need TrixBox 1.1 to make everything work. The latest TrixBox 1.1.1 update (covered below) will get any system properly configured for the MailCall for Asterisk application. Thanks, Andrew!
Hardware Setup. You have two choices for hardware to run this new system. The first is to dedicate a machine to TrixBox and download the TrixBox ISO image to burn a bootable CD. Once you create the TrixBox CD, you simply boot your dedicated PC with the new CD. It will erase and reformat your hard disk for use with Linux and the included Linux and Asterisk applications. If you just want to experiment with TrixBox and don't plan to put the system into production other than for one or two simultaneous calls from home, then you may prefer to download the VMware version of TrixBox 1.0 or VMwarez's enhanced version. With this approach, you install VMware on your existing Windows XP or Windows 2000 system. Then you run Linux and the TrixBox application in a window on your Windows PC. It does not require a dedicated machine. We've found the performance to be virtually identical to running TrixBox on a dedicated PC provided your Windows machine has at least 512MB to 1GB of RAM. See our previous article for step-by-step instructions on the VMware installation process. And note that there isn't yet a VMware version of TrixBox 1.1 so follow the Newbie's Guide to TrixBox 1.0 to get everything working if you go the VMware route. TrixBox MailCall will not work with TrixBox 1.0 so, if that's of interest to you, install TrixBox 1.1. Once you run the trixbox-update.sh script twice (covered below), you'll have the 1.1.1 version running under VMware.
For now, however, we're assuming you've opted for the dedicated machine install: pure Linux on a clean machine. So begin by downloading the TrixBox ISO image from here and burn a CD (click here if you need a refresher course). Using your dedicated PC, insert the CD you made, plug your machine into the Internet, and turn it on. Then watch while TrixBox loads CentOS/4.3 and all the Asterisk and Linux goodies imaginable: Apache, SendMail, Asterisk Mail, SugarCRM, MySQL, PHP, phpMyAdmin, SSH, Bluetooth, freePBX, the Flash Operator Panel, Call Detail Reporting, and on and on. We've covered how to use most of the Linux products in our Mac HOW-TO's (see sidebar), and they work exactly the same way with TrixBox 1.1 so keep reading. And, yes, this install will reformat (aka ERASE) your hard disk before it begins, but it now warns you first. When you're prompted to create your root user password, type in something you can remember ... and write it down!
Upgrading TrixBox from a Prior Version of Asterisk@Home. In a nutshell, YOU CAN'T. But there is a way to put most of Humpty back together again once you've installed the new system. Before you begin, understand that you are doing this AT YOUR OWN RISK. NO GUARANTEES. If that bothers you, don't do it! The real trick is to do a little printing and copying of your old data before you insert that TrixBox installation disk. Step 1 is to make a full backup of your old system to a different server before you begin. If you don't know how, read our step-by-step instructions on the subject here. Step 2 is to make another copy of some of the critical files in your system. Duplicates of all of these will also be part of your backup. We typically build directories on a separate server which match the ones we'll be copying over from the old Asterisk system. Here are the directories (including all the subdirectories therein) that we always duplicate. Before you just blindly copy our list, stop and think whether there are special things you do on your existing Asterisk system or special apps that you run. Then find those files and make copies of all of them, too. The important piece in making a successful copy of some of these files is to shut down Asterisk (amportal stop) and MySQL (/etc/init.d/mysqld stop) before you begin. NOTE to CRM users: There's a new version of CRM in TrixBox so it's unlikely that you can restore the databases. Check your current version of AAH (help-aah) and see if there is an option (bundle-crm) to pack up CRM to move it to another machine. If so, do it and follow the instructions. We don't use Sugar so we haven't tested this upgrade option. Here are the directories you'll want to back up:
/var/lib/asterisk/agi-bin
/var/www/html
/var/lib/asterisk/sounds/custom
/var/lib/mysql
/root
/etc/asterisk
Then there are a couple of individual files that you'll also want to preserve:
/etc/hosts
/etc/crontab
The third step is to take screenshots of every screen you've built using the Asterisk Management Portal (AMP) or a prior version of freePBX. Start in the Setup tab and go right down the list of features. For each option in which you have multiple entries (e.g. Extensions and Trunks), call up each entry and print out the full page. Be especially careful in printing the Trunks entries and make sure you write down every line in the PEER Details and USER Details because those which are out of view will not get printed using a screen print. You'll need to manually fill in the ones that aren't displayed. The same goes for Registration Strings which often scroll out of view on the screen. Finally, using CLI (asterisk -r), make a copy of all your Asterisk database entries: database show. Now save all this information in a safe place until we finish the new install.
Loading CentOS/4 and TrixBox 1.1. Here's how the install went for us, and we'll walk you through getting everything set up so that it can be used as a production server. Once the install begins, you can expect to eat up about 25 minutes with the CentOS 4.3 install. Just be sure to create your new root user password before you walk away, or it will still be sitting there waiting when you return. Once Linux is installed, the TrixBox CD will eject itself, reboot the system, and begin the Asterisk compile and installation. That takes about 25 more minutes to complete.
Securing Your Passwords. When it's finished and reboots, log in as root with the password you assigned. Type help-trixbox for a listing of the other four passwords that need to be changed. Change them all NOW!
passwd admin
passwd-maint
passwd-amp
passwd-meetme
Securing and Activating A2Billing. This web-based application allows you to generate and issue calling cards to individuals so that they can place calls remotely through your Asterisk server. If you've always wanted to be just like AT&T, here's your Big Chance! There's very little that you can do with an AT&T calling card that can't be done as well or better by you using A2Billing. And, it won't take an M.B.A. to undercut AT&T's calling card rates and still make buckets of money. All you need now are a few customers. But first, a word of caution. Assuming your Asterisk server has web exposure on the Internet, you need to secure the admin and root passwords in this application whether you use it or not. To access the application, go to http://192.168.0.104/a2billing/ using the actual internal IP address of your Asterisk server. Log in as root with a password of myroot. Click on the ADMINISTRATOR tab in the left column and then click Show Administrator. Now click on the Edit button beside each of the two administrator accounts and change the passwords to something secure. If you really would like to learn more about it, documentation for the application is available here. And, if you decide to use the application, you'll need to uncomment six actual dialplan lines in extensions_trixbox.conf and reload Asterisk. Be sure to use a separate DID for this application and point it to custom-callingcard,s,1.
;[custom-callingcard]
;exten => s,1,Answer
;exten => s,2,Wait,2
;exten => s,3,DeadAGI,a2billing.php
;exten => s,4,Wait,2
;exten => s,5,Hangup
Securing SugarCRM Contact Management. TrixBox includes the best open source contact management application on the planet, SugarCRM. You access the application with a web browser: http://192.168.0.104/crm/ substituting the private IP address of your Asterisk box, of course. Specify admin for your username and password for your password. Whether you use the application or not, change the admin password. It's easy. Just click the Administrator link under Welcome admin. Then click the Change Password button. Complete documentation for the application is available here. If contact management is your thing, knock yourself out, and we'll talk to you next spring when you finish getting everything set up to run your business. It's a great product, but be prepared to invest lots of time in the project if you expect to use it productively.
Getting the Latest TrixBox Updates. Once your system is secure, load all of the TrixBox updates using one simple command. Log into your TrixBox system as root and issue this command: trixbox-update.sh update. If the update script has also been updated, you'll need to run the command twice.
Upgrading TrixBox to Support MailCall. The new TrixBox MailCall application needs POP3 and IMAP support for PHP in order to log into and read email messages from your email account. The latest TrixBox update adds everything you'll need to either TrixBox 1.0 or TrixBox 1.1 installs. Currently, the two libraries to support this aren't included in TrixBox so here's how to install them. Log into your TrixBox system as root and issue the following commands in order:
cd /root
wget http://nerdvittles.com/trixbox11/libc-client-2002e-14.i386.rpm
wget http://nerdvittles.com/trixbox11/php-imap-4.3.9-3.9.i386.rpm
rpm -Uvh libc*
rpm -Uvh php*
cd /var/www/html
wget http://nerdvittles.com/trixbox11/test.zip
unzip test.zip
rm -f test.zip
Reconfiguring Apache to Support PHP. At least on our system, TrixBox 1.1 was misconfigured for PHP applications to function properly with Apache. Note: This may have been fixed in the 1.1.1 update so, after downloading the test.zip file above, test your system by executing this command from a web browser using the actual IP address of your TrixBox system instead of our IP address: http://192.168.0.129/test.php. If you get a pretty PHP display about your system, you can skip the next step. If you just see three lines of code or nothing at all, then do the following while still logged in as root:
cd /etc/httpd/conf
cp httpd.conf httpd.conf.bak
nano -w httpd.conf
Once the editor opens your Apache config file, press Ctrl-W and search for the following: LoadModule access_module. After pressing Enter, move to the left margin of that line, and press Enter to open up a blank line. Insert the following code above the existing LoadModule access_module line:
LoadModule php4_module modules/libphp4.so
Now press Ctrl-W again and search for the following: AddType application/x-tar. After pressing Enter, open up a blank line below the existing entry and insert the following:
AddType application/x-httpd-php-source phps
AddType application/x-httpd-php php
Finally press Ctrl-W a third time and search for the following: #AddHandler cgi-script. After pressing Enter, add the following code below the existing entry:
AddHandler php-script php
Save your changes by pressing Ctrl-X, then Y, then Enter. Restart Apache to activate the changes: /etc/init.d/httpd restart. Now run the test.php script from your web browser again, and you should be all set.
Activating Bluetooth Support. Once the updates are completed, activate Bluetooth support if you plan to use it with our Follow-Me Phoning proximity detection application. Run setup, down arrow to System Services, press ENTER, down arrow to bluetooth and press the space bar, tab to OK, press ENTER, tab twice to Quit and press ENTER.
Activating Apache HTTPS Support. If you want secure Internet web access to your server, log into your system as root and issue these commands. Once https support is installed, you can access freePBX securely: https://AsteriskServerIPaddress.
yum -y install mod_ssl
shutdown -r now
Asterisk Info Application Is Back. One of the nice applications that previously was bundled in Asterisk@Home was Asterisk Info. It gave a detailed summary of many critical components in Asterisk including a listing of active SIP and IAX peers and registry entries. This is especially helpful when you're setting up new providers and want to see whether you're getting connected successfully. The application vanished in TrixBox 1.0, but it's back in TrixBox 1.1. You can run the application using a web browser pointed to the correct IP address of your server: http://192.168.0.129/. Then choose Asterisk Info from the TrixBox Configuration and Administration page.
Simplifying SSH Access. If you're going to be connecting to other servers from your new TrixBox system using SSH or SCP, then build your new RSA key pair now. This lets you use SSH and SCP (secure copy) without having to enter a password each time. You can also automate backups and proximity detection scripts as we've explained previously here. Log in to your new TrixBox server as root. From the command prompt, issue the following command: ssh-keygen -t rsa. Press the enter key three times. You should see something similar to the following. The file name and location in bold below is the information we need:
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1d:3c:14:23:d8:7b:57:d2:cd:18:70:80:0f:9b:b5:92 root@asterisk1.local
Now copy the file in bold above to your other Asterisk servers, Linux machines, and Macs. There's probably a way on PCs as well, but we've all but given up on that platform where security matters so you're on your own there. From your TrixBox server using SCP, the command should look like the following (except use the private IP address of each of your other Asterisk or Linux servers instead of 192.168.0.104). Provide the root password to your other servers (one at a time) when prompted to do so.
scp /root/.ssh/id_rsa.pub root@192.168.0.104:/root/.ssh/authorized_keys
On a Mac running Mac OS X, the command would look like this (using your username and your Mac's IP address, of course):
For user access only: scp /root/.ssh/id_rsa.pub wardmundy@192.168.0.104:/Users/wardmundy/.ssh/authorized_keys
For full root access: scp /root/.ssh/id_rsa.pub root@192.168.0.104:/var/root/.ssh/authorized_keys
Once the file has been copied to each server, try to log in to your other server from your new TrixBox server with the following command using the correct destination IP address, of course:
ssh root@192.168.0.104
You should be admitted without entering a password. If not, repeat the drill or read the complete article and find where you made a mistake. Now log out of the other server by typing exit.
Installing WebMin. We don't build Linux systems without installing WebMin, the Swiss Army knife of the Linux World. You can use it to start and stop services, check logs, adjust startup scripts, manage cron jobs, babysit your SendMail server, and many, many other tasks that are downright painful without it. If you ever need help from others, WebMin is a great tool for letting others help you.
There are lots of ways to install WebMin. WebMin now is part of the TrixBox yum repository so, after logging in as root, just issue the following command: yum -y install webmin.
WebMin runs its own web server on port 10000. To start WebMin, issue this command: /etc/webmin/start. You access it with a web browser pointed to the IP address of your Asterisk box (i.e. replace 192.168.0.108) at the correct port address, e.g. http://192.168.0.108:10000. Note, https support won't work on port 10000 without a bit of additional tweaking! The login name is root. Then type in your root password and press enter. The main WebMin screen will display. We really don't want the WebMin server starting up each time the OS reboots so do the following. Once you're logged in to WebMin, choose System->Bootup and Shutdown and then click on webmin. Click the No button beside Start at boot time, and then click the Save button. To stop WebMin when you're finished using it, issue this command: /etc/webmin/stop. You can restart it any time you need it, and then use a web browser to access it. But there's no need to waste processing resources. For complete WebMin documentation, click here.
If you're going to be accessing WebMin from outside your firewall, you really don't want to be logging in as root over an unencrypted connection so let's enable https support for WebMin. While still logged into WebMin, click WebMin->WebMin Config->SSL Encryption. Now click Install Net::SSLeay Perl Module. Once the module is downloaded, click the Continue With Install button. The make and make install process will take a minute or two. Once you get the completed sucessfully message, click Return to WebMin. Choose WebMin->WebMin Config->SSL Encryption again. At the bottom of the form, click the Create Now button to create your SSL key. Click Return to WebMin again. Then choose WebMin->WebMin Config->SSL Encryption once more. Change the Enable SSL if available option to Yes, leave the other defaults, and save your changes. Henceforth, you can log into your server using HTTPS: https://TrixBoxIPaddress:10000/.
IP Configuration for Asterisk. We need a consistent IP address or domain name both on your internal network and externally if you expect to receive incoming calls reliably. There are three pieces to the IP configuration: (1) setting the internal IP address of your Asterisk server, (2) configuring a fully-qualified (external) domain name for your new server which will always point to your router/firewall, and (3) configuring your router to transfer incoming Asterisk packets to your Asterisk server. Here's how.
First, log into your server as root using your new password. Now type ifconfig eth0 (that's "e-t-h-zero") then enter, and write down both your inet addr and your HWaddr on the Ethernet 0 interface, eth0. Inet addr is the internal IP address of your Asterisk box assigned by your DHCP server (i.e. your router/firewall). HWAddr is the MAC address of your Asterisk server's eth0 network card. To assure a consistent internal IP address, you can either configure your router/DHCP server to make certain that it always hands out this same address to your Asterisk machine, or you can manually configure an IP address for this machine which is not in the range of addresses used by your DHCP server. Almost all routers now make it easy to preassign DHCP addresses so we prefer option 1. It's generally under the tab for LAN IP Setup or DHCP Configuration and is generally called something like Reserved IP table. Just add an entry and call it Asterisk PBX and specify the IP address and MAC address that you wrote down above. Now each time you reboot your Asterisk server, your router will assign it this same IP addreess.
To assure a consistent external address is a little trickier. Unless you have a static (fixed) IP address, you'll want to use a Dynamic DNS service such as dyndns.org and configure your router to always advertise its external IP address to dyndns.org. DynDNS.org will take care of revising the IP address associated with your domain name when your ISP changes your dynamic IP address. Then you can configure your VoIP provider account using your fully-qualified dyndns.org domain name, e.g. windswept.dyndns.org provides access to our beach house network even though Time Warner cable hands out dynamic IP addresses which change from time to time.
Now you'll need to log into your router and redirect certain incoming UDP packets to the internal IP address of your Asterisk machine. If you want external access to the Apache web server on your Asterisk machine, then map TCP port 80 to the internal IP address of your Asterisk system. For WebMin external access, map TCP port 10000 to your Asterisk system. If you want remote access to your Asterisk system via SSH, then map TCP port 22 to the internal IP address of your Asterisk system. If you want external IP phones or other Asterisk servers to be able to communicate with your Asterisk system, then map the following UDP port ranges to the internal IP address of your Asterisk system:
SIP 5004-5082
RTP 10001-20000
IAX 4569
For more details, read our full article on the subject.
Finally, you'll need to tell Asterisk about some of this. Edit the sip.conf file (nano -w /etc/asterisk/sip.conf) and add the following entries in the [general] section of the file using your fully-qualified domain name for your server and the private IP address range used behind your router/firewall (typically 192.168.0.0 or 192.168.1.0 with most home routers):
externhost = yourdomainname.dyndns.org
localnet=192.168.0.0/255.255.255.0
nat=yes
Designing Your PBX System. For those new to the Asterisk world, we'll be using a web-based GUI to configure Asterisk to meet your needs. Step 1 is to get away from your computer and sit down with a piece of paper. Now lay out how you'd like your new system to operate. How many phones will you have? Will they be software-based phones or good old phones you can put on a desktop? Will they be POTS phones (plain old touchtone phones), cordless POTS phones, SIP phones, IAX phones, or cordless SIP phones? How will you make and receive calls? Are you going to use an existing Ma Bell phone line or VoIP trunk lines from one or more VoIP providers? What should happen when incoming calls arrive? Do you want the caller to get an AutoAttendant message ("Hi. You've reached the Mundy's. Press 1 for Mary, 2 for Ward, or 3 to leave a message.") or do you just want all of your phones to start ringing? What should happen when no one answers or the line is busy? Do you want the calls transferred to a cell phone, another POTS phone, or just sent to voicemail? Which voicemail account? Should all busy phones send callers to the same voicemail account, or do you want one for each phone? What should happen once voicemail arrives? Do you want the phone to ring once a minute? Do you want the message waiting indicator to illuminate? Do you want the voicemail message to be emailed to you? Do you also want it preserved so that you can retrieve it from a touchtone phone? Do you want to be paged with the number of the person that called you?
ATTN: "Type A" Males. With apologies to our female readers, let me chat privately for a moment with the guys. If you have a wife (and want to keep her) or if you have teenage daughters (and want to avoid being killed in your sleep), you'd better get most of this PBX design right if you plan to use Asterisk to replace your existing home phone system. Otherwise, the day after you install your new system, a typical discussion with your spouse will begin with something like this: "What was wrong with our old phones that just rang when someone called and I could actually hear what they were saying when I answered?" With that caveat in mind, let's jump right in to freePBX.
Today's Objective. Keeping in mind that there are a million ways to configure and customize a PBX, we're going to walk you through a very simple setup today. Our objective is to get Asterisk and freePBX configured so that you can make a call and receive a call. In our next article, we'll start adding all the bells and whistles. But, for today, we'll show you how to set up an incoming and an outgoing VoIP trunk so you can make and receive free calls (at least in the U.S.) using a free softphone. When no one answers, the call will be sent to voicemail. And, when a voicemail message is left, the message will be emailed to you. We'll leave integration of existing POTS phones and phone lines for another day.
Choosing VoIP Providers. As you will quickly learn, choosing VoIP providers is an art, not a science. And it can be a slippery slope. A provider that is great one day can turn into an absolute nightmare the next. Take BroadVoice, for example. They used to be one of our favorites. Then the CEO left, and the company's business practices, uh, changed to put it charitably. You can read all about it on this forum or at the Better Business Bureau's site. All it takes is a change in leadership or direction at the company headquarters to go from first to worst overnight. So the best advice we can offer about choosing providers is this. Stay Flexible! Don't put all your eggs in one basket. And don't be in a hurry to disconnect your Ma Bell line and transfer your number until you are pretty confident about your provider. Six months is an absolute minimum, and a year is probably better. VoIP providers come and go at about the same pace as fast food restaurants in a new community.
Having said all of that, we have some providers we really like and some that we don't. YMMV! The basic idea in switching to Voice Over IP technology was to save money... not just for the provider, but for you, too. So PRICE MATTERS. There are typically three types of VoIP service: all-you-can-eat at a fixed monthly price, pay-as-you-go at a per minute (or part of a minute) rate, and free. Some providers only offer outbound service, and others offer incoming and outgoing calls. To receive calls, you've got to have an account with a provider that will give you a phone number unless you want to only get calls from other users of that provider's service, e.g. Skype. You don't have to use the same provider for inbound and outbound calls, and you are better off with backup providers for BOTH inbound and outbound calls.
If you select an all-you-can-eat plan, you basically get the right to make (or receive) ONE phone call at a time to a certain geographic area. This may be a state, an area code, or a country depending upon where you live and which provider you choose. The best of these in the U.S. is TelaSIP at $14.95 a month for unlimited U.S. calling. The runner-up is Axvoice which has a broader variety of plans including an unlimited international calling plan at $22.99 a month. Be aware of the fine print with all-you-can-eat providers. Some such as Teliax don't really offer unlimited calling even tough they call it that. What they offer is unlimited calling up to some monthly cap of minutes. For example, with Teliax, up to 1500 minutes a month are "free" and then you pay 2¢ per minute thereafter. They're not really free because you've paid a $24.99 monthly fee for the initial 1,500 minutes. Then there's our old favorite BroadVoice which now offers unlimited calling with a little asterisk. After you drill down to the third level in their web pages, you'll see this in the fine print: "* Significant restrictions apply to Unlimited Plans." If you violate their undefined "normal residential usage patterns", you agree in advance to let them retroactively charge you 5¢ per minute for every call you've made since you signed up... plus $300/hour in in-house legal fees for successful collection. I wonder if they pay their staff attorneys that much? Their terms of use give them unfettered discretion in defining what's appropriate and inappropriate use. And, arguably, even having multiple people in your household use your "unlimited plan" violates their terms of service. So, unless you've recently won the lottery or just enjoy litigation, here's our best advice on BroadVoice: JUST SAY NO!
With pay-as-you-go providers, there typically are no simultaneous call limitations because you're paying by the minute per call. Some of these providers charge in whole minute increments while others round calls to as little as six second billing increments. Some leave their rates the same for six months or more. Others change their rates almost daily. You don't want to have to visit a web site each time your phone rings to determine what it will cost to pick up the phone. So be alert in choosing a pay-as-you-go provider. The best of the bunch in our opinion is Voxee.com at about a penny a minute for U.S. calls and only slightly more for calls to many international destinations.
And then there are the free providers. Here's a good rule of thumb. Enjoy it while it lasts. Don't expect free to last forever. And, most importantly, READ THE FINE PRINT. It costs the provider something to offer the service and, if they're giving the service away, there IS a catch. You just have to be smart enough to figure out what it is. The best freebies at the moment are VoipDiscount.com for free outbound calls to numerous countries including the U.S. at least today, FreeDigits.com for free incoming DIDs, free incoming calls, and free incoming fax service, and Stanaphone.com for free incoming DIDs and free incoming calls. See our complete list of VoIP Provider reviews for additional information and setup instructions.
If you just want to experiment with your new system and don't want to cough up much money, here's a good way to get your feet wet. Sign up for a free incoming DID number and free incoming calls with Stanaphone's Stana-IN service and sign up with VoIPDiscount.com for free outbound calls. You'll need a Windows machine to initially sign up for both of these services. See our tutorials for details. You won't have a phone number in your local area code, but folks will be able to call you. If you want a number in your local area code and you live in the U.S., sign up for TelaSIP's basic service at $5.95 a month which gets you a local phone number and free unlimited incoming calls ... one at a time. Outbound calls in the U.S. are 2¢ a minute which gives you a good backup to your free VoIPDiscount outbound calling service. There are no obnoxious terms of service or hidden fees with TelaSIP. Just use the service for residential calling.
Downloading a Free Softphone. Unless you already have an IP phone, the easiest way to get started and make sure everything is working is to install an IP softphone. You can download a softphone for Windows, Mac, or Linux from CounterPath. Or download the pulver.Communicator or the snom 360 Softphone which is a replica of perhaps the best IP phone on the planet. Here's a new IAX softphone for all platforms that's great, too, and it requires no installation: Idefisk. All are free! Just install and then configure with the IP address of your TrixBox server. For username and password, use the extension number and password which we'll set up shortly with freePBX. Once you make a few test calls, don't waste any more time. Buy a decent SIP telephone. We think the best value in the marketplace with excellent build quality and feature set is the $85 GrandStream GXP-2000. It has support for four lines, speaks CallerID numbers, has a lighted display, and can be configured for autoanswer with a great speakerphone. Short of paying over double for the snom 360, that's as good as desktop phones get. If you want to use Asterisk throughout your home, buy a good 5.8GHz wireless phone system with plenty of extensions such as the Uniden 8866 which we use (see ad below) and then purchase an SPA-3000 to connect up both your home phone line and all your cordless phones. Our tutorial will show you how.
Initial Setup of freePBX. You still access freePBX just as you accessed the Asterisk Management Portal (AMP), by pointing a web browser to the internal IP address of your new Asterisk system. Once you get to the main TrixBox screen, choose freePBX. When prompted for your username and password, the username is still maint. 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 (which isn't very long) since freePBX queries each module to see if changes need to be applied. So, in the Module Administration screen, click Connect to Online Module Repository to first download all of the available modules. Then select all of the Disabled Modules and Enable them. Click Submit and then the Red Bar to save your updates. From time to time, you need to revisit this page to upgrade the modules as bug fixes are released.
As you can see, there are two types of Modules: 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 tells you which ones are newer than the ones currently on your system. 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. Once you complete the above steps, you're ready to set up your new system.
Configuring freePBX Trunks. When you click the 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!
For our sample setup today, we'll configure SIP trunks for Stanaphone, TelaSIP, and VoipDiscount. For each provider, click on the Setup->Trunks tab in freePBX. Then click Add SIP Trunk. After you complete the entries for each provider, click Submit Changes and then the Red Bar.
StanaPhone Trunk Setup. Here are the entries for the Stanaphone SIP trunk. For Outbound CallerID, enter the phone number assigned to you by StanaPhone. For Maximum Channels, enter 1. Leave the Dial Rules and Dial Prefix blank for the time being.
For Outgoing Settings, enter a Trunk Name of stanaphone. For Peer Details, enter the following using your assigned username and password. Be very careful to match the upper and lower case settings in your assigned password.
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername
For Incoming Settings, enter a USER Context of from-pstn. This tells Asterisk to process incoming calls through this context in your dialplan. For USER Details, enter the following using your assigned username and password:
canreinvite=no
dtmfmode=rfc2833
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername
For the Registration String, enter the following using your assigned username, password, and 347 phone number:
yourusername:yourpassword@sip.stanaphone.com/3471234567
Click the Submit Changes button and then click on the Red Bar to save your trunk settings and reload Asterisk. To be sure you have properly registered with Stanaphone, run the Asterisk_Info application which we installed above using your correct IP address: http://192.168.0.108/maint/asterisk_info.php. Under SIP Peers, you should see an entry for sip.stanaphone.com showing a state of Registered. If not, check your username and password entries for typos.
TelaSIP Trunk Setup. Here are the entries for the TelaSIP SIP trunk. For your Outbound Caller ID, fill in the local phone number provided by Telasip. For Maximum Channels, enter 1. For Dial Rules, enter the following:
1|NXXNXXXXXX
NXXNXXXXXX
In the Outgoing Settings section, name your trunk telasip-gw and then enter the following PEER details using your TelaSIP-assigned username and password:
context=from-pstn (if that doesn't work use: from-trunk)
dtmfmode=rfc2833
host=gw3.telasip.com
insecure=very
secret=yourpassword
type=peer
username=yourusername
Leave the Incoming Settings User Context and User Details blank. For your Registration string, enter the following: yourusername:yourpassword@gw3.telasip.com using your actual username and password assigned by TelaSIP. Click Submit Changes and then the red bar to restart Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with TelaSIP.
VoipDiscount Trunk Setup. Here are the entries for the VoipDiscount SIP trunk. Create a SIP trunk for the service with a Trunk Name of voipdiscount. VoipDiscount doesn't support an outbound CallerID number so leave it blank. The Outgoing Dialing Rules in the U.S. should look like this:
001+NXXNXXXXXX
00+1NXXNXXXXXX
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. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with VoipDiscount.
When you have your Trunks set up, you'll need a way to call out (Outbound Routes), to call in (Inbound Routes), and to process incoming calls: a Digital Receptionist, a Call Queue, a Custom Application, DISA, or a phone to ring (Extensions). For today, we'll get the phones to ring. Then we'll tackle the other options in Parts II and III.
Configuring Outbound Routes. Outbound routes are the rules that determine how calls that are dialed from an extension on your system get processed. The idea here is that you set up a list of priorities. Then, based upon the number dialed, the outbound rules figure out how to route the call. We're going to start with a simple Outbound Route called Everything which will process all calls that are not handled by another Outbound Route. Click Setup->Outbound Routes->Add Route and enter the following:
Route Name ... Everything
Route Password ... [leave it blank]
Pin Set ... [leave it blank]
Emergency Dialing ... [leave it blank]
Dial Patterns: (adjust these if you wish to permit international calls!)
1NXXNXXXXXX
NXXNXXXXXX
Trunk Sequence:
0 sip/voipdiscount
1 sip/telasip-gw
Once you've made all the entries, click the Submit Changes button and then the Red Bar to reload Asterisk. You will be able to place calls by dialing either an area code and phone number or 1 plus an area code and phone number. For international callers, our previous articles will walk you through configuring the dial strings to support various countries. Now you should see two Outbound Routes in your route list. We want to delete the other route so just click on it and then choose Delete Route and click the Red Bar to save your changes. Now there should be only the Everything route in your Outbound Routes list. We'll leave it like that for today, but down the road, we'll add options for emergency calls, toll-free calls, in-state calls, and international calls. After we make those additions, the Everything route will be used as our lowest priority catch-all for calls that don't qualify for processing by another route.
Setting Up Extensions. To add a new extension and voicemail account to your system, click Setup->Extensions->Add SIP Extension and enter the following:
Extension Number ... 500
Display Name ... Office
Extension Options
Direct DID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
DID Alert Info ... [leave blank]
Outbound CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Emergency CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Record Incoming ... On Demand
Record Outgoing ... On Demand
Device Options
secret ... 1234
dtmfmode ... rfc2833
Voicemail & Directory ... Enabled
voicemail password ... 1234
email address ... yourname@yourdomain.com [if you want voicemail messages emailed to you]
pager email address ... yourname@yourdomain.com [if you want to be paged when voicemail messages arrive]
email attachment ... yes [if you want the voicemail message included in the email message]
play CID ... yes [if you want the CallerID played when you retrieve a message]
play envelope ... yes [if you want the date/time of the message played before the message is read to you]
delete Vmail ... yes [if you want the voicemail message deleted after it's emailed to you]
vm options ... callback=from-internal [to enable automatic callbacks by pressing 3,2 after playing a voicemail message]
vm context ... default
Configuring Inbound Routes. Just as we had to tell Asterisk how to process outbound calls, you also have to define what to do with incoming calls from each of your inbound trunks. Be aware that different service providers have implemented SIP and IAX differently. One of the best providers for proper SIP implementation is TelaSIP because you can route incoming calls based upon the DID numbers associated with each trunk. So you could have one incoming trunk from TelaSIP with multiple DID numbers (for each of your children, for example). Each DID then could be routed to a specific extension, and each extension could have its own CallerID number for outbound calls ... even though you might only have one TelaSIP trunk line. So, to outside callers, it would appear that each individual had his or her own phone line even though everyone might be sharing one or two trunks.
For today, we'll get a default inbound route established, and we'll save the gee whiz stuff for later. To create a Default Inbound Route for your calls, choose Setup->Inbound Routes->Add Route. Then enter the following:
DID Number ... [leave blank]
CallerID Number ... [leave blank]
Zaptel Channel ... [leave blank]
Fax Extension ... disabled
Fax Email ... [leave blank]
Fax Detection Type ... none
Pause After Answer ... [leave blank]
Privacy Manager ... no
Alert Info ... [leave blank]
Destination: ... Core: Office 500
Click Submit and then OK when you're warned that this will create a default incoming route for your calls. Down the road as you add additional incoming routes, the new routes will take precedence unless there's no matching DID in which case this default route will be used.
If you want to create a separate incoming route for your Stanaphone calls just to see how it works, click Add Incoming Route and enter the following:
DID Number ... [your 10-digit Stanaphone number]
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]
Destination: ... Core: voice mailbox 500
The trick to learn here is that if you want an incoming DID to go straight to voicemail, you need a slight pause to let Asterisk get properly set up for the call or the first couple seconds of your voicemail announcement will be cut off. By adding two seconds of fax detection, everything will work swimmingly.
Allowing Anonymous Inbound SIP Calls. One final step, and your incoming calls should start arriving without a "this number is not in service" message. Choose Setup->General Settings and scroll to the bottom of the page. Under Security Settings, change Allow Anonymous Inbound SIP Calls from No to Yes and click Submit Changes and then the Red Bar. Once this change is made, inbound calls from Stanaphone will work reliably.
Activating Email Delivery of VoiceMail Messages. When you're out and someone leaves you a voicemail message, TrixBox and freePBX will let you forward that voicemail message to your email address as a .wav file which can be played within most email client software. Or you can have the system send an instant message to your cell phone or pager telling you who called, what their phone number was, and how long a voicemail message the person left for you. Or you can do both. In addition, you can tell the system whether to delete the voicemail from your Asterisk server after sending it to your email account. In short, you now can manage all of your incoming email and voicemail from a single place, your email client. In order to send out emails from your server, you'll need to make a few changes.
First, make this adjustment to the /etc/hosts file on the server. Since anonymous emails are blocked by most ISPs, you'll need a fully-qualified domain name for your server. If you don't have your own domain, the easiest alternative is to use the fully-qualified domain name that your ISP assigns to the IP address for your broadband connection. Don't forget to update it when your ISP changes your IP address! To find out what your fully-qualified domain name is, go to a command prompt on your Asterisk server and type: nslookup 123.456.789.001 substituting your public IP address for the preceding numbers. Then write down the name entry without the trailing period. Now edit the hosts file: nano /etc/hosts. Move the cursor to the second line which reads 127.0.0.1 asterisk1.local , and then move the cursor over the first letter of the first domain name shown, usually asterisk1.local. Now type in the fully-qualified domain name you previously wrote down and add a space after your entry. Don't erase the existing entry! Save your settings: Ctrl-X, y, enter. Now restart network services on your Asterisk machine: service network restart.
Next, you need to modify the email message which delivers your voicemails so that it includes your fully-qualified domain name. Don't do this in TrixBox, or you'll mess up the formatting of the email message. You can download a fresh copy here if you need it. Instead, use nano: nano -w /etc/asterisk/vm_email.inc. Press Ctrl-W, type AMPWEBADDRESS, and press the enter key. Delete the word AMPWEBADDRESS and then type either the fully-qualified domain name for your Asterisk server or the private IP address if you only want to read your emails from behind your firewall. When you start typing, the text display may jump all over the place because of word wrap. Don't freak out. You haven't messed anything up. Once you complete your entry, don't erase or change anything else. Save the file: Ctrl-X,Y, then enter.
Now edit vm_general.inc: nano -w /etc/asterisk/vm_general.inc. Change the serveremail entry of vm@trixbox to an email name at the same fully qualified domain you used in your /etc/hosts file above. Then save your configuration and restart Asterisk: amportal restart. If you continue with this setup and still don't receive emails, here's another configuration change that is sometimes necessary. You'll also need to do it if you reloaded settings from an older version of Asterisk. On the Asterisk terminal, log in as root. Switch to the directory where the SendMail configuration file is stored: cd /etc/mail. Make a backup of the config file: cp sendmail.cf sendmail.cf.bak. Then issue the following command: echo CGasterisk.dyndns.org >> sendmail.cf. Substitute the actual domain name of your Asterisk server for asterisk.dyndns.org, but be sure it's preceded by CG with no intervening spaces.Then restart SendMail on your server and try again: /etc/rc.d/init.d/sendmail restart. Finally, if your ISP doesn't permit downstream mail servers (that's you), then take a look at this link which will show you how to designate your ISP as your SMTP smart host using SendMail.
Activating the Nerd Vittles Weather Forecasts in TrixBox. TrixBox 1.1 now includes the Flite text-to-speech engine as well as the Nerd Vittles weather forecasting system. To use it, just dial 611 from a phone on your system and enter a 3-character airport code to retrieve the weather forecast. TrixBox comes with support for about 50 airports. You can easily expand it to 1,000 airports by following along in Part II of our Weather Tutorial. It'll take you about 15 minutes. For complete instructions, read the full article here.
Creating Wakeup Calls in TrixBox. To set up a wakeup call from any extension, dial *62 and enter a two-digit hour and two-digit minute for the wakeup call.
Determining the Extension Number of Any Phone on Your TrixBox System. To determine the extension number of any phone on your system, dial *65 from that extension.
Retrieving VoiceMail from Any Phone With TrixBox. To retrieve voicemail for any extension, dial *98 and enter the voicemail extension number. When prompted, enter the password for that account. To retrieve voicemail for the extension from which you are calling, dial *97 and enter the password for the account when prompted. You can also set your voicemail defaults and record your voicemail greetings using these options.
Useful Functions on Your TrixBox 1.1 System. Here's the complete list of functions that will work out of the box from any extension on your TrixBox system:
Well, that should get you started. We'll tackle the gee whiz features in TrixBox and freePBX down the road so visit us again soon. In the meantime ...
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.
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.
Some Recent Nerd Vittles Articles of Interest...
The Whole House iPod
While the dust settles a bit in the TrixBox world, we thought we’d digress today and tell you about an incredible whole house audio system. Yes, there’s the iPod for private listening and there are some streaming audio solutions for those that want music in one or two rooms of a home or office. But what if you want music (different music) available in every room of your home. Well, until now, you could look at spending $20,000 to $50,000 for a very proprietary solution such as Elan’s Home Systems. It’s no accident that you won’t find any pricing on their web site.
As luck would have it, we just moved into a new home that was prewired for audio and video in eight rooms including recessed ceiling speakers in all the rooms. While this is an expensive proposition when retrofitting an older home, it’s fairly reasonable during new construction, and many builders now include it as part of the cost of a new house. The gotcha, however, is adding the multi-room amplifier, the audio devices to produce the music, and the touchpanel control units in each room. Can you spell outrageously expensive! In round numbers, you’re looking at $5,000 for installation of a suitable amplifier, $1,500 to $2,500 for each ultra-proprietary touchpanel display, and another $10,000 or more for the audio sources. These include CD jukeboxes, iPods with infrared remote access, a multi-channel XM radio receiver to the tune of $1,500 plus XM radio fees of nearly $30 a month (for three channels) forever, and loads of consulting fees at $100+ an hour. Each of the touchpanels or keypads is manually configured to match the audio components you purchase so that you can switch audio sources, adjust volume, and skip songs in each room. The double-gotcha is that despite having spent tens of thousands of dollars on this system, you have no ability to adjust anything down the road without another $100 an hour service call from the installer. So just pray they’re still around, or you’re basically stuck with your initial setup forever. A $500 magic box is used to configure the touchpanels and keypads, and, NO, you can’t buy one. It’s not sold to consumers, just dealers. Ouch!
You should be getting the picture of why we went shopping for an alternative with a bit more flexibility. That’s when we stumbled upon an incredible product called the Sonos Digital Music System. In a nutshell, you have a self-contained system unit in each room where you want music. It includes an optional amp for connection to a pair of speakers, wired and wireless networking, and a user and streaming audio interface that is as good or better than the iPod. Then you add as many touchpanel control units to select music and music sources as your budget can afford. There are also PC and Mac versions of the touchpanel which won’t cost you a dime. Each touchpanel can control every zone (aka room) in your home. What you don’t need with this system is a house prewired for audio because each unit lets you connect directly to a set of speakers or an external amplifier if desired. You also don’t need a wired network throughout your home. Only one of the Sonos units needs to be connected to a wired network. The rest of the devices automatically configure themselves to communicate wirelessly with the other system units and controllers scattered throughout your home. If you buy the starter pack with two system units including amps and one controller unit, you’re looking at $1,200 which works out to roughly $500 per system unit and about $200 for the controller. That’s roughly one tenth the cost of a functionally similar controller unit from Elan except you can configure the Sonos controller while a dealer has to configure the Elan unit … at $100 an hour.
I feel a little like the guy selling the Ginsu knives on television: "but there’s more." Boy, is there! Not only is the sound of the systems downright incredible (depending upon your speakers, of course), but the variety of available music sources is going to make you want some of these in the morning. Each system unit can stream audio from almost any music source imaginable. This includes MP3’s stored on your PC, Mac, or our latest discovery, a $150 network-attached storage (NAS) device. You also can play Shoutcast streams, either your own or those available for free over the Internet. Another option is to map a file share from a Sonos unit to a Mac or PC. It takes about 10 seconds. Sonos units also can play music from Rhapsody. And, if you’re lucky enough to be a Comcast broadband subscriber like us, a Rhapsody streaming audio subscription with about 50 music channels is yours for free! Just login to your Comcast account and download the Comcast Rhapsody software to any Windows PC. Rhapsody Stations are every bit as good as XM or Sirius channels with one important difference. There’s no additional monthly charge to Comcast customers for as many simultaneous streams as you care to play. That’s quite a contrast from Elan’s three XM streams solution which means three rooms with XM radio and no more … for $30 a month … once you buy your $1,500 Elan XM receiver. With Rhapsody, you won’t need a receiver at all, just an old clunker PC sitting in the corner with the Rhapsody application running. It can be used for other tasks as well. At the moment, we have my daughter’s game PC running Rhapsody with four simultaneous streams playing in seven zones of the house. You can double up zones with the click of a button using any Sonos controller. In addition to all these music sources, you also can connect an old-fashioned analog audio device (like a CD jukebox or an iPod) to each system unit. Music from these sources can be streamed to any combination of rooms you choose, just like traditional Shoutcast streams or Rhapsody stations. The only thing missing with analog device streams is the album art, but it still sounds great.
There are some other reviews of the Sonos system which are worth a look. Check out David Pogue’s article in the New York Times, the Home Theater View, Audioholics, Playlist Magazine, and PC Magazine. Then you’ll want to run, don’t walk, to buy at least one for yourself! You can purchase units from Sonos and most of their dealers with a 30-day money-back guarantee. We installed eight systems with four remotes in just over two hours. We haven’t quit listening since. Now you know why we’re running a little behind on the Asterisk® and TrixBox articles. 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. 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!
Some Recent Nerd Vittles Articles of Interest…
Asterisk + The National Weather Service = Free Weather Reports For 1,000 Cities From Any Touchtone Phone
Thanks to Asterisk®, Flite, and the National Weather Service, you now can get a quick weather update or a seven-day forecast for any combination of 1,000 U.S. cities using your plain-old touchtone telephone... just one of the many perks you receive for being an American Taxpayer. It doesn't mean the forecast will be right, mind you. But you can still listen and make your own judgments about carrying an umbrella. Just dial 611 and then a three-digit airport code for the city you're interested in. And you can customize things to support any 1,000 cities in the United States that you happen to like. [Note: Looking for Worldwide Weather Forecasts for Asterisk? Here's the link. For U.S. Weather Reports by Zip Code, go here.]
Prerequisites. To get started, all you'll need is a free Asterisk@Home or TrixBox server (Asterisk@Home or TrixBox will even run in a window on your Windows Desktop), the free Flite speech synthesis engine for Asterisk, our free MySQL database of airport codes and cities in the United States, and, of course, version 2 of our free Asterisk text-to-speech weather application. Yes, we accept donations above to underwrite the costs of future projects, but don't let that stop you if you're busy, broke, or just plain cheap. We won't track you down, and you'll still be able to sleep at night. We don't do this for a living. In fact, we don't do much of anything for a living, but we're still glad you're visiting. Please at least add yourself to the Nerd Vittles Fan Club Map and say something nice. That won't cost you a dime! We're assuming you already have an Asterisk@Home or TrixBox server up and running with Flite installed. If not, click on the links above to install your favorite flavor of Asterisk@Home or TrixBox plus Flite. And, no, this is not Rocket Science! You can finish this project in about 30 minutes without a Ph.D.
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 the new Nerd Vittles Weather app 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.
Downloading and Testing Flite. If you already have a TrixBox server up and running, you can skip this section. TrixBox has Flite preinstalled. For those running an Asterisk@Home 2.x server, here's how to quickly install the Asterisk-specific version of Flite on your system. Log into your server as root and issue the following commands:
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
Once you complete the installation process above, load the Asterisk Command Line Interface (asterisk -r) 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.
Setting Up the Airport Codes Database. We'll be using a MySQL Airports IATA database and a web-based script to get things going. To install the database and pick your own favorite 1,000 airports, you'll need a version of Asterisk@Home or TrixBox that includes phpMyAdmin as part of the bundle (TrixBox->SystemAdministration->phpMyAdmin) or the Asterisk Management Portal AAH enhancements (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 in the Maintenance tab of Asterisk@Home or TrixBox. Then 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 in the main field 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 needed the main field to pick one. As mentioned above, we'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. Now 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've decided to also support zip codes, and we'll cover that in a future column. 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!
Downloading the nv-weather Application. In addition to the airport codes database, there are two additional pieces to version 2 of the nv-weather application: a PHP/AGI script that does the heavy lifting and an addition to your dialplan which enables you to dial 611 from any phone on your Asterisk system to obtain a weather report. To install the PHP/AGI script, log into your Asterisk server as root and execute the following commands in order:
cd /var/lib/asterisk/agi-bin
wget http://nerdvittles.com/wp-content/nv-weather2.zip
mv nv-weather.php nv-weather.old.php
unzip nv-weather2.zip
rm -f nv-weather2.zip
chmod 775 nv-weather.php
chown asterisk:asterisk nv-weather.php
If you're using version 1 (or later) of TrixBox or if you're using Asterisk@Home and loaded the dialplan script that we covered in Part I of this series, then you've already got the dialplan script so skip the next section.
Dialplan Code. In order to activate extension 611 to answer calls for weather information using Asterisk@Home, you'll need to drop the following code into your dialplan in the [from-internal-custom] context of extensions_custom.conf. For TrixBox fans, you'll find this code already lurking in /etc/asterisk/extensions_trixbox.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.
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 first article, 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 directory every two weeks. If you'd prefer a shorter time, change the number 14 accordingly. If you'd prefer to just delete all these temporary files each night, here's a simplified version you can use:
3 0 * * * root rm -f /var/lib/asterisk/sounds/tts/tts*
Now save your changes: Ctrl-X, Y, then Enter.
Taking nv-weather For A Spin. Once you've installed the airport codes database, the PHP/AGI script, and the dialplan script, you should be good to go. Pick up a phone on your Asterisk system and dial 611. When prompted, key in the three-character airport code for the desired city, and presto! If you'd like to be able to review which airport codes are supported, take a look at Part I of this weather series and download the companion web application. 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.
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!
Newbie’s Guide to TrixBox 1.0 and FreePBX 2.1.1, Part I
NOTE: The system referenced in this article is no longer supported by Nerd Vittles as this version of Asterisk has been phased out. For the latest and greatest, please consider our new PBX in a Flash offering.
Well, the Nerd Vittles staff move is complete, and today we're back in the saddle. So, hello from Charleston, South Carolina! And now there's a brand-new Asterisk@Home: TrixBox 1.0 with a brand-new Asterisk Management Portal: freePBX 2.1.1. So we've got a lot of new ground to cover. These new Asterisk products are designed to support the casual home or home office user's PBX needs as well as gigantic call centers processing millions of calls a month. Everything is free except the hardware on which to run your new system. That can be a $139 refurbished PC or a multi-processor RAID box with mainframe horsepower. For home use, we've had great luck with older refurb units for under $150 each. And, no, we're not on commission. How much commission could there be on this stuff? [Note: Updated TrixBox 1.2.3 tutorial available here.]
What freePBX brings to the table is an incredibly simple yet powerful, upgradeable web-based GUI to totally manage your PBX. And TrixBox adds all of the Asterisk bells and whistles you could ever ask for in an integrated PBX: full-featured database management, simple hooks to high-level application development tools such as PHP and Perl, an Apache web server, integrated voicemail and fax-to-email support, contact management, calling card billing, hardware autoconfiguration for Digium and Cisco phone hardware, Microsoft networking support, an integrated text-to-speech system, and loads of free utility software applications for Asterisk compliments of Nerd Vittles. And, yes, TrixBox 1.0 still fits on a single CD! For those new to Nerd Vittles, be aware that we make slipstream changes to articles as users discover things we've missed. Yes, we're human! So check for Comments before you begin or subscribe to our Comments RSS Feed. And, last but not least, be sure to add yourself to the Nerd Vittles Fan Club Map.
The Game Plan. Because of WordPress article length limitations and our own limited attention span, we're going to divide this Guide into several parts. Today, we'll get your new system running so that you can make your first call. In Part II, we'll cover a number of the bells and whistles that make TrixBox and freePBX such a great combination. Then, in Part III, we'll add some more tips and tricks to help you impress your friends whenever the need arises. And, no we haven't forgotten the other installments in our weather report series. Our updated tutorial for TrixBox 1.1 is now available.
Hardware Setup. You have two choices for hardware to run this new system. The first is to dedicate a machine to TrixBox and download the TrixBox ISO image to burn a bootable CD. Once you create the TrixBox CD, you simply boot your dedicated PC with the new CD. It will erase and reformat your hard disk for use with Linux and the included Linux and Asterisk applications. If you just want to experiment with TrixBox and don't plan to put the system into production other than for one or two simultaneous calls from home, then you may prefer to download the VMware version of TrixBox or VMwarez's enhanced version. With this approach, you install VMware on your existing Windows XP or Windows 2000 system. Then you run Linux and the TrixBox application in a window on your Windows PC. It does not require a dedicated machine. We've found the performance to be virtually identical to running TrixBox on a dedicated PC provided your Windows machine has at least 512MB to 1GB of RAM. See our previous article for step-by-step instructions on the VMware installation process.
For now, however, we're assuming you've opted for the dedicated machine install: pure Linux on a clean machine. So begin by downloading the TrixBox ISO image from here and burn a CD (click here if you need a refresher course). Using your dedicated PC, insert the CD you made, plug your machine into the Internet, and turn it on. Then watch while TrixBox loads CentOS/4.3 and all the Asterisk and Linux goodies imaginable: Apache, SendMail, Asterisk Mail, SugarCRM, MySQL, PHP, phpMyAdmin, SSH, Bluetooth, freePBX, the Flash Operator Panel, Call Detail Reporting, and on and on. We've covered how to use most of the Linux products in our Mac HOW-TO's (see sidebar), and they work exactly the same way with TrixBox so keep reading. And, yes, this install will reformat (aka ERASE) your hard disk before it begins, but it now warns you first. When you're prompted to create your root user password, type in something you can remember ... or write it down!
Upgrading TrixBox from a Prior Version of Asterisk@Home. In a nutshell, YOU CAN'T. But there is a way to put most of Humpty back together again once you've installed the new system. Before you begin, understand that you are doing this AT YOUR OWN RISK. NO GUARANTEES. If that bothers you, don't do it! The real trick is to do a little printing and copying of your old data before you insert that TrixBox installation disk. Step 1 is to make a full backup of your old system to a different server before you begin. If you don't know how, read our step-by-step instructions on the subject here. Step 2 is to make another copy of some of the critical files in your system. Duplicates of all of these will also be part of your backup. We typically build directories on a separate server which match the ones we'll be copying over from the old Asterisk system. Here are the directories (including all the subdirectories therein) that we always duplicate. Before you just blindly copy our list, stop and think whether there are special things you do on your existing Asterisk system or special apps that you run. Then find those files and make copies of all of them, too. The important piece in making a successful copy of some of these files is to shut down Asterisk (amportal stop) and MySQL (/etc/init.d/mysqld stop) before you begin. NOTE to CRM users: There's a new version of CRM in TrixBox so it's unlikely that you can restore the databases. Check your current version of AAH (help-aah) and see if there is an option (bundle-crm) to pack up CRM to move it to another machine. If so, do it and follow the instructions. We don't use Sugar so we haven't tested this upgrade option. Here are the directories you'll want to back up:
/var/lib/asterisk/agi-bin
/var/www/html
/var/lib/asterisk/sounds/custom
/var/lib/mysql
/root
/etc/asterisk
Then there are a couple of individual files that you'll also want to preserve:
/etc/hosts
/etc/crontab
The third step is to take screenshots of every screen you've built using the Asterisk Management Portal (AMP) or a prior version of freePBX. Start in the Setup tab and go right down the list of features. For each option in which you have multiple entries (e.g. Extensions and Trunks), call up each entry and print out the full page. Be especially careful in printing the Trunks entries and make sure you write down every line in the PEER Details and USER Details because those which are out of view will not get printed using a screen print. You'll need to manually fill in the ones that aren't displayed. The same goes for Registration Strings which often scroll out of view on the screen. Finally, using CLI (asterisk -r), make a copy of all your Asterisk database entries: database show. Now save all this information in a safe place until we finish the new install.
Loading CentOS/4 and TrixBox 1.0. Here's how the install went for us, and we'll walk you through getting everything set up so that it can be used as a production server. There is a wrinkle in the installation process because of a Linux kernel upgrade which triggers a bug in Asterisk which triggers a missing component in TrixBox, but we'll get all that fixed up in short order. Once the install begins, you can expect to eat up about 25 minutes with the CentOS 4.3 install. Just be sure to create your new root user password before you walk away, or it will still be sitting there waiting when you return. Once Linux is installed, the TrixBox CD will eject itself, reboot the system, and begin the Asterisk compile and installation. That takes about 25 more minutes to complete.
Securing Your Passwords. When it's finished and reboots, log in as root with the password you assigned. Type help-trixbox for a listing of the other four passwords that need to be changed. Change them all NOW!
passwd admin
passwd-maint
passwd-amp
passwd-meetme
Getting the Latest CentOS Updates. Once your system is secure, load all of the application updates for CentOS 4.3. There now are lots of updates plus a new kernel install so be patient. If you have zaptel cards, read this thread. The command to issue to begin the update process is yum -y update.
Rebuilding Zaptel. Every time there is a kernel update with yum (which is the case here), ZAP device support needs to be rebuilt using the new kernel. Unfortunately, a RedHat bug caused the rebuilding process to fail. Here's the fix. Log into your new server as root and issue the following commands to determine which new kernel was loaded on your system:
cd /usr/src/kernels
ls
You should see the original kernel 2.6.9-34.EL-something and the new one: 2.6.9-34.0.1.EL-something. Depending upon the processor in your system, the something may be different than our machine. Write down the name of the new kernel directory and substitute it below for 2.6.9-34.0.1.EL-i686. Now issue these commands:
cd /usr/src/kernels/2.6.9-34.0.1.EL-i686/include/linux
mv spinlock.h spinlock.h.old
wget http://nerdvittles.com/trixbox/spinlock.h
shutdown -r now
In a perfect world, once the reboot completes, you should have been ready to rebuild ZAP device support. But Andrew inadvertently left out the source code. So here's what you need to do next. Log into your new system as root again and issue the following commands:
cd /usr/src
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.5.tar.gz
tar -zxvf zaptel-1.2.5.tar.gz
mv zaptel-1.2.5 zaptel
cd /usr/src/zaptel
make clean
make install
shutdown -r now
Now we can rebuild support for your ZAP devices or ztdummy if you have no ZAP devices. Log in as root again and type the following command: rebuild_zaptel. Then reboot your system: shutdown -r now. Now log in as root again and type amportal stop and then genzaptelconf. Now, here's one final housekeeping chore. Log in as root again and issue these commands:
touch /etc/fxotune.conf
/usr/sbin/fxotune -s
shutdown -r now
Upgrading to Asterisk 1.2.9.1. Because of a serious security vulnerability in Asterisk, we are modifying this article on June 17 to show how to load the Asterisk upgrade for those that followed this initial tutorial. Log into your server as root and issue the following commands in order:
rpm -del zaptel-modules-2.6.9-34.EL
rpm -del zaptel-modules-2.6.9-35.EL
trixbox-update.sh
trixbox-update.sh update
reboot
rebuild_zaptel
modprobe wcfxo [if you have zaptel hardware]
genzaptelconf
reboot
Now you should be good to go on the software front. Whew!
Activating Bluetooth Support. Once the updates are completed, activate Bluetooth support if you plan to use it with our Follow-Me Phoning proximity detection application. Run setup, down arrow to System Services, press ENTER, down arrow to bluetooth and press the space bar, tab to OK, press ENTER, tab twice to Quit and press ENTER.
Activating Apache HTTPS Support. If you want secure Internet web access to your server, log into your system as root and issue these commands. Once https support is installed, you can access freePBX securely: https://AsteriskServerIPaddress.
yum -y install mod_ssl
shutdown -r now
Restoring Asterisk Info Application. One of the nice applications that previously was bundled in Asterisk@Home was Asterisk Info. It gave a detailed summary of many critical components in Asterisk including a listing of active SIP and IAX peers and registry entries. This is especially helpful when you're setting up new providers and want to see whether you're getting connected successfully. To restore the application, log into your server as root and issue these commands:
cd /var/www/html/maint
wget http://nerdvittles.com/trixbox/asterisk_info.zip
unzip asterisk_info.zip
rm -f asterisk_info.zip
Now you can run the application using a web browser pointed to the correct IP address of your server: http://192.168.0.108/maint/asterisk_info.php
Simplifying SSH Access. If you're going to be connecting to other servers from your new TrixBox system using SSH or SCP, then build your new RSA key pair now. This lets you use SSH and SCP (secure copy) without having to enter a password each time. You can also automate backups and proximity detection scripts as we've explained previously here. Log in to your new TrixBox server as root. From the command prompt, issue the following command: ssh-keygen -t rsa. Press the enter key three times. You should see something similar to the following. The file name and location in bold below is the information we need:
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1d:3c:14:23:d8:7b:57:d2:cd:18:70:80:0f:9b:b5:92 root@asterisk1.local
Now copy the file in bold above to your other Asterisk servers, Linux machines, and Macs. There's probably a way on PCs as well, but we've all but given up on that platform where security matters so you're on your own there. From your TrixBox server using SCP, the command should look like the following (except use the private IP address of each of your other Asterisk or Linux servers instead of 192.168.0.104). Provide the root password to your other servers (one at a time) when prompted to do so.
scp /root/.ssh/id_rsa.pub root@192.168.0.104:/root/.ssh/authorized_keys
On a Mac running Mac OS X, the command would look like this (using your username and your Mac's IP address, of course):
For user access only: scp /root/.ssh/id_rsa.pub wardmundy@192.168.0.104:/Users/wardmundy/.ssh/authorized_keys
For full root access: scp /root/.ssh/id_rsa.pub root@192.168.0.104:/var/root/.ssh/authorized_keys
Once the file has been copied to each server, try to log in to your other server from your new TrixBox server with the following command using the correct destination IP address, of course:
ssh root@192.168.0.104
You should be admitted without entering a password. If not, repeat the drill or read the complete article and find where you made a mistake. Now log out of the other server by typing exit.
Installing WebMin. We don't build Linux systems without installing WebMin, the Swiss Army knife of the Linux World. You can use it to start and stop services, check logs, adjust startup scripts, manage cron jobs, babysit your SendMail server, and many, many other tasks that are downright painful without it. If you ever need help from others, WebMin is a great tool for letting others help you.
There are lots of ways to install WebMin. WebMin now is part of the TrixBox yum repository so, after logging in as root, just issue the following command: yum -y install webmin.
WebMin runs its own web server on port 10000. To start WebMin, issue this command: /etc/webmin/start. You access it with a web browser pointed to the IP address of your Asterisk box (i.e. replace 192.168.0.108) at the correct port address, e.g. http://192.168.0.108:10000. Note, https support won't work on port 10000 without a bit of additional tweaking! The login name is root. Then type in your root password and press enter. The main WebMin screen will display. We really don't want the WebMin server starting up each time the OS reboots so do the following. Once you're logged in to WebMin, choose System->Bootup and Shutdown and then click on webmin. Click the No button beside Start at boot time, and then click the Save button. To stop WebMin when you're finished using it, issue this command: /etc/webmin/stop. You can restart it any time you need it, and then use a web browser to access it. But there's no need to waste processing resources. For complete WebMin documentation, click here.
If you're going to be accessing WebMin from outside your firewall, you really don't want to be logging in as root over an unencrypted connection so let's enable https support for WebMin. While still logged into WebMin, click WebMin->WebMin Config->SSL Encryption. Now click Install Net::SSLeay Perl Module. Once the module is downloaded, click the Continue With Install button. The make and make install process will take a minute or two. Once you get the completed sucessfully message, click Return to WebMin. Choose WebMin->WebMin Config->SSL Encryption again. At the bottom of the form, click the Create Now button to create your SSL key. Click Return to WebMin again. Then choose WebMin->WebMin Config->SSL Encryption once more. Change the Enable SSL if available option to Yes, leave the other defaults, and save your changes. Henceforth, you can log into your server using HTTPS: https://TrixBoxIPaddress:10000/.
IP Configuration for Asterisk. We need a consistent IP address or domain name both on your internal network and externally if you expect to receive incoming calls reliably. There are three pieces to the IP configuration: (1) setting the internal IP address of your Asterisk server, (2) configuring a fully-qualified (external) domain name for your new server which will always point to your router/firewall, and (3) configuring your router to transfer incoming Asterisk packets to your Asterisk server. Here's how.
First, log into your server as root using your new password. Now type ifconfig eth0 (that's "e-t-h-zero") then enter, and write down both your inet addr and your HWaddr on the Ethernet 0 interface, eth0. Inet addr is the internal IP address of your Asterisk box assigned by your DHCP server (i.e. your router/firewall). HWAddr is the MAC address of your Asterisk server's eth0 network card. To assure a consistent internal IP address, you can either configure your router/DHCP server to make certain that it always hands out this same address to your Asterisk machine, or you can manually configure an IP address for this machine which is not in the range of addresses used by your DHCP server. Almost all routers now make it easy to preassign DHCP addresses so we prefer option 1. It's generally under the tab for LAN IP Setup or DHCP Configuration and is generally called something like Reserved IP table. Just add an entry and call it Asterisk PBX and specify the IP address and MAC address that you wrote down above. Now each time you reboot your Asterisk server, your router will assign it this same IP addreess.
To assure a consistent external address is a little trickier. Unless you have a static (fixed) IP address, you'll want to use a Dynamic DNS service such as dyndns.org and configure your router to always advertise its external IP address to dyndns.org. DynDNS.org will take care of revising the IP address associated with your domain name when your ISP changes your dynamic IP address. Then you can configure your VoIP provider account using your fully-qualified dyndns.org domain name, e.g. windswept.dyndns.org provides access to our beach house network even though Time Warner cable hands out dynamic IP addresses which change from time to time.
Now you'll need to log into your router and redirect certain incoming UDP packets to the internal IP address of your Asterisk machine. If you want external access to the Apache web server on your Asterisk machine, then map TCP port 80 to the internal IP address of your Asterisk system. For WebMin external access, map TCP port 10000 to your Asterisk system. If you want remote access to your Asterisk system via SSH, then map TCP port 22 to the internal IP address of your Asterisk system. If you want external IP phones or other Asterisk servers to be able to communicate with your Asterisk system, then map the following UDP port ranges to the internal IP address of your Asterisk system:
SIP 5004-5082
RTP 10001-20000
IAX 4569
For more details, read our full article on the subject.
Finally, you'll need to tell Asterisk about some of this. Edit the sip.conf file (nano -w /etc/asterisk/sip.conf) and add the following entries in the [general] section of the file using your fully-qualified domain name for your server and the private IP address range used behind your router/firewall (typically 192.168.0.0 or 192.168.1.0 with most home routers):
externhost = yourdomainname.dyndns.org
localnet=192.168.0.0/255.255.255.0
nat=yes
Designing Your PBX System. For those new to the Asterisk world, we'll be using a web-based GUI to configure Asterisk to meet your needs. Step 1 is to get away from your computer and sit down with a piece of paper. Now lay out how you'd like your new system to operate. How many phones will you have? Will they be software-based phones or good old phones you can put on a desktop? Will they be POTS phones (plain old touchtone phones), cordless POTS phones, SIP phones, IAX phones, or cordless SIP phones? How will you make and receive calls? Are you going to use an existing Ma Bell phone line or VoIP trunk lines from one or more VoIP providers? What should happen when incoming calls arrive? Do you want the caller to get an AutoAttendant message ("Hi. You've reached the Mundy's. Press 1 for Mary, 2 for Ward, or 3 to leave a message.") or do you just want all of your phones to start ringing? What should happen when no one answers or the line is busy? Do you want the calls transferred to a cell phone, another POTS phone, or just sent to voicemail? Which voicemail account? Should all busy phones send callers to the same voicemail account, or do you want one for each phone? What should happen once voicemail arrives? Do you want the phone to ring once a minute? Do you want the message waiting indicator to illuminate? Do you want the voicemail message to be emailed to you? Do you also want it preserved so that you can retrieve it from a touchtone phone? Do you want to be paged with the number of the person that called you?
ATTN: "Type A" Males. With apologies to our female readers, let me chat privately for a moment with the guys. If you have a wife (and want to keep her) or if you have teenage daughters (and want to avoid being killed in your sleep), you'd better get most of this PBX design right if you plan to use Asterisk to replace your existing home phone system. Otherwise, the day after you install your new system, a typical discussion with your spouse will begin with something like this: "What was wrong with our old phones that just rang when someone called and I could actually hear what they were saying when I answered?" With that caveat in mind, let's jump right in to freePBX.
Today's Objective. Keeping in mind that there are a million ways to configure and customize a PBX, we're going to walk you through a very simple setup today. Our objective is to get Asterisk and freePBX configured so that you can make a call and receive a call. In our next article, we'll start adding all the bells and whistles. But, for today, we'll show you how to set up an incoming and an outgoing VoIP trunk so you can make and receive free calls (at least in the U.S.) using a free softphone. When no one answers, the call will be sent to voicemail. And, when a voicemail message is left, the message will be emailed to you. We'll leave integration of existing POTS phones and phone lines for another day.
Choosing VoIP Providers. As you will quickly learn, choosing VoIP providers is an art, not a science. And it can be a slippery slope. A provider that is great one day can turn into an absolute nightmare the next. Take BroadVoice, for example. They used to be one of our favorites. Then the CEO left, and the company's business practices, uh, changed to put it charitably. You can read all about it on this forum or at the Better Business Bureau's site. All it takes is a change in leadership or direction at the company headquarters to go from first to worst overnight. So the best advice we can offer about choosing providers is this. Stay Flexible! Don't put all your eggs in one basket. And don't be in a hurry to disconnect your Ma Bell line and transfer your number until you are pretty confident about your provider. Six months is an absolute minimum, and a year is probably better. VoIP providers come and go at about the same pace as fast food restaurants in a new community.
Having said all of that, we have some providers we really like and some that we don't. YMMV! The basic idea in switching to Voice Over IP technology was to save money... not just for the provider, but for you, too. So PRICE MATTERS. There are typically three types of VoIP service: all-you-can-eat at a fixed monthly price, pay-as-you-go at a per minute (or part of a minute) rate, and free. Some providers only offer outbound service, and others offer incoming and outgoing calls. To receive calls, you've got to have an account with a provider that will give you a phone number unless you want to only get calls from other users of that provider's service, e.g. Skype. You don't have to use the same provider for inbound and outbound calls, and you are better off with backup providers for BOTH inbound and outbound calls.
If you select an all-you-can-eat plan, you basically get the right to make (or receive) ONE phone call at a time to a certain geographic area. This may be a state, an area code, or a country depending upon where you live and which provider you choose. The best of these in the U.S. is TelaSIP at $14.95 a month for unlimited U.S. calling. The runner-up is Axvoice which has a broader variety of plans including an unlimited international calling plan at $22.99 a month. Be aware of the fine print with all-you-can-eat providers. Some such as Teliax don't really offer unlimited calling even tough they call it that. What they offer is unlimited calling up to some monthly cap of minutes. For example, with Teliax, up to 1500 minutes a month are "free" and then you pay 2¢ per minute thereafter. They're not really free because you've paid a $24.99 monthly fee for the initial 1,500 minutes. Then there's our old favorite BroadVoice which now offers unlimited calling with a little asterisk. After you drill down to the third level in their web pages, you'll see this in the fine print: "* Significant restrictions apply to Unlimited Plans." If you violate their undefined "normal residential usage patterns", you agree in advance to let them retroactively charge you 5¢ per minute for every call you've made since you signed up... plus $300/hour in in-house legal fees for successful collection. I wonder if they pay their staff attorneys that much? Their terms of use give them unfettered discretion in defining what's appropriate and inappropriate use. And, arguably, even having multiple people in your household use your "unlimited plan" violates their terms of service. So, unless you've recently won the lottery or just enjoy litigation, here's our best advice on BroadVoice: JUST SAY NO!
With pay-as-you-go providers, there typically are no simultaneous call limitations because you're paying by the minute per call. Some of these providers charge in whole minute increments while others round calls to as little as six second billing increments. Some leave their rates the same for six months or more. Others change their rates almost daily. You don't want to have to visit a web site each time your phone rings to determine what it will cost to pick up the phone. So be alert in choosing a pay-as-you-go provider. The best of the bunch in our opinion is Voxee.com at about a penny a minute for U.S. calls and only slightly more for calls to many international destinations.
And then there are the free providers. Here's a good rule of thumb. Enjoy it while it lasts. Don't expect free to last forever. And, most importantly, READ THE FINE PRINT. It costs the provider something to offer the service and, if they're giving the service away, there IS a catch. You just have to be smart enough to figure out what it is. The best freebies at the moment are VoipDiscount.com for free outbound calls to numerous countries including the U.S. at least today, FreeDigits.com for free incoming DIDs, free incoming calls, and free incoming fax service, and Stanaphone.com for free incoming DIDs and free incoming calls. See our complete list of VoIP Provider reviews for additional information and setup instructions.
If you just want to experiment with your new system and don't want to cough up much money, here's a good way to get your feet wet. Sign up for a free incoming DID number and free incoming calls with Stanaphone's Stana-IN service and sign up with VoIPDiscount.com for free outbound calls. You'll need a Windows machine to initially sign up for both of these services. See our tutorials for details. You won't have a phone number in your local area code, but folks will be able to call you. If you want a number in your local area code and you live in the U.S., sign up for TelaSIP's basic service at $5.95 a month which gets you a local phone number and free unlimited incoming calls ... one at a time. Outbound calls in the U.S. are 2¢ a minute which gives you a good backup to your free VoIPDiscount outbound calling service. There are no obnoxious terms of service or hidden fees with TelaSIP. Just use the service for residential calling.
Downloading a Free Softphone. Unless you already have an IP phone, the easiest way to get started and make sure everything is working is to install an IP softphone. You can download a softphone for Windows, Mac, or Linux from CounterPath. Or download the pulver.Communicator or the snom 360 Softphone which is a replica of perhaps the best IP phone on the planet. Here's a new IAX softphone for all platforms that's great, too, and it requires no installation: Idefisk. All are free! Just install and then configure with the IP address of your TrixBox server. For username and password, use the extension number and password which we'll set up shortly with freePBX. Once you make a few test calls, don't waste any more time. Buy a decent SIP telephone. We think the best value in the marketplace with excellent build quality and feature set is the $85 GrandStream GXP-2000. It has support for four lines, speaks CallerID numbers, has a lighted display, and can be configured for autoanswer with a great speakerphone. Short of paying over double for the snom 360, that's as good as desktop phones get. If you want to use Asterisk throughout your home, buy a good 5.8GHz wireless phone system with plenty of extensions such as the Uniden 8866 which we use (see ad below) and then purchase an SPA-3000 to connect up both your home phone line and all your cordless phones. Our tutorial will show you how.
Initial Setup of freePBX. You still access freePBX just as you accessed the Asterisk Management Portal (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 clicking the freePBX option from the TrixBox main menu. Then choose 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. So, in the Module Administration screen, click Connect to Online Module Repository to first download all of the available modules. Then select all of the Disabled Modules and Enable them. Click Submit and then the Red Bar to save your updates. From time to time, you need to revisit this page to upgrade the modules as bug fixes are released.
As you can see, there are two types of Modules: 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 tells you which ones are newer than the ones currently on your system. 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. Once you complete the above steps, you're ready to set up your new system.
Configuring freePBX Trunks. When you click the 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!
For our sample setup today, we'll configure SIP trunks for Stanaphone, TelaSIP, and VoipDiscount. For each provider, click on the Setup->Trunks tab in freePBX. Then click Add SIP Trunk. After you complete the entries for each provider, click Submit Changes and then the Red Bar.
StanaPhone Trunk Setup. Here are the entries for the Stanaphone SIP trunk. For Outbound CallerID, enter the phone number assigned to you by StanaPhone. For Maximum Channels, enter 1. Leave the Dial Rules and Dial Prefix blank for the time being.
For Outgoing Settings, enter a Trunk Name of stanaphone. For Peer Details, enter the following using your assigned username and password. Be very careful to match the upper and lower case settings in your assigned password.
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername
For Incoming Settings, enter a USER Context of from-pstn. This tells Asterisk to process incoming calls through this context in your dialplan. For USER Details, enter the following using your assigned username and password:
canreinvite=no
dtmfmode=rfc2833
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername
For the Registration String, enter the following using your assigned username, password, and 347 phone number:
yourusername:yourpassword@sip.stanaphone.com/3471234567
Click the Submit Changes button and then click on the Red Bar to save your trunk settings and reload Asterisk. To be sure you have properly registered with Stanaphone, run the Asterisk_Info application which we installed above using your correct IP address: http://192.168.0.108/maint/asterisk_info.php. Under SIP Peers, you should see an entry for sip.stanaphone.com showing a state of Registered. If not, check your username and password entries for typos.
TelaSIP Trunk Setup. Here are the entries for the TelaSIP SIP trunk. For your Outbound Caller ID, fill in the local phone number provided by Telasip. For Maximum Channels, enter 1. For Dial Rules, enter the following:
1|NXXNXXXXXX
NXXNXXXXXX
In the Outgoing Settings section, name your trunk telasip-gw and then enter the following PEER details using your TelaSIP-assigned username and password:
context=from-pstn (if that doesn't work use: from-trunk)
dtmfmode=rfc2833
host=gw3.telasip.com
insecure=very
secret=yourpassword
type=peer
username=yourusername
Leave the Incoming Settings User Context and User Details blank. For your Registration string, enter the following: yourusername:yourpassword@gw3.telasip.com using your actual username and password assigned by TelaSIP. Click Submit Changes and then the red bar to restart Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with TelaSIP.
VoipDiscount Trunk Setup. Here are the entries for the VoipDiscount SIP trunk. Create a SIP trunk for the service with a Trunk Name of voipdiscount. VoipDiscount doesn't support an outbound CallerID number so leave it blank. The Outgoing Dialing Rules in the U.S. should look like this:
001+NXXNXXXXXX
00+1NXXNXXXXXX
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. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with VoipDiscount.
When you have your Trunks set up, you'll need a way to call out (Outbound Routes), to call in (Inbound Routes), and to process incoming calls: a Digital Receptionist, a Call Queue, a Custom Application, DISA, or a phone to ring (Extensions). For today, we'll get the phones to ring. Then we'll tackle the other options in Parts II and III.
Configuring Outbound Routes. Outbound routes are the rules that determine how calls that are dialed from an extension on your system get processed. The idea here is that you set up a list of priorities. Then, based upon the number dialed, the outbound rules figure out how to route the call. We're going to start with a simple Outbound Route called Everything which will process all calls that are not handled by another Outbound Route. Click Setup->Outbound Routes->Add Route and enter the following:
Route Name ... Everything
Route Password ... [leave it blank]
Pin Set ... [leave it blank]
Emergency Dialing ... [leave it blank]
Dial Patterns: (adjust these if you wish to permit international calls!)
1NXXNXXXXXX
NXXNXXXXXX
Trunk Sequence:
0 sip/voipdiscount
1 sip/telasip-gw
Once you've made all the entries, click the Submit Changes button and then the Red Bar to reload Asterisk. You will be able to place calls by dialing either an area code and phone number or 1 plus an area code and phone number. For international callers, our previous articles will walk you through configuring the dial strings to support various countries. Now you should see two Outbound Routes in your route list. We want to delete the other route so just click on it and then choose Delete Route and click the Red Bar to save your changes. Now there should be only the Everything route in your Outbound Routes list. We'll leave it like that for today, but down the road, we'll add options for emergency calls, toll-free calls, in-state calls, and international calls. After we make those additions, the Everything route will be used as our lowest priority catch-all for calls that don't qualify for processing by another route.
Setting Up Extensions. To add a new extension and voicemail account to your system, click Setup->Extensions->Add SIP Extension and enter the following:
Extension Number ... 500
Display Name ... Office
Extension Options
Direct DID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
DID Alert Info ... [leave blank]
Outbound CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Emergency CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Record Incoming ... On Demand
Record Outgoing ... On Demand
Device Options
secret ... 1234
dtmfmode ... rfc2833
Voicemail & Directory ... Enabled
voicemail password ... 1234
email address ... yourname@yourdomain.com [if you want voicemail messages emailed to you]
pager email address ... yourname@yourdomain.com [if you want to be paged when voicemail messages arrive]
email attachment ... yes [if you want the voicemail message included in the email message]
play CID ... yes [if you want the CallerID played when you retrieve a message]
play envelope ... yes [if you want the date/time of the message played before the message is read to you]
delete Vmail ... yes [if you want the voicemail message deleted after it's emailed to you]
vm options ... callback=from-internal [to enable automatic callbacks by pressing 3,2 after playing a voicemail message]
vm context ... default
Configuring Inbound Routes. Just as we had to tell Asterisk how to process outbound calls, you also have to define what to do with incoming calls from each of your inbound trunks. Be aware that different service providers have implemented SIP and IAX differently. One of the best providers for proper SIP implementation is TelaSIP because you can route incoming calls based upon the DID numbers associated with each trunk. So you could have one incoming trunk from TelaSIP with multiple DID numbers (for each of your children, for example). Each DID then could be routed to a specific extension, and each extension could have its own CallerID number for outbound calls ... even though you might only have one TelaSIP trunk line. So, to outside callers, it would appear that each individual had his or her own phone line even though everyone might be sharing one or two trunks.
For today, we'll get a default inbound route established, and we'll save the gee whiz stuff for the next chapter. To create a Default Inbound Route for your calls, choose Setup->Inbound Routes->Add Route. Then enter the following:
DID Number ... [leave blank]
CallerID Number ... [leave blank]
Zaptel Channel ... [leave blank]
Fax Extension ... disabled
Fax Email ... [leave blank]
Fax Detection Type ... none
Pause After Answer ... [leave blank]
Privacy Manager ... no
Alert Info ... [leave blank]
Destination: ... Core: Office 500
Click Submit and then OK when you're warned that this will create a default incoming route for your calls. Down the road as you add additional incoming routes, the new routes will take precedence unless there's no matching DID in which case this default route will be used.
If you want to create a separate incoming route for your Stanaphone calls just to see how it works, click Add Incoming Route and enter the following:
DID Number ... [your 10-digit Stanaphone number]
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]
Destination: ... Core: voice mailbox 500
The trick to learn here is that if you want an incoming DID to go straight to voicemail, you need a slight pause to let Asterisk get properly set up for the call or the first couple seconds of your voicemail announcement will be cut off. By adding two seconds of fax detection, everything will work swimmingly.
Allowing Anonymous Inbound SIP Calls. One final step, and your incoming calls should start arriving without a "this number is not in service" message. Choose Setup->General Settings and scroll to the bottom of the page. Under Security Settings, change Allow Anonymous Inbound SIP Calls from No to Yes and click Submit Changes and then the Red Bar. Once this change is made, inbound calls from Stanaphone will work reliably.
Activating Email Delivery of VoiceMail Messages. When you're out and someone leaves you a voicemail message, TrixBox and freePBX will let you forward that voicemail message to your email address as a .wav file which can be played within most email client software. Or you can have the system send an instant message to your cell phone or pager telling you who called, what their phone number was, and how long a voicemail message the person left for you. Or you can do both. In addition, you can tell the system whether to delete the voicemail from your Asterisk server after sending it to your email account. In short, you now can manage all of your incoming email and voicemail from a single place, your email client. In order to send out emails from your server, you'll need to make a few changes.
First, make this adjustment to the /etc/hosts file on the server. Since anonymous emails are blocked by most ISPs, you'll need a fully-qualified domain name for your server. If you don't have your own domain, the easiest alternative is to use the fully-qualified domain name that your ISP assigns to the IP address for your broadband connection. Don't forget to update it when your ISP changes your IP address! To find out what your fully-qualified domain name is, go to a command prompt on your Asterisk server and type: nslookup 123.456.789.001 substituting your public IP address for the preceding numbers. Then write down the name entry without the trailing period. Now edit the hosts file: nano /etc/hosts. Move the cursor to the second line which reads 127.0.0.1 asterisk1.local , and then move the cursor over the first letter of the first domain name shown, usually asterisk1.local. Now type in the fully-qualified domain name you previously wrote down and add a space after your entry. Don't erase the existing entry! Save your settings: Ctrl-X, y, enter. Now restart network services on your Asterisk machine: service network restart.
Next, you need to modify the email message which delivers your voicemails so that it includes your fully-qualified domain name. Don't do this in TrixBox, or you'll mess up the formatting of the email message. You can download a fresh copy here if you need it. Instead, use nano: nano -w /etc/asterisk/vm_email.inc. Press Ctrl-W, type AMPWEBADDRESS, and press the enter key. Delete the word AMPWEBADDRESS and then type either the fully-qualified domain name for your Asterisk server or the private IP address if you only want to read your emails from behind your firewall. When you start typing, the text display may jump all over the place because of word wrap. Don't freak out. You haven't messed anything up. Once you complete your entry, don't erase or change anything else. Save the file: Ctrl-X,Y, then enter.
Now edit vm_general.inc: nano -w /etc/asterisk/vm_general.inc. Change the serveremail entry of vm@trixbox to an email name at the same fully qualified domain you used in your /etc/hosts file above. Then save your configuration and restart Asterisk: amportal restart. If you continue with this setup and still don't receive emails, here's another configuration change that is sometimes necessary. You'll also need to do it if you reloaded settings from an older version of Asterisk. On the Asterisk terminal, log in as root. Switch to the directory where the SendMail configuration file is stored: cd /etc/mail. Make a backup of the config file: cp sendmail.cf sendmail.cf.bak. Then issue the following command: echo CGasterisk.dyndns.org >> sendmail.cf. Substitute the actual domain name of your Asterisk server for asterisk.dyndns.org, but be sure it's preceded by CG with no intervening spaces.Then restart SendMail on your server and try again: /etc/rc.d/init.d/sendmail restart. Finally, if your ISP doesn't permit downstream mail servers (that's you), then take a look at this link which will show you how to designate your ISP as your SMTP smart host using SendMail.
Activating the Nerd Vittles Weather Forecasts in TrixBox. TrixBox now includes the Flite text-to-speech engine as well as the Nerd Vittles weather forecasting system. To use it, just dial 611 from a phone on your system and enter a 3-character airport code to retrieve the weather forecast. We now support about 50 airports. In our next installment, that will be expanded to 1,000 so stay tuned. For complete instructions, read our original article.
Creating Wakeup Calls in TrixBox. To set up a wakeup call from any extension, dial *62 and enter a two-digit hour and two-digit minute for the wakeup call.
Determining the Extension Number of Any Phone on Your TrixBox System. To determine the extension number of any phone on your system, dial *65 from that extension.
Retrieving VoiceMail from Any Phone With TrixBox. To retrieve voicemail for any extension, dial *98 and enter the voicemail extension number. When prompted, enter the password for that account. To retrieve voicemail for the extension from which you are calling, dial *97 and enter the password for the account when prompted. You can also set your voicemail defaults and record your voicemail greetings using these options.
Useful Functions on Your TrixBox System. Here's the complete list of functions that will work out of the box from any extension on your TrixBox system:
Well, that should get you started. We'll tackle the gee whiz features in TrixBox and freePBX in our next article so visit us again soon. In the meantime ...
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!
Some Recent Nerd Vittles Articles of Interest...
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:
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!