Freeswitch Installation

I recently needed to install Freeswitch for a singular reason: to register to another server when a SIP client registered to it. (What I call "register on register"). As I went, I decided to document the process of installing and configuring. This server is running Debian 5.0.2, and is a virtual container on top of another Debian lenny install, utilizing the OpenVZ virtualization infrastructure. Note: During my first install, the container only had 1 GB of space. About half of that gets taken up by Debian. For whatever reason, that turned out to not be enough. I increased it to 2 GB, did a make clean, then proceeded with the make.
$ sudo apt-get install make g++ libncurses5 libncurses5-dev
$ wget http://latest.freeswitch.org/freeswitch-1.0.5-20100205-0400.tar.gz
$ tar xzfv freeswitch-1.0.5-20100205-0400.tar.gz
$ cd freeswitch-1.0.5-20100205-0400
$ ./configure
$ make
$ sudo adduser --system --home /usr/local/freeswitch --disabled-login freeswitch
$ sudo chown freeswitch -R .
$ sudo -u freeswitch make install
$ sudo -u freeswitch make cd-sounds-install
$ sudo -u freeswitch make cd-moh-install
$ sudo -u freeswitch /usr/local/freeswitch/bin/freeswitch
freeswitch> fsctl shutdown asap
$ sudo -u freeswitch /usr/local/freeswitch/bin/freeswitch -nc
$ /usr/local/freeswitch/bin/fs_cli
[email protected]> /quit
There are a few things interesting about what's going on here:

  1. The freeswitch user
  2. Starting then restarting

First, the freeswitch user. The default installation instructions do everything as root. Of course, this means that any security vulnerability in freeswitch gives a user root privileges on the box. (Does freeswitch chroot by chance?) As a response to this, I like to run freeswitch as an unprivileged user. Because SIP operates on fairly high port numbers, this *just works*. For a future installation, I would actually like two users - one for the configs and another for the program to run as. This would reduce the opportunity for a vulnerability in the software to give someone access to change the configuration files. That's for another day, though. Second, the reason I started Freeswitch once with the console, then immediately shut it down was to watch for error messages. In my case, I did receive one error:
Error: stacksize 4194303 is too large: run ulimit -s 240 or run /usr/local/freeswitch/bin/freeswitch -waste.
I haven't yet done either thing, or tried to figure out the story. That too, is for another day. After I got Freeswitch loaded completely, I shut it back down to re-start without a console. Perhaps there's a good way to background it from within the console, but I prefer to be tidy and just start it anew. Soon, there will be another blog post discussing the changes from the default configuration that I'll make right off the bat. -jbn

Tags: