Fala galera blz, não estou conseguindo resolver esse problema, já pesquisei em todos os foruns possíveis e nada, alguém já implementou JTAPI aqui?
public void transferX(String target){
Address address = null;
Call call = null;
Connection[] connections = null;
try {
address = provider.getAddress("3334");
terminal = provider.getTerminal("3334");
terminal.addCallObserver(this);
call = provider.createCall();
call.addObserver(this);
connections = call.connect(terminal, address, "3331");
} catch (InvalidPartyException e) {
e.printStackTrace();
} catch (PrivilegeViolationException e) {
e.printStackTrace();
} catch (MethodNotSupportedException e) {
e.printStackTrace();
} catch (ResourceUnavailableException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
e.printStackTrace();
} catch (InvalidStateException e) {
e.printStackTrace();
}
Address address2 = null;
Call call2 = null;
Connection[] connections2 = null;
try {
address2 = provider.getAddress("3332");
terminal = provider.getTerminal("3332");
terminal.addCallObserver(this);
call2 = provider.createCall();
call2.addObserver(this);
connections2 = call2.connect(terminal, address2, "3333");
} catch (InvalidPartyException e) {
e.printStackTrace();
} catch (PrivilegeViolationException e) {
e.printStackTrace();
} catch (MethodNotSupportedException e) {
e.printStackTrace();
} catch (ResourceUnavailableException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
e.printStackTrace();
} catch (InvalidStateException e) {
e.printStackTrace();
}
terminalConnection = terminal.getTerminalConnections()[0];
if(terminalConnection == null) {
return;
}
Connection con1 = call.getConnections()[0];
Connection con2 = call2.getConnections()[0];
CallControlCall origcall = (CallControlCall)con1.getCall();
CallControlCall destcall = (CallControlCall)con2.getCall();
//TerminalConnection tc = (TerminalConnection)destcall.getConnections()[0];
//if(tc == null) {
if(terminalConnection == null) {
//System.out.println("tc == null");
System.out.println("terminalConnection == null");
}
try {
origcall.setTransferEnable(true);
//origcall.setTransferController(tc);
origcall.setTransferController(terminalConnection);
} catch(Exception excp) {
System.err.println("Failed to set transfer controller: " + excp);
JOptionPane.showMessageDialog(null, "Failed to set transfer controller: " + excp.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
}
System.out.println("Transfer!!!");
try {
origcall.transfer(destcall);
} catch(Exception excp) {
System.err.println("Failed to transfer: " + excp);
excp.printStackTrace();
try {
origcall.drop();
} catch(Exception ex) {
System.err.println("Exception when droppinng a call: " + ex);
JOptionPane.showMessageDialog(null, "Exception when droppinng a call: " + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
}
}
}
E está causando o seguinte erro:
com.avaya.jtapi.tsapi.TsapiInvalidStateException: terminal connection is not in this call