TIPS SIP and log file debugging

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
There are a lot of head-scratcher problems that come up when operating PIAF (or, more generically, Asterisk + FreePBX) and a number of roundabout ways of solving them. If you know me and my participation in this forum, the request I am always making is to turn on SIP debugging and post logs. Even though it seems like a hassle to deal with this kind of debugging, I have found that it is much more likely to bring me to a correct understanding of the problem and quicker solution than hacking around with trial and error.

I thought it would be useful to start a thread on the subject where we can share knowledge, so that the log files and protocol-level debug output aren't so intimidating.

Q&A format is welcome or just post your tips/tricks/wisdom.
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
Yes, that would be a good start.

You can enable SIP debugging overall or limit it to specific "peers" (trunks, extensions) or IP addresses. If you know you have a problem with one device or trunk, limiting the debug output will save a lot of reading and filtering later. On the other hand, if you are getting nuisance SIP traffic, for example, and don't know where it's from, it's best to capture everything.

From SSH or a console window, as root: asterisk -r

*CLI> sip set debug

and then press tab. Now you can see what your options are. If you finish the command with "on" then you are capturing all SIP traffic.

If you want to capture SIP traffic on a trunk, continue with "peer" and then tab. (The CLI now shows *CLI> sip set debug peer and a list of SIP devices and trunk names.) Now you can finish out the debug by typing the name of the trunk or device you want to watch. In my case, a SIP extension numbered 1100 showed up, so I could debug that extension with *CLI> sip set debug peer 1100

Same idea for capturing by IP address.

Once debugging is enabled, the SIP debug logs are inserted into /var/log/asterisk/full along with standard dialplan output. This may seem really cluttered but it's good because it shows you the actual timing of SIP packets and resulting dialplan actions.

With the SIP debugs enabled, wait for or cause the problem you want to debug and then, back on the CLI,

*CLI> sip set debug off

The SIP debug will generate a lot of log file information so it's best not to leave debugging enabled longer than necessary.

SIP is an easy protocol to read because it is plain-text. Often the SIP debugs will have information that Asterisk logs will not, including the actual IP address a packet came from (looks like <--- SIP read from UDP:10.20.30.40:5060 ---> before a SIP packet). The SIP debugs will also quickly reveal NAT problems, codec mismatches, and other things that are hard to see from standard logs or the web interface.
 

Members online

No members online now.

Forum statistics

Threads
25,802
Messages
167,720
Members
19,232
Latest member
voiplads
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top