Chapter 31: CLI and API Command Reference
FreeSWITCH exposes its entire runtime API through two interfaces that share the same command set: the interactive fs_cli console and the Event Socket. Any command entered at the fs_cli prompt can be sent verbatim over the Event Socket using the api or bgapi method, making this reference applicable to both surfaces.
This chapter covers the operator-facing command set. FreeSWITCH registers over 150 API commands in total; the commands documented here are the ones operators use for daily administration, call control, and configuration management.
Connecting with fs_cli
fs_cli is the standard interactive client for the FreeSWITCH Event Socket interface. It connects to the address and port defined in event_socket.conf.xml. The default listen address is :: (all interfaces), the default port is 8021, and the default password is ClueCon.
Common connection flags:
| Flag | Purpose |
|---|---|
-H <host> | Event Socket host (default: localhost) |
-P <port> | Event Socket port (default: 8021) |
-p <password> | Event Socket password |
-x <command> | Execute a single command and exit |
-q | Quiet mode; suppress log output |
Example invocation connecting to a non-default host:
fs_cli -H 192.0.2.10 -P 8021 -p ClueCon
Commands issued at the fs_cli prompt are sent to the FreeSWITCH process as API calls over the Event Socket. The same commands work identically when sent via the Event Socket from an external application using api <command> [args].
Status and Inspection
These commands return runtime state information about the FreeSWITCH process and its active sessions.
| Command | Purpose | Syntax |
|---|---|---|
status | Show overall system status: uptime, session count, and rate statistics | status |
version | Report the FreeSWITCH version string | version [short] |
uptime | Report process uptime in a specified unit | uptime [us|ms|s|m|h|d|microseconds|milliseconds|seconds|minutes|hours|days] |
show channels | List active channels | show channels [count|like <match>] |
show calls | List active calls | show calls [count] |
show detailed_calls | List active calls with extended field detail | show detailed_calls |
show bridged_calls | List calls that are currently bridged | show bridged_calls |
show detailed_bridged_calls | List bridged calls with extended field detail | show detailed_bridged_calls |
show registrations | List current SIP registrations | show registrations |
show modules | List loaded modules | show modules |
show interfaces | List registered interfaces | show interfaces |
show interface_types | List registered interface type groups | show interface_types |
show tasks | List scheduled tasks | show tasks |
show codec | List registered codecs | show codec |
show endpoint | List registered endpoints | show endpoint |
show application | List registered dialplan applications | show application |
show api | List registered API commands | show api |
show limits | Show limit backend usage | show limits |
hostname | Return the system hostname | hostname |
switchname | Return the configured switch name | switchname |
host_lookup | Resolve a hostname to an IP address | host_lookup <hostname> |
gethost | Resolve a hostname using gethostbyname | gethost <hostname> |
uuid_exists | Check whether a channel UUID is currently active | uuid_exists <uuid> |
uuid_dump | Dump all variables and state for a session | uuid_dump <uuid> [format] |
uuid_buglist | List active media bugs on a session | uuid_buglist <uuid> |
The show command accepts the full subject list from source:
codec|endpoint|application|api|dialplan|file|timer|calls [count]|
channels [count|like <match string>]|calls|detailed_calls|bridged_calls|
detailed_bridged_calls|aliases|complete|chat|management|modules|
nat_map|say|interfaces|interface_types|tasks|limits|status
Directory and Interface Lookups
These commands query the XML user directory, check for the existence of modules and files, and resolve interface addresses. They are commonly used from scripts and the dialplan to make routing decisions.
| Command | Purpose | Syntax |
|---|---|---|
list_users | List users configured in the directory, optionally filtered by group, domain, user, or context | list_users [group <group>] [domain <domain>] [user <user>] [context <context>] |
user_exists | Test whether a user matches a directory key/value (returns true/false) | user_exists <key> <user> <domain> |
user_data | Return a variable, parameter, or attribute value for a directory user | user_data <user>@<domain> [var|param|attr] <name> |
domain_exists | Test whether a domain is configured in the directory (returns true/false) | domain_exists <domain> |
domain_data | Return a variable, parameter, or attribute value for a directory domain | domain_data <domain> [var|param|attr] <name> |
module_exists | Test whether a module is loaded (returns true/false) | module_exists <module> |
file_exists | Test whether a file exists on the server filesystem (returns true/false) | file_exists <file> |
interface_ip | Return the primary IP address of a named network interface | interface_ip [auto|ipv4|ipv6] <ifname> |
Notes on user_exists:
The <key> argument selects which directory field is matched against <user>, for example id to match on the user ID.
Notes on interface_ip:
ipv4 and ipv6 force the address family; auto returns whichever family is available for the interface named by <ifname>.
Call Control
These commands act on active channels, identified by their UUID. Obtain UUIDs from show channels or show calls.
| Command | Purpose | Syntax |
|---|---|---|
originate | Originate an outbound call leg | originate <call_url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>] |
uuid_bridge | Bridge two existing channel legs together | uuid_bridge <uuid> <other_uuid> |
uuid_kill | Terminate a channel, optionally specifying a hangup cause | uuid_kill <uuid> [cause] |
uuid_transfer | Transfer a channel to a dialplan extension | uuid_transfer <uuid> [-bleg|-both] <dest-exten> [<dialplan>] [<context>] |
uuid_dual_transfer | Transfer a call and its partner leg simultaneously | uuid_dual_transfer <uuid> <A-dest-exten>[/<A-dialplan>][/<A-context>] <B-dest-exten>[/<B-dialplan>][/<B-context>] |
uuid_hold | Place or release a call hold on a channel | uuid_hold [off|toggle] <uuid> [<display>] |
uuid_park | Park a channel | uuid_park <uuid> |
uuid_answer | Answer an unanswered channel | uuid_answer <uuid> |
uuid_pre_answer | Pre-answer a channel (183 Session Progress) | uuid_pre_answer <uuid> |
uuid_ring_ready | Send ringing to a channel | uuid_ring_ready <uuid> [queued] |
uuid_setvar | Set a channel variable on a session | uuid_setvar <uuid> <var> [value] |
uuid_setvar_multi | Set multiple channel variables in one call | uuid_setvar_multi <uuid> <var>=<value>;<var>=<value>... |
uuid_getvar | Retrieve the value of a channel variable | uuid_getvar <uuid> <var> |
uuid_dump | Dump all variables and state for a session | uuid_dump <uuid> [format] |
uuid_broadcast | Execute a dialplan application on a channel | uuid_broadcast <uuid> <path> [aleg|bleg|holdb|both] |
uuid_record | Start, stop, mask, or unmask session audio recording | uuid_record <uuid> [start|stop|mask|unmask] <path> [<limit>] [<recording_vars>] |
uuid_displace | Inject or remove an audio file on a channel | uuid_displace <uuid> [start|stop] <path> [<limit>] [mux] |
uuid_audio | Mute or adjust audio level on a channel | uuid_audio <uuid> [start [read|write] [mute|level <level>]|stop] |
uuid_pause | Pause or resume media on a channel | uuid_pause <uuid> <on|off> |
uuid_break | Break out of the current application blocking a channel | uuid_break <uuid> [all] |
break | Alias for uuid_break | break <uuid> [all] |
uuid_send_dtmf | Send DTMF digits to a channel | uuid_send_dtmf <uuid> <dtmf_data> |
uuid_recv_dtmf | Inject received DTMF digits into a channel | uuid_recv_dtmf <uuid> <dtmf_data> |
uuid_flush_dtmf | Flush buffered DTMF from a channel | uuid_flush_dtmf <uuid> |
uuid_media | Reinvite FreeSWITCH in or out of the media path | uuid_media [off] <uuid> |
uuid_media_3p | Reinvite FreeSWITCH in or out of the media path using 3PCC (third-party call control) | uuid_media_3p [off] <uuid> |
uuid_media_reneg | Trigger a media renegotiation on a channel | uuid_media_reneg <uuid>[ <codec_string>] |
uuid_deflect | Send a SIP REFER to redirect a call | uuid_deflect <uuid> <uri> |
uuid_redirect | Send a SIP redirect response | uuid_redirect <uuid> <uri> |
uuid_display | Update the phone display for a registered device | uuid_display <uuid> <display> |
uuid_loglevel | Set the log level for a specific session | uuid_loglevel <uuid> <level> |
uuid_jitterbuffer | Enable or configure the jitter buffer on a channel | uuid_jitterbuffer <uuid> [0|<min_msec>[:<max_msec>]] |
uuid_session_heartbeat | Enable or set a heartbeat interval on a channel | uuid_session_heartbeat <uuid> [sched] [0|<seconds>] |
uuid_simplify | Attempt to cut FreeSWITCH out of the media path | uuid_simplify <uuid> |
uuid_fileman | Control file playback on a channel | uuid_fileman <uuid> <cmd>:<val> |
uuid_send_message | Send a SIP MESSAGE to the endpoint on a channel | uuid_send_message <uuid> <message> |
uuid_send_info | Send a SIP INFO request to the endpoint on a channel | uuid_send_info <uuid> [<mime_type> <mime_subtype>] <message> |
uuid_limit | Apply a usage-limit resource against a channel through a limit backend | uuid_limit <uuid> <backend> <realm> <resource> [<max>[/interval]] [number [dialplan [context]]] |
uuid_limit_release | Release a limit resource previously applied to a channel | uuid_limit_release <uuid> <backend> [realm] [resource] |
tone_detect | Start tone detection on a channel, optionally firing an application on match | tone_detect <uuid> <key> <tone_spec> [<flags> <timeout> <app> <args> <hits>] |
hupall | Hang up all channels, optionally filtered by variable value | hupall <cause> [<var> <value>] [<var2> <value2>] |
Notes on originate:
The <call_url> argument is a FreeSWITCH endpoint dial string, for example sofia/internal/1001@192.0.2.1. The second positional argument is either a dialplan extension (<exten>) or an inline application prefixed with &, such as &echo(). The <dialplan> and <context> arguments default to XML and default respectively when omitted.
Notes on uuid_transfer:
-bleg transfers the B-leg of the call; -both transfers both legs simultaneously. Without a flag, the A-leg is transferred.
Notes on uuid_broadcast:
The <path> argument is a sound file path or an inline application invocation in app::args form. The aleg, bleg, holdb, and both flags control which leg receives the broadcast.
Notes on uuid_record:
mask replaces recorded audio with silence; unmask restores normal recording. The optional <recording_vars> argument accepts a semicolon-separated list of channel variables to attach as metadata.
Notes on uuid_displace:
start begins audio injection; stop ends it. The mux flag mixes the injected audio with the existing stream rather than replacing it.
Configuration Control
These commands reload configuration without restarting the FreeSWITCH process.
| Command | Purpose | Syntax |
|---|---|---|
reloadxml | Reload all XML configuration from disk | reloadxml |
reload | Reload a loaded module (unload then load) | reload [-f] <mod_name> |
load | Load a module that is not currently loaded | load <mod_name> |
unload | Unload a loaded module | unload [-f] <mod_name> |
reloadacl | Reload access control lists from configuration | reloadacl |
reloadcert | Reload SSL/TLS certificates without restart | reloadcert |
The -f flag on reload and unload forces the operation even if the module reports that it cannot be unloaded safely.
System Control
The fsctl command sends control messages to the FreeSWITCH core. All subcommands follow the pattern fsctl <subcommand> [args]. The shutdown command is also available as a standalone alias.
| Command | Purpose | Syntax |
|---|---|---|
fsctl loglevel | Set the global console log level | fsctl loglevel <level> |
fsctl debug_level | Set the global debug verbosity level | fsctl debug_level <level> |
fsctl pause | Pause call processing (inbound, outbound, or both) | fsctl pause [inbound|outbound] |
fsctl resume | Resume call processing | fsctl resume [inbound|outbound] |
fsctl max_sessions | Set the maximum concurrent session limit | fsctl max_sessions <num> |
fsctl sps | Set the sessions-per-second limit | fsctl sps <num> |
fsctl sps_peak_reset | Reset the peak sessions-per-second counter | fsctl sps_peak_reset |
fsctl shutdown | Initiate a controlled shutdown | fsctl shutdown [cancel|elegant|asap|now|restart] |
fsctl recover | Recover sessions from the core recovery database | fsctl recover |
fsctl hupall | Hang up all active sessions via core control | fsctl hupall |
fsctl min_dtmf_duration | Set the minimum DTMF duration in milliseconds | fsctl min_dtmf_duration <num> |
fsctl max_dtmf_duration | Set the maximum DTMF duration in milliseconds | fsctl max_dtmf_duration <num> |
fsctl default_dtmf_duration | Set the default DTMF duration in milliseconds | fsctl default_dtmf_duration <num> |
fsctl min_idle_cpu | Set the minimum idle CPU percentage before call rejection | fsctl min_idle_cpu <num> |
fsctl sync_clock | Sync the internal clock to the system clock immediately | fsctl sync_clock |
fsctl sync_clock_when_idle | Sync the internal clock the next time the system is idle | fsctl sync_clock_when_idle |
fsctl send_sighup | Send SIGHUP to the process, triggering log rotation | fsctl send_sighup |
fsctl uuid_version | Set the UUID generation version | fsctl uuid_version [4|7] |
fsctl api_expansion | Enable or disable API expansion in dialplan | fsctl api_expansion [on|off] |
fsctl reclaim_mem | Reclaim unused memory from core memory pools | fsctl reclaim_mem |
fsctl mdns_resolve | Enable or disable mDNS resolution | fsctl mdns_resolve [enable|disable] |
fsctl flush_db_handles | Flush idle core database connection handles from the pool | fsctl flush_db_handles |
fsctl calibrate_clock | Recalibrate the internal monotonic clock | fsctl calibrate_clock |
fsctl crash | Force an immediate process crash (for debugging core dumps) | fsctl crash |
fsctl verbose_events | Enable or disable verbose event generation globally | fsctl verbose_events [on|off] |
fsctl threaded_system_exec | Toggle whether system/bg_system shell commands run in a dedicated thread | fsctl threaded_system_exec [on|off] |
fsctl save_history | Persist the CLI command history to disk | fsctl save_history |
fsctl pause_check | Report whether call processing is paused (returns true/false) | fsctl pause_check [inbound|outbound] |
fsctl ready_check | Report whether the system is ready (returns true/false) | fsctl ready_check |
fsctl shutdown_check | Report whether a shutdown is in progress (returns true/false) | fsctl shutdown_check |
fsctl debug_pool | Print core memory pool debug statistics | fsctl debug_pool |
fsctl debug_sql | Toggle SQL debug logging | fsctl debug_sql |
fsctl sql | Start or stop the core SQL queue thread | fsctl sql [start|stop] |
fsctl last_sps | Report the last sessions-per-second value | fsctl last_sps |
shutdown | Initiate immediate shutdown (no modifier flags) | shutdown |
FreeSWITCH log levels, from least to most verbose: console, alert, crit, err, warning, notice, info, debug.
The CTL_SYNTAX usage string published by mod_commands lists the most common subcommands:
fsctl [api_expansion [on|off]|recover|send_sighup|hupall|
pause [inbound|outbound]|resume [inbound|outbound]|
shutdown [cancel|elegant|asap|now|restart]|
uuid_version [4|7]|sps|sps_peak_reset|sync_clock|
sync_clock_when_idle|reclaim_mem|max_sessions|
min_dtmf_duration [num]|max_dtmf_duration [num]|
default_dtmf_duration [num]|min_idle_cpu|
loglevel [level]|debug_level [level]|
mdns_resolve [enable|disable]]
The handler accepts additional subcommands beyond this string, documented in the table above: flush_db_handles, calibrate_clock, crash, verbose_events, threaded_system_exec, save_history, pause_check, ready_check, shutdown_check, debug_pool, debug_sql, sql, and last_sps.
Notes on fsctl shutdown:
cancel aborts a pending shutdown. elegant waits for all active sessions to complete. asap waits only until no sessions are active (does not wait for existing sessions to finish). now terminates immediately. Adding restart to elegant, asap, or now causes a restart after shutdown. The reincarnate now modifier (fsctl shutdown reincarnate now) terminates the process immediately and relaunches it, equivalent to a restart with the watchdog/reincarnate path.
Diagnostic subcommands:
pause_check, ready_check, and shutdown_check return a bare true/false for use in scripts. crash deliberately aborts the process and is intended only for generating a core dump during debugging.
Process and Shell Execution
These commands run external programs from the FreeSWITCH process. They are disabled when the core is started with the command execution restriction (the -nonat/restricted modes or switch.conf.xml <param name="enable-use-system-commands" value="false"/> policy), so confirm they are permitted before relying on them in production.
| Command | Purpose | Syntax |
|---|---|---|
system | Run a shell command in the foreground and write its output to the stream | system <command> |
bg_system | Run a shell command in the background; returns +OK immediately without capturing output | bg_system <command> |
spawn | Run an external program directly (no shell) without capturing its output | spawn <command> |
bg_spawn | Run an external program directly in the background; returns +OK immediately | bg_spawn <command> |
spawn_stream | Run an external program directly and capture its output to the stream | spawn_stream <command> |
log | Write a message to the FreeSWITCH log at a given level | log <level> <message> |
memory | Report core memory usage statistics | memory |
pool_stats | Report core memory pool usage statistics | pool_stats |
unsched_api | Unschedule a task previously created with sched_api, by task ID | unsched_api <task_id> |
Notes on system versus spawn:
system and bg_system pass the command to a shell (/bin/sh -c), so shell features such as pipes and redirection work. The spawn family invokes the target program directly without a shell, which avoids shell-injection and quoting issues but does not interpret shell metacharacters. Use spawn_stream when you need the program's standard output returned to the caller.
Notes on log:
<level> accepts any FreeSWITCH log level name (console, alert, crit, err, warning, notice, info, debug); an unrecognized level defaults to debug.
NAT Mapping
The nat_map command manages UPnP/NAT-PMP port mappings on an upstream router when NAT traversal is initialized.
| Command | Purpose | Syntax |
|---|---|---|
nat_map | Inspect or modify NAT port mappings | nat_map [status|republish|reinit] | [add|del] <port> [tcp|udp] [static] |
Notes on nat_map:
status prints the current NAT status. republish re-announces existing mappings to the router. reinit re-detects the NAT device and re-publishes. add and del create or remove a single mapping for the given <port>; the protocol defaults to UDP when neither tcp nor udp is given, and static marks the mapping as sticky. The command returns an error if NAT traversal is not initialized.
Variables and Evaluation
These commands read, write, and evaluate FreeSWITCH global variables and expressions.
| Command | Purpose | Syntax |
|---|---|---|
global_getvar | Get a global variable value; with no argument, dumps all global variables | global_getvar [<var>] |
global_setvar | Set a global variable; conditionally if a second value is provided | global_setvar <var>=<value> [=<value2>] |
eval | Evaluate a string with variable expansion; no-op if no variables present | eval [uuid:<uuid> ]<expression> |
expand | Execute an API command after performing variable expansion on its arguments | expand [uuid:<uuid> ]<cmd> <args> |
regex | Evaluate a regular expression and optionally apply a substitution | regex <data>|<pattern>[|<subst string>][n|b] |
strftime_tz | Format a time value in a named timezone | strftime_tz <timezone_name> [<epoch>|][format string] |
url_encode | URL-encode a string | url_encode <string> |
url_decode | URL-decode a string | url_decode <string> |
md5 | Return the MD5 hash of a string | md5 <data> |
cond | Evaluate a conditional expression | cond <expr> ? <true val> : <false val> |
coalesce | Return the first non-empty value from a list | coalesce [^^<delim>]<value1>,<value2>,... |
replace | Replace all occurrences of a substring within a string | replace <data>|<string1>|<string2> |
escape | Escape special characters in a string | escape <data> |
toupper | Convert a string to upper case | toupper <string> |
tolower | Convert a string to lower case | tolower <string> |
create_uuid | Generate and return a new UUID | create_uuid |
Notes on global_setvar:
When =<value2> is supplied, the variable is set to <value> only if its current value equals <value2> (conditional set).
Notes on eval:
When a uuid:<uuid> prefix is supplied, expansion resolves channel variables from that session in addition to global variables.
Notes on regex:
The n flag returns the matched group number; b returns a boolean true/false. The delimiter is | within the syntax string, which must be escaped as \| when entered at fs_cli.
Scheduling
These commands schedule API calls or call events at a future time.
| Command | Purpose | Syntax |
|---|---|---|
sched_api | Schedule an API command to run at an absolute or relative time | sched_api [+|@]<time> <group_name> <command_string>[&] |
sched_del | Delete a scheduled task by task ID or group name | sched_del <task_id>|<group_id> |
sched_hangup | Schedule a running call to hang up | sched_hangup [+]<time> <uuid> [<cause>] |
sched_broadcast | Schedule a broadcast application on a running call | sched_broadcast [[+]<time>|@time] <uuid> <path> [aleg|bleg|both] |
sched_transfer | Schedule a transfer for a running call | sched_transfer [+]<time> <uuid> <extension> [<dialplan>] [<context>] |
show tasks | List all currently scheduled tasks | show tasks |
Notes on sched_api time argument:
A leading + means relative seconds from now. A leading @ means recurring: the command re-schedules itself every <N> seconds. A plain numeric value is an absolute Unix timestamp. Appending & runs the scheduled command in its own thread.
To cancel a task created with sched_api, use unsched_api <task_id> (documented under Process and Shell Execution); the task ID is the value returned when the task was scheduled. sched_del removes scheduled hangup, transfer, and broadcast tasks by ID or group.
Background Execution
bgapi executes any API command in a background thread and returns a Job-UUID immediately. The result of the command is delivered as a BACKGROUND_JOB event on the Event Socket.
| Command | Purpose | Syntax |
|---|---|---|
bgapi | Execute an API command in a background thread | bgapi <command>[ <arg>] |
bgapi accepts an optional uuid:<uuid> prefix to assign a specific Job-UUID to the background task:
bgapi uuid:my-job-id status
bgapi is registered as an API command in mod_commands and is available at the fs_cli prompt as well as over the Event Socket. When used over the Event Socket as the ESL bgapi method, the transport layer handles the Background-Job event header directly; the behavior is otherwise identical.
CLI Aliases and ACLs
These commands define shorthand aliases for longer command strings and test IP addresses against named access control lists.
| Command | Purpose | Syntax |
|---|---|---|
alias | Add, update, or delete a CLI/API command alias | alias [add|stickyadd] <alias> <command> | del [<alias>|*] |
acl | Test an IP address against a named ACL (returns true/false) | acl <ip> <list_name> |
Notes on alias:
add creates an alias that maps <alias> to a full <command> string. stickyadd does the same but persists the alias across reloads. del <alias> removes a single alias; del * removes all aliases.
Notes on acl:
The ACL named by <list_name> is defined in acl.conf.xml. The command returns true when <ip> matches the list and false otherwise, making it useful for dialplan or script-driven access decisions. Reload ACL definitions with reloadacl.
Sofia Command Tree
The sofia command is registered by mod_sofia and controls SIP profile and gateway state. All subcommands follow the pattern sofia <subcommand> [args].
Status Subcommands
| Command | Purpose | Syntax |
|---|---|---|
sofia status | Show all loaded profiles and gateways with their state | sofia status |
sofia status profile | Show detailed status for a named profile, including bindings and registration counts | sofia status profile <name> |
sofia status profile ... reg | Filter status output to registrations matching an optional contact string | sofia status profile <name> reg [<contact>] |
sofia status profile ... pres | Show presence data for a profile | sofia status profile <name> pres <pres_str> |
sofia status profile ... user | Show status for a specific user on a profile | sofia status profile <name> user <user@domain> |
sofia status gateway | Show status of a named gateway | sofia status gateway <name> |
sofia xmlstatus | Same as sofia status but output in XML format | sofia xmlstatus [profile <name>|gateway <name>] |
sofia jsonstatus | Same as sofia status but output in JSON format | sofia jsonstatus [profile <name>|gateway <name>] |
Profile Management Subcommands
| Command | Purpose | Syntax |
|---|---|---|
sofia profile ... rescan | Re-read profile configuration from XML without a full restart; preserves existing calls | sofia profile <name> rescan [wait] |
sofia profile ... restart | Fully stop and restart a profile | sofia profile <name> restart [wait] |
sofia profile ... start | Start a stopped profile | sofia profile <name> start |
sofia profile ... stop | Stop a running profile | sofia profile <name> stop [wait] |
sofia profile ... flush_inbound_reg | Flush inbound registrations, optionally scoped to a call ID or user at domain | sofia profile <name> flush_inbound_reg [<call_id>|<user>@<domain>] [reboot] |
sofia profile ... check_sync | Force re-sync of registrations matching a call ID | sofia profile <name> check_sync [<call_id>] |
sofia profile ... register | Force registration of a named gateway or all gateways | sofia profile <name> register [<gateway_name>|all] |
sofia profile ... unregister | Unregister a named gateway or all gateways | sofia profile <name> unregister [<gateway_name>|all] |
sofia profile ... killgw | Remove a gateway from a profile | sofia profile <name> killgw <gateway_name> |
sofia profile ... startgw | Add and start a gateway from the current XML configuration | sofia profile <name> startgw <gateway_name> |
sofia profile ... gwlist | List gateways on a profile | sofia profile <name> gwlist [down] |
sofia profile ... siptrace | Enable or disable SIP trace logging for a profile | sofia profile <name> siptrace <on|off> |
sofia profile ... capture | Enable or disable HEP/HOMER packet capture for a profile | sofia profile <name> capture <on|off> |
sofia profile ... watchdog | Enable or disable the profile watchdog | sofia profile <name> watchdog <on|off> |
sofia profile ... recover | Recover sessions from the recovery database for a profile | sofia profile <name> recover [flush] |
Note on sofia profile ... stop and sofia profile ... restart:
A profile must have been running for at least 10 seconds before it can be stopped or restarted. The wait option blocks until the profile finishes its current SIP transactions.
Global Subcommands
| Command | Purpose | Syntax |
|---|---|---|
sofia global siptrace | Enable or disable SIP trace logging across all profiles | sofia global siptrace <on|off> |
sofia global capture | Enable or disable HEP/HOMER capture globally | sofia global capture <on|off> |
sofia global watchdog | Enable or disable the profile watchdog globally | sofia global watchdog <on|off> |
sofia global standby | Enable or disable standby mode globally | sofia global standby <on|off> |
sofia global debug | Enable or disable presence or SLA debugging | sofia global debug [presence|sla|none] |
sofia restart all | Restart all SIP profiles simultaneously | sofia restart all |
Logging Subcommands
| Command | Purpose | Syntax |
|---|---|---|
sofia loglevel | Get or set the sofia-sip library log level for a named component | sofia loglevel <component> [0-9] |
sofia tracelevel | Set the FreeSWITCH log level at which sofia-sip trace output is emitted | sofia tracelevel <console|alert|crit|err|warning|notice|info|debug> |
Valid <component> values for sofia loglevel: all, default, tport, iptsec, nea, nta, nth_client, nth_server, nua, soa, sresolv, stun.
Utility API Commands
| Command | Purpose | Syntax |
|---|---|---|
sofia_contact | Return the contact URI for a registered user | sofia_contact [profile/]<user>@<domain> |
sofia_count_reg | Return the registration count for a user | sofia_count_reg [profile/]<user>@<domain> |
sofia_gateway_data | Retrieve a variable from a gateway | sofia_gateway_data <gateway_name> [ivar|ovar|var] <name> |
sofia_username_of | Look up the username associated with a registration | sofia_username_of [profile/]<user>@<domain> |
sofia_dig | Perform a SIP DNS lookup (NAPTR/SRV) | sofia_dig <url> |
Example fs_cli Session
The following illustrates a typical operator workflow: checking system state, inspecting an active call, and transferring it.
freeswitch@pbx> status
UP 0 years, 0 days, 2 hours, 14 minutes, 33 seconds, 412 milliseconds, 744 microseconds
FreeSWITCH (Version 1.10.x) is ready
2 session(s) since startup
1 session(s) - peak 1, last 5min 1
0 session(s) per Sec out of max 30, peak 1, last 5min 1
1000 session(s) max
min idle cpu 0.00/99.60
Current Stack Size/Max 240K/8192K
freeswitch@pbx> show channels
uuid,direction,created,created_epoch,name,state,cid_name,cid_num,...
5a3f1c2e-...,inbound,2026-06-02 10:31:00,...
freeswitch@pbx> uuid_transfer 5a3f1c2e-... 2000 XML default
+OK
freeswitch@pbx> sofia status profile internal
=================================
Name internal
...
RUNNING (2)
freeswitch@pbx> fsctl loglevel debug
freeswitch@pbx> reloadxml
+OK [Success]