How to receive Asterisk packets from 5038


I am using Asterisk-1.4. I have configured manager.conf file and connection with the AMI is successfull using username and password. I want to monitor fetch SIP packets from TCP port. Please let me know how to take SIP data from tcp port



tcpdump -ieth0 |grep 5060

is the simplest method :smile:

I need SIP packets from Asterisk.How to use this method.I am not clear ,plz elaborate.

Our scenario:

We are developing CTI applications where we need SIP data from PBX such as SourceIP,Username,Destination IP,TAG,VIA,Contact,CALL-ID,C-Sequence etc for each of the SIP packets such as REGISTER,BYE,INVITE,ACK,SUBSCRIBE,NOTIFY etc.

e.g Wrieshark displays SIP packets for activities going on SIP port in the below mentioned format:

SIP Packet as displayed on wireshark*************

SIP/2.0 200 OK
Via: SIP/2.0/UDP;branch=z9hG4bK10e203f8;rport=5060
Contact: sip:1000000@
To: sip:1000@;tag=1f0f342c
From: "Unknown"sip:Unknown@;tag=as4a585648
Call-ID: 38670a55c46d1235YzY2YWQxZTM0ODk4NTRhZDI5MjY3YjMyYjE4OTlhZjc.
CSeq: 102 NOTIFY
User-Agent: X-Lite release 1003l stamp 30942
Content-Length: 0

After receiving these SIP Packets from Asterisk,we can parse that data according to our requirements.
Is there any text/data file or database where asterisk stores all the information in above format?
If we need to fetch this data at realtime from the port than how can we do that?


you could front end your asterisk system with a flavor of OpenSER (Kamailio or OpenSIPs). Both of them have very robust database integration which would allow you to log all signaling to the database using the sip_trace module.

thanks for the info.
Kamailio may be useful for our applications.I am trying to configure it with asterisk but getting error in its “dbase.c” module while installation.I can’t find any help regarding this on internet.Can you plz help?


I would highly suggest joining the Kamailio ‘users’ list. The primary engineer is always monitoring the list. Someone always responds within 30 minutes. Just make sure you use common troubleshooting guidelines when posting.

Include your config file, and the error message.