Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save thebluesnevrdie/2f9fe8cc384eb502d855dba219307e20 to your computer and use it in GitHub Desktop.

Select an option

Save thebluesnevrdie/2f9fe8cc384eb502d855dba219307e20 to your computer and use it in GitHub Desktop.
Install FreeSWITCH 1.10.6 on Ubuntu 20.04 LTS

Installing FreeSWITCH 1.10.6 on Ubuntu 18.04 | Ubuntu 20.04 LTS

Introduction

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

Prerequisites

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 sngrep

Starting 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

Installing Sofia-Sip library

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 --prefix=/usr
$ sudo make && make install
$ sudo ldconfig

To 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.

Installing SpanDSP library

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 --prefix=/usr
$ sudo make && make install
$ sudo ldconfig

To verify if SpanDSP library is installed correctly in your system, run following command

$ 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

Installing 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.-release

Run 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.conf

Now 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

Post install setup

Create an unprivileged user

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/false
Running as systemd service

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
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.target

Reload the systemctl daemon

$ sudo systemctl daemon-reload

Ensure RSyslog is installed and running:

$ sudo apt install rsyslog -y
$ sudo systemctl enable --now rsyslog

Start the FreeSWITCH Service

$ sudo systemctl start freeswitch

Check if daemon has start successfully

$ sudo systemctl status freeswitch
Command Line interface

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment