Package org.asteriskjava.manager.action

Examples of org.asteriskjava.manager.action.CommandAction


        dmc.setDefaultResponseTimeout(5000);

        for (int i = 0; i < 10; i++)
        {
            dmc.login();
            response = (CommandResponse) dmc.sendAction(new CommandAction("show version"));
            assertTrue("version does not start with \"Asterisk\"", response.getResult().get(0).startsWith("Asterisk"));
            dmc.logoff();
        }
    }
View Full Code Here


        CommandResponse response;

        dmc = getDefaultManagerConnection();
        dmc.login();
       
        response = (CommandResponse) dmc.sendAction(new CommandAction("show voicemail users"));
        System.out.println("Got response: " + response.getResult());
       
        dmc.logoff();
    }
View Full Code Here

        DefaultManagerConnection managerConnection;

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

    }

    @Test
    public void testIsShowVersionCommandAction()
    {
        assertTrue(mc.isShowVersionCommandAction(new CommandAction("show version")));
        assertTrue(mc.isShowVersionCommandAction(new CommandAction("core show version")));
        assertTrue(mc.isShowVersionCommandAction(new CommandAction("core show version foo bar")));
        assertFalse(mc.isShowVersionCommandAction(new CommandAction("foo show version")));
        assertFalse(mc.isShowVersionCommandAction(new PingAction()));
    }
View Full Code Here

        sb.append(" ");
        sb.append(command);
        sb.append(" ");
        sb.append(roomNumber);

        server.sendAction(new CommandAction(sb.toString()));
    }
View Full Code Here

        }
    }

    private void populateRoom(MeetMeRoomImpl room)
    {
        final CommandAction meetMeListAction;
        final ManagerResponse response;
        final List<String> lines;
        final Collection<Integer> userNumbers = new ArrayList<Integer>(); // list of user numbers in the room

        meetMeListAction = new CommandAction(MEETME_LIST_COMMAND + " " + room.getRoomNumber());
        try
        {
            response = server.sendAction(meetMeListAction);
        }
        catch (ManagerCommunicationException e)
View Full Code Here

        {
            final ManagerResponse showVersionFilesResponse;
            final List<String> showVersionFilesResult;

            // increase timeout as output is quite large
            showVersionFilesResponse = sendAction(new CommandAction("show version files pbx.c"), defaultResponseTimeout * 2);
            if (!(showVersionFilesResponse instanceof CommandResponse))
            {
                // return early in case of permission problems
                // org.asteriskjava.manager.response.ManagerError:
                // actionId='null'; message='Permission denied'; response='Error';
                // uniqueId='null'; systemHashcode=15231583
                break;
            }

            showVersionFilesResult = ((CommandResponse) showVersionFilesResponse).getResult();
            if (showVersionFilesResult != null && showVersionFilesResult.size() > 0)
            {
                final String line1 = showVersionFilesResult.get(0);

                if (line1.startsWith("File"))
                {
                    final String rawVersion;

                    rawVersion = getRawVersion();
                    if (rawVersion != null && rawVersion.startsWith("Asterisk 1.4"))
                    {
                        return AsteriskVersion.ASTERISK_1_4;
                    }
                    return AsteriskVersion.ASTERISK_1_2;
                }
                else if (line1.contains("No such command"))
                {
                    final ManagerResponse coreShowVersionResponse = sendAction(new CommandAction("core show version"), defaultResponseTimeout * 2);

                    if (coreShowVersionResponse != null && coreShowVersionResponse instanceof CommandResponse)
                    {
                        final List<String> coreShowVersionResult = ((CommandResponse) coreShowVersionResponse).getResult();

View Full Code Here

    {
        final ManagerResponse showVersionResponse;

        try
        {
            showVersionResponse = sendAction(new CommandAction("show version"), defaultResponseTimeout * 2);
        }
        catch (Exception e)
        {
            return null;
        }
View Full Code Here

        sb.append(" ");
        sb.append(room.getRoomNumber());
        sb.append(" ");
        sb.append(userNumber);

        server.sendAction(new CommandAction(sb.toString()));
    }
View Full Code Here

        {
            final ManagerResponse showVersionFilesResponse;
            final List<String> showVersionFilesResult;

            // increase timeout as output is quite large
            showVersionFilesResponse = sendAction(new CommandAction("show version files pbx.c"), defaultResponseTimeout * 2);
            if (!(showVersionFilesResponse instanceof CommandResponse))
            {
                // return early in case of permission problems
                // org.asteriskjava.manager.response.ManagerError:
                // actionId='null'; message='Permission denied'; response='Error';
View Full Code Here

TOP

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

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.