Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kmix/83da81f14bda7f0a0c967fad48d43809 to your computer and use it in GitHub Desktop.
Save kmix/83da81f14bda7f0a0c967fad48d43809 to your computer and use it in GitHub Desktop.
Install FreeSWITCH 1.10.x on Ubuntu 24.04 LTS

Installing FreeSWITCH 1.10.11 on Ubuntu 24.04 LTS

Based on https://gist.github.com/cyrenity/96cc1ad7979b719b1c684f90aa0f526d with the following changes:

  • Updated for Ubuntu 24.04
  • Doesn't install the signalwire client
  • Doesn't install mod_av

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 install FreeSWITCH and get it up and running on a Ubuntu 24.04 LTS machine.

Prerequisites

To follow along with this guide, you need one Ubuntu 24.04 LTS server which has prerequisite packages installed and configured. In order to install required packages, issue following command:

Ubuntu 24.04 LTS
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 \
            libspeex-dev libavformat-dev libswscale-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev \
            unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep

Install pre-requisites and libraries

In order to install libks, download the 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

Starting from FreeSWITCH version 1.10.4, you have to download, compile, and install sofia-sip and spandsp libraries separately.

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

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 git reset --hard 67d2455efe02e7ff0d897f3fd5636fed4d54549e
$ sudo ./bootstrap.sh 
$ sudo ./configure
$ sudo make && sudo make install

Note: The git reset to a previous commit is to work around signalwire/freeswitch#2158

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!

Installing FreeSWITCH

Download the FreeSWITCH 1.10.11 release file into /usr/local/src directory:

$ sudo wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.11.-release.tar.xz -P /usr/local/src

Extract the release files:

$ cd /usr/local/src
$ sudo tar -Jxvf freeswitch-1.10.11.-release.tar.xz
$ cd freeswitch-1.10.11.-release

Update modules.conf:

  • Disable the signalwire module by commenting out applications/mod_signalwire in modules.conf
  • Comment applications/mod_av to work around signalwire/freeswitch#2202

Note: If you need mod_av to record and playback rtmp:// streams, you may have to install an earlier ffmpeg version or look for a FreeSWITCH patch to enable this functionality.

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 that you are ready to compile and install FreeSWITCH, run following commands in sequence:

$ sudo make 
$ sudo make install 

To install sound and music on hold (MOH), run following commands:

$ sudo make cd-sounds-install
$ sudo make cd-moh-install 

Post install setup

Create Symlinks (Optional)

By default, FreeSWITCH will install its binaries and configurations in /usr/local/bin and /usr/local/freeswitch. To make them available systemwide, 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 an unprivileged user

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/*
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 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

Ensure the service will start on boot:

$ sudo systemctl enable freeswitch
Command Line Interface (CLI)

The fs_cli program is a CLI client 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.)

@rationalthinker1
Copy link

Thanks a lot man. Appreciate it.

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