原文网址:https://blog.csdn.net/cjqhut/article/details/85070954
以下代码实现基于avaya的Tsapi环境,实现了转接是传递UUI(随录数据)
package com.av.demo;
import javax.telephony.Connection;
import javax.telephony.Provider;
import javax.telephony.TerminalConnection;
import javax.telephony.callcontrol.CallControlCall;
import javax.telephony.callcontrol.CallControlTerminal;
import javax.telephony.callcontrol.CallControlTerminalConnection;
import com.av.util.MyProvider;
import com.avaya.jtapi.tsapi.LucentAddress;
import com.avaya.jtapi.tsapi.LucentCall;
import com.avaya.jtapi.tsapi.LucentTerminal;
import com.avaya.jtapi.tsapi.UserToUserInfo;
/**
* @author chengjianqiang
* @date 2018年12月6日
*/
public class UuiTest2 {
public static void main(String[] args) {
Provider p=MyProvider.getProvider();
try {
/**
* (场景:分机号5380的坐席已经在和客户通话,现要将客户转到满意度 VDN4995并随带UUI)
* 用Transfer传递UUI的思路:
* 1、发起一个新的呼叫,把要传递的UUI放进去
* 2、将新呼叫并入原呼叫
*/
//通过分机号或Agent号获取当前通话的Terminal、call对象
CallControlTerminal terminal5380 = (CallControlTerminal)p.getTerminal("5380");
//当前通话的TermConn对象ctrTmCnA5380
CallControlTerminalConnection ctrTmCnA5380=(CallControlTerminalConnection) terminal5380.getTerminalConnections()[0];
//当前通话的呼叫对象callA
CallControlCall callA = (CallControlCall) ctrTmCnA5380.getConnection().getCall();
//先把当前通话保持住,释放资源后才能发起新的呼叫;
ctrTmCnA5380.hold();
//创建新的呼叫callB,并传入UUI
LucentCall callB = (LucentCall) terminal5380.getProvider().createCall();
UserToUserInfo uui=new UserToUserInfo("grp=cheng,stp=jianqiang ");
Connection[] connectArrB = callB.connect((LucentTerminal)terminal5380, (LucentAddress)terminal5380.getAddresses()[0], "4995", false, uui);
//设置转接控制器(转接控制器:即在callA中,又在callB中,比如现在callB中的5380.而且转接成功后,它将自动挂断,不参与任何呼叫);
TerminalConnection termConnB5380 = connectArrB[0].getTerminalConnections()[0];
callB.setTransferController(termConnB5380);
//发起转接
callB.transfer(callA);
Thread.sleep(2000);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.exit(0);
}
}
---------------------
作者:cjqhut
来源:CSDN
原文:https://blog.csdn.net/cjqhut/article/details/85070954
版权声明:本文为博主原创文章,转载请附上博文链接!