FreeSWITCH is a free and opensource telecom software stack. It supports all major operating systems like Linux, Windows, macOS and freeBSD. In this article, we will see how to install Freeswitch 1.8 from source on Ubuntu 18.04 LTS code named Bionic Beaver.
How to install FreeSWITCH on Debian 9 Stretch
How to install FreeSWITCH on Debian 8 Jessie
How to install FreeSWITCH on CentOS 7
Does FreeSWITCH seem hard ? Not really. Visit our FreeSWITCH Archive to learn more.
Installation from Source
1. Fetch updated list of packages
apt update -y
2. Install dependencies
apt install -y git subversion build-essential autoconf automake libtool libncurses5 libncurses5-dev make libjpeg-dev libtool libtool-bin libsqlite3-dev libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev yasm liblua5.2-dev libopus-dev cmake
3. Lets install some optional packages too
apt install -y libcurl4-openssl-dev libexpat1-dev libgnutls28-dev libtiff5-dev libx11-dev unixodbc-dev libssl-dev python-dev zlib1g-dev libasound2-dev libogg-dev libvorbis-dev libperl-dev libgdbm-dev libdb-dev uuid-dev libsndfile1-dev
4. Now install signalwire related packages. First install libks.
apt install cmake
cd /usr/src
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
make install
5. Then install signalwire-c
cd /usr/src
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c
cmake .
make
make install
6. Now grab FreeSWITCH source. Use the -b flag to get a specific branch
cd /usr/src
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git -bv1.8 freeswitch
cd freeswitch
7. As we are in a branch that will go through many rebases, to avoid conflicts better config rebase settings
git config pull.rebase true
8. Start bootstrapping
./bootstrap.sh -j
9. By default, only few modules are enabled. You can enable/disable these modules at this stage. Edit ‘modules.conf’ and change as per requirements. Remember enabling new modules may require additional dependencies.
10. Now run standard installation process
./configure -C
make
make install
11. Compile sounds
make all cd-sounds-install cd-moh-install
12. Create simlinks to use services easily.
ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin
13. Add new group and user with less privileges to run FreeSWITCH service.
cd /usr/local groupadd freeswitch adduser --disabled-password --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup freeswitch freeswitch chown -R freeswitch:freeswitch /usr/local/freeswitch/ chmod -R ug=rwX,o= /usr/local/freeswitch/ chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/
14. Now lets add systemd unit file. Systemd is default init system for Ubuntu 18.04. Open new file ‘/etc/systemd/system/freeswitch.service’ using your favorite editor and copy below content in 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] Type=forking Environment="DAEMON_OPTS=-nonat" EnvironmentFile=-/etc/default/freeswitch ExecStartPre=/bin/chown -R freeswitch:freeswitch /usr/local/freeswitch ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS TimeoutSec=45s Restart=always 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
15. Now start service and enable it to start on boot.
chmod ugo+x freeswitch.service
systemctl start freeswitch.service
systemctl enable freeswitch.service
16. Now check status of FreeSWITCH service
systemctl status freeswitch.service
Status should be ‘active’ something like below
● freeswitch.service – freeswitch
Loaded: loaded (/lib/systemd/system/freeswitch.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-05-27 10:55:15 UTC; 7min ago
17. Now you can connect to FreeSWITCH using client as below
fs_cli -r
Notes
During compilation if you stuck with errors like unknown dependencies (particularly spansdsp), run below command before starting compilation again.
git clean -fdx
Hope you like this article. Let us know feedback in comments.