Hack98.Connect Asterisk to the Skype Network


Hack 98. Connect Asterisk to the Skype Network

They said it couldn't be done without the Skype API. They were wrong.

Wouldn't it be great if your Asterisk server could place calls to (and receive calls from) the Skype network? Imagine the possibilities: putting your Skype buddy list within reach of the Asterisk dial plan so that all your calls can be routed to the appropriate Skype buddy depending on what you dial on your Asterisk-connected phone. Well, that dream is now a realitywith a few gotchas.

The first gotcha is that you'll need to use a little bit of legacy technology (FXO/FXS interfacing) to set up the connection. The second gotcha is that you'll need a Windows PC sitting next to your trusty Asterisk server, and that Windows PC will need to have Skype running and an Internet Phone Wizard USB interface attached. The final gotcha is that the Internet Phone Wizard must already have speed-dial numbers associated with the members of your Skype buddy list [Hack #40]. You would need this anyway if you were going to use the Internet Phone Wizard for its intended purpose: connecting a traditional analog phone to the Skype network via a Skype client on the USB host PC.

Connect a standard RJ11 phone cord from the telephone jack on the Internet Phone Wizard to an FXO port on your Asterisk box. This FXO port can be on a Digium TDM400P, a Digium X100P, or a Sangoma WANPIPE PCI card (several examples for setting up the TDM400P are given in Chapter 4). Configure the Zaptel channel for this FXO port as you normally would if you wanted to connect the Asterisk server to a standard phone line. (The standard phone line is going to be substituted by the connection from the Internet Phone Wizard.)

Next, you'll need to add your Internet Phone Wizard speed-dial numbers to your Asterisk dial plan so that they'll be dialed via the Zaptel FXO channel. (Remember, I'm assuming you've already set up your speed-dial numbers on Skype using the Internet Phone Wizard, so if you haven't, flip back to "Skype with Your Home Phone" [Hack #40].) In the default Asterisk context for the phone you're going to be calling from, add something like this:

 Exten => 71,1,Dial(Zap/1/71) Exten => 72,2,Dial(Zap/1/72) Exten => 73,3,Dial(Zap/1/73) 

If you had buddies with speed-dial numbers of 71, 72, and 73, the Asterisk server would attempt to call them on Skype via the connected Internet Phone Wizard. Of course, all the Asterisk box sees is the Zaptel interface. To be even slicker, you can assign an entire range of numbers to be used for Skype purposes. Here, I've set aside 80 through 89. The dial plan will always dial these extensions on the Zaptel interface, passing the extension number through to the Internet Phone Wizard as dialed digits:

 exten => 8X,1,Dial(Zap/1/${EXTEN}) 

To get calls from Skype routed into your Asterisk dial plan, all you need to do is modify the default context of the Zaptel channel you've used to connect the Internet Phone Wizard. Refer to "Connect a Legacy Phone Line Using Zaptel" [Hack #44] for an example that points out how to do this. Now, if you really want to get fancy with Asterisk and Skype, check out the next hack.




VoIP Hacks
VoIP Hacks: Tips & Tools for Internet Telephony
ISBN: 0596101333
EAN: 2147483647
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net