How to Enable Asterisk/FreePBX SIP Packet Debuging

Asterisk and FreePBX is an Open Source PBX which can be installed on Linux, and is commonly used to provide PBX services via VoIP (Voice Over IP).

Sometimes you may need to dig a little deeper into the raw TCP or UDP SIP messages and packets to understand where an issue may be coming from, either within Asterisk or from an upstream carrier or extension.

Within this guide we will show you how to enable and make use of the debugging modes built into Asterisk, these can be used to capture the RAW SIP messages, and display to screen or log to a file on the server.

Debug the RAW Asterisk SIP Packets

Firstly asterisk has a CLI client which can be used to manage the system, from a terminal or SSH window simply type “asterisks” which the “r” argument to enter this console.

asterisk -r

You should now be presented with a Asterisk console session – So next within this window we will enable the SIP debug, however it’s a good idea to enable it for a specific SIP peer that your having problems with, to limit the number of messages you capture for both performance and readability reasons.

sip set debug on
sip set debug peer {name}

Once the above commands are entered the debugging should be enabled, so now you simply need to reproduce the issue, and then remove the debugging.

Removing the debugging is fairly simple, and just the reverse of enabling it.

sip set debug off

You should find the logs immediately printed to the console screen, however depending on your Asterisk or FreePBX configuration, you may also find a copy of these stored within the following file, which can be monitored using the bellow command.

tail -f /var/log/asterisk/full

Show current SIP registration status

When Asterisk or FreePBX is used as an office PBX, you will typically have a number of SIP Handsets, Softphones or Extensions which are attached to the PBX, they do this by performing a SIP REGISTER towards the PBX, and if successful they will maintain an entry in the registry table of the PBX.

It can be useful to see this registration status, and using the same asterisk console as opened previously you can simply display all registrations using the below command.

sip show registry

Reload SIP configuration, and Re-register Clients

If you have been making /etc/asterisk/sip.conf changes on the fly you will probably want to reload the file and reset your registrations, the following command will accomplish that РAs the name would suggest this will drop all your registrations, so will be service affecting.

sip reload

Technology enthusiastic with many ongoing online projects one of which is this personal blog PingBin. While also working full time within a data center designing and maintaining the network infrastructure.

1 comments On How to Enable Asterisk/FreePBX SIP Packet Debuging

  • Hmm, what about the noisy SIP protocol?

    How do I only show sip messages initiated by my host vice versa?
    How do I filter out OPTIONS messages etc.?
    How do I suppress the codec information which bloat the whole screen?

Leave a Reply to you Cancel Reply

Your email address will not be published.