Switching to VoIP

13.3. Project 13.1 Use Dial-Plan to Connect to Multiple VoIP Networks

13.3.1.1 What you need for this project:

  • Asterisk

  • Internet access

While we're on the subject of VoIP trunks and using the Internet to extend your voice network, let's tackle a project. This time around, we'll use the Internet as a trunk carrier to connect the local Asterisk server to a third-party VoIP network to route select calls. The logical trunk we'll set up is really just an IAX protocol client connection to an Asterisk server on that remote network.

Inter-Asterisk Exchange protocol Version 2, or IAX2, isn't yet embraced heavily by the large commercial telephony manufacturers. But its design goals are very noble: to be the most lightweight, flexible signaling and media streaming protocol for telephony. This goal has been largely achieved, and a number of commercial voice networks have begun to support IAX endpoints. Others, like IAXTel, are exclusively reliant upon IAX. This project describes how to establish a dial-plan that makes use of a logical VoIP trunk for handling calls to and from IAXTel.

13.3.1.2 The Inter-Asterisk Exchange Telephone (IAXTel) network

IAXTel is sponsored by Digium, the creators of the Wildcard TDM interface cards and Asterisk. The purposes of IAXTel are to use to connect Asterisk systems over the Internet, to promote the adoption of the IAX protocol, and to provide free calling for the Digium-sponsored IAX softphone, Gnophone.

IAXTel's service is free. You can use any IAX2 endpoint to terminate and originate calls on the IAXTel networkthis includes IAX analog telephone adapters, IAX IP phones like GnoPhone, and of course, Asterisk itself.

Other networks, including Free World Dialup, Vonage, Packet8, and VoicePulse, employ IAX for direct, Internet-based trunking of calls between their subscribers and those of IAXTel. Free World Dialup (FWD), like IAXTel, is free. VoicePulse, Packet8, and Vonage are commercial TSPs that also provide PSTN calling, but IAXTel is one of the only TSPs that terminates calls to its subscribers from callers using IAX.

In this case, we'll be creating an Asterisk dial-plan that routes outbound calls to these different networks based on extension pattern matching. One way we can do this is by area code. This simulates a least cost routing (LCR) that uses the private network or low-cost third-party peer networks to connect calls in the cheapest possible manner.

To make sure this project remains totally free to you, we're going to use only toll-free area codes: 800, 888, 866, 877, and 700. (700 isn't a traditional toll-free area code, but it can be used to dial calls, free of charge, between IAXTel and FWD. More on this later.)

We'll also create an LCR context for the other IAXTel-participating networks so that when calls are placed to their subscribers from our VoIP network, the calls will be routed via IAXTel rather than the PSTN. This benefits us in two ways: no long-distance charges, and our POTS line isn't tied up during those calls.

Since IAXTel is a free service, it is intended for experimental use only. Nobody promotes it as a reliable, "always-on" service, but it's a good way to learn about VoIP-over-Internet trunks and IAX2 channels.

13.3.1.3 Get access to IAXTel

In order to place calls using the IAXTel network, you'll need to obtain an IAXTel user account and password. To do this, visit IAXTel's sign-up site at http://gnophone.com/directory/createAccount.php. Here, you can obtain a username and password that will be used to authenticate you when you attempt to originate calls into the IAXTel network. Asterisk will have to be programmed with this username and password; this configuration is discussed later, so read on.

13.3.1.4 Set up the dial-plan for regular PSTN calls

First off, we've got to make sure that local and toll calls (not toll-free calls) are routed out the local PSTN interfacewhich we'll assume is an X100P card. To get an "outside line," we'll have Asterisk pick up a POTS line on Zap/1:

[default] exten => _NX.,1,Dial(Zap/1/${EXTEN})

13.3.1.5 Route toll-free calls to the Internet

Next , outbound toll-free calls will go to IAXTel, which supports the IAX protocol for call termination. First, we'll route all calls starting with 1700 to IAXTel.

1700 is the customary prefix used to reach IAXTel users and not a PSTN area code, per se. In fact, if you dial 1-700- IAXTEL# from VoicePulse or FWD, the call will be routed from these networks to IAXTel.

You'll need to plug in your own IAXTel username and password here:

[iaxtel] exten => _1700NXXXXXX,1,Dial(IAX2/ user : password @iaxtel.com/${EXTEN}@iaxtel)

Now, we can send 800 and 866 calls to IAXTel, as well. We'll put them in their own context, too:

