Using sipgate.de on Linux with Linphone SIP client

Note: This is a follow-up blog entry to yesterday’s post about using the Zoiper SIP client on Linux. Linphone works comparably well so far and if I won’t come across any issues, I will recommend Linphone, since it is fully Open Source, which future-proofs is existence and allows others to contribute and improve the software better than for a closed-source product like Zoiper.

Linphone is a GPL licensed SIP client (“softphone”). It has been around since 2001 and is actively developed by the French company Belledonne Communications.

As the name suggests, the software was first developed for Linux but has gradually become truly cross-platform, now supporting Windows, MacOS, Linux, Android, iOS, Windows Phone 8 and most recently a web edition. For most operating systems, simply visit linphone.org and follow the download and installation steps indicated there.

Users of GNU/Linux distributions like Debian, Ubuntu, etc, install the distribution package through their favorite package manager. On my Debian stable (“wheezy”) I did this today:

sudo apt-get install linphone

Then I started up Linphone from the XFCE Start menu, where it is listed in the “Internet” submenu. I canceled the account setup wizard because it didn’t seem to work for me, disabled Video in the Options menu because I am not planning to use it yet, then selected Options – Preferences – Manage SIP accounts and configured my sipgate.de account like this:

Your SIP identity: sip:3998984@sipgate.de
SIP Proxy address: sip:sipgate.de

Screenshot

linphone-sipgate-account

Note that “3998984” is my sipgate.de SIP account name, so you have to substitute it with yours, but note that it is usually not the same as your sipgate.de web login username.

After this initial setup, I successfully tested the account and my headset by calling the sipgate.de test number 10005, which works very similarly to the Skype test call feature.

For personalized config information you can log in at sipgate.de and consult the “Konfigurationshilfe“, selecting one of the Linphone entries from the softphone device lists. I have a sipgate.de basic account, so if you are on a different plan, details may vary slightly.

If this blog post was helpful and/or if something seems inaccurate, please leave a comment. Happy telephoning …

Using sipgate.de on Linux with Zoiper SIP client

I use sipgate.de for international phone calls, using a Grandstream HandyTone IP-to-analog adapter installed in our house, but also using a SIP-capable “softphone” application.

Update: Open Source SIP client software like Linphone, SFLphone, Ekiga or others are preferrable to the below mentioned closed source applications. I successfully use Linphone now, which is also the only Open Source softphone that is explicitly listed by sipgate on their supported devices page.

Below is the original post about Zoiper, which might be of interest if you for some reason don’t like Linphone.


On Windows I have successfully used the PhonerLite freeware (binary download at no charge, proprietary licensed closed-source), which is not available for Linux.

But today I found out, that Sipgate also recommends a SIP client called Zoiper, which is available for Linux. It is also closed-source freeware. But at least – unlike Skype – the installer package has support for 32bit and 64bit Linux systems and the company behind Zoiper seems to develop for all target platforms equally (Android, iOS, Windows Phone 8, Windows, Linux, Mac, Web Browsers).

The Zoiper website has detailed step-by-step installation instructions. To summarize, the installation works like this, assuming the downloaded file is Zoiper_3.3_Linux_Free_32Bit_64Bit.tar.gz :

tar xvzf Zoiper_3.3_Linux_Free_32Bit_64Bit.tar.gz
sudo ./Zoiper_3.3_Linux_Free_64Bit.run

I specified /opt/zoiper as the installation directory.

Then I added an account like this (my SIP account username is 3998984, this is not the sipgate.de web login user name):

zoiper-sipgate-config

The audio devices (speaker, mic) can be configured and tested using the “Audio wizard”:

zoiper-audio-wizard

Human readable timestamp for filenames

I use this bash alias (should work in Linux, Cygwin, probably MacOS, maybe other Unixes):

alias timestamp="date --rfc-3339=ns | tr ' '  '_'"

Then use it like this for example to archive a file:

mv somefile somefile_$(timestamp)

You should see something like

`somefile' -> `somefile_2014-11-13_11:45:46.980175800-04:00'

If you don’t like colons in file names, change tr ' ' to tr ' :'.

Start script for stand-alone Java process

Directory structure

  • lib
    • some.jar
    • another.jar
  • config
    • dev
    • uat
  • start.sh
  • .setenv.sh

.setenv.sh

#!/bin/bash 

# environment (typically 'dev', 'uat' or 'prod') 
env=

# absolute path to java home ( >= 1.7 ) 
# such that $java_home/bin/java exists 
java_home=${JAVA_HOME} 

# add any additional environment setup here:

start.sh

#!/bin/bash 

# script should exit if any command fails 
set -e 

