0

I am using cisco jtapi v7+ and investigating whether I can add a provider to only listen to certain (not all) events. However, the only call I see in the API is the following:

provider.addObserver(ProviderObserver); 

I would like to avoid filtering events in my application and have it done through the API. Any thoughts/insight on this would be appreciated!

ali haider
  • 19,175
  • 17
  • 80
  • 149

1 Answers1

1

You must add CallObserver instance to address which you want listen, then filtering events. For example:

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);
SeniorJD
  • 6,946
  • 4
  • 36
  • 53
Anar Orujov
  • 591
  • 5
  • 18