public abstract class ImmutableSipMessage extends Object implements SipMessage
SipMessage.Builder<T extends SipMessage>
UNABLE_TO_PARSE_OUT_THE_METHOD_DUE_TO_UNDERLYING_IO_EXCEPTION
Modifier | Constructor and Description |
---|---|
protected |
ImmutableSipMessage(Buffer message,
SipInitialLine initialLine,
List<SipHeader> headers,
short indexOfTo,
short indexOfFrom,
short indexOfCSeq,
short indexOfCallId,
short indexOfMaxForwards,
short indexOfVia,
short indexOfRoute,
short indexOfRecordRoute,
short indexOfContact,
Buffer body) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(SipHeader header) |
void |
addHeaderFirst(SipHeader header) |
SipMessage |
clone()
Perform a deep clone of this SipMessage.
|
int |
countNoOfHeaders() |
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
|
protected SipInitialLine |
getInitialLineAsObject() |
MaxForwardsHeader |
getMaxForwards() |
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() |
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.
|
SipHeader |
popHeader(Buffer headerNme)
Remove and return the top-most header.
|
void |
setHeader(SipHeader header)
Set the specified header, which will replace the existing header of the
same name.
|
Buffer |
toBuffer()
Get the
Buffer that is representing this SipMessage . |
String |
toString() |
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.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
copy, createResponse, createResponse, frame, frame, frame, getMethod, isAck, isBye, isCancel, isInfo, isInvite, isMessage, isOptions, isRegister, isRequest, isResponse, isSubsequent, toRequest, toResponse
protected ImmutableSipMessage(Buffer message, SipInitialLine initialLine, List<SipHeader> headers, short indexOfTo, short indexOfFrom, short indexOfCSeq, short indexOfCallId, short indexOfMaxForwards, short indexOfVia, short indexOfRoute, short indexOfRecordRoute, short indexOfContact, Buffer body)
message
- the full immutable buffer which has the entire SIP message in it, including all headers, body
initial line etc.initialLine
- the parsed initial line (which is just a reference into the message buffer)headers
- body
- public SipInitialLine initialLine()
initialLine
in interface SipMessage
public List<SipHeader> getAllHeaders()
getAllHeaders
in interface SipMessage
public int countNoOfHeaders()
countNoOfHeaders
in interface SipMessage
public Buffer getInitialLine()
SipMessage
getInitialLine
in interface SipMessage
protected SipInitialLine getInitialLineAsObject()
public Buffer getContent()
SipMessage
Buffer
.getContent
in interface SipMessage
public boolean hasContent()
SipMessage
SipMessage
is carrying anything in its
message body.hasContent
in interface SipMessage
SipMessage
has a message body, false
otherwise.public Optional<SipHeader> getHeader(Buffer headerName) throws SipParseException
SipMessage
getHeader
in interface SipMessage
headerName
- the name of the header we wish to fetchSipHeader
or null if not foundSipParseException
public List<SipHeader> getHeaders(Buffer headerName) throws SipParseException
getHeaders
in interface SipMessage
SipParseException
public List<SipHeader> getHeaders(String headerName) throws SipParseException
SipMessage
getHeaders
in interface SipMessage
SipParseException
public Optional<SipHeader> getHeader(String headerName) throws SipParseException
SipMessage
#getHeader(Buffers.wrap(keyParameter)
.getHeader
in interface SipMessage
headerName
- the name of the header we wish to fetchSipHeader
or null if not foundSipParseException
public void addHeader(SipHeader header) throws SipParseException
addHeader
in interface SipMessage
SipParseException
public void addHeaderFirst(SipHeader header) throws SipParseException
addHeaderFirst
in interface SipMessage
SipParseException
public SipHeader popHeader(Buffer headerNme) throws SipParseException
SipMessage
popHeader
in interface SipMessage
SipParseException
public void setHeader(SipHeader header) throws SipParseException
SipMessage
setHeader
in interface SipMessage
SipParseException
public FromHeader getFromHeader() throws SipParseException
SipMessage
getFromHeader
in interface SipMessage
SipParseException
- TODOpublic ToHeader getToHeader() throws SipParseException
SipMessage
getToHeader
in interface SipMessage
SipParseException
public ViaHeader getViaHeader() throws SipParseException
SipMessage
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.getViaHeader
in interface SipMessage
ViaHeader
or null if there are no
ViaHeader
s on this message just yet.SipParseException
public List<ViaHeader> getViaHeaders() throws SipParseException
SipMessage
SipMessage
. If there are no
ViaHeader
s then an empty list will be returned.getViaHeaders
in interface SipMessage
SipParseException
public MaxForwardsHeader getMaxForwards() throws SipParseException
getMaxForwards
in interface SipMessage
SipParseException
public RecordRouteHeader getRecordRouteHeader() throws SipParseException
SipMessage
RecordRouteHeader
header if present.getRecordRouteHeader
in interface SipMessage
RecordRouteHeader
header or null if there
are no RecordRouteHeader
headers found in this
SipMessage
.SipParseException
public List<RecordRouteHeader> getRecordRouteHeaders() throws SipParseException
SipMessage
SipMessage
. If there are
no RecordRouteHeader
s in this SipMessage
then an empty
list will be returned.getRecordRouteHeaders
in interface SipMessage
SipParseException
public RouteHeader getRouteHeader() throws SipParseException
SipMessage
RouteHeader
header if present.getRouteHeader
in interface SipMessage
RouteHeader
header or null if there are no
RouteHeader
headers found in this SipMessage
.SipParseException
public List<RouteHeader> getRouteHeaders() throws SipParseException
SipMessage
SipMessage
. If there are no
RouteHeader
s in this SipMessage
then an empty list will
be returned.getRouteHeaders
in interface SipMessage
SipParseException
public ExpiresHeader getExpiresHeader() throws SipParseException
SipMessage
ExpiresHeader
getExpiresHeader
in interface SipMessage
SipParseException
public ContactHeader getContactHeader() throws SipParseException
SipMessage
ContactHeader
getContactHeader
in interface SipMessage
SipParseException
public ContentTypeHeader getContentTypeHeader() throws SipParseException
SipMessage
ContentTypeHeader
for this message. If there is no
Content-Type header in this SIP message then null will be returned.getContentTypeHeader
in interface SipMessage
ContentTypeHeader
or null if there is none.SipParseException
public int getContentLength() throws SipParseException
SipMessage
getContentLength
in interface SipMessage
SipParseException
public CallIdHeader getCallIDHeader() throws SipParseException
SipMessage
getCallIDHeader
in interface SipMessage
SipParseException
public CSeqHeader getCSeqHeader() throws SipParseException
SipMessage
getCSeqHeader
in interface SipMessage
SipParseException
public boolean isInitial() throws SipParseException
SipMessage
isInitial
in interface SipMessage
SipParseException
public void verify()
SipMessage
This list is taken from Kamailio.org
verify
in interface SipMessage
public Buffer toBuffer()
SipMessage
Buffer
that is representing this SipMessage
.toBuffer
in interface SipMessage
public SipMessage clone()
SipMessage
clone
in interface SipMessage
clone
in class Object
Copyright © 2016. All Rights Reserved.