« Back to Cisco JTAPI Questions

provider.getCalls()

Combination View Flat View Tree View
Threads [ Previous | Next ]
I am trying to write an application that will get a specific call by iterating through all the calls from the provider.  My issue is everytime I call provider.getCalls() is returns null.  I've looked on the forums and haven't found much information.  The application user that I am using has been granted CTI control permission but I'm still not seeing any calls.  Any help would be greatly appreciated.  

Applications can access only the calls that are on the devices in the control list. Also callobservers need to be added to all addresses or terminals that you want to observe.
 
provider.getCalls() will return the calls that are on addresses or terminals where application added callobservers. How many devices do you have in user control list and how many calls are active when application called provider.getCalls()? Check if you have callobservers. 

I have my testing device to the control list and have placed a call to it but I don't see the call. So I have one device and have placed one call to that device. Here is the logic that I have implemented.

private Call findCall(String netId) throws Exception {
provider.addObserver(this);
conditionInService.waitTrue();
Terminal[] ts = provider.getTerminals();
Terminal term = provider.getTerminals()[0];
term.addCallObserver(this);
term.addObserver(this);
Call[] cs = provider.getCalls();
return return cs[0];
}

You need to wait till the terminal goes into inservice state. After that if you have calls on the terminal the call observer will start getting the events. Check the jtrace sample code. This is available in the folder where JTAPI is installed. 
calling provider.getCalls() immedeately after adding callobserver will not get you the correct calls. Add some delay after addCallObservers and retry.

My code now waits for the CiscoTermInServiceEv event to happen before continuing but when I call the provider.getCalls() I still don't see any calls.

I found out that I can add a CallObserver and then just wait for the CallCtlConnEstablishedEv event and get the call that way.

I found out that I can add a CallObserver and then just wait for the CallCtlConnEstablishedEv event and get the call that way.

 
This is slightly off-topic from your original question, but believe it would help me immensely with a problem I've been working on.  Could you post a code sample of how you wait for the CallCtlConnEstablishedEv event?

You need to add a CallObserver to the Address object. Then just wait for the callChangedEvent to fire.

public class MyCallObserver implements CallControlCallObserver {

public synchronized void callChangedEvent( CallEv[] eventList ){
for ( int i = 0; i < eventList.length; i++ )
{
if( eventList.getID() == CallCtlConnEstablishedEv.ID) {
//do something cool here
}
}
}

}