Skip to content
Features

A guide to VoIP and Asterisk

With its low price, VoIP has become an attractive alternative to traditional …

Kurt Hutchinson – | 0
Story text

Introduction

I’ve had a phone line free household since I first got a cell phone. Being free from the wires works fairly well, but it has some limitations. To me the cellular phone is like a personal accessory, so when I have a visitor who needs to use a phone it always feels weird to hand the cell-phone over to him. I would almost rather hand him my toothbrush. Also, when the wife and I go out, we need to leave a phone behind for the babysitter in case of emergency.

Alphabet soup

Before going too far, let’s cover some of the terms so this article avoids turning into buzzword bingo, and unless you have some experience in the telco industry, some of these terms can be confusing.

VoIP

VoIP stands for Voice over IP. VoIP essentially works by taking your phone call, converting the analog signal to a digital format, and then transmitting it over a packet-switched IP network (broadband), and then finally terminating on a PSTN. The reason VoIP carries any advantage over the PSTN is that it virtually eliminates toll charges by avoiding the PSTN until you get close to your destination.

POTS

POTS stands for Plain old Telephone Service, nothing more nothing less. Most POTS devices (your telephone) connect to a PSTN (Public Switched Telephone Network), which is owned and operated by your local incumbent telephone company.

For example let’s say you call from Boston to Miami. Using a PSTN, your call would travel from your home to your local telephone exchange, then to your long-distance provider, on to the local telephone exchange in Miami, and finally to the destination. In my theoretical phone call you have involved three companies and have incurred a toll charge.

Let’s take the same example with VoIP. The call originates on your local telephone. Your voice is converted into a digital format and compressed if necessary. It will then travel to the Internet through your home network to get to your VoIP provider. Assuming your VoIP provider has a presence in Miami, your call will travel via the IP network to a local exchange in Miami. At this point your call gets terminated to your destination’s POTS device.

With this method, you’ve avoided all toll charges because you have taken your phone call and hopped over the entire PSTN until you reached your destination.

VoIP also has the advantage in the range of equipment (softphones) that can be used with it. A softphone is essentially just software that utilizes your computer’s hardware to emulate a phone. The advantages of the softphone are numerous. For instance, when traveling you could have your softphone loaded on your laptop and still maintains access to your VoIP service.

SIP

VoIP comes with an additional set of acronyms: SIP, H.323, and IAX. SIP stands for Session Initiation Protocol. SIP is a relatively simple protocol that has characteristics similar HTTP and SMTP. This makes SIP easy to troubleshoot. Also, SIP can use either TCP or UDP; most providers utilize the UDP method. With the ease of troubleshooting and the fact that it is considered a “lightweight protocol,” many VoIP providers utilize SIP to deliver their services. SIP is not without its issues, however. There is some inherent unfriendliness with network address translation (NAT), as many SIP devices like to show their real IP. This can sometimes result in a connection with one-way or no audio. Due to how calls and their associated data travel from point to point, audio is sometimes improperly negotiated. This happens because of the fact that the audio on a SIP phone call is not on the same stream as data that was used to initiate the call. For this reason, you’ll notice that a lot of the current VoIP providers provide entire router solutions for their customers.

H.323

H.323 is another protocol that some VoIP providers use. It’s the heavyweight of the three protocols as it supports everything and the kitchen sink. H.323 has the ability to provide quality of service (QoS) data, and also has greater strength in video conferencing. Like SIP, H.323 suffers inside some NAT implementations for the same reasons as SIP. Also unlike SIP, H.323 is relatively difficult to troubleshoot because it is a completely binary protocol as opposed to SIP, which is more like http.

IAX

IAX is the newcomer to the VoIP party. IAX is the native Asterisk protocol, and as such, is not widely used. It is a UDP-based protocol, but it is more NAT-aware than either H.323 or SIP. IAX is also an order of magnitude more flexible than the other two. In some ways IAX offers the best of both SIP and H.323. It is relatively lightweight, and there will likely be an increased number of IAX devices soon (i.e., phone Adaptors, VoIP gateway appliances), due to its flexibility and NAT friendliness.

So, what are the alternatives?

Install a regular phone line, or go with VoIP.

In my search for a home phone, Vonage stood out mainly due to their aggressive marketing campaign (you may have noticed a few of their advertisements here on Ars). After doing some research, I concluded that while it’s a solid product and the price is right, Vonage didn’t offer the flexibility I was looking for. Also, at the time I was researching, I didn’t see the ability to use the device of my choice, be it a hand-built SIP appliance or a Polycom ip500 IP Phone. I ultimately settled for the combo punch of Asterisk and Broadvoice.com.

Download the PDF
(This feature for Premier subscribers only.)

Asterisk

