public void setApplicationListeners(Set<IApplication> listeners) {
   int count = 0;
   Iterator<IApplication> iter = listeners.iterator();
   while (iter.hasNext()) {
     super.addListener((IApplication) iter.next());
     count++;
   }
 }
Example #2
0
  @Override
  public void streamBroadcastClose(IBroadcastStream stream) {
    String clientId = Red5.getConnectionLocal().getClient().getId();
    String userid = getUserId();
    String username = getUsername();

    log.debug(
        "{} has stopped publishing stream [{}]",
        username + "[uid=" + userid + "][clientid=" + clientId + "]",
        stream.getPublishedName());
    IConnection conn = Red5.getConnectionLocal();
    String peerId = (String) conn.getAttribute("VOICE_CONF_PEER");
    if (peerId != null) {
      super.streamPublishStart(stream);
      sipPeerManager.stopTalkStream(peerId, clientId, stream, conn.getScope());
      super.streamBroadcastClose(stream);
    }
  }
  @Override
  public void roomStop(IScope room) {
    log.debug("Stopping room [" + room.getName() + "].");
    super.roomStop(room);
    assert participantsApplication != null;
    participantsApplication.destroyRoom(room.getName());
    BigBlueButtonSession bbbSession = getBbbSession();
    assert bbbSession != null;

    /** Need to figure out if the next 2 lines should be removed. (ralam nov 25, 2010). */
    assert recorderApplication != null;
    recorderApplication.destroyRecordSession(bbbSession.getSessionName());

    log.debug("Stopped room [" + room.getName() + "].");
  }
  @Override
  public void roomDisconnect(IConnection conn) {
    String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
    int remotePort = Red5.getConnectionLocal().getRemotePort();
    String clientId = Red5.getConnectionLocal().getClient().getId();
    log.info(
        "[clientid=" + clientId + "] disconnnected from " + remoteHost + ":" + remotePort + ".");

    BigBlueButtonSession bbbSession =
        (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
    log.info(
        "User ["
            + bbbSession.getUsername()
            + "] disconnected from room ["
            + bbbSession.getRoom()
            + "]");
    super.roomDisconnect(conn);
  }
  @Override
  public void roomDisconnect(IConnection conn) {

    String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
    int remotePort = Red5.getConnectionLocal().getRemotePort();
    String clientId = Red5.getConnectionLocal().getClient().getId();

    BigBlueButtonSession bbbSession =
        (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);

    String meetingId = bbbSession.getRoom();
    String userId = bbbSession.getInternalUserID();
    String connType = getConnectionType(Red5.getConnectionLocal().getType());
    String userFullname = bbbSession.getUsername();
    String connId = Red5.getConnectionLocal().getSessionId();

    String sessionId = CONN + userId;

    Map<String, Object> logData = new HashMap<String, Object>();
    logData.put("meetingId", meetingId);
    logData.put("connType", connType);
    logData.put("connId", connId);
    logData.put("conn", remoteHost + ":" + remotePort);
    logData.put("sessionId", sessionId);
    logData.put("userId", userId);
    logData.put("username", userFullname);
    logData.put("event", "user_leaving_bbb_apps");
    logData.put("description", "User leaving BBB Apps.");

    Gson gson = new Gson();
    String logStr = gson.toJson(logData);

    boolean removeUser = userConnections.userDisconnected(userId, connId);

    if (removeUser) {
      log.info("User leaving bbb-apps: data={}", logStr);
      red5InGW.userLeft(bbbSession.getRoom(), getBbbSession().getInternalUserID(), sessionId);
    } else {
      log.info("User not leaving bbb-apps but just disconnected: data={}", logStr);
    }

    super.roomDisconnect(conn);
  }
 @Override
 public void roomStop(IScope room) {
   super.roomStop(room);
 }
 @Override
 public void appStop(IScope app) {
   super.appStop(app);
 }
 @Override
 public boolean appStart(IScope app) {
   super.appStart(app);
   connInvokerService.setAppScope(app);
   return true;
 }
 @Override
 public void roomLeave(IClient client, IScope scope) {
   super.roomLeave(client, scope);
 }
 @Override
 public void appLeave(IClient client, IScope scope) {
   super.appLeave(client, scope);
 }
 @Override
 public void appDisconnect(IConnection conn) {
   super.appDisconnect(conn);
 }
  @Override
  public boolean roomConnect(IConnection connection, Object[] params) {
    String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
    int remotePort = Red5.getConnectionLocal().getRemotePort();
    String clientId = Red5.getConnectionLocal().getClient().getId();
    log.info("[clientid=" + clientId + "] connected from " + remoteHost + ":" + remotePort + ".");

    String username = ((String) params[0]).toString();
    String role = ((String) params[1]).toString();
    String conference = ((String) params[2]).toString();

    /*
     * Convert the id to Long because it gets converted to ascii decimal
     * equivalent (i.e. zero (0) becomes 48) if we don't.
     */
    long userid = Long.parseLong(Red5.getConnectionLocal().getClient().getId());
    String sessionName = connection.getScope().getName();

    String voiceBridge = ((String) params[4]).toString();
    String room = sessionName;
    assert recorderApplication != null;
    boolean record = (Boolean) params[5];
    log.debug("record value - [" + record + "]");

    String externUserID = ((String) params[6]).toString();

    if (record == true) {
      recorderApplication.createRecordSession(sessionName);
    }

    BigBlueButtonSession bbbSession =
        new BigBlueButtonSession(
            sessionName,
            userid,
            username,
            role,
            conference,
            room,
            voiceBridge,
            record,
            externUserID);
    connection.setAttribute(Constants.SESSION, bbbSession);

    String debugInfo =
        "userid="
            + userid
            + ",username="******",role="
            + role
            + ",conference="
            + conference
            + ","
            + "session="
            + sessionName
            + ",voiceConf="
            + voiceBridge
            + ",room="
            + room
            + ",externsUserid="
            + externUserID;
    log.debug("User [{}] connected to room [{}]", debugInfo, room);
    participantsApplication.createRoom(room);
    super.roomConnect(connection, params);
    return true;
  }
 @Override
 public void appStop(IScope app) {
   log.debug("Stopping BigBlueButton version " + version);
   super.appStop(app);
 }