Bridging Skype and Asterisk With PSGw

From Etel

Jump to: navigation, search

Contents

Title

Bridging Skype and Asterisk With PSGw

Problem

You'd like to connect your Skype account to your Asterisk server.

Solution

There are a few programs which allow you to connect Skype to your Asterisk server. One of these is the Personal Skype to H.323/SIP Gateway (PSGw).

Discussion

The MS Windows version of the product has seen a bit more development than the Linux version. The documentation for PSGw is a bit sparse. These notes are from the author's experimentation with getting the Linux version 1.6 of PSGw running.

Installation

One of the nice things about PSGw is that you can download a trial version.

1) Go to RSDev.com's PSGw Linux page and click on the link that starts with "Download evaluation version".

2) Create a working folder and move the PSGW tarball into it.

3) cd into the working folder and untar the tarball via "tar xvfz psgw_demo_1.6.tgz". Be sure to read all of "readme.txt".

4) Set up a SIP extension in /etc/asterisk/sip.conf which will allow PSGw to connect to Asterisk. It should look something like:

[skype-gw1]
type=friend
username=704
host=192.168.1.176
secret=XXXX
nat=no
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
context=sip

Note: change the username, secret, and host IP in the above to match your needs.

5) Inside of your working folder, create a config file for PSGw. It should look something like:

[SIP options]
IP address to use (listen)=192.168.1.176
Username=704
Password=XXXX
Proxy=192.168.1.175
Registrar=
Registrar username=guest
Realm=default
UserAgent=PSGw

[Advanced options]
MinJitter=250
MaxJitter=40
TranslateIP=
STUN=
UDP port base=5000
UDP port max=5199
RTP port base=5200
RTP port max=5399
RTP ToS=16

[Routing]
Forward incoming Skype call to=201@192.168.1.175
Incoming username: *
Incoming protocol: Skype
Outgoing username: 192.168.1.175
Outgoing protocol: SIP

Note the SIP section. Change username and secret in the SIP section to suit your needs. Note the two different IP addresses. If you're running Asterisk on the same box as PSGw, you'll have either run PSGw in a virtual machine or add an IP address to your NIC via something like "ifconfig eth0:1 inet 192.168.1.176".

Note the first entry in the "Routing" section. You may want to change "201" to "704" or wherever you want an incoming call to go. "201" is just part of the author's dialplan.

Running PSGw

Run PSGw via "./psgw13 -c myconf". PSGw should respond with something like:

PSGw for Linux Version 1.6.1 by RSDevs.com on Unix Linux (2.6.17-5mdv-i686)

Starting Skype...
Using configuration file /home/joat/workingfolder/psgw_1.6/myconf, other commandline parameters are ignored
Available codecs:  
PCM-16,G.711-ALaw-64k,G.711-uLaw-64k,G.726-16k,G.726-24k,G.726-32k,G.726-40k,GSM-06.10,iLBC-13k3,
 iLBC-15k2,LPC-10,MS-GSM,MS-IMA-ADPCM,SpeexNarrow-11k,SpeexNarrow-15k,SpeexNarrow-18.2k,
 SpeexNarrow-5.95k,SpeexNarrow-8k,SpeexWide-20.6k,YUV420P,H.261(CIF),H.261(QCIF),RGB32,RGB24
UDP ports: 5000-5199
RTP ports: 5200-5398
RTP IP TOS: 0x10
Using IP address udp$192.168.1.176
Waiting for incoming calls. Press Ctrl-C to exit

You should see something like the following in your Asterisk console (if you have the window open):

[Mar  1 08:30:58] NOTICE[5168]: chan_sip.c:12516 handle_response_peerpoke: Peer 'skype-gw1' 
 is now Reachable. (1ms / 2000ms)

When a call comes in from Skype, PSGw's terminal window should print something like the following:

Incoming Skype call
Calling to: 201@192.168.1.175
  3:37.644          SIP Handler:80e80c8         main.cxx(1519)  PCSS    Opened sound channel "" for recording.
Started sending GSM-06.10 to sip
Started receiving GSM-06.10 from sip
In call with sip:201@192.168.1.175 using
Xlib: unexpected async reply (sequence 0x12)!
Skype call disconnected

Note: Those last two lines show up when the call disconnects. It should be safe to ignore them.

Drawbacks

1) The calls can be a bit jittery. You mileage will most definitely vary. Conditions can be improved by experimenting with the "Advanced options" in "myconf".

2) PSGw is greedy in that it requires the use of /dev/dsp and won't tolerate any other program sharing it.

3) PSGw sets up its own SIP listener on port 5060, so you either have to add another IP address to your NIC or run PSGw (and Skype) on a dedicated machine. Note: the author used the "add an IP" approach (via "ifconfig eth0:1 inet 192.168.1.176"). Note: this does not obviate the conflict over /dev/dsp.

4) If issues (such as for dsp (above)) exist, PSGw does not terminate the SIP calls properly. In other words, you may notice a number of "open" SIP channels if PSGw is being bratty.

Troubleshooting

If some other program (e.g., a softphone) also accesses /dev/dsp, PSGw will run but incoming calls will cause it to complain and hang up.

/dev/dsp: Device or resource busy
Incoming Skype call
Xlib: unexpected async reply (sequence 0x18)!
Skype call disconnected

See Also:

http://www.rsdevs.com/psgw_linux.shtml

Metadata

  • By: Tim Kramer
Personal tools