Home » Technology » Back to School Time: The Bleeding Edge of Asterisk, Part 1

The Most Versatile VoIP Provider: FREE PORTING

Back to School Time: The Bleeding Edge of Asterisk, Part 1

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.

It's been almost a year since we released our turnkey trixbox 1.2.3 system for Windows which relied upon CentOS 4 and Asterisk 1.2 and included all of the Nerd Vittles goodies. There have been dozens of security patches not to mention entirely new generations of Asterisk, trixbox, FreePBX, CentOS, MySQL, and PHP code. Just look at our pathetic graphic, and you'll know how much things have changed in the last year while we were building applications. As school begins this week, we decided to get a little education on our own, and we've begun the process of building a VMware image of trixbox 2.x with CentOS 5 and Asterisk 1.4 support. As frequent readers of our column already know, our #1 Pet Peeve is programmers that write new code that breaks other folks' existing code for no reason. We can quibble about what that means but basically Asterisk 1.4 needlessly breaks a lot of applications because of rip-and-replace syntax changes. It's certainly okay to add new command syntaxes, but why would you trash thousands of perfectly functional applications by refusing to add a few lines of code to translate the old syntax into the new one? Here's a good example. In previous versions of Asterisk, you set the timeout for responses from an IVR system with code that looked like this: exten => 611,4,ResponseTimeout(7). To do the same thing in Asterisk 1.4, the syntax looks like this: exten => 611,4,Set(TIMEOUT(response)=7). No big deal, you might be saying. Well, it's a VERY BIG DEAL! It breaks every IVR application on Planet Asterisk. <end of rant... well, almost>

Way back when we actually worked with programmers in years' past, we always started with the proposition that you shouldn't break something that already works when new versions of code are released. Unfortunately, this is a problem in the open source community and especially in our VoIP World. People get so excited to include new stuff in a new version that they forget/ignore/don't test features that were previously available. But we understand that betas do not have complete code sets, and we're using a trixbox 2.3 beta today to have some fun on the bleeding edge. So, be forewarned that everything may not be quite perfect. And, unfortunately, the new trixbox design makes it virtually impossible for mere mortals to add much code on their own to fix things. Lucky for all of us, there are some terrific scripts produced by Tom King. Tom has single-handedly taken over much of the drudgery of smoothing out some of the wrinkles in trixbox. And, thanks to Tom, we've pretty much gotten out of that business... until today.

One of the concerns expressed when Fonality acquired trixbox was that the trixbox code would languish. It certainly hasn't done that, but Bleeding Edge code can pose some problems of its own. We're going into this with our eyes wide open and our sleeves rolled up so... not to worry! We would hasten to add that Andrew and Kerry and the rest of their crew at Fonality have been tireless in their dedication to the trixbox platform. We're all grateful for all that they've done and continue to do. And Chris Lyman's support of the open source Asterisk community has been nothing short of fantastic as well! We just hope that some of what we cover today will find its way into the final trixbox 2.4 release... so we don't have to do this all over again in a month or two.

