123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!-- NewPage -->
- <html lang="zh">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>软电话DEMO</title>
- <link rel="stylesheet" type="text/css" href="./qlSoftPhone//styles/newSoftPhone.css">
- <script type="text/javascript" src="qlSoftPhone/js/jquery-1.9.1.min.js"></script>
- <script type="text/javascript" src="qlSoftPhone/js/QL.SoftPhone-cticaas.js"></script>
- <script type="text/javascript" src="sipphone/phone.js"></script>
- <script type="text/javascript" src="sipphone/sipUtil.js"></script>
- <script type="text/javascript">
- $(function(){
-
- /**************分机初始化开始*********************/
-
- var $this = this;
- // 调用SIP发起语音
- $($this).mySipPhone({
- wss: "ws://10.1.43.10:8088/ws", // webSocket 地址
- uri: "10.1.43.10:8052", // sip服务器的IP和端口
- user: "6001", // sip分机号
- pwd: "a6001", // 分机号密码
- callNumber: "", // 培训默认外呼号码
- options: {
- audioBW: "", // 设置音频带宽
- videoBW: "", // 设置视频带宽
- ice: true, // ICE穿透NAT/防火墙
- stunUrl: "", // STUN穿透
- turnUrl: "", // TURN穿透
- turnUserName: "", // TURN用户名
- turnCredential: "" // TURN证书
- },
- registered: function (evt) {
- // 注册成功
- //registered = true;
- console.log("webRTC话机初始化成功!");
- alert("webRTC话机初始化成功!");
- },
- failed: function (type,evt) {
- console.log("分机呼叫失败!");
- if(evt.cause != undefined && evt.cause != ""){
- console.log("分机呼叫失败:"+ evt.cause);
- }
- },
- ended: function (type,evt) {
- console.log("分机呼叫结束!");
- if(evt.cause != undefined && evt.cause != "" && evt.cause != "Terminated"){
- console.log("分机呼叫异常结束:" + evt.cause);
- }
- },
- accepted: function (callType,evt) {
- console.log("分机呼叫接通!");
-
- },
- stream: function (callType, localStream, remoteStream) {
- console.log("分机语音流,stream!");
- console.log("callType:"+callType);
-
- try {
- $("#remoteVideo")[0].srcObject = remoteStream;
- $("#localVideo")[0].srcObject = localStream;
- } catch (error) {
- $("#audioRemote")[0].src = window.URL.createObjectURL(remoteStream);
- $("#localVideo")[0].src = window.URL.createObjectURL(localStream);
- }
-
- },
- ringing: function (evt) {
- console.log("振铃"+evt);
- //座席分机自动接听
- mySipPhone.answer(false);
- },
- unregister: function () {
- console.log("分机注销");
- }
- });
-
- mySipPhone.register();
-
- /**************分机初始化结束*********************/
-
-
-
- /******************软电话初始化开始*******************/
- //初始化软电话
- var softPhone = $("#qlSoftPhone").softphones({
- host: "http://10.1.43.10:9215/cti",//软电话地址
- agentId: "1001",//坐席工号
- agentName:"1001",//默认和工号一致
- extension: "6001",//分机号码
- password: "1001",//登陆密码
- isDefaultSkill:true,//是否默认一个技能组
- isDisableAcw:false,//是否禁用后处理操作
- softPhoneType:'0',//软电话类型,0:顶部软电话,1:右侧软电话
- marginBottom:0,//底部间距
- marginTop:10,//顶部间距
- marginLeft:10,//顶部间距
- tenant:"tenant1",// 租户
- platformFlag:"gkx", //平台名称,华为:huawei,Aspect:aspect,Awaya:awaya,思科:cisco, 中兴:zte
- agentType:"common",// 座席类型 (common:普通座席, manager:管理员)
- skillGroupCode:"-1",// 技能组编号
- skillGroupName:"默认技能组", // 技能组名称
- consultativeGroup :"{\"-1\":\"默认技能组\"}", // 可咨询组
- transferGroup :"{\"-1\":\"默认技能组\"}", // 可咨询组
- manageGroup:"{\"-1\":\"默认技能组\"}",//可管理组
- ejectScreen:function(data){//电话接通后(包括呼入,呼出)主动触发事件
- console.log("软电话收到弹屏事件");
- //alert("弹屏");
- },
- onCall:function(data){//电话接通后(包括呼入,呼出)主动触发事件
- console.log("软电话接通事件");
- console.log("开始修改录音接通时间");
- //alert("接通事件");
- },
- addRecord:function(data){//电话挂断后主动触发事件
- console.log("开始新增录音记录");
- //alert("增加录音");
- },
- logout:function(data){//软电话退出后主动触发事件
- alert("签出成功");
- },
- onDial:function(data){
- //alert("onDial外呼成功回调事件!");
- console.log("onDial外呼成功回调事件!");
- },
- hangUp:function(data){//软电话挂断触发事件
- console.log("软电话挂断触发事件!");
- //主动挂断座席分机
- //mySipPhone.hangUp();
- }
- });
- /******************软电话初始化结束*******************/
-
- //主动触发事件,主动触发事件必须在软电话初始化后才可以调用
- //坐席操作页面如需要拨号按钮,需要调用此事件
- //qlSoftPhone.makeCall(phone,type);
- //phone:需要拨打的电话号码
- //type:电话类型 1:内部电话,2:外部电话
-
-
- //退出软电话方法,坐席需要退出软电话时,需要调用此事件
- //qlSoftPhone.logOff();
- //qlSoftPhone.completeCall("81");
- });
- function call(){
- //呼分机
- //mySipPhone.call(false,"2001");
- //呼外线
- //mySipPhone.call(false,"18565665810");
- }
- </script>
- </head>
- <body>
- <div id="qlSoftPhone"></div>
- <div>
- <video id="remoteVideo" class="corner" autoplay playsinline style="display: none;"></video>
- <video id="localVideo" class="full" autoplay playsinline muted style="display: none;"></video>
- <!-- <input type="button" value="呼叫" onclick="call()"/>-->
- </div>
- </body>
- </html>
|