More on how "Skype For Asterisk" actually works...
Slides from my ITEXPO security talk - SIP Trunking and Security in an Enterprise Network

Clarifying how Asterisk could possibly be used as a Skype-to-SIP gateway

After my post yesterday about "Skype for Asterisk" (and the update post) and the potential it allows for SIP interoperability via Asterisk, I've received a few comments that seemed to interpret what I wrote as somehow indicating that the Skype announcement somehow meant that there was new "Skype to SIP" functionality in the "Skype for Asterisk" announcement.

Just to be clear, there isn't any new "Skype to SIP" functionality in the "Skype for Asterisk" piece announced yesterday by Digium and Skype. None.

It is purely a commercially-licensed software module (which most of us speculate will be a binary software module, i.e. we won't be able to actually see the code) that provides two-way connectivity from Asterisk to and from the Skype cloud. Skype users can call into an Asterisk system. Users connected to an Asterisk system can call out to Skype users. Users on the Asterisk system can also call to the PSTN (via what was called "SkypeOut") and receive calls from the PSTN (via what was called "SkypeIn").

That's it. That was the announcement yesterday. Period. End-of-story.

However, the point I was making in my post yesterday was this announcement has the potential to turn Asterisk into a two-way "Skype-to-SIP" gateway. Asterisk - with the "Skype For Asterisk" module installed - could be deployed into a network where it could provide interconnection between Skype users and SIP users.

Let me explain...

ASTERISK INTERCONNECTION EXPLAINED

Asterisk has a large number of "channel drivers" that allow phones and systems to be connected to the Asterisk system via various protocols. These systems include:

  • SIP phones, systems and clouds
  • Cisco phones and systems (via the SCCP channel driver)
  • H.323 phones and systems
  • MGCP phones
  • other Asterisk systems (via the IAX channel driver)
  • the PSTN and legacy TDM systems (using the various hardware channel drivers)

There is also an unsupported UNISTIM channel drivers to go into Nortel systems and various other channel drivers out there. (I know of someone who is using a radio channel-driver to interconnect two-way radios to Asterisk.)

The beautiful part about Asterisk is that you can simply and easily interconnect all these systems because the individual endpoints simply become extensions in the "extensions.conf" file inside of Asterisk. So extensions that use the SIP channel can call in and connect to an extension that uses H.323. H.323 endpoints can call Cisco IP phones. Cisco IP phones can call an IAX softphone (there are some out there). Any of those different types of endpoints can call the PSTN through either hardware cards or through SIP or IAX trunks. Graphically, the pictures looks something like this:

asteriskendpoints.jpg

Although perhaps to better depict common scenarios, here's how it could look if you include various options for PSTN connectivity:

asteriskinterconnect.jpg

DIVING A BIT DEEPER

To dive a bit deeper into Asterisk configuration, when you decide to use one of the various "channel drivers" you essentially perform two steps:

  1. Modify the channel driver configuration file
  2. Add appropriate extensions or trunk settings to the 'extensions.conf' file.

Now you might be doing this by editing the configuration files directly using your favorite text editor - or more likely these days you are probably using one of the many different graphical user interfaces to do the actual configuration modification. In the end, the config files are being modified in some manner.

For the SIP channel driver, the config file is the aptly named sip.conf and in the file you enter information such as:

  • Connection information to a SIP Service Provider if you are doing a "SIP trunk" for PSTN connectivity (username, password, connection details, etc.)
  • Connection information to an IP-PBX or application server to which you are connecting via SIP
  • Information about the different SIP phones connected to your Asterisk server

Note that you could use the SIP channel driver to connect individual SIP phones to Asterisk; you could connect your Asterisk server to the PSTN via a SIP trunk; or you could do have both SIP phones and a SIP trunk. In fact, you can have multiple SIP trunks. You could connect over to an existing IP-PBX or to an application server that supports SIP. Asterisk is incredibly flexible in the way that you can configure it.

The second step is to configure the extensions.conf file to have use this channel driver. For instance, to make it so that all calls starting with the digit "9" go out a SIP trunk, you might do something like this:

exten => _9.,1,Dial(SIP/${EXTEN:[email protected],30,r)
(Taken from the voip-info page on sip.conf)

To configure actual phones as extensions, you would enter something like this in extensions.conf (taken from the sample file on an Asterisk install I have around):

exten => 6245,1,Dial(SIP/Grandstream1,20,rt)   ; permit transfer
exten => 6245,1,Dial(SIP/Grandstream1&SIP/Xlite1,20,rtT)
exten => 6361,1,Dial(IAX2/JaneDoe,,rm)         ; ring without time limit
exten => 6389,1,Dial([email protected])

If someone dials one of these extensions, it would then ring the associated phone. Note that for extension 6245 it will actually ring two different phones. Note also that the phones will have to be configured themselves to register with Asterisk, etc.

Now, Asterisk dialplan creation is an enormous subject in and of itself... but this is the general idea. You configure the channel drivers to support connections to either (or both) service providers or endpoints (phones) using the given protocol. You then configure actual extensions or trunk connections in the extensions.conf file.

SO HOW *MIGHT* THIS WORK WITH 'SKYPE FOR ASTERISK'?

Now we don't have any information yet about how this new channel driver would work... but most all of the channel drivers work in a similar fashion. I would expect that there will be something like a skype.conf file that will let you establish what Skype user names are associated with the Skype For Asterisk module. You will probably need to include the login credentials, any restrictions on access (by Asterisk users), etc.

Separately, in the extensions.conf file, you will wind up probably putting in something like this to enable outbound connections:

exten => _9.,1,Dial(SKYPE/${EXTEN:[email protected],30,r)

Or something like that. Now all calls that start with 9 will go out the "Skype trunk".

If you wanted to associate a user ID on the Asterisk system with a Skype ID, you would possibly add something like this:

exten => 6400,1,Dial(SKYPE/danyork,,rm)

Now any calls to ext 6400 on that Asterisk system would go to my Skype ID. You could imagine getting a bit fancier with something like this:

exten => 6400,1,Dial(SKYPE/danyork,,rm)
exten => 6400,1,Dial(SIP/1234,,rm)

which would have the effect of calls to ext 6400 going to both my Skype ID and a SIP phone.

So Skype can just be another way for inbound or outbound calls to enter the Asterisk server - and Skype users can simply be added as extensions on an existing Asterisk server.

Returning to my graphic above (gotta love quick graphics via Skitch!), the picture now looks like this:

asteriskinterconnectwskype.jpg

The "Skype For Asterisk" module allows two way connectivity into the Skype cloud and also the use of Skype as another mechanism for PSTN connectivity.

SO WHAT ABOUT "SKYPE-TO-SIP"?

The point of my post yesterday was now that two-way Skype connectivity becomes just another channel driver for Asterisk, you have all sorts of interconnection possibilities. As a standalone system, you could connect SIP phones on an Asterisk server out to the Skype cloud.

You can also deploy Asterisk as a "SIP-to-Skype" gateway. You could connect an Asterisk box via SIP to an existing IP-PBX and enable connectivity from that IP-PBX to Skype users. You could even be incredibly stupid (given existing security issues) and connect your Asterisk box directly to the Internet and provide a SIP-to-Skype gateway. (If you aren't aware of the SIP security issues, listen to any of my Blue Box podcast episodes or read the VOIPSA blog.)

If the Skype For Asterisk module delivers the functionality it sounds like it will, there are a whole range of possibilities now available for interconnection between the Skype cloud and other VoIP systems simply by putting an Asterisk box in the middle.

We'll see. All of this is mere speculation until we can actually use the Skype For Asterisk module.

Technorati Tags: , , , , ,

Comments