-1

I'm student and i'm working on a project on VOIP to capture communication VOIP and then to convert itinto audio format. I'm using with C programming language

I am able to capture network traffic and filter RTP packets with winpcap library. But i don't know how to create audio file with it.

  • Please provide us with the relevant part of your current code. – sjaustirni Nov 12 '17 at 14:12
  • Not all VoIP protocols use RTP. Some use proprietary protocols. Even those that use RTP may use proprietary protocols or encryption. You need to first determine what protocols are in use. – Ron Maupin Nov 13 '17 at 02:37

2 Answers2

0

For analysis, use wireshark to capture, and export the RTP stream: see

https://wiki.wireshark.org/RTP

and/or

https://www.wireshark.org/docs/wsug_html_chunked/ChTelRTPAnalysis.html

to extract RTP packets from C, you may do it manually with reimplementing following the RFC (https://www.rfc-editor.org/rfc/rfc3550) or use third party lib like gstreamer (https://gstreamer.freedesktop.org/documentation/rtp.html)

Community
  • 1
  • 1
OznOg
  • 4,440
  • 2
  • 26
  • 35
0

Full algorithm is following

  • Use winpcap to get raw packets
  • Detect codec used to encode audio:
    • In VOIP codec negotiation is performed by separate control protocol like Session Initiation Protocol (SIP) and Session Description Protocol ( SDP)
    • For some codecs you may guess codec type by payload ID they are defined in RTP A/V Profile
    • As wireshark says ;)
  • Decode packets one by from pcap file. You need decode:
    • Link-layer headers (Ethernet or VLAN etc)
    • IP header
    • UDP header
    • RTP header
  • Extract RTP flows. This can be done by:
    • Source IP address/Port
    • Destination IP address/Port
    • SSRC field of RTP packet
  • Extract payload of the one RTP flow and decode it with codec
  • Save decoded data as WAV file

Each of this bullet point is pretty tricky task if you need production code but all they have quick and dirty solutions that will work for you.

Community
  • 1
  • 1
Dmitry Poroh
  • 3,705
  • 20
  • 34