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
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.
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 the 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 \
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 sngrepIn order to install libks, download the latest code from GitHub using the following command:
$ sudo git clone https://github.com/signalwire/libks.git /usr/local/src/libksNow, run the following commands in sequence to install the library:
$ cd /usr/local/src/libks
$ sudo cmake .
$ sudo make && sudo make installTo verify if libks is installed correctly in your system, run the 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-sipandspandsplibraries separately.
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 the following commands in sequence to install the library:
$ cd /usr/local/src/sofia-sip
$ sudo ./bootstrap.sh
$ sudo ./configure
$ sudo make && sudo make installTo verify if Sofia-Sip library is installed correctly in your system, run the 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/spandspNow, 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 installNote: 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 the following command:
$ sudo sh -c 'ldconfig && 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.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/srcExtract the release files:
$ cd /usr/local/src
$ sudo tar -Jxvf freeswitch-1.10.11.-release.tar.xz
$ cd freeswitch-1.10.11.-releaseUpdate modules.conf:
- Disable the signalwire module by commenting out
applications/mod_signalwireinmodules.conf - Comment
applications/mod_avto 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 its core database, although support for other database options Like PostgreSQL, ODBC exists. If you want to enable Postgres or ODBC support, then you need to run the
./configurescript with following arguments:
$ sudo ./configure --enable-core-odbc-support --enable-core-pgsql-support Now that you are ready to compile and install FreeSWITCH, run the following commands in sequence:
$ sudo make
$ sudo make install To install sound and music on hold (MOH), run the following commands:
$ sudo make cd-sounds-install
$ sudo make cd-moh-install 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/freeswitchCreate 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 the background using systemctl, open /etc/systemd/system/freeswitch.service in your favorite editor and copy the 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.targetReload the systemctl daemon
$ sudo systemctl daemon-reloadStart the FreeSWITCH Service
$ sudo systemctl start freeswitchCheck if daemon has started successfully
$ sudo systemctl status freeswitchEnsure the service will start on boot:
$ sudo systemctl enable freeswitchThe 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.)
Thanks a lot man. Appreciate it.