Search in sources :

Example 1 with QueueStatusAction

use of org.asteriskjava.manager.action.QueueStatusAction in project camel by apache.

the class AsteriskProducer method process.

public void process(Exchange exchange) throws Exception {
    ManagerAction action;
    switch(endpoint.getAction()) {
        case QUEUE_STATUS:
            action = new QueueStatusAction();
            break;
        case SIP_PEERS:
            action = new SipPeersAction();
            break;
        case EXTENSION_STATE:
            action = new ExtensionStateAction((String) exchange.getIn().getHeader(AsteriskConstants.EXTENSION), (String) exchange.getIn().getHeader(AsteriskConstants.CONTEXT));
            break;
        default:
            throw new IllegalStateException("Unknown action");
    }
    LOG.debug("Asterisk, send action {} ", endpoint.getAction());
    ManagerResponse response = endpoint.sendAction(action);
    exchange.getIn().setBody(response);
}
Also used : ManagerResponse(org.asteriskjava.manager.response.ManagerResponse) ManagerAction(org.asteriskjava.manager.action.ManagerAction) QueueStatusAction(org.asteriskjava.manager.action.QueueStatusAction) SipPeersAction(org.asteriskjava.manager.action.SipPeersAction) ExtensionStateAction(org.asteriskjava.manager.action.ExtensionStateAction)

Aggregations

ExtensionStateAction (org.asteriskjava.manager.action.ExtensionStateAction)1 ManagerAction (org.asteriskjava.manager.action.ManagerAction)1 QueueStatusAction (org.asteriskjava.manager.action.QueueStatusAction)1 SipPeersAction (org.asteriskjava.manager.action.SipPeersAction)1 ManagerResponse (org.asteriskjava.manager.response.ManagerResponse)1