FreeSWITCH Installation on Linux | For Debian / Centos

Depiction of engineers configuring FreeSWITCH on Linux to enhance communication solutions

While working to configure VoIP telephony solutions on Linux servers at IOFLOOD, we spent time installing Freeswitch. From our experience, Freeswitch’s support for various telephony protocols make it a preferred choice for building scalable communication platforms. Through today’s article, we aim to equip our customers with the knowledge and tools needed to create reliable communication solutions on their own dedicated cloud hosting services.

In this guide, we will walk you through the process of installing Freeswitch on Linux. We will cover methods for both APT (Debian and Ubuntu) and YUM-based distributions (CentOS and AlmaLinux), delve into compiling Freeswitch from source, installing a specific version, and finally, how to use the Freeswitch command and ensure it’s installed correctly.

So, let’s dive in and begin installing Freeswitch on your Linux system!

TL;DR: How Do I Install Freeswitch on Linux?

You can install Freeswitch on Linux by first updating your package lists with the command sudo apt-get update. After that, you can install Freeswitch using the command sudo apt-get install freeswitch.

sudo apt-get update
sudo apt-get install freeswitch

# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# The following additional packages will be installed:
#   freeswitch-meta-all
# Suggested packages:
#   freeswitch-sounds-en-us-callie-32000 freeswitch-sounds-en-us-callie-48000
# The following NEW packages will be installed:
#   freeswitch freeswitch-meta-all
# 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
# Need to get 0 B/22.5 kB of archives.
# After this operation, 81.9 kB of additional disk space will be used.
# Do you want to continue? [Y/n]

This is a basic way to install Freeswitch on Linux, but there’s much more to learn about installing and using Freeswitch. Continue reading for more detailed information and advanced usage scenarios.

Getting Started with Freeswitch

Freeswitch is a scalable open-source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text, or any other form of media. It was created in 2006 to fill the void left by proprietary commercial solutions. Freeswitch also provides a stable telephony platform on which many telephony applications can be developed using a wide range of free tools.

Let’s get started with installing Freeswitch on your Linux device. We will cover the installation process using two popular package managers: apt and yum.

Installing Freeswitch with APT

apt is the package manager used by Debian and Ubuntu. To install Freeswitch using apt, you’ll need to open a terminal and type the following commands:

sudo apt-get update
sudo apt-get install -y freeswitch

# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# The following additional packages will be installed:
#   freeswitch-meta-all
# Suggested packages:
#   freeswitch-sounds-en-us-callie-32000 freeswitch-sounds-en-us-callie-48000
# The following NEW packages will be installed:
#   freeswitch freeswitch-meta-all
# 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
# Need to get 0 B/22.5 kB of archives.
# After this operation, 81.9 kB of additional disk space will be used.
# Do you want to continue? [Y/n]

The first command updates your package lists, ensuring you have the latest version of the packages. The second command installs Freeswitch.

Installing Freeswitch with YUM

yum is the default package manager for CentOS, Fedora, and RHEL. To install Freeswitch using yum, open a terminal and type the following commands:

sudo yum update -y
sudo yum install -y freeswitch

# Output:
# Loaded plugins: fastestmirror, langpacks
# Loading mirror speeds from cached hostfile
#  * base: mirror.its.dal.ca
#  * extras: mirror.its.dal.ca
#  * updates: mirror.its.dal.ca
# Resolving Dependencies
# --> Running transaction check
# ---> Package freeswitch.x86_64 0:1.10.3-1.el7 will be installed
# --> Finished Dependency Resolution
# Installed:
#   freeswitch.x86_64 0:1.10.3-1.el7

The first command updates your package lists, and the second command installs Freeswitch. Now, you have Freeswitch installed on your Linux system and ready for use.

Installing Freeswitch from Source

Installing from source code allows you to customize your installation, apply patches, and sometimes get the latest features before they’re available in package managers.

To install Freeswitch from source, you’ll need to clone the Freeswitch GitHub repository and compile it. Here’s how:

# Install dependencies
sudo apt-get install -y git autoconf automake libtool g++

# Clone the Freeswitch repository
git clone https://github.com/signalwire/freeswitch.git

cd freeswitch

# Build and install
./bootstrap.sh -j
./configure
make
sudo make install

This script first installs the necessary dependencies. It then clones the Freeswitch repository, builds the source code, and installs Freeswitch.

Install Specific Freeswitch Versions

Different versions of Freeswitch can have different features, bug fixes, and compatibility with other software. It’s important to choose a version that suits your needs.

Installing Specific Versions from Source

To install a specific version of Freeswitch from source, you’ll need to checkout the specific version after cloning the repository:

git clone https://github.com/signalwire/freeswitch.git
cd freeswitch