function envfail() { 
  echo $1; 
  echo "Please adjust $setenv_script and retry ..." 
  exit 1 
} 
function check_not_empty() { 
  if [ -z "$1" ]; then 
    envfail "Variable '$2' is unset or empty." 
  fi 
} 

script=$(readlink -f "$0") 
if [[ "$script" =~ .*[[:space:]].* ]]; then 
  echo "Script path contains spaces: $script" 
  echo "Please fix and retry ..." 
  exit 1 
fi 

# ok, now we know $script contains no spaces so 
# we don't need quoting acrobatics from here on 

dir=$(dirname $script) 
parent=$(dirname $dir) 
setenv_script=$parent/setenv.sh 

if [ ! -e $setenv_script ]; then 
  echo "$setenv_script not found" 
  cp $dir/.setenv.sh $setenv_script 
  envfail "Created a default $setenv_script for you." 
fi 
setenv_script_file=$(readlink -f $setenv_script) 
if [ -r $setenv_script_file ]; then 
  echo "Sourcing $setenv_script" 
  source $setenv_script 
else 
  envfail "Cannot read $setenv_script" 
fi 

check_not_empty "$env" 'env' 
config_env=$(readlink -f "$dir/config/$env") 
if [[ ! -r "$config_env" || ! -d "$config_env" ]]; then 
  envfail "Invalid env=$env : Cannot read directory $config_env" 
fi 

check_not_empty "$java_home" 'java_home' 
java="$java_home/bin/java" 
if [ ! -e "$java" ]; then 
  envfail "$java is not an executable file" 
fi 
java_version=$("$java" -version 2>&1 \
               | head -n 1 | cut -d'"' -f2 | cut -d'.' -f2) 
if [ $java_version -lt "7" ]; then 
  envfail "Java 1.7 or higher is required." 
fi 

# turn on bash debug output for the following lines 
set -x 

cd $dir 
mkdir -p "../log" 

nohup \ 
"$java" -cp "$config_env:lib/*" \
        net.doepner.example.Main \ 
        > "../log/example_stdout.log" 2>&1 & 

Get java version string via shell commands

Determine the pure java version string from any Unix/Linux shell (including Cygwin):

java -version 2>&1 | head -n 1 | cut -d'"' -f2

This requires only the very commonly available and lightweight “head” and “cut” commands.

I originally found the one-liner on stackoverflow. Thanks to the friendly folks who shared it.

To get only the major version part (e.g. 8 for Java 1.8.x, 11 for 11.x), use this:

java -version 2>&1 \
  | head -1 \
  | cut -d'"' -f2 \
  | sed 's/^1\.//' \
  | cut -d'.' -f1

Note: The sed step is required for versions up to Java 8 that start with the “1.” prefix.

Example: Ensure Java 11 or higher:

#!/bin/bash

version=$(java -version 2>&1 \
  | head -1 \
  | cut -d'"' -f2 \
  | sed 's/^1\.//' \
  | cut -d'.' -f1 
)

if [ $version -lt "11" ]; then
  echo "Java 11 or higher is required."
  exit 1
fi

Use xtrlock via XFCE 4.8 lock button

I currently use XFCE 4.8 on Debian Wheezy as my desktop system. Its panel supports so-called “action buttons” for hibernate, lock, shutdown, etc.

I use one of those buttons to lock the screen but I don’t like xscreensaver (too ugly, don’t need the screensaver stuff), gnome-screensaver (too many dependencies), xlock and its successor xlockmore (too ugly) or slock (just a black blank screen always confuses me).

Good thing is that I found xtrlock which does what I want: It just shows a lock symbol instead of the mouse cursor, all screen content is still visible but user interaction is blocked until the current user password has been typed in.

This is just enough to prevent my 2 and 5 year old children from messing around with my laptop. So I installed it:

sudo apt-get install xtrlock

Problem was that the XFCE lock button calls xflock4 which is a simple shell script that has hardcoded support for the afore-mentioned set of lock programs, but not for xtrlock.

My simple solution was to take advantage of /usr/local/bin being usually before /usr/bin in the PATH and create a script /usr/local/bin/xflock4 with this content:

#!/bin/sh
xtrlock

Make it executable with

sudo chmod a+x /usr/local/bin/xflock4

Now I can use the XFCE lock button and get what I want.

Alternatively, there are a couple of other light-weight lock programs for Linux:

“Why do I have to pay for Redhat if it is ‘Free Software’?”

Unfortunately but quite naturally, there are many many people who are surprised when they first learn that “Free Software” is not necessarily available as a free-of-charge download in immediately usable (i.e. compiled binary) form.

“Free” is an ambiguous word in the English language: Free like “free beer” (= gratis, free of charge) versus free like “Free Speech” (= libre, based on guaranteed freedoms, liberties).

