Home » Search results for 'blocked callerid' (Page 3)

Search Results for: blocked callerid

The Most Versatile VoIP Provider: FREE PORTING

The Incredible PBX: Adding a Free Skype Gateway to Asterisk

Last week we got The Incredible PBX all set up with free worldwide SIP calls, free U.S./Canada PSTN calls using Google Voice with SIPgate or IPkall, and rock-solid Asterisk® security using our new Zero Internet Footprint™ design. Because of licensing restrictions, we couldn't include Skype out of the box. If you're an individual and not a business, today we'll walk you through adding free Skype calling worldwide to your Incredible PBX. With today's addition, the Incredible PBX now provides free calling to nearly a billion phones around the world via Skype, SIP, ENUM, FreeNUM, and U.S./Canada PSTN connections. Yowza!

If you use the recommended hardware, today's setup procedure takes less than 10 minutes! Once it's complete, inbound and outbound Skype calling is totally transparent on your Incredible PBX. To reach a Skype number, just dial * plus the user's Skype name from any phone with an alphanumeric keypad. To place a Skype Out call (fees apply), dial 8 plus the user's area code and number. When your 500 million friends on Skype contact you using your Skype name, all of your Incredible PBX phones will ring just like any other inbound call. What's the difference in today's solution and Digium®'s commercial Skype for Asterisk product? For openers, our solution is $66 cheaper. It's free! And, if you're an individual, you won't need Skype's commercial Business Control Panel to make calls. Functionally, the results with your Incredible PBX Skype implementation are identical.1

To make the Skype Magic work, you'll need three pieces of software in addition to The Incredible PBX obviously: Sun's 6u12 Java SE Development Kit, Skype's Static Edition for Linux plus an existing Skype account, and Greg Dorfuss' SipToSis product which manages the Skype Gateway to Asterisk.

As far as hardware is concerned, we're assuming you're using our recommended $200 Acer Aspire Revo to host your Incredible PBX. With other hardware, your mileage may vary because CentOS 5.4 may or may not support your audio card and graphics mode with your video card. Both are required to get Skype working properly under X-Windows. If you have problems with some other type of hardware, take a look at the tips in our previous article on Setting Up a Skype Gateway to Asterisk as well as the comments. Better yet, visit your neighborhood Best Buy and purchase an Aspire Revo for a hassle-free install.


Installing JDK. Using your favorite browser, go to Sun's 6u12 Java SE Development Kit website, choose Linux for the platform, and agree to the license. Click Continue. Download jdk-6u12-linux-i586-rpm.bin and copy it to the /root directory of your Incredible PBX. Next, make the file executable (chmod +x jdk-6u12-linux-i586-rpm.bin). Then run it: ./jdk-6u12-linux-i586-rpm.bin. Scroll down the wordy license agreement AGAIN and type yes. Java 1.6 then will be installed on your system. Check to be sure Java was properly installed with this command: rpm -q jdk.

Installing Skype and SipToSis. Now we're ready to load the remaining components. While still logged into your Incredible PBX as root, download and run the skype-setup script2:

cd /root
wget http://incrediblepbx.com/skype-setup
chmod +x skype-setup
./skype-setup

Activating Your Skype Gateway. Now we're ready to place your Skype gateway in production. You'll need to perform these steps from the console on your Incredible PBX since we have to run Skype in graphics mode. This may look complicated. It's really not. It's just a bit tedious to figure out the sequence of steps, but we've done that part for you.

WARNING: Be sure that you use a dedicated Skype account on this server! Do not run the same Skype account on any other server or desktop, or it fails!

1. Start up X-Windows: xinit3

2. Start up Skype. While still logged into your server as root, issue the following commands:

cd /root/skype/skype_static-2.0.0.72
./skype

Now log in to Skype with your Skype name and password. Be sure to set Skype to autologin whenever it is started. Then, in the Skype configuration option, set Skype to always run minimized. Save your settings.

Place a Skype Test Call4 to echo123 to be sure your audio settings are set correctly. Again, with the Aspire Revo, this won't be a problem assuming you have plugged in a microphone and speakers. These can be disconnected after you're sure things are working properly. HINT: Intel Atom-based motherboards are a piece o' cake!

Once you've got Skype working and all of the Skype settings configured above, shut down Skype.

3. Restart Skype in Background Mode: ./skype &

Be sure to write down the PID for Skype in case you need to kill the job if something goes wrong. 🙂 If you forget the PID, you can obtain it with this command: pgrep skype. You can kill Skype with the following command using your actual PID instead of 12345: kill 12345.

4. Start up SipToSis: Press Enter if the command prompt doesn't reappear. Then...

cd /siptosis
./SipToSis_linux

A message from Skype will pop up asking if you want to authorize external use of Skype: yes. Important: Be sure to select the Checkbox to save this setting for future connections!

5. Testing Skype. Go to a softphone (X-Lite recommended!) connected to an extension on your Incredible PBX and dial *echo123. You should be connected to the Skype Call Testing Service. Try *nerdvittles for the Nerd Vittles Demo.

Assuming you have a little money in your Skype Out account, go to any extension connected to your Asterisk server and dial 8 + your home phone number. This will place the outbound call through SkypeOut at 2¢ a minute.

Reboot your server when you're sure everything is working properly.

GUI Tips. Here are a few navigation tips for managing your Asterisk console on your Incredible PBX:

1. Ctrl-Alt-F2 gets you a new login prompt for your server

2. Ctrl-Alt-F7 gets you back to the SipToSis/Skype session. You can kill SipToSis by holding down Ctrl-C for several seconds. To decipher your SipToSis PID: pgrep -f SipToSis. To kill SipToSis: kill pid# (that you wrote down). To kill Skype: kill pid# (that you wrote down). To restart Skype: skype & and to restart SipToSis, just issue the command again: ./SipToSis_linux

3. Ctrl-Alt-F9
gets you to the Asterisk CLI.

Automating the Skype Gateway Startup. Once everything is working reliably, reboot your server again, log in as root, and issue the command: /root/skype-start. Place a test call again using a softphone on your Incredible PBX. If everything works fine, you now can add the skype-start command to your server's startup script, and you're all set.

echo "/root/skype-start" >> /etc/rc.d/rc.local

Setting Up Speed Dials for Skype Friends. One of the wrinkles with Skype is that Skype uses names for its users rather than numbers. If you don't have a SIP URI-capable softphone, there's still an easy way to place calls to your Skype friends using FreePBX. Just add a Speed Dial number to your FreePBX dialplan. Choose Extension, then select the Custom type, provide an Extension Number which is the Speed Dial number (this could actually spell your friend's name using a TouchTone phone), enter a Display Name for your friend, and add an optional SIP Alias. Then insert the following in the dial field replacing joeschmo with your friend's actual Skype name. Save your entries and reload the dialplan when prompted.

SIP/joeschmo@127.0.0.1:5070

Security Warning. Do NOT expose UDP port 5070 to the Internet by opening a port on your hardware firewall. You do not need UDP 5070 exposed to the Internet to implement today's gateway solution for inbound or outbound Skype calling from your server!

Enjoy!

Update: As of May 1, you now can set your Google Voice number as your Skype CallerID number. Previously, Google Voice blocked the verification SMS messages, but no longer. Thanks, @zsafwan.

Adding Multiple Google Voice Trunks to The Incredible PBX



Need help with Asterisk? Visit the PBX in a Flash Forum.
Or Try the New, Free PBX in a Flash Conference Bridge.


whos.amung.us If you're wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new whos.amung.us statistical web site and check out what's happening. It's a terrific resource both for us and for you.


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest...

  1. Skype and this suggested implementation are intended for individual use. Your use is, of course, governed by the Skype Terms of Service. []
  2. Here are the actual commands in the skype-setup script if you'd prefer to execute them one at a time:

    cd /root
    mkdir skype
    cd skype
    wget http://www.skype.com/go/getskype-linux-beta-static
    tar jxvf skype_static*
    yum install xorg-x11-server-Xvfb
    yum install qt4
    yum install xterm
    yum install libXScrnSaver.i386
    wget http://pbxinaflash.net/source/skype/siptosis.tgz
    cd /root
    wget http://incrediblepbx.com/skype-start
    chmod +x skype-start
    cp skype-start skype/.
    cd /
    tar zxvf /root/skype/siptosis.tgz
    cd /root


    []

  3. Starting xinit won't be a problem on the Aspire Revo. But, if xinit won't start on your particular machine, you may need to create /etc/X11/xorg.conf. Here's a generic config file that should work fine for our purposes:

    Section "ServerLayout"
    Identifier "X.org Configured"
    Screen 0 "Screen0" 0 0
    EndSection

    Section "Device"
    Identifier "Card0"
    Driver "vesa"
    EndSection

    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    SubSection "Display"
    Viewport 0 0
    Depth 16
    Modes "800x600"
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 16
    Modes "800x600"
    EndSubSection
    EndSection

    []

  4. If the test call fails with a bad audio message, go into Options, Sound Devices and reconfigure your Audio settings until you can place the test call successfully. Otherwise, none of the rest will work! []

Welcome to IP Country: A New Layer of Asterisk Security

image courtesy of fail2ban.org One of the problems with writing a blog like Nerd Vittles is it's more than double the work of your typical blog where a writer pontificates about something and then moves on. What makes Nerd Vittles a little different is that, with help from a number of very gifted developers, we actually create useful applications and then write about how to use them. So you get a bonus for the same low price: free! This obviously imposes some time constraints in order to get fresh material into your hot little hands every week.

This week we turn our attention to Asterisk® Security again and unfortunately the Whole Enchilada is not yet ready. So today you get Chapter I of this topic with a comment that we're still mulling over some enhancements. When those pieces are finished or at least properly evaluated, we'll produce a sequel. Software houses spend years developing applications. And sometimes it takes us more than a week. 🙂

Let's start with a few observations which should be quite obvious to those who have wrestled with VoIP or Asterisk for a while. Internet security is a bitch. And Asterisk security is much, much worse. When a few disgruntled people can bring Twitter to its knees because they're mad about some particular tweet or Twitter user, it tells you what we're all up against. Hate to say it but we can all thank Microsoft for years of security neglect that rendered the Windows operating system less than optimum in preventing the spread and deployment of BOTs. And the tools have gotten more dangerous as well. Strangers (our euphemism for these folks) write new software, too.

If you're using PBX in a Flash (and you really should be!), you know that we've devoted enormous resources to Asterisk security. Two years ago when PBX in a Flash was introduced, the majority of people using Asterisk still were using 1234 as the extension password on all or most of their extensions. A couple $100,000 phone bills and lots of public education, and that situation hopefully is behind us. Two years ago, no Asterisk aggregation included a firewall... except PBX in a Flash. Believe it or not, there were individuals running Asterisk servers on the public Internet with a default root password of password. That added more than a few more BOTs to the Internet kettle of fish. Then there were the brute force password hacks that hit Asterisk servers thousands of times per minute guessing passwords. Nothing stood in the way of these attacks until PBX in a Flash introduced Fail2Ban which automatically blacklisted IP addresses after a certain number of failed login attempts. We followed Fail2Ban with our Atomic Flash product which provided a turnkey Hamachi VPN implementation for rock-solid safe remote computing. And, of course, there was a one-minute Hamachi VPN install script for standard PBX in a Flash systems. No other aggregation has it to this day.

The purpose of the history lesson isn't to crow about PBX in a Flash although we're mighty proud of it. Rather we wanted to make you aware that precious little development effort is actually going into security while enormous resources are devoted to things such as Internet faxing, Skype, and Google Voice integration. We'll be the first to admit that we love the latest gee whiz gizmos as much as anybody. But come on. A handful of us who do this purely for fun somehow manage to turn out loads of security enhancements while huge, for-profit companies are devoting virtually zero resources to making Asterisk, SIP, and the VoIP community safer. SIP is about as secure as whispering at a movie theater. Google releases Google Voice with SIP access protected by a 4-digit password. 🙄 That approach to security needs to change, or we're all going to wake up sorry one day soon. If this is preaching to the choir, then feel free to pass this article on to one of your brethren who has not yet seen the light! Start by reading our Primer on Asterisk Security.

If you have extremely secure passwords on your Asterisk extensions and trunks, and you have deployed a properly configured firewall with Fail2Ban to protect against brute force attacks, then you're ahead of the curve insofar as Asterisk security is concerned. But what we think is still missing is access restrictions based upon what the military calls a "need to know." Simply stated, it means folks shouldn't get access of any kind to your Asterisk server unless they have a need to be there. And, if we find someone there that doesn't belong, they should be kicked off and banned from further access.

So today we have a new security tool for your Asterisk toolbox: IP Country, country-based network filtering by IP address. In a nutshell, it means configuring your Asterisk server to dramatically reduce the number of IP addresses which can reach your server at all. If you receive anonymous SIP connections from all around the globe that you actually need or if you're attacked from a BOT running on grandma's Windows machine down the block, this may not work for you, but it's another tool in your quiver of arrows. For most servers, it has the potential to reduce the vulnerability from random outside threats substantially. It's taken a lot of research to come up with much of what follows, and we want to express our special thanks to Sandro Gauci and Joe Roper for their assistance. Some of this technology has been around for many years, but unfortunately it was expensive. So we also want to express our special appreciation to MaxMind for releasing their open source GeoLite Country database which is now free for downloading. That is the critical ingredient in much of what follows. So here's a word from our sponsor:

This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.

Scope of Protection. An obvious question is just exactly what are we trying to protect. In our view, it's several things. First, we don't want strangers logging in to extensions on our server and making free calls around the globe using pilfered or hacked passwords. We also don't want strangers using our extensions to masquerade as us for any other purpose. Second, we don't want strangers randomly calling our server using SIP URI's that they've dreamed up. And third, we don't want strangers accessing any other applications on our server including SSH and FTP as well as web and email services.

IP Country Design. As with other security features in Asterisk, FreePBX, and IPtables, our implementation of IP Country uses permit and deny access tables that consist of authorized and unauthorized ranges of IP addresses. There's also a table with the latest GeoLite Country information which is used as the data source for your permit table. When a connection to the server is made, the IP address is checked against the permit table of authorized addresses. If there's no match, we'll consider the connection a stranger. If there is a match, then we'll check the deny table to make certain this particular IP address hasn't been banned. Unless you alter all of our scripts, your system must be using the default MySQL account name of root with a password of passw0rd. As configured in PBX in a Flash, this is NOT a security risk since MySQL access is limited to your server, and your server requires root credentials to log in.

Today's Objective. To get everyone started, we're going to tackle the first two objectives today. The solutions offered should work fine on any FreePBX-based Asterisk system... even those that hide the existence of FreePBX.

For outgoing calls, we'll introduce a new script which runs periodically to examine the IP addresses attached to every SIP and IAX extension and trunk on your Asterisk server. If a stranger's IP address is identified (as explained above), we'll add an IPtables firewall rule to permanently block access to your server from this IP address. These rules are stored in /etc/sysconfig/iptables should you ever need to remove an IP address that has been blocked. You can adjust the script execution frequency based upon the thickness of your wallet. After all, it's your phone bill. This functionality is mutually independent from the incoming call protection outlined below so you can use either or both of the functions to meet your own requirements. For systems that use enormous numbers of SIP URI's for communications around the globe, you might choose to implement just this piece for extension and trunk IP Country protection without altering your incoming dialplan at all. Keep in mind that FreePBX now supports permit and deny IP address filters on extensions, something you really should be using even if you decide against implementing the IP Country security protection layer.

For incoming calls, we're going to modify FreePBX's existing Blacklist functionality to also look up the calling IP address in our IP Country permit and deny tables. If the IP address is authorized, the call will go through. Otherwise, the call will be treated just as if the caller's number were blacklisted. Be aware that incoming calls to one of your commercial DIDs may reflect the IP address of your provider since the caller may be calling from a Plain Old Telephone rather than an IP address. The existing Blacklist functionality can be used to block these unwanted callers. If you live in the United States, you'll probably also want to call 888-382-1222 and place your DIDs in the Do Not Call database. Just call from a phone using the CallerID of the number you wish to block.

Installing GeoLite Country. To get started, log into your server as root and issue the following commands:

cd /
wget http://bestof.nerdvittles.com/applications/ipcountry/ipcountry.tgz
tar zxvf ipcountry.tgz
rm ipcountry.tgz
cd /root/ipcountry
./nv-ipcountry

Once the nv-ipcountry script begins to run, it will download and install the GeoLite Country database into MySQL. You then will be asked whether to add countries to your permit table. Since your permit table is empty at this point, the answer should be yes. You'll then get a list of country codes. Choose the two-character country code desired and type it in UPPERCASE, e.g. US. If you want to add one or more additional countries, just rerun ./nv-ipcountry and do NOT initialize the permit table (which erases all of its contents).

New GeoLite Country databases are released every month or two so get used to the procedure. You'll be using it periodically to keep your list of IP addresses current. We'll cover the update procedure after we get you up and running.

Remember: If no IP addresses for any country are added to the permit table, you will not be able to make calls or register trunks with your providers! The only default entries added to the permit table are the non-routable, private IP address ranges, e.g. 192.168.0, etc. The geolite table is merely a data repository of the latest GeoLite Country database and has no effect on the daily operation of your system! You use it only as a data source for populating your permit table.

Testing IP Country. Before we actually turn anything on, we need to be sure we're not going to blow your Asterisk system out of the water! In short, we want to make sure that every extension that's supposed to be able to make a connection to your PBX still can. And we need to make sure all of your trunk registrations still are working. While you're still in the /root/ipcountry directory, issue the following command: ./test.sh. This script will display all of your SIP and IAX connections and then will tell you whether each connection will pass muster with IP Country security in place. Each IP address should display ok. If any of them show ko, you have a problem. This means that you have an extension or trunk with an IP address that is not included in your permit table. You can scan through the show peers listings in the display to figure out which providers or extensions are associated with any problem IP addresses. Be sure it's not a bad guy first. Then you have a couple of options. You can either manually add the IP address to the permit table as outlined below. Or you can add additional countries which include the missing IP address(es). To decipher the country of any problem IP address, go to this link and plug in the IP address. Once you've made entries in your permit table to cover all of your needed IP addresses, run the test script again just to be sure everything shows ok. Do NOT proceed until you get all ok's, and don't write us if you do.

Manually Adding IP Addresses to IP Country. We've provided a command-line utility which makes it easy to add IP addresses and address ranges to either the permit or deny tables of IP Country. Be very careful using this tool! There's limited error-checking which means it's easy to create a mess. You'll find iputility.php in the /root/ipcountry folder. Since all IP addresses are stored as integers, you can use it to merely discover the integer value of an IP address, or you can actually insert IP addresses into either the permit or deny tables. Here are a few examples to show how the utility works:

./iputility.php 156.130.20.10
Returns the integer value for this IP address; no database update
./iputility.php 156.130.20.10 156.130.20.255
Returns integer values for this IP address range; no database update
./iputility.php 156.130.20.10 deny
Adds this IP address to IP Country deny table
./iputility.php 156.130.20.10 156.130.20.255 permit
Adds this address range to IP Country permit table)

