Skip to content
Nodar Nutsubidze edited this page Feb 24, 2017 · 1 revision

Welcome to the freeswitch-container wiki!

FreeSWITCH Dockerfile

Docker Stars Docker Pulls Docker Automated build

This project can be used to deploy a FreeSWITCH server inside a Docker container. The container currently uses the latest stable release version 1.6.x. An effort was made to build many modules so the container can be generic enough to serve many purposes.

The container now includes fail2ban but in order for fail2ban to update the rules in IPTables it must be run with the --privileged flag.

The container exposes the following ports:

  • 5060/tcp 5060/udp 5080/tcp 5080/udp as SIP Signaling ports.
  • 5066/tcp 7443/tcp as WebSocket Signaling ports.
  • 8021/tcp as Event Socket port.
  • 64535-65535/udp as media ports.

Running the Container

CID=$(sudo docker run --name freeswitch -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p 60535-65535:60535-65535/udp -v /home/ubuntu/freeswitch/conf:/usr/local/freeswitch/conf bettervoice/freeswitch-container:1.6.6)

Keep in mind that freeswitch has to be able to read the mounted volume.

Large port range issue

Because of an issue in docker, mapping a large port range like in -p 60535-65535:60535-65535/udp can eat a lot of memory. Starting docker with --userland-proxy=false solves this partially, but startup will still be slow. As a workaround you can remove this from the docker commandline and manually add the iptables rules instead:

CIP=$(sudo docker inspect --format='{{.NetworkSettings.IPAddress}}' $CID)

sudo iptables -A DOCKER -t nat -p udp -m udp ! -i docker0 --dport 60535:65535 -j DNAT --to-destination $CIP:60535-65535
sudo iptables -A DOCKER -p udp -m udp -d $CIP/32 ! -i docker0 -o docker0 --dport 60535:65535 -j ACCEPT
sudo iptables -A POSTROUTING -t nat -p udp -m udp -s $CIP/32 -d $CIP/32 --dport 60535:65535 -j MASQUERADE

Configuration

Make sure you properly set rtp-start-port and rtp-end-port in autoload_configs/switch.conf.xml. Also you need to set ext-rtp-ip and ext-sip-ip for every profile which is accessible from your public ip address. See the freeswitch documentation for further instructions.

Clone this wiki locally