FreeSWITCH is a software defined telecom stack that runs on any commodity hardware. FreeSWITCH can handle voice, video and text communication and support all popullar VoIP protocols. FreeSWITCH is flexible and modular, and can be used in any way you can imagine
This guide demonstrates how to get it install FreeSWITCH and get it up and running on a Ubuntu 20.04 LTS machine
To follow along with this guide, you need one Ubuntu 20.04 LTS server which has prerequisite packages installed and configured. In order to install required packages issue following command
$ sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
libavformat-dev libswscale-dev libavresample-dev liblua5.2-dev liblua5.2 cmake libpq-dev \
unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep
$ sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
libavformat-dev libswscale-dev libavresample-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev \
unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep
sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
libavformat-dev libswscale-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev \
unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep
In order to install libks
First, download latest code from github using following command
$ sudo git clone https://github.com/signalwire/libks.git /usr/local/src/libks
Now run following commands in sequence to install the library
$ cd /usr/local/src/libks
$ sudo cmake .
$ sudo make && sudo make install
To verify if libks
is installed correctly in your system, run following command
$ sudo sh -c 'ldconfig && ldconfig -p' | grep libks
In Order to install libsignalwire
Run following command to download latest code from github
$ sudo git clone https://github.com/signalwire/signalwire-c.git /usr/local/src/signalwire-c
Now run following commands in sequence to install the library
$ cd /usr/local/src/signalwire-c
$ sudo cmake .
$ sudo make && sudo make install
To verify if libsignalwire-client
is installed correctly in your system, run following command
$ sudo sh -c 'ldconfig && ldconfig -p' | grep signalwire
Starting from FreeSWITCH version 1.10.4 You have to Download, Compile and install
sofia-sip
andspandsp
libraries separately
In order to install Sofia-Sip library, you need to download the latest code from FreeSWITCH’s official Packages repository
Clone the official Sofia-Sip repository into /usr/local/src
directory
$ sudo git clone https://github.com/freeswitch/sofia-sip /usr/local/src/sofia-sip
Now run following commands in sequence to install the library
$ cd /usr/local/src/sofia-sip
$ sudo ./bootstrap.sh
$ sudo ./configure
$ sudo make && sudo make install
To verify if Sofia-Sip library is installed correctly in your system, run following command
$ sudo sh -c 'ldconfig && ldconfig -p' | grep sofia
If libsofia-sip
is not installed, there will be no output. If it is installed, you will get a line for each version available.
Clone the SpanDSP repository from FreeSWITCH packages repository into /usr/local/src
directory
$ sudo git clone https://github.com/freeswitch/spandsp /usr/local/src/spandsp
Now run following commands in sequence to install the library
$ cd /usr/local/src/spandsp
$ sudo ./bootstrap.sh
$ sudo ./configure
$ sudo make && sudo make install
To verify if SpanDSP library is installed correctly in your system, run following command
$ sudo sh -c 'ldconfig && ldconfig -p' | grep spandsp
If libspandsp
is not installed, there will be no output. If it is installed, you will get a line for each version available.
You are now ready to install FreeSWITCH
Download the FreeSWITCH 1.10.7 release file into /usr/local/src
directory
$ sudo wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.7.-release.tar.gz -P /usr/local/src
Extract the release file
$ cd /usr/local/src
$ sudo tar -zxvf freeswitch-1.10.7.-release.tar.gz
$ cd freeswitch-1.10.7.-release
Run the configure script
$ sudo ./configure
Note: FreeSWITCH uses SQLite by default for it’s core database although support for other database options Like PostgreSQL, ODBC exists. If you want to enable Postgres or ODBC support than you need to run the
./configure
script with following arguments
$ sudo ./configure --enable-core-odbc-support --enable-core-pgsql-support
Now you are ready to compile and install the FreeSWITCH, run following commands in sequence
$ sudo make
$ sudo make install
To install sound and music on hold run following command
$ sudo make cd-sounds-install
$ sudo make cd-moh-install
FreeSWITCH is now installed and you can confirm it by running sudo freeswitch -nonat
from your terminal
By default, FreeSWITCH will install it’s binaries and configurations in /usr/local/bin
and /usr/local/freeswitch
, to make them available system wide you can create following symlinks
$ sudo ln -s /usr/local/freeswitch/conf /etc/freeswitch
$ sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin/fs_cli
$ sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/sbin/freeswitch
Create a unprivileged system user for running FreeSWITCH daemon
$ sudo groupadd freeswitch
$ sudo adduser --quiet --system --home /usr/local/freeswitch --gecos 'FreeSWITCH open source softswitch' --ingroup freeswitch freeswitch --disabled-password
$ sudo chown -R freeswitch:freeswitch /usr/local/freeswitch/
$ sudo chmod -R ug=rwX,o= /usr/local/freeswitch/
$ sudo chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*
In order to run FreeSWITCH in background using systemctl, open /etc/systemd/system/freeswitch.service
in your favorite editor and copy following content into it
[Unit]
Description=FreeSWITCH open source softswitch
Wants=network-online.target Requires=network.target local-fs.target
After=network.target network-online.target local-fs.target
[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
Environment="DAEMON_OPTS=-nonat"
Environment="USER=freeswitch"
Environment="GROUP=freeswitch"
EnvironmentFile=-/etc/default/freeswitch
ExecStartPre=/bin/chown -R ${USER}:${GROUP} /usr/local/freeswitch
ExecStart=/usr/local/freeswitch/bin/freeswitch -u ${USER} -g ${GROUP} -ncwait ${DAEMON_OPTS}
TimeoutSec=45s
Restart=always
[Install]
WantedBy=multi-user.target
Reload the systemctl daemon
$ sudo systemctl daemon-reload
Start the FreeSWITCH Service
$ sudo systemctl start freeswitch
Check if daemon has start successfully
$ sudo systemctl status freeswitch
The fs_cli
program is a Command-Line Interface that allows a user to connect to a running FreeSWITCH™ instance. The fs_cli
program can connect to the FreeSWITCH™ process on the local machine or on a remote system. (Network connectivity to the remote system is, of course, required.)
I'm running into these errors:
make[1]: Entering directory '/usr/local/src/freeswitch-1.10.7.-release'
CC src/libfreeswitch_la-switch_apr.lo
src/switch_apr.c: In function ‘switch_md5’:
src/switch_apr.c:1176:9: error: ‘MD5_Init’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1176 | MD5_Init(&md5_context);
| ^~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:49:27: note: declared here
49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
| ^~~~~~~~
src/switch_apr.c:1177:9: error: ‘MD5_Update’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1177 | MD5_Update(&md5_context, input, inputLen);
| ^~~~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:50:27: note: declared here
50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
| ^~~~~~~~~~
src/switch_apr.c:1178:9: error: ‘MD5_Final’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1178 | MD5_Final(digest, &md5_context);
| ^~~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:51:27: note: declared here
51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
| ^~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2153: src/libfreeswitch_la-switch_apr.lo] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch-1.10.7.-release'
make: *** [Makefile:1292: all] Error 2