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

SipClientConnection

public interface SipClientConnection implements SipConnection
SipClientConnection represents SIP client transaction. Application can create a new SipClientConnection with Connector or SipDialog object.
see
JSR180 spec, v 1.0.1, p 21-33

Fields Summary
Constructors Summary
Methods Summary
public intenableRefresh(javax.microedition.sip.SipRefreshListener srl)
Enables the refresh on for the request to be sent. The method return a refresh ID, which can be used to update or stop the refresh.

see
JSR180 spec, v 1.0.1, p 29
param
srl - callback interface for refresh events, if this is null the method returns 0 and refresh is not enabled.
return
refresh ID. If the request is not refreshable returns 0.
throws
SipException - INVALID_STATE if the refresh can not be enabled in this state.

public voidinitAck()
Convenience method to initialize SipClientConnection with SIP request method ACK. ACK can be applied only to INVITE request.

see
JSR180 spec, v 1.0.1, p 27

public javax.microedition.sip.SipClientConnectioninitCancel()
Convenience method to initialize SipClientConnection with SIP request method CANCEL.

see
JSR180 spec, v 1.0.1, p 27-28

public voidinitRequest(java.lang.String method, javax.microedition.sip.SipConnectionNotifier scn)
Initializes SipClientConnection to a specific SIP request method (REGISTER, INVITE, MESSAGE, ...).

see
JSR180 spec, v 1.0.1, p 25
param
method - Name of the method
param
scn - SipConnectionNotifier to which the request will be associated. If SipConnectionNotifier is null the request will not be associated to a user defined listening point.
throws
IllegalArgumentException - if the method is invalid
throws
SipException - INVALID_STATE if the request can not be set, because of wrong state in SipClientConnection. Furthermore, ACK and CANCEL methods can not be initialized in Created state.

public booleanreceive(long timeout)
Receives SIP response message. The receive method will update the SipClientConnection with the last new received response. If no message is received the method will block until something is received or specified amount of time has elapsed.

see
JSR180 spec, v 1.0.1, p 28
param
timeout - the maximum time to wait in milliseconds. 0 = do not wait, just poll
return
Returns true if response was received. Returns false if the given timeout elapsed and no response was received.
throws
SipException - INVALID_STATE if the receive can not be called because of wrong state.
throws
IOException - if the message could not be received or because of network failure

public voidsetCredentials(java.lang.String username, java.lang.String password, java.lang.String realm)
Sets credentials for possible digest authentication.

see
JSR180 spec, v 1.0.1, p 29
param
username - username (for this protection domain)
param
password - user password (for this protection domain)
param
realm - defines the protection domain
throws
SipException - INVALID_STATE if the credentials can not be set in this state.
throws
NullPointerException - if the username, password or realm is null

public voidsetListener(javax.microedition.sip.SipClientConnectionListener sccl)
Sets the listener for incoming responses. If a listener is already set it will be overwritten. Setting listener to null will remove the current listener.

see
JSR180 spec, v 1.0.1, p 28
param
sccl - reference to the listener object. Value null will remove the existing listener.
throws
IOException - if the connection is closed.

public voidsetRequestURI(java.lang.String URI)
Sets Request-URI explicitly. Request-URI can be set only in Initialized state.

see
JSR180 spec, v 1.0.1, p 26
param
URI - Request-URI
throws
IllegalArgumentException - MAY be thrown if the URI is invalid
throws
SipException - INVALID_STATE if the Request-URI can not be set, because of wrong state. INVALID_OPERATION if the Request-URI is not allowed to be set.