Package org.asteriskjava.manager

Examples of org.asteriskjava.manager.ResponseEvents


  public Integer countUsers(String confno) {
    if (confno == null) {
      return null;
    }
    ConfbridgeListAction da = new ConfbridgeListAction(confno);
    ResponseEvents r = execEvent(da);
    if (r != null) {
      log.debug("SipDao::countUsers size == " + r.getEvents().size());
      // "- 1" here means: ListComplete event
      return r.getEvents().size() - 1; // TODO check if was successfull
    }
    return 0;
  }
View Full Code Here


      log.warn("There is no Asterisk configured");
      return null;
    }
    try {
      connection.login("on");
      ResponseEvents r = connection.sendEventGeneratingAction(action);
      connection.logoff();
      if (log.isDebugEnabled() && r != null) {
        log.debug(r.getResponse().toString());
      }
      return (r == null || r.getResponse() instanceof ManagerError) ? null : r;
    } catch (Exception e) {
      if (log.isDebugEnabled()) {
        log.error("Error while executing EventGeneratingAction: " + action, e);
      }
    }
View Full Code Here

      log.warn("There is no Asterisk configured");
      return null;
    }
    try {
      connection.login("on");
      ResponseEvents r = connection.sendEventGeneratingAction(action);
      connection.logoff();
      if (log.isDebugEnabled() && r != null) {
        log.debug(r.getResponse().toString());
      }
      return (r == null || r.getResponse() instanceof ManagerError) ? null : r;
    } catch (Exception e) {
      if (log.isDebugEnabled()) {
        log.error("Error while executing EventGeneratingAction: " + action, e);
      }
    }
View Full Code Here

  public Integer countUsers(String confno) {
    if (confno == null) {
      return null;
    }
    ConfbridgeListAction da = new ConfbridgeListAction(confno);
    ResponseEvents r = execEvent(da);
    if (r != null) {
      log.debug("SipDao::countUsers size == " + r.getEvents().size());
      // "- 1" here means: ListComplete event
      return r.getEvents().size() - 1; // TODO check if was successfull
    }
    return 0;
  }
View Full Code Here

     * @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);
View Full Code Here

    ResponseEvents sendEventGeneratingAction(EventGeneratingAction action, long timeout)
            throws ManagerCommunicationException
    {
        ManagerConnection connection;
        ResponseEvents responseEvents;

        connection = get();
        try
        {
            if (timeout > 0)
View Full Code Here

        initialize(null);
    }

    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);
            }
View Full Code Here

        this.queues = new HashMap<String, AsteriskQueueImpl>();
    }

    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);
            }
View Full Code Here

        initialize(null);
    }

    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);
            }
View Full Code Here

        this.queues = new HashMap<String, AsteriskQueueImpl>();
    }

    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);
            }
View Full Code Here

TOP

Related Classes of org.asteriskjava.manager.ResponseEvents

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.