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:

 

  1. 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.

  1. core show version

Description: Shows the version of Asterisk currently running on the system.

  1. 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.

  1. core show channel [channel_name]

Description: Provides detailed information about a specific channel. You can use this to troubleshoot specific calls or sessions.

  1. core restart now

Description: Immediately restarts the Asterisk service. Useful when applying configuration changes that require a full restart.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. pjsip show endpoint [endpoint_name]

Description: Provides detailed information about a specific PJSIP endpoint, including its status, IP address, and other configuration details.

  1. 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.

  1. dialplan reload

Description: Reloads the dialplan configuration without restarting Asterisk. This is useful after making changes to the extensions.conf file.

  1. 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.

  1. 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.

  1. logger reload

Description: Reloads the logging configuration. Use this after making changes to the logging configuration files to apply changes without restarting Asterisk.

  1. 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.

  1. 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.

  1. 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.

  1. 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.
  1. sip show channels

Description: Displays a list of all active SIP channels. It’s useful for monitoring ongoing SIP-based calls.

  1. 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.

  1. 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.

  1. sip set debug off

Description: Turns off SIP debugging when you no longer need it. This helps in reducing log noise after troubleshooting.

  1. 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.

  1. pjsip set logger off

Description: Disables PJSIP message logging once the necessary information is gathered for troubleshooting.

  1. 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.

  1. features show

Description: Shows the currently available call features, such as call parking and call transfer, and their associated key sequences.

  1. 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.

  1. manager show commands

Description: Displays all available AMI commands. Useful when integrating Asterisk with external management tools or developing custom applications.

  1. 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.

  1. cdr show active

Description: Displays active call detail records that are being created for ongoing calls. This is useful for real-time CDR monitoring.

  1. 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.

  1. voicemail show users

Description: Lists all voicemail users configured in the system along with their associated mailbox numbers.

  1. voicemail reload

Description: Reloads the voicemail configuration (voicemail.conf). Use this after making changes to voicemail settings to apply them without restarting Asterisk.

  1. meetme list

Description: Lists all active MeetMe conference bridges and the participants in each conference. Useful for managing conference calls.

  1. meetme kick [confno] [user]

Description: Removes a specific user from a MeetMe conference room by specifying the conference number and user ID.

  1. 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.

  1. iax2 show channels

Description: Lists all active IAX2 channels, showing current calls using the IAX2 protocol.

  1. iax2 show registry

Description: Shows IAX2 registration status with remote systems. Useful for monitoring external IAX2 trunk registrations.

  1. 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.

  1. rtp set debug off

Description: Disables RTP debugging to reduce log output once the necessary data has been gathered.

  1. core show applications

Description: Displays a list of all available dialplan applications, which can be used within the dialplan for various telephony features.

  1. core show application [app_name]

Description: Provides detailed information about a specific dialplan application, including its usage and options.

  1. 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.

  1. fax show sessions

Description: Shows active fax sessions when using Asterisk for faxing, including the status of incoming and outgoing faxes.

  1. fax show capabilities

Description: Displays the faxing capabilities of the system, useful when configuring or troubleshooting fax features.

  1. 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.

  1. 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.

  1. 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.