Raspberry Pi and OpenBTS

Great little article: “How to shrink a 30ft base-station into a three-inch Raspberry Pi” here:


Not quite sure a Raspberry Pi can be used to shrink a 30ft base-station without the additional costs of a duplexer and some power amplification! Also I have concerns that the Pi doesn’t have enough physical RAM. But hats off – it shows the art of the possible.

From my own experiences and like the folks at PA Consulting Group say “Overcoming some seriously complex obstacles along the way, we successfully managed to route voice and SMS traffic through the computer”. For me the biggest obstacle to date on Centos 5 / RHEL 5 has been sorting out all the package version dependencies.

For my project I’m planning to use a Fairwaves (http://fairwaves.ru/) UmTRX (http://code.google.com/p/umtrx/) as the GSM transceiver rather than an Ettus USRP (http://www.ettus.com/). This will give me a bit more flexibility to use the same hardware for other projects in the future.


Also rather than having my own screened-room facility my research suggests that an old Microwave oven with some copper mesh should make a cheaper Faraday cage (although the UmTRXv2 is pretty low-power at 50-100mW anyway)!

More soon.


Driving some relays from a Genesys routing strategy!

Firstly a very Merry Christmas and best wishes for a successful 2013. I’ve not written many blog posts in 2012 – just been too busy and plan to rectify that in 2013. Anyway, a little fun project to keep the brain cells working over the festive period …

For this project you need a Raspberry Pi (http://www.raspberrypi.org/) The Raspberry Pi allows peripherals and expansion boards to access the CPU by exposing the inputs and outputs. The Raspberry Pi board has a 26-pin expansion header, marked as P1, arranged in a 2×13 strip. Amongst other things this provides 8 GPIO pins.

We need to build a circuit to drive the relay from one of the Raspberry Pi General Purpose Input/Output (GPIO) pins (http://elinux.org/RPi_Low-level_peripherals) as shown below:


The parts required are:

2N3904 transistor
6V 10A PCB Relay
1N4004S diode
1K2 Metal Film 0.6W Resistor

This circuit is needed as the Pi’s GPIO pins are 3.3V and the maximum current is 16mA which is not enough to drive a 5v relay directly but is enough to switch a transistor on and off. Essentially, to activate the relay, all the circuit does is send a few milliamps at 3.3V from the GPIO pin, through a 1K resistor. This current is enough to saturate the transistor, causing current to flow on the 5V rail through the transistor, and therefore also through the relay’s coil.

The relay circuit wired to GPIO 17 via the 26-pin expansion header:


To control the GPIO pins we install Apache and PHP5 on the Pi and use a PHP library from here: http://www.huubknops.com/rpi-gpio. The following Linux commands do most of the work:

sudo apt-get update
sudo apt-get install apache2
sudo apt-get install php5 php-xml-serializer php5-gd

cd /var/www
sudo wget http://www.huubknops.com/rpi-gpio/gpio.tar.gz
sudo tar zxvf gpio.tar.gz
sudo bash -c “echo www-data ALL=\(ALL\) NOPASSWD: ALL >> /etc/sudoers”

All we need to do now is to call the relevant PHP scripts from Web Service blocks within a Genesys IRD based routing strategy:




I can’t think of many real world applications at the moment. If you can then please drop me an email. For now I am using it to turn on a blue flashing light!


Look out for some more posts soon – details of CLiDE (Craig’s Little Development Environment) including SBC, core IN, Voxeo, Sangoma and Genesys integration as well as my own GSM mobile test network using OpenBTS (http://en.wikipedia.org/wiki/OpenBTS) as the base transceiver station (BTS)!



It has been quite a long time since my last full post so firstly apologies!

As part of my current project work I have been investigating some support and maintenance tools and stumbled across HOMER SIP Capture (http://www.sipcapture.org/):

“HOMER is a robust, carrier-grade, scalable SIP Capture system and Monitoring Application with HEP/HEP2, IP Proto4 (IPIP) encapsulation & port mirroring/monitoring support right out of the box, ready to process & store insane amounts of signaling with instant search, end-to-end analysis and drill-down capabilities for ITSPs, VoIP Providers and Trunk Suppliers using SIP signaling”.

Sounds interesting! There is a video on YouTube here: http://www.youtube.com/watch?v=5OhAcwW1ouY

Technically, HOMER Capture Nodes use the SIP capture module which is part of Kamailio / OpenSER (http://www.kamailio.org) and a couple of maintenance Perl scripts for statistics, database maintenance / partitioning and log file purging. A centralised AJAX based web front end (WebHomer) written in PHP is used to search captured SIP messages stored on the capture nodes and to display the results or export them to PCAP for viewing in Wireshark.

A standalone Capture Agent can also be deployed. This captures IP packets using the PCAP library and sends them to a Capture Node (Kamailio). I’ve not tried using this yet but then I get time I am planning to compile the agent on my Raspberry Pi (http://www.raspberrypi.org/) and use that as a capture node.

The main interface between each Capture Node (Kamailio) and WebHomer is a MySQL database table named “sip_capture”. MySQL partitioning in conjunction with a Perl script run as a daily cron job is used for maintenance of this table.

Once installed (see below) it does everything shown in the video and hence provides the basis for a useful SIP diagnostic tool. Here are some screenshots from my own installation:






Installation and Configuration

The installation and configuration instructions here (http://code.google.com/p/homer/wiki/HOWTO) leave a little to be desired! Therefore I have supplemented them below based on my own experiences of installing HOMER on a RHEL / CentOS 5.8 x86_64 distro.

STEP 1: Install the correct versions of Apache HTTP, MySQL and PHP.

Note that PHP GD is required for image processing. Since my install is based on CentOS 5.x I had to get the correct versions from the Remi repository:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

yum –enablerepo=remi install httpd php php-common
yum –enablerepo=remi install php-cli php-mysql php-mbstring php-mcrypt php-xml
yum –enablerepo=remi install php-gd
yum — enablerepo=remi install mysql-server

chkconfig –levels 235 mysqld on
chkconfig –levels 235 httpd on

service mysqld start
service httpd start

STEP 2: Install Kamailio.

rpm -Uvh http://download.opensuse.org/repositories/home:/kamailio:/telephony/CentOS_CentOS-5/x86_64/kamailio-3.3.0-9.1.x86_64.rpm

rpm -Uvh http://download.opensuse.org/repositories/home:/kamailio:/telephony/CentOS_CentOS-5/x86_64/kamailio-mysql-3.3.0-9.1.x86_64.rpm

STEP 3: Create Kamailio (Capture Node) database.

Edit “/etc/kamailio/kamctlrc” (by default the database name is “openser“)
Run “/usr/sbin/kamdbctl create”

STEP 4: Create HOMER specific database tables.

Run the scripts “create_sipcapture.sql” and “statisics.sql” against the “openser” database schema.

STEP 5: Create a new database user named “homer@localhost“. Ensure that the user “homer@localhost” has read permissions on the HOMER specific database tables.

NOTE: Ensure that MySQL users and permissions are correct. In a distributed configuration a user will need to be created for each server hosting WebHomer e.g. a user named “homer@<IP address of WebHomer server>”.

STEP 6: Configure Kamailio.

Copy “kamailio.cfg” from the HOMER installation media to “/etc/kamailio/kamailio.cfg”. Edit “/etc/kamailio/kamailio.cfg”

The main changes I made are shown below:

modparam(“sipcapture”, “db_url”, “mysql://homer:<password>@localhost/openser“)
modparam(“sipcapture”, “raw_interface”, “eth1“)

route {
onreply_route {

STEP 7: Start Kamailio:

chkconfig –levels 235 kamailio on
service kamailio start

STEP 8: Install WebHomer:

cd /var/www
tar -xvf webHomer_3_2_4.tar

STEP 9: Create HOMER (WebHomer) database. For my installation I named the database instance “homer“.

STEP 10: Create HOMER database tables. Run the script “homer_users.sql” against the “homer” database schema.

STEP 11: Create a new database user named “homer@localhost“. Ensure that the user “homer@localhost” as full permissions.

STEP 12: Copy WebHomer configuration files:

cd /var/www/webhomer
mv configuration_example.php configuration.php
mv preferences_example.php preferences.php
chown apache tmp

STEP 13: Edit “preferences.php”:


STEP 14: Edit “configuration.php”:

define(HOST, “localhost”);
define(USER, “homer”);
define(PW, “<password>”);
define(DB, “homer“)

define(HOMER_HOST, “localhost”);
define(HOMER_USER, “homer”);
define(HOMER_PW, “<password>”);
define(HOMER_DB, “openser“);
define(HOMER_TABLE, “sip_capture”);


STEP 15: Edit “/etc/httpd/conf/httpd.conf” to add an alias to “webhomer”:

Alias /webhomer “/var/www/webhomer”

STEP 16: Copy the following Perl scripts to “/usr/sbin”:

  • partrotate_unixtimestamp.pl
  • statistic.pl

chmod +x /usr/sbin/statistic.pl
chmod +x /usr/sbin/ partrotate_unixtimestamp.pl

STEP 17: Edit the Perl scripts to have the correct connection details to the Kamailio (“openser”) database schema:

$mysql_table = “sip_capture”;
$mysql_dbname = “openser“;
$mysql_user = “homer”;
$mysql_password = “<password>”;
$mysql_host = “localhost”;

STEP 18: Setup cron jobs to run “statistic.pl” every 5 minutes and “partrotate_unixtimestamp.pl” daily.

You are done!


Quick and easy Sequence Diagrams / Call Flows

If you have ever tried to create sequence diagrams / call flows in Visio you already know how tedious it is. Even worse when you need to make changes (hey – what call flow is 100% correct the first time?).

As an alternative to Visio check out SD Edit here – http://sdedit.sourceforge.net/

Since SD Edit is all text based it is very quick and easy to create a call flow like the one below and more importantly just as quick to add, remove or modify message flows.

Media Server to ACMS Resilience


Raspberry Pi as a wallboard driver

If you haven’t heard about Raspberry Pi then check it out here: http://www.raspberrypi.org/. Put simply it is an ARM GNU/Linux box for $25!

Given that the Pi has an HDMI output I wondered whether it could be used in conjunction with a cheap LCD display as a wallboard taking streaming content from a UPNP Media Server which combines Genesys Stat Server data with audio and video content to create a dynamic wallboard experience in Contact Centre environments. Certainly cheaper and more visual than old fashioned Symon wallboards!

There are some YouTube videos here which give an idea of the video capabilities of the Pi:




XBMC looks like a good starting point for the project in conjunction with a UPNP Media Server such as MediaTomb.

May be when I get some time I’ll start doing some playing …