public interface SipMessage extends Cloneable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SipMessage.Builder<T extends SipMessage>
Whenever you create a new
SipMessage you will end up with a SipMessage.Builder. |
| Modifier and Type | Field and Description |
|---|---|
static String |
UNABLE_TO_PARSE_OUT_THE_METHOD_DUE_TO_UNDERLYING_IO_EXCEPTION |
| Modifier and Type | Method and Description |
|---|---|
SipMessage |
clone()
Perform a deep clone of this SipMessage.
|
SipMessage.Builder<? extends SipMessage> |
copy() |
default int |
countNoOfHeaders() |
default SipResponse.Builder |
createResponse(int responseCode)
Create a new response based on this
SipRequest. |
default SipResponse.Builder |
createResponse(int responseCode,
Buffer content) |
static SipMessage |
frame(Buffer buffer)
Frame the supplied buffer into a
SipMessage. |
static SipMessage |
frame(byte[] buffer) |
static SipMessage |
frame(String buffer) |
default List<SipHeader> |
getAllHeaders() |
CallIdHeader |
getCallIDHeader()
Convenience method for fetching the call-id-header
|
ContactHeader |
getContactHeader()
Get the
ContactHeader |
Buffer |
getContent()
Get the content as a
Buffer. |
int |
getContentLength()
Return the content length.
|
ContentTypeHeader |
getContentTypeHeader()
Get the
ContentTypeHeader for this message. |
CSeqHeader |
getCSeqHeader()
Convenience method for fetching the CSeq header
|
ExpiresHeader |
getExpiresHeader()
Get the
ExpiresHeader |
FromHeader |
getFromHeader()
Convenience method for fetching the from-header
|
Optional<SipHeader> |
getHeader(Buffer headerName)
Get the header as a buffer
|
Optional<SipHeader> |
getHeader(String headerName)
Same as
#getHeader(Buffers.wrap(keyParameter). |
List<SipHeader> |
getHeaders(Buffer headerName) |
List<SipHeader> |
getHeaders(String headerName)
Get all headers with the given name.
|
Buffer |
getInitialLine()
The first line of a sip message, which is either a request or a response
line
|
MaxForwardsHeader |
getMaxForwards() |
Buffer |
getMethod()
Get the method of this sip message
|
RecordRouteHeader |
getRecordRouteHeader()
Get the top-most
RecordRouteHeader header if present. |
List<RecordRouteHeader> |
getRecordRouteHeaders()
Get all the RecordRoute-headers in this
SipMessage. |
RouteHeader |
getRouteHeader()
Get the top-most
RouteHeader header if present. |
List<RouteHeader> |
getRouteHeaders()
Get all the Route-headers in this
SipMessage. |
ToHeader |
getToHeader()
Convenience method for fetching the to-header
|
ViaHeader |
getViaHeader()
Get the top-most
ViaHeader if present. |
List<ViaHeader> |
getViaHeaders()
Get all the Via-headers in this
SipMessage. |
boolean |
hasContent()
Checks whether this
SipMessage is carrying anything in its
message body. |
SipInitialLine |
initialLine() |
default boolean |
is100Trying()
Convenience method for checking whether this is a 100 Trying response or
not.
|
default boolean |
isAck()
Convenience method for determining whether the method of this message is
an ACK or not.
|
default boolean |
isBye()
Convenience method for determining whether the method of this message is a BYE or not.
|
default boolean |
isByeRequest() |
default boolean |
isCancel()
Convenience method for determining whether the method of this message is
a CANCEL or not
|
default boolean |
isCancelRequest() |
default boolean |
isClientError()
Convenience method for checking whether this is a 4xx response or not.
|
default boolean |
isError()
Convenience method for checking whether this an error response is >= 400.
|
default boolean |
isFinal()
Convenience method for checking whether this response is a final response, i.e.
|
default boolean |
isFinalNon2xx()
Convenience method for checking whether this is a 300 - 699.
|
default boolean |
isGlobalError()
Convenience method for checking whether this is a 6xx response or not.
|
default boolean |
isInfo()
Convenience method for determining whether the method of this message is
a INFO or not.
|
default boolean |
isInfoRequest() |
boolean |
isInitial()
Checks whether or not this request is considered to be an "initial"
request, i.e., a request that does not go within a dialog.
|
default boolean |
isInvite()
Convenience method for determining whether the method of this message is
an INVITE or not.
|
default boolean |
isInviteRequest() |
default boolean |
isMessage()
Convenience method for determining whether the method of this message is
a MESSAGE or not.
|
default boolean |
isMessageRequest() |
default boolean |
isOptions()
Convenience method for determining whether the method of this message is
a OPTIONS or not.
|
default boolean |
isOptionsRequest() |
default boolean |
isProvisional()
Convenience method for checking whether this is a 1xx response or not.
|
default boolean |
isRedirect()
Convenience method for checking whether this is a 3xx response or not.
|
default boolean |
isRegister()
Convenience method for determining whether the method of this message is an REGISTER or not.
|
default boolean |
isRegisterRequest() |
default boolean |
isRequest()
Check whether this sip message is a request or not
|
default boolean |
isResponse()
Check whether this sip message is a response or not
|
default boolean |
isRinging()
Convenience method for checking whether this is a 180 Ringing response or
or a 183 Early Media response.
|
default boolean |
isServerError()
Convenience method for checking whether this is a 5xx response or not.
|
default boolean |
isSubsequent() |
default boolean |
isSuccess()
Convenience method for checking whether this is a 2xx response or not.
|
default boolean |
isTimeout()
Convenience method for checking whether this is a 480 Timeout response or
not.
|
Buffer |
toBuffer()
Get the
Buffer that is representing this SipMessage. |
default SipRequest |
toRequest()
Got tired of casting the
SipMessage into a SipRequest so
you can use this method instead. |
default SipResponse |
toResponse()
Got tired of casting the
SipMessage into a SipResponse so
you can use this method instead. |
void |
verify()
ruri sip version - checks if the SIP version in the request URI is
supported, currently only 2.0.
ruri scheme - checks if the URI scheme of the request URI is
supported (sip[s]|tel[s]) by SIP-router.
required headers - checks if the minimum set of required headers to,
from, cseq, callid and via is present in the request.
via sip version - not working because parser fails already when
another version then 2.0 is present.
via protocol - not working because parser fails already if an
unsupported transport is present.
cseq method - checks if the method from the cseq header is equal to
the request method.
cseq value - checks if the number in the cseq header is a valid
unsigned integer.
content length - checks if the size of the body matches with the
value from the content length header.
expires value - checks if the value of the expires header is a valid
unsigned integer.
proxy require - checks if all items of the proxy require header are
present in the list of the extensions from the module parameter
proxy_require.
parse uri's - checks if the specified URIs are present and parseable
by the SIP-router parsers
digest credentials - Check all instances of digest credentials in a
message.
|
static final String UNABLE_TO_PARSE_OUT_THE_METHOD_DUE_TO_UNDERLYING_IO_EXCEPTION
Buffer getInitialLine()
SipInitialLine initialLine()
default SipRequest toRequest() throws ClassCastException
SipMessage into a SipRequest so
you can use this method instead. Just a short cut for:
(SipRequest)sipMessage;
SipRequestClassCastException - in case this SipMessage is actually a
SipResponse.default SipResponse toResponse() throws ClassCastException
SipMessage into a SipResponse so
you can use this method instead. Just a short cut for:
(SipResponse)sipMessage;
SipResponseClassCastException - in case this SipMessage is actually a
SipResponse.default SipResponse.Builder createResponse(int responseCode) throws SipParseException, ClassCastException
SipRequest. If this
SipMessage is not a SipRequest then a
ClassCastException will be thrown. Only the mandatory headers
from the SipRequest are copied. Those mandatory headers are:
responseCode - SipParseException - in case anything goes wrong when parsing out headers from the
SipRequestClassCastExceptiondefault SipResponse.Builder createResponse(int responseCode, Buffer content) throws SipParseException, ClassCastException
SipParseExceptionClassCastExceptiondefault boolean isResponse()
default boolean isRequest()
default boolean isInviteRequest()
default boolean isByeRequest()
default boolean isCancelRequest()
default boolean isRegisterRequest()
default boolean isOptionsRequest()
default boolean isInfoRequest()
default boolean isMessageRequest()
default boolean isError()
default boolean isProvisional()
default boolean isFinal()
default boolean isSuccess()
default boolean isFinalNon2xx()
default boolean isRedirect()
default boolean isClientError()
default boolean isServerError()
default boolean isGlobalError()
default boolean is100Trying()
default boolean isRinging()
default boolean isTimeout()
boolean hasContent()
SipMessage is carrying anything in its
message body.SipMessage has a message body, false
otherwise.Buffer getMethod() throws SipParseException
SipParseExceptionOptional<SipHeader> getHeader(Buffer headerName) throws SipParseException
headerName - the name of the header we wish to fetchSipHeader or null if not foundSipParseExceptionOptional<SipHeader> getHeader(String headerName) throws SipParseException
#getHeader(Buffers.wrap(keyParameter).headerName - the name of the header we wish to fetchSipHeader or null if not foundSipParseExceptionList<SipHeader> getHeaders(String headerName) throws SipParseException
headerName - SipParseExceptionList<SipHeader> getHeaders(Buffer headerName) throws SipParseException
SipParseExceptionFromHeader getFromHeader() throws SipParseException
SipParseException - TODOToHeader getToHeader() throws SipParseException
SipParseExceptionViaHeader getViaHeader() throws SipParseException
ViaHeader if present. If this is a request that
has been sent then there should always be a ViaHeader present.
However, you just created a SipMessage youself then this method
may return null so please check for it.ViaHeader or null if there are no
ViaHeaders on this message just yet.SipParseExceptionList<ViaHeader> getViaHeaders() throws SipParseException
SipMessage. If there are no
ViaHeaders then an empty list will be returned.SipParseExceptionMaxForwardsHeader getMaxForwards() throws SipParseException
SipParseExceptionRecordRouteHeader getRecordRouteHeader() throws SipParseException
RecordRouteHeader header if present.RecordRouteHeader header or null if there
are no RecordRouteHeader headers found in this
SipMessage.SipParseExceptionList<RecordRouteHeader> getRecordRouteHeaders() throws SipParseException
SipMessage. If there are
no RecordRouteHeaders in this SipMessage then an empty
list will be returned.SipParseExceptionRouteHeader getRouteHeader() throws SipParseException
RouteHeader header if present.RouteHeader header or null if there are no
RouteHeader headers found in this SipMessage.SipParseExceptionList<RouteHeader> getRouteHeaders() throws SipParseException
SipMessage. If there are no
RouteHeaders in this SipMessage then an empty list will
be returned.SipParseExceptionExpiresHeader getExpiresHeader() throws SipParseException
ExpiresHeaderSipParseExceptionContactHeader getContactHeader() throws SipParseException
ContactHeaderSipParseExceptionContentTypeHeader getContentTypeHeader() throws SipParseException
ContentTypeHeader for this message. If there is no
Content-Type header in this SIP message then null will be returned.ContentTypeHeader or null if there is none.SipParseExceptionint getContentLength()
throws SipParseException
SipParseExceptionCallIdHeader getCallIDHeader() throws SipParseException
SipParseExceptionCSeqHeader getCSeqHeader() throws SipParseException
SipParseExceptiondefault boolean isInvite()
throws SipParseException
isRequest() and
isResponse()SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isRegister()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isBye()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isAck()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isCancel()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isOptions()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isMessage()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.default boolean isInfo()
throws SipParseException
SipParseException - in case the method could not be parsed out of the underlying
buffer.boolean isInitial()
throws SipParseException
SipParseExceptiondefault boolean isSubsequent()
throws SipParseException
SipParseExceptionvoid verify()
This list is taken from Kamailio.org
Buffer toBuffer()
Buffer that is representing this SipMessage.SipMessage clone()
static SipMessage frame(Buffer buffer) throws SipParseException, IOException
SipMessage. No deep analysis of the message will be
performed so there is no guarantee that this SipMessage is actually a well formed
message.buffer - SipMessageSipParseExceptionIOExceptionstatic SipMessage frame(String buffer) throws SipParseException, IOException
buffer - IOExceptionSipParseExceptionstatic SipMessage frame(byte[] buffer) throws SipParseException, IOException
SipParseExceptionIOExceptiondefault int countNoOfHeaders()
SipMessage.Builder<? extends SipMessage> copy()
Copyright © 2020. All Rights Reserved.