Home » Search results for 'sip uri' (Page 50)

Search Results for: sip uri

The Most Versatile VoIP Provider: FREE PORTING

Asterisk on Steroids: PBX in a Flash Turns 21

In honor of the 21st birthday of PBX in a Flash, we are proud to introduce version 1.1. Yep, PBX in a Flash turns 21 today. That’s 21 as in days old. Joe Roper and Tom King have put together a special birthday bundle for you. On the ISO side, we have a new version 1.1. It still relies upon CentOS 5 which is extremely stable. And, yes, we know that CentOS 5.1 has just been released. If you’ve been following along the last few weeks, then you already know that the PBX in a Flash design is different. You don’t get the kitchen sink in the ISO. Instead you get a rock-solid base operating system on which to build your Internet telephony server. When your server reboots after installation of the ISO, we then download a payload file that compiles Asterisk®, installs FreePBX, and puts you in business. For anything else you choose to add, simply download and run a script. The design theory is simple: No Bloatware and No Bugs!

Update: Much has happened in the 2+ years since this article was first published. If you’re just getting started with Asterisk and VoIP telephony, please take a look at our most recent article for the latest and greatest. Thanks for visiting. –wm

Today we’re proud to introduce the 1.1 release of PBX in a Flash for Linux, Windows, and Macs. It’s a lean, mean Asterisk machine designed to meet the needs of hobbyists as well as business users. And there’s nothing "beta" about PBX in a Flash. That explains why we’re averaging over 1,000 downloads of the ISO per day. So now we have invested 3 weeks in development and 3 weeks in production. Give it a try and see what you’ve been missing. Text-to-speech works, Bluetooth works, the platform is open, the install scripts are available for your use and modification. And PBX in a Flash is rock-solid reliable on Day 21 for a production environment.

For the early adopters, there’s always the question, "Should I upgrade?" Well, the answer is "No." If you’ve added the additional sound files and applied the two-line tweak to get rid of our one and only bug, you’ve already got a near perfect system. Here’s the link to read about any reported bugs. This version does add Asterisk 1.4.15, but the security fixes won’t affect you unless you’re using Postgres with Asterisk. And you can always upgrade Asterisk independently. Keep reading to see how easy it is! For the complete list of additions, see this message thread on the Nerd Vittles Forum.

That’s just half of the story for this birthday bash, of course. While Joe Roper has been tweaking the ISO and payload files to get them just about perfect, Tom King has been turning out some unbelievable scripts for PBX in a Flash. Take a tour of the PBX in a Flash Script Site. You won’t be disappointed. Ever wrestled with updating Asterisk on another all-in-one system? Then you know what an absolute nightmare it used to be. Not any more! Tom’s new Update Source script gets you the latest and greatest version of Asterisk any time you want it. In fact, you can download the script and use it over and over. It will always download, compile, and install the latest version of Asterisk on your PBX in a Flash system, and you’ll be back in business in about 15 minutes. And, if you’re like us, the #1 Missing Component in every other Asterisk implementation has been a way to make a mirror-image backup of your whole system that can be easily restored when there’s a system failure. There’s nothing quite like building a new PBX from scratch when your entire company has lost their phone service. Well, worry no more. Those days are behind you. For PBX in a Flash systems only, there now is a Full Backup Script that builds you a mirror image of your system in ISO format on a collection of CDs or DVDs, or on a separate USB drive, or on a Windows share, or on a remote FTP site. Your choice! And, when the dreaded day arrives, replace the failed component and boot up from the rescue disk and, presto, you’re back in business.

So, if you’re new to PBX in a Flash, keep reading. Otherwise, stop here and check back next week when we’ll begin the transition of all our previous Nerd Vittles applications to PBX in a Flash.

As mentioned above, our design model differs from other Asterisk implementations. The .iso download gives you a rock-solid CentOS 5 Linux implementation which is designed for installation on a dedicated machine. Yes, your hard disk will be erased. Once Linux is installed, the system will reboot and fetch the latest, greatest collection of add-on’s. Once the install completes, you’ll have a high-performance turnkey Asterisk PBX that’s easy to upgrade with a simple migration path to either managed PBX service or hosted PBX service. You never have to migrate if you don’t want to, and the stand-alone product will always have virtually identical functionality minus the peace of mind that comes with managed or hosted PBX service. In short, the stand-alone product isn’t ever going to be crippleware to entice you to migrate. We’ll have more about the managed and hosted options in coming weeks. There also will be a script shortly to transform your system from a solid, lean run-time system into an Asterisk development platform. In the meantime, PBX in a Flash includes Asterisk 1.4.15, FreePBX 2.3.1, Apache, MySQL, PHP, phpMyAdmin, SendMail, Perl, Flite, and much more. You also can choose from dozens of upcoming scripts to add all of the Nerd Vittles goodie bag: AsteriDex, Weather Reports, News Feeds, Email by Phone, TeleYapper, Telephone Reminders, Podcasts by Phone, and on and on. There will also be fax support, turnkey phone scripts, hosting providers with free DIDs and minutes to get you started, and lots of new stuff from developers who already are working on compatible add-on’s. You add features when you need additional functionality. Otherwise, you skip the bloatware. And you can add your own feature requests to the growing Wish List on the Nerd Vittles Forum. Visit today and sign up. Just like everything else at Nerd Vittles, it won’t cost you a dime.

For those that don’t have a dedicated Linux machine, we’ve got a VMware version of PBX in a Flash for you today as well. It’ll run on almost any fairly new Windows XP or Vista Desktop as a virtual Linux server. You can even run it as a virtual machine on a Linux desktop. Just download and install the free VMware Player. For Mac users, you’ll have to buy and install VMware Fusion. Then download and unzip pbxinaflash.zip (4K) into C:\pbxinaflash. The directory name is important, or nothing will work! Next, download the pbxinaflash.iso into C:\pbxinaflash from your favorite download site. Now open Windows Explorer and double-click on the .vmx file in your C:\pbxinaflash folder. And presto! You’ve got a PBX in a Flash… about 30 minutes to be exact. That wasn’t too hard, was it?

For those with a dedicated Linux machine, our goal today is to get everyone off on the right foot with a clean, reliable install. If you have problems with the install or spot a bug, post your questions and suggestions on the Nerd Vittles Forum. We can’t stress strongly enough that this is a collaborative adventure, and you are cordially invited to participate as not only a user but also a contributor. Whether that contribution takes the form of developing scripts or merely contributing bandwidth for .iso downloads, all of us will appreciate your efforts! Nerd Vittles hosts the payload files, the blog, and the message forum. Tom King hosts the PBX in a Flash script collection. And a group of terrific Nerd Vittles supporters now host all of the free ISO downloads. All ISO images include a checksum to make it easy for you to verify that you have The Real McCoy. At the initial installation prompt, you also can type linux mediacheck and press the <Enter> key to verify that you have a reliable CD. The size of the 1.1 ISO image is 678,385,664 bytes. And the MD5 checksum is 058a25fe23b7d1dc4265a2de2e28d8db.

Download Tips. We want to apologize for the difficulties some of you are experiencing downloading our new baby. There are LOTS of you! We are averaging over 1,000 downloads a day so, if at all possible, please use BitTorrent. It’s actually faster. Many have reported download times of under 15 minutes! In fairness to everyone, we have taken the following steps to improve the reliability of the install process. We now have six free download sites in operation with more to come. You also can obtain a free torrent as well as the VMware modules and install scripts from pbxinaflash.net and most of the other sites. If all of the free download sites are busy, we have put up a pay-as-you-go download site as well. The way this works is that you pay $5 with a credit card to download the ISO. You then can email the link to a friend who pays nothing for the download. When that friend releases the link that is provided, you can give it to another friend at no cost. Only the original download is not free, but it is dirt cheap and provides lots of backup bandwidth. So, if you get in a crunch, spring for the $5. Otherwise, check back at a different time of day and try again. Or better yet, use the torrent. The more torrents that are seeded, the easier this will be for everyone.

Getting Started with PBX in a Flash. Just like all the other offerings, you need to begin this adventure by downloading the ISO image for PBX in a Flash (646.96 MB). As new locations for ISO downloads come on line, we will add them to the download list. Just click on the location nearest to you. Once you’ve got the image in hand, use your favorite tool to burn it to a bootable CD. You’re going to need a dedicated PC for this installation unless you’re using VMware to run PBX in a Flash on your Windows or Mac desktop. A current PC in the $200-$300 price range from your favorite Big Box store should perform nicely as a dedicated Linux machine. We recommend at least 512MB of RAM and more won’t hurt. And, remember, your hard disk will first be erased by this install. You’ve been warned… twice.

On the machine you wish to use for your new PBX in a Flash system, insert the CD containing the pbxinaflash.iso and then reboot. After reading the initial prompts and warnings, press the Enter key to begin the installation. Or, if you want to first check the media for corruption, type linux mediacheck and then press the <Enter> key. For Windows users, be sure you’re doing this in the VMware window on your Desktop and not on the main screen of your PC! Erase the existing partition and accept the default for the partition layout when prompted. Then choose your time zone and leave the UTC system clock option unchecked. Next choose a root password for your new system. Make it secure, and write it down. We plan to use this password for virtually everything on your new system. The install process begins. This includes MySQL, Apache, PHP, CUPS, Samba, WebMin, Subversion, SendMail, Yum, Bluetooth support, SSL, Perl, Python, the kernel development package, and much more. In about 15 minutes depending upon the speed of your PC, the install will pause to allow you to eject the CD. Click the Proceed button to continue. After reboot, the system will start up with CentOS 5, then download and install Asterisk and FreePBX, and search for the necessary installation script and payload file on pbxinaflash.net. If you don’t have Internet connectivity, then the installation cannot complete. When the installation finishes, reboot your system and log in as root. The IP address of your PBX in a Flash system will also be displayed once you log in. Write it down, too. We’ll need it in a minute.

Now that you’ve logged in as root, you should see the IP address displayed with the following command prompt: root@pbx:~/. If instead you see bash displayed as the command prompt and it’s not green, then the installation has not completed successfully. This is probably due to network problems but also could be caused by the time being set incorrectly on your server. You can’t compile Asterisk if the time on your computer is a date in the past! For this glitch you have to start over. If it’s a network issue, fix it and then reboot and watch for the eth0 connection to complete. Assuming it doesn’t fail the second time around, the installation will continue. Likewise, if you do not have DHCP on your network, the installation will fail because the PBX will not be given an IP address. Simply type netconfig, fill in the blanks and reboot. The install will recommence. You can obtain the IP address of your server at any time by issuing the ifconfig command.

Required Steps to Complete the Install. There are three important things to do to complete the installation. First, from the command prompt, run genzaptelconf. This sets up your ZAP hardware as well as a timing source for conferencing. Second, decide how to handle the IP address for your PBX in a Flash server. The default is DHCP, but you don’t want the IP address of your PBX changing. Phones and phone calls need to know how to find your PBX, and if your internal IP address changes because of DHCP, that’s a problem. You have two choices. Either set your router to always hand out the same DHCP address to your PBX in a Flash server by specifying its MAC address in the reserved IP address table of your router, or run netconfig at the command prompt and assign a permanent IP address to your server. If you experience problems with the process, see this message thread on the forum. The third configuration requirement probably accounts for more beginner problems with Asterisk systems than everything else combined. Read the next section carefully and do it now!

Getting Rid of One-Way Audio. There are some settings you’ll need to add to /etc/asterisk/sip_custom.conf if you want to have reliable, two-way communications with Asterisk: nano -w /etc/asterisk/sip_custom.conf. The entries depend upon whether your Internet connection has a fixed IP address or a DHCP address issued by your provider. In the latter case, you also need to configure your router to support Dynamic DNS (DDNS) using a service such as dyndns.org. If you have a fixed IP address, then enter settings like the following using your actual public IP address and your private IP subnet:

externip=180.12.12.12
localnet=192.168.1.0/255.255.255.0      (NOTE: The first 3 octets need to match your private IP addresses!)

If you have a public address that changes and you’re using DDNS, then the settings would look something like the following:

externhost=myserver.dyndns.org
localnet=192.168.0.0/255.255.255.0      (NOTE: The first 3 octets need to match your private IP addresses!)

Once you’ve made your entries, save the file: Ctrl-X, Y, then Enter. Reload Asterisk: amportal restart. If you assigned a permanent IP address, reboot your server: shutdown -r now.

Activating Email Delivery of Voicemail Messages. We’ve previously shown how to configure systems to reliably deliver email messages whenever a voicemail arrives unless your ISP happens to block downstream SMTP mail servers. Here’s the link in case you need it. As it happens, you really don’t have to use a real fully-qualified domain name to get this working. So long as the entry (such as pbx.dyndns.org) is inserted in both the /etc/hosts file and /etc/asterisk/vm_general.inc with a matching servermail entry of vm@pbx.dyndns.org (as explained in the link above), your system will reliably send emails to you whenever you get a voicemail if you configure your extensions in freePBX to support this capability. You can, of course, put in real host entries if you prefer. For 90% of the systems around the world, if you just want your server to reliably e-mail you your voicemail messages, make line 3 of /etc/hosts look like this with a tab after 127.0.0.1 and spaces between the domain names:

127.0.0.1     pbx.dyndns.org pbx.local pbx localhost.localdomain localhost

And then make line 6 of /etc/asterisk/vm_general.inc look like the following:

serveremail=voicemail@pbx.dyndns.org

Now issue the following two commands to make the changes take effect:

service network restart
amportal restart

The command "setup-mail" can be used from the Linux prompt to set the fully-qualified domain name (FQDN) of the mail that is sent out from your server. This may help mail to be delivered from the PBX. One of things mail servers do to reduce spam is to do a reverse lookup on where the mail has come from, checking that there is actually a mailserver at the other end. You can only do this if you have set up dynamic DNS or if you have pointed a hostname at your fixed IP address. Once you have done this, and assuming your ISP is cooperative, then you will receive your voicemails via email if you wish (this is set within FreePBX),and your PBX will email you when FreePBX needs an update. You set this feature in FreePBX General Settings.

If your hosting provider blocks downstream SMTP servers to reduce spam, here’s a link on the PBX in a Flash forum to get you squared away.

Setting Passwords and Other Stuff. While logged into your server as root, you can configure many of the ‘lesser’ passwords on your system (i.e. those passwords with less than root privileges) as well as phones, ZAP hardware, and other goodies. The only command you have to remember is help-pbx. Be aware that there are four different usernames and passwords that are enforced in the web interface to your PBX:

maint... to go everywhere
wwwadmin... for users needing FOP and MeetMe access
meetme... for users needing only MeetMe access
FreePBX... default username:password for admin access is admin:admin

Configuring WebMin. WebMin is the Swiss Army Knife of Linux. It provides TOTAL access to your system through a web interface. Search Nerd Vittles for webmin if you want more information. Be very careful if you decide to enable it on the public Internet. You do this by opening port 9001 on your router and pointing it to the private IP address of your PBX in a Flash server. Before using WebMin, you need to set up a username and password for access. From the Linux prompt while logged in as root, type the following command where admin is the username you wish to set up and foo is the password you’ve chosen for the admininstrator account. HINT: Don’t use admin and foo as your username and password for WebMin unless you want your server trashed!

/usr/libexec/webmin/changepass.pl /etc/webmin admin foo

To access WebMin on your private network, go to http://192.168.0.123:9001 where 192.168.0.123 is the private IP address of your PBX in a Flash server. Then type the username and password you assigned above to gain entry. To stop WebMin: /etc/webmin/stop. To start WebMin: /etc/webmin/start. For complete documentation, go here.

Updating and Configuring FreePBX. FreePBX is installed as part of the PBX in a Flash implementation. This incredible, web-based tool provides a complete menu-driven user interface to Asterisk. The entire FreePBX project is a model of how open source development projects ought to work. And having Philippe Lindheimer’s as the Captain of the Ship is just icing on the cake. All it takes to get started with FreePBX is a few minutes of configuration, and you’ll have a functioning Asterisk PBX complete with voicemail, music on hold, call forwarding, and a powerful interactive voice response (IVR) system. There is excellent documentation for FreePBX which you should read at your earliest convenience. It will answer 99% of your questions about how to use and configure FreePBX. For the one percent that is not covered in the Guide, visit the FreePBX Forums which are frequented regularly by the FreePBX developers. Kindly post FreePBX questions on their forum rather than the PBX-in-a-Flash Forum. This helps everybody. Now let’s get started.

NOTE: PBX in a Flash comes with the IPtables firewall enabled on your system. If this causes problems with access to the FreePBX repository (for loading the FreePBX updates below), you can easily (and temporarily) turn off the firewall. Type help-pbx for assistance. Don’t forget to restart the firewall especially if your system has any Internet exposure!

Now move to a PC or Mac and, using your favorite web browser, go to the IP address you deciphered above for your new server. Be aware that FreePBX has a difficult time displaying properly with IE6 and IE7 and regularly blows up with older versions of Safari. Be safe. Use Firefox. From the PBX in a Flash Main Menu in your web browser, click on the Administration link and then click the FreePBX button. The username and password both default to admin. Click Apply Configuration Changes, Continue with Reload, and then Refresh your browser screen. Now click the Module Administration option in the left frame once FreePBX loads. Now click Check for Updates online in the upper right panel. Next, click Download All which will select every module for download and install. The important step here is to move down the list and Deselect Speed Dials and PHPAGI from the download and install options. You may also want to deselect Zork. Once these apps have been deselected, scroll to the bottom of the page and click Process, then Confirm, then Return once the apps are downloaded and installed, then Apply, then Continue with Reload. Now repeat the process once more and do not deselect the two applications, then Process, Confirm, Return, Apply Config Changes, and Continue with Reload. Finally, scroll down the Modules listing until you get to the Maintenance section. Click on each of the following and choose Install: ConfigEdit, Sys Info, and phpMyAdmin. Then click Process, then Confirm, then Return once the apps are downloaded and installed, then Apply, then Continue with Reload. All three of these tools now are installed in the Maintenance section of the Tools tab of FreePBX. One final step, and you’re good to go. An update of FreePBX has been released. Click Check for Updates online. Then choose Download and Upgrade for the Core, FreePBX Framework, and System Dashboard modules. Then click Process, then Confirm, then Return once the apps are downloaded and installed, then Apply, then Continue with Reload. You now have an up-to-date version of FreePBX. You’ll need to repeat the drill every few weeks as new updates are released. This will assure that you have all of the latest and greatest software. To change your Admin password, click on the Setup tab in the left frame, then click Administrators, then Admin in the far right column, enter a new password, and click Submit Changes, Apply Configuration Changes, and Continue with reload. We’re going to be repeating this process a number of times in the next section so… when instructed to Save Your Changes, that means "click Submit Changes, Apply Configuration Changes, and Continue with reload."

Choosing Internet Telephony Hosting Providers for Your System. Before you can place calls to users outside your system or to receive incoming calls, you’ll need at least one provider (each) for your incoming phone number (DID) and incoming calls as well as a provider for your outbound calls (terminations). We have a list of some of our favorites here, and there are many, many others. Within a few weeks, we also will have some providers that will offer you some free minutes for trying their service with PBX in a Flash. You basically have two choices with most providers. You can either pay as you go or sign up for an all-you-can-eat plan. Most of the latter plans also have caps on minutes, and there are none of the latter plans for business service. In the U.S. market, the going rate for pay as you go service is about 1.5¢ per minute rounded to the tenth of a minute. The best deal on DIDs is from les.net. They charge $3.99 a month for a DID with unlimited, free incoming calls. We will have a free offer from les.net for PBX in a Flash users shortly. Another new provider with excellent service and per minute rates is Aretta Communications out of Atlanta. They also have agreed to co-host our ISO downloads for the U.S. East Coast. Thanks, Aretta! WARNING: Before you sign up for any all-you-can-eat plan, do some reading about the service providers. Some of them are real scam artists with backbilling and all sorts of unconscionable restrictions. You need to be careful. Our cardinal rule in the VoIP Wild West is never, ever entrust your entire PBX to a single hosting provider. As Forrest Gump would say, "Stuff happens!" And life’s too short to have dead telephones, even if it’s a rarity.

