我正在使用cisco jtapi v7 +并调查是否可以添加提供程序以仅侦听某些(并非所有)事件。但是,我在API中看到的唯一调用如下:
provider.addObserver(ProviderObserver);
我想避免在我的应用程序中过滤事件,并通过API完成。对此有任何想法/见解将不胜感激!
答案 0 :(得分:1)
您必须将CallObserver
实例添加到要监听的地址,然后过滤事件。例如:
Address srcAddr = provider.getAddress(src);
co = new CallObserver() {
public void callChangedEvent(CallEv[] eventList) {
for (int i = 0; i < eventList.length; ++i) {
try {
if (eventList[i].getID() == TermConnRingingEv.ID) {
session.getBasicRemote().sendText("new_call");
}
} catch (Exception ex) {
ex.printStackTrace();
}
if (eventList[i].getID() == ConnDisconnectedEv.ID) {
try {
System.out.println("Disconnected");
session.getBasicRemote().sendText("disconnected");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (eventList[i] instanceof CallObservationEndedEv) {
System.out.println("Event: Call Observation Ended");
}
if (eventList[i] instanceof CiscoAddrOutOfServiceEv) {
System.out.println("Event: Address Out of service");
}
System.out.println("State: " + eventList[i].getCall().getState());
}
}
};
srcAddr.addCallObserver(co);