Linux command
asterisk-cli 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Connect to the running Asterisk
asterisk -r
Connect with verbose output
asterisk -rvvv
Execute a CLI command
asterisk -rx "sip show peers"
Reload the dialplan
asterisk -rx "dialplan reload"
Show active calls
asterisk -rx "core show channels"
Show SIP registrations
asterisk -rx "sip show registry"
Gracefully shutdown
asterisk -rx "core stop gracefully"
说明
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.
参数
- -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
FAQ
What is the asterisk-cli command used for?
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.
How do I run a basic asterisk-cli example?
Run `asterisk -r` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r do in asterisk-cli?
Connect to a running Asterisk instance via remote console