In this post,I am trying to put some handy commands which can be useful if you are working on asterisk .Assuming pjsip is the channel driver for the asterisk. Here are some of the useful commands:

Command: asterisk -r

Usage: This command is use to enter into cli mode for asterisk where you can issue various commands .

CLI>pjsip set logger <on/off>

This command is used to enable/disable the pjsip logger.

CLI> pjsip set debug on

Usage: This command is use to enable the debug functionality of pjsip .

CLI> core set debug <debug_level>

Usage: This command is use to set debug level . It can be anything between 1-10. More the debug level More the logs

CLI> sip set debug on

Usage: This command is use to enable the sip debug logging.

CLI> rtp set debug on

Usage: This command is use to enable the rtp logging.

CLI> pjsip show registrations

Usage: This command shows all outbound registrations.

CLI>dialplan reload

Usage: This command used to reload the Dialplan when any changes are done in the dialplan.

CLI>pjsip set history <on/off/clear>

Usage: This enables/disables SIP historycapturing, as well as clears an existing history capture. Note that SIP packets captured are stored in memory until cleared. As a result, the history capture should only be used for debugging/viewing purposes, and should NOT be left permanently enabled on a system.

CLI>pjsip show history

Usage: It displays the captured SIP history. When invoked with no options, the entire captured history is displayed.

CLI>dialplan show

Usage:This command will show all the dialplans in the system.

Command: systemctl start/stop asterisk

Usage:To start or stop the asterisk .

CLI>core stop now

Usage:This command stops the Asterisk service immediately, ending any calls in progress.

CLI>core restart now

Usage:This command restarts the Asterisk service immediately, ending any calls in progress.

Hope this commands will be useful. Also if you don’t want to go into cli mode and hit the commands , then use “asterisk -rx” with commands.For example on CLI for reloading the dialplan, we use “dial plan reload”. If the same command needs to be hit on the prompt just use this:

asterisk -rx ‘dialplan reload’

References:https://wiki.asterisk.org/wiki/display/AST/Home

If you have any feedback/suggestion. Please leave a comment.