When one needs to debug an issue or gather additional info on various problems with PBXware, Asterisk' own CLI can come in handy. 

It prints out a lot of additional info not seen in PBXware's CLIR messages, for every call made on the system, a few more situations.


Entering CLI

Before you can see any of the messages in Asterisk CLI, you need to ssh to the system by using ssh command (if using Linux on your computer) or using putty or similar software if on PC/MAC. 

After that you can enter the Asterisk CLI via following command

asterisk -rvvvvv

Where Vs define verbosity level of the CLI.

Once inside you will see a lot of useful information print out for all actions on the system, Asterisk related though. You will see;


  • Phone calls

  • endpoint/aor registrations

  • Subscribe notifications

  • reload of system components



Entering CLI with additional debugging


If for some reason you have some inexplicable issues, like Asterisk not being able to start, you can try to run the CLI with different set of switches which should give some application specific debug info which includes start up sequence, database connection, registration retries, etc.


asterisk -rddddd


where number of Ds define the verbosity of these debug messages.



If above command tells you that asterisk is not running:




Try following command:


asterisk -cdddddd




Running commands outside of CLI


If you don't need to be inside CLI, or you need just to execute some command without concern of output from CLI, you can do so by running Asterisk command with following switches being used:


asterisk -rx ‘type your command’


For example:


asterisk -rx ‘pjsip show endpoints’


Above will list endpoints without going into CLI:





PJSIP Debugging


With PBXware versions 5 and 6 we introduced great tool for troubleshooting SNGREP: https://wiki.bicomsystems.com/Troubleshooting_HOWTO_Using_SNGREP


However, troubleshooting can be done inside of Asterisk CLI as well.


First important command to know is:


pjsip set logger on



Enable debugging for specific IP address:


pjsip set logger host XXX


Where XXX is an IP address for which you are enabling debugging:



Additional command that can be used is an ability to store pjsip logger output to PCAP file:


For example:


pjsip set logger pcap /tmp/test.pcap

Path to the output is: /opt/pbxware/pw/tmp.

In order to read a PCAP file, we can use tcpdump or SNGREP, or we can download it to our computer and use Wireshark!

With tcpdump: tcpdump -r /opt/pbxware/pw/tmp/test.pcap

With SNGREP: /opt/pbxware/sh/sngrep -I /tmp/test.pcap

When you finish debugging, you need to turn off debugging since leaving that running clutters the CLI output and you might miss other important information on the system.


To turn off PJSIP debugging run this command:


pjsip set logger off





Codec transcoding list


If for some reason you have audio problems, some of the messages might indicate codec incompatibilities on the system. In such cases you can see the possible translations paths in Asterisk with following command:


core show translation





List codecs on the system with command 

core show codecs





Reloading the complete Asterisk configuration


In cases, and not limited to, where you did manual modifications to Asterisk dialplan, you need to reload the complete configuration of the Asterisk subsystem which can be done by a simple command:


reload


This will reload all the configuration related to Asterisk telephony engine.



Restarting the Asterisk


If reloading of Asterisk is not enough for the changes made, or there is other reason to do so, you can restart complete Asterisk with:


restart now





Printing out the Dialplan


PBXware’s implementation of Asterisk engine, uses AGI to control how Asterisk should route the call, but for various reasons, you might be inclined to change few aspects of how the calls should route. 

By default, Asterisk uses Dialplan to route the calls to various other places. Dialplan information is located in several conf files (please check official Asterisk documents on this).


When you change the dialplan in extensions.conf file, for example, you will reload Asterisk configuration. After that you will want to show the dialplan to verify that your changes have been applied to it.


To list complete dialplan in Asterisk run:


diaplan show


Similar will appear:



To list specific dialplan that you wrote/changed run:


dialplan show “dialplan name”


for example:


dialplan show t-custom





List aors and endpoints



When checking extensions and/or availability of trunks, you can print aors/endpoints on the system:



pjsip show endpoints



pjsip show aors





Checking for one specific endpoint with command:


pjsip show endpoint XXX


Where XXX is an extension or trunk on the system:




pjsip show aor XXX