A couple of points worth noting. First, all custom entries in your permit and deny tables using iputility will show a country code of AA. This makes them easy to find using phpMyAdmin if you make a mistake. Second, if you attempt to enter the same IP address range more than once, you'll get a database error since all entries in the tables must be unique. Third, remember that entries in the deny table take precedence over entries in the permit table. So, if the same IP address or address range is in both tables, access will be denied. The reason for this is to make it easy to exclude a few bad apples from a country that you might otherwise find unobjectionable. Finally, keep in mind that manual entries added to the permit table will have to be added again each time you initialize the table and insert new country IP codes after a GeoLite Country refresh. The deny table is unaffected by database refreshes. So make yourself a list of entries you manually insert into the permit table and keep it in a safe place for future reference.

Activating the IP Address Checker. In the /root/ipcountry directory, you'll find the script that we'll use to check your system periodically to be sure all of the extensions and trunks are registered at permitted IP addresses. To run the script manually, log into your server as root and type: /root/ipcountry/ip-checker.sh. When you run it, you shouldn't see any modifications to IPtables, just a string of ok's. So now we want to added the script as a cron job that will be run periodically to watch your system. Edit /etc/crontab and insert the following line at the bottom of the file:

*/1 * * * * /root/ipcountry/ip-checker.sh > /dev/null

*/1 means run the script once a minute, all day and night, every day. */5 means every 5 minutes. You make the call on how safe you'd like your system to be. If you'd like to receive an email or text message every time an IP address is blocked by ip-checker.sh, just edit the filecheck.php script, uncomment the two lines that begin with // and replace yourname@gmail.com with your email or text message address.

WARNING: For ip-checker.sh to work properly with IPtables, there are a couple of prerequisites. First, IPtables must be running on your system with the iptables file located in /etc/sysconfig. Second, your IPtables setup must include an SSH permit rule that looks like this:

-A INPUT -p tcp -m tcp --dport ssh -j ACCEPT

We use this rule as a place finder to determine where to insert new rules to block stranger's IP addresses. If you don't have the above rule, filecheck.php (used by ip-checker.sh) won't be able to insert new rules. So you'll need to manually edit filecheck.php to provide a "hook" that can be used to insert rules into your iptables file. PBX in a Flash systems come preconfigured to support this. With other aggregations, YMMV!

Activating the Incoming Call Checker. To screen incoming calls using your IP Country permit and deny tables, the setup is straight-forward assuming you are running the latest version of FreePBX 2.5. We're going to adjust the Blacklist context to also perform IP address lookups from IP Country when new calls arrive on your PBX. Just log into your server as root and add the following lines to the bottom of the extensions_override_freepbx.conf file in /etc/asterisk:

[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1,LookupBlacklist()
exten => s,n,GotoIf($["${LOOKUPBLSTATUS}"="FOUND"]?blacklisted)
exten => s,n,Set(TESTAT=${CUT(SIP_HEADER(From),@,2)})
exten => s,n,GotoIf($["${TESTAT}" != ""]?hasat)
exten => s,n,Set(FROM_IP=${CUT(CUT(SIP_HEADER(From),>,1),:,2)})
exten => s,n,Goto(gotip)
exten => s,n(hasat),Set(FROM_IP=${CUT(CUT(CUT(SIP_HEADER(From),@,2),>,1),:,1)})
exten => s,n(gotip),NoOp(Gateway IP is ${FROM_IP})
exten => s,n,NoOp(IP Country Lookup in Progress...)
; put authorized special calls like sipgate's Google Voice ringbacks below
exten => s,n,GotoIf($["${FROM_IP}"="sipgate.com"]?keepon)
exten => s,n,AGI(nv-ipcountry.php|${FROM_IP})
exten => s,n,GotoIf($["${STRANGER}"="true"]?blacklisted)
exten => s,n(keepon),NoOp(** AUTHORIZED CALLER **)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

Make sure you remove the line-wrap in the s,n(hasat) line and any others that may have wrapped in the display above! Then save the file and reload your Asterisk dialplan: asterisk -rx "dialplan reload". You're all set! If you'd like email notices when a stranger calls and is blacklisted, edit nv-ipcountry.php in /var/lib/asterisk/agi-bin. Plug in your actual email address in the $email variable and set $emailalerts = 1.

Housekeeping 101. As we mentioned above, the pool and location of IP addresses continues to change so periodic updates are necessary, or you'll end up blocking calls that otherwise should be permitted. MaxMind updates GeoLite Country on the first day of every month so add it to your TO-DO list. We strongly recommend that you perform these steps through an SSH connection from a remote PC. Why? Because, if you forget step 1 while logged directly into your server, you could inadvertently lock yourself out of your own system if the ip-checker script happens to run while your permit table is empty. If you do it from a remote machine, you can simply move to another machine and follow these instructions properly. Otherwise, you've got a serious problem on your main server. If this server provides phones to your business, do the update when the server is idle. So here's the drill:

  1. Comment out the ip-checker.sh /etc/crontab entry
  2. Download new GeoLite Country database from MaxMind
  3. Initialize the ipcountry.permit table
  4. Add authorized countries back into ipcountry.permit table
  5. Add back any custom entries to permit table
  6. Test your IP Country system to make sure you get all ok's
  7. Reactivate ip-checker.sh in /etc/crontab

1. Log into your server as root. To comment out the ip-checker.sh line in /etc/crontab, just add # as the first character on the line and save the file.

2. Change to the /root/ipcountry directory and run ./nv-GeoIPrefresh.

3. While still in the /root/ipcountry directory, run ./nv-ipcountry and choose 1-Yes to initialize your ipcountry.permit table.

4. Continue running or rerun ./nv-ipcountry to add each desired country to your ipcountry.permit table.

5. Run ./iputility.php to add custom IP address entries to your ipcountry.permit table. You do NOT need to reenter addresses in the deny table. It is unaffected by this update procedure.

6. Test your system again to make sure all extensions and trunks get an ok by running ./test.sh.

7. Edit /etc/crontab and remove the # at the beginning of the ip-checker.sh line and save the file.

What's Next. We're still exploring another possibility with IP Country, and that is integrating GeoLite Country directly into IPtables. This would validate every packet coming into your firewall using IP Country-like rules in IPtables. If you want to look at how it could be done, see this excellent writeup. Well, not so fast. Unfortunately, it won't compile under CentOS 5.2. Here's a link to the problem code if there are any Linux gurus in the house. Our reluctance in doing this has to do with performance. Keep in mind that, without stateful packet inspection, every single packet coming into your server would presumably trigger a database lookup. On a busy telephony system generating hundreds of thousands of packets per second, it would take a beast of a server with sufficient memory to cache the entire IP Country database in order to handle the processing load. So now we've got to either learn about or find an expert on the IPtables State Machine. If anyone wants to experiment, please share your expertise with the rest of us. There's a Google Voice invite in it for you, too.


whos.amung.us If you're wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new whos.amung.us statistical web site and check out what's happening. It's a terrific resource both for us and for you.



Need help with Asterisk? Visit the PBX in a Flash Forum.
Or Try the New, Free PBX in a Flash Conference Bridge.


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest...

Googlified Messaging: Asterisk’s New Best Friend

Lips from GoogleWithin the past few months, we've added several hundred million free phone numbers to our Asterisk® PBX by creating a Skype Gateway as well as Gizmo Backdoor Dialing and ENUM interfaces that didn't cost us a dime. And, today, we turn our attention to Google's recent transmogrification of GrandCentral into Google Voice. More specifically, what we want to do is examine some ways to integrate the Google Voice feature set into our existing Asterisk implementations. The potential benefits are enormous. There's free calling in the U.S., free distribution of inbound calls to multiple phone numbers scattered around the country, free SMS messaging and delivery by email, free transcription of voicemail messages into text-based emails, free conferencing, and free GOOG-411, a voice-activated service that let's you find nearby businesses by saying where you are and what you're looking for. For today, we've set our sights on the Google Voice feature set which is easiest to integrate into existing Asterisk systems: free voicemail message transcription, free calling in the United States, and free GOOG-411 directory assistance. For lack of a better term, we call it... Googlified Messaging™. 😉

Update: The original SIP interface to Google Voice described in this posting no longer works. A new approach that really works is now available on Nerd Vittles at this link.

Integrating Google Voice into Asterisk. If there is a recurring theme to Google Voice, it's this. Google Voice was designed to be a user-friendly, interactive messaging system. Google didn't intend to provide a telephony toolkit for Asterisk developers, but they haven't blocked any functionality either. There's no SIP connectivity in Google Voice... at least that is obvious. Can you spell G-I-Z-M-O? Well, that was the first hint. But a simple call trace revealed a lot more. It appears the entire Google Voice platform is SIP-based which makes it a perfect fit with Asterisk.

Because of the Google Voice design, there's no simple way to use your Google Voice DID for incoming call distribution while also integrating voicemail transcription and outbound calling into your Asterisk dialplan. Why? Because you can't take advantage of the free voicemail transcription service with Asterisk if Google Voice is sending inbound calls all over the countryside. So the real key to unlocking the greatness of Googlified Messaging is having two Google Voice accounts so that each can be used for a dedicated purpose. The first account will be used for outbound functions and voicemail transcription while the second is used to manage and route incoming calls. This is important because, for security reasons, you don't want to reveal your Google Voice number that is being used for outbound calling. Why? Because it is a SIP connection, and your Google Voice phone bill is only protected by a 4-digit PIN. If Google hasn't learned about Fail2Ban, they will soon. As this is written, multiple Google Voice accounts aren't possible unless you had more than one GrandCentral account since only GrandCentral users currently are eligible for Google Voice accounts. But that, too, will change!

For today, let's put aside the incoming call routing and concentrate on the remaining Googlified Messaging functionality. We turn first to Google Voice's free transcription of voicemail messages into text-based messages for email delivery to your desktop PC or cellphone.

Voicemail Transcription Overview. We begin with a cautionary note. Google's new automated voicemail transcription service is absolutely incredible... even if it's not quite perfect. We've tried a couple of messages to evaluate the transcription accuracy, and we'll let you judge for yourself.

Actual Message: "Hi. I was just passing through the airport. I hadn't seen you in a couple years, and I thought you might wanna get together for a quickie. Give me a call."

Googlified Transcription: "hi i was just passing through the airport i hadn't seen you in a couple years and i thought you might wanna get together for a quickie give me a call"

As you can see, the accuracy was pretty good. But there are a couple of problems. First, there's no CallerID name associated with inbound calls. So, if the caller doesn't identify himself or herself (especially if the caller is using a pay phone), you're S.O.L. relying on the transcription. But the message and phone number were accurate. It probably would motivate you to quickly connect to your email account and actually listen to the voicemail to decipher the caller's identity and avoid a missed opportunity. 🙂

Actual Message: "Hi. I've read over your corporate acquisitions and merger paper, and it isn't quite accurate with regard to our position."

Googlified Transcription: "hi i have a red over your corporate acquisitions in merger paper and it is a quite accurate with regard to our position"

This second example is a bit more problematic. The same issues apply from the first example. Plus there's a new wrinkle that could be a show stopper: the Googlification of "isn't quite accurate" into "it is a quite accurate." You'd better hope there was more to the message than this before running off to present your paper. It also highlights the difficulty that automated systems have when deciphering conjunctions such as "isn't" which often are used in conversational speech.

Some might suggest that this demonstrates the Google developers actually have their priorities in order. Get the kinks out of the sex jargon before focusing on exciting subject matter such as conjunctions. 🙄

Bottom Line: Googlified Messaging may be a boon to your sex life, but don't stake your job security on it just yet. Also make certain that your voicemail announcement includes a very emphatic request that callers actually identify themselves and leave a callback number where they can be quickly reached.

Google Voice Design. To integrate free voicemail transcription into Asterisk, what we first must do is turn your Google Voice account into a glorified answering machine and message distribution system. When calls arrive on your Google Voice number, they will immediately trigger a greeting message that says something like this:

Thank you for calling Nerd Vittles. No one is available at the moment to take your call. After the tone, please identify yourself, leave a callback number, and a brief message. Your message will be transcribed and delivered to us. We will get back to you promptly. Please begin speaking after the tone.

Once a voicemail message is received, we want Google Voice to transcribe it and email us both the voicemail message and the transcribed text.

Google Voice Setup. Log into your Google Voice account and click Settings, General. In the Voicemail Greeting section of the form, record your greeting message as outlined above. In the Notifications section, identify the email and SMS addresses for delivery of your voicemail messages. In Voicemail Transcripts, check the option to transcribe voicemails. Now click on the Do Not Disturb check box to forward all inbound calls to voicemail.

FreePBX Setup. Obviously there are numerous ways to integrate this transcription service into Asterisk. If you're using FreePBX, here are a couple of simple ways. First, create a Miscellaneous Destination for Google Voice and provide your Google Voice number in the correct format to match your dialplan. Next, if you use a Ring Group to answer incoming calls, choose your new Google Voice Miscellaneous Destination as the "Destination if no Answer." If you're using an IVR to route calls, then perhaps you'll want to add an option to leave a voicemail and have it transcribed for delivery to your email account.

HINT: For rerouting of Asterisk calls to Google Voice, be sure to use an outbound trunk that supports CallerID pass-through. And configure the trunk with a blank CallerID value in FreePBX. Then the actual CallerID of the incoming call will be passed along to Google Voice and stored as part of the voicemail message.

Connecting the Dots. For the visionaries in the audience, you're probably wondering what it would take to add language translation to transcription. So were we. It raises some interesting questions, and some of our early adopters already have tried it. Suffice it to say, it doesn't work yet. But it wouldn't take much effort to run a transcribed message through Google Translate and spit out a Spanish, French, or German message on the other end. Or vice versa: transcribe a German message and translate it into English for email delivery in an English-speaking country. Exciting times, indeed. Stay tuned!

Free U.S. Calls with Google Voice. At least for now, calls through Google Voice to phone numbers in the United States are free. And the rates are quite reasonable to other countries. It's a penny a minute to Canada and two cents a minute to many other countries whose names don't include the word "island." There are several ways to terminate calls through Google Voice with Asterisk. Here's the only way we've found to place outbound calls and also preserve the message transcription functionality.

Log into your Asterisk server as root and edit extensions_custom.conf in the /etc/asterisk folder. In the [from-internal-custom] context, add one or more entries for people you wish to call. Be sure to make the following substitutions to match your Google Voice credentials:

999 - Extension number to call
9876543210 - Your Google Voice DID
8888 - Your Google Voice PIN
1234567890 - Phone number of person to call

And here's the default entry which should be one continuous entry on one line:

exten =>999,1,Dial(SIP/9876543210@216.239.37.15:5061
,30,mD(wwwwwwwwwwww*ww8888ww2ww1234567890#))

When you finish making all the extension entries desired, save the file. Then reload your Asterisk dialplan: asterisk -rx "dialplan reload"

Google Dialer for Asterisk. Another approach for outbound calling with Google Voice would be to create a simple dialer in your Asterisk dialplan. The idea here is that anyone can pick up a phone and dial *GV (which is *48) to place a call. They then will be prompted to enter the 10-digit number to call. This code would be inserted in the same [from-internal-custom] context, and remember to insert your actual Google phone number and PIN in the dial string and keep the entire Dial command on a single line (which we can't do in this blog's template). Reload the Asterisk dialplan when you're finished.

exten => *48,1,Answer
exten => *48,n,Wait(1)
exten => *48,n,Set(TIMEOUT(digit)=15)
exten => *48,n,Set(TIMEOUT(response)=20)
exten => *48,n,Playback(pls-entr-num-uwish2-call)
exten => *48,n,Read(NUM2CALL,beep,10)
exten => *48,n,Playback(pls-wait-connect-call)
exten => *48,n,Dial(SIP/9876543210@216.239.37.15:5061
,30,mD(wwwwwwwwwwww*ww8888ww2ww${NUM2CALL}#))
exten => *48,n,Hangup

Outbound Trunk Alternative. Since the original article was published, our British colleague, Joe Roper, suggested that we also include instructions for configuring Google Voice as a dial-out trunk (instead of an extension) in Asterisk. The advantage of this approach is that outbound calls can be dialed in the traditional way without interaction with voice prompts. The solution we will outline below lets you place a call from any Asterisk phone by dialing the GV prefix plus a 10-digit number. So, to place a call to President Obama in Washington through Google Voice, you'd dial 48-202-456-1111. Good luck with that, but here's how...

First, log into your Asterisk server as root and edit extensions_custom.conf again. This time, go to the very bottom of the file and add the following code using your Google Voice phone number and PIN. Remember to expand the two-line dial string so it fits on a single line with no spaces! Save your changes and reload the dialplan.


[custom-google-voice]
exten => _X.,1,Dial(SIP/9876543210@216.239.37.15:5061
,30,rD(wwwwwwwwwwwwww*www8888www2wwww${EXTEN}#))
exten => _X.,n,Hangup

Next, open FreePBX with a web browser and choose Setup, Trunks, Add Custom Trunk. Insert the following Custom Dial String on the form and Submit Changes and reload the dialplan:

local/$OUTNUM$@custom-google-voice

Finally, choose Setup, Outbound Routes, Add Route and fill in the following entries on the form:


Route Name: GoogleVoice
Dial Pattern: 48|NXXNXXXXXX
Trunk Seq: local/$OUTNUM$@custom-google-voice

Save your changes and reload the Asterisk dial plan one more time to complete the setup. Now you're all set to call the President whenever the urge strikes: 48-202-456-1111. And, remember, it's a free call... at least for now.

Homework. Google also has introduced a slick new directory assistance service which also is free. We'll leave it to you to take the lesson above and create a GOOG-411 entry in your dialplan. HINT: You choose option 3 instead of option 2 after entering your PIN in the Google Voice menu. Enjoy!

Chapter 2. Google Voice: Is the SIP and Asterisk Honeymoon Over?

Chapter 3. The Return of Googlified Messaging With Free U.S. Calling


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest...

Asterisk Hell: A Minefield Navigation Guide for Newbies

We're going to take a serious look at Asterisk® through the eyes of a typical new user today. Our objective is to turn newly built Asterisk servers into stellar performers, IP telephony systems that work reliably without the quirks that are all too familiar to those of us who have tiptoed through the minefield for many years. Whether you've chosen to run PBX in a Flash, or a trixbox system, or Elastix, or rolled your own Asterisk system, that's the least of your problems. And it doesn't really matter which flavor you chose because most of the pitfalls we'll be discussing today apply more or less to all of the distributions. Our yardstick for whether your system is performing satisfactorily is straightforward. When your significant other begins screaming for the return of a plain old telephone, you know, one where people on the other end of a call can actually hear what you're saying... you've got a problem.

Download Blues. You can't build an Asterisk-based turnkey system without knowing how to deal with an ISO download. If you have questions about how to create a usable CD from an ISO download or, if your newly minted CD won't boot, follow these simple steps. With a Mac, use Roxio Toast. Choose Copy, click Image File, and drag the ISO file you downloaded into the folder. Click Burn after inserting a blank CD. If you don’t own Toast for your Mac, go to the Applications->Utilities folder and run Disk Utility. Click on Images->Burn from the Title Bar and choose the ISO file you downloaded. Then click Burn to begin. For those in the PC World, you’ll need either Roxio Easy CD Creator or Nero to create a CD from an ISO image. With Easy CD Creator, choose Create Data CD. Then in the File menu, select Create CD from Image, and choose your downloaded file. Now click burn to begin. With Nero, go to Recorder from the top menu and choose Burn Image. Select your download file. Then from the Burn Compilation Window, choose Burn to begin.

Hardware Nightmare. Our Wild Ass Guess (WAG) would be that 90% of the installation problems experienced by new Asterisk users are directly related to crappy hardware. If it sounds like we're tired of hearing about this, you'd be right. The issues range from clone X100P cards that don't work (those that do work usually don't work for long!) to 10 year old systems that barely work to $3,000 top-of-the-line dual everything systems that Linux simply does not yet recognize because the hardware is so new that the glue isn't even dry on the motherboard. The video card is brand new, the onboard network adapter has been in production less than a month, and the SATA RAID drive adapter has been customized just for Dell. Guess what, Dude? The operating system won't load. ATTN: Everybody. Do yourself (and us) a favor. Throw your 10-year-old system in the recycle bin where it belongs. And don't replace it with the most expensive new system from Dell that you can find. We've got nothing against Dell by the way. Keep in mind that we're not loading Windows Vista Premium Deluxe that needs 10,000 horsepower to get out of bed every morning. For a Linux-based telephony server that is going to support under 100 people, the $3,000 server is just overkill and will cause many more problems than it solves. Instead, scratch together $200 and buy yourself a new WalMart Special, a.k.a. the Everex Green PC. You also can get one from NewEgg if you hate WalMart.everything. Now add a gig of RAM for $25 and call it a day. Bottom line: It works. It's reliable. It's new. And it's got performance to spare. Worried about a system failure? Then buy two of them, and we'll show you how to build mirrored servers in coming weeks.

Hardware Nightmare, Part II. For newbies that skimp on hardware, their next purchase is usually the cheapest SIP telephone on the planet. Don't! It's a Death Wish Come True. A week later you'll be wondering why all your friends say it sounds like you're calling from a tunnel. The Little Mrs., of course, has long since begun making all of her calls on a cellphone... which tells you how bad your new system really is! Our advice: Take the $200 you saved buying the WalMart Special above, and buy yourself ONE decent SIP telephone. You'll never be sorry. The Aastra 57i is a perfect phone, period. You can read why here. We even have free software that will automatically configure Aastra 57i's for you. All you have to do is plug it in. And, if you like the flexibility that comes with cordless handsets, splurge for the 57i CT for about $100 more, and you'll have the best phone plus one or more cordless handsets with incredible range.

Software Nightmare. Whether you barely understand Linux or consider yourself a Linux guru, unless you know just as much about Asterisk, save yourself (and the existing Asterisk community) weeks and weeks of headaches. Download one of the Asterisk aggregations that's already been built for you such as PBX in a Flash. In the case of PBX in a Flash, it includes all of the source code necessary to recompile anything on the system once you get your feet wet. Believe it or not, the people that put these aggregations together have decades of Linux, networking, and telephony experience. They actually know what they're doing (in most cases), and the FreePBX web interface to Asterisk that is included in most of these packages was written by some of the best Asterisk gurus on the planet. These aggregations are self-contained ISO images that include the operating system and every piece of the puzzle that you'll need to get an Asterisk system up and running in under an hour. No small feat! If you pick the right one, everything works out of the box, and you can keep it current by issuing one simple command from the Linux prompt... any time you like. It's also easy to add your own pieces down the road using the included compiler and compilation tools. For those that say "I wanna learn as I go" but don't know the difference in a Dialplan, a Bedpan, and a Portapotty (HINT: see inset), here's a tip. Start with an aggregation and then build your own Asterisk system from the ground up... in about six months after you return from Asterisk Bootcamp. In the meantime, pick up a copy of Linux for Dummies. If you're too cheap to cough up the twenty bucks, at least read Joe Roper's Conversational Linux for Newbies. It's free.

It's Your Firewall, Stupid. I wish I had a nickel for every message thread that has been written that goes something like this. "I can make calls out of my system, but the people I call can't hear me." Or vice versa. The answer is pretty simple if you stop and think about it for a second. A phone call has two participants. One talks and the other one listens. Then you take turns. At least that's the theory. For that to actually work in the world of Internet telephony, the talking legs of the call have to be able to get from Point A to Point B and from Point B to Point A. If your IP-based telephone or Asterisk system is sitting behind a firewall/router, you have to configure your router to pass the incoming data into the server and telephone on your private network. If the telephone or Asterisk system on the other end of the call happens to also be sitting behind a firewall/router, then we have what's called "double NAT issues." And, no, this doesn't refer to no-see-ums on a steamy summer night in Dixie. Bottom line: If any of this communications traffic can't find it's way to the other end, then someone can't hear all or part of the telephone conversation.

To fix NAT problems with Asterisk, you simply tell your router to forward all data received on UDP ports 4569, 5004 to 5037, 5039 to 5082, and 10000 to 20000 to the private IP address of your Asterisk server. You also must make certain that the following entries exist in /etc/asterisk/rtp.conf:

[general]
rtpstart=10000
rtpend=20000

And bindport = 5060 must exist in the [general] context of /etc/asterisk/sip.conf. The aggregations take care of the rtp.conf and sip.conf setups for you. But you must reconfigure your router/firewall. Last, but not least, you probably need to complete the next step below as well.

Wherefore Art Thou, Server? If you plan to add additional telephones to your system which are not behind the firewall with your Asterisk server, then those phones have to know the public IP address of your server... all the time. The same holds true with some Internet telephony hosting providers. In lieu of a static IP address, you can use a fully-qualified domain name, e.g. mypbx.dyndns.org. This avoids a problem if your Internet service provider only gives you a dynamic IP address which changes from time to time. There's one more step in making this work. You have to set this information up in Asterisk. Here's how.

Log into your Asterisk server as root and edit sip_custom.conf: 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=mypbx.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.

Be aware that, with some hosting providers, you may experience problems with the externhost approach outlined above. If your ISP only gives you a dynamic IP address, you still can use the externip approach above so long as you have a method to frequently verify your IP address. The approach we actually use on our network is to run a little script every 5 minutes. If it finds that your outside IP address has changed, it will automatically update your sip_custom.conf file with the new address. To use this approach, create a file in /var/lib/asterisk/agi-bin named ip.sh. For this to work, you have to be able to ping your fully-qualified domain name and get a response! Here's the code:1

#!/bin/bash
fqdn="mypbx.dyndns.org"
localnet="192.168.0.0"
externip=`ping -c 1 $fqdn | cut -f 2 -d "(" | cut -f 1 -d ")" -s ↩
| grep -m 1 ^`
if [ -e /tmp/$externip ] ; then
echo No IP Update Required ;
else
echo IP Update Required ;
touch /tmp/$externip ;
echo "externip=$externip" > /etc/asterisk/sip_custom.conf
echo "localnet=$localnet/255.255.255.0" >> /etc/asterisk/sip_custom.conf
asterisk -rx "dialplan reload" ;
fi

On line 2 of the above code, enter the fully-qualified domain name for your server that is registered with your DDNS host. Take a look at this thread for information on DNS-O-Matic which is free.

On line 3, enter the internal subnet for your server. This is usually 192.168.0.0 or 192.168.1.0. YMMV!

Save the file and give it execute permissions: chmod +x /var/lib/asterisk/agi-bin/ip.sh. Then make asterisk the file owner: chown asterisk:asterisk /var/lib/asterisk/agi-bin/ip.sh.

Finally, add the following entry to the bottom of /etc/crontab:

*/5 * * * * asterisk /var/lib/asterisk/agi-bin/ip.sh > /dev/null

Snap, Crackle, and Pop. No. Your phone calls are not supposed to sound like a bowl of Kellogg's Rice Krispies. If they do, it usually means your Internet bandwidth is insufficient to support a reliable VoIP call. Using an uncompressed codec such as ULAW, a single call requires roughly 128 kbps of bandwidth in both directions for a reliable conversation. A full T1 can handle roughly 20 simultaneous calls. If you have a dial up Internet connection, do your friends a favor. Go back to tin cans and a string. It'll work just as well and maybe better. Keep in mind that most ISPs do not offer any QOS guarantees with their service and upstream bandwidth is severely restricted. Not surprisingly, this seems to have gotten worse as more and more ISPs try to steer their customers towards their own VoIP offerings. If you have Internet bandwidth to spare but have a busy LAN, you may want to consider a router that provides increased throughput for certain types of data, e.g. SIP and IAX traffic. Most gaming routers provide good traffic shaping functionality. For example, the dLink DGL-4300 Gaming Router provides excellent results and is currently available at Amazon for under $85 after rebate. Another option is to use a different codec for your calls. See this table for the bandwidth calculations. But be aware that as VoIP data gets compressed, you also run the risk of serious degradation in calls if there is any appreciable packet loss because of the geometric effect this has on compressed data. See this thread for some other troubleshooting tips.

Got Those Disappearing Email Blues. Where did my emails go? Nowhere is the usual answer. Sending email messages with your latest voicemails attached is a wonderful feature that PBX in a Flash and other FreePBX-based systems fully support. There are two common problems in sending emails from your LAMP-based Asterisk server. Either your server isn't configured to send out email or your ISP is blocking the transmission of emails that originate from your system. It's usually easier to troubleshoot email problems by first determining whether your ISP is blocking the emails. Then it's pretty simple to test whether your server is properly configured to send the messages... but, first, a brief history lesson.

Many ISPs don't like downstream servers that function as so-called SMTP hosts because of SPAM and email relay hosts. An improperly configured SendMail server can be used to generate thousands of messages an hour from anyone with an Internet connection. One of the first SPAM messages we received after creation of the Department of Homeland Security was a message using a DHS sendmail server as an email relay host. That inspired confidence. To avoid this problem, ISPs do several things. Typically they block port 25 on their servers so that you can't send out email from downstram SMTP servers. Instead, you have to use their SMTP server to send all outbound email. Comcast takes it a step further. On some systems, they block port 25 on your cable modem so that email never leaves your home or office. Do they typically tell you when they do this? Of course not. While all of this is done in the name of reducing SPAM, it's also a convenient excuse for imposing service restrictions which also happen to save them bandwidth... which you are paying for.

To test whether your ISP is blocking port 25, log into your Asterisk server as root and issue the following command:

telnet nerdvittles.com 25

If your provider isn't blocking port 25, you should get a response like this:

Trying 69.89.21.89...
Connected to nerdvittles.com (69.89.21.89).
Escape character is '^]'
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

If your ISP is blocking port 25, then the first step to get email flowing from your Asterisk server is to reconfigure SendMail in one of two ways. You can either send the messages through your ISP's SMTP server (and this won't work if port 25 is blocked on your cable modem!) or you can send secure messages using gMail as your SMTP relay host on port 587. This requires that you set up a free gMail account first. For detailed instructions on the gMail setup, go to this message thread and follow the instructions. For an example of using Comcast as your SMTP relay host using port 587, read this thread.

Now we're ready to configure your Asterisk server to reliably send out email messages. There's a simple trick to get this working. A fully-qualified domain name for your server must match the "from" address for the email messages that are sent. This domain does not actually have to be accurate so long as you don't expect to get return emails. Think of it as putting a fake return address on a letter which you mail. It doesn't keep the letter from getting to the designated destination. It just means that you'll never get it back if it were incorrectly addressed. So... our recommended scenario is to do the following. Log into your server as root and edit /etc/hosts. Insert pbxinaflash.dyndns.org in front of pbx.local and separate the entries with a space. Save the file and then restart your network: service network restart. Now edit /etc/asterisk/vm_general.inc and change the serveremail line to read as follows: serveremail=vm@pbxinaflash.dyndns.org. Save the change and reload your dialplan: asterisk -rx "dialplan reload".

Finally, we want to send a test message to be sure everything works. Then you can use FreePBX to tell Asterisk to deliver voicemails to your email address by editing your Extensions settings. To send a test message, log into your server as root and type the following using your real email address. Wait a minute and then check your mailbox (including your SPAM mailbox) to be sure you got it somewhere.

echo "test" | mail -s testmessage nerduno@dyndns.org

Decipherable TouchTones Really Are Part Magic. For the poor soul that finally has a system where he can both speak and hear on the phone (just like in the Old Days), the next hurdle usually rears its head the first time you connect to your favorite doctor's office or credit card company and need to press zero for customer service. After pressing 0 for the hundredth time, you conclude that the buttons on your phone are not working. Before too long, you rightly conclude that there's something wrong with Asterisk. Correctomundo! If you want the technical reason for why you may have lost DTMF signalling, take a look at the RFC. To put it down where the goats can get, if you go into a Chinese restaurant where only Chinese is spoken and you happen to only speak English, chances are you may leave hungry. In the world of touchtones and Asterisk, there are several different dtmfmode settings. There's one for your phone to communicate with your Asterisk server, there's another for your server to communicate with your phone, there's another for your Asterisk trunk to communicate with your provider, and there's another for your provider to talk to you. Now multiply all those combinations by two for communications with another party, and you'll have some idea of the technical hurdles... even with a perfect connection between Party A and Party B. In short, perhaps you just should be thankful you can hear the person at the other end of the call at all.

If different portions of the call are using different DTMF settings and with some compressed codecs, the touchtones cannot be deciphered at the other end of the call. There are several things you can do to improve your chances of DTMF tones working. First, use a reliable provider and buy decent phones. Second, set your server trunks, extensions, and your phones to dtmfmode=rfc2833 and see how it goes. If you still have problems, try adjusting the dtmfmode settings on just your phone and extension to some other value supported by your phone. These two must match. Try dtmfmode=inband and dtmfmode=info. Next, make certain that the dtmfmode setting for your trunk matches what your service provider is using to communicate with your server. This pair of settings must match as well. If you still don't have any luck, try a little Googling for the dtmfmode for your phone type and your provider. If it worked for someone else, chances are it will work for you. If all else fails, try another phone or a more reliable telephony service provider. Assuming you can understand them, you typically can tell whether your service provider understands the problems within about 30 seconds after the music on hold ends... which brings us to our favorite topic.

My Telephony Provider SUX. Yes. There are telephony providers and then there are telephony providers. As with most things in the world, you get what you pay for. Cheap telephony rates don't always mean crappy service, but it certainly improves your chances. All-you-can-eat plans are notoriously dangerous. Even if the telephone service is fairly good, the terms of service typically are shocking. Some even force you to agree to pay exorbitant backdated fees plus attorneys' fees if they, in their sole discretion, determine that you have used your plan for unauthorized calling.

We've got some tips that we repeat often so if you've heard them already, skip along to the next topic.

  • Rule #1: If your business depends upon incoming telephone calls, don't use VoIP telephony service for all of your incoming calls. What you may want to do is order a single business line from AT&T and take Marty Tennant's advice: "You can order an arrangement called 'call forward/busy multi-path' from AT&T (confirm this beforehand) that will allow multiple call forwarding instances to another number (the VOIP one in this case)."
  • Rule #2: Do some reading on which providers have good reputations. We also have a good list of providers that we regularly recommend.
  • Rule #3: With pay-as-you-go termination providers for outbound calls, it doesn't cost you a dime to have numerous trunks provisioned and working on your Asterisk system. If a termination fails using your preferred provider, Asterisk will simply drop down the list until it can successfully complete the call. So don't ever put all your eggs in one basket for terminations.
  • Rule #4: All-you-can eat incoming service with a free DID is still a very good deal at least in the United States and Canada. See our list for suggestions.
  • Rule #5: Toll-free numbers no longer have to be expensive. See our recommendations for reasonably priced toll-free numbers, and give your business a shot in the arm for almost nothing!

What Happened to CallerID? CallerID really is the last vestige of the old Ma Bell monopoly. CallerID numbers are easily deciphered on almost all Asterisk systems regardless of your DID provider. This is true on inbound and outbound calls. CallerID name is a different story. The short answer is that the Baby Bells all maintain their own telephone directories. And chances are you're not in it if you're using VoIP telephony service. These companies seek to preserve their telephone monopoly by *NOT* processing CallerID names that are received from "foreign" systems. Instead, they take the CallerID number that is provided and look up the name in their proprietary directory. No entry = No CallerID Name display. So... the short answer is that, for outbound calls from your system, it does no good to send CallerID Name information. Almost every provider throws it in the bit bucket.

That still doesn't explain why you can't get CallerID names for incoming calls. Here's where your DID provider matters. Some of them subscribe to baby Bell-supported service that provides the names, and others don't. If your DID provider doesn't, then you can either set up your own service to supply CallerID name information, or you can get a new DID provider. For the best homegrown CallerID name service, we recommend Ultimate CNAM from Titanous. It works well on all PBX in a Flash systems and is extremely flexible in the choices provided for name lookups. It currently supports eight lookup providers: AsteriDex, WhoCalled.Us (registration required), Whitepages.com, AnyWho.com, Canada411.com, Google Phonebook, TelcoData (Ratecenter), and Fonetastic (Ratecenter).

My Passwords Don't Work Any Longer. What is it about Asterisk that makes everyone want to screw around improving their passwords? Leave them alone! So long as your initial root password is secure, you're absolutely safe from intruders except someone with physical access to your machine (even on the Internet) if you just do the following. First, using a web browser, go to the IP address of your new server. Click on Administration and then Menu Configuration and enter an Admin password that is as secure as your root password. Second, open FreePBX and click on Setup and then Administrators. Change the password for admin to something equally secure. Third, go to the Linux command prompt. Type each of the following commands and enter a secure password for each.

passwd-maint
passwd-amp
passwd-meetme
passwd-webmin

Now leave your damn passwords alone for at least six months unless you are tortured and forced to reveal all of your innermost secrets. If the annoying FreePBX password reminders bug you, then go to this link and follow the instructions to make the reminders disappear. Then leave your system alone for a week to make sure everything works reliably. Now you're free to add one new thing every other day checking often to make sure it didn't break something that was previously working. When you add ten new things at once, it's virtually impossible to put Humpty back together again. But, of course, you knew that. Enjoy!


PiaF Without Tears. Ben Sharif's PiaF Without Tears tutorial (all 208 pages) was released last week. For those that haven't yet taken a look, you're missing a treat!

Coming Attractions. With the new PBX in a Flash 1.2 release, there now are four different versions of Asterisk that can be installed: 32-bit Asterisk 1.4, 64-bit Asterisk 1.4, 32-bit Asterisk 1.6-beta, and 64-bit Asterisk 1.6-beta. Next week we'll address the installation issues with the Nerd Vittles applications using each of these new systems and expose a few more potholes in the Asterisk minefield. And we may have a new AsteriDex 4 add-on for you as well.

Nerd Vittles Cepstral Demos with Allison TTS (courtesy of les.net). You now can take some Nerd Vittles projects for a test drive... by phone! And it provides a good example of the VoIP quality you can expect with hosted service from Aretta Communications. The current demos include all five new applications preconfigured for Cepstral with the Allison TTS voice: (1) MailCall for Asterisk with password 1234 (retrieve POP3 email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, (4) Weather Forecasts by U.S. ZIP Code, and (5) Worldwide Weather Forecasts.

The WalMart Special. We continue to believe that the Everex gPC (aka The WalMart Special) is an almost perfect server for Asterisk implementations with less than 30 simultaneous calls and up to 100 or so extensions. At $199, you can't beat the price. To make things even easier, we will have a preconfigured 2-CD ISO installation set for either the 32-bit Asterisk 1.4 or 1.6-beta version of PBX in a Flash in the next few weeks. It'll include all of the Nerd Vittles goodies plus a full system automatic backup system. All you'll need to add is a 4GB flash drive (about $15) for your weekly backups, and you'll never have to worry about losing your system again! So order your unit, and you'll be ready for the rollout. Here's the WalMart link and the NewEgg link for the latest hardware version. Add a gig of RAM for $25, and you'll have the perfect telephony server platform to begin your Asterisk adventure.


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest...

  1. Join the following line as part of the line above when you see the ↩ character in the code. []

Some Asterisk Resolutions for the New Year

We made some New Year’s Resolutions for 2008… just as we do every year. There are the usual ones: lose weight, exercise, more quality time with the family. But you make all of those, too. This year, there are some changes in the Asterisk® landscape we’d like to see: more community participation, better training opportunities, an end to deprecating commands, and a push into major corporate and government organizations.

The Asterisk Business Model. As we count down the days to the Nerd Vittles third year birthday bash, we’ve got to say that we’ve learned a lot these past few years. The amazing part of Asterisk is really that it has survived at all. Until recently, Digium® derived almost all of its revenue off hardware sales. Fonality makes its money off hosted Asterisk solutions. Hardware vendors seem to be doing just fine as are small systems integrators. But the folks that provide the software products that make Asterisk fly are basically starving to death. The open source model has been used as a convenient way for a handful of companies to essentially profit off someone else’s work, and I’m not talking about Digium that has done much more than its fair share to contribute open source software in exchange for hardware dollars that it has earned. And this isn’t a plea for money. I retired from a cushy government job with a cushy retirement plan so starvation isn’t all that likely in my case. But, to give you an example, our recent fund-raising campaign to raise money for a dedicated server to host our forums raised a whopping $80. To those that contributed, thank you! But we have a weekly readership of roughly 50,000 people, most of whom presumably depend upon Asterisk systems every day. We’re as cheap as the next guy, but come on folks. Would $10 really change your life style that much? And we’ve heard much the same story from the FreePBX developers. So… Resolution #1 for each of you should go something like this. Find a way that you can give something back to the Asterisk community in 2008. It doesn’t have to be money! Develop an application, develop some documentation, come up with some new ideas and share them with the rest of us. But do something for somebody else without expecting something (else) for free.

The Open Source Alternative. Absent some radical shift in contributions and participation which most of us don’t expect to see, our prediction for 2008 is that the days of the open source gravy train are numbered, at least for turnkey telephony systems. Keep in mind that these are systems that most organizations used to pay hundreds of thousands of dollars to purchase and maintain. The alternative that appears to be gaining steam is to gobble up all the free software you can find and then embellish it with proprietary bells and whistles that are not made available without a charge for either the embellished product or a support contract of some type. This is a real dilemma for developers like the FreePBX and PBX in a Flash teams. As we provide more and more functionality as open source software, the "takers" gobble up the goodies, make another sale, and return almost nothing. What’s wrong with this picture? Everything!

Our Resolution #1 is to push for a review of the licensing model. We have no objection to individuals downloading and using all of our code for free forever! However, for those that profit off reselling someone else’s work product, there needs to be some type of contribution into the open source projects that comprise the bundle which is being sold by non-contributors for a handsome profit. And, no, we’re not talking about system integrators who merely charge for their time. For the most part, we’re talking about corporations that sell rebranded, open source solutions for profit. Perhaps a 5-extension license could be offered at no cost with additional extensions being sold for some fee. Another approach might be to license endpoint and/or trunk connections with vendors paying some connection fee to help defray software development costs. Nortel and others used this model for decades. These approaches, of course, also raise questions about how to divide the income between all of the open source contributors. Not sure we know the answers yet, but we’d be interested in getting your feedback and suggestions. It’s in everyone’s best interests to keep the entire Asterisk development community moving forward… and eating.

Vertical Market Penetration. Still another solution, which we happen to favor, is to license add-in code for turnkey Asterisk systems which meets the needs of specific vertical markets. For example, the hotel/motel industry could benefit immeasurably from a move to VoIP telephony. The Marriott’s, Hyatt’s, and Hilton’s of the world already have learned this. But that leaves tens of thousands of smaller hotels and motels that still are using primitive telephony systems. All it would take to make a system like PBX in a Flash a player in this market would be wakeup calls (which Nerd Vittles will provide with Telephone Reminders for Asterisk 1.4 shortly) and a method of recording from room telephones when rooms are vacant, being cleaned, ready for occupancy, or occupied. Asterisk voicemail options already run circles around the features available in most hotels. All that is missing is a way to clear voicemails when someone checks out of the hotel. And A2Billing provides hotels with an instant profit center for outbound calls worldwide. Our purpose today wasn’t to design and build a vertical market solution, but you get the idea. This wouldn’t be rocket science.

Another market which is ripe for Asterisk penetration is the medical community. Ever wondered why a full-time employee in every doctor’s and dentist’s office has to call and remind every patient of their next appointment. TeleYapper and a carefully tailored IVR would provide physicians with a far better telephony solution at considerably less cost. Tying the system into an appointments database would be icing on the cake and easy to implement since MySQL already is running on systems such as PBX in a Flash. Then there are retail stores, restaurants, department stores, WalMart’s, marinas, time shares, rental apartments, call centers, and on, and on. None of these organizations have complex telephony needs that couldn’t be met by a system like PBX in a Flash out of the box. And, with modest customization, any data processing needs could probably be met using the same system. Last but not least is the government: federal, state, and local. Do you have any idea how many separate, crappy phone systems already are in place in government offices? Many of them were installed at a cost of several thousand dollars per user. Counted up the number of government employees lately? So here’s an approach. Find a typical government organization and build them a phone system for free, except for hardware. Then get the mayor or the governor to sing its praises at the dozens of meetings these people attend every year. The sad part of this story is that we have the technical talent in the Asterisk community to produce an extremely compelling product. What’s missing is management vision coupled with a well-trained sales force to get the message across to corporations and government organizations.

Fixing the Asterisk Deal Breaker. Believe it or not, there is a serious shortcoming with Asterisk, and it has nothing to do with the feature set. It lies in the development mentality that there’s something okay about breaking application code by inventing new commands in the Asterisk Extension Language (AEL2) and deprecating (a.k.a. trashing) old ones every year or two. And now Manager 1.1 has been released in the Asterisk SVN trunk. Yikes! We’re scared to look. After the Microsoft fiasco with Visual Basic and VB .NET, one would have hoped we wouldn’t need to have this discussion.

Suppose for a moment that a handful of key commands in the C programming language were changed. The Asterisk developers would be at the front of the line screaming foul when they had to review and rewrite all of their code. Hello!! It’s the same deal when the shoe is on the other foot. This shortcoming simply has to be addressed or vertical market penetration is never going to happen. Organizations buy phone systems expecting them to work reliably for a decade or more. They also invest heavily in building customized application code to support their particular vertical market. DialPlan Functions in AEL2 dealing with timeouts, CallerID, and Asterisk Database Calls all fail if you use the Asterisk 1.2 syntax. These command language changes between Asterisk 1.2 and Asterisk 1.4 broke virtually every application ever produced for Asterisk. Furthermore, the time between versions 1.2 and 1.4 was barely a year. If you want to waste a day, try finding even a list which cross-references old Asterisk 1.2 dialplan commands to their new Asterisk 1.4 counterparts. About the best you can find is a summary of the new commands under section 6.1 here and the mishmash of old and new commands which are summarized at voip-info.org. Neither of these sites has any affiliation with asterisk.org where one would have hoped to find some information. If we’ve missed something, no doubt some fanboy will set us all straight. But, just to be clear, we’re looking for a specific link rather than an RTFM suggestion.

To put it in dollars and cents, organizations simply cannot afford to redesign and rewrite all of their application code every couple of years when someone dreams up new verbs or new ways to use parentheses, brackets, and braces. The fact that Asterisk may be free is pretty much irrelevant once the cost of rewriting all your application code is factored in. So… our plea to the core Asterisk developers is STOP DEPRECATING COMMAND SYNTAX, or you’re going to kill vertical market penetration of the product. It takes at most a few lines of code to support the 1.2 syntax of DigitTimeout(7) as well as the 1.4 syntax of Set(TIMEOUT(digit)=7). There are certainly good reasons for adding new commands to a programming language particularly to support new functionality. But why would you break every application that’s ever been written? Surely it’s not to conserve disk space or RAM in this day and age. You’re writing code for the business community, and that needs to be taken into account if Asterisk is ever going to achieve market penetration in the government and in corporate America… not to mention everywhere else! In case you couldn’t tell, if we have one pet peeve in life, it’s having to debug our own code that functioned perfectly because somebody got a bee in his bonnet to "improve" programming language syntax. <end of rant>

There’s Some Good News, Too! Well, enough of the doom and gloom. We have some terrific news to ring in the New Year as well. As most readers of this column know, FreePBX provides the pretty face for Asterisk as well as all of the smarts to get the most out of your Asterisk PBX without having to learn anything about programming. Well, so you thought! Actually, there’s an incredible number of additional things you can do with Asterisk and FreePBX once you master the FreePBX way of doing things. The problem has been that, up until now, there hasn’t been a way to get individualized training on FreePBX. Well, your prayers have been answered. The FreePBX whiz kids have put together an incredible training session, and Nerd Vittles hometown will be the host site! The FreePBX Open Telephony Training Seminar will be held in Historic Charleston, South Carolina beginning February 27 through February 29, 2008.

This is a DON’T MISS opportunity to learn everything you ever wanted to know about FreePBX, Asterisk, and Linux. The course will cover IVRs, ACDs, IRQs, E911, and the rest of the alphabet as well as routing, trunking, dialplan integration, remote office configuration, echo cancellation, TDM hardware, gateways, IP phones. It’s a very full, three-day course with a half day devoted to branding and selling Asterisk systems. The seminar is being held at one of Charleston’s premier hotels, the Embassy Suites Historic Charleston, with gorgeous suites, swimming pool and exercise room, free WiFi, free breakfasts, and free cocktails every evening. There also will be evening sessions to sit down one-on-one with the FreePBX and PBX in a Flash developers with ample assistance from the quintessential Asterisk development tools: beer and whiskey!

For those unfamiliar with Charleston, just think of it as the best of New Orleans and San Diego all rolled into one terrific Southern city known for its hospitality. By all means, bring your spouse or significant other. Charleston recently won the Reader’s Choice award as the Best Southern City. See the January 2008 issue of Southern Living magazine which is on newstands now. And, if you like New Orleans restaurants, you’ll love Charleston dining! Here’s a big hint: register early if you want to attend. Seating is limited, and the hotel will probably be full except for the rooms already blocked for this seminar. Some of your favorite vendors also will be in attendance, but we’ll save some of those surprises for the coming weeks. If you haven’t yet met Philippe Lindheimer, the lead developer of FreePBX, suffice it to say you are in for quite a treat. We also hope to have the entire PBX in a Flash development team in attendance to address your every need. So, make this New Year’s Resolution: Don’t Procrastinate or you may miss this golden opportunity. Rumor has it that, if you sign up at this link very quickly, you’ll save $600 on the registration fee! And, no, we don’t make a nickel if you attend, but if you tell ’em Uncle Ward sent you, then expect to receive a free drink at Happy Hour just like all of the other Embassy Suites’ guests. Seriously, we’re looking forward to meeting all of you. So come join us and… Happy New Year!


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…

Newbie’s Guide to TrixBox 1.1 and freePBX

NOTE: The system referenced in this article is no longer supported by Nerd Vittles as this version of Asterisk® has been phased out. For the latest and greatest, please consider our new PBX in a Flash offering.

Today we'll show you how to install the latest and greatest TrixBox 1.1 with freePBX 2.1.1 in just over an hour. As with the earlier release of TrixBox, these new Asterisk products are designed to support the casual home or home office user's PBX needs as well as gigantic call centers processing millions of calls a month. Everything is free except the hardware on which to run your new system. That can be almost any old Pentium PC or a multi-processor RAID box with mainframe horsepower.

What freePBX brings to the table is an incredibly simple yet powerful, upgradeable web-based GUI to totally manage your PBX. And TrixBox adds all of the Asterisk bells and whistles you could ever ask for in an integrated PBX: full-featured database management, simple hooks to high-level application development tools such as PHP and Perl, an Apache web server, integrated voicemail and fax-to-email support, contact management, calling card billing, hardware autoconfiguration for Digium and Cisco phone hardware, Microsoft networking support, an integrated text-to-speech system, and loads of free utility software applications for Asterisk compliments of Nerd Vittles. And, yes, TrixBox 1.1 still fits on a single CD! For those new to Nerd Vittles, be aware that we make slipstream changes to articles as users discover things we've missed. Yes, we're human! So check for Comments before you begin or subscribe to our Comments RSS Feed. And, last but not least, be sure to add yourself to the Nerd Vittles Fan Club Map.

UPDATE: This Guide has been superceded. For the TrixBox 1.2.3 tutorial, click here.

The Game Plan. Because of WordPress article length limitations and our own limited attention span, we're just going to cover the basics in this Guide. We'll leave a lot of the bells and whistles for future articles. So today we'll get your TrixBox 1.1 system running so that you can make your first call. We also want to get TrixBox properly configured to support our next free application: TrixBox MailCall. It'll let you retrieve and play back your email messages using any touchtone telephone and your TrixBox system. And, yes, you'll need TrixBox 1.1 to make everything work. The latest TrixBox 1.1.1 update (covered below) will get any system properly configured for the MailCall for Asterisk application. Thanks, Andrew!

Hardware Setup. You have two choices for hardware to run this new system. The first is to dedicate a machine to TrixBox and download the TrixBox ISO image to burn a bootable CD. Once you create the TrixBox CD, you simply boot your dedicated PC with the new CD. It will erase and reformat your hard disk for use with Linux and the included Linux and Asterisk applications. If you just want to experiment with TrixBox and don't plan to put the system into production other than for one or two simultaneous calls from home, then you may prefer to download the VMware version of TrixBox 1.0 or VMwarez's enhanced version. With this approach, you install VMware on your existing Windows XP or Windows 2000 system. Then you run Linux and the TrixBox application in a window on your Windows PC. It does not require a dedicated machine. We've found the performance to be virtually identical to running TrixBox on a dedicated PC provided your Windows machine has at least 512MB to 1GB of RAM. See our previous article for step-by-step instructions on the VMware installation process. And note that there isn't yet a VMware version of TrixBox 1.1 so follow the Newbie's Guide to TrixBox 1.0 to get everything working if you go the VMware route. TrixBox MailCall will not work with TrixBox 1.0 so, if that's of interest to you, install TrixBox 1.1. Once you run the trixbox-update.sh script twice (covered below), you'll have the 1.1.1 version running under VMware.

For now, however, we're assuming you've opted for the dedicated machine install: pure Linux on a clean machine. So begin by downloading the TrixBox ISO image from here and burn a CD (click here if you need a refresher course). Using your dedicated PC, insert the CD you made, plug your machine into the Internet, and turn it on. Then watch while TrixBox loads CentOS/4.3 and all the Asterisk and Linux goodies imaginable: Apache, SendMail, Asterisk Mail, SugarCRM, MySQL, PHP, phpMyAdmin, SSH, Bluetooth, freePBX, the Flash Operator Panel, Call Detail Reporting, and on and on. We've covered how to use most of the Linux products in our Mac HOW-TO's (see sidebar), and they work exactly the same way with TrixBox 1.1 so keep reading. And, yes, this install will reformat (aka ERASE) your hard disk before it begins, but it now warns you first. When you're prompted to create your root user password, type in something you can remember ... and write it down!

Upgrading TrixBox from a Prior Version of Asterisk@Home. In a nutshell, YOU CAN'T. But there is a way to put most of Humpty back together again once you've installed the new system. Before you begin, understand that you are doing this AT YOUR OWN RISK. NO GUARANTEES. If that bothers you, don't do it! The real trick is to do a little printing and copying of your old data before you insert that TrixBox installation disk. Step 1 is to make a full backup of your old system to a different server before you begin. If you don't know how, read our step-by-step instructions on the subject here. Step 2 is to make another copy of some of the critical files in your system. Duplicates of all of these will also be part of your backup. We typically build directories on a separate server which match the ones we'll be copying over from the old Asterisk system. Here are the directories (including all the subdirectories therein) that we always duplicate. Before you just blindly copy our list, stop and think whether there are special things you do on your existing Asterisk system or special apps that you run. Then find those files and make copies of all of them, too. The important piece in making a successful copy of some of these files is to shut down Asterisk (amportal stop) and MySQL (/etc/init.d/mysqld stop) before you begin. NOTE to CRM users: There's a new version of CRM in TrixBox so it's unlikely that you can restore the databases. Check your current version of AAH (help-aah) and see if there is an option (bundle-crm) to pack up CRM to move it to another machine. If so, do it and follow the instructions. We don't use Sugar so we haven't tested this upgrade option. Here are the directories you'll want to back up:

/var/lib/asterisk/agi-bin
/var/www/html
/var/lib/asterisk/sounds/custom
/var/lib/mysql
/root
/etc/asterisk

Then there are a couple of individual files that you'll also want to preserve:

/etc/hosts
/etc/crontab

The third step is to take screenshots of every screen you've built using the Asterisk Management Portal (AMP) or a prior version of freePBX. Start in the Setup tab and go right down the list of features. For each option in which you have multiple entries (e.g. Extensions and Trunks), call up each entry and print out the full page. Be especially careful in printing the Trunks entries and make sure you write down every line in the PEER Details and USER Details because those which are out of view will not get printed using a screen print. You'll need to manually fill in the ones that aren't displayed. The same goes for Registration Strings which often scroll out of view on the screen. Finally, using CLI (asterisk -r), make a copy of all your Asterisk database entries: database show. Now save all this information in a safe place until we finish the new install.

Loading CentOS/4 and TrixBox 1.1. Here's how the install went for us, and we'll walk you through getting everything set up so that it can be used as a production server. Once the install begins, you can expect to eat up about 25 minutes with the CentOS 4.3 install. Just be sure to create your new root user password before you walk away, or it will still be sitting there waiting when you return. Once Linux is installed, the TrixBox CD will eject itself, reboot the system, and begin the Asterisk compile and installation. That takes about 25 more minutes to complete.

Securing Your Passwords. When it's finished and reboots, log in as root with the password you assigned. Type help-trixbox for a listing of the other four passwords that need to be changed. Change them all NOW!

passwd admin
passwd-maint
passwd-amp
passwd-meetme

Securing and Activating A2Billing. This web-based application allows you to generate and issue calling cards to individuals so that they can place calls remotely through your Asterisk server. If you've always wanted to be just like AT&T, here's your Big Chance! There's very little that you can do with an AT&T calling card that can't be done as well or better by you using A2Billing. And, it won't take an M.B.A. to undercut AT&T's calling card rates and still make buckets of money. All you need now are a few customers. But first, a word of caution. Assuming your Asterisk server has web exposure on the Internet, you need to secure the admin and root passwords in this application whether you use it or not. To access the application, go to http://192.168.0.104/a2billing/ using the actual internal IP address of your Asterisk server. Log in as root with a password of myroot. Click on the ADMINISTRATOR tab in the left column and then click Show Administrator. Now click on the Edit button beside each of the two administrator accounts and change the passwords to something secure. If you really would like to learn more about it, documentation for the application is available here. And, if you decide to use the application, you'll need to uncomment six actual dialplan lines in extensions_trixbox.conf and reload Asterisk. Be sure to use a separate DID for this application and point it to custom-callingcard,s,1.

;[custom-callingcard]
;exten => s,1,Answer
;exten => s,2,Wait,2
;exten => s,3,DeadAGI,a2billing.php
;exten => s,4,Wait,2
;exten => s,5,Hangup

Securing SugarCRM Contact Management. TrixBox includes the best open source contact management application on the planet, SugarCRM. You access the application with a web browser: http://192.168.0.104/crm/ substituting the private IP address of your Asterisk box, of course. Specify admin for your username and password for your password. Whether you use the application or not, change the admin password. It's easy. Just click the Administrator link under Welcome admin. Then click the Change Password button. Complete documentation for the application is available here. If contact management is your thing, knock yourself out, and we'll talk to you next spring when you finish getting everything set up to run your business. It's a great product, but be prepared to invest lots of time in the project if you expect to use it productively.

Getting the Latest TrixBox Updates. Once your system is secure, load all of the TrixBox updates using one simple command. Log into your TrixBox system as root and issue this command: trixbox-update.sh update. If the update script has also been updated, you'll need to run the command twice.

Upgrading TrixBox to Support MailCall. The new TrixBox MailCall application needs POP3 and IMAP support for PHP in order to log into and read email messages from your email account. The latest TrixBox update adds everything you'll need to either TrixBox 1.0 or TrixBox 1.1 installs. Currently, the two libraries to support this aren't included in TrixBox so here's how to install them. Log into your TrixBox system as root and issue the following commands in order:


cd /root
wget http://nerdvittles.com/trixbox11/libc-client-2002e-14.i386.rpm
wget http://nerdvittles.com/trixbox11/php-imap-4.3.9-3.9.i386.rpm
rpm -Uvh libc*
rpm -Uvh php*

cd /var/www/html
wget http://nerdvittles.com/trixbox11/test.zip
unzip test.zip
rm -f test.zip

Reconfiguring Apache to Support PHP. At least on our system, TrixBox 1.1 was misconfigured for PHP applications to function properly with Apache. Note: This may have been fixed in the 1.1.1 update so, after downloading the test.zip file above, test your system by executing this command from a web browser using the actual IP address of your TrixBox system instead of our IP address: http://192.168.0.129/test.php. If you get a pretty PHP display about your system, you can skip the next step. If you just see three lines of code or nothing at all, then do the following while still logged in as root:

cd /etc/httpd/conf
cp httpd.conf httpd.conf.bak
nano -w httpd.conf

Once the editor opens your Apache config file, press Ctrl-W and search for the following: LoadModule access_module. After pressing Enter, move to the left margin of that line, and press Enter to open up a blank line. Insert the following code above the existing LoadModule access_module line:

LoadModule php4_module modules/libphp4.so

Now press Ctrl-W again and search for the following: AddType application/x-tar. After pressing Enter, open up a blank line below the existing entry and insert the following:

AddType application/x-httpd-php-source phps
AddType application/x-httpd-php php

Finally press Ctrl-W a third time and search for the following: #AddHandler cgi-script. After pressing Enter, add the following code below the existing entry:

AddHandler php-script php

Save your changes by pressing Ctrl-X, then Y, then Enter. Restart Apache to activate the changes: /etc/init.d/httpd restart. Now run the test.php script from your web browser again, and you should be all set.

Activating Bluetooth Support. Once the updates are completed, activate Bluetooth support if you plan to use it with our Follow-Me Phoning proximity detection application. Run setup, down arrow to System Services, press ENTER, down arrow to bluetooth and press the space bar, tab to OK, press ENTER, tab twice to Quit and press ENTER.

Activating Apache HTTPS Support. If you want secure Internet web access to your server, log into your system as root and issue these commands. Once https support is installed, you can access freePBX securely: https://AsteriskServerIPaddress.

yum -y install mod_ssl
shutdown -r now

Asterisk Info Application Is Back. One of the nice applications that previously was bundled in Asterisk@Home was Asterisk Info. It gave a detailed summary of many critical components in Asterisk including a listing of active SIP and IAX peers and registry entries. This is especially helpful when you're setting up new providers and want to see whether you're getting connected successfully. The application vanished in TrixBox 1.0, but it's back in TrixBox 1.1. You can run the application using a web browser pointed to the correct IP address of your server: http://192.168.0.129/. Then choose Asterisk Info from the TrixBox Configuration and Administration page.

Simplifying SSH Access. If you're going to be connecting to other servers from your new TrixBox system using SSH or SCP, then build your new RSA key pair now. This lets you use SSH and SCP (secure copy) without having to enter a password each time. You can also automate backups and proximity detection scripts as we've explained previously here. Log in to your new TrixBox server as root. From the command prompt, issue the following command: ssh-keygen -t rsa. Press the enter key three times. You should see something similar to the following. The file name and location in bold below is the information we need:

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1d:3c:14:23:d8:7b:57:d2:cd:18:70:80:0f:9b:b5:92 root@asterisk1.local

Now copy the file in bold above to your other Asterisk servers, Linux machines, and Macs. There's probably a way on PCs as well, but we've all but given up on that platform where security matters so you're on your own there. From your TrixBox server using SCP, the command should look like the following (except use the private IP address of each of your other Asterisk or Linux servers instead of 192.168.0.104). Provide the root password to your other servers (one at a time) when prompted to do so.

scp /root/.ssh/id_rsa.pub root@192.168.0.104:/root/.ssh/authorized_keys

On a Mac running Mac OS X, the command would look like this (using your username and your Mac's IP address, of course):

For user access only: scp /root/.ssh/id_rsa.pub wardmundy@192.168.0.104:/Users/wardmundy/.ssh/authorized_keys
For full root access: scp /root/.ssh/id_rsa.pub root@192.168.0.104:/var/root/.ssh/authorized_keys

Once the file has been copied to each server, try to log in to your other server from your new TrixBox server with the following command using the correct destination IP address, of course:

ssh root@192.168.0.104

You should be admitted without entering a password. If not, repeat the drill or read the complete article and find where you made a mistake. Now log out of the other server by typing exit.

Installing WebMin. We don't build Linux systems without installing WebMin, the Swiss Army knife of the Linux World. You can use it to start and stop services, check logs, adjust startup scripts, manage cron jobs, babysit your SendMail server, and many, many other tasks that are downright painful without it. If you ever need help from others, WebMin is a great tool for letting others help you.

There are lots of ways to install WebMin. WebMin now is part of the TrixBox yum repository so, after logging in as root, just issue the following command: yum -y install webmin.

WebMin runs its own web server on port 10000. To start WebMin, issue this command: /etc/webmin/start. You access it with a web browser pointed to the IP address of your Asterisk box (i.e. replace 192.168.0.108) at the correct port address, e.g. http://192.168.0.108:10000. Note, https support won't work on port 10000 without a bit of additional tweaking! The login name is root. Then type in your root password and press enter. The main WebMin screen will display. We really don't want the WebMin server starting up each time the OS reboots so do the following. Once you're logged in to WebMin, choose System->Bootup and Shutdown and then click on webmin. Click the No button beside Start at boot time, and then click the Save button. To stop WebMin when you're finished using it, issue this command: /etc/webmin/stop. You can restart it any time you need it, and then use a web browser to access it. But there's no need to waste processing resources. For complete WebMin documentation, click here.

If you're going to be accessing WebMin from outside your firewall, you really don't want to be logging in as root over an unencrypted connection so let's enable https support for WebMin. While still logged into WebMin, click WebMin->WebMin Config->SSL Encryption. Now click Install Net::SSLeay Perl Module. Once the module is downloaded, click the Continue With Install button. The make and make install process will take a minute or two. Once you get the completed sucessfully message, click Return to WebMin. Choose WebMin->WebMin Config->SSL Encryption again. At the bottom of the form, click the Create Now button to create your SSL key. Click Return to WebMin again. Then choose WebMin->WebMin Config->SSL Encryption once more. Change the Enable SSL if available option to Yes, leave the other defaults, and save your changes. Henceforth, you can log into your server using HTTPS: https://TrixBoxIPaddress:10000/.

IP Configuration for Asterisk. We need a consistent IP address or domain name both on your internal network and externally if you expect to receive incoming calls reliably. There are three pieces to the IP configuration: (1) setting the internal IP address of your Asterisk server, (2) configuring a fully-qualified (external) domain name for your new server which will always point to your router/firewall, and (3) configuring your router to transfer incoming Asterisk packets to your Asterisk server. Here's how.

First, log into your server as root using your new password. Now type ifconfig eth0 (that's "e-t-h-zero") then enter, and write down both your inet addr and your HWaddr on the Ethernet 0 interface, eth0. Inet addr is the internal IP address of your Asterisk box assigned by your DHCP server (i.e. your router/firewall). HWAddr is the MAC address of your Asterisk server's eth0 network card. To assure a consistent internal IP address, you can either configure your router/DHCP server to make certain that it always hands out this same address to your Asterisk machine, or you can manually configure an IP address for this machine which is not in the range of addresses used by your DHCP server. Almost all routers now make it easy to preassign DHCP addresses so we prefer option 1. It's generally under the tab for LAN IP Setup or DHCP Configuration and is generally called something like Reserved IP table. Just add an entry and call it Asterisk PBX and specify the IP address and MAC address that you wrote down above. Now each time you reboot your Asterisk server, your router will assign it this same IP addreess.

To assure a consistent external address is a little trickier. Unless you have a static (fixed) IP address, you'll want to use a Dynamic DNS service such as dyndns.org and configure your router to always advertise its external IP address to dyndns.org. DynDNS.org will take care of revising the IP address associated with your domain name when your ISP changes your dynamic IP address. Then you can configure your VoIP provider account using your fully-qualified dyndns.org domain name, e.g. windswept.dyndns.org provides access to our beach house network even though Time Warner cable hands out dynamic IP addresses which change from time to time.

Now you'll need to log into your router and redirect certain incoming UDP packets to the internal IP address of your Asterisk machine. If you want external access to the Apache web server on your Asterisk machine, then map TCP port 80 to the internal IP address of your Asterisk system. For WebMin external access, map TCP port 10000 to your Asterisk system. If you want remote access to your Asterisk system via SSH, then map TCP port 22 to the internal IP address of your Asterisk system. If you want external IP phones or other Asterisk servers to be able to communicate with your Asterisk system, then map the following UDP port ranges to the internal IP address of your Asterisk system:

SIP 5004-5082
RTP 10001-20000
IAX 4569

For more details, read our full article on the subject.

Finally, you'll need to tell Asterisk about some of this. Edit the sip.conf file (nano -w /etc/asterisk/sip.conf) and add the following entries in the [general] section of the file using your fully-qualified domain name for your server and the private IP address range used behind your router/firewall (typically 192.168.0.0 or 192.168.1.0 with most home routers):

externhost = yourdomainname.dyndns.org
localnet=192.168.0.0/255.255.255.0
nat=yes

Designing Your PBX System. For those new to the Asterisk world, we'll be using a web-based GUI to configure Asterisk to meet your needs. Step 1 is to get away from your computer and sit down with a piece of paper. Now lay out how you'd like your new system to operate. How many phones will you have? Will they be software-based phones or good old phones you can put on a desktop? Will they be POTS phones (plain old touchtone phones), cordless POTS phones, SIP phones, IAX phones, or cordless SIP phones? How will you make and receive calls? Are you going to use an existing Ma Bell phone line or VoIP trunk lines from one or more VoIP providers? What should happen when incoming calls arrive? Do you want the caller to get an AutoAttendant message ("Hi. You've reached the Mundy's. Press 1 for Mary, 2 for Ward, or 3 to leave a message.") or do you just want all of your phones to start ringing? What should happen when no one answers or the line is busy? Do you want the calls transferred to a cell phone, another POTS phone, or just sent to voicemail? Which voicemail account? Should all busy phones send callers to the same voicemail account, or do you want one for each phone? What should happen once voicemail arrives? Do you want the phone to ring once a minute? Do you want the message waiting indicator to illuminate? Do you want the voicemail message to be emailed to you? Do you also want it preserved so that you can retrieve it from a touchtone phone? Do you want to be paged with the number of the person that called you?

ATTN: "Type A" Males. With apologies to our female readers, let me chat privately for a moment with the guys. If you have a wife (and want to keep her) or if you have teenage daughters (and want to avoid being killed in your sleep), you'd better get most of this PBX design right if you plan to use Asterisk to replace your existing home phone system. Otherwise, the day after you install your new system, a typical discussion with your spouse will begin with something like this: "What was wrong with our old phones that just rang when someone called and I could actually hear what they were saying when I answered?" With that caveat in mind, let's jump right in to freePBX.

Today's Objective. Keeping in mind that there are a million ways to configure and customize a PBX, we're going to walk you through a very simple setup today. Our objective is to get Asterisk and freePBX configured so that you can make a call and receive a call. In our next article, we'll start adding all the bells and whistles. But, for today, we'll show you how to set up an incoming and an outgoing VoIP trunk so you can make and receive free calls (at least in the U.S.) using a free softphone. When no one answers, the call will be sent to voicemail. And, when a voicemail message is left, the message will be emailed to you. We'll leave integration of existing POTS phones and phone lines for another day.

Choosing VoIP Providers. As you will quickly learn, choosing VoIP providers is an art, not a science. And it can be a slippery slope. A provider that is great one day can turn into an absolute nightmare the next. Take BroadVoice, for example. They used to be one of our favorites. Then the CEO left, and the company's business practices, uh, changed to put it charitably. You can read all about it on this forum or at the Better Business Bureau's site. All it takes is a change in leadership or direction at the company headquarters to go from first to worst overnight. So the best advice we can offer about choosing providers is this. Stay Flexible! Don't put all your eggs in one basket. And don't be in a hurry to disconnect your Ma Bell line and transfer your number until you are pretty confident about your provider. Six months is an absolute minimum, and a year is probably better. VoIP providers come and go at about the same pace as fast food restaurants in a new community.

Having said all of that, we have some providers we really like and some that we don't. YMMV! The basic idea in switching to Voice Over IP technology was to save money... not just for the provider, but for you, too. So PRICE MATTERS. There are typically three types of VoIP service: all-you-can-eat at a fixed monthly price, pay-as-you-go at a per minute (or part of a minute) rate, and free. Some providers only offer outbound service, and others offer incoming and outgoing calls. To receive calls, you've got to have an account with a provider that will give you a phone number unless you want to only get calls from other users of that provider's service, e.g. Skype. You don't have to use the same provider for inbound and outbound calls, and you are better off with backup providers for BOTH inbound and outbound calls.

If you select an all-you-can-eat plan, you basically get the right to make (or receive) ONE phone call at a time to a certain geographic area. This may be a state, an area code, or a country depending upon where you live and which provider you choose. The best of these in the U.S. is TelaSIP at $14.95 a month for unlimited U.S. calling. The runner-up is Axvoice which has a broader variety of plans including an unlimited international calling plan at $22.99 a month. Be aware of the fine print with all-you-can-eat providers. Some such as Teliax don't really offer unlimited calling even tough they call it that. What they offer is unlimited calling up to some monthly cap of minutes. For example, with Teliax, up to 1500 minutes a month are "free" and then you pay 2¢ per minute thereafter. They're not really free because you've paid a $24.99 monthly fee for the initial 1,500 minutes. Then there's our old favorite BroadVoice which now offers unlimited calling with a little asterisk. After you drill down to the third level in their web pages, you'll see this in the fine print: "* Significant restrictions apply to Unlimited Plans." If you violate their undefined "normal residential usage patterns", you agree in advance to let them retroactively charge you 5¢ per minute for every call you've made since you signed up... plus $300/hour in in-house legal fees for successful collection. I wonder if they pay their staff attorneys that much? Their terms of use give them unfettered discretion in defining what's appropriate and inappropriate use. And, arguably, even having multiple people in your household use your "unlimited plan" violates their terms of service. So, unless you've recently won the lottery or just enjoy litigation, here's our best advice on BroadVoice: JUST SAY NO!

With pay-as-you-go providers, there typically are no simultaneous call limitations because you're paying by the minute per call. Some of these providers charge in whole minute increments while others round calls to as little as six second billing increments. Some leave their rates the same for six months or more. Others change their rates almost daily. You don't want to have to visit a web site each time your phone rings to determine what it will cost to pick up the phone. So be alert in choosing a pay-as-you-go provider. The best of the bunch in our opinion is Voxee.com at about a penny a minute for U.S. calls and only slightly more for calls to many international destinations.

And then there are the free providers. Here's a good rule of thumb. Enjoy it while it lasts. Don't expect free to last forever. And, most importantly, READ THE FINE PRINT. It costs the provider something to offer the service and, if they're giving the service away, there IS a catch. You just have to be smart enough to figure out what it is. The best freebies at the moment are VoipDiscount.com for free outbound calls to numerous countries including the U.S. at least today, FreeDigits.com for free incoming DIDs, free incoming calls, and free incoming fax service, and Stanaphone.com for free incoming DIDs and free incoming calls. See our complete list of VoIP Provider reviews for additional information and setup instructions.

If you just want to experiment with your new system and don't want to cough up much money, here's a good way to get your feet wet. Sign up for a free incoming DID number and free incoming calls with Stanaphone's Stana-IN service and sign up with VoIPDiscount.com for free outbound calls. You'll need a Windows machine to initially sign up for both of these services. See our tutorials for details. You won't have a phone number in your local area code, but folks will be able to call you. If you want a number in your local area code and you live in the U.S., sign up for TelaSIP's basic service at $5.95 a month which gets you a local phone number and free unlimited incoming calls ... one at a time. Outbound calls in the U.S. are 2¢ a minute which gives you a good backup to your free VoIPDiscount outbound calling service. There are no obnoxious terms of service or hidden fees with TelaSIP. Just use the service for residential calling.

Downloading a Free Softphone. Unless you already have an IP phone, the easiest way to get started and make sure everything is working is to install an IP softphone. You can download a softphone for Windows, Mac, or Linux from CounterPath. Or download the pulver.Communicator or the snom 360 Softphone which is a replica of perhaps the best IP phone on the planet. Here's a new IAX softphone for all platforms that's great, too, and it requires no installation: Idefisk. All are free! Just install and then configure with the IP address of your TrixBox server. For username and password, use the extension number and password which we'll set up shortly with freePBX. Once you make a few test calls, don't waste any more time. Buy a decent SIP telephone. We think the best value in the marketplace with excellent build quality and feature set is the $85 GrandStream GXP-2000. It has support for four lines, speaks CallerID numbers, has a lighted display, and can be configured for autoanswer with a great speakerphone. Short of paying over double for the snom 360, that's as good as desktop phones get. If you want to use Asterisk throughout your home, buy a good 5.8GHz wireless phone system with plenty of extensions such as the Uniden 8866 which we use (see ad below) and then purchase an SPA-3000 to connect up both your home phone line and all your cordless phones. Our tutorial will show you how.


Initial Setup of freePBX. You still access freePBX just as you accessed the Asterisk Management Portal (AMP), by pointing a web browser to the internal IP address of your new Asterisk system. Once you get to the main TrixBox screen, choose freePBX. When prompted for your username and password, the username is still maint. Enter the password you assigned to freePBX/AMP when you configured your system. In the old days, AMP came preconfigured with everything they thought you'd need to use it. With the new freePBX architecture, you first have to install and enable the modules you want to use. And now others can write modules to expand the capabilities of freePBX without futzing around in the basic source code. You get to these modules by choosing Tools->Module Admin from the main freePBX menu. Unlike some applications, there's really no reason not to activate all of the available modules since they won't slow down Asterisk. The only performance hit is when you click the Red Bar to reload freePBX. The more modules you've activated, the longer it will take to reload freePBX (which isn't very long) since freePBX queries each module to see if changes need to be applied. So, in the Module Administration screen, click Connect to Online Module Repository to first download all of the available modules. Then select all of the Disabled Modules and Enable them. Click Submit and then the Red Bar to save your updates. From time to time, you need to revisit this page to upgrade the modules as bug fixes are released.

As you can see, there are two types of Modules: Local Modules and Online Modules. Local Modules are the pieces that make freePBX work on your local machine. Online Modules provides access to modules which are available for download over the Internet. And Online Modules tells you which ones are newer than the ones currently on your system. Before too long, we wouldn't be surprised to see an option to email you notices when new modules are released or older ones are updated. This is nothing short of fantastic for the Asterisk community if we do say so.

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

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

For our sample setup today, we'll configure SIP trunks for Stanaphone, TelaSIP, and VoipDiscount. For each provider, click on the Setup->Trunks tab in freePBX. Then click Add SIP Trunk. After you complete the entries for each provider, click Submit Changes and then the Red Bar.

StanaPhone Trunk Setup. Here are the entries for the Stanaphone SIP trunk. For Outbound CallerID, enter the phone number assigned to you by StanaPhone. For Maximum Channels, enter 1. Leave the Dial Rules and Dial Prefix blank for the time being.

For Outgoing Settings, enter a Trunk Name of stanaphone. For Peer Details, enter the following using your assigned username and password. Be very careful to match the upper and lower case settings in your assigned password.

host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername

For Incoming Settings, enter a USER Context of from-pstn. This tells Asterisk to process incoming calls through this context in your dialplan. For USER Details, enter the following using your assigned username and password:

canreinvite=no
dtmfmode=rfc2833
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername

For the Registration String, enter the following using your assigned username, password, and 347 phone number:

yourusername:yourpassword@sip.stanaphone.com/3471234567

Click the Submit Changes button and then click on the Red Bar to save your trunk settings and reload Asterisk. To be sure you have properly registered with Stanaphone, run the Asterisk_Info application which we installed above using your correct IP address: http://192.168.0.108/maint/asterisk_info.php. Under SIP Peers, you should see an entry for sip.stanaphone.com showing a state of Registered. If not, check your username and password entries for typos.

TelaSIP Trunk Setup. Here are the entries for the TelaSIP SIP trunk. For your Outbound Caller ID, fill in the local phone number provided by Telasip. For Maximum Channels, enter 1. For Dial Rules, enter the following:

1|NXXNXXXXXX
NXXNXXXXXX

In the Outgoing Settings section, name your trunk telasip-gw and then enter the following PEER details using your TelaSIP-assigned username and password:

context=from-pstn (if that doesn't work use: from-trunk)
dtmfmode=rfc2833
host=gw3.telasip.com
insecure=very
secret=yourpassword
type=peer
username=yourusername

Leave the Incoming Settings User Context and User Details blank. For your Registration string, enter the following: yourusername:yourpassword@gw3.telasip.com using your actual username and password assigned by TelaSIP. Click Submit Changes and then the red bar to restart Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with TelaSIP.

VoipDiscount Trunk Setup. Here are the entries for the VoipDiscount SIP trunk. Create a SIP trunk for the service with a Trunk Name of voipdiscount. VoipDiscount doesn't support an outbound CallerID number so leave it blank. The Outgoing Dialing Rules in the U.S. should look like this:

001+NXXNXXXXXX
00+1NXXNXXXXXX

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

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

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

yourusername:yourpassword@sip.sipdiscount.com

Click the Submit Changes button and click the Red Bar to update Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with VoipDiscount.

When you have your Trunks set up, you'll need a way to call out (Outbound Routes), to call in (Inbound Routes), and to process incoming calls: a Digital Receptionist, a Call Queue, a Custom Application, DISA, or a phone to ring (Extensions). For today, we'll get the phones to ring. Then we'll tackle the other options in Parts II and III.

Configuring Outbound Routes. Outbound routes are the rules that determine how calls that are dialed from an extension on your system get processed. The idea here is that you set up a list of priorities. Then, based upon the number dialed, the outbound rules figure out how to route the call. We're going to start with a simple Outbound Route called Everything which will process all calls that are not handled by another Outbound Route. Click Setup->Outbound Routes->Add Route and enter the following:

Route Name ... Everything
Route Password ... [leave it blank]
Pin Set ... [leave it blank]
Emergency Dialing ... [leave it blank]
Dial Patterns: (adjust these if you wish to permit international calls!)
1NXXNXXXXXX
NXXNXXXXXX
Trunk Sequence:
0 sip/voipdiscount
1 sip/telasip-gw

Once you've made all the entries, click the Submit Changes button and then the Red Bar to reload Asterisk. You will be able to place calls by dialing either an area code and phone number or 1 plus an area code and phone number. For international callers, our previous articles will walk you through configuring the dial strings to support various countries. Now you should see two Outbound Routes in your route list. We want to delete the other route so just click on it and then choose Delete Route and click the Red Bar to save your changes. Now there should be only the Everything route in your Outbound Routes list. We'll leave it like that for today, but down the road, we'll add options for emergency calls, toll-free calls, in-state calls, and international calls. After we make those additions, the Everything route will be used as our lowest priority catch-all for calls that don't qualify for processing by another route.

Setting Up Extensions. To add a new extension and voicemail account to your system, click Setup->Extensions->Add SIP Extension and enter the following:

Extension Number ... 500
Display Name ... Office
Extension Options
Direct DID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
DID Alert Info ... [leave blank]
Outbound CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Emergency CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
Record Incoming ... On Demand
Record Outgoing ... On Demand
Device Options
secret ... 1234
dtmfmode ... rfc2833
Voicemail & Directory ... Enabled
voicemail password ... 1234
email address ... yourname@yourdomain.com [if you want voicemail messages emailed to you]
pager email address ... yourname@yourdomain.com [if you want to be paged when voicemail messages arrive]
email attachment ... yes [if you want the voicemail message included in the email message]
play CID ... yes [if you want the CallerID played when you retrieve a message]
play envelope ... yes [if you want the date/time of the message played before the message is read to you]
delete Vmail ... yes [if you want the voicemail message deleted after it's emailed to you]
vm options ... callback=from-internal [to enable automatic callbacks by pressing 3,2 after playing a voicemail message]
vm context ... default

Configuring Inbound Routes. Just as we had to tell Asterisk how to process outbound calls, you also have to define what to do with incoming calls from each of your inbound trunks. Be aware that different service providers have implemented SIP and IAX differently. One of the best providers for proper SIP implementation is TelaSIP because you can route incoming calls based upon the DID numbers associated with each trunk. So you could have one incoming trunk from TelaSIP with multiple DID numbers (for each of your children, for example). Each DID then could be routed to a specific extension, and each extension could have its own CallerID number for outbound calls ... even though you might only have one TelaSIP trunk line. So, to outside callers, it would appear that each individual had his or her own phone line even though everyone might be sharing one or two trunks.

For today, we'll get a default inbound route established, and we'll save the gee whiz stuff for later. To create a Default Inbound Route for your calls, choose Setup->Inbound Routes->Add Route. Then enter the following:

DID Number ... [leave blank]
CallerID Number ... [leave blank]
Zaptel Channel ... [leave blank]
Fax Extension ... disabled
Fax Email ... [leave blank]
Fax Detection Type ... none
Pause After Answer ... [leave blank]
Privacy Manager ... no
Alert Info ... [leave blank]
Destination: ... Core: Office 500

Click Submit and then OK when you're warned that this will create a default incoming route for your calls. Down the road as you add additional incoming routes, the new routes will take precedence unless there's no matching DID in which case this default route will be used.

If you want to create a separate incoming route for your Stanaphone calls just to see how it works, click Add Incoming Route and enter the following:

DID Number ... [your 10-digit Stanaphone number]
CallerID Number ... [leave blank]
Zaptel Channel ... [leave blank]
Fax Extension ... freePBX default
Fax Email ... [leave blank]
Fax Detection Type ... NVfax
Pause After Answer ... 2
Privacy Manager ... no
Alert Info ... [leave blank]
Destination: ... Core: voice mailbox 500

The trick to learn here is that if you want an incoming DID to go straight to voicemail, you need a slight pause to let Asterisk get properly set up for the call or the first couple seconds of your voicemail announcement will be cut off. By adding two seconds of fax detection, everything will work swimmingly.

Allowing Anonymous Inbound SIP Calls. One final step, and your incoming calls should start arriving without a "this number is not in service" message. Choose Setup->General Settings and scroll to the bottom of the page. Under Security Settings, change Allow Anonymous Inbound SIP Calls from No to Yes and click Submit Changes and then the Red Bar. Once this change is made, inbound calls from Stanaphone will work reliably.

Activating Email Delivery of VoiceMail Messages. When you're out and someone leaves you a voicemail message, TrixBox and freePBX will let you forward that voicemail message to your email address as a .wav file which can be played within most email client software. Or you can have the system send an instant message to your cell phone or pager telling you who called, what their phone number was, and how long a voicemail message the person left for you. Or you can do both. In addition, you can tell the system whether to delete the voicemail from your Asterisk server after sending it to your email account. In short, you now can manage all of your incoming email and voicemail from a single place, your email client. In order to send out emails from your server, you'll need to make a few changes.

First, make this adjustment to the /etc/hosts file on the server. Since anonymous emails are blocked by most ISPs, you'll need a fully-qualified domain name for your server. If you don't have your own domain, the easiest alternative is to use the fully-qualified domain name that your ISP assigns to the IP address for your broadband connection. Don't forget to update it when your ISP changes your IP address! To find out what your fully-qualified domain name is, go to a command prompt on your Asterisk server and type: nslookup 123.456.789.001 substituting your public IP address for the preceding numbers. Then write down the name entry without the trailing period. Now edit the hosts file: nano /etc/hosts. Move the cursor to the second line which reads 127.0.0.1 asterisk1.local , and then move the cursor over the first letter of the first domain name shown, usually asterisk1.local. Now type in the fully-qualified domain name you previously wrote down and add a space after your entry. Don't erase the existing entry! Save your settings: Ctrl-X, y, enter. Now restart network services on your Asterisk machine: service network restart.

Next, you need to modify the email message which delivers your voicemails so that it includes your fully-qualified domain name. Don't do this in TrixBox, or you'll mess up the formatting of the email message. You can download a fresh copy here if you need it. Instead, use nano: nano -w /etc/asterisk/vm_email.inc. Press Ctrl-W, type AMPWEBADDRESS, and press the enter key. Delete the word AMPWEBADDRESS and then type either the fully-qualified domain name for your Asterisk server or the private IP address if you only want to read your emails from behind your firewall. When you start typing, the text display may jump all over the place because of word wrap. Don't freak out. You haven't messed anything up. Once you complete your entry, don't erase or change anything else. Save the file: Ctrl-X,Y, then enter.

Now edit vm_general.inc: nano -w /etc/asterisk/vm_general.inc. Change the serveremail entry of vm@trixbox to an email name at the same fully qualified domain you used in your /etc/hosts file above. Then save your configuration and restart Asterisk: amportal restart. If you continue with this setup and still don't receive emails, here's another configuration change that is sometimes necessary. You'll also need to do it if you reloaded settings from an older version of Asterisk. On the Asterisk terminal, log in as root. Switch to the directory where the SendMail configuration file is stored: cd /etc/mail. Make a backup of the config file: cp sendmail.cf sendmail.cf.bak. Then issue the following command: echo CGasterisk.dyndns.org >> sendmail.cf. Substitute the actual domain name of your Asterisk server for asterisk.dyndns.org, but be sure it's preceded by CG with no intervening spaces.Then restart SendMail on your server and try again: /etc/rc.d/init.d/sendmail restart. Finally, if your ISP doesn't permit downstream mail servers (that's you), then take a look at this link which will show you how to designate your ISP as your SMTP smart host using SendMail.


Activating the Nerd Vittles Weather Forecasts in TrixBox. TrixBox 1.1 now includes the Flite text-to-speech engine as well as the Nerd Vittles weather forecasting system. To use it, just dial 611 from a phone on your system and enter a 3-character airport code to retrieve the weather forecast. TrixBox comes with support for about 50 airports. You can easily expand it to 1,000 airports by following along in Part II of our Weather Tutorial. It'll take you about 15 minutes. For complete instructions, read the full article here.

Creating Wakeup Calls in TrixBox. To set up a wakeup call from any extension, dial *62 and enter a two-digit hour and two-digit minute for the wakeup call.

Determining the Extension Number of Any Phone on Your TrixBox System. To determine the extension number of any phone on your system, dial *65 from that extension.

Retrieving VoiceMail from Any Phone With TrixBox. To retrieve voicemail for any extension, dial *98 and enter the voicemail extension number. When prompted, enter the password for that account. To retrieve voicemail for the extension from which you are calling, dial *97 and enter the password for the account when prompted. You can also set your voicemail defaults and record your voicemail greetings using these options.

Useful Functions on Your TrixBox 1.1 System. Here's the complete list of functions that will work out of the box from any extension on your TrixBox system:

  • 611 The Latest Weather Forecast
  • *62 Schedule a Wakeup Call
  • *65 Decipher Extension Number of Any Phone
  • *70 Activate Call Waiting
  • *71 Deactivate Call Waiting
  • *72 Enable Call Forwarding (include forwarding number to avoid prompt)
  • *73 Disable Call Forwarding
  • *90 Enable Call Forwarding on Busy (include forwarding number to avoid prompt)
  • *91 Disable Call Forwarding on Busy
  • *78 Enable Do Not Disturb
  • *79 Disable Do Not Disturb
  • *97 Access Voicemail for Calling Extension
  • *98 Access Voicemail with Prompt for Mailbox Number
  • Well, that should get you started. We'll tackle the gee whiz features in TrixBox and freePBX down the road so visit us again soon. In the meantime ...


    Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has raised the bar again on hosting services. For $6.95 a month, you can host up to 6 domains with 30GB of disk storage and 750GB of monthly bandwidth. Free domain registration is included for as long as you have an account. That almost doubles last month's deal, and it really doesn't get any better than that. Their hosting services are flawless! We oughta know. We've tried the best of them. If you haven't tried a web hosting provider, there's never been a better time. Just use our link. You get a terrific hosting service, and we get a little lunch money.


    Nerd Vittles Fan Club Map. Thanks for visiting! We hope you'll take a second and add yourself to our Frappr World Map compliments of Google. In making your entry, you can choose an icon: guy, gal, nerd, or geek. For those that don't know the difference in the last two, here's the best definition we've found: "a nerd is very similar to a geek, but with more RAM and a faster modem." We're always looking for the best BBQ joints on the planet. So, if you know of one, add it to the map while you're visiting as well.


    Some Recent Nerd Vittles Articles of Interest...

    Newbie’s Guide to TrixBox 1.0 and FreePBX 2.1.1, Part I

    NOTE: The system referenced in this article is no longer supported by Nerd Vittles as this version of Asterisk has been phased out. For the latest and greatest, please consider our new PBX in a Flash offering.

    Well, the Nerd Vittles staff move is complete, and today we're back in the saddle. So, hello from Charleston, South Carolina! And now there's a brand-new Asterisk@Home: TrixBox 1.0 with a brand-new Asterisk Management Portal: freePBX 2.1.1. So we've got a lot of new ground to cover. These new Asterisk products are designed to support the casual home or home office user's PBX needs as well as gigantic call centers processing millions of calls a month. Everything is free except the hardware on which to run your new system. That can be a $139 refurbished PC or a multi-processor RAID box with mainframe horsepower. For home use, we've had great luck with older refurb units for under $150 each. And, no, we're not on commission. How much commission could there be on this stuff? [Note: Updated TrixBox 1.2.3 tutorial available here.]

    What freePBX brings to the table is an incredibly simple yet powerful, upgradeable web-based GUI to totally manage your PBX. And TrixBox adds all of the Asterisk bells and whistles you could ever ask for in an integrated PBX: full-featured database management, simple hooks to high-level application development tools such as PHP and Perl, an Apache web server, integrated voicemail and fax-to-email support, contact management, calling card billing, hardware autoconfiguration for Digium and Cisco phone hardware, Microsoft networking support, an integrated text-to-speech system, and loads of free utility software applications for Asterisk compliments of Nerd Vittles. And, yes, TrixBox 1.0 still fits on a single CD! For those new to Nerd Vittles, be aware that we make slipstream changes to articles as users discover things we've missed. Yes, we're human! So check for Comments before you begin or subscribe to our Comments RSS Feed. And, last but not least, be sure to add yourself to the Nerd Vittles Fan Club Map.

    The Game Plan. Because of WordPress article length limitations and our own limited attention span, we're going to divide this Guide into several parts. Today, we'll get your new system running so that you can make your first call. In Part II, we'll cover a number of the bells and whistles that make TrixBox and freePBX such a great combination. Then, in Part III, we'll add some more tips and tricks to help you impress your friends whenever the need arises. And, no we haven't forgotten the other installments in our weather report series. Our updated tutorial for TrixBox 1.1 is now available.

    Hardware Setup. You have two choices for hardware to run this new system. The first is to dedicate a machine to TrixBox and download the TrixBox ISO image to burn a bootable CD. Once you create the TrixBox CD, you simply boot your dedicated PC with the new CD. It will erase and reformat your hard disk for use with Linux and the included Linux and Asterisk applications. If you just want to experiment with TrixBox and don't plan to put the system into production other than for one or two simultaneous calls from home, then you may prefer to download the VMware version of TrixBox or VMwarez's enhanced version. With this approach, you install VMware on your existing Windows XP or Windows 2000 system. Then you run Linux and the TrixBox application in a window on your Windows PC. It does not require a dedicated machine. We've found the performance to be virtually identical to running TrixBox on a dedicated PC provided your Windows machine has at least 512MB to 1GB of RAM. See our previous article for step-by-step instructions on the VMware installation process.

    For now, however, we're assuming you've opted for the dedicated machine install: pure Linux on a clean machine. So begin by downloading the TrixBox ISO image from here and burn a CD (click here if you need a refresher course). Using your dedicated PC, insert the CD you made, plug your machine into the Internet, and turn it on. Then watch while TrixBox loads CentOS/4.3 and all the Asterisk and Linux goodies imaginable: Apache, SendMail, Asterisk Mail, SugarCRM, MySQL, PHP, phpMyAdmin, SSH, Bluetooth, freePBX, the Flash Operator Panel, Call Detail Reporting, and on and on. We've covered how to use most of the Linux products in our Mac HOW-TO's (see sidebar), and they work exactly the same way with TrixBox so keep reading. And, yes, this install will reformat (aka ERASE) your hard disk before it begins, but it now warns you first. When you're prompted to create your root user password, type in something you can remember ... or write it down!

    Upgrading TrixBox from a Prior Version of Asterisk@Home. In a nutshell, YOU CAN'T. But there is a way to put most of Humpty back together again once you've installed the new system. Before you begin, understand that you are doing this AT YOUR OWN RISK. NO GUARANTEES. If that bothers you, don't do it! The real trick is to do a little printing and copying of your old data before you insert that TrixBox installation disk. Step 1 is to make a full backup of your old system to a different server before you begin. If you don't know how, read our step-by-step instructions on the subject here. Step 2 is to make another copy of some of the critical files in your system. Duplicates of all of these will also be part of your backup. We typically build directories on a separate server which match the ones we'll be copying over from the old Asterisk system. Here are the directories (including all the subdirectories therein) that we always duplicate. Before you just blindly copy our list, stop and think whether there are special things you do on your existing Asterisk system or special apps that you run. Then find those files and make copies of all of them, too. The important piece in making a successful copy of some of these files is to shut down Asterisk (amportal stop) and MySQL (/etc/init.d/mysqld stop) before you begin. NOTE to CRM users: There's a new version of CRM in TrixBox so it's unlikely that you can restore the databases. Check your current version of AAH (help-aah) and see if there is an option (bundle-crm) to pack up CRM to move it to another machine. If so, do it and follow the instructions. We don't use Sugar so we haven't tested this upgrade option. Here are the directories you'll want to back up:

    /var/lib/asterisk/agi-bin
    /var/www/html
    /var/lib/asterisk/sounds/custom
    /var/lib/mysql
    /root
    /etc/asterisk

    Then there are a couple of individual files that you'll also want to preserve:

    /etc/hosts
    /etc/crontab

    The third step is to take screenshots of every screen you've built using the Asterisk Management Portal (AMP) or a prior version of freePBX. Start in the Setup tab and go right down the list of features. For each option in which you have multiple entries (e.g. Extensions and Trunks), call up each entry and print out the full page. Be especially careful in printing the Trunks entries and make sure you write down every line in the PEER Details and USER Details because those which are out of view will not get printed using a screen print. You'll need to manually fill in the ones that aren't displayed. The same goes for Registration Strings which often scroll out of view on the screen. Finally, using CLI (asterisk -r), make a copy of all your Asterisk database entries: database show. Now save all this information in a safe place until we finish the new install.

    Loading CentOS/4 and TrixBox 1.0. Here's how the install went for us, and we'll walk you through getting everything set up so that it can be used as a production server. There is a wrinkle in the installation process because of a Linux kernel upgrade which triggers a bug in Asterisk which triggers a missing component in TrixBox, but we'll get all that fixed up in short order. Once the install begins, you can expect to eat up about 25 minutes with the CentOS 4.3 install. Just be sure to create your new root user password before you walk away, or it will still be sitting there waiting when you return. Once Linux is installed, the TrixBox CD will eject itself, reboot the system, and begin the Asterisk compile and installation. That takes about 25 more minutes to complete.

    Securing Your Passwords. When it's finished and reboots, log in as root with the password you assigned. Type help-trixbox for a listing of the other four passwords that need to be changed. Change them all NOW!

    passwd admin
    passwd-maint
    passwd-amp
    passwd-meetme

    Getting the Latest CentOS Updates. Once your system is secure, load all of the application updates for CentOS 4.3. There now are lots of updates plus a new kernel install so be patient. If you have zaptel cards, read this thread. The command to issue to begin the update process is yum -y update.

    Rebuilding Zaptel. Every time there is a kernel update with yum (which is the case here), ZAP device support needs to be rebuilt using the new kernel. Unfortunately, a RedHat bug caused the rebuilding process to fail. Here's the fix. Log into your new server as root and issue the following commands to determine which new kernel was loaded on your system:

    cd /usr/src/kernels
    ls

    You should see the original kernel 2.6.9-34.EL-something and the new one: 2.6.9-34.0.1.EL-something. Depending upon the processor in your system, the something may be different than our machine. Write down the name of the new kernel directory and substitute it below for 2.6.9-34.0.1.EL-i686. Now issue these commands:

    cd /usr/src/kernels/2.6.9-34.0.1.EL-i686/include/linux
    mv spinlock.h spinlock.h.old
    wget http://nerdvittles.com/trixbox/spinlock.h
    shutdown -r now

    In a perfect world, once the reboot completes, you should have been ready to rebuild ZAP device support. But Andrew inadvertently left out the source code. So here's what you need to do next. Log into your new system as root again and issue the following commands:

    cd /usr/src
    wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.5.tar.gz
    tar -zxvf zaptel-1.2.5.tar.gz
    mv zaptel-1.2.5 zaptel
    cd /usr/src/zaptel
    make clean
    make install
    shutdown -r now

    Now we can rebuild support for your ZAP devices or ztdummy if you have no ZAP devices. Log in as root again and type the following command: rebuild_zaptel. Then reboot your system: shutdown -r now. Now log in as root again and type amportal stop and then genzaptelconf. Now, here's one final housekeeping chore. Log in as root again and issue these commands:

    touch /etc/fxotune.conf
    /usr/sbin/fxotune -s
    shutdown -r now

    Upgrading to Asterisk 1.2.9.1. Because of a serious security vulnerability in Asterisk, we are modifying this article on June 17 to show how to load the Asterisk upgrade for those that followed this initial tutorial. Log into your server as root and issue the following commands in order:

    rpm -del zaptel-modules-2.6.9-34.EL
    rpm -del zaptel-modules-2.6.9-35.EL
    trixbox-update.sh
    trixbox-update.sh update
    reboot
    rebuild_zaptel
    modprobe wcfxo [if you have zaptel hardware]
    genzaptelconf
    reboot

    Now you should be good to go on the software front. Whew!

    Activating Bluetooth Support. Once the updates are completed, activate Bluetooth support if you plan to use it with our Follow-Me Phoning proximity detection application. Run setup, down arrow to System Services, press ENTER, down arrow to bluetooth and press the space bar, tab to OK, press ENTER, tab twice to Quit and press ENTER.

    Activating Apache HTTPS Support. If you want secure Internet web access to your server, log into your system as root and issue these commands. Once https support is installed, you can access freePBX securely: https://AsteriskServerIPaddress.

    yum -y install mod_ssl
    shutdown -r now

    Restoring Asterisk Info Application. One of the nice applications that previously was bundled in Asterisk@Home was Asterisk Info. It gave a detailed summary of many critical components in Asterisk including a listing of active SIP and IAX peers and registry entries. This is especially helpful when you're setting up new providers and want to see whether you're getting connected successfully. To restore the application, log into your server as root and issue these commands:

    cd /var/www/html/maint
    wget http://nerdvittles.com/trixbox/asterisk_info.zip
    unzip asterisk_info.zip
    rm -f asterisk_info.zip

    Now you can run the application using a web browser pointed to the correct IP address of your server: http://192.168.0.108/maint/asterisk_info.php

    Simplifying SSH Access. If you're going to be connecting to other servers from your new TrixBox system using SSH or SCP, then build your new RSA key pair now. This lets you use SSH and SCP (secure copy) without having to enter a password each time. You can also automate backups and proximity detection scripts as we've explained previously here. Log in to your new TrixBox server as root. From the command prompt, issue the following command: ssh-keygen -t rsa. Press the enter key three times. You should see something similar to the following. The file name and location in bold below is the information we need:

    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    1d:3c:14:23:d8:7b:57:d2:cd:18:70:80:0f:9b:b5:92 root@asterisk1.local

    Now copy the file in bold above to your other Asterisk servers, Linux machines, and Macs. There's probably a way on PCs as well, but we've all but given up on that platform where security matters so you're on your own there. From your TrixBox server using SCP, the command should look like the following (except use the private IP address of each of your other Asterisk or Linux servers instead of 192.168.0.104). Provide the root password to your other servers (one at a time) when prompted to do so.

    scp /root/.ssh/id_rsa.pub root@192.168.0.104:/root/.ssh/authorized_keys

    On a Mac running Mac OS X, the command would look like this (using your username and your Mac's IP address, of course):

    For user access only: scp /root/.ssh/id_rsa.pub wardmundy@192.168.0.104:/Users/wardmundy/.ssh/authorized_keys
    For full root access: scp /root/.ssh/id_rsa.pub root@192.168.0.104:/var/root/.ssh/authorized_keys

    Once the file has been copied to each server, try to log in to your other server from your new TrixBox server with the following command using the correct destination IP address, of course:

    ssh root@192.168.0.104

    You should be admitted without entering a password. If not, repeat the drill or read the complete article and find where you made a mistake. Now log out of the other server by typing exit.

    Installing WebMin. We don't build Linux systems without installing WebMin, the Swiss Army knife of the Linux World. You can use it to start and stop services, check logs, adjust startup scripts, manage cron jobs, babysit your SendMail server, and many, many other tasks that are downright painful without it. If you ever need help from others, WebMin is a great tool for letting others help you.

    There are lots of ways to install WebMin. WebMin now is part of the TrixBox yum repository so, after logging in as root, just issue the following command: yum -y install webmin.

    WebMin runs its own web server on port 10000. To start WebMin, issue this command: /etc/webmin/start. You access it with a web browser pointed to the IP address of your Asterisk box (i.e. replace 192.168.0.108) at the correct port address, e.g. http://192.168.0.108:10000. Note, https support won't work on port 10000 without a bit of additional tweaking! The login name is root. Then type in your root password and press enter. The main WebMin screen will display. We really don't want the WebMin server starting up each time the OS reboots so do the following. Once you're logged in to WebMin, choose System->Bootup and Shutdown and then click on webmin. Click the No button beside Start at boot time, and then click the Save button. To stop WebMin when you're finished using it, issue this command: /etc/webmin/stop. You can restart it any time you need it, and then use a web browser to access it. But there's no need to waste processing resources. For complete WebMin documentation, click here.

    If you're going to be accessing WebMin from outside your firewall, you really don't want to be logging in as root over an unencrypted connection so let's enable https support for WebMin. While still logged into WebMin, click WebMin->WebMin Config->SSL Encryption. Now click Install Net::SSLeay Perl Module. Once the module is downloaded, click the Continue With Install button. The make and make install process will take a minute or two. Once you get the completed sucessfully message, click Return to WebMin. Choose WebMin->WebMin Config->SSL Encryption again. At the bottom of the form, click the Create Now button to create your SSL key. Click Return to WebMin again. Then choose WebMin->WebMin Config->SSL Encryption once more. Change the Enable SSL if available option to Yes, leave the other defaults, and save your changes. Henceforth, you can log into your server using HTTPS: https://TrixBoxIPaddress:10000/.

    IP Configuration for Asterisk. We need a consistent IP address or domain name both on your internal network and externally if you expect to receive incoming calls reliably. There are three pieces to the IP configuration: (1) setting the internal IP address of your Asterisk server, (2) configuring a fully-qualified (external) domain name for your new server which will always point to your router/firewall, and (3) configuring your router to transfer incoming Asterisk packets to your Asterisk server. Here's how.

    First, log into your server as root using your new password. Now type ifconfig eth0 (that's "e-t-h-zero") then enter, and write down both your inet addr and your HWaddr on the Ethernet 0 interface, eth0. Inet addr is the internal IP address of your Asterisk box assigned by your DHCP server (i.e. your router/firewall). HWAddr is the MAC address of your Asterisk server's eth0 network card. To assure a consistent internal IP address, you can either configure your router/DHCP server to make certain that it always hands out this same address to your Asterisk machine, or you can manually configure an IP address for this machine which is not in the range of addresses used by your DHCP server. Almost all routers now make it easy to preassign DHCP addresses so we prefer option 1. It's generally under the tab for LAN IP Setup or DHCP Configuration and is generally called something like Reserved IP table. Just add an entry and call it Asterisk PBX and specify the IP address and MAC address that you wrote down above. Now each time you reboot your Asterisk server, your router will assign it this same IP addreess.

    To assure a consistent external address is a little trickier. Unless you have a static (fixed) IP address, you'll want to use a Dynamic DNS service such as dyndns.org and configure your router to always advertise its external IP address to dyndns.org. DynDNS.org will take care of revising the IP address associated with your domain name when your ISP changes your dynamic IP address. Then you can configure your VoIP provider account using your fully-qualified dyndns.org domain name, e.g. windswept.dyndns.org provides access to our beach house network even though Time Warner cable hands out dynamic IP addresses which change from time to time.

    Now you'll need to log into your router and redirect certain incoming UDP packets to the internal IP address of your Asterisk machine. If you want external access to the Apache web server on your Asterisk machine, then map TCP port 80 to the internal IP address of your Asterisk system. For WebMin external access, map TCP port 10000 to your Asterisk system. If you want remote access to your Asterisk system via SSH, then map TCP port 22 to the internal IP address of your Asterisk system. If you want external IP phones or other Asterisk servers to be able to communicate with your Asterisk system, then map the following UDP port ranges to the internal IP address of your Asterisk system:

    SIP 5004-5082
    RTP 10001-20000
    IAX 4569

    For more details, read our full article on the subject.

    Finally, you'll need to tell Asterisk about some of this. Edit the sip.conf file (nano -w /etc/asterisk/sip.conf) and add the following entries in the [general] section of the file using your fully-qualified domain name for your server and the private IP address range used behind your router/firewall (typically 192.168.0.0 or 192.168.1.0 with most home routers):

    externhost = yourdomainname.dyndns.org
    localnet=192.168.0.0/255.255.255.0
    nat=yes

    Designing Your PBX System. For those new to the Asterisk world, we'll be using a web-based GUI to configure Asterisk to meet your needs. Step 1 is to get away from your computer and sit down with a piece of paper. Now lay out how you'd like your new system to operate. How many phones will you have? Will they be software-based phones or good old phones you can put on a desktop? Will they be POTS phones (plain old touchtone phones), cordless POTS phones, SIP phones, IAX phones, or cordless SIP phones? How will you make and receive calls? Are you going to use an existing Ma Bell phone line or VoIP trunk lines from one or more VoIP providers? What should happen when incoming calls arrive? Do you want the caller to get an AutoAttendant message ("Hi. You've reached the Mundy's. Press 1 for Mary, 2 for Ward, or 3 to leave a message.") or do you just want all of your phones to start ringing? What should happen when no one answers or the line is busy? Do you want the calls transferred to a cell phone, another POTS phone, or just sent to voicemail? Which voicemail account? Should all busy phones send callers to the same voicemail account, or do you want one for each phone? What should happen once voicemail arrives? Do you want the phone to ring once a minute? Do you want the message waiting indicator to illuminate? Do you want the voicemail message to be emailed to you? Do you also want it preserved so that you can retrieve it from a touchtone phone? Do you want to be paged with the number of the person that called you?

    ATTN: "Type A" Males. With apologies to our female readers, let me chat privately for a moment with the guys. If you have a wife (and want to keep her) or if you have teenage daughters (and want to avoid being killed in your sleep), you'd better get most of this PBX design right if you plan to use Asterisk to replace your existing home phone system. Otherwise, the day after you install your new system, a typical discussion with your spouse will begin with something like this: "What was wrong with our old phones that just rang when someone called and I could actually hear what they were saying when I answered?" With that caveat in mind, let's jump right in to freePBX.

    Today's Objective. Keeping in mind that there are a million ways to configure and customize a PBX, we're going to walk you through a very simple setup today. Our objective is to get Asterisk and freePBX configured so that you can make a call and receive a call. In our next article, we'll start adding all the bells and whistles. But, for today, we'll show you how to set up an incoming and an outgoing VoIP trunk so you can make and receive free calls (at least in the U.S.) using a free softphone. When no one answers, the call will be sent to voicemail. And, when a voicemail message is left, the message will be emailed to you. We'll leave integration of existing POTS phones and phone lines for another day.

    Choosing VoIP Providers. As you will quickly learn, choosing VoIP providers is an art, not a science. And it can be a slippery slope. A provider that is great one day can turn into an absolute nightmare the next. Take BroadVoice, for example. They used to be one of our favorites. Then the CEO left, and the company's business practices, uh, changed to put it charitably. You can read all about it on this forum or at the Better Business Bureau's site. All it takes is a change in leadership or direction at the company headquarters to go from first to worst overnight. So the best advice we can offer about choosing providers is this. Stay Flexible! Don't put all your eggs in one basket. And don't be in a hurry to disconnect your Ma Bell line and transfer your number until you are pretty confident about your provider. Six months is an absolute minimum, and a year is probably better. VoIP providers come and go at about the same pace as fast food restaurants in a new community.

    Having said all of that, we have some providers we really like and some that we don't. YMMV! The basic idea in switching to Voice Over IP technology was to save money... not just for the provider, but for you, too. So PRICE MATTERS. There are typically three types of VoIP service: all-you-can-eat at a fixed monthly price, pay-as-you-go at a per minute (or part of a minute) rate, and free. Some providers only offer outbound service, and others offer incoming and outgoing calls. To receive calls, you've got to have an account with a provider that will give you a phone number unless you want to only get calls from other users of that provider's service, e.g. Skype. You don't have to use the same provider for inbound and outbound calls, and you are better off with backup providers for BOTH inbound and outbound calls.

    If you select an all-you-can-eat plan, you basically get the right to make (or receive) ONE phone call at a time to a certain geographic area. This may be a state, an area code, or a country depending upon where you live and which provider you choose. The best of these in the U.S. is TelaSIP at $14.95 a month for unlimited U.S. calling. The runner-up is Axvoice which has a broader variety of plans including an unlimited international calling plan at $22.99 a month. Be aware of the fine print with all-you-can-eat providers. Some such as Teliax don't really offer unlimited calling even tough they call it that. What they offer is unlimited calling up to some monthly cap of minutes. For example, with Teliax, up to 1500 minutes a month are "free" and then you pay 2¢ per minute thereafter. They're not really free because you've paid a $24.99 monthly fee for the initial 1,500 minutes. Then there's our old favorite BroadVoice which now offers unlimited calling with a little asterisk. After you drill down to the third level in their web pages, you'll see this in the fine print: "* Significant restrictions apply to Unlimited Plans." If you violate their undefined "normal residential usage patterns", you agree in advance to let them retroactively charge you 5¢ per minute for every call you've made since you signed up... plus $300/hour in in-house legal fees for successful collection. I wonder if they pay their staff attorneys that much? Their terms of use give them unfettered discretion in defining what's appropriate and inappropriate use. And, arguably, even having multiple people in your household use your "unlimited plan" violates their terms of service. So, unless you've recently won the lottery or just enjoy litigation, here's our best advice on BroadVoice: JUST SAY NO!

    With pay-as-you-go providers, there typically are no simultaneous call limitations because you're paying by the minute per call. Some of these providers charge in whole minute increments while others round calls to as little as six second billing increments. Some leave their rates the same for six months or more. Others change their rates almost daily. You don't want to have to visit a web site each time your phone rings to determine what it will cost to pick up the phone. So be alert in choosing a pay-as-you-go provider. The best of the bunch in our opinion is Voxee.com at about a penny a minute for U.S. calls and only slightly more for calls to many international destinations.

    And then there are the free providers. Here's a good rule of thumb. Enjoy it while it lasts. Don't expect free to last forever. And, most importantly, READ THE FINE PRINT. It costs the provider something to offer the service and, if they're giving the service away, there IS a catch. You just have to be smart enough to figure out what it is. The best freebies at the moment are VoipDiscount.com for free outbound calls to numerous countries including the U.S. at least today, FreeDigits.com for free incoming DIDs, free incoming calls, and free incoming fax service, and Stanaphone.com for free incoming DIDs and free incoming calls. See our complete list of VoIP Provider reviews for additional information and setup instructions.

    If you just want to experiment with your new system and don't want to cough up much money, here's a good way to get your feet wet. Sign up for a free incoming DID number and free incoming calls with Stanaphone's Stana-IN service and sign up with VoIPDiscount.com for free outbound calls. You'll need a Windows machine to initially sign up for both of these services. See our tutorials for details. You won't have a phone number in your local area code, but folks will be able to call you. If you want a number in your local area code and you live in the U.S., sign up for TelaSIP's basic service at $5.95 a month which gets you a local phone number and free unlimited incoming calls ... one at a time. Outbound calls in the U.S. are 2¢ a minute which gives you a good backup to your free VoIPDiscount outbound calling service. There are no obnoxious terms of service or hidden fees with TelaSIP. Just use the service for residential calling.

    Downloading a Free Softphone. Unless you already have an IP phone, the easiest way to get started and make sure everything is working is to install an IP softphone. You can download a softphone for Windows, Mac, or Linux from CounterPath. Or download the pulver.Communicator or the snom 360 Softphone which is a replica of perhaps the best IP phone on the planet. Here's a new IAX softphone for all platforms that's great, too, and it requires no installation: Idefisk. All are free! Just install and then configure with the IP address of your TrixBox server. For username and password, use the extension number and password which we'll set up shortly with freePBX. Once you make a few test calls, don't waste any more time. Buy a decent SIP telephone. We think the best value in the marketplace with excellent build quality and feature set is the $85 GrandStream GXP-2000. It has support for four lines, speaks CallerID numbers, has a lighted display, and can be configured for autoanswer with a great speakerphone. Short of paying over double for the snom 360, that's as good as desktop phones get. If you want to use Asterisk throughout your home, buy a good 5.8GHz wireless phone system with plenty of extensions such as the Uniden 8866 which we use (see ad below) and then purchase an SPA-3000 to connect up both your home phone line and all your cordless phones. Our tutorial will show you how.


    Initial Setup of freePBX. You still access freePBX just as you accessed the Asterisk Management Portal (AMP), by pointing a web browser to the internal IP address of your new Asterisk system. The username is still maint. Just enter the password you assigned to freePBX/AMP when you configured your system. In the old days, AMP came preconfigured with everything they thought you'd need to use it. With the new freePBX architecture, you first have to install and enable the modules you want to use. And now others can write modules to expand the capabilities of freePBX without futzing around in the basic source code. You get to these modules by clicking the freePBX option from the TrixBox main menu. Then choose Tools->Module Admin from the main freePBX menu. Unlike some applications, there's really no reason not to activate all of the available modules since they won't slow down Asterisk. The only performance hit is when you click the Red Bar to reload freePBX. The more modules you've activated, the longer it will take to reload freePBX since it queries each module to see if changes need to be applied. So, in the Module Administration screen, click Connect to Online Module Repository to first download all of the available modules. Then select all of the Disabled Modules and Enable them. Click Submit and then the Red Bar to save your updates. From time to time, you need to revisit this page to upgrade the modules as bug fixes are released.

    As you can see, there are two types of Modules: Local Modules and Online Modules. Local Modules are the pieces that make freePBX work on your local machine. Online Modules provides access to modules which are available for download over the Internet. And Online Modules tells you which ones are newer than the ones currently on your system. Before too long, we wouldn't be surprised to see an option to email you notices when new modules are released or older ones are updated. This is nothing short of fantastic for the Asterisk community if we do say so.

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

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

    For our sample setup today, we'll configure SIP trunks for Stanaphone, TelaSIP, and VoipDiscount. For each provider, click on the Setup->Trunks tab in freePBX. Then click Add SIP Trunk. After you complete the entries for each provider, click Submit Changes and then the Red Bar.

    StanaPhone Trunk Setup. Here are the entries for the Stanaphone SIP trunk. For Outbound CallerID, enter the phone number assigned to you by StanaPhone. For Maximum Channels, enter 1. Leave the Dial Rules and Dial Prefix blank for the time being.

    For Outgoing Settings, enter a Trunk Name of stanaphone. For Peer Details, enter the following using your assigned username and password. Be very careful to match the upper and lower case settings in your assigned password.

    host=sip.stanaphone.com
    insecure=very
    nat=yes
    secret=yourpassword
    type=peer
    username=yourusername

    For Incoming Settings, enter a USER Context of from-pstn. This tells Asterisk to process incoming calls through this context in your dialplan. For USER Details, enter the following using your assigned username and password:

    canreinvite=no
    dtmfmode=rfc2833
    host=sip.stanaphone.com
    insecure=very
    nat=yes
    secret=yourpassword
    type=peer
    username=yourusername

    For the Registration String, enter the following using your assigned username, password, and 347 phone number:

    yourusername:yourpassword@sip.stanaphone.com/3471234567

    Click the Submit Changes button and then click on the Red Bar to save your trunk settings and reload Asterisk. To be sure you have properly registered with Stanaphone, run the Asterisk_Info application which we installed above using your correct IP address: http://192.168.0.108/maint/asterisk_info.php. Under SIP Peers, you should see an entry for sip.stanaphone.com showing a state of Registered. If not, check your username and password entries for typos.

    TelaSIP Trunk Setup. Here are the entries for the TelaSIP SIP trunk. For your Outbound Caller ID, fill in the local phone number provided by Telasip. For Maximum Channels, enter 1. For Dial Rules, enter the following:

    1|NXXNXXXXXX
    NXXNXXXXXX

    In the Outgoing Settings section, name your trunk telasip-gw and then enter the following PEER details using your TelaSIP-assigned username and password:

    context=from-pstn (if that doesn't work use: from-trunk)
    dtmfmode=rfc2833
    host=gw3.telasip.com
    insecure=very
    secret=yourpassword
    type=peer
    username=yourusername

    Leave the Incoming Settings User Context and User Details blank. For your Registration string, enter the following: yourusername:yourpassword@gw3.telasip.com using your actual username and password assigned by TelaSIP. Click Submit Changes and then the red bar to restart Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with TelaSIP.

    VoipDiscount Trunk Setup. Here are the entries for the VoipDiscount SIP trunk. Create a SIP trunk for the service with a Trunk Name of voipdiscount. VoipDiscount doesn't support an outbound CallerID number so leave it blank. The Outgoing Dialing Rules in the U.S. should look like this:

    001+NXXNXXXXXX
    00+1NXXNXXXXXX

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

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

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

    yourusername:yourpassword@sip.sipdiscount.com

    Click the Submit Changes button and click the Red Bar to update Asterisk. Use Asterisk_Info as we did with Stanaphone to be sure you are registering successfully with VoipDiscount.

    When you have your Trunks set up, you'll need a way to call out (Outbound Routes), to call in (Inbound Routes), and to process incoming calls: a Digital Receptionist, a Call Queue, a Custom Application, DISA, or a phone to ring (Extensions). For today, we'll get the phones to ring. Then we'll tackle the other options in Parts II and III.

    Configuring Outbound Routes. Outbound routes are the rules that determine how calls that are dialed from an extension on your system get processed. The idea here is that you set up a list of priorities. Then, based upon the number dialed, the outbound rules figure out how to route the call. We're going to start with a simple Outbound Route called Everything which will process all calls that are not handled by another Outbound Route. Click Setup->Outbound Routes->Add Route and enter the following:

    Route Name ... Everything
    Route Password ... [leave it blank]
    Pin Set ... [leave it blank]
    Emergency Dialing ... [leave it blank]
    Dial Patterns: (adjust these if you wish to permit international calls!)
    1NXXNXXXXXX
    NXXNXXXXXX
    Trunk Sequence:
    0 sip/voipdiscount
    1 sip/telasip-gw

    Once you've made all the entries, click the Submit Changes button and then the Red Bar to reload Asterisk. You will be able to place calls by dialing either an area code and phone number or 1 plus an area code and phone number. For international callers, our previous articles will walk you through configuring the dial strings to support various countries. Now you should see two Outbound Routes in your route list. We want to delete the other route so just click on it and then choose Delete Route and click the Red Bar to save your changes. Now there should be only the Everything route in your Outbound Routes list. We'll leave it like that for today, but down the road, we'll add options for emergency calls, toll-free calls, in-state calls, and international calls. After we make those additions, the Everything route will be used as our lowest priority catch-all for calls that don't qualify for processing by another route.

    Setting Up Extensions. To add a new extension and voicemail account to your system, click Setup->Extensions->Add SIP Extension and enter the following:

    Extension Number ... 500
    Display Name ... Office
    Extension Options
    Direct DID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
    DID Alert Info ... [leave blank]
    Outbound CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
    Emergency CID ... [your 10-digit TelaSIP phone number if you have one; otherwise, leave blank]
    Record Incoming ... On Demand
    Record Outgoing ... On Demand
    Device Options
    secret ... 1234
    dtmfmode ... rfc2833
    Voicemail & Directory ... Enabled
    voicemail password ... 1234
    email address ... yourname@yourdomain.com [if you want voicemail messages emailed to you]
    pager email address ... yourname@yourdomain.com [if you want to be paged when voicemail messages arrive]
    email attachment ... yes [if you want the voicemail message included in the email message]
    play CID ... yes [if you want the CallerID played when you retrieve a message]
    play envelope ... yes [if you want the date/time of the message played before the message is read to you]
    delete Vmail ... yes [if you want the voicemail message deleted after it's emailed to you]
    vm options ... callback=from-internal [to enable automatic callbacks by pressing 3,2 after playing a voicemail message]
    vm context ... default

    Configuring Inbound Routes. Just as we had to tell Asterisk how to process outbound calls, you also have to define what to do with incoming calls from each of your inbound trunks. Be aware that different service providers have implemented SIP and IAX differently. One of the best providers for proper SIP implementation is TelaSIP because you can route incoming calls based upon the DID numbers associated with each trunk. So you could have one incoming trunk from TelaSIP with multiple DID numbers (for each of your children, for example). Each DID then could be routed to a specific extension, and each extension could have its own CallerID number for outbound calls ... even though you might only have one TelaSIP trunk line. So, to outside callers, it would appear that each individual had his or her own phone line even though everyone might be sharing one or two trunks.

    For today, we'll get a default inbound route established, and we'll save the gee whiz stuff for the next chapter. To create a Default Inbound Route for your calls, choose Setup->Inbound Routes->Add Route. Then enter the following:

    DID Number ... [leave blank]
    CallerID Number ... [leave blank]
    Zaptel Channel ... [leave blank]
    Fax Extension ... disabled
    Fax Email ... [leave blank]
    Fax Detection Type ... none
    Pause After Answer ... [leave blank]
    Privacy Manager ... no
    Alert Info ... [leave blank]
    Destination: ... Core: Office 500

    Click Submit and then OK when you're warned that this will create a default incoming route for your calls. Down the road as you add additional incoming routes, the new routes will take precedence unless there's no matching DID in which case this default route will be used.

    If you want to create a separate incoming route for your Stanaphone calls just to see how it works, click Add Incoming Route and enter the following:

    DID Number ... [your 10-digit Stanaphone number]
    CallerID Number ... [leave blank]
    Zaptel Channel ... [leave blank]
    Fax Extension ... freePBX default
    Fax Email ... [leave blank]
    Fax Detection Type ... NVfax
    Pause After Answer ... 2
    Privacy Manager ... no
    Alert Info ... [leave blank]
    Destination: ... Core: voice mailbox 500

    The trick to learn here is that if you want an incoming DID to go straight to voicemail, you need a slight pause to let Asterisk get properly set up for the call or the first couple seconds of your voicemail announcement will be cut off. By adding two seconds of fax detection, everything will work swimmingly.

    Allowing Anonymous Inbound SIP Calls. One final step, and your incoming calls should start arriving without a "this number is not in service" message. Choose Setup->General Settings and scroll to the bottom of the page. Under Security Settings, change Allow Anonymous Inbound SIP Calls from No to Yes and click Submit Changes and then the Red Bar. Once this change is made, inbound calls from Stanaphone will work reliably.

    Activating Email Delivery of VoiceMail Messages. When you're out and someone leaves you a voicemail message, TrixBox and freePBX will let you forward that voicemail message to your email address as a .wav file which can be played within most email client software. Or you can have the system send an instant message to your cell phone or pager telling you who called, what their phone number was, and how long a voicemail message the person left for you. Or you can do both. In addition, you can tell the system whether to delete the voicemail from your Asterisk server after sending it to your email account. In short, you now can manage all of your incoming email and voicemail from a single place, your email client. In order to send out emails from your server, you'll need to make a few changes.

    First, make this adjustment to the /etc/hosts file on the server. Since anonymous emails are blocked by most ISPs, you'll need a fully-qualified domain name for your server. If you don't have your own domain, the easiest alternative is to use the fully-qualified domain name that your ISP assigns to the IP address for your broadband connection. Don't forget to update it when your ISP changes your IP address! To find out what your fully-qualified domain name is, go to a command prompt on your Asterisk server and type: nslookup 123.456.789.001 substituting your public IP address for the preceding numbers. Then write down the name entry without the trailing period. Now edit the hosts file: nano /etc/hosts. Move the cursor to the second line which reads 127.0.0.1 asterisk1.local , and then move the cursor over the first letter of the first domain name shown, usually asterisk1.local. Now type in the fully-qualified domain name you previously wrote down and add a space after your entry. Don't erase the existing entry! Save your settings: Ctrl-X, y, enter. Now restart network services on your Asterisk machine: service network restart.

    Next, you need to modify the email message which delivers your voicemails so that it includes your fully-qualified domain name. Don't do this in TrixBox, or you'll mess up the formatting of the email message. You can download a fresh copy here if you need it. Instead, use nano: nano -w /etc/asterisk/vm_email.inc. Press Ctrl-W, type AMPWEBADDRESS, and press the enter key. Delete the word AMPWEBADDRESS and then type either the fully-qualified domain name for your Asterisk server or the private IP address if you only want to read your emails from behind your firewall. When you start typing, the text display may jump all over the place because of word wrap. Don't freak out. You haven't messed anything up. Once you complete your entry, don't erase or change anything else. Save the file: Ctrl-X,Y, then enter.

    Now edit vm_general.inc: nano -w /etc/asterisk/vm_general.inc. Change the serveremail entry of vm@trixbox to an email name at the same fully qualified domain you used in your /etc/hosts file above. Then save your configuration and restart Asterisk: amportal restart. If you continue with this setup and still don't receive emails, here's another configuration change that is sometimes necessary. You'll also need to do it if you reloaded settings from an older version of Asterisk. On the Asterisk terminal, log in as root. Switch to the directory where the SendMail configuration file is stored: cd /etc/mail. Make a backup of the config file: cp sendmail.cf sendmail.cf.bak. Then issue the following command: echo CGasterisk.dyndns.org >> sendmail.cf. Substitute the actual domain name of your Asterisk server for asterisk.dyndns.org, but be sure it's preceded by CG with no intervening spaces.Then restart SendMail on your server and try again: /etc/rc.d/init.d/sendmail restart. Finally, if your ISP doesn't permit downstream mail servers (that's you), then take a look at this link which will show you how to designate your ISP as your SMTP smart host using SendMail.


    Activating the Nerd Vittles Weather Forecasts in TrixBox. TrixBox now includes the Flite text-to-speech engine as well as the Nerd Vittles weather forecasting system. To use it, just dial 611 from a phone on your system and enter a 3-character airport code to retrieve the weather forecast. We now support about 50 airports. In our next installment, that will be expanded to 1,000 so stay tuned. For complete instructions, read our original article.

    Creating Wakeup Calls in TrixBox. To set up a wakeup call from any extension, dial *62 and enter a two-digit hour and two-digit minute for the wakeup call.

    Determining the Extension Number of Any Phone on Your TrixBox System. To determine the extension number of any phone on your system, dial *65 from that extension.

    Retrieving VoiceMail from Any Phone With TrixBox. To retrieve voicemail for any extension, dial *98 and enter the voicemail extension number. When prompted, enter the password for that account. To retrieve voicemail for the extension from which you are calling, dial *97 and enter the password for the account when prompted. You can also set your voicemail defaults and record your voicemail greetings using these options.

    Useful Functions on Your TrixBox System. Here's the complete list of functions that will work out of the box from any extension on your TrixBox system:

  • 611 The Latest Weather Forecast
  • *62 Schedule a Wakeup Call
  • *65 Decipher Extension Number of Any Phone
  • *70 Activate Call Waiting
  • *71 Deactivate Call Waiting
  • *72 Enable Call Forwarding (include forwarding number to avoid prompt)
  • *73 Disable Call Forwarding
  • *90 Enable Call Forwarding on Busy (include forwarding number to avoid prompt)
  • *91 Disable Call Forwarding on Busy
  • *78 Enable Do Not Disturb
  • *79 Disable Do Not Disturb
  • *97 Access Voicemail for Calling Extension
  • *98 Access Voicemail with Prompt for Mailbox Number
  • Well, that should get you started. We'll tackle the gee whiz features in TrixBox and freePBX in our next article so visit us again soon. In the meantime ...


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


    Nerd Vittles Fan Club Map. Thanks for visiting! We hope you'll take a second and add yourself to our Frappr World Map compliments of Google. In making your entry, you can choose an icon: guy, gal, nerd, or geek. For those that don't know the difference in the last two, here's the best definition we've found: "a nerd is very similar to a geek, but with more RAM and a faster modem." We're always looking for the best BBQ joints on the planet. So, if you know of one, add it to the map while you're visiting as well.

    Want More Projects? For a complete catalog of all our previous Asterisk projects, click here. For the most recent articles, click here and just scroll down the page.

    Headline News for the Busy Executive and the Lazy Loafer. Get your Headline News the easy way: Planet Asterisk, Planet Gadget, Planet Mac, and Planet Daily. Quick read, no fluff.

    Got a PDA or Web-Enabled Smartphone? Check out our new PDAweather.org site and get the latest weather updates and forecasts from the National Weather Service perfectly formatted for quick download and display on your favorite web-enabled PDA, cellphone, or Internet Tablet. And, of course, it's all FREE!


    Some Recent Nerd Vittles Articles of Interest...