Setting Up FreePBX to Make Your First Call. There are four components in FreePBX that need to be configured before you can place a call or receive one from outside your PBX in a Flash system. So here’s FreePBX for Dummies in less than 50 words. You need to configure Trunks, Extensions, Outbound Routes, and Inbound Routes. Trunks are hosting provider specifications that get calls delivered to and transported from your PBX to the rest of the world. Extensions are internal numbers on your PBX that connect your PBX to telephone hardware or softphones. Inbound Routes specify what should be done with calls coming in on a Trunk. Outbound Routes specify what should be done with calls going out to a Trunk. Everything else is basically fluff.

Trunks. When you sign up with most of the better ITHP’s that support Asterisk, they will provide documentation on how to connect their service with your Asterisk system. If they have a trixbox tutorial, use that since it also used FreePBX as the web front end to Asterisk. Here’s an example from les.net. And here’s the Vitelity support page although you will need to set up an account before you can access it. We also have covered the setups for a number of providers in previous articles. Just search the Nerd Vittles site for the name of the provider you wish to use. You’ll also find many Trunk setups in the trixbox Trunk Forum. Once you find the setup for your provider, add it in FreePBX by going to Setup, Trunks, Add SIP Trunk. Our AxVoice setup (which is all entered in the Outgoing section with a label of axvoice) looks like this with a Registration String of yourusername:yourpassword@sip.axvoice.com:

allow=ulaw
authname=yourusername
canreinvite=no
context=all-incoming
defaultip=sip.axvoice.com
disallow=all
dtmfmode=inband
fromdomain=sip.axvoice.com
fromuser=yourusername
host=sip.axvoice.com
insecure=very
nat=yes
secret=yourpassword
type=friend
user=phone
username=yourusername

And our Vitelity Outbound Trunk looks like the following (labeled vitel-outbound) with no registration string:

allow=ulaw&gsm
canreinvite=no
context=from-pstn
disallow=all
fromuser=yourusername
host=outbound1.vitelity.net
secret=yourpassword
sendrpid=yes
trustrpid=yes
type=friend
username=yourusername

Extensions. Now let’s set up a couple of Extensions to get you started. A good rule of thumb for systems with less than 50 extensions is to reserve the IP addresses from 192.x.x.201 to 192.x.x.250 for your phones. Then you can create extension numbers in FreePBX to match those IP addresses. This makes it easy to identify which phone on your system goes with which IP address and makes it easy for end-users to access the phone’s GUI to add bells and whistles. To create extension 201 (don’t start with 200), click Setup, Extensions, Generic SIP Device, Submit. Then fill in the following blanks leaving the defaults in the other fields for the time being.

User Extension ... 201
Display Name ... Home
Outbound CID ... [your 10-digit phone number if you have one; otherwise, leave blank]
Emergency CID ... [your 10-digit phone number for 911 ID if you have one; otherwise, leave blank]
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

Now create several more extensions using the template above: 202, 203, 204, and 205 would be a good start. Keep the passwords simple. You’ll need them whenever you configure your phone instruments.

Outbound Routes. The idea behind multiple outbound routes is to save money. Some providers are cheaper to some places than others. We’re going to skip that tutorial today. You can search the site for lots of information on choosing providers. Assuming you have only one or two for starters, let’s just set up a default outbound route for all your calls. Using your web browser, access FreePBX on your server and click Setup, Outbound Routes. Enter a route name of Everything. Enter the dial patterns for your outbound calls. In the U.S., you’d enter something like the following:

1NXXNXXXXXX
NXXNXXXXXX

Click on the Trunk Sequence pull-down and choose your providers in the order you’d like them to be used for outbound calls.Click Submit Changes and then save your changes. Note that a second choice in trunk sequence only gets used if the calls fails to go through using your first choice. You’ll notice there’s already a 9_outside route which we don’t need. Click on it and then choose Delete Route 9_outside. Save your changes.

Inbound Routes. We’re also going to abbreviate the inbound routes tutorial just to get you going quickly today. The idea here is that you can have multiple DIDs (phone numbers) that get routed to different extensions or ring groups or departments. For today, we recommend you first build a Ring Group with all of the extension numbers you have created. Once you’ve done that, choose Inbound Routes, leave all of the settings at their default values and move to the Set Destination section and choose your Ring Group as the destination. Now click Submit and save your changes. That will set up a default incoming route for your calls. As you add bells and whistles to your system, you can move the Default Route down the list of priorities so that it only catches calls that aren’t processed with other inbound routing rules.

General Settings. Last, but not least, we need to enter an email address for you so that you are notified when new FreePBX updates are released. Scroll to the bottom of the General Settings screen after selecting it from the left panel. Plug in your email address, click Submit, and save your changes. Done!

Tom King now has put together a detailed tutorial complete with screenshots to get you started with PBX in a Flash. If you are installation-challenged, have a look at the pretty pictures.

Adding Plain Old Phones. Before your new PBX will be of much use, you’re going to need something to make and receive calls, i.e. a telephone. For today, you’ve got several choices: a POTS phone, a softphone, or a SIP phone. Option #1 and the best home solution is to use a Plain Old Telephone or your favorite cordless phone set (with 8-10 extensions) if you purchase a little device (the size of a pack if cigs) known as a Sipura SPA-1001. It’s under $60. Be sure you specify that you want an unlocked device, meaning it doesn’t force you to use a particular service provider. Once you get it, plug the SPA-1001 into your LAN, and then plug your phone instrument into the SPA-1001. Your router will hand out a private IP address for the SPA-1001 to talk on your network. You’ll need the IP address of the SPA-1001 in order to configure it to work with Asterisk. After you connect the device to your network and a phone to the device, pick up the phone and dial ****. At the voice prompt, dial 110#. The Sipura will tell you its DHCP-assigned IP address. Write it down and then access the configuration utility by pointing your web browser to that IP address.

Once the configuration utility displays in your web browser, click Admin Login and then Advanced in the upper right corner of the web page. When the page reloads, click the Line1 tab. Scroll down the screen to the Proxy field in the Proxy and Registration section of the form. Type in the private IP address of your Asterisk system which you wrote down previously. Be sure the Register field is set to Yes and then move to the Subscriber Information section of the form. Assuming your extensions were set up starting with 201, do the following. Enter House Phone as the Display Name. Enter 201 as the User ID. Enter 1234 as the Password, and set Use Auth ID to No. Click the Submit All Changes button and wait for your Sipura to reset. In the Line 1 Status section of the Info tab, your device should show that it’s Registered. You’re done. Pick up the phone and dial 1234# to test it out.

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 another great SIP/IAX softphone for all platforms that’s great, too, and it requires no installation: Zoiper 2.0 (formerly IDEfisk). All are free! Just install and then configure with the IP address of your PBX in a Flash server. For username and password, use one of the extension numbers and passwords which you set up 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 (but probably not the best sound quality) is the $79 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. Some other great choices are the Aastra 9133i and the Siemans Cordless Dect phone. Do some reading before you buy. The Voxilla forums are a good place to start.

A Word About Ports. For the techies out there that want "the rest of the story" to properly configure firewalls, here’s a list of the ports available and used by PBX in a Flash:

TCP 80 - HTTP
TCP 9080 - Duplicate HTTP
TCP 22 - SSH
TCP 9022 - Duplicate SSH
TCP 9001 - WebMin
UDP 10000-20000 - RTP
UDP 5004-5082 - SIP
UDP 4569 - IAX2
UDP 2727 - Media Gateway

A2Billing Installation. Our first example of how we plan to build up PBX in a Flash systems is the installation script for A2Billing. If you want A2Billing installed on your system, then log in as root and type install-a2billing. If you don’t want A2Billing, then you don’t download or run the script. When you return to the main web page for your server after installing A2Billing, you will have two new links for A2Billing customers and A2Billing admin. You will have to install the callback funtionality manually from the docs supplied in the install. A2Billing was created by Areski, who some of you may know was responsible for Web MeetMe, ConfigEdit, and the CDR reports included with FreePBX. A2Billing is sufficiently comprehensive that it warrants an article on its own, so we will save that for another day. Some of the projects we will be looking into are how to pass calls from FreePBX to A2Billing for least-cost routing, departmental billing services, building a calling card server, and a VoIP termination platform. Then you can change your name to Ma Bell and start selling minutes to all the people for whom you have installed PBX-in-a-Flash. If you can’t wait, visit asterisk2billing.org.

Where To Go From Here. Our new script repository is now up and running at pbxinaflash.org. Tom King, the ultimate scripting guru is managing that site. So check it often. And now that PBX in a Flash 1.1 is out the door, we’re chomping at the bit to get all of the Nerd Vittles Goodies ported over. If you want to try one yourself, start with Weather by Airport Code which installs in under 5 minutes. Put your dialplan code in extensions_custom.conf, and be sure to heed the Asterisk 1.4 mod which is explained in the article. Hold off on AsteriDex because we have an updated version of that one for you within the next few weeks. If you still have a DBT-120 Bluetooth adapter, you’ll be happy to learn that it works out-of-the-box with both the Linux and Windows versions of PBX in a Flash. Dust off our two-year old articles on Proximity Detection and see if you can’t configure your system to transfer your phone calls to your cellphone when you leave the house carrying your Bluetooth cellphone. If not, we’ll walk you through it with an iPhone in coming weeks. Now spend some time reading up on FreePBX and enjoy your new toy. Santa came early this year!

Bug Fixes. We’re back down to zero bugs with PBX-in-a-Flash 1.1, but we wanted to provide a way to report them and to address them. So there’s a new PBX-in-a-Flash forum dedicated to bug reporting and fixes. Be sure to visit once in a while just to keep your system current.


Some Recent Nerd Vittles Articles of Interest…

Introducing PBX in a Flash: The Lean, Mean Asterisk Machine

Well, it's Hammer Time at Nerd Vittles, time to put up or shut up. And we've never been accused of being a wallflower. If you've longed for the good ol' days of Asterisk@Home, welcome back to the new steroid-enhanced version. Today we're proud to introduce the first release of PBX in a Flash for Linux, Windows, and Macs. It's a lean, mean Asterisk® machine designed to meet the needs of hobbyists as well as business users. And you won't find the word "beta" in the rest of this article. Our extra special thanks go to Joe Roper, Tom King, and Tony Vincent for their untiring efforts in moving this project from a dream to reality. Just measure the 3 weeks of development work in this project against the years in some other projects, and you will have a good idea about the incredible contribution these guys have made! Nothing's ever perfect, but this is a good one folks. And you need to give it a try to see what we've all been missing this past year. Text-to-speech works, Bluetooth works, the platform is open, the install scripts are available for your use. We believe it is sufficiently reliable on Day 1 for a production environment. It may be two weeks past Halloween, but this is a real treat!

UPDATE: This article now qualifies as ancient. Click here for the latest and greatest.

Our design model differs from other Asterisk implementations. The .iso download gives you a rock-solid CentOS 5 Linux implementation which is designed for installation on a dedicated machine. Yes, your hard disk will be erased. Once Linux is installed, the system will reboot and fetch the latest, greatest collection of add-on's. Once the install completes, you'll have a high-performance turnkey Asterisk PBX that's easy to upgrade with a simple migration path to either managed PBX service or hosted PBX service. You never have to migrate if you don't want to, and the stand-alone product will always have virtually identical functionality minus the peace of mind that comes with managed or hosted PBX service. In short, the stand-alone product isn't ever going to be crippleware to entice you to migrate. We'll have more about the managed and hosted options in coming weeks. There also will be a script shortly to transform your system from a solid, lean run-time system into an Asterisk development platform. In the meantime, PBX in a Flash includes Asterisk 1.4.13, FreePBX 2.3.1, Apache, MySQL, PHP, phpMyAdmin, SendMail, Perl, Flite, and much more. Once we're sure we have a stable base platform (and we're pretty sure!), you'll be able to choose from dozens (if not hundreds) of scripts to add all of the Nerd Vittles goodie bag: AsteriDex, Weather Reports, News Feeds, Email by Phone, TeleYapper, Telephone Reminders, Podcasts by Phone, and on and on. There will also be fax support, turnkey phone scripts, hosting providers with free DIDs and minutes to get you started, and loads of new stuff from developers who already are working on compatible add-on's. You add features when you need additional functionality. Otherwise, you skip the bloatware. And you can add your own feature requests to the growing Wish List on the Nerd Vittles Forum. Visit today and sign up. Just like everything else at Nerd Vittles, it won't cost you a dime.

For those that don't have a dedicated Linux machine, we've got a VMware version of PBX in a Flash for you today as well. It'll run on almost any fairly new Windows XP or Vista Desktop as a virtual Linux server. Just download and install the free VMware Player. For Mac users, you'll have to buy and install VMware Fusion. Then download and unzip pbxinaflash.zip (4K) into C:\pbxinaflash. The directory name is important, or nothing will work! Next, download the pbxinaflash.iso into C:\pbxinaflash from your favorite download site. Now open Windows Explorer and double-click on the .vmx file in your C:\pbxinaflash folder. And presto! You've got a PBX in a Flash... about 30 minutes to be exact. That wasn't too hard, was it?

For those with a dedicated Linux machine, our goal today is to get everyone off on the right foot with a clean, reliable install. If you have problems with the install or spot a bug, post your questions and suggestions on the Nerd Vittles Forum. We can't stress strongly enough that this is a collaborative adventure, and you are cordially invited to participate as not only a user but also a contributor. Whether that contribution takes the form of developing scripts or merely contributing bandwidth for .iso downloads, all of us will appreciate your efforts! Nerd Vittles is donating the first ten terabytes of download bandwidth each month. After that, we need some help. Send us an email with your location if you would be willing to co-host the pbxinaflash.iso. Money donations through the PayPal link at the top of this page also buy bandwidth. We average over 50,000 visitors a week so we're going to need some help to keep the lights on. Ultimately, we hope to let others host the ISO downloads. That will free up our bandwidth to maintain and host the PBX in a Flash script collection. All ISO images will include a checksum to make it easy for you to verify that you have The Real McCoy. At the initial installation prompt, simply type linux mediacheck and press the <Enter> key. The size of the ISO image is 658,966,528 bytes.

Our Apologies. We want to apologize for the difficulties some of you are experiencing downloading our new baby. Apparently, a few others are equally excited about its release. Here's the problem. There are LOTS of you! Our download site, pbxinaflash.net, originally was used not only for ISO downloads, but it also provided the VMware modules and install scripts that bring PBX in a Flash to life for everybody. Without access to pbxinaflash.net, no one could complete the install process. Because of the hammering the site was taking with all of the huge ISO downloads, it meant that even those that got the ISO could not complete the install because, by then, they probably lost access to the site. Don't worry. You can reboot later to finish the installation. In fairness to everyone, we took the following steps. We now have five download sites in operation with more to come. You also can obtain a free torrent as well as the VMware modules and install scripts from pbxinaflash.net and most of the other sites. If all of the free download sites are busy, we have put up a pay-as-you-go download site as well. The way this works is that you pay $5 with a credit card to download the ISO. You then can email the link to a friend who pays nothing for the download. When that friend releases the link that is provided, you can give it to another friend at no cost. Only the original download is not free, but it is dirt cheap and provides lots of backup bandwidth. So, if you get in a crunch, spring for the $5. Otherwise, check back at a different time of day and try again. Or better yet, use the torrent. You'll have it by morning. The more torrents that are seeded, the easier this will be for everyone during the mad rush. Our apologies!!

Getting Started with PBX in a Flash. Just like all the other offerings, you need to begin this adventure by downloading the ISO image for PBX in a Flash (628.44 MB). As new locations for ISO downloads come on line, we will add them to the download list. Just click on the location nearest to you. Once you've got the image in hand, use your favorite tool to burn it to a bootable CD. You're going to need a dedicated PC for this installation unless you're using VMware to run PBX in a Flash on your Windows or Mac desktop. A current PC in the $200-$300 price range from your favorite Big Box store should perform nicely as a dedicated Linux machine. We recommend at least 512MB of RAM and more won't hurt. And, remember, your hard disk will first be erased by this install. You've been warned... twice.

On the machine you wish to use for your new PBX in a Flash system, insert the CD containing the pbxinaflash.iso and then reboot. After reading the initial prompts and warnings, press the Enter key to begin the installation. Or, if you want to first check the media for corruption, type linux mediacheck and then press the <Enter> key. For Windows users, be sure you're doing this in the VMware window on your Desktop and not on the main screen of your PC! Erase the existing partition and accept the default for the partition layout when prompted. Then choose your time zone and leave the UTC system clock option unchecked. Next choose a root password for your new system. Make it secure, and write it down. We plan to use this password for virtually everything on your new system. The install process begins. This includes MySQL, Apache, PHP, CUPS, Samba, WebMin, Subversion, SendMail, Yum, Bluetooth support, SSL, Perl, Python, the kernel development package, and much more. In about 15 minutes depending upon the speed of your PC, the system will reboot. Be sure you eject the CD, or it will get installed again, and again. HINT: Hang around your machine at about the 15 minute mark. After reboot, the system will start up with CentOS 5, then download and install Asterisk and FreePBX, and search for the necessary installation scripts in the /scripts folder on pbxinaflash.net. If you don't have Internet connectivity, then the installation cannot complete. When the installation finishes, reboot your system and log in as root. The IP address of your PBX in a Flash system will also be displayed once you log in. Write it down, too. We'll need it in a minute.

Now that you've logged in a root, you should see the IP address displayed with the following command prompt: root@pbx:~/. If instead you see bash displayed as the command prompt and it's not green, then the installation has not completed. This is probably due to network problems. Fix these, then reboot and watch for the eth0 connection to complete. Assuming it doesn't fail the second time around, the installation will continue. Likewise, if you do not have DHCP on your network, the installation will fail because the PBX will not be given an IP address. Simply type netconfig, fill in the blanks and reboot. The install will recommence. You can obtain the IP address of your server at any time by issuing the ifconfig command.

There are three important things to do to complete the installation. First, from the command prompt, run genzaptelconf. This sets up your ZAP hardware as well as a timing source for conferencing. Second, decide how to handle the IP address for your PBX in a Flash server. The default is DHCP, but you don't want the IP address of your PBX changing. Phones and phone calls need to know how to find your PBX, and if your internal IP address changes because of DHCP, that's a problem. You have two choices. Either set your router to always hand out the same DHCP address to your PBX in a Flash server by specifying its MAC address in the reserved IP address table of your router, or run netconfig at the command prompt and assign a permanent IP address to your server. If you experience problems with the process, see this message thread on the forum. The third configuration requirement probably accounts for more beginner problems with Asterisk systems than everything else combined. Read the next section carefully and do it now!

Getting Rid of One-Way Audio. There are some settings you'll need to add to /etc/asterisk/sip_custom.conf if you want to have reliable, two-way communications with Asterisk: nano -w /etc/astersk/sip_custom.conf. The entries depend upon whether your Internet connection has a fixed IP address or a DHCP address issued by your provider. In the latter case, you also need to configure your router to support Dynamic DNS (DDNS) using a service such as dyndns.org. If you have a fixed IP address, then enter settings like the following using your actual public IP address and your private IP subnet:

externip=180.12.12.12
localnet=192.168.1.0/255.255.255.0      (NOTE: The first 3 octets need to match your private IP addresses!)

If you have a public address that changes and you're using DDNS, then the settings would look something like the following:

externhost=myserver.dyndns.org
localnet=192.168.0.0/255.255.255.0      (NOTE: The first 3 octets need to match your private IP addresses!)

