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 the following command:
$ sudo apt install --yes git 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 sngrepStarting from FreeSWITCH version 1.10.4 You have to Download, Compile and install sofia-sip and spandsp 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-sipNow run following commands in sequence to install the library
$ cd /usr/local/src/sofia-sip
$ sudo ./bootstrap.sh
$ sudo ./configure --prefix=/usr
$ sudo make && make install
$ sudo ldconfigTo verify if Sofia-Sip library is installed correctly in your system, run following command
$ 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/spandspNow run following commands in sequence to install the library
$ cd /usr/local/src/spandsp
$ sudo ./bootstrap.sh
$ sudo ./configure --prefix=/usr
$ sudo make && make install
$ sudo ldconfigTo verify if SpanDSP library is installed correctly in your system, run following command
$ ldconfig -p | grep spandspIf 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.6 release into /usr/local/src directory
$ sudo wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.6.-release.tar.gz -P /usr/local/src Extract the release file:
$ cd /usr/local/src
$ sudo tar -zxvf freeswitch-1.10.6.-release.tar.gz
$ cd freeswitch-1.10.6.-releaseRun the configure script:
$ sudo CFLAGS="-Wno-unused-but-set-variable" disable_cc=yes \
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc \
--with-gnu-ld --with-openssl --enable-zrtp
Disable signalwire module:
$ sudo sed -i 's/applications\/mod_signalwire/#applications\/mod_signalwire/' modules.confNow you are ready to compile and install FreeSWITCH, run the following:
$ sudo make
$ sudo make install To install sound and music on hold run following:
$ 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
Create a unprivileged system user for running FreeSWITCH daemon
$ sudo groupadd --system freeswitch
$ sudo adduser --quiet --system --home /var/lib/freeswitch --gecos 'FreeSWITCH open source softswitch' --ingroup freeswitch freeswitch --disabled-password --shell /bin/falseIn 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
Wants=network-online.target
Requires=syslog.socket network.target local-fs.target
After=syslog.socket network.target network-online.target local-fs.target
[Service]
; service
Type=forking
PIDFile=/run/freeswitch/freeswitch.pid
Environment="DAEMON_OPTS=-nonat"
ExecStartPre=chown -R freeswitch:freeswitch /var/lib/freeswitch /var/log/freeswitch /etc/freeswitch /usr/share/freeswitch /var/run/freeswitch
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
TimeoutSec=45s
Restart=always
; exec
User=root
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007
NoNewPrivileges=false
[Install]
WantedBy=multi-user.targetReload the systemctl daemon
$ sudo systemctl daemon-reloadEnsure RSyslog is installed and running:
$ sudo apt install rsyslog -y
$ sudo systemctl enable --now rsyslogStart the FreeSWITCH Service
$ sudo systemctl start freeswitchCheck if daemon has start successfully
$ sudo systemctl status freeswitchThe 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.)