Fields Summary |
---|
protected static final int | INITIALIZEDInitialized, initial state of dialog. This state is initialized
in this class instead of SipDialog interface as it is an internal
state |
private byte | statecurrent state of the dialog |
private String | dialogIDdialogID (Call-ID + remote tag + local tag). |
protected gov.nist.siplite.stack.Dialog | dialogThis implementation of dialog is linked to the Nist-Siplite dialog |
private javax.microedition.sip.SipConnectionNotifier | sipConnectionNotifierCurrent handle to asynchronous notifier. |
private javax.microedition.sip.SipClientConnectionListener | sipClientConnectionListenerHandle for current listener. |
protected gov.nist.siplite.header.ProxyAuthorizationHeader | proxyAuthorizationHeaderProxy server autorization headers. |
protected gov.nist.siplite.header.AuthorizationHeader | authorizationHeaderAuthorization header key. |
private com.sun.midp.security.SecurityToken | classSecurityTokenSecurity token for SIP/SIPS protocol class |
private String | refreshIDThe refresh ID of the refresh task associated with this client connection
if there is any |
protected boolean | isReliableProvReceivedPermission check before sending a PRACK request. |
private boolean | waitForByeTrue if this dialog can't be terminated until BYE is received. |
Methods Summary |
---|
protected void | addSubscription(gov.nist.siplite.stack.Subscription s)Adds a new subscription to the list of active subscriptions.
dialog.subscriptionList.addSubscription(s);
|
protected gov.nist.siplite.stack.Dialog | getDialog()Gets the curre SIP Dialog.
return dialog;
|
public java.lang.String | getDialogID()Returns the ID of the SIP Dialog.
if (state == TERMINATED) {
return null;
}
return dialogID;
|
public javax.microedition.sip.SipClientConnection | getNewClientConnection(java.lang.String method)Returns new SipClientConnection in this dialog.
The SipClientConnection will be pre-initialized with the given
method and
following headers will be set at least
(for details see RFC 3261 [1] 12.2.1.1 Generating the Request, p.73):
To
From
CSeq
Call-ID
Max-Forwards
Via
Contact
Route//ifthedialogrouteisnotempty
// JSR180: all methods are available in CONFIRMED and EARLY states.
if (state != SipDialog.CONFIRMED && state != SipDialog.EARLY) {
throw new SipException("the client connection can not "
+ "be initialized, because of wrong state.",
SipException.INVALID_STATE);
}
// Validating the method.
if (!Lexer.isValidName(method)) {
throw new IllegalArgumentException("Invalid method: '" +
method + "'");
}
// Create the new sip client connection
// and init the request
SipClientConnection sipClientConnection =
new SipClientConnectionImpl(
getDialog().getRemoteTarget().getURI(), this);
// ((SipClientConnectionImpl)sipClientConnection).start();
if ((sipConnectionNotifier != null) &&
!((SipConnectionNotifierImpl)sipConnectionNotifier).
isConnectionOpen()) {
sipConnectionNotifier = null;
}
sipClientConnection.initRequest(method.toUpperCase().trim(),
sipConnectionNotifier);
// keep a trace of the connection created
return sipClientConnection;
|
protected java.lang.String | getRefreshID()Gets the current refreshID.
return refreshID;
|
protected com.sun.midp.security.SecurityToken | getSecurityToken()Gets the current security token.
return classSecurityToken;
|
protected javax.microedition.sip.SipClientConnectionListener | getSipClientConnectionListener()Gets the current listener.
return sipClientConnectionListener;
|
public byte | getState()Returns the state of the SIP Dialog.
return state;
|
protected void | handleNotify(Request request, gov.nist.siplite.stack.Dialog newDialog, java.lang.String newDialogId)Handles NOTIFY request.
SubscriptionStateHeader ssh = (SubscriptionStateHeader)
request.getHeader(Header.SUBSCRIPTION_STATE);
if (ssh != null && ssh.isTerminated()) {
Subscription s =
dialog.subscriptionList.getMatchingSubscription(request);
if (s != null) {
dialog.subscriptionList.removeSubscription(s);
}
if (dialog.isSubscribeDialog() || dialog.isInviteDialog()) {
// IMPL_NOTE: currently we don't handle the following scenario:
//
// INVITE/200OK - INVITE/200OK - SUBSCRIBE/200OK - BYE/200OK -
// NOTIFY(terminate subscription)/200OK - (*) ...
//
// At the point (*) the dialog will be in TERMINATED state
// what is incorrect.
terminateIfNoSubscriptions();
}
} else {
setState(CONFIRMED);
if (newDialog != null) {
setDialog(newDialog);
} else {
setDialogID(newDialogId);
}
}
|
public boolean | isSameDialog(javax.microedition.sip.SipConnection sc)Does the given SipConnection belong to this dialog.
if (state == SipDialog.TERMINATED || sc == null) {
return false;
}
SipDialog dlg = sc.getDialog();
if (dlg != null) {
String id = dlg.getDialogID();
if (id != null && id.equals(dialogID)) {
return true;
}
}
return false;
|
protected void | removeSubscription(Message message)Removes the subscription matching the given response or NOTIFY
from the list of active subscriptions.
Subscription s =
dialog.subscriptionList.getMatchingSubscription(message);
if (s != null) {
dialog.subscriptionList.removeSubscription(s);
}
|
protected void | setDialog(gov.nist.siplite.stack.Dialog newDialog)Sets the current Dialog handler.
dialog = newDialog;
setDialogID(newDialog.getDialogId());
|
protected void | setDialogID(java.lang.String newDialogID)Sets the Dialog identifier.
dialogID = newDialogID;
|
protected void | setRefreshID(java.lang.String newRefreshID)Sets the current refreshID.
refreshID = newRefreshID;
|
protected void | setSipClientConnectionListener(javax.microedition.sip.SipClientConnectionListener newSipClientConnectionListener)Sets the current connection listener.
sipClientConnectionListener = newSipClientConnectionListener;
|
protected void | setState(byte newState)Changes the state of this dialog
state = newState;
|
protected void | setWaitForBye(boolean bye)Accessor for 'waitForBye' field.
waitForBye = bye;
|
protected void | terminateIfNoSubscriptions()Changes the state of this dialog to TERMINATED
if there are no active subscriptions.
if (dialog == null) {
setState(TERMINATED);
return;
}
if (dialog.subscriptionList.isEmpty() && !waitForBye) {
// TERMINATE the dialog
setState(TERMINATED);
}
|