git checkout v1.10.2

# Build and install
./bootstrap.sh -j
./configure
make
sudo make install

Installing Specific Versions with APT

To install a specific version of Freeswitch with apt, you’ll need to specify the version number when installing:

sudo apt-get install freeswitch=1.10.2~release~12~bbe59a6a1d~buster

Installing Specific Versions with YUM

To install a specific version of Freeswitch with yum, you’ll need to enable the freeswitch-release repository and specify the version number when installing:

sudo yum install freeswitch-1.10.2

Version Comparisons

VersionKey ChangesCompatibility
1.10.2Bug fixes, new featuresCompatible with most systems
1.10.1Performance improvementsOlder systems may not be compatible
1.10.0Initial releaseCompatible with all systems

Using and Verifying Freeswitch

After installing Freeswitch, you can verify its installation and get familiar with some basic usage.

Verifying the Installation

You can verify the installation of Freeswitch by checking its version:

freeswitch -version

# Output:
# FreeSWITCH Version 1.10.2~64bit ( 64bit)

Basic Usage of Freeswitch

Freeswitch has many commands and options. Here’s an example of how to start Freeswitch in the foreground with console logs:

freeswitch -ncwait

# Output:
# FreeSWITCH Version 1.10.2~64bit is ready
# 2019-11-05 17:15:30.639287 [NOTICE] switch_event.c:453 Subclass reservation deleted for presence_state::dialog

This command starts Freeswitch in the foreground and waits for the system to be ready. The -ncwait option tells Freeswitch not to fork and run in the background, and to output logs to the console.

Alternate Freeswitch Install Methods

While we have covered the basic and intermediate methods of installing Freeswitch on Linux, there are alternative methods that offer different advantages. These methods are particularly useful for those who want to experiment with different setups or require a specific configuration for their use case.

Freeswitch Installation Using Docker

Docker is a platform that allows you to automate the deployment, scaling, and management of applications within containers. Installing Freeswitch using Docker can simplify the setup process and make it easier to manage and scale your Freeswitch instances.

Here’s how you can get Freeswitch up and running using Docker:

# Pull the Freeswitch Docker image
sudo docker pull bettervoice/freeswitch-container:latest

# Run the Freeswitch container
sudo docker run -d --name=freeswitch bettervoice/freeswitch-container:latest

The first command pulls the latest Freeswitch Docker image from Docker Hub. The second command runs the Freeswitch container in detached mode, which means it runs in the background.

Manual Installation of Freeswitch

Manual installation gives you the most control over the installation process, allowing you to customize Freeswitch to your exact requirements. However, it is also the most complex method and requires a good understanding of Linux system administration.

Here’s a brief overview of how you might manually install Freeswitch:

# Download the Freeswitch source code
wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.2.tar.gz

# Extract the source code
tar -xvf freeswitch-1.10.2.tar.gz
cd freeswitch-1.10.2

# Compile and install the source code
./configure && make && sudo make install

This script downloads the Freeswitch source code, extracts it, and then compiles and installs Freeswitch.

Comparing the Methods

MethodAdvantagesDisadvantages
APT/YUMSimple, quickLimited customization
DockerEasy management, scalabilityRequires Docker knowledge
ManualFull control, customizationComplex, time-consuming

While each method has its advantages and disadvantages, the best method for you depends on your specific requirements and level of expertise. For beginners, using apt or yum is recommended. For those who need scalability and easy management, Docker is a great choice. And for those who need full control and customization, manual installation is the way to go.

Installation Issue Tips: Freeswitch

While installing Freeswitch on Linux is generally straightforward, you might encounter some issues. Here are common problems and their solutions.

Issue: Package Not Found

This issue occurs when the Freeswitch package is not available in your package manager’s repositories.

sudo apt-get install freeswitch

# Output:
# Reading package lists... Done
# Building dependency tree
# Reading state information... Done
# E: Unable to locate package freeswitch

Solution: Make sure your package lists are up to date. You can update them with sudo apt-get update for apt or sudo yum update for yum. If the issue persists, check if Freeswitch is available in your distribution’s repositories.

Issue: Freeswitch Service Not Starting

This problem occurs when Freeswitch does not start after installation.

sudo service freeswitch start

# Output:
# Failed to start freeswitch.service: Unit freeswitch.service not found.

Solution: Check if Freeswitch is installed correctly by checking its version with freeswitch -version. If it’s not installed, follow the installation steps again. If the issue persists, check the system logs for any errors.

Issue: Freeswitch Command Not Found

This issue occurs when the Freeswitch command is not found, which means it’s not installed or not in your PATH.

freeswitch -version

# Output:
# Command 'freeswitch' not found, but can be installed with...