Asterisk is an open source private branch exchange (PBX) — or private telephone network — that currently runs on Linux, OS X, and Cygwin/Windows. The possibilities with Asterisk are virtually limitless. It supports VoIP in all three flavors: SIP, h323, and IAX.  Asterisk also supports a wide range of hardware that allows you to terminate your Asterisk PBX from a POTS line to a T1.

Initially, my plan with Asterisk was to use it to terminate to a POTS line, while using an Analog phone adaptor to terminate to my house’s demark and utilize soft-phones on all the PCs in my home. This plan proved to be flawed — it had all the complexity of VoIP and all the cost of POTS without really giving any benefits.

Getting started

Some VoIP providers provide VoIP termination, which means they can take your phone call over VoIP and terminate it on the PSTN network. They also allow you to use your own hardware and devices, which made it the ideal solution for me. Broadvoice.com uses the SIP protocol for communication. Asterisk supports it, but as SIP is not the most NAT-friendly protocol, I installed Asterisk on my Gentoo Linux firewall/gateway in order to prevent any major issues related to SIP and having the server located behind the NAT. Asterisk does not require a whole lot in the way of resources, so a really heavy duty PC isn’t necessary to use it.

One word about the command line: there are a few GUI configuration tools available for Asterisk. However, at their current stage of development, none of them are mature enough to get the job done correctly. At this point, by using one of the GUIs available for Asterisk, you limit yourself to what the application author thought was important, and none of them are very helpful when it comes to initial setup.

So I pulled up my sleeves and typed emerge asterisk (actually, I didn’t do that, but I could have). Instead, I went to asterisk.org and downloaded the source and built it using their make file. I also went ahead and built some sample files.

Now here is the scary part about asterisk, after its built you are presented with several configuration files. I sat back dumbfounded for a second, just plain overwhelmed with what I saw in /etc/asterisk.

So where do you start? After doing some cursory research, I found http://www.voip-info.org, which has proven to be invaluable. There, I was able to find enough information to get me a kick-start on getting my Asterisk server going. (Note: when it comes to configuration, Asterisk does not differ much between Linux, Windows or OS X.)

Out of the box, Asterisk is configured to provide a demonstration environment. So I started up Asterisk, by running the command asterisk –vvvvc. This will start Aterisk and provide a console with debugging turned on.  The only thing this Asterisk demonstration environment was missing was a softphone and an actual account on the system. So I dug in and edited the sip.conf file since I would be using a SIP softphone. With the setup I had planned, all of the phones in my house would be a different extension. So you can use your imagination when setting up asterisk. Once you work your way through all the examples inside of sip.conf, adding a new extension is pretty simple. An example:

   [3001]
   type=friend
   secret=*******
   context=stl
   callerid="kurt desk" <3000>
   disallow=all
   allow=ulaw
   host=dynamic
   dtmfmode=rfc2833

The xten software phone came highly recommended from friends who deal with VoIP. Besides offering a full retail copy of their product, they offer a “light” version which is still fairly full featured. The xten xlite product is supported on Windows and OS X. 

Configuring this software was also quite simple.


The configured softphone

With the configuration of my softphone complete as well as the associated sip.conf file, I proceeded to give Asterisk a test. So I dialed one of the sample numbers provided—1000—and voila! I was successful.

I tested the entire set of sample numbers included with the asterisk server and was satisfied with the set up.

I’ve got Asterisk, but what about VoIP service?

Moving right along, I traveled to the broadvoice.com website to get set up with some service. At the time I signed up with Broadvoice, I wasn’t so sure about my level of commitment, so I paid the US$9.95 BYOD (Bring Your Own Device) start-up fee and then chose their US$9.95/month unlimited in-state plan and selected my number.

As soon as you complete sign-up, Broadvoice sends you an e-mail with some configuration items for your generic SIP device. Of course, once I received the instructions I turned back to voip-info.org for some guidance.

After inputting the new entry for broadvoice.com into my sip.conf, I turned my attention to extensions.conf. This file isn’t very straightforward. Basically it appears to work similar to regex.

   [localterm]
   exten => _NXXXXXX,1,Dial(SIP/314${EXTEN}
     @sip.broadvoice.com)
   exten => _NXXXXXX,2,Congestion
   exten => _NXXXXXX,102,Busy()

In the above case, I’ve set a rule that tells Asterisk, that if I dial 7 digits into the telephone, to attach 314 to the numbers I’ve dialed and then connect myself to broadvoice.com. I also made a few rules to ring my softphone on any inbound calls from Broadvoice.com. Everything worked as planned and inbound dialing was also equally successful. To associate your asterisk setup with other VoIP setups, you would only need to create the appropriate rules in extensions.conf and create the appropriate device in the appropriate protocol files (h323.conf sip.conf or iax.conf).

Marrying your phones and your VoIP system

