void initialize() throws ManagerCommunicationException {
    ResponseEvents re;

    try {
      re = server.sendEventGeneratingAction(new QueueStatusAction());
    } catch (ManagerCommunicationException e) {
      final Throwable cause = e.getCause();

      if (cause instanceof EventTimeoutException) {
        // this happens with Asterisk 1.0.x as it doesn't send a
        // QueueStatusCompleteEvent
        re = ((EventTimeoutException) cause).getPartialResult();
      } else {
        throw e;
      }
    }

    for (ManagerEvent event : re.getEvents()) {
      if (event instanceof QueueParamsEvent) {
        handleQueueParamsEvent((QueueParamsEvent) event);
      } else if (event instanceof QueueMemberEvent) {
        handleQueueMemberEvent((QueueMemberEvent) event);
      } else if (event instanceof QueueEntryEvent) {
        handleQueueEntryEvent((QueueEntryEvent) event);
      }
    }
  }
  /**
   * Method to ask for a Queue data update
   *
   * @author Octavio Luna
   * @param queue
   * @throws ManagerCommunicationException
   */
  void updateQueue(String queue) throws ManagerCommunicationException {
    ResponseEvents re;

    try {
      QueueStatusAction queueStatusAction = new QueueStatusAction();
      queueStatusAction.setQueue(queue);
      re = server.sendEventGeneratingAction(queueStatusAction);
    } catch (ManagerCommunicationException e) {
      final Throwable cause = e.getCause();

      if (cause instanceof EventTimeoutException) {
        // this happens with Asterisk 1.0.x as it doesn't send a
        // QueueStatusCompleteEvent
        re = ((EventTimeoutException) cause).getPartialResult();
      } else {
        throw e;
      }
    }

    for (ManagerEvent event : re.getEvents()) {
      // 101119 OLB: solo actualizamos el QUEUE por ahora
      if (event instanceof QueueParamsEvent) {
        handleQueueParamsEvent((QueueParamsEvent) event);
      } else if (event instanceof QueueMemberEvent) {
        handleQueueMemberEvent((QueueMemberEvent) event);
      } else if (event instanceof QueueEntryEvent) {
        handleQueueEntryEvent((QueueEntryEvent) event);
      }
    }
  }
  /**
   * Retrieves all agents registered at Asterisk server by sending an AgentsAction.
   *
   * @throws ManagerCommunicationException if communication with Asterisk server fails.
   */
  void initialize() throws ManagerCommunicationException {
    ResponseEvents re;

    re = server.sendEventGeneratingAction(new AgentsAction());

    for (ManagerEvent event : re.getEvents()) {
      if (event instanceof AgentsEvent) {
        logger.info(event);
        handleAgentsEvent((AgentsEvent) event);
      }
    }
  }
  void initialize(List<String> variables) throws ManagerCommunicationException {
    ResponseEvents re;

    disconnected();
    StatusAction sa = new StatusAction();
    sa.setVariables(variables);
    re = server.sendEventGeneratingAction(sa);
    for (ManagerEvent event : re.getEvents()) {
      if (event instanceof StatusEvent) {
        handleStatusEvent((StatusEvent) event);
      }
    }
  }