Search in sources :

Example 1 with ResponseEvents

use of org.asteriskjava.manager.ResponseEvents 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 ResponseEvents

use of org.asteriskjava.manager.ResponseEvents in project openmeetings by apache.

the class SipDao method countUsers.

public Integer countUsers(String confno) {
    if (confno == null) {
        return null;
    }
    ConfbridgeListAction da = new ConfbridgeListAction(confno);
    ResponseEvents r = execEvent(da);
    if (r != null) {
        log.debug("SipDao::countUsers size == " + r.getEvents().size());
        // "- 1" here means: ListComplete event
        return r.getEvents().size() - 1;
    }
    return 0;
}
Also used : ResponseEvents(org.asteriskjava.manager.ResponseEvents) ConfbridgeListAction(org.asteriskjava.manager.action.ConfbridgeListAction)

Aggregations

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