0

I'm trying to obtain the port of the audio media of SDP headers. I am currently using JnetPcap to catch traffic.

I am obtaining the Media value from the SDP headers like so:

sdp.getAVP(Sdp.Fields.Media.name());    

(I know this is not the prettiest way, I have already asked for better alternatives here.)

This does the job. Except for voice calls. When a call has video enabled the SDP header contains 2 Media values, audio and video. The problem is that the getAVP() method always only returns the video value.

How do I obtain the audio port?

Community
  • 1
  • 1
user2818782
  • 736
  • 8
  • 18

1 Answers1

0

Depending on what you want to achieve:

  • Capture the traffic with Wireshark and look at the c lines and m lines manually
  • Take the captured sdp object and do .ToString() and parse it yourself, line by line looking for m= and c=
  • Take the sdp and parse it with JAIN SDP

The structure of the SDP is defined by RFC 4566: https://www.rfc-editor.org/rfc/rfc4566 see chapter "5.14. Media Descriptions ("m=")"

Community
  • 1
  • 1
Staffan Persson
  • 151
  • 1
  • 5
  • That's kinda pointing to what I did. I used sdp.text() to get the enter header, then using regex a stripped the audio port out. – user2818782 Apr 18 '16 at 06:46