0

I have code:

        CiscoJtapiPeer peer = (CiscoJtapiPeer) JtapiPeerFactory.getJtapiPeer(null);
    CiscoProvider provider = (CiscoProvider) peer.getProvider(host+";login="+ login +";passwd=" + pass);
    provider.addObserver(new ProviderObserver() {
                    @Override
        public void providerChangedEvent (ProvEv [] eventList) {
            if (eventList == null) return;
            for (int i = 0; i < eventList.length; ++i) {
                if (eventList[i] instanceof ProvInServiceEv) {
                    inService.set();
                }
            }
        }
    });
    inService.waitTrue();
    System.out.println("In servise.");
        CiscoAddress srcAddr = (CiscoAddress) provider.getAddress(dn);
        srcAddr.addCallObserver(new MyCallControlCallObserver(dn, provider))

and observer on address:

        @Override
public void callChangedEvent(CallEv[] evlist)throws Exception{
    for (CallEv evlist1 : evlist) {

        if (evlist1.getID() == CiscoTermConnRecordingEndEv.ID) {
            call = provider.getCall(callid);
            if (call != null) {
                System.out.println("From: " + call.getCallingAddress() + "   To: " + call.getCalledAddress());
            }
            else {System.out.println("Call is null");}
        }
    }
}

function provider.getCall(callid) returns the object is not stable. Like this -

From: 4403   To: 5215 
Call is null
Call is null
From: 4403   To: 5215
From: 4403   To: 5215
Call is null
Call is null
From: 4403   To: 5215

The interval between calls 5 - 15 seconds and the duration of 3 - 7 seconds. I tried to change to handle the event - the same result. What am i doing wrong? Maybe it's due to the fact that the CUCM is a cluster? And CiscoProvider is different for each call?

Slot
  • 1
  • 2
Slot555
  • 1
  • 2

1 Answers1

0
if (evlist1.getID() == CiscoTermConnRecordingEndEv.ID) {
            call = provider.getCall(callid);
            if (call != null) {
                System.out.println("From: " + call.getCallingAddress() + "   To: " + call.getCalledAddress());
            }
            else {System.out.println("Call is null");}
        }

You are getting calls which has recording option true. You get only RECORDED calls. Thats why your function is not stable. If you want get all calls instead of CiscoTermConnRecordingEndEv use TermConnActiveEv if you want get call in active state or TermConnRingingEv if you want get call in ringing state.

Anar Orujov
  • 591
  • 5
  • 18