Home » Technology » Telephony (Page 87)

Category Archives: Telephony

The Most Versatile VoIP Provider: FREE PORTING

Internet Telephony Shootout: Finding the Best VoIP Provider for the Asterisk PBX

blankIf you’re one of the 75,000+ Broadband Reports VoIP Forum subscribers who took advantage of the Staples/Vonage million dollar giveaway of easily unlocked Linksys PAP2 terminal adapters this past week and now you’d like to do more with VoIP than just make phone calls, welcome! For the rest of us including those that have been following our Asterisk articles these past few months, you already know that the hardest part of using Asterisk@Home or any other flavor Asterisk PBX is finding reliable, cost-effective VoIP providers that support home users of Asterisk. For business users, the prospects are even more bleak! With pay-as-you-go service, most providers don’t care what you connect with including Asterisk, and our experience suggests that Voxee.com (1¢ – 2¢ for most of the world with six second billing increments for U.S. calls) remains the best and most economical alternative, but it’s for outgoing calls only. And, yes, we love GoIAX.com with their free outbound calls within the U.S., and we love IPkall and Stanaphone for free incoming calls as long as you don’t mind a Washington state or New York City phone number. But, if there is one thing you can count on in the VoIP world, it’s this: free calling in or out probably won’t last forever. You do the math! Footnote: Matthew Simpson, who started the GoIAX service, promises us he’ll keep it going "forever" provided the cost of stamping out abusers doesn’t start outweighing the benefits of keeping the free service operational. We obviously wish him all the luck in the world and hereby donate this terrific, new (and free) firewall to assist in his efforts. He’s probably going to need it.

More problematic is finding a provider in the United States that supports Asterisk with an unlimited residential calling plan and a local phone number at a decent price. While BroadVoice advertises incredibly cheap international calling plans as unlimited with local phone numbers in most U.S. area codes, their fine print and the number of complaints of backbilling and other financial shenanigans posted on the Voxilla forum suggest that you’d better be extremely careful if you elect to use one of BroadVoice’s so-called Unlimited* Calling Plans with much of any call volume. As your Mama used to say, "If something sounds too good to be true, it probably is." For our review of international calling plans, go here. Last week we reviewed Yahoo’s dialpad service, but the voice quality of the calls just wasn’t satisfactory at least for our purposes, and there was no support for incoming calls with a local phone number. We personally liked Teliax, but they charged 2¢ a minute (rounded to whole minutes) for outgoing and incoming calls plus $5 a month for a local number (DID). And, when something comes unglued at their end, good luck getting it fixed. We had a DID that worked reliably and then all of a sudden you got a fast busy when folks called the number. In short, the calls never made it to our Asterisk server at all, and we showed them our logs to prove it. Unfortunately, explaining the situation to the Teliax support folks was a bit like talking to a toddler. They heard the words, but … Suffice it to say, the line remained dead in the water for almost a week before magically coming back to life. So we’re kissing Teliax goodbye for breaking Telecom Rule #1: When someone calls, our phone needs to ring! Then we looked at VoicePulse Connect with free incoming calls and a local number of your choice, but it’s $11 a month, and you then have to pay 4¢ a minute for outgoing U.S. calls. Yes, VoicePulse has all-you-can-eat plans, but they won’t support Asterisk. They will let you purchase a second line for Asterisk and pay 4¢ a minute for U.S. calls. We can do about as well with a WalMart phone card. So where does that leave us? Exhausted but persevering…

blankJust when we thought the Asterisk landscape was looking pretty bleak in the U.S. all-you-can-eat department, we stumbled upon a VoIP provider that loves and actually uses Asterisk, has state-of-the-art servers and a network backbone to match, demonstrates incredible depth of experience in the VoIP market, doesn’t play mind games with unconscionable terms of service (i.e. unlimited long distance calling means unlimited long distance calling), and has dirt cheap all-you-can-eat U.S. residential calling plans with local phone numbers for incoming calls. How much? $14.95 a month with no hidden "recovery" fees. For business users, you won’t find a better collection of business offerings on the planet. There are cradle-to-grave plans, or you can do-it-yourself for $40 per trunk with $1 DID’s and unlimited U.S. local and long distance calling. Even with its $100 monthly minimum, the latter is a great deal on PSTN origination and termination service for almost any size business. If you’re a small business and these plans don’t quite meet your needs, send them an email, and I’m pretty sure they’ll work out some cost-effective arrangement that meets your needs. Having tried dozens of VoIP providers over the past few months, suffice it to say, we’ve learned to spot the duds, the con artists, and the crappy providers just about as quickly as you can sign up for service. What you won’t get with this provider is a splashy web site with flashing signs promising you the moon … only to learn (later) that your free trip was just one way. Nor will there be a lot of hand-holding support although we received a return support call from the founder of the company in less than 30 minutes, and he didn’t know us from Adam. If you want handholding, then Vonage with a locked PAP2 phone adapter and no Asterisk server may be your best ticket to experience VoIP. Or here’s a cheaper alternative. BellSouth will sell you residential CallerID in Atlanta for only $8 a month … no phone line, no free calls to anywhere, no dial tone, no phone, just CallerID. And they wonder why their customers are leaving in droves.

So, where were we? If you’re comfortable with Asterisk and just looking for rock-solid reliable calls and an unlimited U.S. calling plan where you can actually hear the person at the other end of the line, then we’ve found a provider for you at a very reasonable price. Have we dragged this out long enough? The winner is VoipXpress aka TelaSIP. Congratulations to Jacob Brassington, who correctly guessed the winner in a posted comment following last week’s column. We didn’t publish the wrong guesses to protect the innocent. Our recommendation is that you try the $14.95 VoipXpress Premium plan for yourself. And, yes, the company founder, Gene Willingham, will give you your money back if you’re not satisfied. Or, if you just don’t trust anybody without a little personal testing, sign up for the VoipXpress Basic plan which is free with 4¢ per minute pay-as-you-go domestic calls.

Full Disclosure & Freebies. Like most other VoIP providers, VoipXpress helps a bit to defray the costs of the bandwidth for this blog if you sign up using the link we’ve provided. Sorry, but we’re addicted to referral credits, and you, too, can get them once you sign up for service. Anyway, it costs you nothing and helps us a little. But, if the referral stuff bothers you, just delete the PARTNER portion of the link to VoipXpress once you arrive on their web site. We like their service with or without referral credits. You will get a freebie, however, if you use our link. During October, VoipXpress will give you a second DID number in your choice of area code at no additional charge. Their DID’s are normally $1.95 a month, the best residential DID bargain around for those that need or want numbers in multiple places. Just mention Nerd Vittles when you sign up during October to get your second DID in almost any area code at no cost.


Configuring Asterisk@Home for VoipXpress. Now let’s get VoipXpress working with your Asterisk@Home system. The VoipXpress servers are actually maintained by their parent company, TelaSIP. We need to add a simple context to process incoming calls and then add a new trunk in our Asterisk@Home system. Finally we’ll reconfigure the outbound dialing routes to take advantage of the VoipXpress unlimited calling plan. Here’s how.

Point your web browser to your Asterisk@Home server’s IP address and choose AMP->Maintenance->Config Edit and choose extensions_custom.conf. We’re assuming you heeded our advice in our Securing Asterisk column and have already added a [from-external-custom] context to your extensions_custom file. If not, do that first! Now scroll to the bottom of the file and add the following new context substituting your Telasip assigned phone number for 4561234567. If you received two DIDs from TelaSIP, add three additional exten lines with your second number. Then click the Update button to save your changes.

