VoIPowering Your Office with Asterisk: Commercial PSTN Termination

by Carla Schroder

To talk to folks on the POTS network, you'll need a commercial VoIP provider. Here's how you connect to our favorite.

In our previous installments in this series we ran the excellent AstLinux through its paces. Last week we connected to the outside world with Free World Dialup. But this still leaves out one vital element in our grand telephony scheme: PSTN integration—or being able to call and receive calls from people on the plain old-fashioned telephone network. This always costs money to somebody somewhere, so you're not going to get it for free unless you find a generous soul. And there are some out there, as a Google search will show you.

In fact the cost of wholesale PSTN termination has dropped so low that an increasing number of providers are using it as a loss-leader to attract customers. But read the fine print—there are usually restrictions like limiting your calls only to other customers of the same service, and limitations on which numbers you can call from.

We're not going to mess with those, but instead are going to hook AstLinux up to a real genuine Asterisk-friendly commercial VoIP provider. We'll be able to make and receive calls without having to nag other people to sign up—we'll just pick up the phone and call them like normal people, and they can do the same in return.

Great for AstLinux and all Asterisks
While this article targets AstLinux, these instructions work for any Asterisk server. Our example provider, VoicePulse, is a good fit for AstLinux because of their efficiency. They support IAX for trunking, and use the CPU-friendly G711 and GSM voice codecs, so AstLinux on Soekris or WRAP boards will be able to handle more calls. A Soekris 4801 can theoretically handle eight concurrent calls under such CPU-efficient conditions, since it's not doing any transcoding. In comparison, if you try to use a CPU-intensive compressed codec like G729a on a Soekris or WRAP board, you'll be lucky if it handles two calls at a time.

We want a BYOD, or Bring Your Own Device service provider. A lot of commercial VoIP services that target small users restrict you to their own branded SIP phones which cannot be used for other providers without great pain and hassle and risk of bricking the phone, and don't even try to use your own server with them. We shall shun them, and instead turn to friendly providers that give us what we want. The VOIP Service Providers page provides a wealth of information and links, and don't forget to check out the VOIP provider cemetery page.

I'm going to use VoicePulse in this article. They are a good VoIP provider with low prices, and they support both SIP and IAX. IAX is the native protocol for Asterisk. It is efficient, firewall-friendly, and carries multiple calls per stream, so I like to use it as much as possible.

VoicePulse rates
VoicePulse has an interesting method for calculating your rates. They don't have a fixed pricing table or a flat monthly rate. Their rates are continually changing, so they offer a couple of tools to help Asterisk users. One is their FlexRate Realtime Pricing macro. This looks up the current rate when you make a call, and if VoicePulse's rate is too high Asterisk will route your call to a second provider that you specify.

They also have an online calculator that lets you calculate their rates for up to 1,000 calls at once. Currently their rates for calls in the United States range from a half-cent per minute to 1.9 cents. International rates are also pleasingly low.

VoicePulse does a bit of hand holding in the form of prefab configuration files containing your account configuration. You'll still have to edit these, but they are helpful.

Configuring AstLinux
Last week we hooked up with Free World Dialup. This example shows how to add VoicePulse to last week's extensions.conf so you can use both providers. You must first have entered your VoicePulse configurations into iax.conf.


;voicepulse peers

include => fromiaxfwd
include => voicepulse


;outgoing voicepulse for US domestic calls

;outgoing voicepulse for international calls
exten => _011XXXX.,n,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_A}/${EXTEN})
exten => _011XXXX.,n,GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|500)
exten => _011XXXX.,500,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_B}/${EXTEN})

;where do all incoming voicepulse calls go
exten => _XX.,1,Dial(SIP/ellen)
Execute the usual reload command and you're in business. Be sure to double-check all the context names. The VoicePulse sample configurations include macros for least-cost routing, and test users for testing your new accounts.

To dial out over Free World Dialup, use the 393 prefix. VoicePulse calls are dialed like ordinary phone calls.

These examples route all incoming calls to the long-suffering Ellen. You'll want to send them to the appropriate extension for your shop.

Service areas
No VoIP provider gives complete coverage, and VoicePulse is no exception. They are concentrated in large population areas, so us folks in the sticks get left out of the party. You can use several providers to take advantage of different coverage areas.

VOIP Service Providers
Broadband Reports VoIP Reviews. Broadband Reports contains a wealth of information on broadband Internet and service providers of all kinds.
Asterisk series on VoIP Planet

This article was originally published on Monday Dec 18th 2006