packet-sniffer can't sniff SIP(voip) packet
<p>I want to build "SIP sniffer" for my project to alert incoming call from VoIP communication.I try to call from my smartphone to my notebook and check incoming packet by wireshark. I see all SIP-message ( INVITE , BYE , TRYING ). I know basic of SIP ,it use UDP port 5060.</p>

<p>Next, I use this code from <a href="http://www.binarytides.com/python-packet-sniffer-code-linux/" rel="nofollow">http://www.binarytides.com/python-packet-sniffer-code-linux/</a> &lt;&lt;--- last code , longest code ( I try to paste but I can't paste code in box ) run with Raspberry PI connect to notebook by LAN cable.</p>

<p>This program can sniff UDP packet, I check in wireshark it correct 90% ( IP address and IP destination not correct ) port and payload are correct.  I checking header from ethernet header ===> ip header ===> udp header
it not different from SIP-INVITE , they different only payload  ( check by wireshark ).</p>

<p>but i try to VoIP call to my notebook, It's not work , it never sniff 5060 or SIP packet ( one time i see outgoing call data : "sip:xxxx@linphone.org" )</p>

<p>Why i can sniff other but VoIP can't.</p>

<p>Sorry for my poor english.
thank you for your advice.</p>

<pre><code>#UDP packets
    elif protocol == 17 :
        u = iph_length + eth_length
        udph_length = 8
        udp_header = packet[u:u+8]

        #now unpack them :)
        udph = unpack('!HHHH' , udp_header)

        source_port = udph[0]
        dest_port = udph[1]
        length = udph[2]
        checksum = udph[3]

        print 'Source Port : ' + str(source_port) + ' Dest Port : ' + str(dest_port) + ' Length : ' + str(length) + ' Checksum : ' + str(checksum)

        h_size = eth_length + iph_length + udph_length
        data_size = len(packet) - h_size

        #get data from the packet
        data = packet[h_size:]

        print 'Data : ' + data

    #some other IP packet like IGMP
    else :
        print 'Protocol other than TCP/UDP/ICMP'

    print
</code></pre>

python linux sockets udp packet-sniffers