In this tutorial, you’ll learn that how to install FreeSwitch PBX on Ubuntu 20.04. Before going to the installation process, let’s have a short introduction about the topic.
Introduction:
PBX stand for Private Branch Exchange. PBX is a private telephone system used by the organizations for the communication purposes within the organization. The purpose of using PBX is that it provides free and easy calls within the organization to the users and also can be used for external calls with the help of VoIP. It provides the features of call queues, digital reception, forward calls, voice mails and call recordings. Here in this guide we are going to use FreePBX. So, FreePBX also provides the same features as listed earlier along with the better communication. Here are some salient features of FreeSwitch PBX listed below:
- Supports Windows, Linux & FreeBSD
- WebRTC support
- IVR API
- Recording facility for calls
- Better performance
- Automatic Attendant
And much more you can google it. Now we are moving toward the installation procedure.
Step 1: Update Your System
As it is a good practice to have the latest packages installed on our system so before going to install any new package, update your system
sudo apt -y update
Step 2: Install Required Dependencies
Hit the below command to get install the required dependencies for the installation of FreeSwitch on Ubuntu 20.04.
sudo 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
Also install the below additional packages for better performance but they are optional.
sudo 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
After these, install the libks & signal wire with the help of following commands.
cd /usr/src sudo git clone https://github.com/signalwire/libks.git cd libks sudo cmake . sudo make sudo make install cd /usr/src sudo git clone https://github.com/signalwire/signalwire-c.git cd signalwire-c sudo cmake . sudo make sudo make install
Step 3: Install FreeSwitch on Ubuntu 20.04
Now, visit the official page of FreeSwitch to obtain the latest version or download it by wget command.
cd /usr/src sudo wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.3.-release.zip sudo apt -y install unzip sudo unzip freeswitch-1.10.3.-release.zip cd freeswitch-1.10.3.-release/
If you’ve not installed the unzip, simply run the below command before running above command.
sudo apt -y install unzip
And now run the final command to install the package.
sudo ./configure -C sudo make
Note: If any error occurred during the compilation, simply comment that module or install the missing dependencies if any. And then restart the compilation as seen below:
sudo ./configure && sudo make clean && sudo make
Successful compilation will print the following result:
If everything okay, hit the below command to install the FreeSwitch
sudo make install
Result:
You’ll see the similar screen
And then compile the sound by typing
sudo make all cd-sounds-install cd-moh-install
After that create the simlinks to use the service in more convenient way.
sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin
Then create the new user for FreeSwitch to operate it with low privileges.
cd /usr/local sudo groupadd freeswitch sudo adduser --disabled-password --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup freeswitch freeswitch 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/
Now, add the new systemd unit file.
sudo nano /etc/systemd/system/freeswitch.service
Then add the below data into it and save the file.
[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 RestartSec=90 StartLimitInterval=0 StartLimitBurst=6 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
Step 4: Start FreeSwitch PBX Services
Run the following command to start and enable the FreeSwitch services on Ubuntu 20.04.
sudo chmod ugo+x freeswitch.service
sudo systemctl start freeswitch.service
sudo systemctl enable freeswitch.service
Verify the status by running below command.
sabir@Ubuntu20:/usr/local$ sudo systemctl status freeswitch.service ● freeswitch.service - freeswitch Loaded: loaded (/etc/systemd/system/freeswitch.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2020-08-22 13:49:50 PKT; 38s ago Main PID: 243622 (freeswitch) Tasks: 22 (limit: 3449) Memory: 56.4M CGroup: /system.slice/freeswitch.service └─243622 /usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait -nonat اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] Waiting for background process pid:243622 to be ready..> اگست 22 13:49:50 Ubuntu20 freeswitch[243614]: FreeSWITCH[243614] System Ready pid:243622 اگست 22 13:49:50 Ubuntu20 systemd[1]: Started freeswitch. lines 1-19/19 (END)
Step 5: Connect to FreeSwitch Client
Fire the below command to connect to the FreeSwitch client.
fs_cli -r
Result:
You’ll see the similar screen below:
So, this is how you can install FreeSwitch PBX on Ubuntu 20.04. For more tutorials, visit our website and explore your interesting articles.