Class EslMessage
java.lang.Object
com.bytedesk.call.esl.client.transport.message.EslMessage
Basic FreeSWITCH Event Socket messages from the server are decoded into this data object.
An ESL message is modelled as text lines. A message always has one or more header lines, and
optionally may have some body lines.
Header lines are parsed and cached in a map keyed by the
EslHeaders.Name enum. A message
is always expected to have a "Content-Type" header
Any Body lines are cached in a list.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddBodyLine(String line) Used by theEslFrameDecoder(package private) voidaddHeader(EslHeaders.Name name, String value) Used by theEslFrameDecoder.Any received message body linesConvenience methodConvenience methodAll the received message headers in a map keyed byEslHeaders.Name.getHeaderValue(EslHeaders.Name headerName) Convenience methodbooleanConvenience methodbooleanhasHeader(EslHeaders.Name headerName) Convenience methodbooleanDid this message return Reply-Text: +OKtoString()
-
Field Details
-
headers
-
body
-
contentLength
-
-
Constructor Details
-
EslMessage
public EslMessage()
-
-
Method Details
-
getHeaders
All the received message headers in a map keyed byEslHeaders.Name. The string mapped value is the parsed content of the header line (ie, it does not include the header name).- Returns:
- map of header values
-
hasHeader
Convenience method- Parameters:
headerName- as aEslHeaders.Name- Returns:
- true if an only if there is a header entry with the supplied header name
-
getHeaderValue
Convenience method- Parameters:
headerName- as aEslHeaders.Name- Returns:
- same as getHeaders().get( headerName )
-
hasContentLength
public boolean hasContentLength()Convenience method- Returns:
- true if and only if a header exists with name "Content-Length"
-
getContentLength
Convenience method- Returns:
- integer value of header with name "Content-Length"
-
getContentType
Convenience method- Returns:
- header value of header with name "Content-Type"
-
getBodyLines
Any received message body lines- Returns:
- list with a string for each line received, may be an empty list
-
addHeader
Used by theEslFrameDecoder. -
addBodyLine
Used by theEslFrameDecoder -
isReplyOk
public boolean isReplyOk()Did this message return Reply-Text: +OK- Returns:
- true if reply equals +OK, false if not.
-
toString
-