public class SIPUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APP_SDP_VALUE
SDP Media type value.
|
static ContentType |
APPLICATION_SDP_MIME_TYPE |
static java.lang.String |
EVENT_HEADER_NAME
Deprecated.
|
static java.lang.String |
INITIAL_QOS_REMOTE |
static ContentType |
MULTIPART_MIXED_MIME_TYPE |
static java.lang.String |
MULTIPART_MIXED_VALUE
multipart mixed
|
static java.lang.String |
MULTIPART_VALUE
multipart
|
static java.lang.String |
RELIABLE_PROVISIONAL_VALUE
Reliable provisional response option tag value.
|
static java.lang.String |
TERMINATING_DOMAIN_HEADER_NAME
SIP OC-Terminating-Domain Header name.
|
static ContentType |
TEXT_PLAIN_MIME_TYPE |
Constructor and Description |
---|
SIPUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addAllowEventsValues(java.lang.String[] values,
SipMessage sipMessage,
SipFactory sipFactory,
javax.slee.facilities.Tracer tracer)
Make sure SIP message contains Allow-events header with specified values
|
static void |
addMessageContent(SipMessage message,
MessageBody messageBody,
boolean replace,
javax.slee.facilities.Tracer tracer)
Sets content in the body of a SIP message.
|
static void |
copySDPSessionVersion(OutgoingSipRequest outgoingInvite,
SessionDescriptionWrapper latestReceivedSDP,
javax.slee.facilities.Tracer tracer)
Copies the SDP session version from the latest received SDP into the outgoing
INVITE's SDP.
|
static java.util.List<MessageBody> |
getMessageContent(SipMessage message,
ContentType contentType,
javax.slee.facilities.Tracer tracer)
Retrieves message content from a SIP message as a MessageBody.
|
static byte[] |
getSDPBody(SipMessage message)
Deprecated.
use getSDPMessageBody() instead
|
static MessageBody |
getSDPMessageBody(SipMessage message,
javax.slee.facilities.Tracer tracer)
Gets the first SDP body in a message; if the message has Content-Type "application/sdp",
or a multipart body with an "application/sdp" part.
|
static java.lang.String |
getSDPString(SipMessage sipMessage) |
static SubscribedEventID |
getSubscribedEventID(SipMessage message)
Return a subscribed event ID, if present in the message.
|
static boolean |
isInitialSipRequest(SipRequest request)
Returns true if the SipRequest is an initial request.
|
static java.lang.String |
makeSIPAddress(java.lang.String user,
boolean isSipUri,
java.lang.String sipDomain)
It creates a string for the SIP Address user to be used in the SIP Requests.
|
static void |
removeMessageContent(SipMessage message,
ContentType contentType,
javax.slee.facilities.Tracer tracer)
Removes content with the given content type from a SIP message, or any and all content if no content type is provided.
|
static void |
removeSipMessageBody(SipMessage message)
Removes the message body from a SIP message.
|
static java.lang.String |
removeTagsFromURI(java.lang.String uri)
Removes any parameters from the URI String
|
static void |
setSDPBody(SipMessage message,
java.lang.String sdp,
javax.slee.facilities.Tracer tracer)
Sets SDP content in a message.
|
static void |
updateSDPPreconditions(OutgoingSipRequest outgoingInvite,
SessionDescriptionWrapper latestReceivedSDP,
javax.slee.facilities.Tracer tracer)
Sets SDP qos attributes of an outgoing INVITE based on a provided SDP.
|
@Deprecated public static final java.lang.String EVENT_HEADER_NAME
public static final java.lang.String TERMINATING_DOMAIN_HEADER_NAME
public static final java.lang.String APP_SDP_VALUE
public static final java.lang.String MULTIPART_VALUE
public static final java.lang.String MULTIPART_MIXED_VALUE
public static final java.lang.String INITIAL_QOS_REMOTE
public static final java.lang.String RELIABLE_PROVISIONAL_VALUE
public static final ContentType APPLICATION_SDP_MIME_TYPE
public static final ContentType MULTIPART_MIXED_MIME_TYPE
public static final ContentType TEXT_PLAIN_MIME_TYPE
public static java.lang.String removeTagsFromURI(java.lang.String uri)
uri
- URI String to strip of parameters.public static java.lang.String makeSIPAddress(java.lang.String user, boolean isSipUri, java.lang.String sipDomain)
user
- the value to use as the user for SIP URI or Tel URIisSipUri
- True
for SIP URIs, otherwise False
sipDomain
- SIP URI domain.public static boolean isInitialSipRequest(SipRequest request)
request
- SipRequest to query.public static void addAllowEventsValues(java.lang.String[] values, SipMessage sipMessage, SipFactory sipFactory, javax.slee.facilities.Tracer tracer) throws SipParseException
values
- Parameterable value to add/setsipMessage
- Target SIP messagesipFactory
- SIP factoryorg.jainslee.resources.sip.SipParseException
SipParseException
public static SubscribedEventID getSubscribedEventID(SipMessage message)
Leg
.
For SUBSCRIBE and NOTIFY requests and responses, use the Event header.
REFER requests and responses automatically have the event name "refer",
with "id" set to the REFER's sequence number.message
- a SIP messageSubscribedEventID
object, or null if the message
did not contain a subscribed event.public static void addMessageContent(@Nonnull SipMessage message, @Nonnull MessageBody messageBody, boolean replace, @Nullable javax.slee.facilities.Tracer tracer) throws java.io.IOException
message
- The message to put the content in.messageBody
- The MessageBody object containing the content to add.replace
- if true, if the message already contains a body with the messageBody's content type then the
provided content will replace the existing message content of that type.tracer
- Optional tracer for logging debug messages to.java.io.IOException
public static java.util.List<MessageBody> getMessageContent(@Nonnull SipMessage message, @Nullable ContentType contentType, @Nullable javax.slee.facilities.Tracer tracer)
message
- The message to retrieve content from.contentType
- The Content-Type of the desired content, or null for any and all content.tracer
- Optional tracer for debug logging.public static void removeMessageContent(@Nonnull SipMessage message, @Nullable ContentType contentType, @Nullable javax.slee.facilities.Tracer tracer) throws java.io.IOException
message
- The message to strip content from.contentType
- The type of content to strip, or null if all content should be stripped.tracer
- An optional tracer for debug logging.java.io.IOException
- If there is an issue while handling multipart content that prevents content from being stripped.public static void removeSipMessageBody(@Nonnull SipMessage message)
message
- The message to remove the body from.@Deprecated public static byte[] getSDPBody(SipMessage message)
message
- the SIP message to inspectpublic static MessageBody getSDPMessageBody(@Nonnull SipMessage message, @Nullable javax.slee.facilities.Tracer tracer)
message
- the SIP message to get SDP from.tracer
- Optional tracer for debug logging.public static void setSDPBody(@Nonnull SipMessage message, @Nonnull java.lang.String sdp, @Nullable javax.slee.facilities.Tracer tracer) throws java.io.IOException
message
- The message to set the SDP in.sdp
- The UTF-8 encoded SDP content to be set.tracer
- Optional tracer for debug logging.java.io.IOException
- If there is an issue reading any existing content body in the message.public static void updateSDPPreconditions(OutgoingSipRequest outgoingInvite, SessionDescriptionWrapper latestReceivedSDP, javax.slee.facilities.Tracer tracer)
outgoingInvite
- The INVITE to update.latestReceivedSDP
- the SDP to copy local precondition attributes fromtracer
- Optional tracer for debug logging.public static void copySDPSessionVersion(OutgoingSipRequest outgoingInvite, SessionDescriptionWrapper latestReceivedSDP, javax.slee.facilities.Tracer tracer)
outgoingInvite
- the INVITE request to be forwardedlatestReceivedSDP
- the latest SDP received from the calling party. This SDP's
version will be copied into the output requesttracer
- a tracerpublic static java.lang.String getSDPString(@Nonnull SipMessage sipMessage) throws java.io.IOException
java.io.IOException
Copyright © OpenCloud. All Rights Reserved.