| java.lang.Object gov.nist.microedition.sip.SipServerConnectionImpl
Field Summary | |
final public static int | COMPLETED | final public static int | INITIALIZED | final public static int | REQUEST_RECEIVED Request Received, SipServerConnection returned from
SipConnectionNotifier or provisional response(s) (1xx) sent. | final public static int | STREAM_OPEN Stream Open, OutputStream opened with openContentOutputStream(). | final public static int | TERMINATED |
Method Summary | |
public void | addHeader(String name, String value) Adds a header to the SIP message. | public void | close() Closes the connection. | public SipDialog | getDialog() Returns the current SIP dialog. | public String | getHeader(String name) Gets the header field value of specified header type.
Parameters: name - - name of the header type, either in full or compact form.RFC 3261 p.32 topmost header field value, or null if thecurrent message does not have such a header or the header is for otherreason not available (e.g. | public String[] | getHeaders(String name) Gets the header field value(s) of specified header type
Parameters: name - - name of the header, either in full or compact form.RFC 3261 p.32 array of header field values (topmost first), or null if thecurrent message does not have such a header or the header is for otherreason not available (e.g. | public String | getMethod() Gets the SIP method. | public String | getReasonPhrase() Gets SIP response reason phrase. | public String | getRequestURI() Gets Request-URI. | public int | getState() | public int | getStatusCode() Gets SIP response status code. | public void | initResponse(int code) Initializes SipServerConnection with a specific SIP response to the
received request.
The default headers and reason phrase will be initialized automatically.
After this the SipServerConnection is in Initialized state.
The response can be sent. | public InputStream | openContentInputStream() Returns InputStream to read SIP message body content.
InputStream to read body content throws: java.io.IOException - - if the InputStream can not be opened,because of an I/O error occurred. throws: SipException - - INVALID_STATE the InputStream can not be openedin this state (e.g. | public OutputStream | openContentOutputStream() Returns OutputStream to fill the SIP message body content.
When calling close() on OutputStream the message will be sent
to the network. | public void | removeHeader(String name) Removes header from the SIP message. | public void | send() | public void | setHeader(String name, String value) Sets header value in SIP message. | public void | setReasonPhrase(String phrase) Changes the default reason phrase. |
COMPLETED | final public static int COMPLETED(Code) | | Completed, transaction completed with sending final response
(2xx, 3xx, 4xx, 5xx, 6xx)
|
INITIALIZED | final public static int INITIALIZED(Code) | | Initialized, response initialized calling initResponse()
|
REQUEST_RECEIVED | final public static int REQUEST_RECEIVED(Code) | | Request Received, SipServerConnection returned from
SipConnectionNotifier or provisional response(s) (1xx) sent.
|
STREAM_OPEN | final public static int STREAM_OPEN(Code) | | Stream Open, OutputStream opened with openContentOutputStream().
Opening InputStream for received request does not trigger state
transition.
|
TERMINATED | final public static int TERMINATED(Code) | | Terminated, the final state, in which the SIP connection has
been terminated by error or closed
|
SipServerConnectionImpl | protected SipServerConnectionImpl(Request request, SipDialog sipDialog, SipConnectionNotifierImpl sipConnectionNotifierImpl)(Code) | | Constructor.
Parameters: request - the protocol connection request Parameters: sipDialog - the current transaction state Parameters: sipConnectionNotifierImpl - the notification handler |
addHeader | public void addHeader(String name, String value) throws SipException, IllegalArgumentException(Code) | | Adds a header to the SIP message. If multiple header field values exist
the header value is added topmost of this type of headers.
The implementations MAY restrict the access to some headers
according to RFC 3261.
Parameters: name - - name of the header, either in full or compact form.RFC 3261 p.32 Parameters: value - - the header value throws: SipException - - INVALID_STATE if header can not be added inthis state. INVALID_OPERATION if the system does not allow to addthis header. throws: IllegalArgumentException - - MAY be thrown if the header orvalue is invalid |
getDialog | public SipDialog getDialog()(Code) | | Returns the current SIP dialog. This is available when the SipConnection
belongs to a created SipDialog and the system has received (or sent)
provisional (101-199) or final response (200).
SipDialog object if this connection belongs to a dialog,otherwise returns null. |
getHeader | public String getHeader(String name)(Code) | | Gets the header field value of specified header type.
Parameters: name - - name of the header type, either in full or compact form.RFC 3261 p.32 topmost header field value, or null if thecurrent message does not have such a header or the header is for otherreason not available (e.g. message not initialized). |
getHeaders | public String[] getHeaders(String name)(Code) | | Gets the header field value(s) of specified header type
Parameters: name - - name of the header, either in full or compact form.RFC 3261 p.32 array of header field values (topmost first), or null if thecurrent message does not have such a header or the header is for otherreason not available (e.g. message not initialized). |
getMethod | public String getMethod()(Code) | | Gets the SIP method. Applicable when a message has been
initialized or received.
SIP method name REGISTER, INVITE, NOTIFY, etc. Returns null ifthe method is not available. |
getReasonPhrase | public String getReasonPhrase()(Code) | | Gets SIP response reason phrase. Available when SipClientConnection is in
Proceeding or Completed state or when SipServerConnection is in
Initialized state.
reason phrase. Returns null if the reason phrase isnot available. |
getRequestURI | public String getRequestURI()(Code) | | Gets Request-URI. Available when SipClientConnection is in Initialized
state or when SipServerConnection is in Request Received state.
Built from the original URI given in Connector.open().
See RFC 3261 p.35 (8.1.1.1 Request-URI)
Request-URI of the message. Returns null if the Request-URIis not available. |
getState | public int getState()(Code) | | Return the state of SIP server connection
state of the SIP Server Connection |
getStatusCode | public int getStatusCode()(Code) | | Gets SIP response status code. Available when SipClientConnection is in
Proceeding or Completed state or when SipServerConnection is in
Initialized state.
status code 1xx, 2xx, 3xx, 4xx, ... Returns 0 if the status codeis not available. |
initResponse | public void initResponse(int code) throws IllegalArgumentException, SipException(Code) | | Initializes SipServerConnection with a specific SIP response to the
received request.
The default headers and reason phrase will be initialized automatically.
After this the SipServerConnection is in Initialized state.
The response can be sent. The procedure of generating the response and
header fields is defined in RFC 3261 [1] p. 49-50. At least following
information is set by the method:
From MUST equal the From header field of the request
Call-ID MUST equal the Call-ID header field of the request
CSeq MUST equal the CSeq field of the request
Via MUST equal the Via header field values in the request
and MUST maintain the same ordering
To MUST Copy if exists in the original request,
'tag' MUST be added if not present
Furthermore, if the system has automatically sent the 100 Trying
response, the 100 response initialized and sent by the user
is just ignored.
Parameters: code - - Response status code 1xx - 6xx throws: IllegalArgumentException - - if the status code is out ofrange 100-699 (RFC 3261 p.28-29) throws: SipException - - INVALID_STATE if the response can not beinitialized, because of wrong state. |
openContentInputStream | public InputStream openContentInputStream() throws IOException, SipException(Code) | | Returns InputStream to read SIP message body content.
InputStream to read body content throws: java.io.IOException - - if the InputStream can not be opened,because of an I/O error occurred. throws: SipException - - INVALID_STATE the InputStream can not be openedin this state (e.g. no message received). |
openContentOutputStream | public OutputStream openContentOutputStream() throws IOException, SipException(Code) | | Returns OutputStream to fill the SIP message body content.
When calling close() on OutputStream the message will be sent
to the network. So it is equivalent to call send(). Again send() must
not be called after closing the OutputStream, since it will throw
Exception because of calling the method in wrong state.
Before opening OutputStream the Content-Length and Content-Type headers
has to se set. If not SipException.UNKNOWN_LENGTH or
SipException.UNKNOWN_TYPE will be thrown respectively.
OutputStream to write body content throws: IOException - if the OutputStream can not be opened,because of an I/O error occurred. throws: SipException - INVALID_STATE the OutputStream can not be openedin this state (e.g. no message initialized).UNKNOWN_LENGTH Content-Length header not set.UNKNOWN_TYPE Content-Type header not set. |
removeHeader | public void removeHeader(String name) throws SipException, IllegalArgumentException(Code) | | Removes header from the SIP message. If multiple header field
values exist the topmost is removed.
The implementations MAY restrict the access to some headers
according to RFC 3261.
If the named header is not found this method does nothing.
Parameters: name - - name of the header to be removed, either intfull or compact form RFC 3261 p.32. throws: SipException - - INVALID_STATE if header can not be removed inthis state. INVALID_OPERATION if the system does not allow to removethis header. |
setHeader | public void setHeader(String name, String value) throws SipException, IllegalArgumentException(Code) | | Sets header value in SIP message. If the header does not exist
it will be added to the message, otherwise the existing header is
overwritten. If multiple header field values exist the topmost is
overwritten. The implementations MAY restrict the access to some headers
according to RFC 3261.
Parameters: name - - name of the header, either in full or compact form.RFC 3261 p.32 Parameters: value - - the header value throws: SipException - - INVALID_STATE if header can not be set inthis state. INVALID_OPERATION if the system does not allow to setthis header. throws: IllegalArgumentException - - MAY be thrown if the header orvalue is invalid |
|
|