Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/signalwire/freeswitch/llms.txt

Use this file to discover all available pages before exploring further.

FreeSWITCH provides two primary command-line interfaces: the interactive console that runs in the foreground alongside the process, and fs_cli, a standalone client that connects to a running FreeSWITCH instance over the Event Socket Layer (ESL). Both give you access to the same set of API commands — the console is ideal for development and direct server access, while fs_cli is the standard tool for remote or scripted administration.

Starting FreeSWITCH

The freeswitch binary accepts a number of flags that control how the process starts, where it looks for configuration, and what privileges it runs under. All flags are optional; running freeswitch without arguments starts it in interactive console mode.

Run Mode Flags

-c

Start in interactive console mode and stay in the foreground. This is the default behavior when no run-mode flag is given.

-nc

Daemonize — disable the interactive console and send the process to the background.

-ncwait

Like -nc, but the parent process waits until FreeSWITCH finishes startup before exiting. Useful in init scripts.

-nf

Stay in the foreground without attaching an interactive console. Useful with process supervisors such as systemd or runit.

Control Flags

FlagDescription
-hShow inline help and exit.
-versionPrint the version string and exit immediately.
-stopSend a stop signal to a running background instance.
-reincarnateAutomatically restart the process after an uncontrolled exit.
-reincarnate-reexecLike -reincarnate, but re-executes the binary via execv on restart.

Directory Override Flags

These flags let you run multiple FreeSWITCH instances or relocate specific data directories without editing configuration files.
FlagDescription
-base <dir>Set the base prefix directory for all paths.
-cfgname <file>Set the pathname to the main configuration file.
-conf <dir>Directory for configuration files (default: /etc/freeswitch).
-log <dir>Directory for log files.
-run <dir>Directory for temporary runtime files (PID file, etc.).
-db <dir>Directory for internal database files.
-mod <dir>Directory where runtime modules are loaded from.
-htdocs <dir>Directory for htdocs (HTTP server).
-scripts <dir>Directory for call-control scripts.
-temp <dir>Directory for temporary files.
-grammar <dir>Directory for grammar files.
-recordings <dir>Directory for call recordings.
-storage <dir>Directory for voicemail storage.
-sounds <dir>Directory for sound/prompt files.

Privilege and Performance Flags

FlagDescription
-u <user>Call setuid after startup to drop root privileges to the given user.
-g <group>Call setgid after startup to drop root privileges to the given group.
-rpEnable realtime scheduling priority for the main process threads.
-lpEnable low scheduling priority.
-npEnable normal scheduling priority (explicit default).
-vgRun the switch process under Valgrind for memory debugging.
-nonatDisable the NAT detection checks performed at startup.
-nonatmapDisable automatic NAT port mapping.
-nocalDisable the system clock calibration performed at startup.
-nortDisable use of CLOCK_REALTIME.
-heavy-timerUse a more expensive but potentially more accurate system timer.
-nosqlDisable internal SQL usage (may limit functionality).
-coreEnable core dump generation on crash (also requires appropriate ulimit settings).

Example: Starting in Daemon Mode

# Start as a daemon, wait for full startup before returning
freeswitch -ncwait -u freeswitch -g freeswitch

# Start interactively with a custom config directory
freeswitch -c -conf /opt/freeswitch/conf

# Stop a running background instance
freeswitch -stop

fs_cli

fs_cli is a separate binary that connects to a running FreeSWITCH instance over the Event Socket Layer on TCP port 8021. It provides the same interactive console experience — including tab completion and command history — without requiring direct access to the server process.

Connection Flags

FlagDescription
-H <host>Hostname or IP address to connect to (default: 127.0.0.1).
-P <port>ESL port to connect on (default: 8021).
-p <password>ESL password (default: ClueCon — change this in production).
-x <cmd>Execute a single command non-interactively and exit.
-qQuiet mode — suppress banner output.
-t <ms>Timeout in milliseconds for ESL connection.

Connecting to a Local Instance

fs_cli -H 127.0.0.1 -P 8021 -p ClueCon

Running a Single Command Non-Interactively

# Check status and exit — useful in scripts and monitoring checks
fs_cli -x "status"

# Reload XML configuration from a shell script
fs_cli -x "reloadxml"

# Retrieve active channel count
fs_cli -x "show channels count"
Inside fs_cli, press Tab to auto-complete API command names and module names. Use the Up/Down arrow keys to navigate command history, and type /help to list available meta-commands. Press F1–F12 to trigger the keybindings configured in switch.conf.xml.

