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.

    Be Sociable, Share!

    49 Responses to “Turbocharging Your Asterisk@Home PBX”

    1. David says:

      Fabulous instructions (all four parts)! I’ve really been struggling to get the SPA-3000 to work correctly with Asterisk but your how-to did the trick. Just a couple of quick comments:

      1) In both the Line 1 and PSTN Proxy Registration I believe you meant to say input the IP of the Asterisk box (and not the SPA-3000).

      2) For some reason I couldn’t record the voice prompts as you described. I’ll re-check my work again, but I’m pretty sure I entered it as you suggested.

      Thanks again for the great tutorial!

      [WM: You're absolutely right. Sorry. Too much typing. I've corrected the main article for future readers. As for the voice prompts, add the following near the top of the extensions_custom.conf file in the [from-internal-custom] context:

      include => custom-recordme-code

      Then restart Asterisk, and all should be well. I knew I’d leave something out. And you were the (un)lucky finder. Thanks for writing.]< .i>

    2. drkfiber says:

      Thanks a bunch. I just bought a SPA-3000 and have been messing with it for about a week. Asterisk@Home and the SPA-3000 are a great combo, and with these instructions it makes it almost painless to setup.

    3. Sean says:

      Two quick questions:

      1) Can you hook up multiple SPA-3000′s to one asterisk machine to support incoming and outgoing?

      2) Is it possible to modify this to dial Group #1 as opposed to extension 200?

      exten => t,2,Dial(&SIP/200,20,m)

      Thanks.

      [WM: The answer to the first question is yes, but you'd have to be careful to make the ports on each one unique. Be sure to use three extensions for each one, too. A single SPA-3000 can support incoming and outgoing calls. As for #2, yes you can dial a group instead of an extension. Here's the correct syntax: exten => t,2,Dial(local/222@from-internal,20,m) where 222 is the group number.]

    4. drkfiber says:

      In the part about setting up the PSTN Line 1 tab Settings there is nothing listed for setting up dial plan 8 “In the Dial Plans section, enter the following for Dial Plan 8: . That’s S-zero, not S and the letter O…” should’t there be something listed after 8: .

      [WM: I've fixed it. Thanks. WordPress has a hard time with brackets of any variety and some of the text got mangled.]

    5. djw says:

      When’s the next aah segment to be published? Looking forward to it anxiously.

      [WM: Looks like Wednesday, September 14, is the big day. We're proofing the final copy now.]

    6. Robert Guenther says:

      I have a question, i can’t find anywhere else, I want to add an extension like u quoted in previous versions, where like 6535 will call a cellphone of your friends, Well, same concept, I want that extension to be used in the Queue, on incoming calls, so when someone preses 2 to be transfered to the next available rep, i can put 6535 as on cell and 6536 as another cell phone ..

      [WM: I haven't tried this, but the way I would do it is like this. Create two regular extensions and make them part of the queue numbers, e.g. 6535 and 6536. Pick up one of your existing phones and dial *72. At the voice prompt, enter the first extension number (6535) and press #, and then the forwarding number of the first cellphone: 4047891234. Once you've saved that entry, repeat the process to forward 6536 to the other cellphone number. If you ever want to cancel the forwarding or change the forwarding number, connect a softphone to the extension to be cancelled and dial *73 to cancel forwarding. Good luck.]

    7. wkg says:

      I looked at Now Micro system configuration you’ve linked to – all the drives are SATA. Has there been a change that eliminates this system as a candidate for Asterisk?

      [WM: You'll need to call NOW Micro and ask them to build one with an ATA drive. My contact there was Kelly Davisson at 877-393-2102. The quote number was 153752. Hope this helps.]

    8. dave says:

      thanks for all the great help. best howto on this setup that i have read, but….. when i get a call from my landline, it passes it through to * then hangs up and starts all over. I know this because i substituted xlite for the extention to ring (my regular phone did not ring, i don’t think it had enough time). if you call, it plays the message, then one nano-second of music, then repeats. it is getting throug to * and then to xlite. if i time it right with xlite, i can answer the call. I have quadruple checked my settings, very little hair left on my head. if you can help, thanks

      [WM: Lucky for you, I had the same problem. There's apparently a bug in Asterisk with the Dial(local/204@from-internal) syntax under certain conditions. Use the Dial(SIP/204) syntax, and I think it will solve your problem.]

    9. dave says:

      found it. i had the problem in post #8. the cause was that i cut and pasted the section for extension_custom.conf. when i did so it put in some sort of back quote instead of the regular ” . the error only becomes visable after staring at the screen for several hours. thanks for the help, works like a charm.
      dave

    10. rasta_roots says:

      Wooww!!!! the dyndns service is pretty very cool!!!!!

    11. Craig says:

      Thanks for this awesome set of instructions for the SPA3000.
      One question tho’. Would it not be possible that instead of creating an extension 99 and then editing custom_extensions.conf that you could create a ring group (say 99) and then assign your extensions and then in DialPlan 8 have the RingGroup number (eg 99) ?

      [WM: Try it, and let us know. We prefer an AutoAttendant in the middle of incoming calls to run interference, check for (lack of) Caller ID, and block creeps. But, as they say, different strokes for different folks.]

    12. LoneVictor says:

      Once you get your SPA-3000 configured and working properly, there’s a new Windows utility program that will let you back up that configuration. You can download it from here. Works great!

    13. Peo says:

      Hi! Great tutorial! I’m a complete newbie regarding voip and *, and still got it up and running! Thanks. I discovered a problem, though, with my server – or is it a configuration issue? About 24 hours after getting it to work, all incoming calls sent to ext 99 are reported as “busy”, and thus, I can’t hear them. Checking in the Flash Operator Panel, all extensions and trunks are blinking green/red. Any1 know what the problem might be?

    14. asterix_user says:

      Awesome tutorial – thanks a zillion for doing this! Got my Sipura and Asterisk up in a day – and had no experience with either before!

      I also had the problem reported above in (8) and (13). For (8), I found the solution at: http://www.voip-info.org/tiki-index.php?page=Sipura+3000
      Since I do not have called-ID on my PSTN line – i kept getting the “Address moved temporarily” error from the sipura. Setting the CID manually fixed it for the first time, then subsequently i kept getting the line busy problem as in (13) above. I updated extensions_custom.conf for extension 99 to set CID manually thus and the problem appears to be fixed:

      exten => 99,1,SetCIDNum(234)

    15. Ryanz says:

      Thanks for the great effort you made :-)

      How does one record and setup a custom voicemail recorded message per extension instead of the standard AAH message “The user at extension xx is not available…” I would like each extension user to record their own voicemail to take messages when they cannot be reached.

      [WM: Dialing *97 from each extension and selecting 0 for Mailbox Options will let you record both unavailable and busy voicemail greetings. Or you can dial *98 from any extension and choose the extension with which you wish to work.]

    16. DarkSource says:

      Your tutorials are great. I followed the SPA-3000 tut and everything works great except one issue which probably only applies to my situation.
      I have regular phones hooked up to my PSTN as well as my SPA-3000. I would like my PSTN line to ring 5 or 6 times before my SPA answers it and sends the call to asterisk. Currently I have tweaked the FXO timers and it now answers after 3 rings. What am I missing?
      Here is a link to my PSTN line configuration.
      http://www.darksource.org/pstnlineadvanced.png
      Any help is greatly appreciated.
      Thank you,
      DarkSource

    17. OliverS says:

      Thank you for the super tutorials. I’m having a lot of fun although I’m not out of the spousal doghouse yet.

      I would like to reduce the delay between answering an incoming call on the PSTN line and getting to the second ‘pls-try-while-we-try to-connect-you’ prompt and having the designated extension ring. I have tried taking out the ‘digittimeout’ and ‘response’ statements but with no noticable effect. I have a Sipura 3000 handling the PSTN line as well as the extension to be rung. The machine is 2.1 GHz Athlon so I doubt it is processing power related. Any ideas?
      Thanks in advance.

    18. Paul Rocha says:

      Incredible information, we all owe you our gratitude. My question is concerning recording voice prompts. When I key 456# i get a fast busy, everything else seems to work fine.

      Thanks

      [WM: Try changing the extension number to something in the 200's and see if that resolves the problem. The 400's are reserved for speed dialing in some versions of Asterisk@Home.]

    19. Fiddler says:

      Your notes on setting up the SPA-3000 were great. Worked right off the bat.

      I have a question on incoming CallerID on the SPA-3000 FXO port. What I’m seeing is that the SPA-3000 will in the absence of CallerID from the PSTN line, insert it’s configured Caller ID settings and so my calls show PSTN <199> instead of no CallerID at all. Essentially what this means is that the Privacy Manager feature won’t work since there is always some CallerID present. I guess I could add processing that deleted the PSTN <199> strings if they were present – seems kludgy though. Any other ideas would be welcome.

      Thanks

      [WM: We had the same problem. One way to resolve it is shown in our Stealth AutoAttendant code which watches for the PSTN caller ID entries as an indication that no caller ID is present. Be aware that some cellphone companies send a caller ID number but no name. If just the name is blank, the SPA-3000 puts PSTN in there still, and you may or may not want to block these calls. Just remove the calleridname=PSTN line from the code if you want to let these calls get through normally.]

    20. Tim Litwiller says:

      I think it would be nice to give the SPA-3000 it’s own article on your site. Also – I am having problems with the way this works. It doesn’t drop the caller in the normal flow of incoming calls. Instead it is in internal-custom call that you have to program manually.

      Wouldn’t it be better to setup the incoming and outgoing parts of the trunk so that the standard call controls of AMP would could care of the call?

      Or is that impossible?

      [WM: SPA-3000 article is in the site index.]

    21. Tim Litwiller says:

      I finally found this http://www.geekgazette.com/index.php?option=com_content&task=view&id=28&Itemid=0&limit=1&limitstart=3, and it works great for setting up a trunk that works like any other trunk with Asterisk at Home – except it has 2 errors – in the amp setup of the trunk it says to put in the ip address of the asterisk server. It should say to put in the ip address of the spa3000.

    22. Kim says:

      I do not have Sipura 3000. But I have an IPKall number being forwarded to my GIZMO setup in Asterisk. I use Gizmo for their 1C/Min call charges anywhere in USA and good rates for international calls as well as to recieve calls coming from my IPKALL# to the gizmo account – I can make and recieve calls using my gizmoOut and gizmoIN trunk. Now can I from my office dial the IPKall# and select my Gizmo trunk to make internations calls? I guess I need to setup autoattendant like above but confused about all the Sipura related settings… Appreciate any help on it.

      [WM: It's easier with Asterisk, but head on over to Voxilla. They have a setup for the SPA-3000 to do what you want to do.]

    23. Brian says:

      Great guide! Got it working no problems. I have found some things I would like to change and am not sure how to.

      When making a call on my normal phone. I can see that the SPA3000 is processing the call. Not *. Making a call via my SIP phone works fine.

      Also, I think there is an issue with echo using firmware 3.1.7 on the SPA-3000. Any work around?

      Other than that its pretty sweet. Gonna tell Ma Bell to keep some of her features.

    24. Mukesh Aggarwal says:

      you are awsome !! you are the one who made me spend $100 on sipura 3000 !! i just have one problem.. I will be using sipura overseas to register to my asterix in US.. since the outgoing trunk in asterisk requires the IP address of sipura, it will be difficult (sipura will get IP dynamically from DHCP).. also since sipura doesn’t have built in support for dyndns, how can it be configured ? so the scenerio is this

      asterisk < ==> router < ===> internet < ==> router < ==> sipura 3000

      I am sure if you add the section as to how to make it work, it will be useful for lot of people who wish to use it to access PSTN of other countries.

      [WM: There's a very active Sipura SPA-3000 forum on Voxilla with loads of international users. That's the best place to post this and get an answer that works.]

    25. Mukesh Aggarwal says:

      I found the answer to my question. I put sipura 3000 behind the router which registered at dyndns. Then on the router, I forwarded the sip ports (10001 to 20000, etc.) to sipura 3000. Then in the trunk config, I used the fdqn like xyz.dyndns.com in place of host. Also I had to add a line “nat=yes” .
      Maybe you might want to add this info in your tutorial. It sure will help lot of people.

    26. Glenn Jensen says:

      Thanks – I can make calls from a phone attached to the Sipura, but I get the dreaded ‘all circuits busy’ error calling out the Sipura trunk. Pulling my hair out….. all ideas welcome.

    27. Olu Solaru says:

      Great instructions. unfortunately I have a Sipura 1001. I have been unable to get any similar information for my Sipura 1001, every information I have researched has been very sketchy. I guess some of your instructions don’t apply to the Sipura 1001. But if you know where I can get some REAL information. I will really appreciate it.. Thanks..

    28. joshua says:

      MOH w/Asterisk and hte SPA-3k —- please explain how to..

    29. Brian says:

      I have an old Linksys RTP-300 from my Vonage days that now has the 3.1.10 NA firmware on it. Any tips to program the 2 fxs ports on it? Thanks for all of you help with AAH and now TrixBox.

    30. Rizwan says:

      “be sure to replace the WordPress-inserted, front and back quotes with normal quotation marks, or you?ǨѢll send Asterisk into the ozone.”

      Could you please explain what you mean by “normal quotation” marks? Is it ‘ ‘ or ` ` ??.

      Thanks.
      Rizwan

      [WM: It's quotation marks where the one on the left of a quotation looks different than the one on the right, i.e. not the one two doors down from the L key on your keyboard.]

    31. martin says:

      How do you point the sipura 3000 to the attendant ?

    32. tom glaab says:

      Since upgrading to Trixbox 1.1 I have not received caller ID from my SPA-3000. The SPA decodes it OK, but it doesn’t seem to make it any further (log analysis to follow). A post at http://forums.whirlpool.net.au/forum-replies-archive.cfm/549271.html suggests that Asterisk and Trixbox interact differently with the SPA, meaning this tutorial won’t work with Trixbox.

      My SPA-3000 also answers on one ring, no matter what PSTN Answer Delay is set to. Arrgh. Can I load v3 firmware on a box with v2 firmware/hardware?

      tg.

    33. Vincent says:

      I’m using the Linksys 3102, the newer version of the 3000, and the Linksys will forward incoming PSTN calls to the PBX by just setting an extension in User1 > Call Forward Settings > Cfwd All Dest. Using a dial plan in “PSTN Line” doesn’t do anything, and prepending numbers to the caller ID number isn’t needed.

      Unfortunately, no one has yet been able to solve a serious issue: When forwarding calls to the PBX (I guess it’s really FXS > FXO > PBX, the Linksys goes off-hook while notifying the PBX, so even if no one ends up answering the call, the caller will be charged for the call. I’ve tried a bunch of settings in the Linksys interface, including the “Off Hook While Calling VoIP = no (default anyway)” in PSTN Line, all to no avail. If someone knows how to disable this, I’m interested.

      [WM: I'd recommend you repost this on the Voxilla forums. There are lots of Linksys/Sipura experts there.]

    34. Jens says:

      This is a great tutorial, but I have one question: What does do? Is the 99 a link to extension 99?

      Thanks,
      Jens

    35. tphank says:

      I’ve been using Asterisk since 2.7, now 2.8 and any day now will migrate to Trixbox… Now at home, I have an SPA3000 setup as an extension (100). When a specific stanaphone number is called, I use a DIAL(SIP/100). It appears that asterisk or the SPA has answered the call and is ringing while the extension is being called. Is there a way for the call not to be answered? I know it is being answered, since when I call by cell, by the first ring my cell shows connected, even though the extension is just starting to ring…. I Just have NoOp commands before the dial, so it must either be the dial or the SPA answering the call? Is there anyway to not have the call answered unless someone picks up the extension?
      Thanks!
      tphank

    36. Andy Nilssen says:

      If you’re pulling your hair out trying to make an outbound PSTN call with the SPA3000 (i was), here’s one thing to check: Line-In-Use Voltage. Turns out my PSTN line is a low voltage line and the SPA3000 was not recognizing it. The fix is easy. See the only Point #10 on this page: http://www.nch.com.au/hardware/setup/fxo.html

    37. Tom says:

      Regarding #32 above, I think I found it. See: http://www.aussievoip.com/wiki/index.php?page_id=119&tk=d2dbfa84507b907bcb25&refresh=1. At first look things are working in both directions. While firmware v3 loaded on my Sipura v2 hardware, I went back to v2 FW just to eliminate that variable. Finally my wife won’t constantly complain about the phones (I hope :-)

    38. Alfred says:

      After setup my Line 1 Status shows registered but the PSTN Line Status states Failed. The User Name 204 in PSTN Line will then change the PSTN Line Status to registered. Trying 99, 199, asterisk and the phone # which is the name of the Trunk all fail. Please share thoughts.

      I am using a TrixBox and SPA3102.

      [WM: SPA-3102 is a very different beast than the 3000, and we have not yet tested one of them. Sorry. Visit the Voxilla Forums.]

    39. Alfred says:

      Solved my own problem. FYI: After connecting to the SPA-3102 via the Ethernet port, click on WAN and turn on Web Access. Then disconnect from the Ethernet Port and plug into the WAN port. All of the stuff only works via the WAN port. This assumes that you already have a router and are not using the SPA-3102 as a router where you would use both the Ethernet and WAN jacks.

    40. Alfred says:

      New question. If I want the PSTN line which is setup as a trunk to work the same as the VoIP inbound calls, what do I do? The above instructions discuss ringing a phone extension. I want the PSTN line to follow the logic setup in Inbound Routes. Currently this is set to Time Conditions.

      Everything is working as currently the call is sent to extension 99 but then does not know what to do since I did not paste the code into Extensions_Custom.

      I am using the latest version of Trixbox with VM Ware.

    41. Alfred says:

      If I send the call from the SPA3102 to 7777 caller ID works. Everything works. What do I need to add to my dial plan to pass the Caller ID info when transfering to extension 99?

      I need to send to 99 as the phone is not answered until the 4th ring when sending to 7777. When I send to 99 I have it setup to pickup on the first ring. However, the name I have setup in the SPA3102 comes across as the caller ID info.

      Help!

    42. tom glaab says:

      Alfred — tak a look at #37. That solution gets rid of the whole extension 99/199 schema and seems to be working well with my Trixbox and SPA-3000.

    43. Jens says:

      Great guide. However I have one problem. It appears that my SPA-3102 doesn’t forward any DTMF sounds to Asterisk. Is there an additional setting I am missing?

      Thanks,
      Jens

    44. Josh says:

      Just thought i’d share my experience with the SPA3102. I used the guide here to set up Trixbox and the SPA3102. Also if you’re not using the 3102 as a router see my post here.

      I’m also curious as to the differences between the Voip-info setup (which I used) and the setup described here. Calling in to my PSTN rings all my extensions (ring group) and calling out calls out normally. I can dial 101 to get my extension on the 3102 and from there I can dial 200/201 to get my softphones.

      If you need to reach me, do so through voxilla.

    45. Duncan says:

      Thanks for this great info. I have Nerdvittles V1.2.3 trixbox running in VMWare Player on an Athlon XP2800+ with 1GB RAM and mirrored SATA drives, a Linksys SPA-3000 configured as detailed in this how-to, and a Polycom SoundPoint IP 501 SIP. Thanks to your instructions, I can dial in and out using my PSTN line via the SPA-3000. Problem is, the sound cuts in and out so badly it is unusable. Sometime I get no sound for 5-10 seconds at a time. Is this just the VMWare implementation? Is there something else I should check? Is this a possible result of improper configuration? I configured my Polycom SIP phone by trial and error so I certainly could have done something wrong there. any idea where to look? Is dedicating a server the only way to go? Thanks.

    46. Dave says:

      The SPA3000 setup here is a hack because it makes the incoming calls appear to come from an extension on the network and not from a trunk line. This may give you problems with DID and IVR tone recognition. Here is a better set of instructions.

      [WM: To each his own. Thanks for the link. We've never had a problem with DID's or IVR tone recognition.]

    47. Ian Worthington says:

      Hi Ward.

      10 months after I bought my spa-3000, swmbo is finally out of town giving me a chance to integrate this wee timorous beastie with my trixbox (in your vm box).

      I had some problems with your instructions, and some reservations about defining it as an extension rather than a trunk, and Kerry Garrison’s instructions didn’t work either.

      But I wrestled it to the ground and all’s now well. I also found out what needed changing for it to work with a UK BT circuit. For anyone having similar issues I’ve documented it all at http://isw.me.uk/content/view/14/28/

      ian

      [WM: Many thanks. Our intstructions are getting a little long in the tooth and, unfortunately, we no longer have a PSTN line to play with. We're a pure IP shop and home at this point.]

    48. Fred says:

      Nice Tutorial thanks. I’m trying to follow along but I installed AsteriskNOW which seems very different. The “trunks” part doesn’t mak much sense so far.
      Whay are there so many variants of asterix, is @home the best one for a beginner? I thought NOW was supposed to be?
      Thx for any guidence.

      [WM: This is a very old article. AsteriskNOW is different, and Asterisk@Home has been superseded. Click on one of the links at the top of our web page to download a turnkey solution for Linux, Windows, or a Mac.]

    49. Villalvilla says:

      Nice article!
      But…
      You have an error. When you configure PSTN for outbound calls, you need to configure the “PSTN user” tab. Just put “00*” in “Cfwd Sel1 Caller” and “199″ in “Cfwd Sel1 Dest”, instead of putting that information in the “user 1″ tab.
      The rest of the article works like a charm!
      congratulations.

    Ringbinder theme by Themocracy