|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.protocol.sip.sdp.SdpUtils
public class SdpUtils
The class contains a number of utility methods that are meant to facilitate creating and parsing SDP descriptions.
| Field Summary | |
|---|---|
static String |
ZRTP_HASH_ATTR
The name of the SDP attribute that defines zrtp hello hash. |
| Constructor Summary | |
|---|---|
SdpUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
containsAttribute(javax.sdp.MediaDescription description,
String attributeName)
Returns the media type (e.g. |
static javax.sdp.Attribute |
createAttribute(String name,
String value)
Creates an Attribute object with the specified values. |
static javax.sdp.MediaDescription |
createDisablingAnswer(javax.sdp.MediaDescription offer)
Creates and returns a MediaDescription in answer of the specified offer that disables the corresponding stream by setting a 0 port and keeping the original list of formats and eliminating all attributes. |
static javax.sdp.MediaDescription |
createMediaDescription(String transport,
List<MediaFormat> formats,
StreamConnector connector,
MediaDirection direction,
List<RTPExtension> rtpExtensions,
DynamicPayloadTypeRegistry dynamicPayloadTypes,
DynamicRTPExtensionsRegistry rtpExtensionsRegistry)
Creates a new MediaDescription instance according to the specified formats, connector and direction, and using the dynamicPayloadTypes registry to handle dynamic payload type registrations. |
static javax.sdp.SessionDescription |
createSessionDescription(InetAddress localAddress)
Creates an empty instance of a SessionDescription with preinitialized s, v, c, o and t parameters. |
static javax.sdp.SessionDescription |
createSessionDescription(InetAddress localAddress,
String userName,
Vector<javax.sdp.MediaDescription> mediaDescriptions)
Creates an empty instance of a SessionDescription with preinitialized s, v, c, o and t parameters. |
static javax.sdp.SessionDescription |
createSessionUpdateDescription(javax.sdp.SessionDescription descToUpdate,
InetAddress newConnectionAddress,
Vector<javax.sdp.MediaDescription> newMediaDescriptions)
Creates and returns a new SessionDescription that is supposed to update our previous descToUpdate and advertise the brand new newMediaDescriptions. |
static MediaStreamTarget |
extractDefaultTarget(javax.sdp.MediaDescription mediaDesc,
javax.sdp.SessionDescription sessDesc)
Returns a MediaStreamTarget instance reflecting the address pair (RTP + RTCP) where we should send media in this stream. |
static List<MediaFormat> |
extractFormats(javax.sdp.MediaDescription mediaDesc,
DynamicPayloadTypeRegistry ptRegistry)
Extracts and returns the list of MediaFormats advertised in mediaDesc preserving their oder and registering dynamic payload type numbers in the specified ptRegistry. |
static Vector<javax.sdp.MediaDescription> |
extractMediaDescriptions(javax.sdp.SessionDescription sessionDescription)
Extracts and returns all MediaDescriptions provided in sessionDescription. |
static List<RTPExtension> |
extractRTPExtensions(javax.sdp.MediaDescription mediaDesc,
DynamicRTPExtensionsRegistry extMap)
Extracts and returns the list of RTPExtensions advertised in mediaDesc and registers newly encountered ones into the specified extMap. |
static URL |
getCallInfoURL(javax.sdp.SessionDescription sessDesc)
Returns a URL pointing to a location with more details (and possibly call control utilities) about the session. |
static String |
getContentAsString(javax.sip.message.Message message)
Gets the content of the specified SIP Message in the form of a String value. |
static MediaDirection |
getDirection(javax.sdp.MediaDescription mediaDesc)
Determines the direction of the media stream that mediaDesc describes and returns the corresponding MediaDirection enum entry. |
static MediaType |
getMediaType(javax.sdp.MediaDescription description)
Returns the media type (e.g. |
static javax.sdp.SessionDescription |
parseSdpString(String sdp)
Parses the specified sdp String into a SessionDescription and returns it; |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ZRTP_HASH_ATTR
| Constructor Detail |
|---|
public SdpUtils()
| Method Detail |
|---|
public static javax.sdp.SessionDescription parseSdpString(String sdp)
throws IllegalArgumentException
sdp - the sdp String that we'd like to parse.
IllegalArgumentException - in case sdp is not a valid
SDP String.
public static javax.sdp.Attribute createAttribute(String name,
String value)
name - the name of the attributevalue - the value of the attribute
public static javax.sdp.SessionDescription createSessionDescription(InetAddress localAddress)
throws OperationFailedException
localAddress - the InetAddress corresponding to the local
address that we'd like to use when talking to the remote party.
OperationFailedException - if the SDP creation failed
public static javax.sdp.SessionDescription createSessionDescription(InetAddress localAddress,
String userName,
Vector<javax.sdp.MediaDescription> mediaDescriptions)
throws OperationFailedException
localAddress - the InetAddress corresponding to the local
address that we'd like to use when talking to the remote party.userName - the user name to use in the origin parameter or
null in case we'd like to use a default.mediaDescriptions - a Vector containing the list of
MediaDescriptions that we'd like to advertise (leave
null if you'd like to add these later).
OperationFailedException - if the SDP creation failed
public static javax.sdp.SessionDescription createSessionUpdateDescription(javax.sdp.SessionDescription descToUpdate,
InetAddress newConnectionAddress,
Vector<javax.sdp.MediaDescription> newMediaDescriptions)
throws OperationFailedException
descToUpdate - the SessionDescription that we'd like to
update.newConnectionAddress - the InetAddress that we'd like to
use in the new c= field.newMediaDescriptions - the descriptions of the new streams that we'd
like to have in the updated session.
OperationFailedException - if the SDP creation failed
public static List<MediaFormat> extractFormats(javax.sdp.MediaDescription mediaDesc,
DynamicPayloadTypeRegistry ptRegistry)
mediaDesc - the MediaDescription that we'd like to probe
for a list of MediaFormatsptRegistry - a reference to the DynamycPayloadTypeRegistry
where we should be registering newly added payload type number to format
mappings.
public static List<RTPExtension> extractRTPExtensions(javax.sdp.MediaDescription mediaDesc,
DynamicRTPExtensionsRegistry extMap)
mediaDesc - the MediaDescription that we'd like to probe
for a list of RTPExtensionsextMap - a reference to the DynamycRTPExtensionsRegistry
where we should be registering newly added extension mappings.
public static MediaStreamTarget extractDefaultTarget(javax.sdp.MediaDescription mediaDesc,
javax.sdp.SessionDescription sessDesc)
throws IllegalArgumentException
mediaDesc - the media description that we'd like to extract our
RTP and RTCP destination addresses.sessDesc - the session description that we received
mediaDesc in.
IllegalArgumentException - in case we couldn't find connection
data or stumble upon other problems while analyzing the SDP.public static MediaDirection getDirection(javax.sdp.MediaDescription mediaDesc)
mediaDesc - the description of the media stream whose direction
we are trying to determine.
public static URL getCallInfoURL(javax.sdp.SessionDescription sessDesc)
sessDesc - the session description that we'd like to extract an
URL form.
public static javax.sdp.MediaDescription createMediaDescription(String transport,
List<MediaFormat> formats,
StreamConnector connector,
MediaDirection direction,
List<RTPExtension> rtpExtensions,
DynamicPayloadTypeRegistry dynamicPayloadTypes,
DynamicRTPExtensionsRegistry rtpExtensionsRegistry)
throws OperationFailedException
transport - the profile name (RTP/SAVP or RTP/AVP)formats - the list of formats that should be advertised in the newly
created MediaDescription.connector - the socket couple that will be used for the media stream
which we are advertising with the media description created here.direction - the direction of the media stream that we are describing
here.rtpExtensions - a list of RTPExtensions supported by the
MediaDevice that we will be advertising.dynamicPayloadTypes - a reference to the
DynamicPayloadTypeRegistry that we should be using to lookup
and register dynamic RTP mappings.rtpExtensionsRegistry - a reference to the
DynamicRTPExtensionRegistry that we should be using to lookup
and register URN to ID mappings.
OperationFailedException - in case we fail to get payload type
numbers for dynamic payload types or in case our SDP generation fails for
some other reason.
public static MediaType getMediaType(javax.sdp.MediaDescription description)
throws IllegalArgumentException
description - the MediaDescription whose media type we'd
like to extract.
IllegalArgumentException - if description does not
contain a known media type.
public static boolean containsAttribute(javax.sdp.MediaDescription description,
String attributeName)
throws IllegalArgumentException
description - the MediaDescription whose media type we'd
like to extract.attributeName - name of the attribute to check
IllegalArgumentException - if description does not
contain a known media type.
public static javax.sdp.MediaDescription createDisablingAnswer(javax.sdp.MediaDescription offer)
throws IllegalArgumentException
offer - the MediaDescription of the stream that we'd like
to disable.
IllegalArgumentException - if the offer argument is so
in-parsable that there was no way we could create a meaningful answer.
public static Vector<javax.sdp.MediaDescription> extractMediaDescriptions(javax.sdp.SessionDescription sessionDescription)
throws IllegalArgumentException
sessionDescription - the SessionDescription that we'd like
to extract MediaDescriptions from.
IllegalArgumentException - in case there were no media descriptions
in sessionDescription.public static String getContentAsString(javax.sip.message.Message message)
message - the SIP Message to get the content of
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||