Potty Page

April 5, 2008

Skype+SippySkype+Asterisk

Some of you will know I like to play with VoIP...

Quite a lot of the time when people I speak to online want to talk to me using VoIP, they want to use Skype. To a VoIP purist, this have levels of wrongness. In the past I've convinced people to install Freshtel Firefly. This means that they can talk to me on VoIP with little setting up required at their end (like Skype, but without the bad karma of using Skype).

Anyways, I've decided it's a bit unfair to people making them install another piece of VoIP software if they've got Skype... so I've been looking into getting Skype to integrate with Asterisk.

Most bits of software to do this cost money. I've found SippySkype, which does the job (sort of) and costs nowt. It's a Skype to SIP gateway, so can be used to get Skype to talk to any SIP device (and a SIP device to Skype).

It's taken some doing to get it working though...

Here's some handy hints should you be trying it.

  • If you get it working, but audio remains on your PC instead going to the SIP device.... check the version of Java installed on your PC (with java -version). You need Java version 1.6 or greater.
  • If it refuses to register with asterisk... try setting the realm in sippyskype.cfg to asterisk.
  • Also try setting the SIP username in asterisk to be your skypeuser name - it seems to try and authorize with that rather than the username you set in the config file.
  • Calls from Skype to SIP not working? I think there's a bug in mjsip. Basically, when a call is being sent to Asterisk and Asterisk sends back a "407 Proxy Authorization Required", mjsip just sends back another INVITE, with the authorization digest. It doesn't first send an ACK to let Asterisk know it's got the 407. When Asterisk doesn't get the ACK, but gets the INVITE it sends back a "491 Request Pending" and the call fails.

    I hacked mjsip_1.6/src/org/zoolu/sip/dialog/ExtendedInviteDialog.java and added

    Message ack=MessageFactory.createRequest(this,SipMethods.ACK,null);
    TransactionClient acktc=new TransactionClient(sip_provider,ack,this);
    transactions.put(acktc.getTransactionId(),acktc);
    acktc.request();

    Between

    { attempts++;

    and

    Message req=tc.getRequestMessage();

    This of course might not be exactly correct and might cause a memory leak if a lot of calls are handled - it was a quick fix... if someone knows the best way of doing this let me know!

The SIP bit of my sippyskype.cfg file looks like this...

host_port=5061
transport_protocols=udp
ua_jar=ua.jar
contact_url=sip:myskypeusername@ipaddressofmypc:5061
from_url="Skype Account" <sip:myskypeusername@myasteriskbox.example.com:5060>
username=myskypeusername
realm=asterisk
passwd=myreallycomplicatedpassword
expires=6000
minregrenewtime=60
regfailretrytime=15
do_register=yes

I'm using port 5061 because I run a soft phone on the machine, which is on 5060. You can use 5060 if you want!

And that's that. The sip.conf file for Asterisk has...

; skype gateway account
[myskypeusername]
username=myskypeusername
type=friend
context=default
secret=myreallycomplicatedpassword
host=dynamic
nat=no
dtmfmode=auto
canreinvite=no
port=5061
defaultip=ipaddressofmypc

I've noticed that if someone from Skype calls and then hangs up... the call does not get torn down; the phones keep ringing. I'm looking into trying to fix this too... and if I do I'll get back to you.

I hope this helps someone, if so let me know.

Why not try it out? My status

Posted by Ed at April 5, 2008 5:21 PM | Geek |