Introduction
Asterisk is an open-source PBX and telephony engine widely used for VoIP systems. The Asterisk Command Line Interface (CLI) is the primary tool for managing calls, inspecting SIP endpoints, debugging issues, and controlling the running PBX in real time.
Asterisk 22 is an LTS release, and it continues the modern shift toward PJSIP, deprecating many legacy components like chan_sip.
This article covers:
- How the CLI works
- Core command categories
- All commonly used commands compatible with Asterisk 22+
- Deprecated vs modern equivalents
- Real-world usage explanations
1️⃣ Accessing the Asterisk CLI
You can interact with Asterisk locally or remotely via the CLI.
Attach to a Running Instance
asterisk -r
asterisk -rvvv
-r→ connect to the running Asterisk process-v→ increase verbosity (-rvvvis common)
Run a Single Command
asterisk -rx "core show channels"
Useful for scripts, cron jobs, and monitoring systems.
2️⃣ Core System Commands
These commands manage the Asterisk core engine.
System Status
core show version
core show uptime
core show settings
core show sysinfo
Calls & Channels
core show calls
core show channels
core show channels concise
core show channel <channel_name>
Restart & Shutdown
core restart now
core restart gracefully
core stop now
core stop gracefully
⚠️
gracefullywaits for active calls to finish.
3️⃣ Dialplan Management
The dialplan controls call routing and logic.
View Dialplan
dialplan show
dialplan show <context>
dialplan show <context>,<extension>
Reload Dialplan
dialplan reload
💡 In Asterisk 22+, dialplan reloads are safe and non-disruptive.
4️⃣ Reloading Configuration
Reload Everything
reload
Targeted Reloads (Preferred)
core reload
module reload
module reload <module_name>
Targeted reloads reduce call disruption.
5️⃣ Module Management
Asterisk loads features as modules.
module show
module show like pjsip
module load <module_name>
module unload <module_name>
module reload <module_name>
📌 Example:
module reload res_pjsip.so
6️⃣ PJSIP Commands (Primary SIP Stack in Asterisk 22)
✅ chan_sip is removed in Asterisk 22
❌sip show peersno longer exists
Endpoints & Registration
pjsip show endpoints
pjsip show endpoint <endpoint>
pjsip show registrations
pjsip show aors
pjsip show auths
Channels
pjsip show channels
Reload & Debug
pjsip reload
pjsip set logger on
pjsip set logger off
🛠 Use pjsip set logger on for SIP packet debugging (replaces sip set debug on).
7️⃣ RTP & Media Debugging
rtp set debug on
rtp set debug off
Shows RTP packet flow — useful for one-way audio troubleshooting.
8️⃣ Queues (Call Centers)
queue show
queue show <queue_name>
queue reload all
Member Control
queue pause member <interface> queue <queue>
queue unpause member <interface> queue <queue>
9️⃣ Music on Hold (MOH)
moh show classes
moh reload
Used for hold music, ringback tones, and IVR audio.
🔟 Logging & Debugging
Verbosity & Debug Levels
core set verbose <level>
core set debug <level>
Tracing
core set trace on
core set trace off
Logger
logger show channels
logger reload
1️⃣1️⃣ Asterisk Internal Database (AstDB)
A lightweight internal key-value store.
database show
database show <family>
database get <family> <key>
database put <family> <key> <value>
database del <family> <key>
database deltree <family>
Used for:
- DND flags
- Call counters
- Feature state storage
1️⃣2️⃣ CDR & CEL (Call Records)
Call Detail Records (CDR)
cdr show status
cdr reload
Call Event Logging (CEL)
cel show status
1️⃣3️⃣ HTTP, DNS, & Networking
http show status
http show sessions
dns show cache
Useful for:
- REST APIs
- WebRTC
- AMI / ARI integrations
1️⃣4️⃣ File & Media Formats
file show formats
Lists supported audio codecs and file types.
1️⃣5️⃣ Help & Discovery
help
help <command>
core show help
💡 Many subcommands reveal hidden options via help.
🔄 Deprecated Commands (Removed in Asterisk 22)
| Old Command | Status | Replacement |
|---|---|---|
sip show peers | ❌ Removed | pjsip show endpoints |
sip set debug on | ❌ Removed | pjsip set logger on |
chan_sip | ❌ Removed | chan_pjsip |
sip reload | ❌ Removed | pjsip reload |
✅ Best Practices for Asterisk 22+
- Use PJSIP only
- Prefer targeted reloads
- Avoid full restarts in production
- Use
asterisk -rxfor automation - Enable debug only when needed (can affect performance)
🧠 Final Notes
The Asterisk CLI is live, powerful, and dangerous if misused. In Asterisk 22+, the command set is cleaner, more modular, and fully centered on PJSIP and modern VoIP workflows.




