Ejemplo n.º 1
0
  /**
   * Returns the state of the sharing
   *
   * @return State
   * @throws RemoteException
   * @see State
   */
  public int getState() throws RemoteException {
    try {
      VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId);
      if (session == null) {
        return mPersistentStorage.getState().toInt();
      }
      SipDialogPath dialogPath = session.getDialogPath();
      if (dialogPath != null && dialogPath.isSessionEstablished()) {
        return State.STARTED.toInt();

      } else if (session.isInitiatedByRemote()) {
        if (session.isSessionAccepted()) {
          return State.ACCEPTING.toInt();
        }
        return State.INVITED.toInt();
      }
      return State.INITIATING.toInt();

    } catch (ServerApiBaseException e) {
      if (!e.shouldNotBeLogged()) {
        sLogger.error(ExceptionUtil.getFullStackTrace(e));
      }
      throw e;

    } catch (Exception e) {
      sLogger.error(ExceptionUtil.getFullStackTrace(e));
      throw new ServerApiGenericException(e);
    }
  }