This ambiguity is an old problem of the term “Free Software” – first coined by the “Free Software Foundation” (FSF) in the 1980s – and was actually one factor that motivated the foundation of the “Open Source Initiative” (OSI) and its official definition of “Open Source”.

Both definitions use the same criteria and are essentially different names for the same category of software. To acknowledge and peacefully combine both of these naming conventions some people also speak of “Free/Libre Open Source Software” (FLOSS).

The Redhat Linux distribution is Free/Libre Open Source Software. The source code is licensed under the GPL and similar Open Source licenses and can be downloaded from Redhat’s ftp server. The binaries are not available as gratis download, which is perfectly in line with FLOSS rules.

For almost every IT professional these days, it is very beneficial to understand what “Free/Libre Open Source Software” (FLOSS) is. It might seem like a complex and dry subject at first, especially when some business folks confuse things further by using the vague term “Intellectual Property” for everything from copyright, trademarks, patents to license agreements, etc.

Minimal Debian Wheezy netinstall – no network after reboot

I just installed Debian Wheezy on a Toshiba laptop using the netinstall CD.

During installation everything worked fine, ethernet and wireless interfaces were both detected and functional. I actually did the installation using the wireless connection. On the “Task selection” screen I only selected “Laptop” and “Standard system utilities”.

However, after the reboot at the end of the installation, I had no network anymore. Here is what I did to fix it:

Edit /etc/network/interfaces and add this block:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

Then run as root:

/etc/init.d/networking start

If the machine is connected via ethernet cable to a router, you should see messages about your network being configured via DHCP, i.e. receiving its local IP address.

If you get error messages, then you might have to install firmware for your network card:

On another computer, download firmware.tar.gz and save it to a USB stick.

Then do the following as root on the new Debian system:

Plug in the USB stick and mount it. You might have to run “dmesg” to see which device file to mount. In my case it was /dev/sdb

mount /dev/sdb /mnt

Unzip the firmware tarball:

cd /mnt
tar xvzf firmware.tar.gz

Install the core firmware packages:

dpkg -i firmware-linux-*.deb

Install additional firmware packages as necessary. Use the output of the lspci command to identify your network cards. Consult the “Firmware” Debian wiki page to find out what package you have to install.

If you are done installing firmware, restart the system:

shutdown -r now

Hopefully you will have a network connection after the reboot.

A minttyrc for black on white with red block cursor

I don’t particularly like the tradition of light text on dark backgrounds in everything that (shell) coders or Unix admins seem to use. But even the Jetbrains folks provide a Darcula theme now.

Anyway, I want more light in my mintty – which is the default Cygwin terminal – and an easy to find cursor:

oliver@windowsbox ~
$ cat .minttyrc 

BoldAsFont=yes
BoldAsColour=yes
BackgroundColour=240,220,180
ForegroundColour=0,0,0
CursorColour=255,0,0
CursorType=block
Black=0,0,0
BoldBlack=0,0,0
Red=160,0,0
BoldRed=80,0,0
Green=0,160,0
BoldGreen=0,80,0
Yellow=80,80,0
BoldYellow=40,40,0
Blue=0,0,160
BoldBlue=0,0,80
Magenta=100,0,60
BoldMagenta=50,0,30
Cyan=60,0,100
BoldCyan=30,0,50
White=60,60,60
BoldWhite=40,40,40
Font=Lucida Console
FontHeight=10

If you come across other colors that are too light to be readable on white background, just add more ColorName=0,0,0 lines in this file. Make sure you consult the related mintty reference documentation.

For existing work on more beautiful(?) but IMHO less ergonomic palettes of colors, you might want to check out these “Solarized” color configs for mintty.

XFCE 4.8 panel : Fix missing Suspend and Hibernate icons

The “Action Buttons” panel plugin of XFCE 4.8 on Debian “wheezy” has a known bug regarding missing icons for the Suspend and Hibernate actions and users will only see a generic placeholder icon.

Ognyan Kulev who reported the bug says this is because most icon themes do not provide icons named “system-suspend” and “system-hibernate”.

As a work-around he suggests linking to the corresponding xfce4-power-manager icons. This fixed the issue on my Debian laptop:

sudo apt-get install xfce4-power-manager-data
cd /usr/share/icons/hicolor/scalable/actions
sudo ln -s xfpm-suspend.svg system-suspend.svg
sudo ln -s xfpm-hibernate.svg system-hibernate.svg
sudo gtk-update-icon-cache-3.0 -f ../..

I saved save the commands into a shell script so I can run it again if the symbolic links get deleted during an apt-get update or accidental apt-get remove:

echo "#! /bin/sh" > /usr/local/bin/fix-xfce-action-icons.sh
chmod ugo+x /usr/local/bin/fix-xfce-action-icons.sh
sudo vim /usr/local/bin/fix-xfce-action-icons.sh