How to Install FreeSWITCH on Debian 12: Packages, Docker and Your First Call
This guide walks you through installing FreeSWITCH on a fresh Debian 12 server, securing the defaults, and placing your first test call between two softphones. By the end you will have a working media server you can build on.
Always check the current FreeSWITCH documentation for exact repository and package details, because installation instructions change between releases. The steps below reflect the common approach at the time of writing.
Before you begin
You need:
- A Debian 12 server or VM with root or
sudoaccess - A static IP address, and DNS if you will use hostnames
- Time synchronization (for example with
chronyorsystemd-timesyncd), because SIP and TLS depend on accurate clocks - Two SIP softphones or desk phones for testing, such as Linphone or Zoiper
- Control of the firewall in front of the server
FreeSWITCH's official packages target Debian. If you prefer Ubuntu or another distribution, you will usually build from source or use a container.
Choose an installation method
| Method | Best for | Trade-off |
|---|---|---|
| Official Debian packages | Most servers: fast, supported, easy to update | Requires a SignalWire token for the package repository |
| Docker | Repeatable environments and testing | Needs careful networking for RTP; image provenance matters |
| Build from source | Custom modules, non-Debian systems | Slower, more dependencies to manage |
Method 1: install from the official Debian packages
FreeSWITCH's package repository is hosted by SignalWire and requires a free personal access token from a SignalWire account. Create the token first, then run the following as root (or prefix with sudo).
apt-get update && apt-get install -y gnupg2 wget lsb-release
TOKEN=YOUR_SIGNALWIRE_TOKEN
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
echo "machine freeswitch.signalwire.com login signalwire password $TOKEN" > /etc/apt/auth.conf
chmod 600 /etc/apt/auth.conf
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
apt-get update
apt-get install -y freeswitch-meta-all
freeswitch-meta-all installs FreeSWITCH with a broad set of modules, which is convenient for learning. For production, install only the modules you need.
Enable and start the service, then confirm it is running:
systemctl enable --now freeswitch
fs_cli -x "status"
If fs_cli prints uptime and session counts, FreeSWITCH is running.
Where things live
| Path | Contents |
|---|---|
/etc/freeswitch/ | Configuration (XML) |
/var/log/freeswitch/ | Log files |
/usr/share/freeswitch/ | Sounds and shared files |
/var/lib/freeswitch/ | Recordings, databases, and runtime data |
Method 2: run FreeSWITCH in Docker
Containers are handy for testing and repeatable builds, with one important caveat: FreeSWITCH uses a very large range of UDP ports for RTP, and Docker's port mapping handles large ranges poorly. The simplest reliable setup is host networking.
docker run -d --name freeswitch --network host \
-v /opt/freeswitch/conf:/etc/freeswitch \
-v /opt/freeswitch/log:/var/log/freeswitch \
YOUR_FREESWITCH_IMAGE
Notes:
- Replace
YOUR_FREESWITCH_IMAGEwith an image you build or one you trust. Community images exist, but verify who maintains an image before running it on a production server. - Copy the default configuration into your mounted volume first, so you can edit it.
- Many teams build their own image from a Debian base using the same packages as above, which keeps versions under your control.
Method 3: build from source
Building from source gives you full control and works on any distribution. The source is on GitHub at signalwire/freeswitch. In outline:
- Install the build toolchain and development libraries.
- Build and install required libraries that the release depends on (such as
sofia-sipandspandsp, and others noted in the build guide). - Run
./bootstrap.sh -j,./configure,make, andmake install. - Create a service unit so FreeSWITCH starts on boot.
The exact dependency list changes by version, so follow the current build instructions in the official documentation.
Open the right ports
Open only what you need, and restrict sources where possible.
| Port | Protocol | Purpose |
|---|---|---|
| 5060 | UDP and TCP | SIP for the internal profile (phones) |
| 5080 | UDP and TCP | SIP for the external profile (carriers and trunks) |
| 5061 / 5081 | TCP | SIP over TLS, if enabled |
| 16384 to 32768 | UDP | RTP audio (the default range) |
| 8021 | TCP | Event Socket (keep this local) |
| 7443 | TCP | WebRTC over secure WebSocket, if enabled |
Never expose the Event Socket port (8021) to the internet.
Secure the defaults before you expose the server
The stock FreeSWITCH configuration is built for demonstration. Change these before the server is reachable from outside:
- Default extension password. The sample users (1000 to 1019) share a password defined in
vars.xmlasdefault_password, which is a well-known value. Change it to a strong, unique value. - Event Socket password. In
autoload_configs/event_socket.conf.xml, change the default password and restrict access to localhost with the ACL. - Restrict SIP exposure. Use firewall allow-lists for carriers and known networks. Block everything else.
- Add automatic blocking of abusive sources. See FreeSWITCH hardening with fail2ban and firewalls.
- Disable what you do not use, including unused modules and demo features.
Internet-facing SIP servers are scanned constantly, often within minutes of going online. Treat security as step one, not a later task. See also VoIP security best practices.
Behind NAT? Set your external addresses
If the server sits behind NAT, or has a public IP that the operating system does not know about (common on cloud platforms), set the external addresses in vars.xml so SDP and SIP headers advertise the right IP:
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=YOUR.PUBLIC.IP"/>
<X-PRE-PROCESS cmd="set" data="external_sip_ip=YOUR.PUBLIC.IP"/>
Reload with fs_cli -x "reloadxml" and restart the SIP profiles as needed. NAT problems are the number one cause of one-way audio. See NAT traversal with STUN, TURN and ICE and SIP ALG.
Make your first call
-
Register softphone A as extension
1000. Use your server's IP as the SIP domain or server, username1000, and the password you set indefault_password. -
Register softphone B as extension
1001with the same password. -
Confirm registration on the server:
fs_cli -x "sofia status profile internal reg" -
Call
1001from1000. Both phones should ring and carry audio in both directions. -
Try the echo test by dialing
9196. You should hear your own voice repeated back.
If both calls work, signaling, routing, and media are working end to end.
Useful fs_cli commands
| Command | Purpose |
|---|---|
status | Uptime and session counts |
sofia status | SIP profiles and gateways |
sofia status profile internal reg | Registered users |
show channels | Active calls |
sofia global siptrace on | Print SIP messages to the console |
console loglevel 7 | Increase log detail |
reloadxml | Reload configuration |
Troubleshooting
| Problem | Likely cause | What to try |
|---|---|---|
| Phone will not register | Wrong password, domain, or blocked port | Check default_password, port 5060, and sofia status profile internal reg |
| Calls connect but no audio | RTP ports blocked, or NAT addresses wrong | Open the RTP range and set external IPs |
| One-way audio | NAT or a router SIP ALG | Fix external IPs and disable SIP ALG |
| Calls rejected | Dialplan or user not found | Watch siptrace and check the dialplan context |
| Changes do not apply | Configuration not reloaded | reloadxml, and restart profiles if needed |
What to do next
- Connect to a carrier by defining a SIP gateway and an outbound route. See SIP trunking buyer's guide.
- Add call logic with the dialplan and the Event Socket. See the FreeSWITCH Event Socket guide and dynamic configuration with mod_xml_curl.
- Scale out by putting Kamailio in front of several FreeSWITCH servers. See scaling FreeSWITCH horizontally with Kamailio and Kamailio basic configuration.
- Compare it with other platforms in FreeSWITCH vs Asterisk vs Kamailio.
Frequently asked questions
Is FreeSWITCH free?
Yes. FreeSWITCH is open-source software. Commercial support and hosted services are available from vendors, but the software itself is free to use.
Which operating system is best for FreeSWITCH?
Debian is the primary target for the official packages. Other distributions work, usually by building from source or using containers.
Can I run FreeSWITCH on Ubuntu?
Yes, typically by building from source or using a container, since the official package repository targets Debian.
How many calls can one FreeSWITCH server handle?
It depends on hardware, codecs, transcoding, and features such as recording. Measure with realistic traffic rather than relying on generic numbers. See SIP trunking load testing.
References
Need FreeSWITCH installed, hardened, and scaled for production? Our FreeSWITCH development team designs, builds, and operates production media servers.
Related Services
Keep Reading
Discussion
0Join the conversation
Sign in with your preferred account to comment, reply, and keep the discussion useful for other engineers.
Takes a few seconds. No separate password required.
Controva LLC
Engineering Team
We build digital empires that scale. Specializing in high-performance web architecture, AI automation, and headless commerce.
Work with us