[telasip-in]
exten => 4561234567,1,NoOp(Incoming call from TelaSIP #4561234567)
exten => 4561234567,2,Goto(from-external-custom,s,1)
exten => 4561234567,3,Hangup

Now let’s add a trunk for TelaSIP. Choose AMP->Setup->Trunks. Then click Add SIP Trunk. Why SIP and not IAX? The simple answer is there’s less call overhead between you and the provider. With SIP, only signalling information is passed to your provider while the data for the call itself (i.e. the heavy lifting) is strictly between you and the person you’re calling. Now where were we? For your Outbound Caller ID, fill in the local phone number provided by Telasip. For Maximum Channels, enter 2. That means that, unlike most providers of unlimited service, your account can handle two simultaneous calls in or out of your house with TelaSIP. For Dial Rules, enter the following substituting your local area code for 404:

1|NXXNXXXXXX
NXXNXXXXXX
404+NXXXXXX

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=telasip-in
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.

Adjusting Your Dialplans To Support VoipXpress/TelaSIP. If you’re using the Outbound Dialplans that we’ve built in the last few episodes, then it’s a simple matter to move SIP/telasip-gw up this list of priorities. Using AMP->Setup, click the Outbound Routing tab and then select each of the following routes: Local, Tollfree, and US. For each route, add a new Trunk Sequence by clicking the Add button and choosing SIP/telasip-gw. Then move it to the top of your Trunk Sequence list for each route to make it your first outbound dialing priority. Save your changes and restart Asterisk.

Making a Test Call Using TelaSIP. To be sure everything is working swimmingly, start up Asterisk in interactive mode using the Command Line Interface (CLI) so that you can actually watch what’s happening when calls are placed and received. This works best if you connect to your Asterisk server through SSH from a Mac or PC. SSH comes with every Mac and the syntax is simple: ssh root@AsteriskIPaddress. If you’re still chained to Microsoft, download Putty from the Mother Country, and you can do the same thing using a Windows machine. Once you’re logged in as root, issue the following command: asterisk -r. Quit ends your Asterisk CLI session, and exit logs you out of your SSH session. Now issue the command: set verbose 10 to get maximum information. Then place a U.S. long distance call and watch what happens. You should see something similar to the following which shows that the call was placed using the new telasip-gw trunk:

-- Called telasip-gw/8435551212
-- SIP/telasip-gw-2cbf is ringing

Coming Attractions. Next week, we still have Digium®’s IAXy device to configure so that you can take a phone with you on the road and connect back to your Asterisk® server to make calls. And with the IAXy 2 (now shipping), you can even use MD5 encryption for your passwords to further protect your Asterisk system. We’ll show you how. Then we’ll turn our attention to faxing and show you how to reconfigure Asterisk@Home to perform double-duty as not only a versatile PBX but also a sophisticated fax machine. You won’t need any special fax detection hardware to make this work, and Asterisk@Home will automatically detect and capture incoming faxes using your VoIP line. No dedicated fax line required! Then Asterisk@Home will convert the faxes into PDF documents and forward them to any email address you choose. This works great with your SIP line from TelaSIP by the way and works rarely with VoIP service from BroadVoice … yet another reason to put on your traveling shoes.

For those on the West Coast, don’t forget that next week is the big Asterisk convention in Anaheim: Astricon 2005. It’s not too late to register. And all your favorite nerds will be there, except us unfortunately. It should be a great time to learn all about Asterisk and to hear and see what’s on the drawing boards.

Last but not least, we previously walked you through adding entries to extensions_custom.conf to blacklist your "favorite" callers. But, in a coming article, we’ll show you how to do the same thing automatically at the touch of a button on your phone. In addition, there are some easy tools to manually add and remove blacklisted callers from Asterisk’s internal database, and we’ll show you how to access them from your phone. As the holiday and election seasons approach, you’ll be glad you’ve mastered blacklisting. Have a great weekend.

Other Tutorials. There are numerous additional articles in this Asterisk HOW-TO series to keep you busy. You can read all of them by clicking here and scrolling down the page. We recommend reading at least the first four or five articles from the bottom up so that the learning curve is less painful. Finally, if you just want to brush up on your phone etiquette, don’t miss Lily Tomlin’s "This Is A Recording" (See inset of "Ernestine" pictured with a vintage tip-and-ring switchboard). There is no finer tutorial on the planet: "We don’t care. We don’t have to. We’re the phone company."

Securing Your Asterisk@Home PBX: Here’s How

blankNow that you've gotten your feet wet with our Asterisk@Home series, we want to catch our breath today and make sure your system is locked down. After all, you don't want the entire world making free phone calls on your nickel! Just as unsecured SendMail servers can be used as SPAM relay hosts, misconfigured Asterisk® servers also can be used as relay hosts to place calls to anywhere by anybody. In our second article we covered the basics of resetting all of the default passwords that come with Asterisk@Home. If you skipped that step, now would be a great time to be sure you've changed ALL of them. Just go back and reread the Securing Asterisk section of that article for the details.

Update: For the latest information, please read our Primer on Asterisk Security.

One of our few criticisms of Asterisk is its support of the goto command coupled with undocumented context subroutines and macros which are scattered across more than a dozen configuration files in applications such as the Asterisk Management Portal (AMP). For those of you that cut your teeth on the BASIC programming language, you know the tendency of applications to turn into spaghetti code, i.e. code so convoluted with goto's and undocumented subroutine calls that it's difficult to trace how an application actually plays out when it's executed. This, in turn, makes it extremely difficult to secure such applications because of the complexity of tracing through all the hoops executed when the program is in use.

Particularly for home or small office use, the major security risk with an Asterisk system is incoming call vulnerability. Someone connects to your system through the Internet and then places an outgoing call through your system to a coconspirator on some desert island on the other side of the globe that legally charges $12.00 a minute for calls. Cruise ships charge about the same thing! If you're not careful, you get stuck with the phone bill. Our solution to this incoming call vulnerability is to circle our wagons and strictly limit the number of Asterisk contexts used to process incoming calls. If you're lost in the ozone at this point, don't worry. Just keep reading, and we'll walk you through what all this means and what you can do to easily protect your system.

In Asterisk@Home, the context that controls incoming calls via IP is [from-sip-external] which can be found in extensions.conf using AMP->Maintenance->Config Edit. We previously showed you how to set up a Stealth AutoAttendant. We strongly recommend you use that or something similar to manage all incoming calls to your Asterisk server. This is the main reason we recommend against DID routing with Asterisk@Home. Using a single AutoAttendant assures that every incoming call lands in the same place and callers can only do the things you permit in this one context. Keep in mind that any extension command you have set up anywhere in the [from-internal-custom] context can be executed using this AutoAttendant. It doesn't really matter whether it is above or below the AutoAttendant code! And, of course, if you provide access to Asterisk's DISA service with either an insecure password or no password or if you took our advice and built speed-dial numbers but the calls are routed to Hong Kong, then you're on your own. IT'S YOUR PHONE BILL!

Why did we place the AutoAttendant code in the [from-internal-custom] context? Because we needed access to it for our Sipura SPA-3000 to handle incoming PSTN calls. In summary, you just need to be careful what options you provide in your AutoAttendant and the remainder of the [from-internal-custom] context because anyone can call you and choose any available option throughout that context. And keep in mind that your phone doesn't necessarily ring when someone hits your AutoAttendant so you may not know your system is being attacked unless you review your call logs frequently: AMP->Reports->Call Logs. Remember, any other Asterisk server on the planet can call your server via an IP connection. All it takes is the domain name or IP address of your Asterisk server, and they can at least attempt to make a connection. The only question is what can they do once they get there. And that's up to you! Finally, you need to carefully test your system by placing calls to yourself and pressing every button on your phone including 0, *, and #. Then try placing calls to local and long distance numbers while the AutoAttendant is playing. If they go through, you've got a problem. Last but not least, go into your VoiceMail system (just as a caller would) and dial the same numbers as above making sure there is no back door there that you don't know about. Remember, we showed you how to open the DISA backdoor in VoiceMail so make sure all of your voicemail passwords are secure if you implemented that tip.


Assuming you have deployed the Stealth AutoAttendant and added it to your [from-internal-custom] context in the extensions_custom.conf file, here is our recommended configuration for the [from-sip-external] context in the extensions.conf file. Be sure every other line in this context is commented out with a semicolon at the beginning of each line. Then restart Asterisk.

exten => _.,1,Wait(1)
exten => _.,2,Goto(from-internal-custom,111,1)

Our personal preference is to create a duplicate AutoAttendant context for your incoming VoIP connections. This eliminates the risk of inadvertently exposing some other extension code lurking elsewhere in your [from-internal-custom] context with IP connections. This new context can use identical code to the Stealth AutoAttendant we previously built, or you can customize it as desired. Place the new context at the bottom of the extensions_custom.conf file and then adjust your [from-sip-external] code to look like the following. Don't forget to restart Asterisk.

exten => _.,1,Wait(1)
exten => _.,2,Goto(from-external-custom,s,1)

Update: If you want to retain the flexibility to use the Asterisk Management Panel's DID Routes functionality to map incoming calls from certain trunks to different contexts or extensions, then insert the following code just below the [from-sip-external] label:

include => ext-did

And here's the sample code to insert in your extensions_custom.conf file. If you cut-and-paste the code below, don't forget to replace the opening and closing typographic quote characters with the standard quotation mark character or you'll get unexpected results with Asterisk.

[from-external-custom]
exten => s,1,Zapateller(answer|nocallerid)
exten => s,2,Wait(1)
exten => s,3,SetMusicOnHold(default)
exten => s,4,GotoIf($["${CALLERIDNUM}" = ""]?who-r-u,s,1)
exten => s,5,GotoIf($["foo${CALLERIDNUM}" = "foo"]?who-r-u,s,1)
exten => s,6,GotoIf($["${CALLERIDNAME:0:9}" = "Anonymous"]?who-r-u,s,1)
exten => s,7,GotoIf($["${CALLERIDNAME:0:7}" = "Unknown"]?who-r-u,s,1)
exten => s,8,GotoIf($["${CALLERIDNUM:0:7}" = "Private"]?who-r-u,s,1)
exten => s,9,GotoIf($["${CALLERIDNAME:0:7}" = "Private"]?who-r-u,s,1)
exten => s,10,GotoIf($["${CALLERIDNUM:0:10}" = "Restricted"]?who-r-u,s,1)
exten => s,11,GotoIf($["${CALLERIDNUM:0:4}" = "PSTN"]?who-r-u,s,1)
exten => s,12,DigitTimeout,3
exten => s,13,ResponseTimeout,3
exten => s,14,Background(custom/welcome)

exten => 0,1,Background(pls-hold-while-try)
exten => 0,2,AGI(directory,general,ext-local,${DIRECTORY:0:1}${DIRECTORY_OPTS})
exten => 0,3,VoiceMail(204@default)
exten => 0,4,Hangup
exten => 1,1,Background(pls-hold-while-try)
exten => 1,2,Dial(local/222@from-internal,20,m)
exten => 1,3,VoiceMail(204@default)
exten => 1,4,Hangup
exten => 4,1,Authenticate(1234588)
exten => 4,2,Background(pls-wait-connect-call)
exten => 4,3,DISA(no-password|from-internal)

exten => 2XX,1,Background(pls-hold-while-try)
exten => 2XX,2,Dial(local/${EXTEN}@from-internal,20,m)
exten => 2XX,3,VoiceMail(${EXTEN}@default)
exten => 2XX,4,Hangup
exten => 2XX,103,Voicemail(${EXTEN}@default)
exten => 2XX,104,Hangup

exten => t,1,Background(pls-hold-while-try)
exten => t,2,Dial(local/204@from-internal,20,m)
exten => t,3,VoiceMail(204@default)
exten => t,4,Hangup

exten => o,1,Dial(local/204@from-internal,20,m)
exten => o,2,VoiceMail(204@default)
exten => o,3,Hangup

exten => i,1,Playback(wrong-try-again-smarty)
exten => i,2,Goto(s,16)

Here's how the AutoAttendant code above works. Pressing zero activates the directory, pressing 1 rings the ring group (222) for all extensions, pressing 4 gives access to external dial tone if the password 1234588 is correctly entered, pressing no key (the t timeout entries) rings the main home phone extension, 204. Users can also enter 3-digit extension numbers beginning with a 2. If you didn't insert the following two contexts from our previous Asterisk column, then you'll need to add them to the bottom of [from-external-custom] to manage callers without CallerID:

[who-r-u]
exten => s,1,Background(privacy-unident)
exten => s,2,Background(vm-rec-name)
exten => s,3,Wait(2)
exten => s,4,Record(/tmp/asterisk-stranger:gsm|5|15)
exten => s,5,Background(pls-hold-while-try)
exten => s,6,Goto(ext-park,70,1)
exten => s,7,VoiceMail(204@default)
exten => s,8,Playback(Goodbye)
exten => s,9,Hangup

[ext-park]
exten => 70,1,Answer
exten => 70,2,SetMusicOnHold(default)
exten => 70,3,SetCIDNum(200|a)
exten => 70,4,SetCIDName(Parked Call Info|a)
exten => 70,5,ParkAndAnnounce(silence/9:asterisk-friend:/tmp/asterisk-stranger:vm-isonphone:at-following-number:PARKED|40|local/204@from-internal|who-r-u,s,7)
exten => 70,6,Hangup

MySQL Security Alert. Recently, we happened to look at how security was set up on MySQL with Asterisk@Home. This may also apply to those using plain-old Asterisk with the Asterisk Management Portal. In any case, you need to check your system NOW! Using the Asterisk Management Portal, go to AMP->Maintenance->phpMyAdmin. Then click on the Database pulldown in the left pane and choose mysql. When the tables display, click on the user table. Now click the Browse tab at the top of the right pane. The entry we care about is the second one: asterisk1.local for root user access. If your password field is blank, you've got a potential security problem. What this entry means in layman's terms is anyone on the Internet can connect to your MySQL databases as root with no password. The only roadblock is being able to spoof the default hostname of your Asterisk@Home server. And hostname spoofing has been a reported vulnerability of MySQL so it's just not worth taking a chance. Keep in mind that all of your VoIP account usernames and passwords are stored in a MySQL table when you use the Asterisk Management Portal (AMP). Not a healthy situation when it's your wallet that's at risk. To fix the problem permanently, just click on the pencil beside the second record. When the record displays, click on the function pulldown in the password row and choose Encrypt. Then make up a password that's secure and enter it in the password value field. Click Go to save your update. Now click the Browse tab again and be sure an encrypted password is shown for both root user entries in the table. We don't care about the blank password for the blank user because you'll note that all the database privileges are set to N for this account. Fixed!


Other Security Advisories. We also recommend that you frequently review the Secunia web site for Asterisk security advisories. They also have an RSS Feed for those of us who are forgetful.

Other Asterisk Articles. There are numerous additional articles in this Asterisk HOW-TO series to keep you busy. You can read all of them by clicking here and scrolling down the page. We recommend reading the articles from the bottom up so that the learning curve is less painful. Sleep well. Your Asterisk server is now at least a little bit more secure, and you know a good bit more about how the pieces actually fit together and why.
blank

Taming Yahoo’s DialPad Service for Use with Asterisk: Here’s How

dialpadIn our unending quest to find the best and cheapest VoIP providers that work reliably with Asterisk®, today we turn our attention to dialpad, a company which recently was acquired by Yahoo! As it turns out, that may not be a good thing for Asterisk lovers, but it was probably a pretty good day for the dialpad owners. For those that don’t know, dialpad offers the least costly (aka cheapest) unlimited U.S. and Canada outbound residential VoIP service on the planet: $11.99 a month for all you can eat with no hidden fees or add-on’s. For those that enjoy legal mumbo jumbo, if you review their Terms of Service, you’ll see lots of language that looks vaguely familiar to what you’ll find in the BroadVoice language minus the $100 penalties which BroadVoice lawyers seem to have concocted on their very own.

It used to be you could subscribe to dialpad and had your choice of a Sipura SPA-2000 ATA or a softphone client. Since the Yahoo purchase, the ATA option has quietly disappeared even though (to date) they still are supporting customers with ATA’s. Yahoo apparently wants dialpad to integrate a softphone into their instant messenger service to compete with Skype. Skype is free so you do the math. What does all this have to do with Asterisk, you might be asking. Well, plenty. As long as there is an ATA configuration floating around, we can usually look at the settings and make the service work equally well with Asterisk. And it turns out that is still the case with dialpad. Just don’t expect it to last forever… but, you’ve heard that advice with other providers as well so welcome to the VoIP rollercoaster. And, for those who care, Dialpad’s terms of service don’t (yet) prohibit use of a PBX. Didn’t know you were going to have to go back to law school just to use your damn Asterisk server at home, did you?

So how do we get dialpad to work with Asterisk? Well, first you sign up for the service. That gets you an account with a username and password. Then you’ll need a quick lesson in how to install the G.729 codec for Asterisk. This is the codec that dialpad uses for communications so you have to use it at your end, too. Otherwise, you get a fast busy every time you connect through dialpad. Unless water torture is your thing, you have to pay for G.729, but it’s only $10 for one simultaneous connection which is what you get with dialpad anyway. Once we get G.729 working, you add a trunk for dialpad and then integrate dialpad into your outbound dialplans. And presto, dialpad works!

Before we begin, let me take my obligatory moment to again rail against VoIP providers who are so short-sighted that they don’t see the Golden Opportunity they are missing by not supporting Asterisk directly. Asterisk users are pioneers. VoIP users are either pioneers … or idiots. Which would you rather deal with? Asterisk users have money. Almost half of American families with median incomes over $150,000 a year and residential broadband service also have some type of PBX in their homes! Skype is free and competing with free isn’t a big money-maker. So why is it that most VoIP providers can’t figure the rest of this out for themselves? Beats me.

Signing Up for dialpad Service. To get a dialpad account, just visit their web site and make a selection. The only real deal is the all-you-can-eat U.S. and Canada dialpadUSA plan for $11.99, and you have to live in the U.S. or Canada to subscribe. Remember, too, that this is for residential use only. The rest of the offerings are reasonable but not the best deals available compared to providers such as Voxee and BroadVoice which we previously have covered. Don’t bother to download the softphone client. We won’t be using it. Just write down your username and password. That’s what we’ll be needing to connect through Asterisk.

Installing the G.729 Codec for Asterisk. The G.279 codec is used to reduce the bandwidth necessary to process voice calls. Instead of 64Kbps of data for a voice call, G.729 stuffs the call into 8Kbps. What MP3 did for music, G.729 does for voice calls. To install the G.729 codec, you first need to download the version that matches the processor in your Asterisk box. There are codecs available for both Linux and FreeBSD systems here. You’ll also need to download the registration utility. If you’re using Asterisk@Home, you’ll need the glibc_2.3 utility available here. If you don’t know what version of glibc is running on your Asterisk server, go to a command prompt and type ldd –version. Note: There should be two dashes before the word "version." Now that you’ve downloaded codec_g729a.so, you’ll need to copy it to /usr/lib/asterisk/modules on your Asterisk server while logged in as root. Next, copy the register program to any convenient place on your Asterisk server, e.g. /tmp will do. Modify the permissions for the register program so that it is executable: chmod a+x register. Now pay your $10 and wait for your registration key to be emailed to you. When you get the key, go to your Asterisk server and issue the following command from the directory where you placed the register program: ./register G729-1234ABCD substituting your actual key for G729-1234ABCD. Your Asterisk server must have Internet access to complete the registration process. Once you get a message that the registration was successful, restart Asterisk, and you’re in business: amportal stop then amportal start. Finally, note that the G.729 registration is locked to the MAC addresses of the network cards in your Asterisk server. If you change NICs, you’ll need to reregister the G.729 codec. You get two bites at the apple without contacting Digium® for a new code.

Adding the dialpad Trunk. Fire up your web browser and point it at your Asterisk@Home server now. Go to AMP->Setup->Trunks and choose Add SIP Trunk. You can leave the CallerID field blank since you set this on the dialpad site. For maximum channels, enter 1. For the Dial Rules, enter the following:

1+NXXNXXXXXX
1NXXNXXXXXX

In the Outgoing Settings, name the Trunk: dialpad. For the Peer Details, enter the following substituting your own username and password where necessary. The only trick here is that we’re going to tell dialpad that we’re a Sipura ATA device instead of an Asterisk server just to avoid anyone at dialpad getting their panties in a wad if Asterisk PBX entries started appearing in the dialpad log files. Right now dialpad doesn’t block Asterisk devices but who knows what the future holds so we’ll just masquerade as the device the dialpad service already supports and avoid any future problems.

allow=g729
canreinvite=no
disallow=all
fromuser=yourusername
host=66.35.222.58
insecure=very
secret=yourpassword
type=peer
useragent=Sipura/SPA2000-2.0.9(d)
username=yourusername

Leave the Incoming Settings section blank since we won’t be receiving calls from dialpad. For the Registration string, enter the following using your username and password: yourusername:yourpassword@66.35.222.58. Now save your entries and then click the red bar to restart Asterisk. Almost done.


Adjusting Your Dialplans To Support dialpad. If you’re using the Outbound Dialplans that we’ve built in the last few episodes, then it’s a simple matter to move dialpad up this list of priorities. Using AMP->Setup, click the Outbound Routing tab and then select each of the following routes: Local, Tollfree, and US. For each route, add a new Trunk Sequence by clicking the Add button and choose SIP/dialpad. Then move it to the top of your Trunk Sequence list for each route to make it your first outbound dialing priority. Save your changes and restart Asterisk.

Making a Test Call Using dialpad. To be sure everything is working swimmingly, start up Asterisk in interactive mode using the Command Line Interface (CLI) so that you can actually watch what’s happening when calls are placed and received. This works best if you connect to your Asterisk server through SSH from a Mac or PC. SSH comes with every Mac and the syntax is simple: ssh root@AsteriskIPaddress. If you’re still chained to Microsoft, download Putty from the Mother Country, and you can do the same thing using a Windows machine. Once you’re logged in as root, issue the following command: asterisk -r. Quit ends your Asterisk CLI session, and exit logs you out of your SSH session. Now issue the command: set verbose 5 to get maximum information. Now place a U.S. long distance call and watch what happens. You should see something similar to the following which shows that the call was placed using the new dialpad trunk:

-- Called dialpad/16785551212
-- SIP/dialpad-a47a is making progress passing it to SIP/101-d762
-- SIP/dialpad-a47a answered SIP/101-d762

Call Quality with dialpad. Now that we have everything working, you’re probably asking, "Well, How Is It?" On a scale of 1 to 10, we give dialpad sound quality a 5. This is always a subjective thing, but there seem to be considerably more echoing calls, calls without sound at one end, and other annoyances that remind you of the snowy television era. Your mileage may vary, of course, depending upon where you are and who you’re calling. Just keep in mind that dialpad doesn’t have a trial period, and they don’t give refunds so you’ll end up spending $11.99 for the experiment, whether it works out or not. Instant messaging isn’t the same technology as voice calls and, if the voice calls are managed similarly to Yahoo’s IM traffic using the same type servers and bandwidth management techniques, that would probably account for the mediocre voice quality, but the price is right.

blankComing Attractions. If you’ve already got dialpad or BroadVoice service, then enjoy the rest of your current month subscription using Asterisk, but start lacing up your switching shoes. If you’re new to VoIP, we’d recommend you pass on dialpad despite the price. We’ll have a rock-solid performer for you next week for $3 more with real Asterisk support and unlimited U.S. residential calling plus two free incoming DID’s from any of the blue states shown on the U.S. map (inset). For all the poor BroadVoice users out there, you’ll finally have something to cheer about. And this provider offers simultaneous outbound calling at no extra cost! Are you listening Teenagers of America? It’s all backed by a company with in-depth Asterisk know-how which doesn’t mean you can bug them to death for $14.95 a month, but it does assure all of us that the Asterisk@Home configuration we lay out is one which has passed their scrutiny with flying colors. The good news for businesses is that these folks know their stuff and have an infrastructure to assure that your communications system remains rock-solid reliable … even with VoIP. They’ll even preconfigure phones for you. And it all runs on the best fiber backbone in the country. Last but not least, the dialpad and BroadVoice (obnoxious) terms of service will be just a bit of ancient history once we introduce this provider so I can take off my legal eagle thinking cap for a while. Did we mention their calls sound better than Ma Bell?

Also coming soon, we’ll cover Digium’s S101I, affectionately known as the IAXyâ„¢ Version 2, a NAT-transparent, FXS device providing a POTS telephone interface to your Asterisk PBX using an IAX connection. The real beauty of the IAXy is that you can travel with it and never again have to worry about firewalls, NAT, and STUN servers. Just open one UDP port, and you’re done. Remote access to your Asterisk@Home server from anywhere on the planet becomes a one-minute drill instead of a nightmare. For parents bankrupted by college kids’ cell phone bills, the IAXy is the perfect addition for that college dorm room or apartment.

Oldies But Goodies. There are numerous additional articles in this Asterisk HOW-TO series to keep you busy. You can read all of them by clicking here and scrolling down the page. We recommend reading the articles from the bottom up so that the learning curve is less painful. Enjoy!

Free U.S. Calls with Asterisk: Here’s How

blankIt’s Birthday Week at Nerd Vittles and, as you’ve come to expect, we do things a little differently around here. We like to savor birthdays for a whole week (sometimes more) and, to celebrate, we have a special gift for you: a tip on how to make free long distance calls in the United States using your new, free Asterisk® server.

In our column last week, you learned how to configure and reconfigure Asterisk to take advantage of the best communications deals in the marketplace. And today we have a deal you can’t refuse: free calls to anywhere in the United States using the newest IAX2-compatible provider on the block, GoIAX.com. Just sign up for a free account with your email address and a password of your choice, add a trunk using the Asterisk Management Portal (AMP) or Asterisk@Home, make a minor adjustment in your Outbound Routing, and start dialing for free. Will it last? Probably not. But who cares? It’ll work for a while, and then something else will come along. So enjoy it while you can and … Happy Birthday!

NOTE: The GoIAX service is temporarily restricted to toll-free calls only. See their web site for current status updates.

Adding the GoIAX Trunk with AMP. Using your web browser pointed to your Asterisk server, go to AMP->Setup->Trunks->Add New IAX2 Trunk. Fill in the Outbound CallerID with the GoIAX phone number you were provided when you registered. For Outgoing Dialing Rules, use the following:

1+NXXNXXXXXX
1NXXNXXXXXX

In Outgoing Settings, use goiax for the Trunk Name and the following for the Trunk Details substituting your own GoIAX phone number and password:

allow=gsm
auth=md5
disallow=all
host=server1.goiax.com
secret=yourpassword
type=peer
username=878201234567

For Incoming Settings, use iax.goiax.com for the USER Context and the following for the USER Details substituting your own GoIAX phone number and password. NOTE: If you have signed up for a DID number from GoIAX, then you’ll need to rename your USER context from iax.goiax.com to your GoIAX account number, not your DID number. E.g. 878201234567.

allow=gsm
auth=md5
context=from-pstn
disallow=all
host=server1.goiax.com
secret=yourpassword
type=friend
username=878201234567

For the Registration String, use the following with your GoIAX phone number and password: 878201234567:yourpassword@server1.goiax.com. Now Save your changes and click the Red Bar to restart Asterisk.

Adjusting Outbound Routing for Free U.S. calls. Last week, we made Voxee.com our top priority for outbound long distance calls since they provided penny-a-minute calls within the U.S. This week we want to move them down a notch since we have a new provider that’s free. In Asterisk-speak, we want to make goiax our first priority for outbound U.S. long distance calls and move Voxee down to the second spot. If GoIAX stops working, Asterisk will automatically route the calls to Voxee without any user intervention. Here’s how.

Go to AMP->Setup->Outbound Routing and click on the US route which we created last week. It should show a Trunk Sequence of IAX2/voxee, then IAX2/teliax, and then SIP/pstn if you have a PSTN (POTS) line. Just click on the pull-down beside each trunk and substitute IAX2/goiax as your #0 choice, IAX2/voxee as your #1 choice, and IAX2/teliax as your #2 selection. Click the Add button and insert SIP/pstn as your #3 pick. Click Submit Changes and then the Red Bar to restart Asterisk.

That’s it. You’re done in just a couple of minutes. All future U.S. long distance calls will be routed out using your new Outbound US dial plan.


Making a Test Call Using GoIAX. To be sure everything is working swimmingly, start up Asterisk in interactive mode using the Command Line Interface (CLI) so that you can actually watch what’s happening when calls are placed and received. This works best if you connect to your Asterisk server through SSH from a Mac or PC. SSH comes with every Mac and the syntax is simple: ssh root@AsteriskIPaddress. If you’re still chained to Microsoft, download Putty from the Mother Country, and you can do the same thing using a Windows machine. Once you’re logged in as root, issue the following command: asterisk -r. Quit ends your Asterisk CLI session, and exit logs you out of your SSH session. Now issue the command: set verbose 5 to get maximum information. Now place a U.S. long distance call and watch what happens. You should see something similar to the following which shows that the call was placed using the new goiax trunk:

-- Called goiax/12345678910
-- Call accepted by 204.13.233.114 (format gsm)
-- Format for call is gsm
-- IAX2/goiax/1 is ringing

For those that would prefer a long-term player to handle your long distance calling and don’t mind paying a little, we’ll have another suggestion for you later this week. With this provider, you get unlimited residential calling to anywhere in the U.S. and Canada for only $11.99 a month. That’s less than half the cost of most of the all-you-can-eat plans including Vonage. And, it’s roughly the same cost as BroadVoice’s in-state calling plan after adding all of BroadVoice’s hidden fees. Even though Asterisk isn’t directly supported by the provider, we’ll walk you through setting up the service to work reliably with Asterisk. Can you say Yahoo! In the meantime, there are numerous additional articles in this Asterisk HOW-TO series to keep you busy for a few days. You can read all of them by clicking here and scrolling down the page.

Save Millions on VoIP Costs: Here’s How

Lesson #6: In the VoIP Wild West, don't believe every flashing sign that you see or every headline that you read. But rest assured, the Federal Trade Commission will be coming to your rescue ... some day.

And, yes, this is the sixth article in our Asterisk@Home series, and we will show you how to save some money on your current phone bills using Asterisk® Dial Plans, but maybe not quite millions. Everything in this article applies to anyone using Asterisk@Home or a pure Asterisk® PBX with the Asterisk Management Portal (AMP). Read the first five parts (I, II, III, IV, and V), and then you'll be ready to continue on here.

Perhaps the greatest feature of Asterisk@Home is the ease with which you can automatically route outgoing calls based upon the number dialed. And you can do it with or without dialing prefixes such as dialing 8 or 9, and then a 1, and then an area code, and then a phone number. You can use this dialing plan intelligence to route specific types of calls to different VoIP providers thereby taking advantage of cost savings offered by the different providers. For example, Voxee.com has a 1.1¢ per minute rate for calls within the United States with 6 second billing increments. And Free World Dialup (FWD) has free outgoing calls to 800 numbers in the United States. In addition to worldwide calling plans, BroadVoice also has a $9.95 in-state residential calling plan that hopefully will prove to be less controversial than their worldwide plans. It provides unlimited (sort of) in-state calling. The "sort of" is a warning that BroadVoice recently inserted an asterisk (Unlimited*) after all of their so-called Unlimited Dialing Plans despite their continuing ads to the contrary (inset). In the fine print, BroadVoice indicates that they now can retroactively determine that you are not using the plans as they intended them to be used. It's still a bit of a mystery as to what the BroadVoice formula is; however, you are forewarned to be prepared for a legal battle if you exceed their undisclosed calling thresholds. When your international calling gets into the thousands (not billions) of minutes, expect to be converted to a business plan where you'll be billed by the minute at prevailing rates.

Voxilla ad for BroadVoiceHere's the actual text of their Terms and Conditions. On the Voxilla forums, some customers report being "converted" to business accounts merely for calling their girlfriends too frequently. Compare that conduct to the ad now running on Voxilla (see inset) and judge for yourself. Suffice it to say, if you take BroadVoice's bait and attempt to use a billion minutes, you should fully expect a bill for millions of dollars rather than the $19.95 advertised price. Bottom Line: If you choose BroadVoice, protect yourself after signing up by switching to a prepaid debit card with no more than a three-month cash balance: $66.50.

You agree that if BroadVoice determines in its sole discretion that you have used the Service, and/or anyone else has used the Service for any activities and purposes prohibited by this section it may immediately charge you BroadVoice's higher rates for its Business service for all periods, including past periods, in which you use, or used, the Service for such prohibited activities together with a US$100.00 administrative fee for same, and that BroadVoice may immediately charge such amounts on your credit card.

The AMP Approach to Dialing Plans. There are, of course, about A Billion ways to set up Asterisk dialing plans, too. We'll provide one approach that works. When we're finished, you'll have a VoIP dial plan that provides toll-free calling to millions of phone numbers, free calling to anyone in your state, and penny-a-minute long distance calls within the United States with billing increments of six seconds. The total monthly cost is $9.95 plus however many penny-a-minute U.S. long distance calls you make. International savings are equally remarkable. Suffice it to say, you can call Paris, London, Hong Kong, and Tokyo for less than 2¢ a minute with numerous VoIP providers. Check the Voxilla forums for the best current deals. You, of course, can take what you learn here today and embellish these dial plans to meet your unique circumstances. But, we're getting ahead of ourselves. First, you need to know a bit about how Asterisk@Home and especially the Asterisk Management Portal (AMP) process outgoing calls. It's quite different than the pure Asterisk way of doing things so, if you plan to use AMP or Asterisk@Home which uses AMP, learn the AMP way of doing things. It's very powerful and downright easy once you get the hang of it. The only problem is that no one ever bothered to write down HOW ... until NOW!

When you dial a number, AMP compares the dialed number against the Dial Patterns you've set up in your AMP->Setup->Outbound Routing rules. When AMP finds the first matching dial pattern in any Route (going down the list of routes from top to bottom), it then looks there to see what your first Trunk Sequence priority is and applies the Outgoing Dial Rules for that trunk. You set these dial rules in AMP->Setup->Trunks by editing your Trunk configurations. The important point is that the Dial Pattern in your Outbound Routing rule gets processed first, and then the Dial Rules for the Trunk that will actually do the dialing are processed. If this Trunk isn't available for some reason, Asterisk repeats the process using your second Trunk Sequence priority, and so forth until all of the Trunk Sequences are exhausted or the call is successfully dialed. Let's walk through a good example which uses these configurations so you can see how to put one together and what goes where. You'll note that this sequence is exactly backwards from the way you configure new VoIP providers using AMP, i.e. you first set up the trunk and then the outbound rule to support the trunk. As unintuitive as it may appear, it really works quite well ... if you first sit down with a pencil and figure out what you're trying to do. It turns out that's pretty good advice for most programming tasks.


Since we know that FWD provides free outbound dialing for toll-free (800 number) calls, let's use FWD as our top Trunk Sequence priority for placing outbound 800 calls. You can't beat free! We'll assume you've already set up your free FWD account. If not, go here first. Now we want to create a FWD trunk entry using AMP->Setup->Trunks->Add IAX2 Trunk. IAX2 is the native protocol that Asterisk speaks so use it whenever you can to eliminate pesky NAT problems. Just be sure UDP port 4569 on your firewall is redirected to the internal IP address of your Asterisk server. Now back to AMP. In the General Settings, plug in a Caller ID entry, e.g. "DOE JOHN <695695>" where John Doe is your name and 695695 is your FWD number. FWD expects 800 number calls to be in the following format: *18002221212, but that isn't really the way you dial them since there isn't an asterisk on your phone. In the Outgoing Dial Rules for your FWD trunk, enter the following which tells Asterisk to add an asterisk (*) prefix before dialing 18xx calls or add 1 plus an asterisk (*) before dialing 8xx calls. This way FWD can correctly handle calls whether you dial 18002221212 or 8002221212 on your phone. The main point to remember here is that you use Trunk Dial Rules to reformat a dialed number into something the VoIP provider is expecting to see when the call arrives from your Asterisk server. And typically you use Outbound Dial Patterns to interpret the numbers dialed on a telephone instrument and to route the call accordingly. So here's the code for the Outgoing Dial Rules in your Trunk setup for FWD:

*+18XXNXXXXXX
*1+8XXNXXXXXX

Here's the rest of the code you'll need to make and receive calls using FWD. In the FWD Trunk's Outgoing settings, enter fwd for the Trunk Name, and enter the following for the Peer Details using your callerid, username, and password from FWD registration. WARNING: If you cut and paste code from these articles and the code contains quotation marks (such as below), be sure to replace the WordPress-inserted, front and back quotes with normal quotation marks, or you'll send Asterisk into the ozone.

allow=ulaw
auth=md5
callerid="DOE JOHN" <695695>
disallow=all
host=iax2.fwdnet.net
qualify=yes
secret=yourFWDpasswordhere
type=peer
username=695695

For your FWD Incoming Settings, name your User Context iaxfwd and enter the following for the User Details:

allow=ulaw
auth=rsa
context=fwd-in
disallow=all
inkeys=freeworlddialup
type=user

For the Registration String, enter 695695:yourpasswordhere@iax2.fwdnet.net using your actual FWD phone number and password. Now save your settings and click the Red Bar to restart Asterisk.

You'll note in the Incoming Settings above, we're using a special context to manage incoming FWD calls: fwd-in. So we need to add some code to process the incoming FWD calls at the bottom of the extensions_custom.conf file. Do that now before you forget it. Don't forget to plug in your own FWD phone number in each line below and then save your file by clicking the Update button. Here's the code to cut and paste:

[fwd-in]
exten => 695695,1,NoOp(Incoming call for FWD #695695)
exten => 695695,2,Goto(from-internal-custom,111,1)
exten => 695695,3,Hangup

The above code will assure that your incoming FWD calls are processed by the autoattendant we built last week just like your other incoming calls.

Now we're ready to add an Outbound Route for our toll-free calls. Choose AMP->Setup->Outbound Routing. In the Add Route screen, name your new route TollFree. For Dial Patterns, enter the following:

1800NXXXXXX
1822NXXXXXX
1833NXXXXXX
1844NXXXXXX
1855NXXXXXX
1866NXXXXXX
1877NXXXXXX
1888NXXXXXX
800NXXXXXX
822NXXXXXX
833NXXXXXX
844NXXXXXX
855NXXXXXX
866NXXXXXX
877NXXXXXX
888NXXXXXX

The above code covers all of the existing and planned toll-free area codes in the United States and will be triggered whenever you dial 1 and a matching 8XX area code or just 8XX and a 7-digit number. For the primary Trunk Sequence, choose IAX2/fwd. If you also have an SPA-3000 connected to a PSTN (POTS) line, click add and choose SIP/pstn for the second Trunk Sequence. Click Submit Changes to add the new Outbound Route. Use the Up arrow beside the TollFree Outbound Route to move it up your list of routes so that it is just above all of your other long distance routes. Otherwise, these calls would be processed by the first matching long distance route which would mean you'd have to pay for the call with most VoIP providers. Now click the red bar to restart Asterisk. Note that 10-digit 800 calls (i.e. without a 1) using your PSTN line will fail unless you add 1+NXXNXXXXXX to the Outgoing Dial Rules for your SIP/pstn Trunk. Once you get all the changes entered, make a test call to an 800 number after starting the Asterisk Command Line Interface (CLI) which we covered in the last article. Your output on the CLI screen should look something like the following. You'll note that the highlighted text shows the call was placed using the proper Outbound Trunk: IAX2/fwd.

-- Executing Dial("SIP/204-4c88", "IAX2/fwd/*18005551212") in new stack
-- Called fwd/*18005551212
-- Call accepted by 65.39.205.121 (format ulaw)
-- Format for call is ulaw

AsteriskImplementing Prefix Dialing. There's one more Dial Plan concept you need to get under your belt, and we can demonstrate it by designing an Outbound Route to actually place calls to others with FWD phone numbers. Then, for your homework, we'll leave it to you to design Dial Plans that allow you to place calls to other VoIP providers' customers with whom FWD has peering agreements. There's a long list of them here, and all of these calls are absolutely FREE to anywhere in the world. Another one that's not in the list is using FWD to call BroadVoice numbers: **282 + Area Code + Number. And you also can call FWD numbers from BroadVoice but there may be a charge depending upon your plan: 011+0+393+FWDnumber. Post a comment with a correct dial plan that provides access to all the peering agreement customers' numbers, and you may or may not (more likely) win a prize. We'll only publish correct answers so don't worry about being embarrassed by an incorrect suggestion.

Now, for the missing piece, we need another FWD dial plan that let's you force calls to go out through your FWD trunk. This comes in handy for other providers as well. For example, you might want to dial an 8 prefix to force a call to be sent out to Voxee or 9 to force a call to be sent out through your PSTN (home phone) line. We use 393 (FWD spelled with the phone keys) as a prefix to place FWD calls. All of their numbers have either 5 or 6 digits so the numbers you'd dial would be 393-12345 or 393-123456. What we want the Outbound Route to do is strip off the 393 and then send the call along to our IAX2/fwd trunk for processing. Use AMP->Setup->Outbound Routing and in the Add Route screen, fill in OutFWD as the Route Name. For the Dial Pattern, use 393|XXXX. and don't forget the trailing period. The period tells Asterisk to accept any number (but at least one more) digit following seven initial digits which begin with 393. The 393| expression tells Asterisk to look for a number beginning with 393 and then discard the 393 prefix before sending the call on to the outbound trunk. Note that this dial pattern will avoid interference with local phone numbers beginning with 393 of exactly seven digits ... for those of you that still have local 7-digit dialing. The reason is that you'll have to dial at least 8 digits for this dial plan to be triggered. For the Trunk Sequence, choose IAX2/fwd. Click the Submit Changes button and then move the OutFWD route to the top of your Outbound Routes list. We do this to assure that Asterisk always processes dialed calls beginning with 393 by first examining whether the call can be handled by FWD. Now click the red bar to restart Asterisk. You can try placing a call to yourself by dialing 393 plus your FWD phone number. If you want a test incoming call from elsewhere, go to the Free World Dialup site here and log in with your FWD phone number and password.

Using the samples above, you now should be able to structure a Dial Plan for your Asterisk server which takes maximum advantage of the strong points and cost savings offered by various VoIP providers. For example, our own Asterisk@Home server now has the following Outbound Routes in the following order (from top to bottom):

  • OutFWD ... 393 prefix routes calls to Free World Dialup trunk after stripping 393 prefix
  • OutVoxee ... 9 prefix routes calls to Voxee trunk after stripping 9 prefix
  • OutTeliax ... 8 prefix routes calls to Teliax trunk after stripping 8 prefix
  • OutBroadvoice ... 7 prefix routes calls to BroadVoice trunk after stripping 7 prefix
  • OutPSTN ... 5 prefix routes calls to PSTN trunk after stripping 5 prefix
  • Local ... 404, 678, 770, and 470 prefix routes local Atlanta calls first to BroadVoice trunk and then to PSTN trunk
  • Georgia ... Calls with Georgia area codes are routed first to BroadVoice trunk and then to Voxee trunk and then to Teliax
  • TollFree ... Calls with U.S. toll-free prefix are routed first to FWD trunk and then to PSTN trunk
  • US ... Calls with ten-digit numbers or calls with a 1 prefix and ten additional digits are routed first to Voxee trunk and then to Teliax trunk
  • Server2 ... Calls with a 4 prefix are routed to our secondary Asterisk server for processing
  • The real beauty of structuring a Dial Plan with AMP along the lines that we've shown above is that, when a new VoIP provider comes along with a more cost effective plan down the road, you can add a new trunk for that provider and, in under a minute, adjust the outbound routes of your Asterisk system to take maximum advantage of that provider's strong points. Thereafter, every call placed on your system will use the new Dial Plan without any further training of end-users and without any disruption in service. Try that on your $250,000 Nortel or AT&T system. We'll be talking about the last entry in a future column so stay tuned.

    Disclaimer: Some of what you've read above might be construed by some as legal advice. It's not. It's merely advice learned the hard way through the school of hard knocks. If it saves you some grief or some money, great! But, if you need or want legal advice, hire a lawyer. Remember, you get what you pay for ... and you haven't paid us a dime.

    Finally, we're really sorry if we misled you with our headline. We really didn't mean it. Don't expect to ever hear that from a VoIP provider! And, yes, there are numerous additional articles in this series. You can read all of them by clicking here.

    Why Asterisk Matters: It’s Katrina, Stupid!

    blankOver the past eight weeks, we’ve written the better part of a book on how to quickly and effectively deploy Asterisk@Home PBX systems using hardware which many folks and virtually every corporation in America have sitting around gathering dust in a back room. For anyone that’s been reading between the lines, you already know that, with these Asterisk® servers running on low-end Pentium III hardware, you could quickly and inexpensively build and deploy a meshed communications network supporting the needs of tens if not hundreds of thousands of users. What Google did for searches with lots of small, networked, redundant PCs, Asterisk could do for communications using virtually identical (low-cost) hardware. And the typical build time: under an hour! If you’re in the continuity of operations or disaster recovery business, you need to take a hard, careful look at Asterisk and especially Asterisk@Home. Our tutorials will get you started.

    Also during the past month, our country endured one of the worst natural disasters in its history, Hurricane Katrina. If you’ve been following the news, you’ve probably reached the same conclusions that we have. There were at least four major shortcomings which arose after Katrina: food, water, security, and communications. We’ll leave the first three to others who are more qualified to solve them. We’re more concerned about the last one. The total absence of a communications solution during this disaster appears to be merely the tip of a very large iceberg: the lack of creative technical talent in our country with the capacity to solve basic technical problems which don’t follow a preordained script especially after a catastrophic event. It seems the key ingredient in everyone’s disaster recovery plan was cellphones. Wrong!

    Where were our self-proclaimed technology geniuses after Katrina: Bill Gates, Steve Jobs, Eric Schmidt, Larry Ellison, Michael Dell, Andy Grove, Larry Page, and on and on? Where were our whiz kids when the country desperately needed some technical help? Was there a trade show that we all missed somewhere? Oh, I almost forgot. There was a new iPhone to introduce. Too bad they don’t work without a functioning cellphone tower. Hint to all billionaires: You Can’t Take It With You. And where were all those football blimps when we could have used them for something other than a 15-second panoramic shot above the SuperDome? Is all the glorious talk of WiMax just hot air? Was there no better place to try out this technology than New Orleans these last couple weeks? Come on, folks! The feds, of course, had no problem ordering up the most costly solution on the planet to meet their own communications needs. But what would you expect from an aerospace contractor selling $500 toilet seats?

    Bush Vacation - courtesy of half the sites on the InternetWhat became abundantly clear very quickly was that there weren’t any technical geniuses (or any other genius flavors) in FEMA or elsewhere in the federal government, state governments, or local municipalities. Is there only one Rudi Guiliani, Crisis Manager, in the whole damn country? We probably should have anticipated our government’s technical shortcomings after reading how the FBI has been trying to build a unified database for one government agency, itself, FOR TEN YEARS. But wouldn’t you think the same folks that can communicate from Earth to Mars could wire some tin cans together when folks really needed some help getting in touch with their loved ones. As someone who served in the federal government for over 30 years, I’m embarrassed to see how little talent remains and how many bureaucrats and politicians are on the payroll who care about nothing more than themselves and their next photo op. And you wondered why everybody was outsourcing their technology jobs to India!

    Some of you are probably snickering saying "but there weren’t any phone lines or cable modems, dummy." Ah, but you can buy a modified Pringles can that will transmit and receive the data equivalent of ten T1 lines for a distance of 10 MILES for under $50. You can even buy them at CompUSA (or you could have stolen them with the police if you were in New Orleans). Or you could build two yourself for under $10! Think what $10,000 could have built. And just think of the media coverage Pringles would have gotten … for free. After all, that’s what seems to matter. Now we need electricity. Fine. You can walk in any Home Depot or Lowe’s and buy a generator with networking power to spare for under $500. Add another $30 for a week’s worth of gasoline and presto: instant network and communications for thousands of people. 200 generators, 400 Pringles cans, and a truckload of clunker PCs and wireless access points comes to a little over $100,000, and there would have been communications to spare. Is there no one left at any level of government that can create a functional, low-tech solution that works without turning to AT&T or Sprint … who was also dead in the water, literally. Guess where Sprint’s major network hub was located? You guessed it: New Orleans, Louisiana. Now there’s a technology breakthrough: build your communications hub below sea level.

    Think what $1 million could have built for the people in the hands of a creative technology group of Americans. The only trouble with Microsoft and America’s other technology giants is there are too many overweight millionaires on the payroll that care about little else than the value of their stock portfolios. Here’s something to ponder. When some of those nutty guys in the Middle East decide its time to blow up something new and they choose one of your corporate campuses, what’s your stock going to be worth then? At least put yourself together an Asterisk box so you and your colleagues can conference and whine together.

    I’m sleeping better now knowing that New Orleans is going to be rebuilt … whatever it costs. After all, George Bush told the world he used to party there. But what about the poor folks in Mississippi and L.A. That’s Lower Alabama for those of you who’ve never been there. Hopefully someone will come along who still can make a difference in the communities that don’t have and really don’t want another Bourbon Street.

    Update. CNN carried the following story about this very subject on Wednesday, October 5, 2005.

    Who Is This Guy? Ward Mundy is a retired attorney who spent more than 30 years providing legal and technology assistance to the federal courts in the United States.

    Putting the Pedal to the Metal with Asterisk@Home

    blankPeaceful Coexistence. This is the fifth in our Asterisk@Home series. Read the first four parts (I, II, III and IV), and then this one will be a breeze. Now that we have our Asterisk® server up and running and our Sipura SPA-3000 configured, you've probably noticed a few quirks. Specifically, both Asterisk and the Sipura device are designed to control some of the same functions such as call forwarding, call forwarding on busy, call waiting, and do not disturb. Where possible, we want the Asterisk box to control these functions because you may have more trunks than your Ma Bell PSTN line, and the Sipura box is only designed to manage your incoming PSTN trunk. That would mean your SIP and IAX2 trunks would be left without support for call forwarding, call waiting, and do not disturb which isn't what we want. There's a simple way to fix this. Point a web browser at your Sipura device's IP address, click on Admin Login and then Advanced. Now click the Regional tab and scroll down to the Vertical Service Activation Codes section. Then delete the following entries: Blind Transfer Code, Cfwd All Act Code, Cfwd All Deact Code, Cfwd Busy Act Code, Cfwd Busy Deact Code, CW Per Call Act Code, CW Per Call Deact Code, Block ANC Act Code, DND Act Code, DND Deact Code, and Conference Act Code. Now save your changes by clicking the Submit All Changes Button at the bottom of the form. Your SPA-3000 will reboot, and you're all set. Now the following functions will work through Asterisk from any extension on your system:

  • *61 Local weather forecast
  • *62 Schedule wakeup call
  • *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
  • Wading into the Weeds. As best we could, we've tried to keep the really technical parts of Asterisk shrouded in secrecy because there's really no reason to fiddle with most of this stuff, particularly if you don't really understand what you're doing. There are times, however, when things don't work or lines ring busy when they shouldn't, and you at least need to know where to look to find the information that others (not me!) will need to help you with your problem. The Asterisk forums at SourceForge and Voxilla are tremendous resources when something comes unglued, and you'll also learn a lot just by reading some of the issues others have faced. If you're new to forums, there's one cardinal rule you need to observe. Search for an existing answer to your problem first. If you don't find it, then post a question. This will save you the embarrassment of being flamed for repeating a question that already has been answered.

    blankSo where do you look to see what's going on with your system. If you're getting a fast busy when you try to place calls or, if people calling you are getting a fast busy when they dial your number, the first thing to check is whether your connections to your VoIP providers have been successfully established. Fire up your web browser and point it at your Asterisk server's IP address. Then choose AMP->Maintenance and click on Asterisk Info. The sections we're primarily interested in are Sip Peers and IAX2 Sip Registry. All of your connections to BroadVoice, Voxee, and other VoIP providers will have an entry here assuming you've created a Trunk for each of them. In the far right column of each entry should be an entry which says "Registered." If it says something else, you've got a registration problem which typically is caused by your providing an incorrect account name and/or password, or your VoIP provider's service may be down. If you're using a Sipura SPA-3000 to manage your PSTN (home phone) line, then you'll need to point your web browser at the IP address of your SPA-3000, click Admin login, then Advanced, and choose the Info tab on the far left. Check the Registration State in both the Line 1 Status section and the PSTN Line Status section. Both of these should also show Registered. If not, review the setup steps for the SPA-3000 in our previous articles. You've missed a step or a password somewhere. The next place to turn for information is Asterisk's debug log. You can print out the last 2,000 lines of the file by going to AMP->Maintenance->Log Files and clicking on Asterisk Full debug log. Or, if you're a glutton for punishment, go to a command prompt, change to /var/log/asterisk, and print out the full file. Yep, that's the name of the file: full.

    Asterisk also has an interactive mode called the Command Line Interface (CLI) so that you can actually watch what's happening when calls are placed and received. This works best if you connect to your Asterisk server through SSH from a Mac or PC. SSH comes with every Mac and the syntax is simple: ssh root@AsteriskIPaddress. If you're still chained to Microsoft, download Putty from the Mother Country, and you can do the same thing using a Windows machine. Once you're logged in as root, issue the following command: asterisk -r. Quit ends your Asterisk CLI session, and exit logs you out of your SSH session. Now issue the command: set verbose 5 to get maximum information. Place a call and watch what happens. HELP will list all of the various commands which are available. Be careful! Some of them will really screw up your system if you don't know what you're doing. Save dialplan, for example, sounds fairly innocuous but it permanently deletes your existing dialplan with no backup! If you have problems with SIP connections, review the SIP commands and turn debug on for a particular IP address or channel. If you have Zap, IAX2, or PRI connection issues, you can do something similar for the addresses and channels of these interfaces. Before you use any of the commands in CLI, give a careful read to the detailed explanations of the commands which can be found at this link on VOIP-Info.org.

    blankSystem Backups. If you do nothing else with your Asterisk server, at least configure the system to make regular backups and download at least one backup to another computer. To download a backup to another computer, go to the remote computer and use a web browser to access AMP on your Asterisk server. Choose, Maintenance, then Backup. Now Ctrl-Click (Mac) or Right-Click (PC) on Download Backup and save it to a safe place on your local machine. To configure regular backups on the Asterisk server itself (remember that these don't help you if you have a disk crash!), go to AMP->Setup->Backup and Restore and choose Add Backup Schedule. Stop here for a moment and go to your Asterisk machine, log in as root, and change to the following directory: cd /var/lib/asterisk. Make a new directory: mkdir backups. Change the owner of the directory: chown asterisk backups. Change the group ownership of the directory: chgrp asterisk backups. Now return to AMP's Add Backup Schedule screen. Name your backup schedule Daily. Click Yes for all the buttons. Leave Follow Schedule Below selected. Click 2 in both the hour and minute columns, and make sure the other three entries each have All selected. This means you'll get a backup every day at 2:02 am in your /var/lib/asterisk/backups/daily folder. Click Submit Changes to activate the backup schedule. Don't forget to check the directory from time to time and remove some of the older backups. Periodically, make an external backup to a remote machine just be on the safe side. Now you'll sleep better.

    Choosing VoIP Providers. One of the beauties of having your own PBX is being able to easily add and change VoIP providers. Because Voice Over IP technology is still experiencing some growing pains, putting all your eggs in one basket for IP telephony is a very bad idea. A number of readers have written asking for specific provider recommendations beyond those outlined in some of these articles. We're always shopping for the most reliable and least costly solutions just as you are and THINGS CHANGE. BroadVoice, for example, which has been one of our favorites and is especially flexible for those with Asterisk servers is having some internal problems apparently. Three of the company's founders including the CEO, his wife, and their top guru all abruptly left BroadVoice last month ... about the same time BroadVoice reportedly implemented some shady retroactive billing practices. Read this thread on Voxilla for more information. You really can't beat Voxee for pricing on most outgoing calls, but they don't provide incoming phone numbers (yet anyway). For a really good selection of incoming numbers and reliable service, we like Teliax but, unlike most in the VoIP industry, they charge for incoming and toll-free calls (2¢ a minute) with minimum one minute billing plus $5/month per phone number/DID. Don't expect them to be around too long. They're just too pricey. Secret clue for Teliax: folks aren't drawn to the VoIP solution just to find a way to pay more for their phone service than they're currently paying Ma Bell. Sorry boys but the cellphone pricing model just isn't going to fly in the VoIP arena. A footnote on Teliax: One of the extremely cool things you can do with a Teliax IAX2 connection to your server is spoof your CallerID number. If you want to have a little fun, put on a Barry White album and then call your buddy late one night after setting your CallerIDNumber to his girlfriend's home phone number ... and then lock all your doors and windows.


    Another top-rated provider is VoicePulse. They offer all-you-can-eat plans starting at $14.95 (these plans use a locked terminal adapter!) and pay-as-you-go service called VoicePulse Connect with local numbers/DIDs priced at $11 per month with unlimited free incoming calls. That's just about double the price of a comparable BYOD-Lite account with BroadVoice. Others have recommended getting a FWD account and using it with a free DID from Washington state using IPkall. This gives you free incoming calls albeit to a Washington state telephone number. Our experience with FWD has been just short of terrible. And our one inviolate rule for incoming calls is your phone needs to ring when someone calls. This is simply not negotiable in our book. Our particular FWD account failed to register about 90% of the time during our testing these past few weeks so we've pretty much written off FWD. The good news is that just because FWD was disappointing doesn't mean you can't use an IPkall number with Asterisk to get free incoming calls from a real Washington state PSTN number. In fact, your number will be just outside Bill Gates' hometown. For this to work, you'll need a fully qualified domain for your Asterisk server as we previously discussed. Then you'll need to make certain that your firewall redirects incoming UDP traffic on ports 5060 through 5082 and 10000 through 20000 to the internal IP address of your Asterisk server. Finally create an entry in the [from-internal-custom] context of your extensions_custom.conf file that looks like this substituting one of your phone extensions for 204 in lines 1 and 2. Why not just use an actual extension number with ipkall.com? Because this way you can control incoming calls from that specific VoIP provider without divulging any information about the actual extensions in your Asterisk system.

    exten => ipkall,1,dial(SIP/204,20,m)
    exten => ipkall,2,VoiceMail(204@default)
    exten => ipkall,3,Hangup

    You'll also need to make sure you have two lines in the [General] context of your sip.conf file. The first line should contain the actual public IP address of your Asterisk server. If you don't know it, click here. The second line should be the private subnet of your internal network, typically 192.168.0.0 or 192.168.1.0. The subnet mask (255.255.255.0) should be correct for most of you. With these settings, you shouldn't have to turn on NAT for your individual phone instruments. Just remember to update your externip address whenever your ISP changes your dynamic IP address if that's what you have. The third line is a little fix (from the Voxilla forums) that solves a nagging problem with incoming BroadVoice calls not actually ringing at the caller's end. Just thought we'd fix it while we were here.

    externip = 24.99.153.83
    localnet=192.168.0.0/255.255.255.0
    progressinband=yes

    Restart Asterisk and then go to ipkall.com and sign up for your free telephone number. For your SIP phone number, use ipkall. For your SIP Proxy, use the fully qualified domain name for your Asterisk server. Use your legitimate email address to assure that you receive your signup information. Think up a four digit PIN to access your IPkall account in the future. And change the seconds to voicemail to a number such as 90 so that it never gets used. Now sit back and wait for your signup email which will have your new phone number in area code 360. Within an hour, anyone will be able to dial your 360 phone number and connect through your Asterisk server to the extension you specified above. It doesn't get much easier (or cheaper!) than that. Ours was operational in just under 60 minutes. If you ever want to disable the number temporarily or permanently, all you have to do is comment out the three ipkall lines in your extensions_custom.conf file with a leading semicolon and restart Asterisk.

    Here's a good list of all the VoIP providers out there if you want to explore your options further.


    So which providers do we use? Well, it's a combination of a $49 a month BellSouth PSTN line and BroadVoice's $9.95 in-state SIP calling plan with free incoming calls to handle all incoming calls as well as outgoing local and in-state calls (which make up about 90% of our usage) and Voxee's pay-as-you-go, penny-a-minute service for U.S. long distance calls. Guess which one we're about to disconnect? Then we have ipKall and Teliax's pay-as-you-go service for additional redundancy. If all of these services fail, telephones will be the least of our worries. We don't do much international calling (other than to some of you) so that wasn't a big issue for us. Your mileage may vary depending upon your calling patterns. Based upon the current allegations floating around, BroadVoice would be our very last choice if heavy international calling (even to girlfriends or family) were a priority. Here's why. Too bad.

    blankBuilding Autoattendants and Interactive Voice Response (IVR) Systems. Entire books have been written and literally hundreds of multi-thousand dollar telephony courses can be purchased to learn about good design and implementation techniques for autoattendants and IVR systems. Our discussion is going to focus on the technical aspects of implementing such a system with Asterisk@Home. But, if you want to keep your friends and your customers, you really should learn something about IVR design before implementing your own version of IVR Hell. Here's a free site with loads of good tips about IVR design. A little additional time with Google will work wonders, too.

    The folks that brought us the Asterisk Management Portal (AMP) got it almost right with their Digital Receptionist. You access it by going to AMP->Setup->Digital Receptionist. The drill for today goes something like this. First, sketch out on a piece of paper what options you want to offer your callers. Whether you like it or not, callers will have the option of keying in an actual extension number to dial or pressing the pound key to access your directory lookup service. We configured this in Part II. In any case, you'll probably want to tell callers about these two options plus any others you want to add. Second, we'll record the actual Main Menu for your new autoattendant. Third, we'll move it to its permanent home on your Asterisk server. And then we'll use AMP to tweak our extensions_custom config file. And finally, we'll use AMP's Digital Receptionist to do the heavy lifting of building the actual IVR code for us. Just for fun, play along and build the sample below. Then you can change it to your heart's content.

    As we mentioned, the AMP folks got it just about right, but not quite. Just about everything works except actually naming and placing your voice prompt files (such as For Bob, press 1; for Betty, press 2, etc.) in the proper locations. The AMP solution also uses .wav files which are roughly 50 times the size of equivalent .gsm files. So we're going to do things a little differently, but the result will be the same. It does mean you have to endure a couple of error messages from AMP, but who cares if it works when we're done. Right? So we begin by thinking through what we want our home menu choices to be when someone calls. We decide that callers should be able to press 1 to ring Bob's phone, 2 to ring Bob's cellphone, or 3 to leave a voicemail message. Pressing 4 will give password-protected access to an outside line, and pressing 5 will play back today's weather forecast. We built these last two applications previously but we'll modify them a bit to support AMP's IVR design plan.

    In our last article, we covered Recording Voice Prompts with Asterisk. If you've forgotten how, go back and read that section again. Now that you're up to speed, pick up a phone and dial 456. Then say "Welcome to Bob's Place. Press 1 for Bob, 2 for Bob's cellphone, 3 to leave a message, 4 to access an outside line, or 5 for today's local weather forecast. You can also access Bob's directory by pressing the pound key." When you finish speaking, press the pound key (#) to play back and then save your recording into the /tmp folder with a filename of asterisk-recording.gsm. If you make a mistake, you just repeat the drill which will overwrite the previous file. Now go to your Asterisk terminal and login as root. Now move your recording to it's final home and delete the corresponding .wav file if it exists:

    mv /tmp/asterisk-recording.gsm /var/lib/asterisk/sounds/custom/aa_1.gsm
    rm /var/lib/asterisk/sounds/custom/aa_1.wav

    Now go back to your Mac or PC and bring up AMP using your web browser. Before we get to the Digital Receptionist, we need to make a couple additions to our extensions_custom.conf file. So click on the Maintenance tab, click Config Edit, and then click extensions_custom.conf. Insert the following code at the bottom of the file substituting your cell phone number in the last context. Then save the file by clicking the Update button.

    [custom-weather]
    exten => s,1,Answer
    exten => s,2,AGI(weather.agi)
    exten => s,3,Hangup

    [custom-callout]
    exten => s,1,Authenticate(1234588)
    exten => s,2,Background(pls-wait-connect-call)
    exten => s,3,DISA(no-password|from-internal)

    [custom-cellphone]
    exten => s,1,Dial(SIP/6781234567@bv,60,r)
    exten => s,2,Hangup

    Now go to AMP->Setup->Digital Receptionist and click Create a New Voice Menu. Provide your extension number when prompted. Ignore Step 1 and Step 2 and the error message in the Record Menu. Name your menu "Main Menu" and give a brief summary of what it is -- "Main Asterisk Autoattendant." In the Options for Menu screen, leave the context as Default, and enter 5 for the number of options. When you click Continue, you'll be prompted to actually enter your choices for the five options. Enter the following:

  • Option #1 ... click Extension button ... choose Bob's extension from pull-down
  • Option #2 ... click Custom App button ... enter the following: custom-cellphone,s,1
  • Option #3 ... click Voicemail button ... choose Bob's extension from pull-down
  • Option #4 ... click Custom App button ... enter the following: custom-callout,s,1
  • Option #5 ... click Custom App button ... enter the following: custom-weather,s,1
  • If you want a default AutoAttendant option for those that don't press any buttons, then just add a final menu selection and change it's number from 6 to the letter t (for timeout) with whatever option you want to implement for that choice.

    Now click the Continue button to save your changes and then the red bar to reload Asterisk. Then go to AMP->Setup->Incoming Calls and choose Digital Receptionist->Main Menu for both your day time and evening call answering choice. Save your changes and click the red button to restart Asterisk. You now can test your autoattendant by calling your home or BroadVoice number.

    For those that also want to control your incoming PSTN line from your Sipura SPA-3000, replace your existing exten=>99 code in extensions_custom.conf with the following. WARNING: If you cut and paste code from these articles and the code contains quotation marks (such as below), be sure to replace the WordPress-inserted, front and back quotes with normal quotation marks, or you’ll send Asterisk into the ozone.

    exten => 99,1,GotoIf($["${CALLERIDNUM:0:2}" = "00"]?2:3)
    exten => 99,2,SetCIDNum(${CALLERIDNUM:2})
    exten => 99,3,SetMusicOnHold(default)
    exten => 99,4,Goto(aa_1,s,1)

    The last line is the important one. There's a context for each autoattendant, and they're numbered starting with 1. AMP->Digital Receptionist provides the actual names (after the word "Menu").


    The Stealth AutoAttendant. For home use especially, you may prefer something a bit less intimidating for callers. Last week, we built a welcome message which said something like "Welcome to the Rockefellers. Someone will be right with you." We stored the welcome message in the custom sounds folder. This can be used as kind of a silent autoattendant. In short, for regular callers, they just hear music on hold while calls are transferred to the extensions you designate. For family that know it's really an autoattendant, you can dial certain codes to make Asterisk jump through certain hoops so long as you start dialing immediately after the welcome message begins playing. Here's how we've done it for our home. In the [from-internal-custom] context of the extensions_custom.conf file, add an extension which will trigger the AutoAttendant welcome message:

    exten => 111,1,Zapateller(answer|nocallerid)
    exten => 111,2,Wait(1)
    exten => 111,3,SetMusicOnHold(default)
    exten => 111,4,GotoIf($["${CALLERIDNUM}" = ""]?who-r-u,s,1)
    exten => 111,5,GotoIf($["foo${CALLERIDNUM}" = "foo"]?who-r-u,s,1)
    exten => 111,6,GotoIf($["${CALLERIDNAME:0:9}" = "Anonymous"]?who-r-u,s,1)
    exten => 111,7,GotoIf($["${CALLERIDNAME:0:7}" = "Unknown"]?who-r-u,s,1)
    exten => 111,8,GotoIf($["${CALLERIDNUM:0:7}" = "Private"]?who-r-u,s,1)
    exten => 111,9,GotoIf($["${CALLERIDNAME:0:7}" = "Private"]?who-r-u,s,1)
    exten => 111,10,GotoIf($["${CALLERIDNUM:0:10}" = "Restricted"]?who-r-u,s,1)
    exten => 111,11,GotoIf($["${CALLERIDNAME:0:11}" = "OUT OF AREA"]?who-r-u,s,1)
    exten => 111,12,GotoIf($["${CALLERIDNUM:0:4}" = "PSTN"]?who-r-u,s,1)
    exten => 111,13,GotoIf($["${CALLERIDNAME:0:4}" = "PSTN"]?who-r-u,s,1)
    exten => 111,14,DigitTimeout,3
    exten => 111,15,ResponseTimeout,3
    exten => 111,16,Background(custom/welcome)

    exten => 0,1,Background(pls-hold-while-try)
    exten => 0,2,Dial(local/200@from-internal,20,m)
    exten => 0,3,VoiceMail(200@default)
    exten => 0,4,Hangup
    exten => 1,1,Background(pls-hold-while-try)
    exten => 1,2,Dial(local/222@from-internal,20,m)
    exten => 1,3,VoiceMail(204@default)
    exten => 1,4,Hangup
    exten => 4,1,Authenticate(1234588)
    exten => 4,2,Background(pls-wait-connect-call)
    exten => 4,3,DISA(no-password|from-internal)

    exten => 2XX,1,Background(pls-hold-while-try)
    exten => 2XX,2,Dial(local/${EXTEN}@from-internal,20,m)
    exten => 2XX,3,VoiceMail(${EXTEN}@default)
    exten => 2XX,4,Hangup
    exten => 2XX,103,Voicemail(${EXTEN}@default)
    exten => 2XX,104,Hangup

    exten => t,1,Background(pls-hold-while-try)
    exten => t,2,Dial(local/204@from-internal,20,m)
    exten => t,3,VoiceMail(204@default)
    exten => t,4,Hangup

    exten => i,1,Playback(wrong-try-again-smarty)
    exten => i,2,Goto(111,16)

    At the bottom of the extensions_custom.conf file, add the two following contexts:

    [who-r-u]
    exten => s,1,Background(privacy-unident)
    exten => s,2,Background(vm-rec-name)
    exten => s,3,Wait(2)
    exten => s,4,Record(/tmp/asterisk-stranger:gsm|5|15)
    exten => s,5,Background(pls-hold-while-try)
    exten => s,6,Goto(ext-park,70,1)
    exten => s,7,VoiceMail(200@default)
    exten => s,8,Playback(Goodbye)
    exten => s,9,Hangup

    [ext-park]
    exten => 70,1,Answer
    exten => 70,2,SetMusicOnHold(default)
    exten => 70,3,ParkAndAnnounce(asterisk-friend:/tmp/asterisk-stranger:vm-isonphone:at-following-number:PARKED|40|local/222@from-internal|who-r-u,s,7)
    exten => 70,4,Hangup

    Now create an additional extension on your Asterisk server to process incoming calls, e.g. 205. Using a softphone, connect to that extension and then place a call to *72111 which tells Asterisk to forward incoming calls on this extension 205 to extension 111. You never have to touch extension 205 again. Now using AMP->Setup->Incoming Calls, send incoming calls to extension 205. We have to jump through the double extension hoop (205 and then 111) because AMP only recognizes extensions created in AMP and not custom extensions which you've built in extensions_custom.conf. If you want to extend this to also manage your SPA-3000 incoming PSTN calls, then you'll need to modify your exten=>99 block of code from last week to call extension 205 (only!).


    Let's cover a little of what the code above actually does so that you can make changes and enhancements if you want to. The exten=>111 section of the code actually processes the incoming call to this extension. Zapateller is a special information tone which will be played to callers who have CallerID disabled. It also causes most automated telemarketing systems to hang up and place your phone number in their Do-Not-Call database. Others won't hear the tone sequence at all. Lines 4 through 11 attempt to identify all the various messages which are sent when someone has CallerID disabled. Lines 12 and 13 handle incoming PSTN calls with no CallerID from your SPA-3000. If there's any match, these callers will be prompted to say their name after which their call will be parked automatically on an extension (beginning with 71). Asterisk figures out the next empty parking space so you don't have to worry about it. You do need to modify the [ext-park] context code (line 3) to specify the extension, extensions, or ring group where you want this incoming call announced. We use 222 as a ring group for our entire house. So our phones will ring, we answer, and Asterisk says "Asterisk is your friend. John Doe is on the phone at the following number: 71." John Doe is whatever name the caller recorded above in the caller's own voice. We then hang up the phone, pick it up again, and dial 71 to connect to John Doe, who is listening to music while waiting. If you don't want to talk to John Doe, then don't dial 71 and sooner or later John Doe will get tired of the elevator music and hang up. Actually exten=>s,7 specifies which voicemail account will be used in the event of no parked call answer within 40 seconds. Be sure to change it to one of your working voicemail extensions.

    For incoming callers with CallerID, the system will play "Welcome to the Rockefellers. Please hold while we connect your call." Music on hold plays and the extension, extensions, or ring group specified in exten=>t,2 (we use 204 for our cordless phones) will ring assuming the caller presses no buttons. If there's no answer in 20 seconds, exten=>t,3 sends them to voicemail for extension 204. You can change these extensions to suit your needs. The exten=>2XX code block allows callers (who know our little secret) to actually dial a 200-299 extension within our home. If your extensions are numbered differently, just modify 2XX to match them. The exten=>0 code rings our office if someone presses 0. The exten=>1 code rings our ring group (all phones) if someone presses 1. And the exten=>4 code prompts for a password (1234588) and then gives outside dial tone to place a call through BroadVoice or the PSTN line or our other VoIP providers. If the caller enters any other number, the exten=>i code block plays a "try again, dummy" message.

    Special Filters for Special People. Finally, if you're like most mere mortals, there are some "special" callers with CallerID enabled that you'd just prefer to never speak to again. Remember, if someone turns off CallerID, we'll catch them in our [who-r-u] tangled web. But for old girlfriends, ex-wives, and former stock brokers, we need some special processing. Asterisk handles this with ease in a couple of different ways. We'll cover the blacklist database in a future article but, for now, just add lines like the following at the top of the exten=>111 code above substituting the actual area code and numbers of the people you want to block:

    exten => 111/2565551212,1,Congestion
    exten => 111/6785551212,1,Congestion
    exten => 111/3215551212,1,Congestion

    Why Use Asterisk@Home and Not Roll Your Own? One of our favorite pundits on Voxilla summed it up this way:

    After using Asterisk@Home for three months, we haven't found a single thing we couldn't do that someone with a roll-your-own version of Asterisk could. Asterisk@Home is not crippled in any way. In fact, it's just the opposite. It's not only full-blown Asterisk but it's also AMP (Asterisk Management Panel, think of it as PHPmyAdmin for Asterisk) plus functioning music on hold (just try to get it working on a vanilla Linux box!) plus voice support for any speech application you can dream up plus a Flash Operator Panel plus ring groups plus calling queues plus conferencing plus DID routing plus SQL-compliant Call Detail Reporting plus SugarCRM contact management with integrated dialing plus SpanDSP fax support plus Microsoft Outlook TAPI integration with a Microsoft TAPI gateway (that works!) plus Apache, PHP, SSH, SFTP, SendMail, Web Mail, and MySQL integration plus Cisco XML support (to load your contact management info into your Cisco IP phones) plus xPL for Home Automation plus H.323 NetMeeting support plus turnkey support for SIP, IAX2, auto-configuring ZAP channels, and ENUM.

    What we have found is that we can implement solutions for clients in a couple of minutes or hours that would have taken weeks or months to learn to do had we gone the roll-your-own route. That includes building IVR and AutoAttendant solutions literally in minutes, supporting five or more VoIP providers and numerous departments each with numerous phones of all flavors, implementing complex dialing rules, remote phone access, voicemail with email and SMS alerts, and out-of-the-box support for virtually every 3-digit calling feature provided by local Baby Bells.

    Are there folks that want to master calling plans, extension syntax, contexts, Linux, Apache, SendMail, MySQL, PHPmyAdmin, WebMin, Web Mail, Asterisk and all its add-on's plus Linux dependency hell? Absolutely. But Asterisk@Home doesn't preclude your using anything you learn. It just gives you an incredible, leveraged head start. Asterisk@Home is a deceptive moniker. It's not stripped-down, crippled, or condensed in any way. Quite the contrary, it's Asterisk on Steroids, plain and simple. Worked great for Major League Baseball, didn't it?

    Amen, Brother! Well, we've covered a lot of territory today. It ought to be sufficient to keep you busy while we think of something else to write about. Enjoy!


    Some Recent Nerd Vittles Articles of Interest...

    Turbocharging Your Asterisk@Home PBX

    This is the fourth in our series of articles on the Asterisk® PBX. You'll be much the wiser and less frustrated reading this if you begin with Part I. Then read Part II. And then read Part III. Then return here.

    Voxee.com30 minutes and 2 cents. That's how long it took to configure a backup VoIP provider and the total cost of testing seven outbound calls in the U.S. while configuring last week's CallMe application to use the backup provider. Our choice was Voxee.com, and nobody could make it much easier or charge much less. Outgoing calls within the U.S. or to Canada, London, Paris, and most of Germany are about a penny a minute, and U.S. calls are billed in 6 second increments. China costs 2¢ and most of Mexico is under a nickel. Any place with an island in the name ... well, it's almost cheaper to go there. But that's true with all providers. It costs $5 through PayPal to seed your Voxee account with call money. After that, it's pay as you go. There are no setup fees. In fact, if you opted for the BroadVoice BYOD-Lite plan which gives you free incoming calls and 100 minutes of outgoing calls a month, then Voxee is the perfect complement. You'll pay a penny a minute for most calls with increment rounding in the U.S. while BroadVoice charges 4¢ a minute in the U.S. with full minute rounding. The other good news is that Voxee supports Asterisk's native protocol IAX2 which makes configuring telephones at remote sites a breeze. Unlike SIP, there are no NAT headaches with IAX2. All you need is a phone that talks IAX. For more information, here's a great article. There's even an adapter to plug in POTS phones using IAX. In short, if you want to skip some SIP headaches, IAX is worth a careful look at both the telephone instrument and the service provider levels.

    Adding a Voxee Trunk. To add a Voxee trunk using Asterisk@Home, run AMP, choose Setup->Trunks->Add IAX2 Trunk. Maximum channels only matters if you want to restrict how many simultaneous outgoing calls through Voxee can be made. Otherwise, skip down to the middle of the form and under Outgoing Settings, name your trunk voxee. For the Peer Details, insert the following using your username and password assigned when you registered for an account:

    type=friend
    host=66.246.246.52
    username=some number assigned by Voxee goes here
    secret=the password you chose at Voxee goes here

    Now drop down to the Registration field and plug in the following: YourAcctNoHere:YourVoxeePasswordHere@66.246.246.52. Save your settings and click the red bar.

    Voxee.comAdding a Voxee Outbound Dialing Route. The final step is to add an outbound dialing route for your Voxee calls. The easiest way to set this up is to use a dialing prefix for Voxee calls, e.g. 9. So click Outbound Routing within AMP Setup. In the Add Route screen, name your new route OutVoxee. Whether to have a route password is, of course, up to you. For the dial strings, we recommend the following which lets you dial U.S. and foreign Voxee calls by dialing 9, 1, area code and number or 9, 011, country code, and number. The 9's will be stripped off before the dial string is sent to Asterisk to place the call. That's what the "9|" syntax means.

    9|011.
    9|1NXXNXXXXXX

    Now click on the Trunk Sequence pull-down and choose voxee for your outbound trunk. Click the Submit Changes button and then the red bar to update Asterisk. The only gotcha here is to be sure you dial a 9 and a 1 plus area code and number for U.S. calls. BroadVoice doesn't require a 1, but Voxee does. If you want to use the callme application we built last week, the correct syntax to have Asterisk place the call through Voxee is http://asterisk.dyndns.org/callme.php?number=iax2/voxee/16781234567 where asterisk.dyndns.org is the fully qualified domain name for your Asterisk server and 6781234567 is the phone number to be sent dialtone. For early readers of last week's column, please note that a code change was made on Saturday to avoid a potential security problem. It's explained in the comments section of last week's article if you want more details. Otherwise, just download the callme.php file again and replace your old version.

    Adding a Voicemail Address. We all are accustomed to having email addresses. So what's next: Voicemail Addresses, of course. Yes, with most SIP phones, you now can make calls to addresses that look just like your existing email address: homer@thesimpsons.com. If you've followed our tutorials thus far and have set up a fully-qualified domain name with dyndns.org or if you have your own domain pointing to your Asterisk server, then it's a two-minute operation to add voicemail addressing. Using AMP, click on the Maintenance tab and open extensions_custom.conf. Now add the following lines to the [from-internal-custom] context of the file substituting your real name for homer and adding an actual extension number on your Asterisk PBX for 1000:

    exten => homer,1,dial(SIP/1000,20,m)
    exten => home,2,VoiceMail(u1000@default)

    Once you save your changes and restart Asterisk, anyone can call you from any IP telephone or softphone by "dialing" sip:homer@asterisk.dyndns.org where homer is the name you plugged in to extensions_custom.conf and asterisk.dyndns.org is the fully-qualified domain name pointing to your Asterisk server. You can add as many additional accounts as desired. It's equally simple to match address names to the locations of IP phone extensions in your home or office: kitchen, office, playroom, pool, or whatever else you might need. And your friends can sign up for a SIPphone account or a Free World Dialup (FWD) account to make the calls ... which are free! Many phones don't even require the sip: prefix just as most web browsers no longer force you to type http://. For those that want to make your new voicemail address match your email address, here's a link that will tell you what's necessary to make it happen with your ISP.

    Sipura SPA-3000. There is no finer piece of telephony equipment you can purchase than the SPA-3000. As we mentioned last week (but it's worth repeating), the SPA-3000 does three things and does them all well. First, if you want to connect your existing home or office Ma Bell phone line to your Asterisk server so that incoming calls to your regular phone line can be managed with Asterisk just like your VoIP line, then the SPA-3000 is the way to go. It provides the best voice quality period. Second, if you want the flexibility and redundancy of having a Ma Bell line to place outgoing calls (especially for 911 service), then the SPA-3000 is just the ticket. You even get failover protection when your Internet service croaks. And finally, if you want to connect a 5.8 GHz wireless phone set to your Asterisk PBX for use throughout your home or office, the SPA-3000 is a must-have. With some careful shopping, you can purchase an "unlocked" SPA-3000 for just under $100. Unlocked means you can access the administrator setup features of the unit. You need this capability to use the device with an Asterisk PBX.


    Buying the SPA-3000 it turns out is the easy part. Getting it configured properly to work with Asterisk can be a nightmare, and we're not quite sure why. Actually, we are pretty sure why. Sipura is one of those fine companies that thinks only dealers can read so you'll have a hell of a time finding even a user's guide for the product. For those of you that can read, here it is. Another part of the problem is that Asterisk is an incredibly complex toolbox which can be set up in many, many different ways. So providing HOW-TO instructions to configure an SPA-3000 is a daunting task. We're assuming you are using Asterisk@Home and that you've configured Asterisk@Home according to our tutorials. If not, you may be in for a rough ride with the SPA-3000, but we'll try to provide some explanations as we go so that you can get back on track if your configuration differs from ours. We're also going to stick with Plain English rather than telephony jargon so, if you're a telephone geek or a purist, don't go postal. Just bear with us.

    Overview. There are four parts to the SPA-3000 configuration drill today. First, we'll set up the SPA-3000 hardware device and get everything plugged in correctly. Next we'll set up some Asterisk extensions to support the SPA-3000. Then we'll use a web browser to configure the SPA-3000 device to work with your Asterisk@Home server. And finally we'll add some bells and whistles to Asterisk to show off a little bit. When we're finished, your Asterisk server should be able to answer calls from both BroadVoice and your home/office Ma Bell phone line. And, you should be able to place calls through BroadVoice or your Ma Bell phone line using the phone or wireless phone set connected to the SPA-3000. As we did with the Asterisk server, we're assuming you have placed the SPA-3000 behind a rock-solid firewall. Otherwise, your phone bill may include thousands of dollars of calls to the Queen Mary that you didn't make.

    SPA-3000SPA-3000 Hardware Interfaces. So let's begin with the hardware basics. The SPA-3000 is designed to plug in to four different things:

  • The A/C adapter. It's pretty simple to figure out where to plug that in. Plug it in last!
  • The Network Jack. It's on the same side as the A/C adapter jack. Use a network cable to plug it into your 10/100 router or switch. We're assuming your network will provide a dynamic IP address to the SPA-3000 using a DHCP server. If not, fix that before plugging in the unit. The SPA-3000 also must be on the same network as your Asterisk server. Stated another way, the first three numbers in the IP address of your Asterisk box and your SPA-3000 must be the same, e.g. 192.168.0 or 192.168.1. And, yes, I know it is theoretically possible for them to be different, but who cares.
  • The Line Jack. A clearly marked jack on the opposite side of the SPA-3000 from the A/C adapter. Use a garden-variety phone cable to plug it into a phone jack in your home or office that receives incoming calls from Ma Bell, i.e. a POTS line.
  • The Phone Jack. A clearly marked jack on the opposite side of the SPA-3000 from the A/C adapter. Use a garden-variety phone cable to plug in a regular telephone or 5.8 GHz wireless phone set here. If you accidentally plug your home phone line into this jack, you'll probably fry the SPA-3000 the first time someone calls you on your home phone line.
  • Once you get all the wires connected, plug in the SPA-3000. Or, if you plugged it in before connecting it to your LAN, unplug it, count to 10, and plug it back in. Once all the lights stop blinking, pick up the telephone you connected to the Phone jack. You should hear a dial tone. If not, go back to square one. Otherwise, press **** which will access the Sipura configuration menu. Once Egor stops talking, press 110# to retrieve the IP address assigned to your unit. Write it down and hang up the phone. Rather than hard-code an IP address into the SPA-3000, our preference is to tell your router to reserve the IP address already assigned so that it is reassigned to the SPA-3000 whenever you turn it off and back on. We did the same thing with your Asterisk box in Part II so reread the IP Configuration of Asterisk section of that tutorial if you need a refresher.

    Configuring Asterisk to Support the SPA-3000. Before configuring the SPA-3000, let's turn our attention to Asterisk for a bit. You'll need three extensions to support the SPA-3000: one for incoming calls, one for outgoing calls, and one to handle the telephone instrument(s) you plugged into the Phone jack above. From your web browser, access AMP->Setup by going to the IP address of your Asterisk box. When prompted, type in maint for your username and whatever password you assigned to AMP previously. The trick to adding these three extensions is that you have to do everything twice because you can't enter all of the data for each extension in the original form. Aside from that, it's pretty straight-forward. You can obviously use any extension numbers you like, but using ours may make it simpler when we start configuring the SPA-3000. So here goes.

    SPA-3000 Incoming Extension. Click Extensions and fill out the Add an Extension form as follows:

  • Phone Protocol - leave it as is
  • Extension Number - 99
  • Extension Password - 121212 (Make up something good and use it for all three extensions. It's your phone bill!)
  • Full Name - PSTN Incoming
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - disabled
  • Click the Add Extension button to save your work and then the red bar to restart Asterisk. In the right column, click on PSTN Incoming - Extension 99 that you just added. Make sure your form looks like the following. Then save your changes and click the red bar to restart Asterisk.

  • Caller ID - PSTN Incoming <99>
  • Canreinvite - no
  • Context - from-internal
  • DTMFmode - RFC2833
  • Host - dynamic
  • NAT - never
  • Port - 5062 < --Important!
  • Qualify - no
  • Secret - your password goes here
  • Type - friend
  • Username - 99
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - disabled
  • Now click Submit Changes and then the red bar to update Asterisk. One down. Two to go.

    SPA-3000 Outgoing Extension. Click Extensions and fill out the Add an Extension form as follows:

  • Phone Protocol - leave it as is
  • Extension Number - 199
  • Extension Password - 121212 (Make up something good and use it for all three extensions. It's your phone bill!)
  • Full Name - PSTN
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - disabled
  • Click the Add Extension button to save your work and then the red bar to restart Asterisk. In the right column, click on PSTN - Extension 199 that you just added. Make sure your form looks like the following. Then save your changes and click the red bar to restart Asterisk.

  • Caller ID - PSTN <199>
  • Canreinvite - no
  • Context - from-internal
  • DTMFmode - RFC2833
  • Host - dynamic
  • NAT - never
  • Port - 5061 < --Important!
  • Qualify - no
  • Secret - your password goes here
  • Type - friend
  • Username - 199
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - disabled
  • Now click Submit Changes and then the red bar to update Asterisk. Two down. One to go.

    SPA-3000 Phone Extension. Click Extensions and fill out the Add an Extension form as follows:

  • Phone Protocol - leave it as is
  • Extension Number - 204
  • Extension Password - 121212 (Make up something good and use it for all three extensions. It's your phone bill!)
  • Full Name - Wireless
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - enabled
  • Voicemail Password - 121212 (Make it the same as the Extension password.)
  • Email Address - joe@schmo.com (Fill it in if you want voicemail delivery to your email account.)
  • Pager Email Address - joeschmo@messaging.sprintpcs.com (Fill it in if you want voicemail notification to your pager or cellphone.)
  • Email Attachment - yes (only if you want email delivery of voicemails)
  • Click the Add Extension button to save your work and then the red bar to restart Asterisk. In the right column, click on Wireless - Extension 204 that you just added. Make sure your form looks like the following. Then save your changes and click the red bar to restart Asterisk.

  • Caller ID - Cordless <204>
  • Canreinvite - no
  • Context - from-internal
  • DTMFmode - RFC2833
  • Host - dynamic
  • NAT - yes
  • Port - 5060 < --Important!
  • Qualify - yes
  • Secret - your password goes here
  • Type - friend
  • Username - 204
  • Record Incoming - leave it as is
  • Record Outgoing - leave it as is
  • Voicemail and Directory - enabled
  • Voicemail Password - 121212 (Make it the same as the Extension password.)
  • Email Address - joe@schmo.com (Fill it in if you want voicemail delivery to your email account.)
  • Pager Email Address - joeschmo@messaging.sprintpcs.com (Fill it in if you want voicemail notification to your pager or cellphone.)
  • Email Attachment - yes (only if you want email delivery of voicemails)
  • Click Submit Changes and then the red bar to update Asterisk. Done. Now we're finally ready to configure the SPA-3000.

    Configuring Your SPA-3000 for Asterisk. Before we get down to the nitty gritty, let's chat about what you'll have in place when we get finished. Our design plan is to support incoming calls from both your BroadVoice VoIP number and your POTS (aka Ma Bell or PSTN) number that you've had forever. For outgoing calls in the U.S., dialing a 7-digit number will place the call through your PSTN line. Dialing a 10-digit number will also place the call through your PSTN with BroadVoice as a backup. Dialing 1 and then area code and phone number will place the call through BroadVoice. Dialing 9 and then the area code and phone number will place the call through Voxee. Dialing 911 will place an emergency call through your PSTN (i.e. local) phone number. Dialing 011 calls for other countries will go out through Voxee. If you need another configuration, post your question using language similar to what we've outlined, and we'll respond to some of them in a future column. Don't ask questions about other VoIP providers. That's what the VoIP forums are for, and we've previously pointed you to several good ones. So here we go.


    First, a reminder: MAKE SURE YOUR SPA-3000 IS BEHIND A FIREWALL! Now let's reset the SPA-3000 to its factory defaults just to be sure we're all reading from the same sheet of music. With a phone connected to the Phone jack, lift the receiver and dial **** to access the Sipura Configuration Menu. Now press 73738#. When prompted, press 1 to confirm your request. The SPA-3000 will reboot. Then, using a web browser, access the IP address of your SPA-3000 that you wrote down above. When the main screen displays, click Admin Login in the upper right corner. Then click Advanced. If you're prompted for a password, you have a locked unit, and all bets are off. Contact your vendor and either get the passwords or send the unit back. You won't have this problem with Voxilla. After clicking on the Advanced option, you'll have access to all the settings in the SPA-3000.

    Regional Tab Settings. You'll notice there are nine tabs across the top of the SPA-3000 Admin Config page. Start by clicking on the Regional tab and set your Time Zone. This matters because POTS phones connected to the Phone jack get their time from the SPA-3000. The Time Zone pull-down is in the Miscellaneous section of the form toward the bottom of the screen. The SPA-3000 doesn't know about Daylight Savings so pick your time zone accordingly. Save your change by clicking the Submit All Changes button. The SPA-3000 will reboot.

    Line 1 Tab Settings. In the Proxy Registration section, enter the IP address of your Asterisk box in the Proxy field, set Register to Yes, set Register Expires to 60, and Use Outbound Proxy should be No. Leave all the other settings as you find them. In the Subscriber Information section,

  • Display Name: Kitchen (or whatever you want to call your PSTN phones)
  • User ID: 204
  • Password: whatever you chose for this Asterisk extension
  • Use Auth ID: No

  • Set Auto PSTN Fallback to Yes. Finally, one could write a book on Dial Plan settings, and someone probably should. But it won't be me. While I'm by no means an expert, I'm learning fast. So here's a Dial Plan configuration to get things working, and we'll revisit it in a future column to add additional features and safeguards. For now, plug the following into the Dial Plan field at the bottom of the form after erasing what's already there. Then Submit All Changes:

    (#xx|< :*>*xxxS0|*xx|[3469]11|0|00|1[2-9]xx[2-9]xxxxxxS0|[2-9]xxxxx.|[2-9]xx[2-9]xxxxxxS0|xxxxxxxxxx.)

    PSTN Line Tab Settings. Things get a little tricky in this form so type carefully, or you'll have a real mess when you try to receive calls. In SIP Settings, set the SIP Port to 5061. In the Proxy Registration section, enter the IP address of your Asterisk box in the Proxy field, set Register to Yes, set Register Expires to 60, and Use Outbound Proxy should be No. Leave all the other settings as you find them. In the Subscriber Information section,

  • Display Name: PSTN
  • User ID: 199
  • Password: whatever you chose for this Asterisk extension
  • Use Auth ID: No
  • Dial Plan 8 should be entered for Dial Plan 8 in the Dial Plans section. That's a less than symbol, then S, then zero, then a colon, 99, and a greater than symbol. In the VOIP-To-PSTN Gateway Setup, set Gateway Enable to Yes and Caller Auth Method to None. In the PSTN-To-VoIP-Setup, set Gateway Enable to Yes, PSTN Ring Thru Line 1 to Yes, PSTN CID for VoIP CID to Yes, PSTN Caller Default DP to 8, and PSTN CID Number Prefix to 00 (that's zero-zero).

    In the FXO Timer Values section, set VoIP Answer Delay to 1, PSTN Ring Thru Delay to 3, and PSTN Ring Thru CWT Delay to 3. Click Submit All Changes button to save your work thus far.

    User1 Settings. In the Selective Call Forward Settings section, set Cfwd Sel1 Caller to 00* (zero-zero-asterisk). Set Cfwd Sel1 Dest to 99. And, at the bottom of the form, set VMWI Ring Policy to New VM Arrives. If you forget to change this last one, your phone will ring once a minute, all night long whenever anyone leaves you a voicemail message in the middle of the night. Click the Submit All Changes button, and we're finished configuring the SPA-3000 ... at least for today.


    Tweaking the Asterisk@Home Dial Plan to Support the SPA-3000. Our final drill for today is to tell Asterisk about the SPA-3000, add a few custom routines to our Extensions_Custom config file, and test everything to make sure it's working. Whew! No one said this would be easy, did they?

    Let's first add the PSTN trunk. Call up AMP->Setup->Add SIP Trunk. For the Outbound Caller ID, enter your home phone number with area code. For maximum channels, type 1. Skip the Outgoing Dial Rules section as well as the Incoming and Registration sections. In the Outgoing Settings, let's name the trunk pstn. For PEER Details, enter the following but not our comments on the right. Then click the Submit Changes button and then the red bar.


    auth=md5
    context=from-internal
    dtmfmode=rfc2833
    fromuser=asterisk < -- don't change this host=192.168.0.115 <-- plug in the internal IP address of your SPA-3000 here insecure=very port=5061 <-- important! secret=123456 <-- use your password for extension 204 here type=peer username=asterisk <-- don't change this

    Next we need to reconfigure our Outbound Routing a bit. Let's add a new Outbound Route and name it OutPSTN. For the Dial Rules, enter the following:


    911
    NXXNXXXXXX
    NXXXXX.

    For the Trunk Sequence, choose SIP/pstn and then add SIP/bv. Be sure they appear in this order or press one of the blue arrow keys to reorder them correctly. Now click Submit Changes and then click the red bar. When the list of trunks reappears, make sure they are in the following order (top to bottom): OutVoxee, OutPSTN, Outside. If not, click on the arrows to reorder them, submit changes, and click the red bar.

    Modifying Extensions_Custom to Handle Incoming PSTN Calls. Click on AMP->Maintenance->Config Edit and then choose the extensions_custom.conf file. When the editor opens, move down several lines to an opening in the [from-internal-custom] context. Insert the following code. WARNING: If you cut and paste code from these articles and the code contains quotation marks (such as below), be sure to replace the WordPress-inserted, front and back quotes with normal quotation marks, or you’ll send Asterisk into the ozone.

    ;next extension (99) is to handle incoming PSTN calls
    exten => 99,1,GotoIf($["${CALLERIDNUM:0:2}" = "00"]?2:3)
    exten => 99,2,SetCIDNum(${CALLERIDNUM:2})
    exten => 99,3,SetMusicOnHold(default)
    exten => 99,4,Answer
    exten => 99,5,Wait(1)
    exten => 99,6,Background(custom/welcome)
    exten => 99,7,DigitTimeout,2
    exten => 99,8,ResponseTimeout,2
    exten => t,1,Answer
    exten => t,2,Wait(1)
    exten => t,3,Background(pls-hold-while-try)
    exten => t,4,Dial(SIP/204&SIP/200,20,m)
    exten => t,5,VoiceMail(204@default)
    exten => t,6,Hangup
    exten => i,1,Answer
    exten => i,2,Wait(1)
    exten => i,3,Playback(wrong-try-again-smarty)
    exten => i,4,Goto(99,5)

    The only line above that you'll need to modify is t,4 where you'll need to specify the numbers of each extension you want to ring when a call comes into Asterisk from your PSTN (home phone) line. If you have more than one extension, separate them with an ampersand and use the SIP/extensionnumber syntax for each extension. Now add the following code snippet at the bottom of the file after adding include => custom-recordme-code near the top of the file in the [from-internal-custom] context :

    [custom-recordme-code]
    exten => 456,1,Playback(custom/record-msg)
    exten => 456,2,Wait(2)
    exten => 456,3,Record(/tmp/asterisk-recording:gsm)
    exten => 456,4,Wait(2)
    exten => 456,5,Playback(/tmp/asterisk-recording)
    exten => 456,6,Wait(2)
    exten => 456,7,Hangup

    Recording Voice Prompts with Asterisk. Save your changes by clicking the Update button and then restart Asterisk as previously described. Now pick up a phone and dial 456#. When you hear a beep, say "Please say your voice prompt at the tone. Press the pound key when you are finished." Then press the # key, listen to your recording, and hang up. If you want to revise it, just repeat the steps. Now go to the Asterisk console and log in as root. Change to the tmp directory: cd /tmp. Rename the custom recording we just made: mv asterisk-recording.gsm record-msg.gsm. Now move the file to its permanent home: mv record-msg.gsm /var/lib/asterisk/sounds/custom. Now let's record one more. Dial 456# again. At the tone, say "Hi, you've reached the Rockefeller's. Someone will be right with you." Now press # to save your recording. Now go back to the Asterisk console. Go to the /tmp directory. Rename the recording: mv asterisk-recording.gsm welcome.gsm. Then move the file to its permanent home: mv welcome.gsm /var/lib/asterisk/sounds/custom.

    HU61Why are we doing all of this? Well, there really is a reason. Now when someone (like you) calls that knows what's going on, you can dial any extension on your Asterisk system while this mundane greeting plays. You can even call up the weather.

    At this point, everything should be working. You should be able to dial in using either your home phone number or your BroadVoice number. And you should be able to dial out using the dialing rules we outlined when we began. Finally, a word of caution. Being human, we sometimes forget a step in a process as complex as this was. We've actually built our new system at the same time we wrote this so everything oughta work fine. Ours does. If not, post a comment (don't email me with technical problems!), and we'll have a look. For those that are curious, we purchased an Ice Cube HU61 from Now Micro in St. Paul, Minnesota. For just over $500, it includes an AMD Athlon 64 XP3000 processor, 512MB of RAM, a 250GB Seagate 7200 ATA IDE drive (don't buy SATA drives as they won't work with this version of Linux and Asterisk), a 52X CD ROM drive, and a 3 year parts and labor warranty. Remember, you don't need an operating system for this machine. It's on the Asterisk@Home installation CD. The Ice Cube has the capacity to handle about 1000 phone extensions and roughly 200 simultaneous SIP calls so it'll do just fine for home use unless we have more than a few Strom Thurmond "moments." And, on the weekends, you can disconnect your phones and take your ass-kickin' Ice Cube to the finest LAN parties in town. See you next week.

    There are numerous additional articles in this series now. You can read all of them by clicking here.