What you need:
- A Raspberry Pi
- An SD card loaded with Raspbian Wheezy (the default Pi OS)
- A SIP phone (of soft SIP phone on another PC)
- Some sort of SIP gateway if you want to talk to the outside world
I control My Pi through SSH, but you could easily configure it with a keyboard and an HDMI monitor if you have them lying around.
1. Upgrade your OS
All of the following commands need to be run as the root user. That means you need to prefix them with
However, if you’re feeling lazy, just open a shell as the root user using
And ignore all the sudos. Of course, be careful as you could entirely mess your system in unexpected ways yada yada…. Of course, if you’re using a Raspberry Pi then the worst case scenario is that you’ll lost a couple of hours work and have to flash Raspbian onto the SD card again. Before running a command as root, think about why you’re running it, and why you need to be root to achieve it.
To fetch the latest repo index and upgrade any packages:
sudo apt-get update && sudo apt-get upgrade
2. Install pre-requisites
This is the minimum set of packages required to build on the RPi:
apt-get install autoconf automake gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config libperl-dev libgdbm-dev libdb-dev libssl-dev
3. Clone the stable version of Freeswitch
Don’t bother trying to find pre-built packages of freeswitch, it seems to be a fruitless exercise. Building from source is the way to go, and luckily git makes it pretty straightforward. Full details are on the Freeswitch wiki installation guide.
cd /usr/local/src git clone -b v1.2.stable git://git.freeswitch.org/freeswitch.git
Building Freeswitch from source on the Pi is going to take a long time. In theory you could cross-compile using a different machine. I’ve tried doing this using an Ubuntu VM running on my normal desktop and I couldn’t get it to work, so personally I would have found it easier just to build straight away on the Pi itself. Luckily, this isn’t your main computer, so you can just leave the build running and get on with something else.
A note on screen
To that end, it’s very useful to use screen, especially if you’re connecting via SSH. Your shell runs inside screen, and if you disconnect your SSH session you can just open it again and reconnect to the screen session without losing all your work.
To install screen:
sudo apt-get install screen screen
You’ll see a shell. Work away as normal, disconnect your SSH session, and when you reconnect run
and your session is restored.
This includes the sounds for the demo voicemail and IVR, and music on hold, which is recommended. If you want to save a bit of time and storage space then miss off the “make all cd-sounds…” step. CD sounds are the best quality, and hence recommended for a demo, but there are lower quality sounds available – check the freeswtch wiki.
cd /usr/local/src/freeswitch sudo ./bootstrap.sh sudo ./configure sudo make && sudo make install && sudo make all cd-sounds-install cd-moh-install
The last line will take a few hours to complete; I left it running in a screen session overnight.
You can check which IP addrss and port Freeswitch is using for SIP by running
sofia status from the freeswitch command line. Try registering a SIP phone as user "1000" using password "1000".
6. Run on startup
Follow the guide for debian on the Freeswitch wiki.
If you copy and paste the init script it uses a different group to the one you assigned to the Freeswitch user using the “adduser” command. Edit
and you should be fine. Now your Pi should start Freeswitch on every boot.