VoIP
To use VoIP you need a VoIP client and an account with a VoIP
connection service provider.
Skype - don't use!
I looked at Skype, who
provide both a client and a connection service, but rejected them
because:
- They use a proprietary protocol, instead of the standard open
protocol SIP.
- Their Linux client is buggy, rudimentary, and virtually
unsupported (e.g. see this thread on
their forum).
- They were involved in many court cases concerning an earlier P2P
enterprise (Kazaa),
which installed malware on the client machines.
- They use client machines as a distributed server, which can
apparently
heavily load the client machine and its ADSL connection, even when the
client is not involved in a call of its own. Who knows what else they
might be doing on the client machine ...
- They charge for the landline telephone number that you need for
incoming calls. It's only £20+VAT per year, but you can get a
number free elsewhere.
sipgate
sipgate provide a
connection service. They charge (cheaply) for calls to landline
numbers, but everything else is free (including a landline number for
incoming calls).
They sell hardware telephones that connect to your ADSL line. They also
supply a free software client, but for Windows only.
However, since they use SIP, you should be able to use any VoIP client
that supports SIP.
They appear to be a German company with a strong presence in the UK
(good UK website and wide selection of UK telephone numbers to choose
from).
Registration is easy - just follow the instructions on the site.
Ekiga - couldn't get to work!
Ekiga (formerly known as
GnomeMeeting) is an open-source VoIP client, which is intended (as its
old name implies) for use with Gnome.
It's available as a Slackware package from linuxpackages, but has
several dependencies. I ended up downloading and installing the
following from linuxpackages:
and also the following from slackware.com:
Obviously, there may be later versions of these packages available now.
When I tried running Ekiga, I got a window pop-up with the error
"Gconf key error ..." and some suggested URLs that might help diagnose
the problem (FAQ at http://www.ekiga.org/,
troubleshooting section at http://www.gnome.org/projects/gconf/,
and mailing list archives at http://mail.gnome.org).
The first URL (Ekiga FAQ) suggests doing:
chmod -R 4755 /etc/gconf/gconf.xml.defaults/
killall -9 gconfd-2
but that didn't help. Couldn't find anything useful at the other URLs
or from a Google search - so gave up!
Twinkle
Twinkle is another
open-source VoIP client. This one has to be built from source, and also
has several dependencies,
some of which have to be built from source
too.
Four dependencies are available as Slackware packages:
Having downloaded and installed those, on to the source packages. The
following instructions use checkinstall
to build Slackware packages from the source downloads. I've put all the
Slackware packages that I built in this way in /usr/local/packages on sage, so
it should be possible to simply install those packages instead of
downloading and building the sources.
1. Download and install commoncpp2-1.5.0.tar.gz:
tar xvf commoncpp2-1.5.0.tar.gz
cd commoncpp2-1.5.0
./configure
make
mkdir doc-pak
cp -a doc config.log AUTHORS COPYING COPYING.addendum ChangeLog INSTALL INSTALL.w32 NEWS README THANKS TODO doc-pak
vim description-pak
checkinstall
2. Download and install ccrtp-1.5.0.tar.gz:
tar xvf ccrtp-1.5.0.tar.gz
cd ccrtp-1.3.6
./configure
make
mkdir doc-pak
cp -a doc config.log AUTHORS COPYING COPYING.addendum ChangeLog INSTALL NEWS README THANKS TODO doc-pak
vim description-pak
checkinstall
3. Download and install libzrtpcpp-0.9.0.tar.gz:
tar xvf libzrtpcpp-0.9.0.tar.gz
cd libzrtpcpp-0.9.0
./configure
make
mkdir doc-pak
cp config.log AUTHORS COPYING README doc-pak
vim description-pak
checkinstall
4. Download and install ilbc-rfc3951.tar.gz:
tar xvf ilbc-rfc3951.tar.gz
cd ilbc-rfc3951
./configure
make
mkdir doc-pak
cp config.log AUTHORS COPYING ChangeLog INSTALL NEWS README doc-pak
vim description-pak
checkinstall
5. Download and install twinkle-0.9.tar.gz:
tar xvf twinkle-0.9.tar.gz
cd twinkle-0.9
cp /usr/lib/qt-3.3.4/lib/qt-mt.pc /usr/lib/pkgconfig # should have happened as part of Qt installation???
./configure --without-kde
make
mkdir doc-pak
cp config.log AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS doc-pak
vim description-pak
checkinstall
You should now be able to run twinkle (but you may want to look at the
README and/or the start of the manual first).
When you first run twinkle, you have to create a user profile. You are
given a choice of a wizard or a profile-editor to do this. I chose the
wizard (which already knows about sipgate), but you can easily change
things afterwards using Edit->User Profile.
My settings (mainly from "Connection Information" on "My Account" page
at sipgate website) were:
- Name of profile: sipgate
- SIP service provider: sipgate.co.uk
- Username: 8788225
(from "SIP-ID")
- Password: ******
(from "SIP-Password")
Some other twinkle settings under Edit->System Settings that I
changed:
- General->Create system tray icon on startup: unchecked this to
get rid of the funny little "star" window.
- Audio->Reduce noise from microphone: unchecked this since it
actually introduced background crackling.
- Audio->Ring tone: selected "ALSA: plughw:0,0" to get ringing
via laptop internal speaker.
- Audio->Speaker and Audio->Microphone: selected "ALSA: other
device: plughw:Headset:0,0" to use my Logitech USB headset.
Logging and recording calls
Twinkle can be configured (under Edit->User profile->Scripts) to
call a script or program at various points during a call. See the manual
for details.
In order to log calls, I have configured twinkle to call the following
script for all trigger conditions (except call-release - see below):
#!
/bin/bash
# This script is called by
twinkle at various points during a call.
# It logs information about the
call.
TWINKLE_DIR=~/twinkle/
SCRIPT_DIR=$TWINKLE_DIR/scripts
CALLS_DIR=$TWINKLE_DIR/calls
LOG_FILE=$CALLS_DIR/log
if [[ $TWINKLE_TRIGGER ==
'in_call' || $TWINKLE_TRIGGER == 'out_call' ]]
then
echo >> $LOG_FILE
date +%c >> $LOG_FILE
echo "From: $SIP_FROM" >>
$LOG_FILE
echo "To: $SIP_TO" >>
$LOG_FILE
fi
echo " $(date +%H:%M:%S)
$TWINKLE_TRIGGER" >> $LOG_FILE
Calls are recorded by configuring the audio devices (Edit->System
settings->Audio) as follows:
Speaker: |
ALSA: Other device |
Other device: |
tee:"plughw:Headset",/home/fog/twinkle/calls/spk.raw |
Microphone: |
ALSA: Other device |
Other device: |
tee:"plughw:Headset",/home/fog/twinkle/calls/mic.raw |
and configuring twinkle to call the following script for the two
call-release conditions:
#!
/bin/bash
# This script is called by
twinkle when a call ends.
# It saves the recording of the
conversation.
TWINKLE_DIR=~/twinkle/
SCRIPT_DIR=$TWINKLE_DIR/scripts
CALLS_DIR=$TWINKLE_DIR/calls
$SCRIPT_DIR/log.sh
cd $CALLS_DIR
time=$(date +%Y%m%d-%H%M%S)
mv mic.raw mic-$time.raw
mv spk.raw spk-$time.raw
sox -swr 8000 mic-$time.raw -c 2
mic-$time.wav pan 1
sox -swr 8000 spk-$time.raw -c 2
spk-$time.wav pan -1
soxmix -v 1.0 mic-$time.wav -v
1.0 spk-$time.wav $time.wav
lame --quiet -V 2 $time.wav
$time.mp3
rm -f mic-$time.raw spk-$time.raw
mic-$time.wav spk-$time.wav $time.wav
This method of recording calls is based on suggestions from a thread
in the twinkle form.
NAT and firewall
The SIP and RTP protocols used by VoIP have problems getting though the
NAT (Network Address Translation) that allows us to have several
computers sharing the same public IP address.
There are two methods of dealing with this:
- We can
configure the VoIP clients (i.e. Twinkle) to use our public static IP
address, but using different ports on different machines. We then set
up fennel to forward all the relevant ports to the appropriate
computer.
- We can use
the STUN server provided by sipgate (stun.sipgate.net), and configure
Twinkle accordingly.
Apparently the STUN server helps Twinkle to figure out what fennel's
NAT is doing to IP addresses and ports, so Twinkle can put the right
addresses/ports in the packets it sends.
The STUN method seemed to work for a single client without any change
to firewalls on fennel
or the laptop. But it didn't work reliably for two clients (on
different machines).
So we have to use the first method, which requires a bit more setup. We
need to configure:
- fennel to forward the appropriate ports to the appropriate
laptop
- firewalls on the laptops to let in packets destined to the
forwarded ports
- twinkle to use our static IP address and different ports on each
laptop
Fennel configuration:
- under Services define names for the port ranges to be forwarded:
Service Type |
Ports |
SIP1 (UDP) |
5060 - 5061 |
RTP1 (UDP) |
8000 - 8005 |
SIP2 (UDP) |
5062 - 5063 |
RTP2 (UDP) |
8006 - 8011 |
- under Firewall Rules define rules to forward the port ranges to
nettle and rocket:
Service
Name |
Action |
LAN Server
IP address |
WAN Users |
Log |
RTP2 |
ALLOW always |
192.168.183.13 |
Any |
Never |
SIP2 |
ALLOW always |
192.168.183.13 |
Any |
Never |
RTP1 |
ALLOW always |
192.168.183.7 |
Any |
Never |
SIP1 |
ALLOW always |
192.168.183.7 |
Any |
Never |
Laptop firewall configuration - use following line in /etc/rc.d/rc.firewall:
PERMIT="192.168.183.0/24 5060-5063/udp 8000-8011/udp"
Twinkle configuration:
- Under Edit->User Profile->NAT select "Use statically
configured ..." and enter our fixed IP address (82.71.13.216)
- Under Edit->System Settings->Network enter 5060 (on rocket)
or 5062 (on nettle) for SIP UDP port, and 8000 (on rocket) or 8006 (on
nettle) for RTP port
DTMF
If you have to use the keypad when you are in a call (e.g. to select
from a menu, enter a number, etc.) then your keypresses are transmitted
using "DTMF". There seem to be three methods of doing this with SIP:
- In-band - the keypresses are sent as tones over the normal voice
channel. This is what is used with ordinary telephones.
- RFC2833-DTMF - the keypresses are sent as special packets.
- RFC2833-INFO - the keypresses are sent as special packets,
but different from the second alternative!
Twinkle supports the first two options.
It's not clear what sipgate supports, but their voicemail doesn't
work with twinkle. Calls via sipgate to ordinary phones work with
"in-band", but not with RFC2833-DTMF.
There's a long thread
on this issue in the twinkle forum. It sounds as though the "INFO"
method might be added to twinkle fairly soon.
For now, though, configure twinkle Edit->User
Profile->RTP->DTMF->DTMF Transport to "Inband".
UPDATE 1 Oct 2006: There's a new version (0.9) of Twinkle that supports
INFO DTMF. It seems to work initially with sipgate voicemail, but then
stops. I've switched back to using Inband... (but that also seems to
stop working part way through a call).
codecs
A codec is used to encode/decode speech in order to send it digitally.
sipgate supports the following codecs:
- G.729
- G.711
- iLBC
- GSM
- G726
Twinkle supports:
- speex-wb (16kHz)
- speex-nb (8kHz)
- iLBC
- G.711 A-law
- G.711 u-law
- GSM
- speex-uwb (32kHz)
They seem to end up agreeing to use G.711A - so sipgate's
preference ordering seems to take priority over Twinkle's.
There is useful information here and a
comparison table here.
G.711 is the standard codec,
used over landlines. It uses no compression, so there is no
encoding/decoding delay and loss of quality due to compression. It is,
however, expensive on bandwidth (64kbps).
iLBC and GSM are lower-bandwidth (around 13kbps) than G.711. GSM was
designed for mobile phones. iLBC is specifically designed for the
internet, and is supposedly more tolerant of lost packets - so it might
be the best choice when the bandwidth/reliability of the connection is
dubious (like over my wireless link!). G.711 should provide better
quality when the bandwidth is available.