A short, step-by-step guide for proper installation of Freeswitch on Debian 11 (bullseye)
The official instructions are barebone, so this guide is a supplement covering the most important steps to finish with a working system.
Root login
After Debian 11 installation, it is impossible to login with the root from outside. Let’s fix that.
sed -i "s|PermitRootLogin without-password\+|PermitRootLogin yes|g" /etc/ssh/sshd_config
systemctl restart sshd
Time sync service
Now, let’s install the service that automatically syncs the system clock to prevent installation problems:
apt -y install chrony
systemctl start chrony
systemctl enable chrony
You may get a similar error when installing:
/debian/dists/buster/InRelease is not valid yet (invalid for another 19h 54min 54s). Updates for this repository will not be applied.
This means that the system clock is off-sync and that you skipped this step.
System upgrade
You will need to upgrade the system with the latest packets:
apt-get update && apt-get -y dist-upgrade
Based on your system and internet speed, this can take up to several minutes.
After the new packets are installed, reboot the system and relogin:
reboot
Freeswitch installation
Now we can execute official steps to install Freeswitch:
apt-get update && apt-get install -y gnupg2 wget lsb-release
wget -O /usr/share/keyrings/freeswitch-archive-keyring.gpg https://files.freeswitch.org/repo/deb/debian-release/freeswitch-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/freeswitch-archive-keyring.gpg] http://files.freeswitch.org/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=/usr/share/keyrings/freeswitch-archive-keyring.gpg] http://files.freeswitch.org/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list
# you may want to populate /etc/freeswitch at this point.
# if /etc/freeswitch does not exist, the standard vanilla configuration is deployed
apt-get update && apt-get install -y freeswitch-meta-allapt-get update && apt-get install -y freeswitch-meta-all
After these steps, the official guide tells you to access Freeswitch with the command:
fs_cli -rRS
However, this command will fail:
[ERROR] fs_cli.c:1691 main() Error Connecting []
[INFO] fs_cli.c:1697 main() Retrying
The reason it will fail is because after installation, Freeswitch is not automatically started. Let’s start it:
systemctl start freeswitch
Also let’s enable it to start on system reboot:
systemctl enable freeswitch
Now, we can access Freeswitch:
fs_cli
If you get an error, it is possible that Freeswitch has not started yet. Sometimes it takes up to 20 s until it is operational.
If after 20 s fs_cli returns an error, you will need to check it with these commands:
apt-get -y install net-tools
netstat -vatupn | grep freeswitch | grep 8081
The output should show two lines, similar to these (some numbers will be different):
tcp 0 0 192.168.1.195:8081 0.0.0.0:* LISTEN 43246/freeswitch
tcp6 0 0 ::1:8081 :::* LISTEN 43246/freeswitch
If you don’t see the above output, Freeswitch has failed to start, and the console (whose port is 8081) is not reachable.
Restart Freeswitch with:
systemctl restart freeswitch
If this does not help, check Freeswitch status with:
systemctl status freeswitch
If an error is shown, then follow the guidelines described in the output to get more details about the problem and solve it. (Troubleshooting Freeswitch service startup is an extensive topic that will not be covered in this article.)
Exit from fs_cli with /bye, /exit or /quit command.
Additional Services
You will need to install/activate several services for the Freeswitch server.
DNS caching:
apt -y install unbound
sed -i "s|#prepend domain-name-servers 127.0.0.1\+|prepend domain-name-servers 127.0.0.1|g" /etc/dhcp/dhclient.conf
systemctl start unbound
systemctl enable unbound
You will also need to enable the proper entropy source for cryptography operations:
apt-get -y install haveged
haveged -w 1024
systemctl enable haveged.service
systemctl start haveged.service
These help Freeswitch to run more smoothly.
G729 codec installation for transcoding
Freeswitch comes with G729 codec only for pass-through, which means if one call leg has G729 codec and another has a different codec, the call will fail because Freeswitch will be unable to transcode to/from G729 codec.
To solve this, royalty-free (as of Jan 1 2017) G729 codec can be installed with transcoding capabilities.
apt-get -y install libfreeswitch-dev git autoconf automake libtool build-essential cmake
cd /usr/src/
git clone https://github.com/xadhoom/mod_bcg729.git
cd mod_bcg729
make && make install
sed -i "s|mod_g729\+|mod_bcg729|g" /etc/freeswitch/autoload_configs/modules.conf.xml
Restart Freeswitch:
systemctl restart freeswitch
And check if codec is loaded properly:
fs_cli -x "show codecs" b | grep g729
The result should be:
codec,G.729,mod_bcg729
Conclusion
The procedure described in this article will help you install Freeswitch on the Debian 11 together with additional steps for system operation. Let us know if you have additional questions on completing each step. Happy Freeswitching!