Пример #1
0
  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);
      }
    }
  }
Пример #2
0
  /**
   * 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);
      }
    }
  }
Пример #3
0
  /**
   * 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);
      }
    }
  }
Пример #4
0
  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);
      }
    }
  }