/**
   * Receive a new video sharing invitation
   *
   * @param session Video sharing session
   */
  public void receiveVideoSharingInvitation(VideoStreamingSession session) {
    if (logger.isActivated()) {
      logger.info("Receive video sharing invitation from " + session.getRemoteContact());
    }

    // Extract number from contact
    String number = PhoneUtils.extractNumberFromUri(session.getRemoteContact());
    VideoContent content = (VideoContent) session.getContent();

    // Update rich call history
    RichCall.getInstance()
        .addCall(
            number,
            session.getSessionID(),
            RichCallData.EVENT_INCOMING,
            content,
            RichCallData.STATUS_STARTED);

    // Add session in the list
    VideoSharingSession sessionApi = new VideoSharingSession(session);
    addVideoSharingSession(sessionApi);

    // Broadcast intent related to the received invitation
    Intent intent = new Intent(RichCallApiIntents.VIDEO_SHARING_INVITATION);
    intent.putExtra("contact", number);
    intent.putExtra("contactDisplayname", session.getRemoteDisplayName());
    intent.putExtra("sessionId", session.getSessionID());
    intent.putExtra("videotype", content.getEncoding());
    intent.putExtra("videowidth", content.getWidth());
    intent.putExtra("videoheight", content.getHeight());
    AndroidFactory.getApplicationContext().sendBroadcast(intent);
  }
  /**
   * Initiate a live video sharing session
   *
   * @param contact Contact
   * @param player Media player
   * @throws ServerApiException
   */
  public IVideoSharingSession initiateLiveVideoSharing(String contact, IVideoPlayer player)
      throws ServerApiException {
    if (logger.isActivated()) {
      logger.info("Initiate a live video session with " + contact);
    }

    // Check permission
    ServerApiUtils.testPermission();

    // Test IMS connection
    ServerApiUtils.testIms();

    try {
      // Initiate a new session
      VideoStreamingSession session =
          Core.getInstance().getRichcallService().initiateLiveVideoSharingSession(contact, player);

      // Update rich call history
      RichCall.getInstance()
          .addCall(
              contact,
              session.getSessionID(),
              RichCallData.EVENT_OUTGOING,
              session.getContent(),
              RichCallData.STATUS_STARTED);

      // Add session in the list
      VideoSharingSession sessionApi = new VideoSharingSession(session);
      addVideoSharingSession(sessionApi);
      return sessionApi;
    } catch (Exception e) {
      if (logger.isActivated()) {
        logger.error("Unexpected error", e);
      }
      throw new ServerApiException(e.getMessage());
    }
  }