Once you've made your entries, save the file: Ctrl-X, Y, then Enter. Reload Asterisk: amportal restart. If you assigned a permanent IP address, reboot your server: shutdown -r now.

Activating Email Delivery of Voicemail Messages. We've previously shown how to configure systems to reliably deliver email messages whenever a voicemail arrives unless your ISP happens to block downstream SMTP mail servers. Here's the link in case you need it. As it happens, you really don't have to use a real fully-qualified domain name to get this working. So long as the entry (such as pbx.dyndns.org) is inserted in both the /etc/hosts file and /etc/asterisk/vm_general.inc with a matching servermail entry of vm@pbx.dyndns.org (as explained in the link above), your system will reliably send emails to you whenever you get a voicemail if you configure your extensions in freePBX to support this capability. You can, of course, put in real host entries if you prefer. For 90% of the systems around the world, if you just want your server to reliably e-mail you your voicemail messages, make line 3 of /etc/hosts look like this with a tab after 127.0.0.1 and spaces between the domain names:

127.0.0.1     pbx.dyndns.org pbx.local pbx localhost.localdomain localhost

And then make line 6 of /etc/asterisk/vm_general.inc look like the following:

serveremail=voicemail@pbx.dyndns.org

Now issue the following two commands to make the changes take effect:

service network restart
amportal restart

The command "setup-mail" can be used from the Linux prompt to set the fully-qualified domain name (FQDN) of the mail that is sent out from your server. This may help mail to be delivered from the PBX. One of things mail servers do to reduce spam is to do a reverse lookup on where the mail has come from, checking that there is actually a mailserver at the other end. You can only do this if you have set up dynamic DNS or if you have pointed a hostname at your fixed IP address. Once you have done this, and assuming your ISP is cooperative, then you will receive your voicemails via email if you wish (this is set within FreePBX),and your PBX will email you when FreePBX needs an update. You set this feature in FreePBX General Settings.

If your hosting provider blocks downstream SMTP servers to reduce spam, here's a link on the PBX in a Flash forum to get you squared away.

Setting Passwords and Other Stuff. While logged into your server as root, you can configure many of the 'lesser' passwords on your system (i.e. those passwords with less than root privileges) as well as phones, ZAP hardware, and other goodies. The only command you have to remember is help-pbx. Be aware that there are four different usernames and passwords that are enforced in the web interface to your PBX:

maint... to go everywhere
wwwadmin... for users needing FOP and MeetMe access
meetme... for users needing only MeetMe access
FreePBX... default username:password for admin access is admin:admin

There also is an Administration password which can be set in the KennonSoft UI which appears when you point a browser at the IP address of your server. Do NOT use the same Admin password here that you use elsewhere because this one is not overly secure.

Configuring WebMin. WebMin is the Swiss Army Knife of Linux. It provides TOTAL access to your system through a web interface. Search Nerd Vittles for webmin if you want more information. Be very careful if you decide to enable it on the public Internet. You do this by opening port 9001 on your router and pointing it to the private IP address of your PBX in a Flash server. Before using WebMin, you need to set up a username and password for access. From the Linux prompt while logged in as root, type the following command where admin is the username you wish to set up and foo is the password you've chosen for the admininstrator account. HINT: Don't use admin and foo as your username and password for WebMin unless you want your server trashed!

/usr/libexec/webmin/changepass.pl /etc/webmin admin foo

To access WebMin on your private network, go to http://192.168.0.123:9001 where 192.168.0.123 is the private IP address of your PBX in a Flash server. Then type the username and password you assigned above to gain entry. To stop WebMin: /etc/webmin/stop. To start WebMin: /etc/webmin/start. For complete documentation, go here.

Updating and Configuring FreePBX. FreePBX is installed as part of the PBX in a Flash implementation. This incredible, web-based tool provides a complete menu-driven user interface to Asterisk. The entire FreePBX project is a model of how open source development projects ought to work. And having Philippe Lindheimer's as the Captain of the Ship is just icing on the cake. All it takes to get started with FreePBX is a few minutes of configuration, and you'll have a functioning Asterisk PBX complete with voicemail, music on hold, call forwarding, and a powerful interactive voice response (IVR) system. There is excellent documentation for FreePBX which you should read at your earliest convenience. It will answer 99% of your questions about how to use and configure FreePBX. For the one percent that is not covered in the Guide, visit the FreePBX Forums which are frequented regularly by the FreePBX developers. Kindly post FreePBX questions on their forum rather than the PBX-in-a-Flash Forum. This helps everybody. Now let's get started.

NOTE: PBX in a Flash comes with the IPtables firewall enabled on your system. If this causes problems with access to the FreePBX repository (for loading the FreePBX updates below), you can easily (and temporarily) turn off the firewall. Type help-pbx for assistance. Don't forget to restart the firewall especially if your system has any Internet exposure!

Now move to a PC or Mac and, using your favorite web browser, go to the IP address you deciphered above for your new server. Be aware that FreePBX has a difficult time displaying properly with IE6 and IE7 and regularly blows up with older versions of Safari. Be safe; use Firefox. From the PBX in a Flash Main Menu in your web browser, click on the Administration link and then click the FreePBX button. The username and password both default to admin. Click Apply Configuration Changes, Continue with Reload, and then Refresh your browser screen. Now click the Module Administration option in the left frame once FreePBX loads. Now click Check for Updates online in the upper right panel. Next, click Download All which will select every module for download and install. The important step here is to move down the list and Deselect Speed Dials and PHPAGI from the download and install options. You may also want to deselect Zork. Once these apps have been deselected, scroll to the bottom of the page and click Process, then Confirm, then Return once the apps are downloaded and installed, then Apply, then Continue with Reload. Now repeat the process once more and do not deselect the two applications, then Process, Confirm, Return, Apply Config Changes, and Continue with Reload. Finally, scroll down the Modules listing until you get to the Maintenance section. Click on each of the following and choose Install: ConfigEdit, Sys Info, and phpMyAdmin. Then click Process, then Confirm, then Return once the apps are downloaded and installed, then Apply, then Continue with Reload. All three of these tools now are installed in the Maintenance section of the Tools tab of FreePBX. You now have an up-to-date version of FreePBX. You'll need to repeat the drill every few weeks as new updates are released. This will assure that you have all of the latest and greatest software. To change your Admin password, click on the Setup tab in the left frame, then click Administrators, then Admin in the far right column, enter a new password, and click Submit Changes, Apply Configuration Changes, and Continue with reload. We're going to be repeating this process a number of times in the next section so... when instructed to Save Your Changes, that means "click Submit Changes, Apply Configuration Changes, and Continue with reload."

Choosing Internet Telephony Hosting Providers for Your System. Before you can place calls to users outside your system or to receive incoming calls, you'll need at least one provider (each) for your incoming phone number (DID) and incoming calls as well as a provider for your outbound calls (terminations). We have a list of some of our favorites here, and there are many, many others. Within a few weeks, we also will have some providers that will offer you some free minutes for trying their service with PBX in a Flash. You basically have two choices with most providers. You can either pay as you go or sign up for an all-you-can-eat plan. Most of the latter plans also have caps on minutes, and there are none of the latter plans for business service. In the U.S. market, the going rate for pay as you go service is about 1.5¢ per minute rounded to the tenth of a minute. The best deal on DIDs is from les.net. They charge $3.99 a month for a DID with unlimited, free incoming calls. We will have a free offer from les.net for PBX in a Flash users shortly. Another new provider with excellent service and per minute rates is Aretta Communications out of Atlanta. They also have agreed to co-host our ISO downloads for the U.S. East Coast. Thanks, Aretta! WARNING: Before you sign up for any all-you-can-eat plan, do some reading about the service providers. Some of them are real scam artists with backbilling and all sorts of unconscionable restrictions. You need to be careful. Our cardinal rule in the VoIP Wild West is never, ever entrust your entire PBX to a single hosting provider. As Forrest Gump would say, "Stuff happens!" And life's too short to have dead telephones, even if it's a rarity. NEWS FLASH: Here's a link to an AxVoice offer of free setup, a free DID in your choice of area codes, and a month's free minutes to get you started in the U.S. and Canada.

Setting Up FreePBX to Make Your First Call. There are four components in FreePBX that need to be configured before you can place a call or receive one from outside your PBX in a Flash system. So here's FreePBX for Dummies in less than 50 words. You need to configure Trunks, Extensions, Outbound Routes, and Inbound Routes. Trunks are hosting provider specifications that get calls delivered to and transported from your PBX to the rest of the world. Extensions are internal numbers on your PBX that connect your PBX to telephone hardware or softphones. Inbound Routes specify what should be done with calls coming in on a Trunk. Outbound Routes specify what should be done with calls going out to a Trunk. Everything else is basically fluff.

Trunks. When you sign up with most of the better ITHP's that support Asterisk, they will provide documentation on how to connect their service with your Asterisk system. If they have a trixbox tutorial, use that since it also used FreePBX as the web front end to Asterisk. Here's an example from les.net. And here's the Vitelity support page although you will need to set up an account before you can access it. We also have covered the setups for a number of providers in previous articles. Just search the Nerd Vittles site for the name of the provider you wish to use. You'll also find many Trunk setups in the trixbox Trunk Forum. Once you find the setup for your provider, add it in FreePBX by going to Setup, Trunks, Add SIP Trunk. Our AxVoice setup (which is all entered in the Outgoing section with a label of axvoice) looks like this with a Registration String of yourusername:yourpassword@sip.axvoice.com:

allow=ulaw
authname=yourusername
canreinvite=no
context=all-incoming
defaultip=sip.axvoice.com
disallow=all
dtmfmode=inband
fromdomain=sip.axvoice.com
fromuser=yourusername
host=sip.axvoice.com
insecure=very
nat=yes
secret=yourpassword
type=friend
user=phone
username=yourusername

And our Vitelity Outbound Trunk looks like the following (labeled vitel-outbound) with no registration string:

allow=ulaw&gsm
canreinvite=no
context=from-pstn
disallow=all
fromuser=yourusername
host=outbound1.vitelity.net
secret=yourpassword
sendrpid=yes
trustrpid=yes
type=friend
username=yourusername

