| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723 |
- var ws, n = 0,
- timer,hidTel,hidCallID,hidActionID,
- directType,sendType,mesCont,
- eorrorConnect,errorState=false,
- makeCallId = "",lockReconnect = false,
- obj = {},cls = 0,
- lasttime = new Date().getTime(),
- reconnecTion,recon,loginOr=false;
- //创建scoket连接
- function createWebSocket() {
- try {
- $("#top-search li i").removeClass("active");
- Connect();
- } catch(e) {
- reconnect();
- //打印日志
- directType="lianjie";
- sendType="异常错误"; //JSON.stringify(data)
- mesCont=e.message;
- debuggerLog();
- }
- }
- //连接
- function Connect() {
- ws = new WebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
- ws.onopen = function() {
- console.log(new Date() + " " + "建立连接");
- //心跳检测重置
- heartCheck.reset().start();
- cls = 0;
- $(".Login").addClass("active");
- //自动签入
- lasttime = new Date().getTime();
- obj.Type = "Login";
- obj.AgentType = "0";
- Send(); /*2018-05-19zhangshaungnan注释*/
- };
- //接收到消息的回调方法
- ws.onmessage = function(evt) {
- //如果获取到消息,心跳检测重置
- //拿到任何消息都说明当前连接是正常的
- heartCheck.reset().start();
- var myDate = new Date();
- console.log(myDate + " receive " + evt.data);
- var data = JSON.parse(evt.data)[0];
- //打印日志
- directType="recive";
- sendType=data.Type; //JSON.stringify(data)
- mesCont=JSON.stringify(data);
- debuggerLog()
- if(data) {
- var rlt = data.Result;
- if(rlt == true) {
- var type = data.Type;
- switch(type.toLowerCase()) {
- //case "heart": HeartBack(); break;//心跳
- case "login":
- LoginBack();
- break; //签入
- case "logout":
- LogoutBack();
- break; //签出
- case "dropcall":
- DropCallBack();
- break; //挂断
- case "makecall": //MakeCall
- MakeCallBack(data);
- break; //外呼
- case "setstate":
- SetState(data);
- break; //置忙置闲
- //case "saybusy": SayBusyBack(data); break;
- //case "sayfree": SayFreeBack(data); break;
- case "meeting":
- MeetingBack();
- break; //多方通话
- case "transfer":
- TransferBack();
- break; //转移
- case "hold":
- HoldBack();
- break; //保持
- case "retrieve":
- RetrieveBack();
- break; //接回
- case "incoming":
- IncomingBack(data);
- break; //来电
- case "subscribe":
- SubScribeBack();
- break; //监测
- case "subscribecancel":
- SubScribeCancelBack();
- break; //停止监测
- case "agentstate":
- AgentStateBack(data);
- break; //坐席状态
- case "linestate":
- LineStateBack(data);
- break; //线路状态
- case "motorsetstate":
- SayFreeBack();
- break; //班长置闲
- case "linestateagent":
- LineStateAgentBack(data);
-
- break; //线路状态通知
- // case "agentstateagent":
- // AgentStateAgentBack(data);
- // break; //坐席状态通知
-
- case "callid":
- CallIDBack(data);
- break; //获取callid
- case "recordpath":
- RecordPathBack(data);
- break; //录音返回
- }
- } else {
- if(rlt == false) {
- //$(".hwzt").text('操作失败!');
- //外呼失败的文字展示
- if (data.Type.toLowerCase() == "makecall") {
- switch (data.ErrorCode) {
- case 1: $(".hwzt").text(' 挂机,请重试!'); break;
- case 2: $(".hwzt").text(' FS外呼命令失败,请重试!'); break;
- case 3: $(".hwzt").text(' 外呼获取座席失败,请重试!'); break;
- case 4: $(".hwzt").text(' 座席置忙禁止座席外呼,请重试!'); break;
- case 5: $(".hwzt").text(' 主叫座席分机非空闲或摘机拨号,请重试!'); break;
- case 6: $(".hwzt").text(' 为外呼设置座席状态失败,请重试!'); break;
- case 7: $(".hwzt").text(' 被叫座席非空闲,请重试!'); break;
- case 8: $(".hwzt").text(' 执行分机呼叫失败, 未找到分机通道,请重试!'); break;
- case 9: $(".hwzt").text(' 执行分机呼叫失败, 无法绑定分机通道,请重试!'); break;
- case 10: $(".hwzt").text(' 禁止分机自呼,请重试!'); break;
- case 11: $(".hwzt").text(' 发送分机呼叫Esl命令失败,请重试!'); break;
- case 12: $(".hwzt").text(' 目标分机非空闲,请重试!'); break;
- case 13: $(".hwzt").text(' 主控通道非空闲,请重试!'); break;
- case 14: $(".hwzt").text(' 校验不通过绑定本端逻辑线路失败,请重试!'); break;
- case 15: $(".hwzt").text(' 校验不通过本端当前线路忙,请重试!'); break;
- case 16: $(".hwzt").text(' 校验不通过对端线路状态忙,请重试!'); break;
- case 17: $(".hwzt").text(' 被叫关机,请重试!'); break;
- case 18: $(".hwzt").text(' 无效号码,请重试!'); break;
- case 19: $(".hwzt").text(' 无人接听,请重试!'); break;
- case 20: $(".hwzt").text(' 交换机错误(用户无法接通),请重试!'); break;
- case 21: $(".hwzt").text(' 话机外呼执行数据交换操作失败未找到分机通道,请重试!'); break;
- case 22: $(".hwzt").text(' 话机外呼执行数据交换操作失败分机通道未绑定任务,请重试!'); break;
- case 23: $(".hwzt").text(' 执行设备外呼任务失败无法获取对应线路,请重试!'); break;
- }
- }
- if(data.Type=='AcdConnectNotify'){
- $("#top-search li i").removeClass("active");
- $(".hwzt").text('Acd未连接');
- }
- } else {
- $(".hwzt").text(rlt);
- //layer.confirm(rlt, {
- // btn: ['确定']
- //});
- }
- }
- }
- };
- //连接关闭的回调方法
- ws.onclose = function(evt) {
- // 打印日志
- directType="recive";
- sendType="close"; //JSON.stringify(data)
- mesCont=JSON.stringify(evt);
- debuggerLog();
- if(cls == 0) {
- cls = 1;
- $(".hwzt").text('连接关闭!');
- $("#top-search li i").removeClass("active");
- reconnect();
- }
- };
- //连接发生错误的回调方法
- ws.onerror = function(evt) {
- // 打印日志
- directType="recive";
- sendType="连接错误 "; //JSON.stringify(data)
- mesCont=JSON.stringify(evt);
- debuggerLog();
- //产生异常
- $(".hwzt").text('连接出现异常!');
- console.log(ws);
- if(ws == null || ws.readyState != ws.OPEN) {
- console.log(new Date() + "开始重连");
- reconnect();
- }
- };
- }
- //重连
- function reconnect() {
- if(lockReconnect) return;
- lockReconnect = true;
- //没连接上会一直重连,设置延迟避免请求过多
- setTimeout(function() {
- // 打印日志
- directType="send";
- sendType="重连中 "; //JSON.stringify(data)
- mesCont="重连中";
- debuggerLog();
- console.log(new Date() + " " + "重连中……");
- createWebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
- lockReconnect = false;
- }, 2000);
- }
- function debuggerLog(){
- $.post(huayi.config.callcenter_url + 'Log/CallOpt', {
- direct: directType,
- type: sendType,
- cont: mesCont,
- "token": $.cookie("token")
- }, function(result) {
- result = $.parseJSON(result);
- if(result.state.toLowerCase() == "warning") {
- //layer.msg("创建工单成功");
- }
- })
- }
- //异常重连
- function errorFun(){
- clearInterval(timer);
- var errorNum=0
- timer = setInterval(function() {
- errorNum++;
- if (errorNum>2) {
- $(".hwzt").text('连接异常!');
- }else{
- $("#top-search li i").removeClass("active");
- $(".Login").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("bl").addClass("br");
- $(".hwzt").text('');
- }
- reconnect();
- $(".hwzt").text('连接异常!');
- }, 15000);
- }
- noLine();
- clearInterval(recon);
- recon = setInterval(function () {
- if(loginOr){
- noLine();
- setTimeout(function () {
- lineState();
- }, 2000);
- }
- }, 1000*10);
- function lineState(){
- if (reconnecTion) {
- reconnecTion=false;
- }else{
- directType="send";
- sendType="断网 "; //JSON.stringify(data)
- mesCont="断网";
- debuggerLog();
- }
- }
- function noLine(){
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'UserAccount/GetNowUser',
- async: true,
- dataType: 'json',
- data: {
- "token": $.cookie("token")
- },
- success: function(data) {
- reconnecTion = data.data.user.F_UserCode;
- }
- });
- }
- //发送
- function Send() {
- if(ws.readyState != ws.OPEN) {
- if(loginOr){
- errorState=true;
- $("#top-search li i").removeClass("active");
- $(".Login").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("bl").addClass("br");
- $(".hwzt").text('');
- directType="send";
- sendType=ws.readyState; //JSON.stringify(data)
- mesCont="签入时异常了";
- debuggerLog();
- $(".hwzt").text('连接异常!');
- reconnect();
- }else{
- errorState=false;
- $("#top-search li i").removeClass("active");
- $(".Login").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("bl").addClass("br");
- $(".hwzt").text('');
- directType="send";
- sendType=ws.readyState; //JSON.stringify(data)
- mesCont="异常了";
- debuggerLog();
- $(".hwzt").text('连接异常!');
- reconnect();
- }
- }
- if(ws.readyState == ws.OPEN) {
- if (obj.Type) {
- directType="send";
- sendType=obj.Type;
- mesCont=JSON.stringify(obj);
- debuggerLog()
- }else{
- directType="send";
- sendType="建立连接";
- mesCont=JSON.stringify(obj);
- debuggerLog()
- }
- console.log(new Date() + " send " + JSON.stringify(obj));
- ws.send(JSON.stringify(obj));
- }
- }
- //心跳检测
- var heartCheck = {
- timeout: 25000, //25秒
- timeoutObj: null,
- serverTimeoutObj: null,
- reset: function() {
- clearTimeout(this.timeoutObj);
- clearTimeout(this.serverTimeoutObj);
- return this;
- },
- start: function() {
- var self = this;
- this.timeoutObj = setTimeout(function() {
- //这里发送一个心跳,后端收到后,返回一个心跳消息,
- //onmessage拿到返回的心跳就说明连接正常
- obj.Type = "Heart";
- Send();
- self.serverTimeoutObj = setTimeout(function() { //如果超过一定时间还没重置,说明后端主动断开了
- ws.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
- //同步签出状态
- $("#top-search li i").removeClass("active");
- $(".Login").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("bl").addClass("br");
- $(".hwzt").text('');
- //打印日志
- directType="heart";
- sendType="心跳"; //JSON.stringify(data)
- mesCont="未收到";
- debuggerLog();
- if(cls == 0) {
- cls = 1;
- reconnect();
- }
- }, self.timeout)
- }, this.timeout)
- }
- }
- //签入
- function LoginBack() {
- $("#top-search li i").removeClass("active");
- $(".Logout").addClass("active");
- $(".SayBusy").addClass("active");
- $(".MakeCall").addClass("active");
- $(".zxzt").removeClass("br").addClass("bl");
- $(".fwzt").removeClass("br").addClass("bl");
- $(".hwzt").text('空闲');
- }
- //签出
- function LogoutBack() {
- $("#top-search li i").removeClass("active");
- $(".Login").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("bl").addClass("br");
- $(".hwzt").text('');
- }
- //来电
- function IncomingBack(data) {
- if(data.CallID!=0){
- var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID=' + data.CallID + '">来电弹屏' + data.Number + ' <i class="fa fa-times-circle close_call"></i></a>';
- $(".J_menuTab").removeClass("active");
- var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+ data.CallID +'" width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + data.Number + '&CallID=' + data.CallID + '&ActionID=' + data.ActionID + '" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID=' + data.CallID + '" seamless></iframe>';
- $(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
- $(".J_menuTabs .page-tabs-content").append(p);
- hidTel=data.Number;
- hidCallID=data.CallID;
- hidActionID=data.ActionID;
- }else{
- var timestamp = Date.parse(new Date());
- var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID='+timestamp+'">来电弹屏' + data.Number + ' <i class="fa fa-times-circle close_call"></i></a>';
- $(".J_menuTab").removeClass("active");
- var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+timestamp+'" width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + data.Number + '&CallID='+timestamp+'" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID='+timestamp+'" seamless></iframe>';
- $(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
- $(".J_menuTabs .page-tabs-content").append(p);
- hidTel=data.Number;
- hidCallID=timestamp;
- }
- }
- //***************************************************
- function CallIDBack(data) {
- //$(".hidCallID").val(data.CurrID);
- }
- //挂断
- function DropCallBack() {
- $("#top-search li i").removeClass("active");
- $(".Logout").addClass("active");
- $(".SayBusy").addClass("active");
- $(".MakeCall").addClass("active");
- var obj = $("iframe:visible")
- // if (obj.attr("data-id") == './callScreen/callScreen.html?tel=' + hidTel + '&CallID=' + hidCallID + '') {
- // window.frames[obj.attr("name")].$(".td-call").hide();
- // window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
- // }
- if(window.frames['iframe'+ hidCallID +'']){
- window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
- }
- if ($("#isml").val() === "1") {
- $(".SayBusy").removeClass("active");
- $(".SayFree").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".hwzt").text('置忙');
- }
- }
- //线路状态通知
- function LineStateAgentBack(data) {
- var objiframe = $("iframe:visible")
- //0分机不可用,1空闲,2摘机等待拨号,3正在拨号,4呼出振铃,5来电振铃,6通话中,7播放忙音中,8移除IP分机,9通话保持中
- if(data.State == '0') {
- $(".hwzt").text('分机不可用'); //左下角状态显示
- //$(".fwzt").removeClass("br").removeClass("bl");
- $(".fwzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加话机状态灯
- $(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
- }
- if(data.State == '1') {
- // var isml=0;
- if($("#isml").val()==1){
- // isml=1;
- $(".hwzt").text('置忙'); //左下角状态显示
- $(".zxzt").removeClass("bl").addClass("br");
- }
- else{
- $(".hwzt").text('空闲'); //左下角状态显示
- $(".zxzt").removeClass("br").addClass("bl");
- }
-
- $(".fwzt").removeClass("br").addClass("bl");
- // $(".zxzt").removeClass("br").addClass("bl");//20180509 by fanlongfei 增加坐席状态灯
- if(window.frames['iframe'+ hidCallID +'']){
- window.frames['iframe'+ hidCallID +''].clearInter();
- }
- if (hidTel && hidCallID) {
- $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateGJ', {
- callid: hidTel,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") { }
- })
- }
- $("#top-search li i").removeClass("active");
- $(".Logout").addClass("active");
- if($("#isml").val()==0){
- $(".SayBusy").addClass("active");
- }
- else{
- $(".SayFree").addClass("active");
- }
- $(".MakeCall").addClass("active");
- if(window.frames['iframe'+ hidCallID +'']){
- window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
- }
- }
- if(data.State == '2') {
- $(".hwzt").text('摘机等待拨号'); //左下角状态显示
- }
- if(data.State == '3') {
- $(".hwzt").text('正在拨号'); //左下角状态显示
- }
- if(data.State == '4') {
- $(".hwzt").text('呼出振铃'); //左下角状态显示
- }
- if(data.State == '5') {
- $(".hwzt").text('来电振铃'); //左下角状态显示
- //$(".fwzt").removeClass("bl").addClass("br");
- $(".fwzt").removeClass("br").addClass("bl");//20180509 by fanlongfei 增加话机状态灯
- $(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
- if (hidTel && hidCallID) {
- $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZL', {
- callid: hidCallID,
- "token": $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") { }
- })
- }
- }
- if(data.State == '6') {
- $(".hwzt").text('通话中'); //左下角状态显示
- $(".fwzt").removeClass("bl").addClass("br");
- $(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
- if(hidTel && hidCallID) {
- $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZJ', {
- callid: hidCallID,
- "token": $.cookie("token")
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {}
- })
- }
- $("#top-search li i").removeClass("active");
- $(".DropCall").addClass("active");
- $(".Hold").addClass("active");
- $(".Transfer").addClass("active");
- $(".Meeting").addClass("active");
- if(data.CallDirection=="in"){
- // window.frames['iframe'+ hidCallID +''].window.onload = function(){
- // var callingFun = window.frames['iframe'+ hidCallID +''].window.calling;
- // callingFun();
- // }
- // if (objiframe.attr("data-id") == './callScreen/callScreen.html?tel=' + hidTel + '&CallID=' + hidCallID + '') {
- setTimeout (window.frames['iframe'+ hidCallID +''].calling(),500);/*2018-05-19 zhangshuangnan 修改 ps: 因软电话设置为 自动应答 通话时间不计时问题*/
- // }
- }
- }
- if(data.State == '7') {
- $(".hwzt").text('播放忙音中'); //左下角状态显示
- }
- if(data.State == '8') {
- $(".hwzt").text('移除IP分机'); //左下角状态显示
- }
- if(data.State == '9') {
- $(".hwzt").text('通话保持中'); //左下角状态显示
- }
- }
- function toDub(i) {
- return i < 10 ? "0" + i : "" + i;
- }
- //外呼
- function MakeCallBack(data) {
- var makeCallPhone = $.cookie("makeCallPhone");
- $("#top-search li i").removeClass("active");
- $(".DropCall").addClass("active");
-
- //外呼弹屏
- if(data.CallID!=0){
- var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + makeCallPhone + '&CallID=' + makeCallId + '">外呼弹屏' + makeCallPhone + ' <i class="fa fa-times-circle close_call"></i></a>';
- $(".J_menuTab").removeClass("active");
- var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+ makeCallId +'" width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + makeCallPhone + '&CallID=' + makeCallId + '&ActionID=' + data.ActionID + '" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + makeCallPhone + '&CallID=' + makeCallId + '" seamless></iframe>';
- $(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
- $(".J_menuTabs .page-tabs-content").append(p);
- hidTel=makeCallPhone;
- hidCallID=makeCallId;
- hidActionID=data.ActionID;
- }else{
- var timestamp = Date.parse(new Date());
- var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + makeCallPhone + '&CallID='+timestamp+'">外呼弹屏' + makeCallPhone + ' <i class="fa fa-times-circle close_call"></i></a>';
- $(".J_menuTab").removeClass("active");
- var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+timestamp+'" width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + makeCallPhone + '&CallID='+timestamp+'" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + makeCallPhone + '&CallID='+timestamp+'" seamless></iframe>';
- $(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
- $(".J_menuTabs .page-tabs-content").append(p);
- hidTel=makeCallPhone;
- hidCallID=timestamp;
- }
-
- window.frames['iframe'+ hidCallID +''].window.onload = function(){
- var callingFun = window.frames['iframe'+ hidCallID +''].window.calling;
- callingFun();
- }
- // setTimeout (window.frames['iframe'+ hidCallID +''].calling(),500);
- // window.frames[obj.attr("name")].calling();
- }
- //置忙置闲
- function SetState(obj) {
- if(obj.State == '5') {
- $(".SayBusy").removeClass("active");
- $(".SayFree").addClass("active");
- $(".zxzt").removeClass("bl").addClass("br");
- $(".hwzt").text('置忙');
- $("#isml").val(1)
- }
- if(obj.State == '2') {
- $(".SayBusy").addClass("active");
- $(".SayFree").removeClass("active");
- $(".zxzt").removeClass("br").addClass("bl");
- $(".hwzt").text('空闲');
- $("#isml").val(0)
- }
- }
- //置忙
- function SayBusyBack() {
- $(".SayBusy").removeClass("active");
- $(".SayFree").addClass("active");
- $("#isml").val(1)
- }
- //坐席班长置闲
- function SayFreeBack() {
- $(".SayBusy").addClass("active");
- $(".SayFree").removeClass("active");
- $(".zxzt").removeClass("br").addClass("bl"); // 2018/05/09 by fanlongfei 增加坐席状态指示
- $(".hwzt").text('空闲');// 2018/05/09 by fanlongfei 增加坐席状态指示
- $("#isml").val(0)
- }
- //多方通话
- function MeetingBack() {
- }
- //转移
- function TransferBack() {
- $("#top-search li i").removeClass("active");
- $(".Logout").addClass("active");
- $(".SayBusy").addClass("active");
- $(".MakeCall").addClass("active");
- }
- //保持
- function HoldBack() {
- $(".Hold").removeClass("active");
- $(".Retrieve").addClass("active");
- }
- //接回
- function RetrieveBack() {
- $(".Hold").addClass("active");
- $(".Retrieve").removeClass("active");
- }
- //监测
- function SubScribeBack() {
- $('#content-main .J_iframeNew').each(function(i,n){
- if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
- window.frames[$(this).attr("name")].Start();
- }
- })/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
-
-
- }
- //取消监测
- function SubScribeCancelBack() {
- // var obj = $("iframe:visible")
- // if(obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
- // window.frames[obj.attr("name")].();
- // }
- $('#content-main .J_iframeNew').each(function(i,n){
- if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
- window.frames[$(this).attr("name")].Stop();
- }
- })/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
-
- }
- //班长监测返回状态
- //坐席状态
- function AgentStateBack(data) {
- $('#content-main .J_iframeNew').each(function(i,n){
- if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
- window.frames[$(this).attr("name")].UpdateAgentState(data.AgentID, data.State);
- }
- })/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
- }
- //线路状态
- function LineStateBack(data) {
- $('#content-main .J_iframeNew').each(function(i,n){
- if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
- window.frames[$(this).attr("name")].UpdateLineState(data.AgentID, data.State);
- }
- })/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
- }
- //录音返回
- function RecordPathBack(data) {
- $(".hidCallID").val(data.CallID);
- //if ($(".hidTel").val() && $(".hidCallID").val()) {
- // $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', { callid: $(".hidCallID").val(),path:data.RecPath, "token": $.cookie("token") }, function (result) {
- // result = JSON.parse(result);
- // if (result.state.toLowerCase() == "success") {
- // }
- // })
- //}
-
- // 外呼返回CallId
- makeCallId = data.CallID;
-
- if(hidTel) {
- $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', {
- callid: data.CallID,
- path: data.RecPath,
- "token": $.cookie("token")
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {}
- })
- }
- }
- //获取当前的日期时间 格式“yyyy-MM-dd HH:mm:ss”
- function getNowFormatDate() {
- var date = new Date();
- var seperator1 = "-";
- var seperator2 = ":";
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if(month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if(strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +
- " " + date.getHours() + seperator2 + date.getMinutes() +
- seperator2 + date.getSeconds();
- return currentdate;
- }
|