Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

How to Install FreeSwitch On Debian 11/ Debian 12

FreeSwitch Installation on Debian 11/12.

Posted: June 30, 2024 6 min read

FreeSWITCH is a free and open-source telephony software for real-time communication protocols using audio, video, text, and other forms of media. The software has applications in Web Real-Time Communication (WebRTC), voice over Internet Protocol (VoIP), video transcoding, and Multipoint Control Unit (MCU) functionality. It supports Session Initiation Protocol (SIP) and Real-time Transport Protocol (RTP) features.

History

First announced in January 2006, the FreeSWITCH project officially released its first version in May 2008. The following iterations—1.2, 1.3, and 1.4—supported SIP over Websocket and WebRTC and were published in 2012 and 2014. 2018 saw the release of the 1.8 version, which added capabilities for video transcoding and video conferencing to the 1.6 version. The most recent version is 1.10.

To offer elastic FreeSWITCH core-based cloud telecommunication services and act as a long-term commercial sponsor for the FreeSWITCH open-source project, SignalWire Inc. was established in 2018. After that, it bought FreeSWITCH Solutions.

Applications

Here is a list of applications and projects built with or utilizing FreeSWITCH:

  1. Session Border Controllers (SBC)
  2. Embedded Communication Appliances
  3. Videoconferencing with Chat and Screen Sharing
  4. Private Branch Exchanges (PBX)
  5. Interactive Voice Response (IVR) Services
  6. Wholesale Least-Cost Routing
  7. ZRTP and DTLS Functionality
  8. BigBlueButton – Foundation for the project
  9. FusionPBX – Add-on offering a web management interface
  10. Truphone – Designated for usage since June 2007
  11. Gaboogie – Conferencing platform since August 2007
  12. Samsung – Partner for utilization
  13. Waeve – Partner for utilization
  14. Five9 – Partner for utilization
  15. Plivo – Partner for utilization
  16. Twilio – Partner for utilization
  17. US Department of Veterans Affairs – Utilizes FreeSWITCH

Let’s start the installation guide!

First, you have to obtain a FreeSWITCH Personal Access Token from SignalWire, follow the below steps to get one.

  • Create an account on SignalWire, if you don’t have one
Signup Page
  • Log in if you already have an account
Login Page
Dashboard - Piecebyte
  • Scroll Down to Personal Access Tokens
Dashboard - Piecebyte
  • Click the Add New Button
FreeSwitch Dashboard - Piecebyte
  • After that click the Generate button
FreeSwitch Token Generation
  • Copy the personal access token somewhere safe as you won’t be able to retrieve it again after the tab is closed.
FreeSwitch Personal Access Token

After Obtaining the Personal Access Token Follow The Below Steps.

Open The Terminal and switch to the root user
sudo su

Enter the password, if asked

Change The Directory to /root
cd

cd command is used to change the directory

Set The Token Variable

use the following code to set the TOKEN variable to the value of the personal access token you got from Signalwire.

TOKEN=YOURSIGNALWIRETOKEN
Update and Install Essential Libraries
apt-get update && apt-get install -yq gnupg2 wget lsb-release
Download The FreeSwitch Repository
wget --http-user=signalwire --http-password=$TOKEN -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg

You will get an output like this:

FreeSwitch repo installation

On the first try, it throws 401 UnAuthorized Error, because it does not know us, after that it responds with 200 OK which means, we are successfully authenticated and it downloads the FreeSWITCH repo.

Set the token to /etc/apt/auth.conf
echo "machine freeswitch.signalwire.com login signalwire password $TOKEN" > /etc/apt/auth.conf
Change The Access Mode of the auth file
chmod 600 /etc/apt/auth.conf

600 permissions means that only the file owner has full read and write access to it. Once a file permission is set to 600, no one else can access the file

Add the SignalWire FreeSWITCH repository to the list of package sources for the APT package manager on a Debian-based Linux system
echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list
  • It creates a new file called freeswitch.list in the /etc/apt/sources.list.d/ directory.
  • It writes a line to this file that specifies the URL of the SignalWire FreeSWITCH repository and the necessary authentication key.
Add the source package repository for SignalWire FreeSWITCH to your APT configuration
echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list
  • It appends a line to the freeswitch.list file in the /etc/apt/sources.list.d/ directory.
  • The line specifies the URL of the SignalWire FreeSWITCH source package repository and the necessary authentication key.
Update APT
apt-get update
Install dependencies required for the build
# Install dependencies required for the FreeSwitch build
apt-get build-dep freeswitch

This will prompt you to continue the installation of FreeSwitch, enter y to continue installation

Continue Process?
Get the source. Use the -b flag to get a specific branch.
# then get the source. Use the -b flag to get a specific branch
cd /usr/src/
git clone https://github.com/signalwire/freeswitch.git -bv1.10 freeswitch
cd freeswitch
Configure Git to use the rebase strategy when pulling updates from a remote repository to avoid conflicts
git config pull.rebase true
Do the build
./bootstrap.sh -j
./configure
make
make install

Configure systemd

For Linux operating systems, systemd is a software suite that offers a variety of system components. The primary goal is to standardize behaviour and configuration for services across Linux distributions. An init system called “system and service manager” serves as its main part and is used to control user processes and bootstrap user space.

use nano or any other editor you want to use to create /etc/systemd/system/freeswitch.service. I will be using nano.

[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /usr/local/freeswitch/run
ExecStartPre=/bin/chown freeswitch:daemon /usr/local/freeswitch/run
ExecStart=/usr/local/freeswitch/bin/freeswitch -ncwait -nonat
TimeoutSec=45s
Restart=always
; exec
WorkingDirectory=/usr/local/freeswitch/run
User=freeswitch
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
;LimitSTACK=240
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007

[Install]
WantedBy=multi-user.target

enable and start the freeswitch service

systemctl daemon-reload
systemctl start freeswitch
systemctl enable freeswitch

check if the freeswitch service is running

ps aux | grep freeswitch

You will get something like this.

Set fs_cli bash profile

nano ~/.bash_profile
PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/local/freeswitch/bin
export PATH
unset USername

And there you have it. We installed Freeswitch.

Check whether freeswitch cli is working

cd /usr/local/freeswitch/bin/

Run ./fs_cli

./fs_cli

You will get something like this, which means, our FreeSWITCH installation was successful.

Conclusion

In this post, we learned how to install Freeswitch on Debian 11/12.

2 Comments

  1. I was reading some of your content on this site and I believe this website is really instructive!
    Retain posting.

Leave a Reply

Your email address will not be published. Required fields are marked *