/** * Capabilities update notification has been received * * @param contact Contact * @param capabilities Capabilities */ public void handleCapabilitiesNotification(String contact, Capabilities capabilities) { if (logger.isActivated()) { logger.debug( "Handle capabilities update notification for " + contact + " (" + capabilities.toString() + ")"); } // Extract number from contact String number = PhoneUtils.extractNumberFromUri(contact); // Broadcast intent containing the new capabilities Intent intent = new Intent(CapabilityApiIntents.CONTACT_CAPABILITIES); intent.putExtra("contact", number); intent.putExtra("capabilities", capabilities); getApplicationContext().sendBroadcast(intent); // TODO keep only one intent here // Send GSMA UI Connector intent Intent intentGsma = new Intent(GsmaUiConnector.ACTION_CAPABILITIES_CHANGED); intentGsma.putExtra(GsmaUiConnector.EXTRA_CONTACT, number); intentGsma.putExtra(GsmaUiConnector.EXTRA_CAPABILITY_CHAT, capabilities.isImSessionSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_FT, capabilities.isFileTransferSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_IMAGE_SHARE, capabilities.isImageSharingSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_VIDEO_SHARE, capabilities.isVideoSharingSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_GEOLOCATION_PUSH, capabilities.isGeolocationPushSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_CS_VIDEO, capabilities.isCsVideoSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_PRESENCE_DISCOVERY, capabilities.isPresenceDiscoverySupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_SOCIAL_PRESENCE, capabilities.isSocialPresenceSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_IPVOICECALL, capabilities.isIPVoiceCallSupported()); intentGsma.putExtra( GsmaUiConnector.EXTRA_CAPABILITY_IPVIDEOCALL, capabilities.isIPVideoCallSupported()); intentGsma.putStringArrayListExtra( GsmaUiConnector.EXTRA_CAPABILITY_EXTENSIONS, capabilities.getSupportedExtensions()); getApplicationContext().sendBroadcast(intentGsma); }
/** * Receive a capability request (options procedure) * * @param options Received options message */ public void receiveCapabilityRequest(SipRequest options) { String contact = SipUtils.getAssertedIdentity(options); if (logger.isActivated()) { logger.debug("OPTIONS request received during a call from " + contact); } try { // Create 200 OK response String ipAddress = getImsModule().getCurrentNetworkInterface().getNetworkAccess().getIpAddress(); boolean richcall = getImsModule().getCallManager().isRichcallSupportedWith(contact); SipResponse resp = SipMessageFactory.create200OkOptionsResponse( options, getImsModule().getSipManager().getSipStack().getLocalContact(), CapabilityUtils.getSupportedFeatureTags(richcall), CapabilityUtils.buildSdp(ipAddress, richcall)); // Send 200 OK response getImsModule().getSipManager().sendSipResponse(resp); } catch (Exception e) { if (logger.isActivated()) { logger.error("Can't send 200 OK for OPTIONS", e); } } // Extract capabilities from the request Capabilities capabilities = CapabilityUtils.extractCapabilities(options); logger.debug("capabilities = " + capabilities); if (capabilities.isImSessionSupported()) { // The contact is RCS capable ContactsManager.getInstance() .setContactCapabilities( contact, capabilities, ContactInfo.RCS_CAPABLE, ContactInfo.REGISTRATION_STATUS_ONLINE); /** M: Added to fix the issue that RCS-e icon does not display in contact list of People.@{ */ capabilities.setRcseContact(true); /** @} */ } else { // The contact is not RCS ContactsManager.getInstance() .setContactCapabilities( contact, capabilities, ContactInfo.NOT_RCS, ContactInfo.REGISTRATION_STATUS_UNKNOWN); /** M: Added to fix the issue that RCS-e icon does not display in contact list of People.@{ */ capabilities.setRcseContact(false); /** @} */ } /** M: Added to fix the issue that RCS-e icon does not display in contact list of People.@{ */ if (logger.isActivated()) { logger.debug( "receiveCapabilityRequest setRcseContact contact: " + contact + " " + capabilities.isImSessionSupported()); } /** @} */ // Notify listener getImsModule().getCore().getListener().handleCapabilitiesNotification(contact, capabilities); }