Package org.asteriskjava.manager.action

Examples of org.asteriskjava.manager.action.StatusAction


            public void onManagerEvent(ManagerEvent event)
            {
                System.out.println("Got event: " + event);
            }
        });
        dmc.sendAction(new StatusAction());

        // wait for 3 seconds to receive events
        Thread.sleep(3000);
        dmc.logoff();
    }
View Full Code Here


                    dmc.sendAction(a);
                    succeeded.getAndIncrement();
                    */
                   
                    ResponseEvents responseEvents;
                    StatusAction a = new StatusAction();
                    a.setActionId(actionId);
                    responseEvents = dmc.sendEventGeneratingAction(a);
                    if (responseEvents.getEvents().size() == 2)
                    {
                        succeeded.getAndIncrement();
                    }
View Full Code Here

    @Test
    public void testSendActionWithoutSocket() throws Exception
    {
        try
        {
            managerWriter.sendAction(new StatusAction(), null);
            fail("Must throw IllegalStateException");
        }
        catch (IllegalStateException e)
        {
            assertTrue("Exception must be of type IllegalStateException", e instanceof IllegalStateException);
View Full Code Here

        socketConnectionFacade.write("action: Status\r\n\r\n");
        socketConnectionFacade.flush();
        replay(socketConnectionFacade);

        managerWriter.setSocket(socketConnectionFacade);
        managerWriter.sendAction(new StatusAction(), null);
        verify(socketConnectionFacade);
    }
View Full Code Here

    }

    @Test
    public void testSendActionWhenNotConnected() throws Exception
    {
        StatusAction statusAction;

        statusAction = new StatusAction();

        try
        {
            mc.sendAction(statusAction);
            fail("No IllegalStateException thrown");
View Full Code Here

    }

    @Test
    public void testSendAction() throws Exception
    {
        StatusAction statusAction;
        ManagerResponse response;

        statusAction = new StatusAction();
        statusAction.setActionId("123");

        // fake connect
        mc.connect();
        mc.setState(ManagerConnectionState.CONNECTED);
        response = mc.sendAction(statusAction);

        assertEquals("incorrect actionId in action", "123", statusAction.getActionId());
        assertEquals("incorrect actionId in response", "123", response.getActionId());
        assertEquals("incorrect response", "Success", response.getResponse());

        assertEquals("other actions not sent 1 time", 1, mockWriter.otherActionsSent);
    }
View Full Code Here

    }

    @Test
    public void testSendActionTimeout() throws Exception
    {
        StatusAction statusAction;

        statusAction = new StatusAction();
        statusAction.setActionId("123");

        mc.setDefaultResponseTimeout(200);
        // fake connect
        mc.connect();
        mc.setState(ManagerConnectionState.CONNECTED);
View Full Code Here

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

    } catch (Exception e) {
      logger.error("Login to Asterisk Manager-Interface on {} throws exception: {}", host, e.toString());
    }
   
    try {
      AsteriskBinding.managerConnection.sendAction(new StatusAction());
    } catch (Exception e) {
      logger.error("registering for status update throws exception: {}", e.toString());
    }
  }
View Full Code Here

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

TOP

Related Classes of org.asteriskjava.manager.action.StatusAction

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.