This document was generated from CDN thread
Created by: MIKE WILCOX on 21-03-2012 12:45:41 PM
Is it possible to use JTAPI to query the status of a phone to see whether it is onhook or offhook?
Thanks,
Mike
Subject: RE: Onhook.Offhook status
Replied by: Ron Buchanan on 21-03-2012 01:29:44 PM
some snippets from my code:
if (((CiscoTerminalConnection)terminalConnection).getCallControlState() == CiscoTerminalConnection.TALKING) //for the record, "TALKING" includes off-hook
CiscoCallAddressInfo.getNumActiveCalls() vs. CiscoCallAddressInfo.getNumCallsOnHold() - tells you if the user has a call that's not on hold
this should tell you if the user just has the phone off hook (listening to a dial tone or a busy signal):
for (javax.telephony.Connection lineConnection : line.getConnections())
if (lineConnection.getAddress().getName().equals(line.getName())){
CiscoCall call = (CiscoCall)lineConnection.getCall(); // if the number of connections on the call is 1, then that means there is only one
javax.telephony.Connection[] connections = call.getConnections(); // party to the call (most likely the phone is off-hook with either just a dialtone
if (connections==null || connections.length <= 1) // or a busy signal), so return the call object (the call must be returned so that
return (CiscoCall) call; // the call can be dropped before attempting to place an outbound call)
}