[tollfree] exten => _1866NXXXXXX,1,Dial(IAX2/user:password@iaxtel.com/${EXTEN}@iaxtel) exten => _1800NXXXXXX,1,Dial(IAX2/user:password@iaxtel.com/${EXTEN}@iaxtel) exten => _1888NXXXXXX,1,Dial(IAX2/user:password@iaxtel.com/${EXTEN}@iaxtel) exten => _1877NXXXXXX,1,Dial(IAX2/user:password@iaxtel.com/${EXTEN}@iaxtel)

So, at this point, you can reach IAXTel subscribers at their 1700 numbers , and you can reach toll-free destinations, all using only the Internet, without using the PSTN.

Now, we'll use IAXTel to connect our system's calls to users of Free World Dialup. All FWD subscriber numbers are six-digit numbers. This makes it easy to handle them in the dial-plan. Since six-digit numbers aren't generally used with the PSTN, we'll just route them all to FWD via IAXTel. This can be done by tacking a 17009 onto the beginning of the number that's sent to IAXTel. The IAXTel servers recognize the extra 9 as a token indicating the call should be routed to FWD for termination:

[fwd] exten => _NXXXXX,1,Dial(IAX2/ user:password @iaxtel.com/17009${EXTEN}@iaxtel)

FWD and IAXTel aren't the only TSP services that have dial-plan tokens for routing calls to each other. Try experimenting with the ones in Table 13-1.

Table 13-1. Dial prefixes for calling between TSPs using the Internet

Call an IAXTEL user from FWD

*-1-700 and the 7-digit IAXTel number

Call a Vonage user from FWD

**-2431 and the full 11-digit Vonage PSTN number

Call a FWD user from Vonage a

0110393 and the 6-digit or 5-digit FWD number

Call a FWD user from Packet8a

0451 and the 6-digit FWD number or 5-digit FWD number

Call a Packet8 user from FWD

**898-1 and the full 11-digit Packet8 PSTN number

Call a VoicePulse user from FWD

1-700-900-0000 and the full 11-digit VoicePulse PSTN number

Call an IAXTel user from VoicePulse

1-700 and the 7-digit IAXTel number

Call a FWD user from VoicePulse

1-700-9 and the 6-digit FWD number or 1-700-99 and the 5-digit FWD number

a See warning, next.

There's not yet a way to register an Asterisk server as a SIP client on Vonage or Packet8, so the prefixes in Table 13-1 will work with those services only when dialed through the TSP-provided gateway equipment/ATA.

13.3.1.6 Allow incoming calls from IAXTel

Routing calls to IAXTel is a function of the dial-plan. But in order to receive calls from them, we've got to set up an IAX2 registration peer. In other words, the Asterisk server will become an IAX2 client registered with a server on the IAXTel network. To do this, add a directive such as this to the [general] section of iax.conf :

register => username:password@iaxtel.com

The registration tells the IAXTel network how to reach youspecifically, to contact your Asterisk server's IAX2 client whenever a call is bound for your IAXTel number. Next, we'll need to set up the IAX2 peer in iax.conf that tells Asterisk the context in which to place calls when they come in from IAXTel:

[iaxtel] type=friend host=iaxtel.com context=from-iaxtel

13.3.1.7 Route incoming IAXTel calls

At this point, we've got IAXTel calls coming to the from-iaxtel context, but this context doesn't exist yet in the dial-plan. So, in extensions.conf , we can use this context to tell Asterisk what to do with the calls. In this case, we'll just have them ring a Zaptel channel and then dump to voice mail box 100 if there's no answer after 45 seconds:

[from-iaxtel] exten => s,1,Dial(Zap/1,45) exten => s,2,Voicemail(100)

13.3.1.8 Monitoring registrations

When you set up VoIP trunks from the Asterisk server to various providers, what you're really doing is registering Asterisk as a VoIP client. To monitor the status of each trunk's registration, use the sip show registry and iax2 show registry commands. Here's a SIP trunk registration in progress:

pbx*CLI> sip show registry Host Username Refresh State access1.voicepulse.com:5060 s00227788 120 Auth. Sent

Here's an IAX trunk registration:

pbx*CLI> iax2 show registry Host Username Perceived Refresh State 69.73.19.178:4569 tedwalling <Registered> 60 Registered

You can also follow VoIP trunk registrations in Asterisk's detail log output.

Категории