Essential Console Commands

The following commands work identically whether you type them at the interactive console or pass them via fs_cli -x "...".

Status and Monitoring

Displays FreeSWITCH uptime, the number of active sessions, sessions per second, and peak session counts.
freeswitch> status
Example output:
UP 0 years, 1 day, 4 hours, 32 minutes, 18 seconds, 423 milliseconds, 815 microseconds
FreeSWITCH (Version 1.10.x) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0
0 sessions per second - peak 0, last 5min 0
min idle cpu 0.00/100.00
Lists all currently active channels (legs) in the switch, including their UUID, state, caller ID, and destination.
freeswitch> show channels
freeswitch> show channels count
Displays all currently registered SIP endpoints, their contact URIs, expiry times, and user agents.
freeswitch> show registrations
Lists bridged call legs (as opposed to individual channels). Useful for seeing how many actual calls — not legs — are in progress.
freeswitch> show calls
freeswitch> show calls count

Sofia SIP Management

Shows all loaded Sofia SIP profiles and their state (RUNNING, STOPPED), listening addresses, and gateway counts.
freeswitch> sofia status
Dumps detailed information about a specific SIP profile including bindings, gateways, and settings.
freeswitch> sofia status profile internal
freeswitch> sofia status profile external
Reloads a SIP profile’s configuration without restarting FreeSWITCH. Changes to the profile XML are applied immediately.
freeswitch> sofia profile internal reload
freeswitch> sofia profile external restart
Enables live SIP message tracing to the console for all profiles. Invaluable for debugging registration and call setup issues.
freeswitch> sofia global siptrace on
freeswitch> sofia global siptrace off

Configuration Reloading

Re-reads and re-parses all XML configuration files (dialplan, directory, config). No restart required. Module configuration requires a separate reload command.
freeswitch> reloadxml
Unloads and reloads a named module, applying any configuration changes. Does not affect other modules.
freeswitch> reload mod_sofia
freeswitch> reload mod_dialplan_xml
Loads a module that is not currently running, or unloads one that is. Changes are not persistent across restarts — edit modules.conf.xml to make them permanent.
freeswitch> load mod_xml_curl
freeswitch> unload mod_xml_curl

Call Control

Creates a new call leg to an endpoint and connects it to an application or extension. This is the primary way to generate calls from the console.
# Call a SIP endpoint and play music on hold
freeswitch> originate sofia/internal/1000@192.168.1.100 &hold

# Call an endpoint and bridge it to another
freeswitch> originate sofia/internal/1000@192.168.1.100 &bridge(sofia/gateway/mycarrier/18005551234)

# Originate and drop into an IVR application
freeswitch> originate sofia/internal/1000@192.168.1.100 &playback(/tmp/welcome.wav)
Immediately terminates a specific channel identified by its UUID. Use show channels to find the UUID.
freeswitch> uuid_kill 3f6a1b2c-1234-4abc-8def-000000000001
Bridges two already-answered channels together, connecting their audio paths.
freeswitch> uuid_bridge 3f6a1b2c-1234-4abc-8def-000000000001 5a9b2c3d-5678-4def-9012-000000000002

System Control

Changes the verbosity of console log output at runtime. Level 0 silences all output; level 7 shows INFO and below; level 8 shows DEBUG.
freeswitch> log 7
freeswitch> log 0
freeswitch> log debug
Temporarily suspends acceptance of new inbound calls. In-progress calls are not affected. Use fsctl resume to resume.
freeswitch> fsctl pause
freeswitch> fsctl resume
Submits an API command for asynchronous execution. The result is delivered as an event rather than blocking the console.
freeswitch> bgapi originate sofia/internal/1000@192.168.1.100 &echo
Prints the exact version string of the running FreeSWITCH binary.
freeswitch> version

Console Keybindings

The default switch.conf.xml defines F-key bindings available in the interactive console:
KeyCommand
F1help
F2status
F3show channels
F4show calls
F5sofia status
F6reloadxml
F7console loglevel 0 (silence)
F8console loglevel 7 (INFO)
F9sofia status profile internal
F10sofia profile internal siptrace on
F11sofia profile internal siptrace off
F12version
These bindings can be customized in the <cli-keybindings> section of conf/autoload_configs/switch.conf.xml.

Build docs developers (and LLMs) love