If you are using the Twinkle SIP phone to connect through a STUN server, you may be unable to REGISTER. This is due to SIP Express Router sending a wrong Call-ID in REGISTER responses, and Twinkle matching responses for REGISTER requests by looking at the Call-ID instead of the Via branch and the CSeq method.

Introduction

This page gives a workaround for the problem outlined above: being unable to register through STUN to some servers running SIP Express Router.

You will have to either download a precompiled package or rebuild one yourself.

Bug description

The problem can be described like this: You can't register your profile, and if you look in the logs, you can see something like this:

The REGISTER gets sent:

REGISTER sip:yourname@SIP_DOMAIN SIP/2.0
...
Call-ID: ...@SIP_PROXY_IP
...

This gets received:

SIP/2.0 401 Authentication Required
...
Call-ID: ...@YOUR_LOCAL_IP
...

And Twinkle complains that the response doesn't match any transaction. While the obvious right solution is to upgrade the SER software, you can't always do that, so patching your SIP client is what you sometimes have to do.

Although according to RFC 3261, an endpoint SHOULD send REGISTERs through a single Call-ID, it's arguable that matching responses to REGISTER requests should be done by Twinkle simply as the RFC describes (section 17.1.3): using via.branch and cseq.method.

Precompiled packages

Binary packages for whatever distributions I recently used are available:

Table: Binary packages for Ubuntu
Version Arch Package
Gutsy (7.10) i386 twinkle_1.0.1-1build2_i386.deb
Hardy (8.04) AMD64 twinkle_1.1-2build2_amd64.deb

Download the one that fits and install with gdebi <package-name> or with dpkg -i or whatever else suits you.

Building from source

Even if building from source, you might prefer to generate a package for your distribution, so that you can uninstall, upgrade, etc. later. For Ubuntu-specific steps, see Ubuntu instructions below.

Basically you have to apply a patch and recompile. Patches for a few versions of Twinkle are included:

Table: Patches for Twinkle
Version Patch
1.0.x twinkle-nat-1.0.patch
1.1.x twinkle-nat-1.1.patch

Apply to the source directory (twinkle-1.x) with patch -p1 < filename.patch and then ./configure && make and make install afterwards.

Building on Ubuntu

You will need some tools for rebuilding packages in general. I got them with:

sudo apt-get install dpkg-dev build-essential fakeroot

Then install the packages needed for building Twinkle:

sudo apt-get build-dep twinkle

Then make a directory for the source package and download it:

mkdir twinkle-build
cd twinkle-build
sudo apt-get source twinkle

Apply the patch in the source dir. For Ubuntu 8.04 that would be:

cd twinkle-1.1
patch -p1 < path/to/twinkle-nat-1.1.patch

And finally build the package:

fakeroot debian/rules binary

This should produce the .deb package in twinkle-build.