コード例 #1
0
  /**
   * Sends command to retrieve phones list.
   *
   * @return is command successful.
   */
  @SuppressWarnings("unchecked")
  private boolean getPhoneList() {
    JSONObject obj = new JSONObject();
    try {
      obj.put("class", "phones");
      obj.put("function", "getlist");

      return send(obj);
    } catch (Exception e) {
      logger.error("Error retrieving phones");
      return false;
    }
  }
コード例 #2
0
  /**
   * Send needed command for features.
   *
   * @param astid param from previous command.
   * @param xivoUserId param from previous command.
   * @return is command successful.
   */
  @SuppressWarnings("unchecked")
  private boolean sendFeatures(String astid, String xivoUserId) {
    if (connection == null || astid == null || xivoUserId == null) return false;

    JSONObject obj = new JSONObject();
    try {
      obj.put("class", "featuresget");
      obj.put("userid", astid + "/" + xivoUserId);

      return send(obj);
    } catch (Exception e) {
      logger.error("Error send features get command", e);
      return false;
    }
  }
コード例 #3
0
  /**
   * Sends password command.
   *
   * @param sessionId the session id from previous command.
   * @param password the password to authorize.
   * @return is command successful.
   */
  @SuppressWarnings("unchecked")
  private boolean authorize(String sessionId, String password) {
    if (connection == null || sessionId == null || password == null) return false;

    JSONObject obj = new JSONObject();
    try {
      obj.put("class", "login_pass");
      obj.put("hashedpassword", Sha1Crypto.encode(sessionId + ":" + password));

      return send(obj);
    } catch (Exception e) {
      logger.error("Error login with password", e);
      return false;
    }
  }
コード例 #4
0
  /**
   * Sends login command.
   *
   * @param capalistParam param from previous command.
   * @return is command successful.
   */
  @SuppressWarnings("unchecked")
  private boolean sendCapas(JSONArray capalistParam) {
    if (connection == null || capalistParam == null || capalistParam.isEmpty()) return false;

    JSONObject obj = new JSONObject();
    try {
      obj.put("class", "login_capas");
      obj.put("capaid", capalistParam.get(0));
      obj.put("lastconnwins", "false");
      obj.put("loginkind", "agent");
      obj.put("state", "");

      return send(obj);
    } catch (Exception e) {
      logger.error("Error login", e);
      return false;
    }
  }
コード例 #5
0
  /**
   * Sends login command.
   *
   * @param username the username.
   * @return is command successful.
   */
  @SuppressWarnings("unchecked")
  private boolean login(String username) {
    if (connection == null || username == null) return false;

    JSONObject obj = new JSONObject();
    try {
      obj.put("class", "login_id");
      obj.put("company", "Jitsi");

      String os = "x11";
      if (OSUtils.IS_WINDOWS) os = "win";
      else if (OSUtils.IS_MAC) os = "mac";
      obj.put("ident", username + "@" + os);

      obj.put("userid", username);
      obj.put("version", "9999");
      obj.put("xivoversion", "1.1");

      return send(obj);
    } catch (Exception e) {
      logger.error("Error login", e);
      return false;
    }
  }