So, the next hurdle I had to face was getting my “regular” phones on this new VoIP system. I needed some sort of analog adaptor first, and secondly I needed some way to interface this adaptor with the rest of my home. The first thing I learned is that this “analog adaptor” had a proper name: FXS. I found an inexpensive Sipura two-port FXS, and the price per port on the Sipura SPA-2000 looked good, so I ordered one.

The Sipura is a rather simple-looking device. It has a power jack and RJ-45 connector on one end and two RJ-11 connectors on the other end.


The Sipura SPA-2000 analog adaptor

Configuring the device is just as easy. By default it looks for a DHCP server, but can also configure it with the touch-tones from an analog phone.

Once the device has an IP, you can complete the configuration from its web interface.


The web interface for Sipura

I assigned a new extension to my sip.conf and modified my dial plan in my extensions.conf. I now had the ability to use my voip system with a regular phone.

Now, the only thing missing is a method to interface my entire house with this new appliance. Normally, when you get a line in from your local telephone company, they bring the service to your house and terminate it at what is called a demark. In my house all my lines terminate at this juncture.


My house is over 100 years old and I swear the demark here was installed by Alexander Graham Bell himself.

Anyhow, I made a trip to my local hardware store and purchased some Cat-3 cable along with some RJ-11 jacks. Making sure to disconnect my demark from the connection that appeared to be going outside, I connected my new Cat03 cable from my spa-2000 to the demark. I haven’t seen any issues yet.

Since I travel a bit, I’ve modified my firewall to allow inbound UDP connections on port 5060, the SIP port. With this open, I’ve been able to connect directly to my home VoIP network and call outbound over my Broadvoice.com service.

VoIP and Asterisk for the small business

Setting up an Asterisk server for an office would mostly follow the same path that was used for setting up Asterisk in the home. Things that would differ would be the plan used with your VoIP provider and the equipment.

Many small business maintain multiple PSTN lines. Using the ability of Asterisk to terminate to the PSTN, one option could be to use Asterisk as a IP-based PBX for this environment. You would need an analog adaptor such as the Clipcomm CG-101E to work in this environment. This adaptor, while costlier then the sipura adaptor used for terminating your telephone, allows the PSTN lines from outside to be terminated internally.

This setup would expand your setup to allow IP-based phones as well as analog phones.  Another option for small business owners involves terminating to a VoIP provider. This option with the appropriate bandwidth would be a cost-effective method of maintaining phone service while allowing for more useable phone lines.

The demark in most small offices will be a tad more complex then those found within the average home. Other than the demark, the installation will identical to the process outlined above. Asterisk will be right at home in the small business environment, with features like call attendant, hold music, and conference-calling "meet-me" rooms. For the fraction of the cost of a full-blown PBX you can have all of the features.

Conclusion

So now I have a vanilla VoIP phone system that is now wired to every phone in the house. What am I missing?

911!

VoIP does not always play nicely with emergency 911 service. While Vonage and some of the other services have struck deals or are negotiating with the likes of Verizon, SBC, and the other Baby Bells, not all of them offer true 911 capability.

Broadvoice.com doesn’t have it yet, so what do you do? I have found that SBC offers e911 service only for a minimal fee per month. The flexibility of Asterisk allowed me to dig around and find a one-port FXS card (a supported modem. Unfortunately the modem that is supplied with the Macintosh is not compatible currently). So to put this all together, you need to add a dial plan that matches 911 and configure your modem.conf to identify your modem.

So what other caveats are there? Well, as I said before the machine has to be reliable. I went the extra mile with my Asterisk Server, connecting it to a UPS, using RAID 1, and not messing around with the installation.

Another major problem I’ve run into is bandwidth and VoIP. Using any sort of P2P app causes me heartache, as I have a relatively small upstream cap with my ISP (ahem, Charter). Needless to say, I’ve changed most of my usage habits. I do have one ace up my sleeve: the flexibility of using a Linux-based firewall. Using some of the QoS features built into the kernel, I’ve been able to set some traffic-shaping rules and prioritize all UDP packets on my network (SIP relies on UDP). Since making my firewall changes, I’ve had minimal problems with unintelligible calls. For those of you without a flexible firewall, I recommend the use of a VoIP gateway/firewall product.

All in all, I have been extremely impressed with my new phone setup. I’ve since added a toll-free number from broadvoice.com and have created some rules on my asterisk server that allows me to call in with my cellphone and then dial out anywhere. The possibilities are endless with Asterisk.

Asterisk

Pros:

  • Completely customizable
  • Once configured, minimal fuss

Cons:

  • Initial setup is tedious

Broadvoice.com

Pros:

  • Allows you to “bring your own device”
  • Competitive pricing
  • Excellent support

Cons:

  • No e911
0 Comments

Comments are closed.