Install FreeSwitch from a freeswitch docker image
March 25 UPDATED:
This post presents the instructions to install FreeSwitch from a freeswitch docker image on Ubuntu 20.04.
Start from a fresh installed Ubuntu image.
apt -y update
apt -y upgrade
apt install docker docker.io
Pull the image and run it:
docker run -d --network host --restart always --name fs-rbsongcan rbsongcan/freeswitch.1.10.3:latest
In MARCH 25 2023, latest version of Freeswitch is available:
freeswitch.1.10.9 now included dependency library for mod_shout.
docker run -d --network host --restart always --name fs-rbsongcan rbsongcan/freeswitch.1.10.9:latest
Project is hosted at:
https://hub.docker.com/repository/docker/rbsongcan/fs-rbsongcan
Note: The dockerized freeswitch will listen on ip and ports of docker host to avoid NAT issue. Make sure the following port are open:
5060 5066 5080 7443 8081 8082 8021
And RTP port ranges.
Once docker run completed, you can check if docker container is up and running:
docker ps
netstat -lnp | grep freeswitch
tcp 0 0 192.168.75.167:5066 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 192.168.75.167:8081 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 192.168.75.167:8082 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 192.168.75.167:7443 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 127.0.0.1:8021 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 192.168.75.167:5080 0.0.0.0:* LISTEN 119785/freeswitch
tcp 0 0 192.168.75.167:5060 0.0.0.0:* LISTEN 119785/freeswitch
tcp6 0 0 ::1:8081 :::* LISTEN 119785/freeswitch
tcp6 0 0 ::1:8082 :::* LISTEN 119785/freeswitch
tcp6 0 0 ::1:5080 :::* LISTEN 119785/freeswitch
tcp6 0 0 ::1:5060 :::* LISTEN 119785/freeswitch
udp 0 0 192.168.75.167:5060 0.0.0.0:* 119785/freeswitch
udp 0 0 192.168.75.167:5080 0.0.0.0:* 119785/freeswitch
udp 0 0 0.0.0.0:1337 0.0.0.0:* 119785/freeswitch
udp6 0 0 ::1:5060 :::* 119785/freeswitch
udp6 0 0 ::1:5080 :::* 119785/freeswitch
To connect to freeswitch console fs_cli:
docker exec -it fs-rbsongcan fs_cli
At this point, you can log in with freeswitch default users and make test calls.
username: 1000-1009
password:1234
SIP server IP: your server IP
domain: your server IP
Configure dockerized FreeSWITCH
Practically, it is required to be able to modify the data on freeswitch and it can be achieved by docker –mount parameter which can be set as following:
#sip_profiles
--mount source=fs-rbsongcan-sip_profiles,target=/usr/local/freeswitch/conf/sip_profiles
#dialplan
--mount source=fs-rbsongcan-dialplan,target=/usr/local/freeswitch/conf/dialplan
#directory
--mount source=fs-rbsongcan-directory,target=/usr/local/freeswitch/conf/directory
An example:
docker run -d --network host --restart always \
--mount source=fs-rbsongcan-sip_profiles,target=/usr/local/freeswitch/conf/sip_profiles \
--mount source=fs-rbsongcan-dialplan,target=/usr/local/freeswitch/conf/dialplan \
--mount source=fs-rbsongcan-directory,target=/usr/local/freeswitch/conf/directory \
--name fs-rbsongcan rbsongcan/fs-rbsongcan:latest
Note: rbsongcan/fs-rbsongcan:nightly can be used as an alternative for rbsongcan/fs-rbsongcan:latest