< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] Accessing specific values in an "sdp" record.


Hi,

Lets say I have the following SDP record.....

v=0
o=- 0 0 IN IP4 80.227.140.70
s=WhitePhone Mac
c=IN IP4 80.227.140.70
b=CT:1000
t=0 0
m=audio 47801 RTP/AVP 3 101
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

I need to be able to pull out various things... first, I need the Payload type.
I suspect that would be the "3" in the "m=audio" line in the above record.

Another thing I need is the IP and port.   I would get the port from the
2nd argument of the "m=" or it would be 47801.  The IP address I would
get from the "c="...

So,  I have a "msg" as my SipMessage.

SdpContents *sdp = (SdpContents *)msg.getContents();

This would then get me the "sdp" record, or a pointer to a "SdpContents" class.

I've never run into a C++ situation where one class has other classes embedded
in it....   so Would I get the IP address like this?

Data RemoteIP = sdp->Session.Connection.getAddress();

Obviously, this doesn't compile.   So how do I get my RemoteIP from the
sdp pointer?
Same for port and Payload type....

I was able to get this to compile,  not sure of this is right...

int port = dp->session().media().front().port();

So, does this mean there can be more then one "m=" in an sdp record? Apparently the media() method returns a list, I'm not sure what this
is a list of.   Does it imply more then one port?  or does it imply more
then one "m=" line,  which I know I only have one of.

Thanx
John