It is a common problem that people starting out with Asterisk PBX find it difficult to diagnose where problems arise. Here is a quick blog that may help someone in that situation.
To debug asterisk you need to get hold of the asterisk messages and any other log info you can. This isn't always so simple if you have a busy system as so many records are created.
If you have a lot of calls its important to be very quick when you place a test call and capture output so you won't have multiple calls in the same capture.
Log into your asterisk server via ssh.
Usually I then type :
asterisk -rx "sip set debug on"
asterisk -rcvvvvvvvvvvvvvvvvvvvvv> /usr/local/admin/htdocs/debug.txt
(note 1: you can use asterisk -rx "sip set debug on IP" if you know a particular IP, or use PEER. Type help from the command line for options)
(note 2: replace /usr/local/admin/htdocs/debug.txt with some path on your server. If the path is to htdocs then you can easily download the capture using a browser)
And after that I call the number that I want to test and then I hangup when the call goes through. Then I quickly stop the asterisk capture with CTRL+C.
After that I verify the Asterisk capture. I just download it and view in a text editor.
In this situation I only verified the Asterisk log but in another situation I might have to check the SIP packets. To do that I use tcdump.
If tcpdump is not installed you can run 'yum install tcpdump' on a linux system to install.
I then run something like
'tcpdump -p udp -s 4096 -w /usr/local/admin/htdocs/capture.pcap'
to capture all traffic.
or, 'tcpdump -w /usr/local/admin/htdocs/capture.pcap -s 0 host sip.avoipcarrier.net' to get a dump for just one host.
After I place a call from an extension to an specific number I stop the capture with CTRL+C and I download the capture to my computer.
Then using a tool like Wireshark (you can find that on the internet since its a free tool) I verify the call flows and view the SIP messages.
I guess this is a basic howto on how to debug basic things. if you want to learn more check some articles regarding basic call flows and how SIP handles basic transactions.
Also check some tutorials about Wireshark (source/destination port/address, how to debug rtp, sip messages, filters, jitter...).
I hope this helps.
Virtual Phone Numbers
Keep Up with TechRepublic