Search in sources :

Example 1 with ManagerError

use of org.asteriskjava.manager.response.ManagerError in project openmeetings by apache.

the class SipDao method execEvent.

private ResponseEvents execEvent(EventGeneratingAction action) {
    if (factory == null) {
        log.warn("There is no Asterisk configured");
        return null;
    }
    ManagerConnection con = getConnection();
    try {
        con.login("on");
        ResponseEvents r = con.sendEventGeneratingAction(action);
        if (r != null) {
            log.debug(r.getResponse().toString());
        }
        return (r == null || r.getResponse() instanceof ManagerError) ? null : r;
    } catch (Exception e) {
        log.error("Error while executing EventGeneratingAction: " + action, e);
    } finally {
        try {
            con.logoff();
        } catch (Exception e) {
        // no-op
        }
    }
    return null;
}
Also used : ManagerError(org.asteriskjava.manager.response.ManagerError) ManagerConnection(org.asteriskjava.manager.ManagerConnection) DefaultManagerConnection(org.asteriskjava.manager.DefaultManagerConnection) ResponseEvents(org.asteriskjava.manager.ResponseEvents)

Example 2 with ManagerError

use of org.asteriskjava.manager.response.ManagerError in project openmeetings by apache.

the class SipDao method exec.

private ManagerResponse exec(ManagerAction action) {
    if (factory == null) {
        log.warn("There is no Asterisk configured");
        return null;
    }
    ManagerConnection con = getConnection();
    try {
        con.login();
        ManagerResponse r = con.sendAction(action);
        if (r != null) {
            log.debug(r.toString());
        }
        return (r instanceof ManagerError) ? null : r;
    } catch (Exception e) {
        log.error("Error while executing ManagerAction: " + action, e);
    } finally {
        try {
            con.logoff();
        } catch (Exception e) {
        // no-op
        }
    }
    return null;
}
Also used : ManagerError(org.asteriskjava.manager.response.ManagerError) ManagerConnection(org.asteriskjava.manager.ManagerConnection) DefaultManagerConnection(org.asteriskjava.manager.DefaultManagerConnection) ManagerResponse(org.asteriskjava.manager.response.ManagerResponse)

Aggregations

DefaultManagerConnection (org.asteriskjava.manager.DefaultManagerConnection)2 ManagerConnection (org.asteriskjava.manager.ManagerConnection)2 ManagerError (org.asteriskjava.manager.response.ManagerError)2 ResponseEvents (org.asteriskjava.manager.ResponseEvents)1 ManagerResponse (org.asteriskjava.manager.response.ManagerResponse)1