Package org.asteriskjava.manager.response

Examples of org.asteriskjava.manager.response.ManagerResponse


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


  }

  public String get(String confno) {
    String pin = null;
    DbGetAction da = new DbGetAction(ASTERISK_OM_FAMILY, getKey(confno));
    ManagerResponse r = exec(da);
    if (r != null) {
      pin = r.getResponse();
    }
    return pin;
  }
View Full Code Here

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

  }

  public String get(String confno) {
    String pin = null;
    DbGetAction da = new DbGetAction(ASTERISK_OM_FAMILY, getKey(confno));
    ManagerResponse r = exec(da);
    if (r != null) {
      pin = r.getResponse();
    }
    return pin;
  }
View Full Code Here

        managerConnection = getDefaultManagerConnection();
        managerConnection.login();

        CommandAction commandAction = new CommandAction("sip show peers");
        ManagerResponse response = managerConnection.sendAction(commandAction);
        if (response instanceof CommandResponse)
        {
            for (String item : ((CommandResponse) response).getResult())
            {
                System.out.println(item);
View Full Code Here

            }
        });
        dmc.login();
        System.out.println("Dial 1296");
        Thread.sleep(5000);
        ManagerResponse response = dmc.sendAction(new AgiAction(
                "IAX2/iax0-cgn_reucon_net-2",
                "EXEC Playback tt-monkeysintro",
                "myCommandId"));
        System.out.println(response);
View Full Code Here

    }

    @Test
    public void testBuildResponse()
    {
        ManagerResponse response;

        attributes.put("response", "Success");

        response = responseBuilder.buildResponse(ManagerResponse.class, attributes);
        assertEquals("Response of wrong type", ManagerResponse.class, response.getClass());
        assertEquals("Response not set correctly", "Success", response.getResponse());
    }
View Full Code Here

    }

    @Test
    public void testBuildResponseWithoutResponseClass()
    {
        ManagerResponse response;

        attributes.put("response", "Success");

        response = responseBuilder.buildResponse(null, attributes);
        assertEquals("Response of wrong type", ManagerResponse.class, response.getClass());
        assertEquals("Response not set correctly", "Success", response.getResponse());
    }
View Full Code Here

    }

    @Test
    public void testBuildError()
    {
        ManagerResponse response;

        attributes.put("response", "Error");
        attributes.put("message", "Missing action in request");

        response = responseBuilder.buildResponse(ManagerResponse.class, attributes);
        assertEquals("Response of wrong type", ManagerError.class, response.getClass());
        assertEquals("Message not set correctly", "Missing action in request", response.getMessage());
    }
View Full Code Here

    }

    @Test
    public void testBuildErrorWithActionId()
    {
        ManagerResponse response;

        attributes.put("response", "Error");
        attributes.put("actionid", "1234");
        attributes.put("message", "Missing action in request");

        response = responseBuilder.buildResponse(ManagerResponse.class, attributes);
        assertEquals("ActionId not set correctly", "1234", response.getActionId());
    }
View Full Code Here

TOP

Related Classes of org.asteriskjava.manager.response.ManagerResponse

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.