import javax.telephony.JtapiPeer;
import javax.telephony.JtapiPeerFactory;
import javax.telephony.Provider;
import javax.telephony.callcenter.ACDAddress;
import javax.telephony.callcenter.Agent;
JtapiPeer jtapiPeer = null;
jtapiPeer = JtapiPeerFactory.getJtapiPeer("com.avaya.jtapi.tsapi.TsapiPeer");
String Link="AVAYA#AVAYA_ECS#CSTA#name;loginID=;passwd="
Provider tempProvider= jtapiPeer.getProvider(myArgs);
if (tempProvider instanceof ECSV5Provider) {myProvider = (ECSV5Provider) tempProvider;
// 3.add the observer to the provider
myProvider.addObserver(this);
myAddress = (ECSAddress) myProvider.getAddress(extensionNo);
myTerminal = (ECSV5TerminalEx) myProvider.getTerminal(extensionNo);
myACDAddress = (ACDAddress) myProvider.getAddress(groupNo);
myAgent = myTerminal.addAgent(myAddress, myACDAddress,Agent.NOT_READY, agentId, "");
myAgent.setState(Agent.NOT_READY);
myACDAddress = myAgent.getACDAddress();
myTerminal.addCallObserver(this);
// logout when add call observer failed.
myTerminal.removeAgent(myAgent, 1);
// 4. 由Provider对象建立 call 对象
myCall = (ECSV5Call) myProvider.createCall();
// 5. call 对象创建连接
myCall.connect(myTerminal, myAddress, destNo, false, utui);
//6. get call UCID
this.ucid = myCall.getUCID();