asterisk-cli
TLDR
Connect to the running Asterisk console
SYNOPSIS
asterisk -r [-v...]
asterisk -rx "command"
DESCRIPTION
Asterisk CLI is the command-line interface for managing the Asterisk PBX (Private Branch Exchange) server. It provides real-time monitoring, configuration reloading, and administrative control over the telephony system.
Connect to a running Asterisk instance with asterisk -r. For scripts and automation, use asterisk -rx "command" to execute commands non-interactively. Tab completion is available for commands within the interactive console.
The CLI provides access to all Asterisk subsystems including SIP/PJSIP peers, active channels, dialplan, voicemail, queues, and the internal database. Verbosity levels (-v flags) control the amount of real-time event output displayed.
Configuration changes typically require module reloads rather than full restarts. Use dialplan reload for extensions.conf changes or module reload for specific modules.
PARAMETERS
-r
Connect to a running Asterisk instance via remote console-R
Same as -r, but attempt reconnection if disconnected-v
Increase verbosity (can be repeated: -vvv for more detail)-x command
Execute a CLI command and exit-c
Start Asterisk in console mode (foreground)-g
Dump core on crash (for debugging)-n
Disable ANSI color output
CLI COMMANDS
core show help [command]
Display help for CLI commandscore show channels
List active channels and callscore show applications
List available dialplan applicationsdialplan reload
Reload the dialplan configurationsip show peers
Display configured SIP peerssip show registry
Show SIP registration statuspjsip show endpoints
Display PJSIP endpoints (modern SIP stack)module reload module
Reload a specific modulelogger reload
Reload logging configurationcore stop gracefully
Stop Asterisk after calls completecore stop now
Stop Asterisk immediatelydatabase show [family]
Display AstDB database contents
CAVEATS
The Asterisk daemon must be running before connecting with -r. Some commands require specific modules to be loaded. The legacy chan_sip module uses sip commands while modern deployments use pjsip commands. Heavy verbosity can impact performance on busy systems.
HISTORY
Asterisk was created by Mark Spencer at Digium (now Sangoma) and first released in 1999. It pioneered software-based PBX systems and VoIP telephony. The CLI has evolved alongside Asterisk, with the introduction of PJSIP in Asterisk 12 (2013) providing a modern SIP stack alongside the legacy chan_sip module.
SEE ALSO
asterisk(8), freeswitch(1), kamailio(8)


