How to build FreeSwitch on Debian 8 (Jessie)


FreeSwitch is an open source telephony platform, with support for multiple protocols (SIP, IAX, Googletalk, Jabber, XMPP, WOOMERA/H.323, PRI/T1/E1) and it is cross platform (Linux, Windows and Mac). It is a softswitch which implies that it does the job of a traditional PBX and much more. It is scalable and has been tested to handle thousands of simultaneous calls. It is fully extendable and can be customized to meet customers VOIP needs.

FreeSwitch pre-built binaries packages are available for download for installation Linux, Windows and Mac, with minimal modules included to get it running. But to harness the power of FreeSwitch with the various modules it has, FreeSwitch needs to be built from source with the option of enabling the modules required for your custom PBX setup.

FreeSwitch development team recommends Debian as the operating system of choice, starting from FreeSwitch 1.6 a number of libraries required to build Freeswitch are included in Debian 8, this blog post will run through steps involved to build Freeswitch on a fresh installation of Debain 8 (Jessie).

Debian 8 Installation

Download and install Debian 8 installation packages from the following link. Run through the installation process and set the server up accordingly. After the installation is completed, edit the /etc/apt/sources.list file, add # to comment out the dvd source in the file to prevent apt-get from requesting to get packages from the dvd path. Uncomment the other download sources and add the mirror deb jessie main contrib and save the file. Run the command below to download available updates and upgrade the pc with the latest available libraries.

sudo apt-update && apt-upgrade
Preparing to Build FreeSwitch

All commands to be run on the terminal should be run using root account to ensure that required permissions and priviledges are granted.
FreeSwitch Debian Jessie repository needs to be enabled, the commands below will create 99FreeSWITCH.test.list file and add it to /etc/apt/sources.list.d folder and also download and add a GPG key to the apt sources keyring.

echo "deb jessie main" > /etc/apt/sources.list.d/99FreeSWITCH.test.list
wget -O - |apt-key add - 
apt-get update
Next, download the needed dependecies to build FreeSwitch using this command

DEBIAN_FRONTEND=none APT_LISTCHANGES_FRONTEND=none apt-get install -y --force-yes freeswitch-video-deps-most
Now, the source code will be cloneed from repository.

cd  /usr/src/
git config --global pull.rebase true
git clone freeswitch.git
cd /usr/src/freeswitch.git
Building FreeSwitch After the Freeswitch source has be cloned from the repository, edit modules.conf file inside the freeswitch source folder to enable specific modules needed for your Freeswitch installation. Then run the following commands

./ -j
./configure -C
make install
make cd-sounds-install
make cd-moh-install
make samples
You might be tempted to run FreeSwitch immediately the after the make and install. But hold on, few configurations need to be done.
Edit the System Kernel setting file /etc/sysctl.d/vid.conf and add the following lines.

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
kernel.core_pattern = core.%p
Next, activate the kernel settings changes earlier made by running the following commands.

sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216
sysctl -w kernel.core_pattern=core.%p
Remember earlier, I said all commands should be run as super user, this implies that FreeSwitch was built as root. To allow system to system to interact with FreeSwitch, a user ‘freeswitch’ will be created and put in group ‘daemon’ and we will change the ownership of the FreeSwitch installation folder and the containing to the user ‘freeswitch’ to be created. Run the following commands on the terminal

cd /usr/local
adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH" --ingroup daemon freeswitch
chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R ug=rwX,o= /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*
Freeswitch source comes with a systemd file which when configured properly will at boot time, monitor the Freeswich to start it as a daemon, restart it if it fails. The file can be found in this location usr/src/freeswitch.git/debian/freeswitch-systemd.freeswitch.service you can change the con-tent to reflect the path to your freeswitch installation.
Lets link the systemd unif file above to systemd using this command

ln -s /usr/src/freeswitch.git/debian/freeswitch-systemd.freeswitch.service /etc/systemd/system/freeswitch.service
Next, run the following command systemctl daemon-reload to notify systemd to reload and look for changes in its configuration. Now run systemctl enable freeswitch to install FreeSWITCH to start at boot time.
To start Freeswitch for the first time run this command

systemctl start freeswitch
Freeswitch comes with a Command Line Interface program that can be used to to interact and send commands to Freeswitch . /usr/local/freeswitch/bin/fs_cli –l 6

And that is it, you have FreeSwitch built and configured.

Share this page on

  1 People Like(s) This Page   Permalink  

 Click  To Like This Page

comments powered by Disqus