FileDocCategorySizeDatePackage
SipConnection.javaAPI DocphoneME MR2 API (J2ME)7117Wed May 02 18:00:42 BST 2007javax.microedition.sip

SipConnection

public interface SipConnection implements javax.microedition.io.Connection
SipConnection is the base interface for Sip connections.
see
JSR180 spec, v 1.0.1, p 11-20

Fields Summary
Constructors Summary
Methods Summary
public voidaddHeader(java.lang.String name, java.lang.String value)
Adds a header to the SIP message.

see
JSR180 spec, v 1.0.1, p 17
param
name - name of the header, either in full or compact form. RFC 3261 p.32
param
value - the header value
throws
SipException - INVALID_STATE if header can not be added in this state.
INVALID_OPERATION if the system does not allow to add this header.
throws
IllegalArgumentException - MAY be thrown if the header or value is invalid

public javax.microedition.sip.SipDialoggetDialog()
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).

return
SipDialog object if this connection belongs to a dialog, otherwise returns null.

public java.lang.StringgetHeader(java.lang.String name)
Gets the header field value of specified header type.

param
name - name of the header type, either in full or compact form. RFC 3261 p.32
return
topmost header field value, or null if the current message does not have such a header or the header is for other reason not available (e.g. message not initialized).

public java.lang.String[]getHeaders(java.lang.String name)
Gets the header field value(s) of specified header type

param
name - name of the header, either in full or compact form. RFC 3261 p.32
return
array of header field values (topmost first), or null if the current message does not have such a header or the header is for other reason not available (e.g. message not initialized).

public java.lang.StringgetMethod()
Gets the SIP method. Applicable when a message has been initialized or received.

return
SIP method name REGISTER, INVITE, NOTIFY, etc. Returns null if the method is not available.

public java.lang.StringgetReasonPhrase()
Gets SIP response reason phrase. Available when SipClientConnection is in Proceeding or Completed state or when SipServerConnection is in Initialized state.

return
reason phrase. Returns null if the reason phrase is not available.

public java.lang.StringgetRequestURI()
Gets Request-URI.

see
JSR180 spec, v 1.0.1, p 19
return
Request-URI of the message. Returns null if the Request-URI is not available.

public intgetStatusCode()
Gets SIP response status code. Available when SipClientConnection is in Proceeding or Completed state or when SipServerConnection is in Initialized state.

return
status code 1xx, 2xx, 3xx, 4xx, ... Returns 0 if the status code is not available.

public java.io.InputStreamopenContentInputStream()
Returns InputStream to read SIP message body content.

return
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 opened in this state (e.g. no message received).

public java.io.OutputStreamopenContentOutputStream()
Returns OutputStream to fill the SIP message body content.

see
JSR180 spec, v 1.0.1, p 20
return
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 opened in this state (e.g. no message initialized). UNKNOWN_LENGTH Content-Length header not set. UNKNOWN_TYPE Content-Type header not set.

public voidremoveHeader(java.lang.String name)
Reomves header from the SIP message.

see
JSR180 spec, v 1.0.1, p 18
param
name - name of the header to be removed, either int full or compact form RFC 3261 p.32.
throws
SipException - INVALID_STATE if header can not be removed in this state.
INVALID_OPERATION if the system does not allow to remove this header.

public voidsend()
Sends the SIP message. Send must also close the OutputStream if it was opened

throws
IOException - if the message could not be sent or because of network failure
throws
InterruptedIOException - if a timeout occurs while either trying to send the message or if this Connection object is closed during this send operation
throws
SipException - INVALID_STATE if the message cannot be sent in this state.
INVALID_MESSAGE there was an error in message format

public voidsetHeader(java.lang.String name, java.lang.String value)
Sets header value in SIP message.

see
JSR180 spec, v 1.0.1, p 17
param
value - the header value
throws
SipException - INVALID_STATE if header can not be set in this state.
INVALID_OPERATION if the system does not allow to set this header.
throws
IllegalArgumentException - MAY be thrown if the header or value is invalid