Package org.asteriskjava.manager.response

Examples of org.asteriskjava.manager.response.ManagerResponse


            {
                expectedResponseClasses.remove(internalActionId);
            }
        }

        final ManagerResponse response = responseBuilder.buildResponse(responseClass, buffer);

        if (response != null)
        {
            response.setDateReceived(DateUtil.getDate());
        }

        return response;
    }
View Full Code Here


        sendPauseAction(new QueuePauseAction(location, paused));
    }

    private void sendPauseAction(QueuePauseAction action) throws ManagerCommunicationException, NoSuchInterfaceException
    {
        final ManagerResponse response = server.sendAction(action);

        if (response instanceof ManagerError)
        {
            //Message: Interface not found
            if (action.getQueue() != null)
            {
                //Message: Interface not found
                throw new NoSuchInterfaceException("Unable to change paused state for '" + action.getInterface() + "' on '" +
                        action.getQueue() + "': " + response.getMessage());
            }
            else
            {
                throw new NoSuchInterfaceException("Unable to change paused state for '" + action.getInterface() +
                        "' on all queues: " + response.getMessage());
            }
        }
    }
View Full Code Here

        if (penalty < 0)
        {
            throw new IllegalArgumentException("Penalty must not be negative");
        }

        final ManagerResponse response = server.sendAction(
                new QueuePenaltyAction(location, penalty, queue.getName()));
        if (response instanceof ManagerError)
        {
            throw new InvalidPenaltyException("Unable to set penalty for '" + location + "' on '" +
                    queue.getName() + "': " + response.getMessage());
        }
    }
View Full Code Here

    }

    public void hangup(HangupCause cause) throws ManagerCommunicationException, NoSuchChannelException
    {
        final HangupAction action;
        final ManagerResponse response;

        if (cause != null)
        {
            setVariable(CAUSE_VARIABLE_NAME, Integer.toString(cause.getCode()));
            action = new HangupAction(name, cause.getCode());
        }
        else
        {
            action = new HangupAction(name);
        }

        response = server.sendAction(action);
        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
    }
View Full Code Here

        }
    }

    public void setAbsoluteTimeout(int seconds) throws ManagerCommunicationException, NoSuchChannelException
    {
        ManagerResponse response;

        response = server.sendAction(new AbsoluteTimeoutAction(name, seconds));
        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
    }
View Full Code Here

    }

    public void redirect(String context, String exten, int priority) throws ManagerCommunicationException,
            NoSuchChannelException
    {
        ManagerResponse response;

        response = server.sendAction(new RedirectAction(name, context, exten, priority));
        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
    }
View Full Code Here

    }

    public void redirectBothLegs(String context, String exten, int priority) throws ManagerCommunicationException,
            NoSuchChannelException
    {
        ManagerResponse response;

        if (linkedChannel == null)
        {
            response = server.sendAction(new RedirectAction(name, context, exten, priority));
        }
        else
        {
            response = server.sendAction(new RedirectAction(name, linkedChannel.getName(), context, exten, priority,
                    context, exten, priority));
        }

        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
    }
View Full Code Here

        }
    }

    public String getVariable(String variable) throws ManagerCommunicationException, NoSuchChannelException
    {
        ManagerResponse response;
        String value;

        synchronized (variables)
        {

            value = variables.get(variable);
            if (value != null)
            {
                return value;
            }

            response = server.sendAction(new GetVarAction(name, variable));
            if (response instanceof ManagerError)
            {
                throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
            }
            value = response.getAttribute("Value");
            if (value == null)
            {
                value = response.getAttribute(variable); // for Asterisk 1.0.x
            }

            variables.put(variable, value);
        }
        return value;
View Full Code Here

        return value;
    }

    public void setVariable(String variable, String value) throws ManagerCommunicationException, NoSuchChannelException
    {
        ManagerResponse response;

        response = server.sendAction(new SetVarAction(name, variable, value));
        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
        synchronized (variables)
        {
            variables.put(variable, value);
        }
View Full Code Here

        }
    }

    public void playDtmf(String digit) throws ManagerCommunicationException, NoSuchChannelException, IllegalArgumentException
    {
        ManagerResponse response;

        if (digit == null)
        {
            throw new IllegalArgumentException("DTMF digit to send must not be null");
        }

        response = server.sendAction(new PlayDtmfAction(name, digit));
        if (response instanceof ManagerError)
        {
            throw new NoSuchChannelException("Channel '" + name + "' is not available: " + response.getMessage());
        }
    }
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.