Extensions. Now let's set up a couple of Extensions to get you started. A good rule of thumb for systems with less than 50 extensions is to reserve the IP addresses from 192.x.x.201 to 192.x.x.250 for your phones. Then you can create extension numbers in FreePBX to match those IP addresses. This makes it easy to identify which phone on your system goes with which IP address and makes it easy for end-users to access the phone's GUI to add bells and whistles. To create extension 201 (don't start with 200), click Setup, Extensions, Generic SIP Device, Submit. Then fill in the following blanks leaving the defaults in the other fields for the time being.

User Extension ... 201
Display Name ... Home
Outbound CID ... [your 10-digit phone number if you have one; otherwise, leave blank]
Emergency CID ... [your 10-digit phone number for 911 ID if you have one; otherwise, leave blank]
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

Now create several more extensions using the template above: 202, 203, 204, and 205 would be a good start. Keep the passwords simple. You'll need them whenever you configure your phone instruments.

Outbound Routes. The idea behind multiple outbound routes is to save money. Some providers are cheaper to some places than others. We're going to skip that tutorial today. You can search the site for lots of information on choosing providers. Assuming you have only one or two for starters, let's just set up a default outbound route for all your calls. Using your web browser, access FreePBX on your server and click Setup, Outbound Routes. Enter a route name of Everything. Enter the dial patterns for your outbound calls. In the U.S., you'd enter something like the following:

1NXXNXXXXXX
NXXNXXXXXX

Click on the Trunk Sequence pull-down and choose your providers in the order you'd like them to be used for outbound calls.Click Submit Changes and then save your changes. Note that a second choice in trunk sequence only gets used if the calls fails to go through using your first choice. You'll notice there's already a 9_outside route which we don't need. Click on it and then choose Delete Route 9_outside. Save your changes.

Inbound Routes. We're also going to abbreviate the inbound routes tutorial just to get you going quickly today. The idea here is that you can have multiple DIDs (phone numbers) that get routed to different extensions or ring groups or departments. For today, we recommend you first build a Ring Group with all of the extension numbers you have created. Once you've done that, choose Inbound Routes, leave all of the settings at their default values and move to the Set Destination section and choose your Ring Group as the destination. Now click Submit and save your changes. That will set up a default incoming route for your calls. As you add bells and whistles to your system, you can move the Default Route down the list of priorities so that it only catches calls that aren't processed with other inbound routing rules.

General Settings. Last, but not least, we need to enter an email address for you so that you are notified when new FreePBX updates are released. Scroll to the bottom of the General Settings screen after selecting it from the left panel. Plug in your email address, click Submit, and save your changes. Done!

A more detailed tutorial complete with screenshots is under development and will be available shortly, but we wanted to provide those just getting started with Asterisk sufficient information today to get a working system.

Adding Plain Old Phones. Before your new PBX will be of much use, you're going to need something to make and receive calls, i.e. a telephone. For today, you've got several choices: a POTS phone, a softphone, or a SIP phone. Option #1 and the best home solution is to use a Plain Old Telephone or your favorite cordless phone set (with 8-10 extensions) if you purchase a little device (the size of a pack if cigs) known as a Sipura SPA-1001. It's under $60. Be sure you specify that you want an unlocked device, meaning it doesn't force you to use a particular service provider. Once you get it, plug the SPA-1001 into your LAN, and then plug your phone instrument into the SPA-1001. Your router will hand out a private IP address for the SPA-1001 to talk on your network. You'll need the IP address of the SPA-1001 in order to configure it to work with Asterisk. After you connect the device to your network and a phone to the device, pick up the phone and dial ****. At the voice prompt, dial 110#. The Sipura will tell you its DHCP-assigned IP address. Write it down and then access the configuration utility by pointing your web browser to that IP address.

Once the configuration utility displays in your web browser, click Admin Login and then Advanced in the upper right corner of the web page. When the page reloads, click the Line1 tab. Scroll down the screen to the Proxy field in the Proxy and Registration section of the form. Type in the private IP address of your Asterisk system which you wrote down previously. Be sure the Register field is set to Yes and then move to the Subscriber Information section of the form. Assuming your extensions were set up starting with 201, do the following. Enter House Phone as the Display Name. Enter 201 as the User ID. Enter 1234 as the Password, and set Use Auth ID to No. Click the Submit All Changes button and wait for your Sipura to reset. In the Line 1 Status section of the Info tab, your device should show that it's Registered. You're done. Pick up the phone and dial 1234# to test it out.

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 another great SIP/IAX softphone for all platforms that's great, too, and it requires no installation: Zoiper 2.0 (formerly IDEfisk). All are free! Just install and then configure with the IP address of your PBX in a Flash server. For username and password, use one of the extension numbers and passwords which you set up 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 (but probably not the best sound quality) is the $79 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. Some other great choices are the Aastra 9133i and the Siemans Cordless Dect phone. Do some reading before you buy. The Voxilla forums are a good place to start.

A Word About Ports. For the techies out there that want "the rest of the story" to properly configure firewalls, here's a list of the ports available and used by PBX in a Flash:

TCP 80 - HTTP
TCP 9080 - Duplicate HTTP
TCP 22 - SSH
TCP 9022 - Duplicate SSH
TCP 9001 - WebMin
UDP 10000-20000 - RTP
UDP 5004-5082 - SIP
UDP 4569 - IAX2
UDP 2727 - Media Gateway

A2Billing Installation. Our first example of how we plan to build up PBX in a Flash systems is the installation script for A2Billing. If you want A2Billing installed on your system, then log in as root and type install-a2billing. If you don't want A2Billing, then you don't download or run the script. When you return to the main web page for your server after installing A2Billing, you will have two new links for A2Billing customers and A2Billing admin. You will have to install the callback funtionality manually from the docs supplied in the install. A2Billing was created by Areski, who some of you may know was responsible for Web MeetMe, ConfigEdit, and the CDR reports included with FreePBX. A2Billing is sufficiently comprehensive that it warrants an article on its own, so we will save that for another day. Some of the projects we will be looking into are how to pass calls from FreePBX to A2Billing for least-cost routing, departmental billing services, building a calling card server, and a VoIP termination platform. Then you can change your name to Ma Bell and start selling minutes to all the people for whom you have installed PBX-in-a-Flash. If you can't wait, visit asterisk2billing.org.

Nerd Vittles Coming Attractions. First, we will have a new script repository up and running in a few days at pbxinaflash.org. Tom King, the ultimate scripting guru will be managing that site. So check it often. And now that PBX in a Flash is out the door, we're chomping at the bit to get all of the Nerd Vittles Goodies ported over. If you want to try one yourself, start with Weather by Airport Code which installs in under 5 minutes. Put your dialplan code in extensions_custom.conf, and be sure to heed the Asterisk 1.4 mod which is explained in the article. Hold off on AsteriDex because we have an updated version of that one for you within the next few weeks. If you still have a DBT-120 Bluetooth adapter, you'll be happy to learn that it works out-of-the-box with both the Linux and Windows versions of PBX in a Flash. Just take a look at our recent iPhone article on Proximity Detection, and you can configure your system to transfer your phone calls to your cellphone when you leave the house carrying your Bluetooth cellphone in about 5 minutes. Now spend some time reading up on FreePBX and enjoy your new toy. Santa came early this year!

Bug Fixes. There's only been one reported bug (horrors!) in PBX-in-a-Flash, but we wanted to provide a way to report them and to address them. So there's a new PBX-in-a-Flash forum dedicated to bug reporting and fixes. Be sure to visit once in a while just to keep your system current.


Some Recent Nerd Vittles Articles of Interest...

Introducing TeleYapper 3.0: The Free Asterisk Message Broadcasting System

AsteriDex Security Alert. Because of a security vulnerability in our AsteriDex robodialer, you should download and install the following patch to protect your system if AsteriDex is accessible from the public Internet or if your private network is used by individuals other than your immediate (trustworthy) family. Log into your Asterisk® server as root and issue the following commands. We also recommend you change the name of the asteridex folder to something that only you know. For further security precautions, read the Hardening Your System section of the Best of Nerd Vittles article.

cd /var/www/html/asteridex
rm -f callboth.php
wget http://nerdvittles.com/trixbox11/callboth.zip
unzip callboth.zip
rm -f callboth.zip
chown asterisk:asterisk callboth.php
chmod 775 callboth.php


NOTE: This version of TeleYapper works with Asterisk 1.2 only. For Asterisk 1.4, read our new article on TeleYapper 4.0 or visit our Best of Nerd Vittles site.

WARNING: New federal regulations regarding robodialers go into effect on September 1, 2009. Before you use this software, make absolutely certain that you are in compliance with the new regulations regarding calls that deliver a prerecorded message! You can download the regulations here.

To start July off with a bang, we're back today with TeleYapper 3.0, an updated version of our Asterisk-based telephone broadcasting service. For those with multiple outbound trunks, TeleYapper 3.0 now supports simultaneous calls using multiple trunks. Special thanks to Matt Frederickson for the code. Version 3 works with all flavors of Asterisk@Home 2.x as well as most versions of TrixBox. We haven't tested it with Asterisk 1.4, but tips from others suggest that it'll work just fine with the DigitTimeout and ResponseTimeout tweaks that already are incorporated into TeleYapper 3.0. If you're running an earlier version of Asterisk@Home, use our version 1 code and tutorial. And, just like the original and version 2.5, TeleYapper 3.0 can be used for neighborhood association announcements, schools, little leagues, fundraisers, municipal governments, and anyone else that just wants to pester folks with annoying, but free, prerecorded phone calls.

Everything you'll need to get TeleYapper 3.0 dialing away is in this article. And functionally, TeleYapper still works identically to prior versions. The only problem was version 1 didn't work at all with AAH 2.4 and 2.5. For those new to TeleYapper, here's what happens. You create a recorded message using Asterisk. Then you create a list of phone numbers to call in a MySQL database using a tool such as phpMyAdmin which is bundled with TrixBox and Asterisk@Home. Finally, you place a phone call either to kick off TeleYapper or to redial calls that failed the first time around. The software will dutifully swing into action and call qualifying phone numbers from any of ten calling categories that you specify when you set up your database of callees. TeleYapper then will deliver the message you've recorded. It works much like call-em-all.com and numerous other telephone broadcasting services with one important difference: TeleYapper is FREE! So, instead of paying 15¢ a call or $35 to $100 a month for a commercial service or spending thousands of dollars for a commercial dialer, now you can do it yourself using TeleYapper and your (also free) TrixBox PBX. Look at the top of this page (just below the Nerd Vittles header) for links to Windows, Mac, and Linux versions of TrixBox that are perfectly suited for use with TeleYapper. Today we'll actually get TeleYapper making calls and emailing you the results of those calls. Don't be intimidated by the length of the article. You can still complete this project in about 30 minutes. It's mostly a cut-and-paste exercise. If you're using one of our TrixBox builds which we just described, then this is less than a 5-minute upgrade. In either case, we've done all the hard work for you.

Legalese. For those that are used to buying flawless software such as Microsoft Windows or Microsoft Office, let's be sure we're all on the same page up front. First, you're not buying this software. It's FREE! And, yes, sometimes you get what you pay for. Second, don't assume today's version is error-free. It's probably not. We try pretty hard to write reliable code, but even the best among us make mistakes. Third, by downloading or using this software, you are agreeing to assume all risks associated with use of the software. NO WARRANTIES EXPRESS OR IMPLIED INCLUDING ITS FITNESS FOR USE OR MERCHANTABILITY ARE PROVIDED WITH THIS SOFTWARE. And, finally, read or reread Part I of this series concerning Do Not Call statutes in your jurisdiction and make sure you are in compliance before placing any calls. Failure to heed this advice may subject you to serious criminal and civil penalties. If any of this gives you heartburn, exercise your constitutional right to not use the software.

Overview. Today's TeleYapper update provides a good framework for anyone wanting to write Asterisk AGI scripts using PHP. The code is well-documented to demonstrate how to pass variables to an AGI script from your dialplan and how to retrieve variables from an Asterisk AGI script into your dialplan. We needed this for TeleYapper because we're using a phone call to an Interactive Voice Response (IVR) session embedded in the dialplan to begin the calling process. We use the IVR session not only to determine which group of callees to call but also to give the caller the option of placing a call to everyone in the group or just those to whom the initial call was unsuccessful. After the caller hangs up, the results are passed to the teleyapper.php application to do the heavy lifting. The PHP program takes advantage of an AGI script's ability to actually set dialplan code in motion once a call is answered. In order to log calls and track which ones are successful, we have to pass variables into that dialplan code and then execute another PHP script when the call is completed. Stated another way, every call requires two round-trips from the Asterisk dialplan to PHP/AGI scripts. So, if you can't figure out how to pass variables back and forth using this application, you probably should consider another line of work. For those that just want to use the TeleYapper application and not learn much of anything about programming, you're welcome to do that subject to the license agreement which follows. We hope you'll put it to good use for the betterment of a school, an intramural sports program, or a neighborhood in which you happen to live.

Creative Commons LicenseLicensing. We are retaining ownership of this software as well as the copyright. It is licensed for use under the terms of the Creative Commons Attribution Non-Commercial license. A Plain English summary is available here. We've done this primarily to do our part to stamp out the telemarketing creeps of the world. Those wishing to use TeleYapper in a commercial environment must first request a license outlining your proposed terms of use. We will promptly respond with a yay or nay. Telemarketers need not apply!

TeleYapper in a Nutshell. Before we get to the code, let's briefly cover how this message broadcasting system works. When you dial 674, the TeleYapper system will answer and prompt you for your password. Once you correctly enter the password, an interactive voice response (IVR) system will swing into action and give you several choices. That's what the [yapper] context handles. Pressing 1 lets you listen to your prerecorded TeleYapper message (if you have one). You don't yet so don't press 1. Pressing 2 lets you record a new TeleYapper message. This is handled by the [yapper2] context. Do this first and record something ... anything. You can rerecord a new message at any time by choosing option 2 again. Pressing 3 lets you kick off a TeleYapper dialing spree. It's handled by the [yapper3] context. Don't do this until we add your new database below, or you'll get smoke. If you choose option 3 to initiate a TeleYapper calling session, the system will first prompt you for a group option number to use. This is managed by the [yapper-options] context. Simply stated, when you build your database of callees for TeleYapper, you can specify a one-digit group number for each entry in the file. Then, when you begin a calling session, you can narrow down the calling group by telling TeleYapper which group of callees to call. If you want a callee to be in more than one group, you simply enter that callee into the database multiple times with different group numbers. If you want everyone in the same group, then enter 0 for every person in your database.

Once you specify the group number during your TeleYapper session, the system will actually look up and report back how many messages will be delivered to the callee group you've chosen. Allison will say something like this assuming there were 146 calls to be placed: "The number I have is one hundred and forty six messages." This will give you the count of qualifying records in the database and the option of proceeding with the calls, cancelling the transaction, or just redialing the numbers of the calls that failed to this group on the previous pass through the database. As noted previously, we've endeavored to build this entire application using the voice prompts that are delivered with Asterisk@Home and TrixBox so they're not quite perfect. But they work reasonably well once you understand how the pieces fit together. You're supposed to be nodding in agreement now.

TeleYapper's Calling Process. For those that like lists, it may help to visualize how all the TeleYapper code fits together by laying out the actual program steps in a typical call:

  • Caller with TeleYapper password places call to M-S-G (extension 674) to activate a TeleYapper session.
  • Asterisk answers the call, provides IVR menu choices: playback a message, record a new message, or place a call.
  • If caller chooses to place a call, IVR prompts for Group number to call (0-9).
  • Asterisk passes the Group number to MySQL (checkgroup.php) to look up the number of callees in the chosen Group.
  • Group count is passed back to Asterisk which uses Allison to tell the caller how many callees are in the chosen Group.
  • Caller has option of placing the call, hanging up, or choosing advanced options (which redials previously unsuccessful calls in chosen Group again).
  • If caller chooses to place a new call, Asterisk thanks the caller, hangs up, and then passes control to teleyapper.php to handle placing the calls.
  • TeleYapper time stamps dialing scripts two minutes apart for each call beginning two minutes after the initiating request. Scripts are placed in the Asterisk outgoing calls queue.
  • TeleYapper initializes the date/time and status fields for each record in the Group to be called. These are only filled in when a call is then answered.
  • If you've enabled logging in teleyapper.php, then the log is generated after all of the call setups have been completed.
  • If you've enabled emailing of the teleyapper.php log, then the log is emailed to your email address at the same time.
  • Asterisk checks its call queue each minute and places each call at the appointed time, Then it waits for the callee to answer.
  • If no one answers the call, nothing is posted to the MySQL database regarding call completion. That's how we identify unsuccessful calls.
  • If the call is answered, the callee is advised to hold for an important message and then your prerecorded message plays.
  • Callee is then prompted to press 1 to replay the message, press 2 to blacklist the last caller (you!), or press 3 to hang up.
  • If callee presses 1, your message is replayed, and then the call is disconnected. MySQL database will show date/time of call with ReplayedMsg as status.
  • If callee presses 2, log will reflect that caller requested blacklisting. MySQL will actually DELETE this person from your database. It's the LAW!
  • If callee presses 3, Allison says goodbye and Asterisk hangs up the call. MySQL database will show date/time of call with status of OK.
  • If callee makes no choice, Asterisk will replay your message, then hang up, and record the date/time of call with status of AnsMachine.
  • If you've enabled logging in teleyapper2.php, then the individual call log is generated and appended to the main log file after each call has been placed.
  • If you've enabled emailing in teleyapper2.php, then the call log is emailed to your email address after EACH call has been placed.
  • The TeleYapper code not only handles the actual dialing of the callees you've entered in your MySQL database (teleyapper.php), it also plays your message when a callee answers (dialplan contexts), and documents what happened during the calls (teleyapper2.php). Call progress is documented in two ways. First, when a call is completed, TeleYapper will log the date and time of the call as well as a best guess of what happened during the call in your MySQL database. So browsing entries in your TeleYapper database will always show the date, time, and status of the last completed call to each callee. We'll build a web interface for this one of these days. Second, when you install the TeleYapper PHP components, there are some configuration options which will also let you create a detailed log of what happened during the TeleYapper calls. If you have email working reliably on your Asterisk system, you also can enter your email address and tell TeleYapper to email you every log that is produced. There are log entries for the initial call setup (handled by teleyapper.php) and for the placement of the individual calls (handled by teleyapper2.php). Finally, you have the option of creating a new log with each series of calls that are placed (the default setting), or you can configure TeleYapper to keep adding to the end of the initial log. In the latter case, it's up to you to erase the log before it fills up your disk. Individual call entries, if logged, will be appended to the main TeleYapper call setup log (/var/log/asterisk/teleyapper.txt).

    To keep things simple, everything you'll need to make TeleYapper work is covered in this article even though we've covered some of this in our previous TeleYapper articles. Here are the components that make up the complete TeleYapper system, and we'll cover them below in the order which simplifies the installation process:

  • TeleYapper MySQL database
  • Code Snippet to Answer M-S-G Calls
  • AutoAttendant Contexts
  • checkgroup.php AGI script
  • Call Processing Contexts
  • teleyapper.php AGI script
  • teleyapper2.php AGI script
  • Upgrading from TeleYapper 2.5. If you're using one of our preconfigured TrixBox 1.2.3 systems from the links at the top of this page or if you have an existing TeleYapper 2.5 system which is working, then the upgrade to TeleYapper 3.0 is a piece of cake. You only need to download and replace the teleyapper.php AGI script located in /var/lib/asterisk/agi-bin on your TrixBox system. Just log into your Asterisk server as root and execute the commands below to install the new code. Then adjust the default settings as described below to meet your needs. That's it. You're done!

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/trixbox123/teleyapper30.zip
    mv teleyapper.php teleyapper25.php
    unzip teleyapper30.zip
    rm teleyapper30.zip
    chmod 775 teleyapper.php
    chown asterisk:asterisk teleyapper.php

    Creating the TeleYapper Database. We use the MySQL database management system to manage the list of callees for TeleYapper to dial. It can handle a database of almost any size and generally stands up well in performance comparisons with Oracle. So you're covered on the database front.

    To create the MySQL database to support TeleYapper, the easiest way is using phpMyAdmin. On Asterisk@Home systems, use a web browser pointed to your Asterisk server and choose: AMP->Maintenance->phpMyAdmin. On TrixBox systems, choose System Administration and then phpMyAdmin from the maintenancemenu. When phpMyAdmin loads, click on the SQL icon in the left column. When the SQL window appears, clear the existing SQL query and then cut-and-paste the following SQL code into that box and then click the Go button. When the import completes, click the teleyapper.callees table entry in the left column to open the file. Then click the Insert tab at the top of the right column to add entries to the table. You only need to add information for the name, phonenum, and group fields in the corresponding values column. The id, lastokcall, and lastcall fields should be left as is. The id field gets calculated automatically. The lastokcall will record the time and date of the last successful call using TeleYapper. And the lastcall field identifies what happened during the last call to this person, e.g. ok means the call was completed successfully, no answer means no one answered the call, or answering machine means an answering machine took the call.

    You can add up to two records at a time and, by clicking the Insert Another New Row button, you will be returned to this data entry screen after you save your entries by clicking the Go button. The name field allows you to quickly review entries you've made. It won't be used when making TeleYapper calls. The phonenum field is the important one. This is the exact dial string required to place a call on your Asterisk system to this callee using whatever VoIP or PSTN outbound trunk you plan to use with TeleYapper. For example, if your preferred provider requires 11-digit phone numbers with a 1, area code, and number, then that's the way the numbers should be entered into the TeleYapper database. The group field has already been discussed. Just enter a number between 0 and 9 to identify the group with whom this individual should be associated. Finally, after adding records to the table, you can click the Browse tab to review your entries. And, while Browsing, you can click the Pencil icon beside any record entry to edit it. Clicking the red X icon beside a record entry deletes the record. If, for some reason, you wish to delete ALL the records in the file, click the Empty tab at the top of the right column. Under no circumstances should you click on the Drop tab as this removes not only the table's contents but also the table structure itself. In short, you'd have to import the database table again.

    Answering the Incoming Call. A simple addition to your dialplan is used to force Asterisk to answer calls to M-S-G (extension 674) and pass them to the TeleYapper contexts for processing. Log into your Asterisk system as root and move to the /etc/asterisk directory. To add TeleYapper to your dialplan, just cut-and-paste the following code into the [from-internal-custom] context near the top of extensions_custom.conf. For TrixBox users, cut-and-paste the following code into the [from-internal-trixbox] context near the top of extensions_trixbox.conf. Be sure to change the 1234 password below to something secure for your system since this will be used to gain access to your TeleYapper system!

    exten => 674,1,Answer ; dial MSG on any extension to manage your TeleYapper system
    exten => 674,2,Wait(1)
    exten => 674,3,Authenticate(1234)
    exten => 674,4,Goto(yapper,s,1)

    If you're a long-time reader of Nerd Vittles and you're using either our Stealth AutoAttendant or some other AutoAttendant, then you already know why you need to be careful about putting extensions like 6-7-4 in your extensions_custom.conf file. Anyone can call you, dial 6-7-4 while your AutoAttendant is playing, and insert their own obscene message into your TeleYapper system. The solution is adding your own secure password in line 3 above rather than using the default 1234. Another precaution you should always perform is to first play your outgoing TeleYapper message to yourself to make certain it says what you think it should before you kick off a dialing spree to a thousand of your closest friends or business associates.

    AutoAttendant Contexts for TeleYapper. Now insert the following chunk of code at the bottom of extensions_custom.conf or extensions_trixbox.conf if you're using TrixBox:

    [yapper]
    exten => s,1,Set(TIMEOUT(digit)=7)
    exten => s,2,Set(TIMEOUT(response)=10)
    exten => s,3,Background(T-to-hear-cur-ancmnt)
    exten => s,4,Background(press-1)
    exten => s,5,Background(to-rerecord-yr-message)
    exten => s,6,Background(press-2)
    exten => s,7,Background(to-place-outgoing-call)
    exten => s,8,Background(press-3)
    exten => s,9,Background(to-hear-menu-again)
    exten => s,10,Background(press-4)
    exten => s,11,Background(to-hang-up)
    exten => s,12,Background(press-5)
    exten => 1,1,Playback(custom/broadcast)
    exten => 1,2,Wait(2)
    exten => 1,3,Goto(s,3)
    exten => 2,1,Goto(yapper2,s,1)
    exten => 3,1,Goto(yapper-options,s,1)
    exten => 4,1,Goto(s,3)
    exten => 5,1,Playback(goodbye)
    exten => 5,2,Hangup
    exten => t,1,Goto(s,3)
    exten => i,1,Goto(s,3)
    exten => o,1,Goto(s,3)
    exten => h,1,Hangup

    [yapper2]
    exten => s,1,Playback(after-the-tone)
    exten => s,2,Playback(say-temp-msg-prs-pound)
    exten => s,3,Wait(2)
    exten => s,4,Record(custom/broadcast:gsm)
    exten => s,5,Wait(2)
    exten => s,6,Playback(custom/broadcast)
    exten => s,7,Wait(2)
    exten => s,8,Playback(your-msg-has-been-saved)
    exten => s,9,Wait(2)
    exten => s,10,Goto(yapper,s,1)

    [yapper3]
    exten => s,1,AGI(checkgroup.php|${GROUP})
    exten => s,2,NoOp(tmp variable: ${tmp})
    exten => s,3,GotoIf($[${tmp} = 0]?9,1)
    exten => s,4,Set(COUNTER=${tmp}|g)
    exten => s,5,Playback(the-num-i-have-is)
    exten => s,6,SayNumber(${COUNTER})
    exten => s,7,Playback(vm-messages)
    exten => s,8,Wait(1)
    exten => s,9,Set(TIMEOUT(digit)=7)
    exten => s,10,Set(TIMEOUT(response)=10)
    exten => s,11,Background(to-call-this-number)
    exten => s,12,Background(press-1)
    exten => s,13,Background(to-hang-up)
    exten => s,14,Background(press-2)
    exten => s,15,Background(vm-advopts)
    exten => 1,1,Goto(yapper-gen,s,1)
    exten => 2,1,Playback(goodbye)
    exten => 2,2,Hangup
    exten => 3,1,Goto(yapper-redial,s,1)
    exten => 9,1,Playback(dir-nomatch)
    exten => 9,2,Wait(1)
    exten => 9,3,Goto(yapper,s,1)
    exten => t,1,Playback(goodbye)
    exten => t,2,Hangup
    exten => i,1,Playback(goodbye)
    exten => i,2,Hangup
    exten => h,1,Hangup

    [yapper-options]
    exten => s,1,Wait(1)
    exten => s,2,Playback(you-have-these-options)
    exten => s,3,Playback(digits/0)
    exten => s,4,Playback(through)
    exten => s,5,Playback(digits/9)
    exten => s,6,Playback(press-star-cancel)
    exten => s,7,Read(tmp,vm-enter-num-to-call,1)
    exten => s,8,Set(GROUP=${tmp}|g)
    exten => s,9,NoOp(${GROUP})
    exten => s,10,GotoIf($["foo${GROUP}" = "foo"]?s,78)
    exten => s,11,GotoIf($["foo${GROUP}" = "foo*"]?s,88)
    exten => s,12,GotoIf($["foo${GROUP}" = "foo#"]?s,98)
    exten => s,13,Goto(yapper3,s,1)
    exten => s,78,Playback(connection-timed-out)
    exten => s,79,Wait(1)
    exten => s,80,Goto(yapper,s,1)
    exten => s,88,Playback(cancelled)
    exten => s,89,Wait(1)
    exten => s,90,Goto(yapper,s,1)
    exten => s,98,Playback(option-not-implemented)
    exten => s,99,Goto(yapper,s,1)

    [yapper-gen]
    exten => s,1,Playback(speed-dial)
    exten => s,2,Playback(activated)
    exten => s,3,Wait(1)
    exten => s,4,Playback(goodbye)
    exten => s,5,Hangup
    exten => h,1,DeadAGI(teleyapper.php|${GROUP}|${COUNTER}|1)
    exten => h,2,Hangup

    [yapper-redial]
    exten => s,1,Playback(speed-dial)
    exten => s,2,Playback(activated)
    exten => s,3,Wait(1)
    exten => s,4,Playback(goodbye)
    exten => s,5,Hangup
    exten => h,1,DeadAGI(teleyapper.php|${GROUP}|${COUNTER}|3)
    exten => h,2,Hangup

    Call Processing Contexts for TeleYapper. Finally insert the following chunk of code at the bottom of extensions_custom.conf or extensions_trixbox.conf:

    [broadcast]
    exten => s,1,Answer
    exten => s,2,Wait(2)
    exten => s,3,Playback(system-status-msg)
    exten => s,4,Wait(2)
    ;exten => s,5,BackgroundDetect(custom/broadcast|1000|50|3000)
    exten => s,5,Playback(custom/broadcast)
    exten => s,6,Goto(talk,1)
    exten => t,1,Goto(talk,1)
    exten => i,1,Goto(talk,1)
    exten => o,1,Goto(talk,1)
    exten => h,1,NoOp(Callee hung up call before menu. Dialed: ${DIAL} ID: ${ID}.)
    exten => h,2,Set(STATUS='EarlyHangup'|g)
    exten => h,3,DeadAGI(teleyapper2.php|${ID}|${STATUS}|${DIAL})
    exten => h,4,Hangup
    exten => talk,1,Goto(broadcast2,s,1)

    [broadcast2]
    exten => s,1,Set(STATUS='Answered'|g)
    exten => s,2,Set(TIMEOUT(digit)=4)
    exten => s,3,Set(TIMEOUT(response)=4)
    exten => s,4,Background(to-hear-msg-again)
    exten => s,5,Background(press-1)
    exten => s,6,Background(to-blklist-last-caller)
    exten => s,7,Background(digits/2)
    exten => s,8,Background(otherwise-press)
    exten => s,9,Background(digits/3)
    exten => t,1,NoOp(Callee's Answering Machine probably answered. Dialed: ${DIAL} ID: ${ID}.)
    exten => t,2,Set(STATUS='AnsMachine'|g)
    exten => t,3,Background(restarting)
    exten => t,4,Wait(1)
    exten => t,5,Playback(custom/broadcast) ; playing again for ans machine
    exten => t,6,Background(goodbye)
    exten => t,7,Hangup
    exten => h,1,DeadAGI(teleyapper2.php|${ID}|${STATUS}|${DIAL})
    exten => h,2,Hangup
    exten => i,1,Goto(1,1)
    exten => o,1,Goto(1,1)
    exten => 1,1,Set(STATUS='ReplayedMsg'|g)
    exten => 1,2,Goto(t,3)
    exten => 2,1,Set(STATUS='Zap'|g)
    exten => 2,2,Background(num-was-successfully)
    exten => 2,3,Background(removed)
    exten => 2,4,Background(goodbye)
    exten => 2,5,NoOp(Callee Requested to have number removed. Dialed: ${DIAL} ID: ${ID}.)
    exten => 2,6,Hangup
    exten => 3,1,Set(STATUS='OK'|g)
    exten => 3,2,Background(goodbye)
    exten => 3,3,NoOp(Callee Acknowledged Call. Dialed: ${DIAL} ID: ${ID}.)
    exten => 3,4,Hangup

    Once you finish adding all of the new contexts above to extensions_custom.conf or extensions_trixbox.conf, save your changes to disk. There's no need to reload Asterisk just yet. We've still got our AGI scripts to install.

    If you're using freePBX, then make the following addition to your freePBX configuration. Log into your TrixBox server with a web browser. Choose freePBX and then choose Setup, Misc Destination. Add a new entry for TeleYapper with 674 as the Dial entry. Save your change and click the Red Bar to update the freePBX configuration.

    For those that are curious, you'll notice there is a commented out line 5 in the [broadcast] context. It's an Asterisk command called BackgroundDetect. What this command is supposed to do is play a sound file while listening for silence at the callee's end of the call. Once silence is detected, the call processing drops to talk. We couldn't get it to work reliably although we haven't tried it with Asterisk 1.4. So the current release blindly plays your message and then asks for an acknowledgment. If it doesn't get one, it plays your message again, and then hangs up. The theory here is that, even if a callee has an answering machine, the second playing of your message usually will get recorded. Just be aware that there may be further adjustments down the road. In the meantime, you can check back and read the latest comments to this blog entry.

    Installing checkgroup.php AGI Script. Now let's install the checkgroup.php script in your /var/lib/asterisk/agi-bin directory and change file ownership and permissions on the file. Log in to your Asterisk server as root, and then execute the following commands:

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/checkgroup.zip
    unzip checkgroup.zip
    rm checkgroup.zip
    chmod 775 checkgroup.php
    chown asterisk:asterisk checkgroup.php

    This script includes a debug log. The default settings are to create a new log file (/var/log/asterisk/telecheck.txt) each time the script is executed. This doesn't take up much room and is always there for you to read if something comes unglued: cat /var/log/asterisk/telecheck.txt. There are some other options. You can turn off the log file entirely ($debug=0). You can choose not to erase the previous log file each time the script is run ($newlogeachdebug=0) in which case the file continues to grow until your hard disk fills up. And you can have the log file emailed to you each time the script is executed ($emaildebuglog=1) by adding your email address ($email=youremailaddress). The last option obviously assumes you have followed our previous tutorials and gotten outbound email working reliably on your system. The functions are controlled by the following lines at the top of the checkgroup.php file. 1 means yes, and 0 means no. Just edit the file carefully: nano -w checkgroup.php. And save your changes when you're finished: Ctrl-X, Y, then press Enter.

    $debug = 1;
    $newlogeachdebug = 1;
    $emaildebuglog = 0;
    $email = "yourname@yourdomain" ;

    NOTE: If you're using TeleYapper with Asterisk 1.4.x, comment out lines 168-172 in checkgroup.php to get the script to function properly. Special thanks to Lee Azzarello for the tip.

    Installing teleyapper.php AGI Script. This code only works with Asterisk@Home 2.4 or 2.5. To install the teleyapper.php script in your /var/lib/asterisk/agi-bin directory, execute the following commands while logged into your server as root:

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/trixbox123/teleyapper30.zip
    mv teleyapper.php teleyapper25.php
    unzip teleyapper30.zip
    rm teleyapper30.zip
    chmod 775 teleyapper.php
    chown asterisk:asterisk teleyapper.php

    The teleyapper.php script has a number of configuration options including a debug log. Edit the file carefully while positioned in the correct directory: nano -w teleyapper.php. And save your changes when you're finished: Ctrl-X, Y, then press Enter. All of the options are shown below.

    $maxlines=1 ;
    $maxretries=1 ;
    $retrytime=60 ;
    $waittime=60 ;
    $callspread=2 ;
    $debug = 1;
    $newlogeachdebug = 1;
    $emaildebuglog = 0;
    $email = "yourname@yourdomain" ;
    $trunk = "local" ;
    $callerid = chr(34) . "TeleYapper" . chr(34) . " <6781234567>" ;

    The first line lets you set the number of simultaneous calls which can be placed. Be sure you have sufficient outbound trunks to support the number you insert and be sure to use the "local" setting for $trunk. The callspread variable determines the spacing of calls (or groups of calls if you have multiple outbound trunks) to your various callees. The default has been changed from one minute to minutes based upon extensive testing with large numbers of calls. This means the call to the second callee (or group of callees if you have specified $maxlines > 1) begins two minutes after the first call starts. Because a broadcast message is usually more than about 20 seconds long, we have found the 2 minute setting to be better since it allows sufficient time to complete the first call before the next one begins. Otherwise, calls will start failing if you only have a single outbound trunk. If you're going to be placing hundreds of calls, be sure to read our previous article which covers a real-world example using a 700-call database.

    The debug flags in this file are set the same way as in the checkgroup.php script above: 1 means yes, and 0 means no. The default settings are to create a new log file (/var/log/asterisk/teleyapper.txt) each time the script is executed. This doesn't take up much room and is always there for you to read if something comes unglued: cat /var/log/asterisk/teleyapper.txt. There are some other options. You can turn off the log file entirely ($debug=0). You can choose not to erase the previous log file each time the script is run ($newlogeachdebug=0) in which case the file continues to grow until your hard disk fills up. And you can have the log file emailed to you each time the script is executed ($emaildebuglog=1) by also adding your email address ($email=youremailaddress).

    Two settings you will need to review and perhaps adjust to get calls to complete properly are the trunk and callerid variables. If you wish to use a specific trunk in your dialplan for outbound calls, the syntax for the outbound trunk is the same as it is in your dialplan, e.g. sip/telasip-gw or iax2/voxee. Look at the OUT settings at the top of your extensions_additional.conf file if you're not sure. At the request of a number of users, we've now added a new option which allows all outbound TeleYapper calls to be placed using the default dialplan rules on your server. The advantage of this approach is that different VoIP providers can be used automatically for different types of calls in your TeleYapper database. To use your default dial rules, set the trunk in all lowercase letters to local and TeleYapper will handle the rest of the setup for you.

    The callerid variable should be set to the callerid number of your outbound trunk unless your service provider allows callerid spoofing (most don't!). The callerid setting is ignored if you choose to use your default dialplan rules with a trunk setting of local. Don't delete the variable! Just leave the default value.

    Finally keep in mind that the format of the numbers to be dialed in your database must exactly match the syntax your trunk provider is expecting to see unless you're using your default dialplan rules. Otherwise, all of the outbound calls will fail. For example, if your provider requires that calls begin with a 1 followed by a 3-digit area code and 7-digit number, then that's the way the numbers must be entered in your TeleYapper database.

    Installing teleyapper2.php AGI Script. Install the teleyapper2.php script in your /var/lib/asterisk/agi-bin directory, change file ownership and permissions on the file, and decide if you want to adjust the default debug configuration setup. Log in to your Asterisk server as root, and then execute the following commands:

    cd /var/lib/asterisk/agi-bin
    wget http://nerdvittles.com/aah2/teleyapper2.zip
    unzip teleyapper2.zip
    rm teleyapper2.zip
    chmod 775 teleyapper2.php
    chown asterisk:asterisk teleyapper2.php

    The only configuration options in the teleyapper2.php script are for the debug log on individual calls that are placed. We recommend you leave the existing settings, or you'll get a new email every time a call is placed by TeleYapper. You can edit the file while positioned in the correct directory: nano -w teleyapper2.php. And save your changes when you're finished: Ctrl-X, Y, then press Enter. All of the options are shown below.

    $debug = 1;
    $emaildebuglog = 0;
    $email = "yourname@yourdomain" ;

    The debug flags in this file are set the same way as in the teleyapper.php script above: 1 means yes, and 0 means no. The default settings are to append individual call information onto the teleyapper.txt log file (/var/log/asterisk/teleyapper.txt) each time a new call is placed. Unless you're planning to call hundreds of thousands of people, this doesn't take up much room and is there for you when something comes unglued. The other options are as follows. You can turn off the individual call logging entirely ($debug=0). And you can have the entire teleyapper.txt log file emailed to you each time a call is placed ($emaildebuglog=1) by also adding your email address ($email=youremailaddress). For your initial test calls, this may be desirable just so you can see what's going on ... if you're too lazy to read the log.

    Taking TeleYapper for a Spin. Once you restart Asterisk (amportal stop then amportal start), you should have a Broadcast Message System that works. First, start up the Asterisk Command Line Interface (CLI) by typing asterisk -rvvvvv from the command prompt on your system after you've logged in as root. The CLI now will track the progress of your TeleYapper sessions.

    Using phpMyAdmin, add your cellphone number to your TeleYapper database and specify Group 0 for the entry. Now dial 674 and provide your password, record a message (Option #2), and then place a call (Option #3) to Group 0. Press 1 to kick off the TeleYapper calling spree. Check your CLI and TeleYapper logs if your cellphone doesn't ring in the next two minutes. Enjoy!

    Real-World Test of TeleYapper. Be sure to check out our follow-up article on TeleYapper for a real-world example dialing 700+ neighbors with information about a rezoning meeting.

    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.

    From Our Legal Department, moi: The TeleYapper product name (our feeble attempt at humor through parody) has absolutely no affiliation with TeleZapper, the terrific hardware product designed to keep telemarketers from bugging the hell out of you while you're eating your dinner. We confess that our sense of humor got the better of us in coming up with the name for this non-commerical (aka "free") utility designed primarily as an educational vehicle to assist the Asterisk community in recognizing the almost limitless potential of AGI and PHP programming. Our parody seeks to amuse, not to confuse. Our telephony software Yaps. Their telephony hardware Zaps. Other than a telephone line, there is no product similarity as the two conjoined words make clear. And, yes, that is the whole point! The products are opposites, not identical nor even similar. One letter makes all the difference in Night and Light. So it is with Yapper and Zapper. Brand confusion in trademark law arises from synonyms, not antonyms. It is systems like what we're writing about today that TeleZapper is designed to protect against. And it does that very well. In fact, we use TeleZapper hardware in our own home and have for many years. The only problem, of course, is when that tornado comes rolling down the neighbor's street, it would have been nice to get the automated phone call from TeleYapper at the neighborhood headquarters. But, who cares, right? It's only your house. Class dismissed.


    Some Recent Nerd Vittles Articles of Interest...

    Introducing Telephone Reminders 3.0: The Free Asterisk Telephone Reminder System

    It's free software day again at Nerd Vittles, and today we're updating our Telephone Reminder System for Asterisk® to version 3. The original system let you schedule reminders for future events and, when the appointed date and time arrived, Asterisk swung into action and placed a call to the number you designated to deliver your customized reminder message. Today we add the bells and whistles that just about everyone using the original application requested. Now you can set up recurring reminders that call daily or on weekdays as well as weekly, monthly, and annually. This means it can be used to wake you up in the morning, or to remind Granny to take her medicine every day, or to remind your Little League team of practice times and locations, or to remind you and your customers of scheduled and recurring events.

    The smarts for the original system already have been incorporated into our TeleYapper 2.5 Voice Messaging System. But that's a real-time system meaning it begins calling immediately after you choose a group of people to call. This phone reminder system is different in that you can schedule the calls for the near or distant future, you can specify different numbers for the calls, and you can customize the recorded messages for each call. In short, it's perfect for appointment reminders, birthday reminders, anniversary reminders, and anything else you want to remember. All it takes is a phone call to set up each reminder. There's no web page to fill in and no database required to manage the reminders. You can schedule as many reminders per phone number as your little fingers care to dial! And, in our next article, we'll show you how to use a single entry from the new Asterisk Telephone Reminder System to contact a small or large group of people on a recurring basis.

    Prerequisites. We've tested version 3 of our appointment reminder system with ISO-installed versions of Asterisk@Home 2.5 and TrixBox 1.2.3 in addition to the Nerd Vittles VMware builds of TrixBox 1.2.3. If you wish to use it with later versions of TrixBox or with a "pure Asterisk" system (not 1.4!), then you shouldn't have any problems. It won't work with version 1.x of Asterisk@Home or 1.4 releases of Asterisk. Post a comment if you have problems. You also will need a system which includes PHP to run this application. We've tested it with PHP 4.3.9, but PHP 5 systems probably will function without many changes in the underlying code. You should be able to install this project and get everything working in under 30 minutes. For those using our VMware TrixBox builds or our Linux PBX-in-a-Flash script for TrixBox 1.2.3 which can be downloaded at the top of this page, we'll walk you through the 5-minute upgrade drill so that you can take advantage of the new Version 3 recurring reminders feature set. If you're installing Telephone Reminders for the first time, complete installation instructions are available on our Best of Nerd Vittles site.

    How It Works. The reminder system is actually quite simple to use. You dial extension 1-2-3 on your Asterisk system, enter your password, and then you'll be prompted to record a reminder message. Next you enter the phone number, date, and time for delivery of the reminder message. Finally, you're prompted whether to schedule a single reminder or recurring reminders (weekdays, daily, weekly, monthly, or annually). When the appointed date and time arrives, Asterisk will place the call to the number you specified using your default dialing rules and will play the customized reminder when the call is answered. If the call is not answered, the call will be repeated n number of times with a delay between calls of x minutes before giving up on the call. You'll get an email with the call reminder setup if desired. You also get to configure the number of retries and the delay between calls. Finally, end of the month recurring reminders pose a special problem. Why? Because not all months end on the same numbered day. January has 31, February has 28, April has 30. You get the idea. So the default behavior is as follows, If you schedule monthly reminders on the last day of any month, then we assume you want the reminders delivered on the last day of every month. You can alter this behavior by setting a flag in the reminder.php script if you want monthly reminders to always be delivered on the 28th day of the month, for example.

    Finally, a word about failed calls. Reminders are important to most folks, or you wouldn't be scheduling them. So failed calls are problematic. On the one hand, you don't want to overburden your phone system placing thousands of reminder calls just because the calls continue to fail. You may have entered an incorrect phone number, for example. So our middle-of-the-road solution to failed calls is this. You can tell the system how many times to repeat the call and how much time to eat up between attempts. If the call still fails, non-recurring reminders will be deleted from the system. But the reminder message is preserved as well as the recurring reminder for the next date on which to place the call. If you look in /var/lib/asterisk/sounds/custom on your system, you will see some custom sound files (such as the reminder prompts which all begin with reminder). In addition, you will see the actual reminder messages for each of your reminders. The naming convention is HourMinute.Date.PhoneNumber.gsm. If you see entries in this directory with dates before today's date, those are failed call reminders. You can play the sound files on most computers by simply double-clicking on the files. You can delete old reminders for a specific date while logged in as root on your Asterisk system with a command like this:

    rm -f /var/lib/asterisk/sounds/custom/*.20060123.*.gsm

    Be sure you don't delete today's reminder messages or messages with a future date, or your entire reminder system will be toast!

    Here are the components that make up the complete system:

  • AutoAttendant Contexts to Create Reminders
  • Code Snippet to Answer 1-2-3 Calls
  • Allison Voice Prompts for Telephone Reminder 3.0 IVR Interface
  • checkdate.php AGI script to Check for Dates in the Past
  • checktime.php AGI script to Check for Times in the Past
  • reminder.php AGI script to Schedule Calls
  • Reminder Call Processing Contexts
  • run_reminders script to Check for Today's Reminders
  • run_recurring script to Reschedule Recurring Reminders Due Today
  • Limitations. There are a few limitations you need to be aware of. First, you can't schedule delivery of a reminder within the first 5 minutes after midnight each night. That's when the reminder system does its housekeeping. Second, you must schedule reminders at least 5 minutes after you place your call to set up the reminder. This gives the system ample time to generate the configuration files it needs and to put them in the right places. Third, the current reminder system does not fully support simultaneous scheduling of multiple reminders. The current system uses unique names to identify sound files generated by multiple simultaneous callers. However, it still is theoretically possible for two different callers to schedule two reminders for the same phone number and the same reminder time and to do so at the exact same time. This would cause one of the reminders to be discarded. We just wanted to alert you to this remote possibility. But we hasten to add that the chance of this happening is pretty small even in a very large Asterisk system with hundreds of users.

    License. This software is licensed for your use under a Creative Commons Attribution-ShareAlike 2.5 license. Before using this software, please read the terms of the license. A Plain English version of the license is available here. You may not charge a fee for something we are giving you for free. Finally, we ask that you preserve our copyright notice in any copies of the software you make. The same applies to derivative works. If you do not accept the terms of the license, do not use the software. Even if you accept the terms of the license, keep in mind that BY USING THIS SOFTWARE, YOU ASSUME ALL RISKS OF USE AND NO WARRANTIES EXPRESS OR IMPLIED ARE PROVIDED WITH THIS FREE SOFTWARE INCLUDING FITNESS FOR A PARTICULAR USE AND MERCHANTABILITY. In short, it's up to you to determine, at your own risk, whether this software meets your needs. Don't assume that it will, and don't assume that the code is error-free. It's probably not.

    The Game Plan. In today's article, we're going to walk you through upgrading a system on which you already have installed an earlier version of our Telephone Reminders system. As mentioned, if you're installing the software for the first time, stop here and use our Best of Nerd Vittles tutorial. To get the Reminder System upgraded, we're first going to move all of the code into the proper places. This includes the modifications to the dialplan contexts, installation of a new Allison voice prompts, and installation of the upgraded PHP/AGI scripts. Then we'll walk you through configuring the system. And finally we'll schedule a reminder to make sure everything went according to plan.

    Modifying Your Dialplan. Step #1 is to replace some code that's already in your dialplan. The original contexts in extensions_custom.conf looked like this. Find ALL of this code (toward the bottom of the extensions_custom.conf file or, for TrixBox systems, extensions_trixbox.conf in the /etc/asterisk directory on your system) and delete it. The contexts to delete are the following: reminder, reminder2, reminder3, reminder4, reminder5, reminder6, reminder7, reminder8, reminder9, remindem, and remindem2. Replace the deleted contexts with this version 3.0 code.

    For Step #2, make sure the following code snippet is still located in the top section of extensions_custom.conf in the [from-internal-custom] context or, for TrixBox systems, extensions_trixbox.conf in the [from-internal-trixbox] context:

    exten => 123,1,Answer
    exten => 123,2,Wait(1)
    exten => 123,3,Authenticate(12345678)
    exten => 123,4,Goto(reminder,s,1)

    If, for some reason, you already are using extension 1-2-3 on your Asterisk system for some other purpose, then simply adjust the 123 extension in the four lines above to another number that works on your system. This is the number you will dial to schedule reminders. Line 3 is important as well. This is where you set a password for scheduling reminders on your system. Anyone that knows the password can schedule reminders. Simply replace 12345678 with a password that's secure enough for you to sleep well.

    Finally, a head's up. When you do the cut-and-paste, double-check the long lines of code such as h,1 in [reminder9] and be sure all of the text ends up on a single line. Otherwise, things won't work correctly. Once you've added the two sections of code above, save your new config file and reload Asterisk.

    Installing Reminder Voice Prompts. These voice prompts are free for the taking subject to the terms of the license agreement, and they're all the same as version 2.5 except there is a new reminder6.gsm. Just log into your Asterisk server as root and enter the following command to install the new voice prompt:

    cd /var/lib/asterisk/sounds/custom
    wget http://nerdvittles.com/aah2/reminder6.gsm
    chmod 664 reminder*.gsm
    chown asterisk:asterisk reminder*.gsm

    If you need all of the voice prompts, then use these commands instead:

    cd /var/lib/asterisk/sounds/custom
    wget http://nerdvittles.com/aah2/nv-reminder3_voice.zip
    unzip nv-reminder3_voice.zip (be sure to overwrite existing files!)
    chmod 664 reminder*.gsm
    chown asterisk:asterisk reminder*.gsm
    rm -f nv-reminder3_voice.zip

    Installing the Reminder PHP/AGI Scripts. Now we're getting to the new code for version 3. While you're still logged in as root, let's install the final pieces of code that you'll need to get things working. Just execute the commands below:

    cd /var/lib/asterisk/agi-bin
    mv reminder.php reminder25.php
    mv run_reminders run_reminders.25
    mv checkdate.php checkdate25.php
    mv checktime.php checktime25.php
    wget http://nerdvittles.com/aah2/nv-reminder3.zip
    unzip nv-reminder3.zip
    chmod 775 reminder.php
    chown asterisk:asterisk reminder.php
    chmod 775 check*.php
    chown asterisk:asterisk check*.php
    chmod 777 run_reminders
    chown asterisk:asterisk run_reminders
    chmod 777 run_recurring
    chown asterisk:asterisk run_recurring

    Creating Reminders Directories. While you're still logged in as root, create the following directories to store your reminders until the day arrives to execute them. Just issue the following commands. You should already have the reminders directory, but it won't hurt execute the command again just to be sure.

    su asterisk
    cd /var/spool/asterisk
    mkdir reminders
    mkdir recurring
    exit

    Setting Up the Crontab Entries. Now we need to set up the cron jobs to actually move reminders and recurring reminders into the Asterisk call processing directory on the day they are scheduled to run. Be very careful here. If you already have a working Telephone Reminders system, then there will already be an entry for run_reminders. For the new system to work, you MUST adjust the time that the run_reminders script executes so that it occurs AFTER the run_recurring script each day. While logged in as root, edit the crontab file: nano -w /etc/crontab. Be sure you typed the exit command in the last step, or you'll be logged in as asterisk instead of root. And you won't be able to edit the file! Now insert the following commands at the bottom of the crontab file and delete the existing run_reminders entry if you have one. Each command below should go on its own line.

    0 0 * * * root /var/lib/asterisk/agi-bin/run_recurring >/dev/null 2>&1
    3 0 * * * root /var/lib/asterisk/agi-bin/run_reminders >/dev/null 2>&1

    Once you've added the two news lines and deleted the existing run_reminders line, save your changes: Ctrl-X, Y, then press Enter. Whew! That's it for the Reminder code. Now let's configure the system, and you'll be all set.

    Configuring the Reminder System. To configure the reminder system, you'll need to edit the reminder.php script while logged in as root: nano -w /var/lib/asterisk/agi-bin/reminder.php. You'll notice a section of variables at the top of the file that looks like this:

    $endofmonthflag=1 ;
    $extensionmaxdigits=4 ;
    $debug = 1;
    $newlogeachdebug = 1;
    $emaildebuglog = 0;
    $email = "yourname@yourdomain" ;
    $trunk = "local" ;
    $callerid = "6781234567" ;
    $numcallattempts=6 ;
    $calldelaybetweenruns=300 ;
    $timetoring=40 ;
    $acctcode= "Reminder" ;

    This is the only section of code you ought to mess with. When we update the code, we'll assume everything else has been left intact. Be very careful when editing this file. Don't remove any semicolons or quotation marks, or nothing will work! Here's a quick run-down on what each of the above variables does:

  • $endofmonthflag=1 ... Forces monthly recurring reminders scheduled on the last day of a month to the last day of every succeeding month
  • $extensionmaxdigits=4 ... Sets the maximum number of digits for treating outbound calls as calls to local extensions.
  • $debug = 1 ... If set to 1, then a debug log is created in /var/log/asterisk/reminder.txt. Instructions for deleting reminders are in the log.
  • $newlogeachdebug = 1 ... If set to 1, then a new debug log is created each time a reminder is scheduled. Otherwise, file grows and grows.
  • $emaildebuglog = 0 ... If set to 1, the debug log is emailed to the email address set below when each reminder is scheduled.
  • $email = "yourname@yourdomain" ... Enter your actual email address between the quotation marks. Only works if line above is set to 1.
  • $trunk = "local" ... If set to "local", calls are routed using your default dialplan rules. Otherwise, specify a trunk to use, e.g. "sip/telasip-gw".
  • $callerid = "6781234567" ... Specify your caller ID number. Only used if $trunk is not set to "local" above.
  • $numcallattempts=6 ... If there is no answer on the Reminder call, how many times should Asterisk attempt to deliver the reminder?
  • $calldelaybetweenruns=300 ... How many seconds delay should there be between failed call attempts to deliver a reminder?
  • $timetoring=40 ... How many seconds should the call ring when attempting to deliver a reminder?
  • $acctcode= "Reminder" ... What accouting code should be used for reminder calls?
  • Once you've configured the Reminder System to meet your needs, save your changes: Ctrl-X, Y, then press Enter. HINT: You may want to start with the defaults which will work well for most folks.

    Scheduling A Reminder. We're ready to take the Reminder System for a trial run at this juncture. Make sure you've reloaded your Asterisk system, and then dial 123 from an extension on your system. Enter the password you set up for your system and then press the pound key.

    Entering a Reminder Message. You'll first be prompted to record a reminder message. This is the message that will be played when someone answers the reminder call. If you're not scheduling this reminder for yourself, then the message ought to explain who's calling and what the purpose of the call is. Once you've recorded your message, press the pound key to end the recording. You can replay or rerecord the reminder if desired while you're in this step of the reminder creation process.

    Entering the Callback Number. When prompted for the reminder callback number, there are a couple of things to keep in mind. First, if you've specified "local" as the trunk to use for reminders in the reminder.php script, then the phone numbers can be entered in any format supported by your dialplan. Press the pound key after entering the appropriate number. The calls will be placed using the trunks specified in your dialplan rules. The one exception is extensions on your local Asterisk system since these can't be routed by Asterisk@Home or TrixBox systems using your outbound calls dialplan rules. The way we handle extensions is by examining the length of the phone number. At the top of reminder.php, you can specify the maximum number of digits for local extensions by setting $extensionmaxdigits. So long as the callback number is less than or equal to this number of digits, the system has the smarts to correctly route the call to a local extension.

    If you have designated a particular trunk for placement of reminder calls, then you'll need to make certain that the format of the phone numbers entered for reminders on your system matches a dial string supported for this outbound trunk in your dialplan. For example, if this trunk requires that calls be entered with a 1 and then an area code and 7-digit number, then that is the only format that should be used for entering callback numbers in your reminder system. Again, the one exception is calls to local extensions. So long as the number of a local extension is entered with less than or equal the number of digits set for the $extensionmaxdigits variable in reminder.php, the call will be routed properly to the local extension regardless of the trunk setting.

    Finally, here's a shortcut that can be used if the phone you're using to schedule the reminder is the same one on which you want to get the reminder callback. In this case, just press the pound key when prompted for the number to which to deliver the reminder message. This will set the callback number as the caller ID of the phone you used to schedule the call. If it's a local extension, then the caller ID will be set to the local extension number of the phone from which you placed the reminder scheduling call. Just be sure your $extensionmaxdigits is set correctly or calls to local extensions will fail.

    Entering the Date of the Reminder. Once you accept the reminder message, you'll be prompted to enter the date on which this reminder will be delivered. Dates are entered using a four-digit year, then a two-digit month, and then a two-digit day using the time zone of the Asterisk system running the Telephone Reminders System. There is some error correction but not much. You obviously can't schedule reminders in the past! And you don't need to press the pound key after entering the eight digits. Beginning in version 2.5, you now can press the pound key (#) instead of entering an 8-digit date, and the system will set the reminder date to today. Once you've entered a date, the system will tell you what date you entered including the day of the week. If the entry is correct, just press 1 to move on.

    Entering the Time of the Reminder. Now you'll be prompted to enter the delivery time for your reminder. Times are entered as a two-digit hour and two-digit minute using the time zone of the Asterisk system running the Telephone Reminders System. For times less than 1200, you will be prompted whether you meant AM or PM. For those that understand military time, you can avoid this step by entering times using the format: 1345 which means 1:45 p.m. You don't need to press the pound key after entering the four-digit time for delivery of your reminder. Keep in mind that you cannot schedule a reminder for delivery in the first five minutes after midnight. Other times "in the midnight hour" should be entered in the format: 0045 which means 12:45 a.m. Keep in mind that reminder times always must be at least 5 minutes in the future. Finally, you cannot schedule two reminders for the exact same date and time for delivery to the same phone number. Once you enter a delivery time, the system will play back both the date and time for the reminder as a precaution. Press 1 to accept your entries.

    Entering Recurring Reminders. Beginning with version 3, you now will be prompted whether to schedule (1) a single reminder, (2) a recurring reminder every weekday (M-F), (3),a recurring reminder every day, (4) a recurring reminder every week, (5) a recurring reminder every month, or (6) a recurring reminder every year. Once you make a selection, your reminder will be scheduled. If you choose an option other than 1 through 6, a single reminder will be scheduled.

    Where Reminders Are Stored. There are actually two files that make up each reminder: the .call file which places the actual call and the .gsm file which is the reminder message itself. The file naming convention is HourMinute.Date.PhoneNumber with either a .call or .gsm extension. The sound files are all stored in /var/lib/asterisk/sounds/custom. For recurring reminders, duplicates of the .call script and the .gsm message are stored in /var/spool/asterisk/recurring with the date of the next recurring reminder. At midnight on the next scheduled date, the two files are copied to the /var/spool/asterisk/reminders and /var/lib/asterisk/sounds/custom folders respectively. Then the next scheduled reminder date is set in the two filenames. For single reminders, prior to the delivery date of the reminder message, the .call file is stored in /var/spool/asterisk/reminders. Then, at 12:03 am on the date the reminder is scheduled for delivery, the run_reminders script in /var/lib/asterisk/agi-bin moves the affected .call files to /var/spool/asterisk/outgoing. The .call files in the outgoing directory are reviewed every minute of the day by Asterisk. By examining the time stamp of the file, Asterisk looks for a match with the current hour and minute of the day. Once the time for the call arrives, Asterisk processes the .call script and places the call. All dialing retries are handled internally by Asterisk with no user or program control so it's important to set your default values correctly in the reminder.php script as explained above. Once the .call file is processed, Asterisk discards the file whether the call was successful or not. As noted above, the reminder message file is only discarded if the call is completed successfully. So, from time to time, you do need to review the contents of /var/lib/asterisk/sounds/custom and discard reminder messages, if any, with dates in the past. Note also that, if you begin scheduling a reminder and change your mind and hang up after recording a reminder message, that recorded message will still exist in /var/lib/asterisk/sounds/custom.

    Finally, a word of caution about the reminder message files: be very careful in deleting these files. The message files and .call files are linked by filename only, and there is no error detection or correction if the message file gets discarded before the time for the reminder call arrives. What would happen in such a situation is the call would be placed, someone would answer, Allison would say "please hold for an important reminder," and then there would be a brief silence followed by Allison saying "to repeat this reminder, press 1; otherwise, press 2" which is not entirely helpful. To delete a recurring reminder, delete both the .call and .gsm files from /var/spool/asterisk/recurring. Note that the .call file will have an additional extension which tells the recurring type, e.g. .daily, .weekly, etc.

    Reminder and Wakeup Call Processing. It has been documented that flooding Asterisk with a bunch of .call scripts simultaneously can cause some of the scripts to be discarded without being executed. We hope this has been resolved in Asterisk 1.2.4, but just be alert to the possibility of a problem if multiple calls are scheduled at exactly the same time to different numbers.

    When you're first getting started with the reminder system, it's probably a good idea to fire up Asterisk's Command Line Interface (CLI): asterisk -rvvvvv. Then you can watch as the reminders are scheduled and reminder calls are placed. Just schedule a reminder for five minutes from the time you begin the reminder call, and you'll be all set to give it a whirl. By default, there's also a reminder log file produced for the last reminder call placed. You can display this file with the following command: cat /var/log/asterisk/reminder.txt.

    For Programmers Only. If you're just getting into PHP and AGI programming with Asterisk, then have a second look at reminder.php. In particular, take a look at the section of code that begins with parse agi headers into array. As best we can tell, our initial tutorial on Telephone Reminders was the first version of this subroutine written in PHP that actually worked. We've tried to repeat our success here. If you review the log file (reminder.txt), you will see a listing of all the AGI headers which are passed by Asterisk to PHP. But this is the first code we've seen that correctly reads the headers into variables where you can actually retrieve the content. We call it a feature. For example, the commented out line ($tmp = $agi['dnid']) shows the syntax to retrieve the DNID value from Asterisk. Just make a mental note that the parse AGI headers code in reminder.php actually works. Some of our previous code inherited the mistakes of others, but we've now taken the time to get this functioning properly because we needed it for something else. Here's the complete list of AGI headers that can be saved to variables in your PHP code should the need ever arise:

    read: agi_request: reminder.php
    read: agi_channel: SIP/204-6a1a
    read: agi_language: en
    read: agi_type: SIP
    read: agi_uniqueid: 1138010325.1367
    read: agi_callerid: "Line2" <204>
    read: agi_dnid: 123
    read: agi_rdnis: unknown
    read: agi_context: reminder9
    read: agi_extension: h
    read: agi_priority: 2
    read: agi_enhanced: 0.0
    read: agi_accountcode:

    You'll also want to take note of a little quirk in Asterisk (compared to some PBXs). To decipher the extension which actually placed a call, you must parse the agi_channel variable for the data between the slash and hyphen characters since the DNID (dialed number identifier) returns the extension being called (as opposed to the originating extension) when an internal call is placed. Here's one PHP approach to get the answer which in this case happens to be extension 204. Regex wizards could probably save a line of code, but who cares.

    $CallingID = substr(stristr($agi['channel'],"/"),1);
    $CallingID = substr($CallingID,0,strrpos($CallingID,"-"));

    Web Interface to Telephone Reminders. We've built a very simple web page that will let you review which reminders are pending on your system. Recurring reminders are NOT yet included excepted those scheduled for delivery today. You can access the web page directly at http://192.168.0.111/reminders/ using the IP address of your Asterisk system. To install the Telephone Reminders web interface, log into your Asterisk system as root and then issue the following commands:

    cd /var/www/html
    mkdir reminders
    cd reminders
    wget http://nerdvittles.com/aah2/webreminder.zip
    unzip webreminder.zip
    rm webreminder.zip

    Be advised that we are just getting started with a web interface to the Telephone Reminders application. Stay tuned for loads of additional features!

    Security Reminder. If you plan to open the Asterisk web interface on your system to the public Internet, make sure to take security precautions to reduce the risk of a stranger trashing your system or running up your phone bill. Just click here and search for our articles on security to get your system up to speed.

    Hot Tip! O'Reilly's must-have book, Asterisk: The Future of Telephony, is still available for free download here under a Creative Commons license. This is a cleaned up version of the original PDF which fixes pagination and compresses the file size to 3.9MB using Acrobat's Reduce File Size tool. Requires at least Acrobat 4 to load. Special thanks to Alexander Burke for all the hard work cleaning this up.

    Email Delivery of Reminders. Assuming you have email messaging working on your Asterisk system, Telephone Reminders has the ability to deliver an email copy of reminders to the recipient in addition to a phone call. Be advised that, if the phone call is never completed, the email copy of the reminder will not be delivered. The reason for this is because Asterisk never passes the call to the context which handles delivery of the email message until the call is connected. So ... no connection, no email. However, if the recipient has an answering machine or voice mail, that would trigger delivery of the email message.

    Once you've installed the new contexts to support email messaging, step two is registering email addresses for extensions and phone numbers to which you want email reminders delivered. Log in to your Asterisk server as root, and start up the Command Line Interface (CLI): asterisk -r. For each extension and phone number for which you want to activate email reminders, enter a command at the CLI prompt that looks like this: database put EMAIL 6781234567 joe@schmo.com where 6781234567 is the phone number of the reminder recipient and joe@schmo.com is the recipient's email address. You can display all existing EMAIL addresses that have been entered into your Asterisk database with this command: database show EMAIL. If you need to modify an existing entry, simply delete it and reenter it. To delete an existing entry, use the following syntax: database del EMAIL 6781234567.

    MIME-Construct: Wherefore Art Thou? A Linux utility, MIME-Construct, made it easy to convert images (like faxes) to PDF documents and also facilitated the emailing of just about any other document including reminder messages. Unfortunately, it came up missing in TrixBox, and it's difficult to install because of all the Linux dependencies. So here's a simple solution that restores the original functionality of MIME-construct thanks to the programming genius of Rob Thomas. Since Rob's fax-process.pl code (included in freePBX) mimics the old MIME-construct application, the simple solution was just to tweak it a bit for Nerd Vittles and TrixBox compatibility and then copy a renamed version into the PATH (remember the DOS PATH!) on your Linux box. Log in as root and issue these commands, and you'll be back in the mime-construct business with TrixBox:

    cd /usr/local/bin
    wget http://nerdvittles.com/trixbox123/mime-construct
    chmod +x mime-construct


    Nerd Vittles Demo Hot Line (courtesy of les.net). You now can take a number of Nerd Vittles projects for a test drive... by phone! The current demos include (1) MailCall for Asterisk with password 1111 (retrieve your email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, and (4) Weather Forecasts by U.S. ZIP Code. You're not prompted for #4 yet, but it does work! Just call our number (shown in the left margin) and take any or all of them for a spin. The sound quality may not be perfect due to performance limitations of our ancient Intel 386 demo machine. But the price is right.

    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...

    Putting TeleYapper to the Test

    For those that are new to Nerd Vittles, you may not recall that, on Valentine's Day in 2006, we released TeleYapper, a telephone broadcasting system that distributes reminders and other messages to large or small groups of people by phone, of course. Believe it or not, it still works with almost all versions of TrixBox and Asterisk@Home 2.5 or later. But, it's one thing to develop a piece of software that can send unattended telephone reminders to your clients, patients, or Little League team. It's quite another to actually use it for a huge project and find out where all the warts are. As the resident cheerleader in our new neighborhood, I was wrestling with how to get detailed information about a meeting to review a proposed zoning change to a group of 700+ homeowners... in a hurry. Delivering flyers door-to-door was not going to happen. E-mail was certainly an option, but that unfortunately is hit and miss these days. With spam blockers, spam filters, missing email addresses, and verification requirements from companies such EarthLink, we decided we could only count on a delivery success rate of about 50 per cent.

    The one piece of technology that everyone in the neighborhood had was a telephone. And our neighborhood database showed only 7 people with unlisted or do-not-call telephone numbers. So it was time to dust off our very own, free TeleYapper software and put it to the test using Asterisk®. Could it really deliver 700 phone calls using Voice Over IP with a home broadband connection in a reasonable time at a reasonable cost without any problems? To preserve our existing home phone system, we decided to really push the envelope by running it on a Windows desktop using our out-of-the-box VMware version of TrixBox 1.2.3.

    Picking a Provider. It may not sound like a big deal, but choosing a really good VoIP provider matters when all of your neighbors are going to be listening to a 60 second message that has your name all over it. Can you imagine getting complaints from all your neighbors that go something like this: "I got some funny message from you last night on my answering machine, and I couldn't understand a single word of it. There was all this echoing, and I finally deleted the message after listening to about 10 seconds of gibberish." So, yes, there was the personal reputation to preserve. And picking a high-quality VoIP service provider was crucial in getting the actual message content delivered reliably. But there was more to consider as well.

    First, you can't really use an all-you-can-eat VoIP service for something like this because it will trigger virtually every safeguard mechanism providers have put in place to make certain that folks aren't making unlimited, automated business calls on a residential phone plan. Second, with the exception of TelaSIP, most all-you-can-eat providers won't let you adjust the CallerID of the outbound calls. We wanted to do this to identify the call as coming from the neighborhood association's telephone number, not mine! Then there's the cost factor. We didn't mind paying by the minute within reason, but 2¢ per minute was just too expensive, and we'll explain why in a moment.

    We ended up picking Vitelity for a number of reasons. Most importantly, they have outstanding VoIP service with support for unlimited outbound trunks if you have the bandwidth to support it. We chose to use up to 4 simultaneous trunks which worked well using Comcast broadband service. They also have the best and most flexible configuration options in the business. You can even create your own sub-accounts. Thus, we could set up a new TrixBox system with a sub-account even though we also use Vitelity as a fallback provider on our home system. Most providers don't support sub-accounts or even multiple accounts. With any other provider, you would have been forced to disable the existing trunk on your main system before you could use it on another system. With a Vitelity sub-account, none of this juggling is necessary. Vitelity also provides adjustable CallerID and excellent call accounting with detailed, tailorable logs which made it easy to print a report and get reimbursed for the calls. And, last but not least, their pricing was reasonable at 1.39¢ per minute with six second billing increments and no charges for failed calls. We made the right choice. Setup was easy using their Asterisk and TrixBox templates, and the calls were flawless with no hiccups.

    Setting Up the Database. Now things get interesting. As installed, TeleYapper comes with a MySQL database that is preconfigured to work with TeleYapper. The problem is that you either have to do a lot of typing to get the data into that database before you make the first call, or you need a way to quickly assimilate information from an alternate source. Since we were working with a fairly large number of records, we didn't relish banging in 700+ names and phone numbers. So here's a little trick that works with just a little bit of database knowledge. There is no easy way to "import" data from a text file or other MySQL database because the fieldnames and field sizes won't match up. However, you can do something similar. What we did was export the neighborhood database into a comma-delimited ASCII text file. Then, using phpMyAdmin which comes with TrixBox, you can create a MySQL database table using this file as your source. There are hundreds of good tools for importing data into MySQL. Just do a little Googling. Or you can try Navicat which works for many formats. That's only half the battle unfortunately.

    You still need to get the data into a format that TeleYapper can use, or you have a good bit of programming work ahead of you. We wrote the TeleYapper code, but we still didn't want to muck around in it to make this database work. So here's the trick. When you create your new table (we'll call it XYZ), create it as part of the teleyapper database on your system. Then take a look at the callees table that comes with TeleYapper. You'll notice that it has the following fields with the field types and lengths shown in parentheses:

    id (medium integer 9)
    name (varchar 40)
    phonenum (varchar 20)
    group (tiny integer 1)
    lastokcall (datetime)
    lastcall (varchar 7)

    Using phpMyAdmin, you want to modify the structure of your new XYZ table so that it includes the fields shown above. For example, if your XYZ table has a field called LASTNAME, simply rename it to name and adjust the field length. You won't lose your existing data. Do the same thing with the phone number field. You'll probably have to add new fields to your XYZ table for id, group, lastokcall, and lastcall. Don't leave any of the fields out or TeleYapper will croak when you try to run it. For the id field, be sure to choose the auto-increment and index options so you get a unique field in your table. Once you're finished, browse through the file and make sure everything looks right. For phone numbers, be sure they're in one of the two following formats: 404-123-4567 or 4041234567. That's what TeleYapper is expecting to find.

    When we originally wrote TeleYapper, we weren't really focused on folks using external databases, but you may need to. So, if your phone numbers aren't in this format, you can edit the teleyapper.php file in /var/lib/asterisk/agi-bin and add a few lines of code that look like this to convert 404.123.4567 and (404) 123-4567 to 4041234567 and to get rid of spaces in entries like 404 123 4567:

    $phonenum = str_replace( ".", "", $phonenum );
    $phonenum = str_replace( " ", "", $phonenum );
    $phonenum = str_replace( "(", "", $phonenum );
    $phonenum = str_replace( ")", "", $phonenum );

    This new code should be inserted immediately after existing line 231 which reads: $phonenum = $row["phonenum"].

    Now where were we? Once your new database table looks good to go, delete the existing callees table using the Drop icon. Then rename your XYZ table to callees. Now your TeleYapper database is ready for use. If you want to be able to use subsets of the table to make calls, you'll need to fill in appropriate group numbers. Otherwise, every entry will have a group entry of zero.

    Calling Logistics. We built some flexibility into TeleYapper to handle multiple, simultaneous calls as well as redials. Call us nervous, but we like to watch what's going on when calls are placed. And when you get too many things going on at the same time, it's difficult to monitor with asterisk -rvvvv. This is especially true if the length of the message you plan to deliver is 50 seconds or more. Why? Well, answering machines don't typically pick up on the first ring, and neither do people. So, if you only separate your calls by one minute and you permit redials for calls that go unanswered, you can quickly have 7 or 8 calls going on at the same time since TeleYapper is designed to replay your message once if an answering machine picks up or no one presses a key after the initial message plays out. Our solution was to space out the calls a bit more (2 minutes instead of 1) and turn off the automatic redial of failed calls. To do this, edit the TeleYapper app and make the following entries using your desired CallerID number, of course: nano -w /var/lib/asterisk/agi-bin/teleyapper.php:

    $numcallattempts=0 ;
    $callspread=2 ;
    $callerid = "6781234567" ;

    Unexpected Surprise. Some folks are never home when you try to call them, and we expected that when TeleYapper was designed. But, believe it or not, about 50 people out of 700 in our neighborhhood don't have an answering machine. In short, they don't seem to care if they miss that all-important call announcing that they've won the latest lottery sweepstakes in England. To be honest, I hadn't really appreciated the scope of that wrinkle when TeleYapper was being developed. Yes, there was a way to kick off another round of calling, but this quantity of redials forced us to adjust the redial option ($numcallattempts) to 0 to avoid dozens of simultaneous outbound calls. Here's a little tidbit of practical wisdom for would-be programmers. If someone isn't answering their phone at 10:02 on a weekday morning, chances are they're probably not going to answer at 10:04 a.m. either. They're at work, stupid! So you can waste the entire day with fruitless redials, or come up with a new Plan B. Our solution was pretty simple, we placed a round of calls beginning at 9 a.m. in the morning, and then we placed another round of calls (to pick up the failed calls) starting at 6 p.m. the following night. Keep in mind that, if you want to cancel your round of calls in the middle, you can't just shut down Asterisk and pick up where you left off the next day. Why? Because TeleYapper schedules each call for a specific time of the day on the specific day that you first run the application. If you shut down your system and restart it the following morning, it will try to place all the remaining calls at once. The solution is fairly simple. Just delete all the files in /var/spool/asterisk/outgoing with commands like this. The first command is a good idea when you first start your calling spree. Look at the last entry in the directory to decipher what time your last call will be placed. If it's in the middle of the night, you might want to delete some of the entries and place those calls on a subsequent day during daylight hours.

    ls -all /var/spool/asterisk/outgoing
    rm -f /var/spool/asterisk/outgoing/*

    The next day when you're ready to pick up where you left off, initiate another TeleYapper session with the same group ID and choose option 3 to dial calls that never were completed.

    TeleYapper's Calling Process. Here are the actual steps in the TeleYapper call setup process:

  • Caller with TeleYapper password places call to M-S-G (extension 674) to activate a TeleYapper session.
  • Asterisk answers the call, provides IVR menu: playback a message, record a new message, or place a call.
  • If caller chooses to place a call, IVR prompts for Group number to call (0-9).
  • Asterisk passes the Group number to MySQL (checkgroup.php) to look up the number of callees in the chosen Group.
  • Group count is passed back to Asterisk which uses Allison to tell the caller how many callees are in the chosen Group.
  • Caller has option of placing the call, hanging up, or choosing advanced options (This is Option 3. It redials previously unsuccessful calls in chosen Group again).
  • If caller chooses to place a new call, Asterisk thanks the caller, hangs up, and then passes control to teleyapper.php to handle placing the calls.
  • TeleYapper time stamps dialing scripts a minute apart for each call beginning two minutes after the initiating request. Scripts are placed in the Asterisk outgoing calls queue.
  • TeleYapper initializes the date/time and status fields for each record in the Group to be called. These are only filled in when a call is then answered.
  • If you've enabled logging in teleyapper.php, then the log is generated after all of the call setups have been completed.
  • If you've enabled emailing of the teleyapper.php log, then the log is emailed to your email address at the same time.
  • Asterisk checks its call queue each minute and places each call at the appointed time, Then it waits for the callee to answer.
  • If no one answers the call, nothing is posted to the MySQL database regarding call completion. That's how we identify unsuccessful calls.
  • If the call is answered, the callee is advised to hold for an important message and then your prerecorded message plays.
  • Callee is then prompted to press 1 to replay the message, press 2 to blacklist the last caller (you!), or press 3 to hang up.
  • If callee presses 1, your message is replayed, and then the call is disconnected. MySQL database will show date/time of call with ReplayedMsg as status.
  • If callee presses 2, log will reflect that caller requested blacklisting. MySQL will actually DELETE this person from your database. It's the LAW!
  • If callee presses 3, Allison says goodbye and Asterisk hangs up the call. MySQL database will show date/time of call with status of OK.
  • If callee makes no choice, Asterisk will replay your message, then hang up, and record the date/time of call with status of AnsMachine.
  • If you've enabled logging in teleyapper2.php, then the individual call log is generated and appended to the main log file after each call has been placed.
  • If you've enabled emailing in teleyapper2.php, then the call log is emailed to your email address after EACH call has been placed.
  • The Tab. You're probably wondering what the cost was to deliver all of the messages to 700 people since we were paying by the minute. Since the message was about a minute long, that translated into roughly a two minute call for calls in which an answering machine picked up since TeleYapper automatically replays a message if the callee doesn't press a button on their phone. That accounted for roughly 70% of the calls. Even with the large volume of calls to answering machines, the total tab for placing the 700 calls was just under $10. Enjoy!


    Nerd Vittles Demo Hot Line (courtesy of les.net). You now can take a number of Nerd Vittles projects for a test drive... by phone! The current demos include (1) MailCall for Asterisk with password 1111 (retrieve your email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, and (4) Weather Forecasts by U.S. ZIP Code. You're not prompted for #4 yet, but it does work! Just call our number (shown in the left margin) and take any or all of them for a spin. The sound quality may not be perfect due to performance limitations of our ancient Intel 386 demo machine. But the price is right.

    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...

    Keeping Telemarketers At Bay With TrixBox and freePBX-Enabled Asterisk Systems

    Just when you thought the National Do-Not-Call Registry was getting you some peace and quiet during the dinner hour, VoIP telephony comes into its own and gives the telemarketers a brand new universe to pollute. And, of course, the politicians exempted themselves and non-profits from the Do-Not-Call rules anyway. So the unwanted dinnertime calls from your best friends at campaign headquarters and the Fraternal Order of Police will always need to be dealt with. Lucky for all of us, there’s an Asterisk® PBX standing between the telemarketers and the dinner table. We first wrote about this 16 months ago so we wanted to provide an update showing how much simpler things have become with TrixBox and any other Asterisk system running freePBX 2.2.x. In the "old days" you had to do a good bit of mucking around in the Asterisk code to blacklist callers. And that method still works. However, you now can avoid the coding knuckle drill. With the latest versions of freePBX, you can send a special information tone to certain callers to block autodialers just by adding the unwanted numbers to your BlackList. There’s no code to modify at all. And there are three simple ways to manage your blacklist. Here’s how.

    BlackListing Callers With freePBX. freePBX 2.2.x now includes all the tools you’ll need to block unwanted calls. If you’re running one of the free TrixBox 1.2.3 systems at the top of this page, we’ve already provided a tutorial to get your freePBX system upgraded. Once you’ve done that or if your running TrixBox 2.x, to block calls from unlisted numbers, simply log into freePBX and choose Setup, General Settings, and set Allow Anonymous Inbound SIP Calls to No. This may cause too many calls to be blocked with some hosting providers. Another option is to set Privacy Manager to Yes in each of your Inbound Routes setups. This forces Asterisk to prompt callers for their phone number when no CallerID is provided. If there are old girlfriends and ex-wives that you’d prefer to never hear from again, choose Setup, Blacklist, and plug in the numbers. When they call, they’ll be greeted by a disconnect tone and a message that your number is no longer in service. It’s as simple as that. If you change your mind, you can remove numbers from your blacklist just as easily. freePBX now displays the list of all the numbers you’ve blacklisted. Just click Delete beside the number you wish to remove from your blacklist, and you’re done. It doesn’t get much easier than that.

    BlackListing Callers Using Your Phone. You may not always want to run to your computer to block future calls from someone that annoys you. freePBX now includes built-in support for blacklisting callers using any telephone on your Asterisk system. If you’ve just hung up and wish to blacklist the last caller, pick up your telephone and dial *32. You’re done. If you want to manually enter a different number into your blacklist, pick up any phone on your system and dial *30. Enter the number to be blacklisted when prompted. To remove a number from your blacklist, dial *31 and enter the number to be removed.

    BlackListing Callers Using Phone Genie for Asterisk. If you’ve installed our free Phone Genie for Asterisk web utility, you also can blacklist callers by sending an HTML command to your Asterisk server using any web browser including the one on your cellphone.

    To add a number to your blacklist, just enter a command like this where 192.168.0.123 is the IP address or fully-qualified domain name of your Asterisk server, 6781234567 is the number to be blacklisted, and 1234 is your admin password for Phone Genie:

    http://192.168.0.123/nv-genie.php?action=dbput&family=blacklist&key=6781234567&value=1&pw=1234

    To remove the same number from your blacklist, the web command would look like the following:

    http://192.168.0.123/nv-genie.php?action=dbdel&family=blacklist&key=6781234567&pw=1234

    To display the numbers in your blacklist, the web command would look like the following:

    http://192.168.0.123/nv-genie.php?action=dbshow&family=blacklist&pw=1234

    You’re an expert now. So just sit back and wait for the Bad Guys to call. They will.

    Our Special Thanks. We’re actually out cruising in the middle of the Carribean this week soaking up a little sun. So don’t be frustrated if your comments don’t get posted until next week. We did want to take a moment to thank all you for reading Nerd Vittles. About 50,000 folks from 137 countries around the globe read Nerd Vittles every week. The Nerd Vittles Official Flag at left shows all of your home towns, and that’s just this month. Incidentally, the countries are ordered by the number of actual visitors from each country. We like detail work unfortunately. InfoWorld finally discovered Open Source VoIP this week, and Vonage would do well to brush up on the advantages of open source VoIP… within the next two weeks. The VoIP Revolution is, of course, old news to us and to you. But it does demonstrate that our little secret is becoming front page news worldwide almost every day. Thanks again for your support. And, yes, we’re still looking for a few good advertisers. You don’t get a huge ad, but you get an enormous, focused, loyal group of readers. And we’ve got the cheapest ads on the planet, just $500 a month. Give it a shot. You won’t be disappointed, and you’ll be helping us hire some H-E-L-P, not to mention paying for these Carribean junkets.

    Security Reminder. If the version of Asterisk displayed when you start up the Command Line Interface (asterisk -r) predates Asterisk 1.2.17, your system is extremely vulnerable to a SIP denial of service attack. For complete upgrade instructions, read this Nerd Vittles article.


    trixbox Appliance. In case you missed it, Fonality has announced a new line of turnkey trixbox appliances. Two-port and six-port configurations as well as models with one and two preconfigured T1’s, mirrored drives, and redundant power supplies will be available for purchase in June starting at $999 for the base model. Stay tuned to Nerd Vittles for a sneak peak and test drive of what’s coming. In the meantime, you can read all about the new line of trixbox appliances by clicking on the link at the top of the page. Great idea!


    Nerd Vittles Demo Hot Line (courtesy of les.net). You now can take a number of Nerd Vittles projects for a test drive… by phone! The current demos include (1) MailCall for Asterisk with password 1111 (retrieve your email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, and (4) Weather Forecasts by U.S. ZIP Code. You’re not prompted for #4 yet, but it does work! Just call our number (shown in the left margin) and take any or all of them for a spin. The sound quality may not be perfect due to performance limitations of our ancient Intel 386 demo machine. But the price is right.

    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…

    Click2Dial for Every(Asterisk)man… and Woman

    There have been any number of click to call applications released for Asterisk®, but none quite so simple to implement as the one we've uncovered. The original was introduced at VoIPjots.com about this time last year. Then Rafael Cortes at asteriskpbxs.com further embellished it. We took Rafael's version and added a few minor enhancements, and today you get Click2Dial for Asterisk to freely use with virtually any Asterisk PBX. It works exceptionally well with our customized versions of TrixBox 1.2.3 which you can download from the links above for Windows, Intel Macs, and Linux.

    Overview. For those new to this technology, the basic idea behind Click-to-Dial or click to call applications is that folks can visit your web site, click on a link after plugging in their phone number, and a call is placed from your Asterisk PBX connecting you and them without the visitors incurring any long distance charges. The initial call to you is placed first, and it can be to any extension on your Asterisk system or even your cellphone if you have more than one outbound (termination) trunk. If you don't answer, no second call is placed. Once you answer, the outbound call to the web site visitor is placed. We've added support in the PHP application so that callers can also enter their name, and the name entry together with the phone number to be called will be displayed on your phone before you answer the call: Web-John Doe 843-678-1234. Be aware that cellphone providers throw CallerIDName information in the bit bucket so the name display only works on calls to Asterisk extensions, but the CallerIDNumber will work with any of the providers that support adjusting your outbound CallerID, such as TelaSIP. See our Roundup of VoIP Providers for more choices. Anyway, the web site visitors get 12 characters in which to enter their name and 10 for their area code and phone number. Without much tweaking, the 10-digit limitation can be adjusted for international calling. No dialplan changes are required to get this working assuming your dialplan supports 10-digit dialing from extensions on your system. Simply drop the code into the web directory on your Asterisk server, open port 80 on your firewall to point to the web server on your Asterisk or TrixBox system, and you're off to the races. Installation and setup time: about 2 minutes.

    Click2Dial for Asterisk Installation and Setup. To download the Click2Dial for Asterisk application, click on this link. Save and unzip the archive on your Desktop. Open the Click2Dial folder and copy click2dial.php into the web folder on your Asterisk server (/var/www/html on TrixBox systems). Log into your Asterisk server as root and edit the file: nano -w /var/www/html/click2dial.php. For TrixBox systems, the only entry you need to change is the incoming call destination on line 38. For a SIP extension on your Asterisk system, the line should look like this: $strChannel = "SIP/502"; where 502 is the extension you wish to ring for incoming Click2Dial calls. If you have multiple outbound trunks and you want to route incoming web calls to your cellphone, here's the syntax:

    $strChannel = "local/1NXXNXXXXXX@from-internal" ;

    Replace 1NXXNXXXXXX with the actual phone number that you currently dial from an extension on your system to place a call to your cellphone. Save your change (Ctrl-X, Y, then Enter), and you're done! To try it out, point a web browser at the following page substituting your own fully-qualified domain name or IP address of your Asterisk server: http://192.168.0.211/click2dial.php. Feel free to cut-and-paste the code into an actual web page if you'd prefer to integrate Click2Dial for Asterisk into your existing web layout.

    Other Goodies. We've also included all of Rafael Cortes' other handiwork in the archive which you are free to use (not sell!) if you so desire. In addition, we've included our YeeHah add-on for AsteriDex. This lets you do a couple of things. First, you can use it as a Click2Dial add-on which works exactly like the code described above. Just edit the top of the file and specify your CallerID number and extension number to be called. Then move the file to your existing AsteriDex folder on your Asterisk server. While editing the file, if you set Click2Call=false, then the application lets you actually dial outbound calls to two phones of your choosing from the web page. This is handy for personal use but obviously has serious security risks unless you also uncomment the top few lines in the application and specify the actual IP addresses of the computers on which this application can be used. If you don't understand what any of this means, then do yourself and your phone bill a favor, don't use it! Otherwise, anyone with access to your AsteriDex web application can make unlimited calls on your nickel to anywhere. Enjoy!

    Nerd Reminder. Don't forget today is Valentine's Day. Give the keyboard a rest for a bit.

    Nerd Vittles Valentine's Day Giveaway. As a special thanks to our loyal readers, we have a couple of free passes to give away to the Fonality trixbox Open Communications Certification course being held on March 5-6, 2007 at the Los Angeles LAX Westin. The retail value of each pass is $1495. If you'd like to attend, post a comment to this article which begins with I WANNA GO. Just tell us why you'd like or need to go to the course. And be sure to include your real name and email address in the required fields. Email addresses do NOT get shown on the web but do give us a way to get in touch with you. Except for the winning entries, none of the other comments will actually be posted on the blog so feel free to lie your ass off beg. To be eligible, we must receive your comment before 7 a.m., Eastern time, on Thursday, February 15, 2007. We will pick two lucky winners tomorrow morning. Decision of the judges (Nerd Uno) is final. If you don't hear from us by noon (Eastern time) tomorrow, then you didn't win. Sorry. Make up a better story next time. Winners are, of course, responsible for their own transportation, lodging, food and beverage expenses. This is a perfect opportunity to get certified on the TrixBox platform at minimal expense. Offer void where prohibited by law. Good luck!


    Nerd Vittles Demo Hot Line (courtesy of les.net). You now can take a number of Nerd Vittles projects for a test drive... by phone! The current demos include (1) MailCall for Asterisk with password 1111 (retrieve your email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, and (4) Weather Forecasts by U.S. ZIP Code. You're not prompted for #4 yet, but it does work! Just call our number (shown in the left margin) and take any or all of them for a spin. The sound quality may not be perfect due to performance limitations of our ancient Intel 386 demo machine. But the price is right.

    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...

    PBX-in-a-Flash: HOW-TO NerdVittlize Your TrixBox 1.2.3 Asterisk PBX

    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.

    Perhaps the most requested new article by Nerd Vittles' readers has been a HOW-TO for configuring a Linux-based TrixBox system to do everything our VMware TrixBox build for Windows can do. So today we decided to tackle it. If you read nothing else, read the following cautionary note: This application only works with a clean build of TrixBox 1.2.3 using the TrixBox .iso install on a dedicated PC. If you've already installed TrixBox 1.2.3 and made any configuration changes either to Linux or Asterisk with or without using freePBX, do not use this program. It will overwrite (aka erase) all of your existing settings! Just consider it the last critical step in an initial TrixBox 1.2.3 install, and you should be fine. There, you've been warned.

    Overview. If you can cook French Toast without burning yourself or setting your kitchen on fire, then PBX-in-a-Flash™ will be a piece of cake for you. The good news is that, with a clean TrixBox 1.2.3 .iso install, this may just be the greatest thing since sliced bread. Why? Because it builds you a turnkey Asterisk PBX with all of the security patches, and freePBX and WebMin updates, and Nerd Vittles apps in just a few minutes with no user intervention. You'll still need to secure your passwords and walk through the freePBX module updates process, but you'll be ready to roll with 8 extensions and 2 phone lines in less than 30 minutes... and that includes installation of TrixBox from the boot disk. You really don't need to know much of anything about Linux or Asterisk for that matter. And, as much as we love freePBX, the number of menus and options can be intimidating until you get your feet wet. PBX-in-a-Flash solves that by preconfiguring virtually everything on your new system. For ease of reference, portions of our previous tutorials on TrixBox 1.2.3 and the VMware build for TrixBox 1.2.3 are also repeated here so that everything is easy to follow. And, when you're finished, phones ring, voicemail works, voicemail messages get emailed to you without any further tweaking of Linux and SendMail, callers get a welcoming message and music on hold before your phones start to ring, and those (like you) with the secret password can do all sorts of other tricks while the AutoAttendant plays... such as getting dial tone to make an outbound call using your (almost) free VoIP international calling plan.

    Here are the basic steps:

    Step 1. Download and install the TrixBox 1.2.3 .iso on a dedicated PC ... and, yes, VMware installs should also work.

    Step 2. Download and run the Nerd Vittles pbx-in-a-flash script to get everything loaded, configured, and up to date.

    Step 3. Reboot your system and be sure all your passwords are secure.

    Step 4. Load and activate all of the new freePBX modules. We've preconfigured the rest of freePBX for you.

    Step 5. Sign up and then enter your usernames and passwords for your VoIP hosting providers.

    Step 6. Plug in and set up your phones.

    Step 7. Enjoy!

    Step 1. Installing TrixBox 1.2.3. Begin by downloading the TrixBox 1.2.3 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.4 (with an older Linux kernel that doesn't break voice applications!) 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. This install will reformat (aka ERASE) your hard disk before it begins, but it will warn you first. You'll be prompted to choose your keyboard language, then your time zone, and then your root user password. Make up a password that you can remember but others can't ... and write it down! About 5 or 10 minutes after the installation begins (depending on the speed of your machine), the boot disk will eject. Be sure to remove it before the system reboots to continue the install, or it'll just start over by rebooting from the CD again. When the installation is finished, you should see a login prompt.

    So You Need a $100 Computer? TrixBox runs best on a dedicated machine. And, unless you have an old clunker sitting around, here's a deal you shouldn't pass up. It's a used Dell OptiPlex GX150 for $47.91. Bump up the RAM to 256MB for $12.95 (recommended) and add $32 for shipping, and it still comes in at under $100. If you're feeling downright wealthy, add another $10 for a one year parts and labor warranty including shipping fees (recommended). You can also bump up the processor to 1 Ghz for $30 more, and the box still comes in at under $140.

    Step 2. Installing PBX-in-a-Flash. Now for the fun part. Don't do anything on your system yet except to login as root with the password you wrote down. At the command prompt, type these commands in order:

    cd /root
    wget http://nerdvittles.com/trixbox123/pbx-in-a-flash
    chmod +x pbx-in-a-flash
    ./pbx-in-a-flash

    Read the warning and then press the Enter key to proceed with the pbx-in-a-flash update. When it finishes, you'll be prompted to press the Enter key again to reboot your system. Just do it!

    Step 3. Securing Your Passwords.When the install is finished and reboots again, log in as root with the password you assigned. Type help-trixbox for a listing of the other passwords that need to be changed. Change them all NOW! Keep it simple and use the same password for everything. You're not going to expose this web server to the Internet anyway... if you're smart.

    passwd admin
    passwd-maint
    passwd-amp
    passwd-meetme

    Securing AsteriDex. Because of a security vulnerability in our very own AsteriDex, you'll need to download and install this simple patch. Log into your Asterisk server as root and issue the following commands:

    cd /var/www/html/asteridex
    rm -f callboth.php
    wget http://nerdvittles.com/trixbox11/callboth.zip
    unzip callboth.zip
    rm -f callboth.zip
    chown asterisk:asterisk callboth.php
    chmod 775 callboth.php

    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 Ma Bell, 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 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 /etc/asterisk/extensions_trixbox.conf and reload Asterisk. Be sure to use a separate DID for this application and point it to custom-callingcard,s,1. We'll have a terrific new VoIP provider with dirt cheap DID rates to tell you about shortly so stay tuned!

    ;[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. We're going to stop repeating the substitution tip from here on. Whenever you see a reference to 192.168.something, just substitute the private IP address of your TrixBox server. Once the SugarCRM login screen appears, 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. If all you need is a phone dialer and a database that can display CallerID info for your friends and business associates, our AsteriDex product will be a better fit, and it takes about 2 seconds to enter each new person into the AsteriDex database.

    Step 4. Load and Activate freePBX Modules. freePBX is the web GUI which manages your Asterisk system. You access it with a web browser by going to the IP address of your Asterisk server. If you don't know the IP address, log in as root, and it will tell you. Then go to that IP address with your browser, e.g. http://192.168.0.142/. At the main TrixBox menu, choose System Administration. When prompted for your username, type maint with the password you assigned above for passwd-maint. Now choose FreePBX and then Tools and then Module Admin. Put a check mark beside each of the Modules (shown in green) and then click Submit. After the modules are enabled, click the Red Bar at the top of your screen to reload the settings into Asterisk.

    Next, select the Online Modules Repository. Put a check mark beside each of the Modules (shown in orange) and then click Submit. After the modules are installed and enabled, click the Red Bar at the top of your screen to reload the settings into Asterisk.

    Before the extensions will actually ring (instead of going directly to voicemail), you'll need to click on Setup->Extensions. Then choose each extension and at least click the Submit button followed by the Red Bar. This is a security feature to encourage you to change the password for each extension including its voicemail password.

    If you'd prefer that callers hear Music on Hold rather than ring tones after the AutoAttendant plays, then click Setup-> General Settings and change the entry for Asterisk Dial Command Options from tr to tm. To enable recording of incoming calls by pressing *1, add a lowercase w to the string. Then click Submit and the Red Bar when you're finished.

    Step 5. Setting Up Your VoIP Providers. Before you can place calls to real phone numbers, you'll need at least one outbound VoIP provider. Before you can receive calls from real phone numbers, you'll need at least one inbound DID trunk (aka "phone number") from a VoIP provider. These can be the same provider or different ones. Unlike with Ma Bell, more is better in the VoIP world because it gives you some redundancy... and stuff does break from time to time.

    You add hosting providers in freePBX by adding Trunks in the Setup menu. We've preconfigured your system for two providers, VoipDiscount and Stanaphone, so that all you have to do is click on each of those trunks, plug in your account names/numbers and passwords, save your updates, click the Red Bar, and you're off to the races. You may want to choose your own providers which is perfectly fine. But, for $15 which works out to $5 a month, our two picks will get you started for three months with free incoming calls, a free phone number, and 300 minutes a week of free outbound calls to dozens of countries including the U.S., most of Europe and Asia, and Australia. During that three months, you can start your VoIP Provider Education here and then you can read our reviews and HOW-TO's for setting up dozens of different providers with Asterisk here.

    DISA Security. Getting remote dialtone can be a dangerous thing in the wrong hands so let's put your own password (of any length) on the DISA function that is triggered by pressing 8 when your AutoAttendant answers your incoming calls. In freePBX, choose Setup. Then click DISA in the left column of freePBX and then DialTone in the right column. Now enter a PIN that will let you sleep well at night ... knowing that you are paying for all outbound DISA calls. When you finish, click the Submit Changes button and then the Red Bar to reload Asterisk.

    Step 6. Setting Up Your Phones. Before your new PBX will be of much use, you're going to need something to make and receive calls, i.e. a telephone. For today, you've got three choices. Option #1 and the best home solution is to use a Plain Old Telephone or your favorite cordless phone set (with 8-10 extensions) if you purchase a little device (the size of a pack of cigs) known as a Sipura SPA-1001. It's under $60. Be sure you specify that you want an unlocked device, meaning it doesn't force you to use a particular service provider. Once you get it, plug the SPA-1001 into your LAN, and then plug your phone instrument into the SPA-1001. Your router will hand out a private IP address for the SPA-1001 to talk on your network. You'll need the IP address of the SPA-1001 in order to configure it to work with Asterisk. After you connect the device to your network and a phone to the device, pick up the phone and dial ****. At the voice prompt, dial 110#. The Sipura will tell you its DHCP-assigned IP address. Write it down and then access the configuration utility by pointing your web browser to that IP address.

    Once the configuration utility displays in your web browser, click Admin Login and then Advanced in the upper right corner of the web page. When the page reloads, click the Line1 tab. Scroll down the screen to the Proxy field in the Proxy and Registration section of the form. Type in the private IP address of your Asterisk system which you wrote down previously. Be sure the Register field is set to Yes and then move to the Subscriber Information section of the form. The preconfigured extensions are set up as 500 through 508 with voicemail activated for extension 500 and 501 presently. To keep things simple, enter House Phone as the Display Name. Enter 500 as the User ID. Enter 1234 as the Password, and set Use Auth ID to No. Click the Submit All Changes button and wait for your Sipura to reset. In the Line 1 Status section of the Info tab, your device should show that it's Registered. You're done. Pick up the phone and dial 611 to get a current weather report or dial 511 to get today's news headlines.

    If you're like us, you've gone to all this trouble downloading your fancy new PBX, and you sure as hell don't want to wait a week for your Sipura 1001 to arrive before trying it out. So here's the quick and dirty solution. There's software that will run on your Windows, Mac, or Linux desktop that acts like a telephone. You obviously need speakers and a microphone on your system for this to work. Assuming you have those, go to CounterPath's web site and download X-Lite for your favorite OS. There's a manual there, too, but you probably won't need it. Once the download completes, click on it to start the install. Accept the obnoxious license agreement and install the software in the default directory. Unless you want X-Lite to load every time you restart your machine, uncheck the Launch on Startup checkbox. Reboot your system and, if it's also running your TrixBox system, restart it first. Then run the X-Lite application. Click No to turn off X-Lite's spyware. When the "SIP Accounts" window opens, click the Add button and fill in the following data:

    Display Name ... House Phone
    User name ... 500
    Password ... 1234
    Auth. User Name ... 500
    Domain ... the IP address of your TrixBox system

    Leave the other defaults and click on the Check Voicemail tab. For the Number to Dial to Check Voicemail, enter *97. Then click OK and Close. If your Windows Firewall is doing what it's supposed to, it will probably block the connection to your Asterisk system. When prompted, tell it to allow future connections. If this happens and X-Lite does not register with your Asterisk system, click the Down Arrow at the top of the softphone (Show Menu). Click SIP Account Settings, Properties, OK, and Close again. You now should be registered. Dial 611 and get your first weather report. To exit from X-Lite, click the Down Arrow and then Exit.

    Step 7. Enjoy! We saved the best for last. All you have to do now is learn about all the great freebies that have just fallen into your lap. Here's a little info to get you started.

    Linux 101. If you're new to Linux and/or Asterisk, here are a few commands you'll need from time to time. And, if you didn't already know, you don't just pull the plug on a Linux system ... even if it's running in a window on your Windows Desktop. Linux caches lots of stuff to speed up processing. So always shut things down gracefully if your data matters.

    df -h ... Free disk space remaining on your Linux system. Be sure you always have the required 6GB of Windows space for this app!
    logout ... Logs you out of the Linux system.
    Ctrl-Alt ... Gives your Windows cursor back and lets you run other Windows apps until you click again in the nv-TrixBox window.
    asterisk -r ... Runs the Asterisk Command Line Interface (CLI) after you've logged in as root.
    quit ... Exits gracefully from the Asterisk CLI
    amportal restart ... Restarts Asterisk.
    /etc/webmin/start ... Starts up WebMin, the Swiss Army Knife of Linux. Access it with a web browser: https://TrixBoxIPaddress:10000/
    shutdown -h now ... Shut down your Linux system right now. Wait for VMware Player window to close!
    shutdown -r now ... Reboot your Linux system right now.
    nano -w filename ... Edit any file in your Linux system. Ctrl-X, Y, then Enter saves your changes.
    cd dirname ... Changes to another directory below current directory.
    cd /dirname ... Changes to another directory below the root directory.
    ls ... The Linux equivalent of dir to get a directory listing.
    cd /var/www/html ... Home of the TrixBox web server files accessed at http://TrixBoxIPaddress/ or https://TrixBoxIPaddress/
    cd /var/lib/asterisk/agi-bin ... Home of the TrixBox and Asterisk scripts for Asterisk apps.
    cd /var/lib/asterisk/sounds ... Home of Allison and all the voices prompts that make up the Asterisk system.
    cd /etc/asterisk ... Home of all the Asterisk, TrixBox, and freePBX configuration files.

    The Nerd Vittles Collection. Below are links to tutorials for the Nerd Vittles applications that are preloaded in the PBX-in-a-Flash install. AsteriDex and MailCall require some quick configuration so take a look at the tutorials. You also may want to change the Telephone Reminders default password of 123 in line 28 of /etc/asterisk/extensions_trixbox.conf. If you do, remember to restart Asterisk for the change to take effect.

    AsteriDex - The Poor Man's Rolodex (http://TrixBoxIPaddress/asteridex/)

    NewsClips for Asterisk - Get the News By Telephone (Dial 511)

    MailCall for Asterisk - Get Your Email By Telephone (Dial 555)

    Weather Reports by Airport Code - Get the Latest Weather Forecasts for 1,000 U.S. Cities (Dial 611)

    Telephone Reminders for Asterisk - Appointment Reminders By Telephone (Dial 123)

    GabCast Studio for Asterisk - Create and Play PodCasts Using Your Phone (Dial *422 and 422)

    TeleYapper Message Broadcasting System - Deliver Appointment Reminders and Important Info to Any Custom Calling List (Dial 674)

    What To Do Next. Once your new PBX is humming away, here are the next steps. First, you'll want to upgrade freePBX to version 2.2.x. The tutorial to walk you through the drill can be found here. Last but not least, you'll want to apply the latest Asterisk security patches to prevent a denial of service attack on your system. The tutorial for that can be found here.

    Where To Go From There. If you're new to the Asterisk world, you have lots of fun (and learning) ahead of you. Start with the comments to this article for late-breaking news. Then take a look at our Newbie's Tutorial. We've already done most of the work for you here so you'll get to see how much fun you missed. Seriously, it's an easy read and covers many topics that we didn't get to here. So start there. If you want to review what actually got installed with the PBX-in-a-Flash script, take a look at our article on the VMware build of TrixBox 1.2.3. You'll also want to get plugged into the TrixBox Forums. That's the place to ask questions after you do some reading. Posting support questions on Nerd Vittles just doesn't work because of the cumbersome blog format. Don't email us questions either! About 20,000 pages of our tutorials get downloaded each day so we hope you'll understand why free, individualized tech support is not possible. We do accept thank you notes with or without donations to the site. Finally, take a look at our catalog of articles, projects, and Asterisk resource links. You'll find just about everything you'll ever need there. Enjoy!

    Nerds' Corner. The trick to building the backup image which makes PBX-in-a-Flash tick lies in the backup script which we use to back up critical pieces of our TrixBox system to a redundant server. Before you can use it to backup your own TrixBox system, you'll need another TrixBox server or any Linux system. Then you'll need to run through the SSH autologin trick which is outlined in our TrixBox 1.2.3 tutorial. This sets up your system so that you can log into other Linux machines with ssh or scp without having to type your password. Finally, you'll need to modify the last line of the backup script so that it points to the correct IP address of your remote Linux server. If you want more detail on the backup process, read our article: Backups and Redundancy with Asterisk. The only remaining piece to make all of this portable was to create a compressed archive of the backup folder on the backup server and make it available to you using the new pbx-in-a-flash script. This command did the trick:

    tar cfvz /tmp/backup.tar.gz /backup