String calleeCallId = ((CallIdHeader) h).getCallId();
SessionAssociation sa = new SessionAssociation(
"org.mobicents.slee.service.callcontrol.CallControlSbb$InitialState");
Session calleeSession = new Session(calleeCallId);
calleeSession.setSipAddress(calleeAddress);
calleeSession.setToBeCancelledClientTransaction(ct);
// The dialog for the client transaction in which the INVITE is sent
Dialog dialog = ct.getDialog();
if (dialog != null && logger.isDebugEnabled()) {
logger
.debug("Obtained dialog from ClientTransaction : automatic dialog support on");
}
if (dialog == null) {
// Automatic dialog support turned off
try {
dialog = getSipProvider().getNewDialog(ct);
if (logger.isDebugEnabled()) {
logger
.debug("Obtained dialog for INVITE request to callee with getNewDialog");
}
} catch (Exception e) {
logger.error("Error getting dialog", e);
}
}
// Get activity context from factory
ActivityContextInterface sipACI = getSipActivityContextInterfaceFactory()
.getActivityContextInterface(dialog);
ActivityContextInterface clientSipACI = getSipActivityContextInterfaceFactory()
.getActivityContextInterface(ct);
if (logger.isDebugEnabled()) {
logger
.debug("Obtained dialog in onThirdPCCTriggerEvent : callId = "
+ dialog.getCallId().getCallId());
}
dialog.terminateOnBye(true);
calleeSession.setDialog(dialog);
sa.setCalleeSession(calleeSession);
/**
* Actually callerSession is not required for this example and clean
* up is needed
*/
Session callerSession = new Session();
// Create a new caller address from caller URI specified in the
// event (the real caller address) since we need this in the next
// INVITE.
callerAddress = getSipUtils().convertURIToAddress(callerSip);
callerSession.setSipAddress(callerAddress);
// Since we don't have the client transaction for the caller yet,
// just set the to be canceled client transaction to null.
callerSession.setToBeCancelledClientTransaction(null);
sa.setCallerSession(callerSession);
// put the callId for the callee dialog in the cache
getCacheUtility().put(calleeCallId, sa);