/** * Receive CANCEL request * * @param cancel CANCEL request */ public void receiveCancel(SipRequest cancel) { if (logger.isActivated()) { logger.info("Receive a CANCEL message from the remote"); } if (getDialogPath().isSigEstablished()) { if (logger.isActivated()) { logger.info( "Ignore the received CANCEL message from the remote (session already established)"); } return; } // Close media session closeMediaSession(); // Update dialog path getDialogPath().sessionCancelled(); // Send a 487 Request terminated try { if (logger.isActivated()) { logger.info("Send 487 Request terminated"); } SipResponse terminatedResp = SipMessageFactory.createResponse( getDialogPath().getInvite(), IdGenerator.getIdentifier(), 487); getImsService().getImsModule().getSipManager().sendSipResponse(terminatedResp); } catch (Exception e) { if (logger.isActivated()) { logger.error("Can't send 487 error response", e); } } // Remove the current session getImsService().removeSession(this); // Notify listeners for (int i = 0; i < getListeners().size(); i++) { getListeners().get(i).handleSessionTerminatedByRemote(); } // Request capabilities to the remote getImsService() .getImsModule() .getCapabilityService() .requestContactCapabilities(getDialogPath().getRemoteParty()); }
/** Send the file transfer information */ private void sendFileTransferInfo() { // Send File transfer Info String mime = CpimMessage.MIME_TYPE; String from = ImsModule.IMS_USER_PROFILE.getPublicUri(); String to = ChatUtils.ANOMYNOUS_URI; String msgId = IdGenerator.getIdentifier(); // Send file info in CPIM message String content = ChatUtils.buildCpimMessageWithImdn( from, to, msgId, fileInfo, FileTransferHttpInfoDocument.MIME_TYPE); // Send content chatSession.sendDataChunks(ChatUtils.generateMessageId(), content, mime); RichMessaging.getInstance() .updateFileTransferChatId(getSessionID(), chatSession.getContributionID(), msgId); }