Create an SDP message by using MCC SDP functions to output SDP field values. To create an SDP message, perform these tasks:
Task |
Action |
1 |
|
2 |
|
3 |
Use the mccdSdpGetLength function to get the length of the generated SDP contents. |
To add session-level information to an SDP message, follow these steps:
Step |
Action |
Associated function |
Associated SDP field |
1 |
Initialize the SDP context. |
N/A |
|
2 |
Add a session description field. |
or |
v, o, s |
3 |
Optionally, add an information field that applies to all media formats in the SDP message. |
i |
|
4 |
Optionally, add a session connection field that applies to all media formats in the SDP message. If you do not add a session connection field here, you must add one for each media type. For information, see Adding media descriptions to the SDP message. |
or |
c |
5 |
Optionally, add one or more general attributes that apply to all media formats in the session. Call mccdSdpAddAttribute for each session-level general attribute you want to add. |
a |
|
6 |
Optionally, add one or more rtpmap attributes that apply to all media formats in the session. Call mccdSdpAddRtpmap for each session-level rtpmap attribute you want to add. |
a |
Note: There are no MCC SDP functions available for creating SDP session-level u, e, p, b, t, and k fields.
To add one or more media descriptions to the SDP message, follow these steps:
Step |
Action |
Associated function |
Associated SDP field |
1 |
Begin a media description field. |
m |
|
2 |
Add one or more media formats to the media description field. Call mccdSdpAddMediaFormat for each media type you want to add. |
m |
|
3 |
Close the media description field. |
m |
|
4 |
Optionally, add an information field that describes the media. |
i |
|
5 |
Optionally, add a connection field for each specified media format. If you did not specify a session-level connection field, then this step is mandatory. Call mccdSdpAddConnIP4 or mccdSdpAddConnIP6 for each media-level connection field you want to add. |
or |
c |
Optionally, add one or more general attributes for each specified media format. Call mccdSdpAddAttribute for each media-level general attribute you want to add. |
a |
||
7 |
Optionally, add one or more rtpmap attributes for each specified media format. Call mccdSdpAddRtpmap for each media-level rtpmap attribute you want to add. |
a |
Note: There are no MCC SDP functions available for creating SDP media-level b and k fields.
The following example creates an SDP message formatted for RTP/AVP and then obtains the length of the generated message:
MCC_SDP_CONTEXT_W context, *pc = &context;
MCC_SDP * sdp;
uint32_t error;
char sdpData[1024]; /* Buffer to write SDP to */
char buffer[1024]; /* Buffer to create MCC_SDP structure in */
/* Write SDP into sdpData */
mccdSdpInit ( pc, sdpData, sizeof(sdpData) );
mccdSdpAddSessionIP4 ( pc, "user", 123, 124, "127.0.0.1" );
mccdSdpAddConnIP4 ( pc, "192.168.0.1" );
mccdSdpAddMediaBegin ( pc, MCCSDP_MEDIA_AUDIO, 8000, 0, "RTP/AVP" );
mccdSdpAddMediaFormat ( pc, "0" );
mccdSdpAddMediaFormat ( pc, "8" );
mccdSdpAddMediaEnd ( pc );
mccdSdpAddInformation ( pc, "My audio stream" );
mccdSdpAddRtpmap ( pc, "0", "PCMU", 8000, 0 );
mccdSdpAddRtpmap ( pc, "8", "PCMA", 8000, 0 );
/* Print generated SDP /
printf ( " Generated SDP message: \n" );
printf (%.*s, mccdSdpGetLength(pc), sdpData );