Hi,
We use the Avaya Java Telephony API ( JTAPI) to perform various telephony-related operations like connecting to a Call , answering and disconnecting a call using the SDK.
I'm facing the following issues, first one when I'm making a simple Call, and then we make a second call , the connection don't etablish correctly .
Please ,can you explain me ?
1.Which SDK classes to use to open the connection ( ie JtapiPeer ... ) ?
2. How close connection with safety ?
Here is the code use
[code]
// init Step
// init JtapiPeeer
JtapiPeer jtapiPeer = JtapiPeerFactory.getJtapiPeer(null);
// create provider
Provider provider = jtapiPeer.getProvider(null);
// create Terminal
Terminal terminalOfficer = provider.getTerminal(TelNumber); ...
private void holdAndConnect(String number) throws Exception {
try {
CallControlCall secondCall = (CallControlCall) provider.createCall();
TerminalConnection[] cons = terminalOfficer.getTerminalConnections();
officerTerminalConnection = null;
String calledAddr;
for (TerminalConnection c : cons) {
officerTerminalConnection = (CallControlTerminalConnection) c;
calledAddr = c.getTerminal().getName();
if (calledAddr.compareTo(terminalOfficier.getName()) == 0) {
break;
}
}
// we place officer connexion in hold state
officerTerminalConnection.hold();
// Waiting
Thread.sleep(tempo);
secondCall = (CallControlCall) provider.createCall();
secondCall.addCallListener(new CallControlConnectionListener(this));
if (secondCall instanceof LucentCall && userInfo != null) {
((LucentCall) secondCall).connect((LucentTerminal)
terminalOfficier, (LucentAddress) addressOfficier, number, false, userInfo);
} else {
secondCall.connect(terminalOfficier, addressOfficier, number);
}
} catch (ResourceUnavailableException | InvalidStateException | PrivilegeViolationException | MethodNotSupportedException | InvalidPartyException | InvalidArgumentException te) {
if (secondCall != null && secondCall.getState() == Call.ACTIVE) {
secondCall.drop();
}
secondCall = null;
if (officierTerminalConnection != null &&
officerTerminalConnection.getCallControlState() ==
CallControlTerminalConnection.HELD) {
officierTerminalConnection.unhold();
}
}
[code]
Best regards
|