0

我正在使用 cisco jtapi v7+ 并调查是否可以添加提供程序以仅侦听某些(不是全部)事件。但是,我在 API 中看到的唯一调用如下:

provider.addObserver(ProviderObserver); 

我想避免在我的应用程序中过滤事件并通过 API 完成。对此的任何想法/见解将不胜感激!

4

1 回答 1

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);
于 2014-08-11T11:49:08.467 回答