/** Terminate session */ public void terminateSessionWithoutBy() { if (dialogPath.isSessionTerminated()) { // Already terminated return; } // Stop session timer getSessionTimerManager().stop(); // Update dialog path dialogPath.sessionTerminated(); // Unblock semaphore (used for terminating side only) synchronized (waitUserAnswer) { waitUserAnswer.notifyAll(); } }
/** Terminate session */ public void terminateSession() { if (logger.isActivated()) { logger.debug("Terminate the session"); } if (dialogPath.isSessionTerminated()) { // Already terminated return; } // Stop session timer getSessionTimerManager().stop(); // Update dialog path dialogPath.sessionTerminated(); // Unblock semaphore (used for terminating side only) synchronized (waitUserAnswer) { waitUserAnswer.notifyAll(); } try { // Terminate the session if (dialogPath.isSigEstablished()) { // Increment the Cseq number of the dialog path getDialogPath().incrementCseq(); // Send BYE without waiting a response getImsService().getImsModule().getSipManager().sendSipBye(getDialogPath()); } else { // Send CANCEL without waiting a response getImsService().getImsModule().getSipManager().sendSipCancel(getDialogPath()); } if (logger.isActivated()) { logger.debug("SIP session has been terminated"); } } catch (Exception e) { if (logger.isActivated()) { logger.error("Session termination has failed", e); } } }
/** * Create terminating dialog path * * @param invite Incoming invite */ public void createTerminatingDialogPath(SipRequest invite) { // Set the call-id String callId = invite.getCallId(); // Set target String target = invite.getContactURI(); // Set local party String localParty = invite.getTo(); // Set remote party String remoteParty = invite.getFrom(); // Get the CSeq value long cseq = invite.getCSeq(); // Set the route path with the Record-Route Vector<String> route = SipUtils.routeProcessing(invite, false); // Create a dialog path dialogPath = new SipDialogPath( getImsService().getImsModule().getSipManager().getSipStack(), callId, cseq, target, localParty, remoteParty, route); // Set the INVITE request dialogPath.setInvite(invite); // Set the remote tag dialogPath.setRemoteTag(invite.getFromTag()); // Set the remote content part dialogPath.setRemoteContent(invite.getContent()); // Set the session timer expire dialogPath.setSessionExpireTime(invite.getSessionTimerExpire()); }
/** Create originating dialog path */ public void createOriginatingDialogPath(String callId) { logger.debug("createOriginatingDialogPath(), callId = " + callId); // Set the route path Vector<String> route = getImsService().getImsModule().getSipManager().getSipStack().getServiceRoutePath(); // Create a dialog path dialogPath = new SipDialogPath( getImsService().getImsModule().getSipManager().getSipStack(), callId, INIT_CSEQUENCE_NUMBER, getRemoteContact(), ImsModule.IMS_USER_PROFILE.getPublicUri(), getRemoteContact(), route); // Set the authentication agent in the dialog path dialogPath.setAuthenticationAgent(getAuthenticationAgent()); }
/** Create originating dialog path */ public void createOriginatingDialogPath() { // Set Call-Id String callId = getImsService().getImsModule().getSipManager().getSipStack().generateCallId(); // Set the route path Vector<String> route = getImsService().getImsModule().getSipManager().getSipStack().getServiceRoutePath(); // Create a dialog path dialogPath = new SipDialogPath( getImsService().getImsModule().getSipManager().getSipStack(), callId, 1, getRemoteContact(), ImsModule.IMS_USER_PROFILE.getPublicAddress(), getRemoteContact(), route); // Set the authentication agent in the dialog path dialogPath.setAuthenticationAgent(getAuthenticationAgent()); }
/** * Handle 403 error. First do re-register then send request again * * @param request The request was responded with 403 */ public void handle403Forbidden(SipResponse resp) { if (logger.isActivated()) { logger.debug("handle403Forbidden() entry"); } boolean isRegistered = imsService .getImsModule() .getCurrentNetworkInterface() .getRegistrationManager() .registration(); if (logger.isActivated()) { logger.debug("re-register isRegistered: " + isRegistered); } if (isRegistered) { String callId = dialogPath.getCallId(); SipRequest invite = createSipInvite(callId); if (invite != null) { try { sendInvite(invite); } catch (SipException e) { if (logger.isActivated()) { logger.debug("re send sip request failed."); } e.printStackTrace(); } } else { if (logger.isActivated()) { logger.debug("handle403Forbidden() invite is null"); } } } if (logger.isActivated()) { logger.debug("handle403Forbidden() exit"); } handleDefaultError(resp); }
/** Create originating dialog path */ public void createOriginatingDialogPath() { // Set Call-Id String callId = getImsService().getImsModule().getSipManager().getSipStack().generateCallId(); // Set the route path Vector<String> route = getImsService().getImsModule().getSipManager().getSipStack().getServiceRoutePath(); // Create a dialog path dialogPath = new SipDialogPath( getImsService().getImsModule().getSipManager().getSipStack(), callId, /** M: Added to resolve the rich call 403 error.@{ */ INIT_CSEQUENCE_NUMBER, /** @} */ getRemoteContact(), ImsModule.IMS_USER_PROFILE.getPublicUri(), getRemoteContact(), route); // Set the authentication agent in the dialog path dialogPath.setAuthenticationAgent(getAuthenticationAgent()); }
/** * Terminate session * * @param reason Reason */ public void terminateSession(int reason) { if (logger.isActivated()) { logger.debug("Terminate the session (reason " + reason + ")"); } if ((dialogPath == null) || dialogPath.isSessionTerminated()) { // Already terminated return; } // Stop session timer getSessionTimerManager().stop(); // Update dialog path if (reason == ImsServiceSession.TERMINATION_BY_USER) { dialogPath.sessionTerminated(200, "Call completed"); } else { dialogPath.sessionTerminated(); } // Unblock semaphore (used for terminating side only) synchronized (waitUserAnswer) { waitUserAnswer.notifyAll(); } try { // Terminate the session if (dialogPath.isSigEstablished()) { // Increment the Cseq number of the dialog path getDialogPath().incrementCseq(); // Send BYE without waiting a response getImsService().getImsModule().getSipManager().sendSipBye(getDialogPath()); } else { // Send CANCEL without waiting a response getImsService().getImsModule().getSipManager().sendSipCancel(getDialogPath()); } if (logger.isActivated()) { logger.debug("SIP session has been terminated"); } } catch (Exception e) { if (logger.isActivated()) { logger.error("Session termination has failed", e); } } if (this.getDialogPath().isSigEstablished() && reason != ImsServiceSession.TERMINATION_BY_USER) { for (int j = 0; j < getListeners().size(); j++) { final ImsSessionListener listener = getListeners().get(j); if (listener instanceof FileSharingSessionListener) { AsyncTask.execute( new Runnable() { @Override public void run() { try { Thread.sleep(3 * 1000); } catch (InterruptedException e) { // Nothing to do } ((FileSharingSessionListener) listener) .handleTransferError( new FileSharingError(FileSharingError.MEDIA_TRANSFER_FAILED)); } }); } } } }