Asterisk is an open-source communications platform used primarily as a PBX (Private Branch Exchange) system. It has a command-line interface (CLI) that allows administrators to interact with and configure the system. Here are the top 50 most frequently used Asterisk CLI commands, along with detailed explanations:
- core show help
Description: Displays a list of available commands. It’s useful to get information about any specific command or check what commands are available.
- core show version
Description: Shows the version of Asterisk currently running on the system.
- core show channels
Description: Displays a list of all the active channels currently in use on the system. This helps in monitoring calls and sessions in real time.
- core show channel [channel_name]
Description: Provides detailed information about a specific channel. You can use this to troubleshoot specific calls or sessions.
- core restart now
Description: Immediately restarts the Asterisk service. Useful when applying configuration changes that require a full restart.
- core stop now
Description: Immediately stops the Asterisk service without waiting for active calls to finish. Use with caution, as it will terminate all ongoing calls.
- sip show peers
Description: Lists all the SIP (Session Initiation Protocol) peers (clients or endpoints) registered on the system along with their status. This is essential for monitoring SIP devices.
- sip show peer [peer_name]
Description: Shows detailed information about a specific SIP peer, such as its IP address, status, and configuration details. This is helpful for diagnosing issues with a specific SIP client.
- sip show registry
Description: Displays a list of all external SIP registrations. It helps to see if Asterisk has successfully registered with a remote SIP provider.
- pjsip show endpoints
Description: Shows a list of all PJSIP endpoints and their statuses. PJSIP is an alternative SIP channel driver that replaces the older SIP channel.
- pjsip show endpoint [endpoint_name]
Description: Provides detailed information about a specific PJSIP endpoint, including its status, IP address, and other configuration details.
- dialplan show
Description: Displays the current dialplan loaded in Asterisk. The dialplan is the set of rules that determine how calls are routed within the system.
- dialplan reload
Description: Reloads the dialplan configuration without restarting Asterisk. This is useful after making changes to the extensions.conf file.
- module reload
Description: Reloads all modules that are currently loaded in Asterisk. This is useful when making changes to a specific module’s configuration without restarting Asterisk.
- module show
Description: Lists all loaded modules, showing the module name, description, and version. This is helpful for troubleshooting issues related to missing or misconfigured modules.
- logger reload
Description: Reloads the logging configuration. Use this after making changes to the logging configuration files to apply changes without restarting Asterisk.
- queue show
Description: Displays the status of call queues, including the number of callers waiting, agents available, and other related statistics. Useful in call center environments.
- core set verbose [level]
Description: Sets the verbosity level of the CLI output. Higher verbosity provides more detailed output, useful for debugging and monitoring purposes.
- core set debug [level]
Description: Adjusts the debugging level for Asterisk. Increasing the debug level will produce more detailed logs, which can help in diagnosing more complex issues.
- reload
Description: Reloads the configuration for all subsystems that support reload. This includes SIP, IAX, dialplans, and others, allowing you to apply changes without fully restarting Asterisk.
Bonus Commands:
- core show uptime: Shows how long Asterisk has been running since the last restart.
- sip reload: Reloads the SIP configuration files (sip.conf) without restarting Asterisk.
- pjsip reload: Reloads the PJSIP configuration (pjsip.conf).
- core show calls: Displays the total number of active calls.
- sip show channels
Description: Displays a list of all active SIP channels. It’s useful for monitoring ongoing SIP-based calls.
- sip show history
Description: Shows a history of SIP-related activities on the system, including registration attempts and call setups. This helps in troubleshooting SIP-related issues.
- sip set debug on
Description: Turns on SIP debugging, showing all SIP messages in real-time. This is invaluable for diagnosing SIP-related problems such as registration failures or call setup issues.
- sip set debug off
Description: Turns off SIP debugging when you no longer need it. This helps in reducing log noise after troubleshooting.
- pjsip set logger on
Description: Enables logging of PJSIP messages. This provides detailed information for debugging PJSIP-related issues, similar to sip set debug on.
- pjsip set logger off
Description: Disables PJSIP message logging once the necessary information is gathered for troubleshooting.
- core show settings
Description: Displays the current settings of Asterisk, such as system name, version, default language, and maximum calls. It’s useful for verifying the system configuration.
- features show
Description: Shows the currently available call features, such as call parking and call transfer, and their associated key sequences.
- manager show connected
Description: Lists all active Asterisk Manager Interface (AMI) connections. AMI is used by external programs to interact with Asterisk, and this command helps monitor those connections.
- manager show commands
Description: Displays all available AMI commands. Useful when integrating Asterisk with external management tools or developing custom applications.
- cdr show status
Description: Shows the status of the Call Detail Records (CDR) subsystem. CDR records contain detailed information about each call, and this command helps ensure that CDR logging is functioning correctly.
- cdr show active
Description: Displays active call detail records that are being created for ongoing calls. This is useful for real-time CDR monitoring.
- core show hints
Description: Displays the status of all device hints (used for BLF – Busy Lamp Field), showing which devices are in use, available, or busy.
- voicemail show users
Description: Lists all voicemail users configured in the system along with their associated mailbox numbers.
- voicemail reload
Description: Reloads the voicemail configuration (voicemail.conf). Use this after making changes to voicemail settings to apply them without restarting Asterisk.
- meetme list
Description: Lists all active MeetMe conference bridges and the participants in each conference. Useful for managing conference calls.
- meetme kick [confno] [user]
Description: Removes a specific user from a MeetMe conference room by specifying the conference number and user ID.
- iax2 show peers
Description: Displays a list of all IAX2 (Inter-Asterisk eXchange) peers along with their status. IAX2 is an alternative to SIP used primarily for trunking between Asterisk systems.
- iax2 show channels
Description: Lists all active IAX2 channels, showing current calls using the IAX2 protocol.
- iax2 show registry
Description: Shows IAX2 registration status with remote systems. Useful for monitoring external IAX2 trunk registrations.
- rtp set debug on
Description: Enables RTP (Real-Time Protocol) debugging, showing detailed information about RTP packets being sent and received. This is useful when diagnosing audio-related issues such as choppy or missing audio.
- rtp set debug off
Description: Disables RTP debugging to reduce log output once the necessary data has been gathered.
- core show applications
Description: Displays a list of all available dialplan applications, which can be used within the dialplan for various telephony features.
- core show application [app_name]
Description: Provides detailed information about a specific dialplan application, including its usage and options.
- parking show
Description: Displays the status of parked calls, showing which calls are on hold, where they are parked, and for how long. Useful in environments where call parking is frequently used.
- fax show sessions
Description: Shows active fax sessions when using Asterisk for faxing, including the status of incoming and outgoing faxes.
- fax show capabilities
Description: Displays the faxing capabilities of the system, useful when configuring or troubleshooting fax features.
- http show status
Description: Shows the status of the Asterisk HTTP server, which is used for serving things like Asterisk’s WebSocket, REST API, or web interfaces.
- core show file formats
Description: Displays a list of file formats supported by Asterisk, such as WAV, MP3, and GSM. Useful when dealing with audio file handling and recording.
- queue reload
Description: Reloads the queue configuration (queues.conf) to apply changes without restarting Asterisk. Call centers often use this to modify queue behavior dynamically.
These commands are essential for managing, configuring, and troubleshooting Asterisk PBX systems. Regular use of these CLI commands will help you efficiently monitor and resolve issues within your Asterisk system.
By expanding your command set, you’ll gain even greater control over the various aspects of Asterisk, such as protocol handling, logging, and call feature management. This extended list includes tools for managing SIP, PJSIP, IAX2, voicemail, conferencing, logging, and debugging across the system.