Solution: Make sure Freeswitch is installed by following the installation steps. If it’s installed but the command is not found, add Freeswitch to your PATH.

Remember, while these solutions cover common issues, they might not solve every problem. If you’re facing a unique issue, consider seeking help from the Freeswitch community or professional support.

Telephony & Communication Explored

Before diving deeper into the functionalities of Freeswitch, it’s essential to understand the basics of telephony platforms and communication protocols.

Telephony Platforms

In the digital world, a telephony platform is a system that manages the routing and switching of voice, fax, and other forms of data from one point to another. It’s the backbone of any communication network, allowing multiple devices to communicate seamlessly.

Freeswitch is one such telephony platform. It’s a software switchboard that connects and directs calls from one line to another, over a network, based on certain protocols.

# Sample Freeswitch command to show active calls
freeswitch@localhost> show calls

# Output:
# uuid  direction  created                   created_epoch  name  state
# ==================================================================================================
# 9d61b8f8-067f-1239-12fa-005056b204e2  inbound   2021-05-17 10:32:22  1621264342  sofia/internal/[email protected]  CS_EXECUTE

This command lists all active calls on your Freeswitch server. In the output, you can see the unique identifier for each call, the direction of the call, and the current state of the call.

Communication Protocols

Communication protocols define the rules for data exchange over a network. They determine the format, timing, sequencing, and error checking of messages. Some common protocols that Freeswitch supports include SIP (Session Initiation Protocol), XMPP (Extensible Messaging and Presence Protocol), and WebRTC (Web Real-Time Communication).

For instance, SIP is a signaling protocol used for initiating, maintaining, modifying, and terminating real-time sessions that include voice, video, and messaging applications.

# Sample Freeswitch command to show SIP registrations
freeswitch@localhost> sofia status profile internal reg

# Output:
# Call-ID      User    Contact
# ==================================================================================================
# MThkYzUxNz  1001    "1001" <sip:[email protected]:5060>

This command shows all SIP registrations on your Freeswitch server. In the output, you can see the call ID, the user, and the contact information for each registration.

Understanding these fundamentals is crucial as they form the basis of how Freeswitch operates. With a solid foundation, you can better appreciate the power and flexibility Freeswitch offers in handling telephony tasks.

The Relevance of Freeswitch

Freeswitch isn’t just a tool for handling telephony tasks; it’s a versatile solution that plays a crucial role in system administration and communication. Its capabilities extend beyond basic call routing, offering functionalities like IVR, conferencing, and even text-to-speech conversion.

Exploring Related Concepts: VoIP and SIP

Understanding Freeswitch also opens the door to broader concepts in the world of digital communication. Two such concepts are VoIP (Voice over Internet Protocol) and SIP.

VoIP is a technology that allows voice calls to be made over an internet connection instead of a regular phone line. Freeswitch can be used as a VoIP server, managing and routing VoIP calls within a network.

SIP, on the other hand, is a protocol used to control communication sessions. It’s one of the protocols Freeswitch supports and is commonly used for managing multimedia communication sessions such as voice and video calls.

# Sample Freeswitch command to show SIP registrations
freeswitch@localhost> sofia status profile internal reg

# Output:
# Call-ID      User    Contact
# ==================================================================================================
# MThkYzUxNz  1001    "1001" <sip:[email protected]:5060>

This command shows all SIP registrations on your Freeswitch server. In the output, you can see the call ID, the user, and the contact information for each registration.

Further Resources for Mastering Freeswitch

To delve deeper into the world of Freeswitch, here are some resources that provide more detailed information:

Wrap Up: Linux Freeswitch Tutorial

In this comprehensive guide, we’ve delved into the process of installing Freeswitch on Linux, a powerful and flexible telephony platform that can manage various communication protocols.

We started with the basics, demonstrating how to install Freeswitch using the apt and yum package managers. We then explored more advanced topics, such as installing Freeswitch from source and installing specific versions, providing code examples and explanations along the way.

We also discussed alternative approaches to Freeswitch installation, such as using Docker and manual installation, and provided a comparison of these methods. Moreover, we addressed common issues you might encounter during installation and offered solutions to these problems.

MethodAdvantagesDisadvantages
APT/YUMSimple, quickLimited customization
DockerEasy management, scalabilityRequires Docker knowledge
ManualFull control, customizationComplex, time-consuming

In addition to installation, we explored the fundamentals of telephony platforms and communication protocols, giving you a better understanding of how Freeswitch operates. And we looked at the broader implications of Freeswitch in system administration and communication, directing you to more resources for further learning.

Whether you’re just starting out with Freeswitch or you’re looking to enhance your skills, we hope this guide has provided you with the knowledge and confidence to install and use Freeswitch on Linux effectively. Happy coding!