First, the Bad News. We don't have a finished VMware product for you yet because there was lots of Nerd Vittles code to rewrite. But we're darn close to a perfect Asterisk 1.4 platform with a huge helping hand from Tom. We thought it might be equally useful to walk through some of the challenges that await anyone who decides to try this alone (without Tom's script) on a dedicated Linux box. So here we go...

Let's begin with a summary of what we're starting with and what our objective will be. Digium® is pushing everyone to get off the 1.2 Asterisk® platform and move on to Asterisk 1.4. In fact, the end of life date for Asterisk 1.2 was August 1, 2007. We're going to avoid the temptation of explaining how unreasonable that date is in the telephony business (most phone systems are designed to last for a decade, not a year). Well, we did tell you. But let's move on. Then there's freePBX which is the terrific front-end to Asterisk. Remember, Asterisk 1.4 broke large chunks of their code. Here's their take on life with 1.4. The silver lining is that the freePBX development crew released the production version of 2.3 supporting Asterisk 1.4 this past Saturday. Now we get to trixbox which rolls together dozens of other products and has had to make generational leaps in the Linux distribution, MySQL,and PHP plus upgrades to the web server, FTP server, Perl, and on and on. When you recall that none of these products were designed by the same groups, you'll start to appreciate how daunting this task can become. Then there are the whiners like us that just write application software so that people can do cute tricks with their phone systems.

Once we get all the pieces talking to one another and functioning, there's the final issue of hardware. With CentOS 5 and Asterisk 1.4, the processor demands particularly to run this Asterisk-based PBX under VMware on your Windows desktop are substantial. For those accustomed to our speedy TrixBox 1.2.3 image, this one is not equivalent. We've always recommended using the free Process Explorer tool to bump up the Process Priority of vmware-vmx.exe and vmware.exe to 13 (High) on your Windows Desktop. Just highlight each application in the list of running apps and click Process, Set Priority, High. To get equivalent voice synthesis performance with CentOS 5 and Asterisk 1.4 on the identical machine now requires a setting of 24 (Realtime) for these apps which is all but unheard of on a Windows machine. If you happen to have a multi-processor machine or a new dual-core system with lots of RAM, you may be able to avoid this step. Just be forewarned that this new application probably isn't going to run satisfactorily on grandma's 3-year old Windows XP desktop.

Let the Downloads Begin. We begin this process by downloading the trixbox image. The one you'll want is (not!). It has CentOS 5, Asterisk 1.4, and freePBX 2.3. Unfortunately, they're not the current and patched versions of any of these products because the world keeps changing every day. So you have a Hobson's Choice to make here. You can stick with the trixbox team and wait for them to release each little piece of the puzzle. Or you can convert your system into a more vanilla Linux distribution so that you can make changes yourself. Once you do this, however, you may break some of the cradle-to-grave trixbox support and the trixbox upgrade mechanism which also happens to require registration. Tom indicates that for most updates, this is not the case. Either way, we're doing this to enjoy the bleeding so, of course, we want the free and open model. This assures we can load what we need. YMMV! This conversion process used to be really painful, but now it's not. Why? Because Tom King has made it easy by providing a script that does all the conversion and upgrade work for you. Documentation for the script can be downloaded from Tom's site. We would hasten to add that we've been comparing notes with Tom so today's edition of Tom's script now includes almost all of the tweaks that follow.

After you install trixbox (and we're doing this using VMware Workstation on a Windows desktop but it'll work similarly on a dedicated Linux installation), it's time to run Tom's script. Log into your trixbox server as root and issue the following commands. Note to NEWBIES: This column probably is not the best place for you to start your Asterisk exploration. Try one of the links at the top of this page. They just work... out of the box.

cd /root
wget http://nerdvittles.com/trixbox2/updatesrc14.sh.gz
gunzip updatesrc14.sh.gz
chmod +x updatesrc14.sh
dos2unix updatesrc14.sh

The script takes a while to run and you're well advised to also open a separate SSH session to your new trixbox server with putty (also free) so that you can supply needed commands when prompted without having to stop and reboot your server to continue the upgrade process. The script may stop once in a while and, if it does, pressing <enter> will gets things moving again.

Upgrading freePBX. The most critical component of this new system is freePBX. Complete documentation for this incredible Asterisk web GUI can be accessed here. There's also an active set of forums plus the trixbox forums for more immediate assistance. Of particular note, there are only three known bugs with this version of freePBX, and those are minor. In fact, the final release of FreePBX 2.3 was released as we were putting the finishing touches on this article.

To get things going, restart your system after completion of the script above. Once Asterisk is running, use a web browser to access freePBX at the following address: http://serverIPaddress/admin/. The username is maint and the password is password. Click on the Setup tab and then Module Admin. Click Check for Updates on line. You'll need to download these in clumps. If you get errors loading some of them, skip those and move on. When you finish the rest, go back and try the ones that didn't install again. Then your system will be up to date. When you click the FreePBX System Status tab in the left column, the system will now tell you which new updates are available. Stay current! New goodies arrive regularly. You can safely ignore the warnings about the default MySQL and Asterisk Manager passwords being used. The default setup of trixbox protects these applications from the outside world so, unless you change the default settings to permit Internet access to MySQL or the Asterisk Manager, this isn't a problem.

Restoring Text-to-Speech Capabilities Using Flite. Most of the Nerd Vittles goody bag is dependent upon text-to-speech voice synthesis with Flite. It doesn't work with tribox 2.x as delivered. Here's how to restore it, but Tom's script will now do all of this for you. Otherwise, after a reboot, log into your trixbox server as root and issue the following commands (in order):

cd /root
wget http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/extras/5/i386/flite-1.3-8.fc5.i386.rpm
wget http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/extras/5/i386/flite-devel-1.3-8.fc5.i386.rpm
rpm -Uvh flite*
yum install subversion subversion-devel
svn co https://dialogpalette.svn.sourceforge.net/svnroot/dialogpalette dialogpalette
cd dialogpalette/trunk/asterisk-flite
make install
shutdown -r now

If, for some reason, one or more of the above sites isn't working, you can download and install the files directly from Nerd Vittles with these commands:

cd /root
wget http://nerdvittles.com/trixbox2/flite.zip
unzip flite.zip
cd flite
rpm -Uvh flite*
cd dialogpalette/trunk/asterisk-flite
make install
cd /root
rm -r flite
rm -f flite.zip
shutdown -r now

Bringing Music On Hold Back From the Dead. After the freePBX updates (and maybe before), Music on Hold didn't function for things as simple as placing an incoming call on hold. Here's how to get it back. Tom's script now includes the necessary code to fix this as well. Suffice it to say, there was a missing directory. And a license file was improperly named which caused Message on Hold to fail. For the time being, you need both a /var/lib/asterisk/moh and a /var/lib/asterisk/mohmp3 directory, and both need to contain all of your music on hold files. You also need to remove the LICENSE text file from both directories and copy one of the existing files to a new file named LICENSE.wav in both directories. Then music on hold will work.

Activating Email Delivery of Voicemail Messages. We've previously shown how to configure any trixbox system 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. Just search for the following heading: Activating Email Delivery of VoiceMail Messages. 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 trixbox1.dyndns.org) is inserted in both the /etc/hosts file and /etc/extensions/vm_general.inc with a servermail entry of vm@trixbox1.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.

Resurrecting phpMyAdmin. Many of the Nerd Vittles applications also rely heavily upon MySQL databases. The only way to make installation of these apps relatively painless to install is to have phpMyAdmin working on your trixbox system. Unfortunately, it's missing from the 2.3 beta and the trixbox repository. The easiest way to remedy this deficiency now is to run Tom's script. If you'd prefer to do it manually, here are the steps. Log into your server as root and issue these commands:

cd /var/www/html/maint
wget http://nerdvittles.com/trixbox2/phpmyadmin.zip
unzip phpmyadmin.zip
cd /var/lib/php
chmod -R o+rwx session

Once installed, you can access phpMyAdmin with your web browser by pointing to the IP address of your Asterisk server with a command like the following:

Reviving Asterisk Weather Station by Airport Code. We'll finish for today by getting one of the major Nerd Vittles weather apps working under Asterisk 1.4 just to demonstrate that text-to-speech functionality is back from the dead. In coming weeks, we'll fix the rest of our applications. The complete installation tutorial is available on our Best of Nerd Vittles site. Complete the Database Setup and Changing Preferred Airport Codes steps as explained in the tutorial. The Dialplan Setup is already included in the trixbox beta, but it uses some Asterisk 1.2 commands that no longer work. Here's how to fix it. While still logged into your Asterisk server as root, edit the extensions_trixbox.conf file:

nano -w /etc/asterisk/extensions_trixbox.conf

Scroll down the dialplan until you find the lines beginning with exten => 611. Replace lines 3 and 4 with the following new code:

exten => 611,3,Set(TIMEOUT(digit)=7)
exten => 611,4,Set(TIMEOUT(response)=10)

Save your changes: Ctrl-X, then Y, then <Enter>. Then complete the freePBX Setup, AGI Script Setup, and System Setup sections of the tutorial. Restart Asterisk and you're good to go: amportal restart. The whole process should take you less than 5 minutes to complete.

The Future is Now. Now that we've whetted your appetite, take a look at some of Tom's other scripts for trixbox. There's almost nothing you can't do with a few more minutes of work: X Windows/KDE, Daily Backups, G729 and G723 codecs, server SSL, and who knows what else by tomorrow. Enjoy your new sandbox!

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


  1. Ward and Tom are once again my heroes! LOL Ward, I’ve been playing with TB 2.3 and it has been a pain in the butt… I didn’t know Tom had already released a script for it (silly me forgot all about script-trix.us) I am glad you wrote this article… I am running the script right now!
    Have a great day, and thanks a lot for rescuing us once again!

    PS Do you have any comments about the trixbox Pro? Never mind, I think so too! LOL

  2. Ward,
    Thanks for all you have done so far. I have managed to get mail, weather by airport, weather by zipcode, and yahoo news working. I haven’t been able to get telephone reminders or teleyapper working.
    When I try to run telephone reminders, it reaches a point where it just hangs up the line.
    I knew that it was a matter of time when we all had to upgrade to Centos 5 and Asterisk 1.4. Good luck in getting all of your great apps working again.

  3. Ward,
    Another great one!! Will you be doing a security one soon? Like how to lock down all the open web directories (i.e. panel) so that they only way you can get to is to log in first.


  4. Happy I stopped by tonight and found your most recent post BEFORE I started my Trixbox CE install–this should save me at least 3 or 4 lumps on the noggin. When you get caught up–I’d love for you to have a look at Stephen Uhlers ConMan application
    and see what can be done to get his great web front-end for meet-me conferencing more of a 1,2,3 process. Thanks for all your hard work!

  5. I also am making the asterisk 1.4 plunge trying to diy like aah was. I’ve been strugleing with nv_faxdetect rx_fax and tx_fax.

    It would be awesome if you could expand your bluetooth howto to cover chan_mobile in asterisk. It would be awesome to use asterisk to connect to your cellphone when your home. I got it to compile from svn trunk but not from a release.

    Your articles are always helpfull. Thanks!

  6. I was ready for a tough time with this release after all the ruckus going on in the trixbox forums. But Tom’s script has made all the difference. I’m finding this release to be stable and even my Aastra phones are getting their configs thanks to the TFTP fix included in Tom’s update. The new FreePBX is blowing me away as well, what a gem!

    I’ve been using the asterisk phonebook to manage incoming callerid. It’s fast, but no callerid.php/Asteridex trifecta! Do you expect we’ll see those anytime soon?

    Thank you Ward coaxing me to try this one, and a big thanks to Tom for all his efforts!

    [WM: Thanks for writing. AsteriDex and the CallerID Trifecta are in the works! Tom’s script is quite a jewel, isn’t it!]

  7. Interested in a VMware image of all this 🙂 I simply need a auto attendant and a dialer for a scrubbed list promoting my services and a few other things… anyone whose familiar with nerd vittles stuff and can throw together a system quick n effecient… stable…. but must be in vmware image shoot me an email jeffery.ferguson at gmail.com

Comments are closed.