|
@@ -0,0 +1,798 @@
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
+import router from '/@/router';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
+import { WebsocketInterface } from "./websocket";
|
|
|
+import { useTelStatus } from '/@/stores/telStatus';
|
|
|
+import { useUserInfo } from '/@/stores/userInfo';
|
|
|
+import { useAppConfig } from '/@/stores/appConfig';
|
|
|
+import { TelStates, RestStates } from '/@/stores/interface';
|
|
|
+import { debounce } from '/@/utils/tools';
|
|
|
+
|
|
|
+const storesUserInfo = useUserInfo();
|
|
|
+const { userInfos } = storeToRefs(storesUserInfo);
|
|
|
+const useTelStatusStore = useTelStatus();
|
|
|
+const { telStatusInfo } = storeToRefs(useTelStatusStore);
|
|
|
+const appConfigStore = useAppConfig();
|
|
|
+const { AppConfigInfo } = storeToRefs(appConfigStore);
|
|
|
+
|
|
|
+//定义当前登录的用户,在jquery的$(function(){})中对下面参数赋值, 全局变量,取值在PhoneScript.js中处理的,
|
|
|
+const SystemAttr = {
|
|
|
+ CurrentUser: { "DepartmentID": "", "GongHao": "", "FenJi": "", "AgentGroupName": "" }
|
|
|
+}
|
|
|
+let timer: any = null;
|
|
|
+let time = 0;
|
|
|
+// 开始计时
|
|
|
+const startTime = debounce(() => {
|
|
|
+ let talkTime = telStatusInfo.value.callTime
|
|
|
+ if (talkTime) {
|
|
|
+ time = Number(talkTime);
|
|
|
+ timer = setInterval(() => {
|
|
|
+ time++;
|
|
|
+ useTelStatusStore.setCallTime(time);
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ timer= setInterval(() => {
|
|
|
+ time++;
|
|
|
+ useTelStatusStore.setCallTime(time);
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+}, 1000);
|
|
|
+// 结束计时
|
|
|
+const removeTimer = debounce(() => {
|
|
|
+ time = 0;
|
|
|
+ useTelStatusStore.clearCallTime();
|
|
|
+ clearInterval(timer);
|
|
|
+}, 1000);
|
|
|
+
|
|
|
+//音频接口对象
|
|
|
+export const VoiceInterfaceObject:any = {
|
|
|
+ // 设置全局变量
|
|
|
+ SetSendModel: function (params: any) {
|
|
|
+ SystemAttr.CurrentUser.DepartmentID = params.DepartmentID || ""; // 部门ID
|
|
|
+ SystemAttr.CurrentUser.GongHao = params.GongHao || ""; // 工号
|
|
|
+ SystemAttr.CurrentUser.FenJi = params.FenJi || ""; // 分机
|
|
|
+ SystemAttr.CurrentUser.AgentGroupName = params.AgentGroupName || ""; // 坐席组
|
|
|
+ },
|
|
|
+ /*
|
|
|
+ * @@@@全局变量
|
|
|
+ *
|
|
|
+ * 当前实体对象
|
|
|
+ * 下行JSON格式:{ "Action": "", "GongHao": "", "FenJi": "", "PlatFormCode": "", "Params": "" }
|
|
|
+ * 上行JSON格式:{ "Action": "", "GongHao": "", "FenJi": "", "PlatFormCode": "", "Params": "", "Message": "" }
|
|
|
+ */
|
|
|
+ GetSendModel: function (action: string, params?: string) {
|
|
|
+ let p_action = action || "";
|
|
|
+ let p_params = params || "";
|
|
|
+ return {"Action": p_action, "GongHao": SystemAttr.CurrentUser.GongHao, "FenJi": SystemAttr.CurrentUser.FenJi, "PlatFormCode": SystemAttr.CurrentUser.DepartmentID, "Params": p_params};
|
|
|
+ },
|
|
|
+ /*
|
|
|
+ * @@@@事件触发
|
|
|
+ *
|
|
|
+ * 当前实体对象
|
|
|
+ * 下行JSON格式:{ "Action": "", "GongHao": "", "FenJi": "", "PlatFormCode": "", "Params": "" }
|
|
|
+ * 上行JSON格式:{ "Action": "", "GongHao": "", "FenJi": "", "PlatFormCode": "", "Params": "", "Message": "" }
|
|
|
+ */
|
|
|
+ //弹屏 回调
|
|
|
+ Back_TelPhoneEvent: function (returnVal: { Message: string; Params: any; }) {
|
|
|
+ let DialArray = returnVal.Message.split(",");
|
|
|
+ let DialInfo:any = {};
|
|
|
+ DialInfo.fromTel = DialArray[0]; //来电号码
|
|
|
+ DialInfo.telGongHao = DialArray[1]; //来电工号
|
|
|
+ DialInfo.telArea = DialArray[3]; //来电区域
|
|
|
+ DialInfo.telGuid = DialArray[4]; //来电GUID
|
|
|
+ DialInfo.telIVR = DialArray[5]; //来电IVR名称
|
|
|
+ DialInfo.telType = returnVal.Params; // 0来电 1外呼 2转接
|
|
|
+
|
|
|
+ console.info(returnVal.Message,DialInfo,'来电谈单');
|
|
|
+
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telGongHao: DialInfo.telGongHao,
|
|
|
+ fromTel: DialInfo.fromTel,
|
|
|
+ telArea: DialInfo.telArea,
|
|
|
+ telGuid: DialInfo.telGuid,
|
|
|
+ telIVR: DialInfo.telIVR,
|
|
|
+ telType: DialInfo.telType,
|
|
|
+ });
|
|
|
+ // 设置电话状态 振铃中
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.ring);
|
|
|
+
|
|
|
+ if(DialInfo.telType === '0'){ // 来电才展示弹屏
|
|
|
+ // 跳转到录入工单页面
|
|
|
+ router.push({
|
|
|
+ name: 'orderAdd',
|
|
|
+ params: {
|
|
|
+ createBy: 'tel',
|
|
|
+ telNo: DialInfo.fromTel,
|
|
|
+ callId: DialInfo.telGuid,
|
|
|
+ transfer: '12315',
|
|
|
+ tagsViewName: '工单受理',
|
|
|
+ },
|
|
|
+ }).then(()=>{} );
|
|
|
+ }
|
|
|
+ //layer.open({
|
|
|
+ // title: "来电弹屏",
|
|
|
+ // type: 1,
|
|
|
+ // area: ['600px', '360px'],
|
|
|
+ // shadeClose: true, //点击遮罩关闭
|
|
|
+ // content: '\<\div style="padding:10px;">来电号码:' + DialInfo.telNum + '<br>来电工号:' + DialInfo.telGongHao + '<br>来电区域:' + DialInfo.telArea + '<br>来电GUID:' + DialInfo.telGuid + '<br>来电IVR名称:' + DialInfo.telIVR + '<br>来电类型:' + DialInfo.telType + ' \<\/div>'
|
|
|
+ //});
|
|
|
+ },
|
|
|
+ //弹屏 回调
|
|
|
+ // Back_RegNumberState: function (returnVal: any) {
|
|
|
+ // //Tel,GongHao,URL,Area,Guid,IVR,Remark
|
|
|
+ // console.log(returnVal);
|
|
|
+ // },
|
|
|
+ //心跳 回调
|
|
|
+ Back_keeplive: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+ //登录
|
|
|
+ Login: function () {
|
|
|
+ const modelJson = this.GetSendModel("Login");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //登录回调
|
|
|
+ Back_Login: function (returnVal: { Params: string; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ WebsocketInterface("KeepAlive");
|
|
|
+ // 设置分机号
|
|
|
+ useTelStatusStore.setCallInfo({telsNo: SystemAttr.CurrentUser.FenJi});
|
|
|
+ // 设置签入状态
|
|
|
+ useTelStatusStore.setDutyState(true);
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ this.SetGroupRole();// 设置组权限
|
|
|
+ this.SetRecordRole();// 设置录音权限
|
|
|
+ this.SetCallRole();// 设置呼叫权限
|
|
|
+ ElMessage.success("登录语音系统成功!")
|
|
|
+ } else {
|
|
|
+ ElMessage.error("登录语音系统失败!")
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //设置用户权限
|
|
|
+ SetGroupRole: function () {
|
|
|
+ const modelJson = this.GetSendModel("SetGroupRole", SystemAttr.CurrentUser.AgentGroupName);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //设置用户权限 回调
|
|
|
+ Back_SetGroupRole: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success(returnVal.Message)
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ ElMessage.error('设置组权限失败')
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 设置录音权限
|
|
|
+ SetRecordRole: function () {
|
|
|
+ const modelJson = this.GetSendModel("SetRecRole", '0');
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 设置录音权限 回调
|
|
|
+ Back_SetRecRole: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success(returnVal.Message)
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ ElMessage.error('设置录音权限失败!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 设置呼叫权限
|
|
|
+ SetCallRole: function () {
|
|
|
+ const modelJson = this.GetSendModel("SetDialRole", '2');
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 设置呼叫权限 回调
|
|
|
+ Back_SetDialRole: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ console.log('设置呼叫权限回调',returnVal)
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success(returnVal.Message)
|
|
|
+ } else {
|
|
|
+ ElMessage.error('设置呼叫权限失败!');
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //登出 当前座席
|
|
|
+ LogOut: function () {
|
|
|
+ const modelJson = this.GetSendModel("LogOut");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ ElMessage.success("语音系统退出成功!")
|
|
|
+ // 关闭websocket
|
|
|
+ const a = WebsocketInterface('Close');
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强制登出
|
|
|
+ F_LogOut: function (gongHao: any) {
|
|
|
+ const modelJson = {"Action": "LogOut", "GongHao": gongHao, "FenJi": "", "PlatFormCode": SystemAttr.CurrentUser.DepartmentID, "Params": ""};
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //登出回调
|
|
|
+ Back_LogOut: function (returnVal: any) {
|
|
|
+ console.info(returnVal);
|
|
|
+ },
|
|
|
+ //退出事件
|
|
|
+ Back_NoLogin: function (returnVal: any) {
|
|
|
+ ElMessage.error(returnVal.message)
|
|
|
+ console.info(returnVal.message);
|
|
|
+ },
|
|
|
+ //示忙当前座席
|
|
|
+ SetBusy: function () {
|
|
|
+ const modelJson = this.GetSendModel("SetBusy");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强制示忙座席
|
|
|
+ F_SetBusy: function (gongHao: any) {
|
|
|
+ const modelJson = {"Action": "SetBusy", "GongHao": gongHao, "FenJi": "", "PlatFormCode": SystemAttr.CurrentUser.DepartmentID, "Params": ""};
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //示忙回调
|
|
|
+ Back_SetBusy: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success("小休开始!")
|
|
|
+ // 设置电话状态小休中
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.rest);
|
|
|
+ useTelStatusStore.setRest(RestStates.resting);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //示闲当前座席
|
|
|
+ SetIdle: function () {
|
|
|
+ const modelJson = this.GetSendModel("SetIdle");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强制示闲座席
|
|
|
+ F_SetIdle: function (gongHao: any) {
|
|
|
+ const modelJson = {"Action": "SetIdle", "GongHao": gongHao, "FenJi": "", "PlatFormCode": SystemAttr.CurrentUser.DepartmentID, "Params": ""};
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //示闲回调
|
|
|
+ Back_SetIdle: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success("小休结束!")
|
|
|
+ // 设置休息状态 设置未正常状态
|
|
|
+ useTelStatusStore.setRest(RestStates.unRest);
|
|
|
+ // 设置话机状态 结束休息改为签入状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保持
|
|
|
+ KeepInTouch: function () {
|
|
|
+ const modelJson = this.GetSendModel("KeepInTouch");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保持回调
|
|
|
+ Back_KeepInTouch: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setHold(true);
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.onHold);
|
|
|
+ ElMessage('开始保持');
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //取消保持
|
|
|
+ KeepCancelInTouch: function () {
|
|
|
+ const modelJson = this.GetSendModel("KeepCancelInTouch");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //取消保持回调
|
|
|
+ Back_KeepCancelInTouch: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ // 设置电话状态 取消单个保持为通话中
|
|
|
+ useTelStatusStore.setHold(false);
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.onCall);
|
|
|
+ ElMessage('取消保持');
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //开启事后
|
|
|
+ TalkedDealBegin: function () {
|
|
|
+ const modelJson = this.GetSendModel("KeepCancelInTouch");
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //开启事后 回调
|
|
|
+ Back_TalkedDealBegin: function (returnVal: any) {
|
|
|
+
|
|
|
+ },
|
|
|
+ //结束事后
|
|
|
+ TalkedDealEnd: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ //结束事后 回调
|
|
|
+ Back_TalkedDealEnd: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ //语音呼叫
|
|
|
+ DialOut: function (phone: any) {
|
|
|
+ const modelJson = this.GetSendModel("DialOut", phone);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 语音呼叫 回调
|
|
|
+ Back_DialOut: function (returnVal: any) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ ElMessage.success(returnVal.Message)
|
|
|
+ }else{
|
|
|
+ ElMessage.error(returnVal.Message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 语音呼叫 回调
|
|
|
+ Back_dialOut: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+
|
|
|
+ }else{
|
|
|
+ ElMessage.error(returnVal.Message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //视频呼叫
|
|
|
+ VideoCall: function (phone: any) {
|
|
|
+ const modelJson = this.GetSendModel("VideoCall", phone);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //挂断
|
|
|
+ HangUp: function (phone?: any) {
|
|
|
+ const modelJson = this.GetSendModel("HangUp", phone);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ } else {
|
|
|
+ closeWrVideo("videortmp");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //挂断 回调
|
|
|
+ Back_HangUp: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telArea: "", // 电话区号
|
|
|
+ telGuid: "", // 电话guid
|
|
|
+ telIVR: "", // 电话IVR
|
|
|
+ telType: "", //来电 外呼 转接
|
|
|
+ fromTel: "", // 来电号码
|
|
|
+ });
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强拆 挂断
|
|
|
+ Rtmp: function (phone: any) {
|
|
|
+ const modelJson = this.GetSendModel("Rtmp", phone);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //自动外呼
|
|
|
+ StartAutoDial: function (phone: any) {
|
|
|
+ const modelJson = this.GetSendModel("StartAutoDial", phone);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //通知公告
|
|
|
+ Notice: function (tels: string, content: string) {
|
|
|
+ const param = tels + "|" + content;
|
|
|
+ const modelJson = this.GetSendModel("Notice", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //外呼回调
|
|
|
+ Back_Rtmp: function (returnVal: { Params: string; Rtsp: any; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.log(returnVal);
|
|
|
+ const videoid = $("#videortmp").prop("id");
|
|
|
+ const suuid = parseInt(String(Math.random() * 100000)) + '' + new Date().getTime();
|
|
|
+ registerWrVideo(suuid, videoid, returnVal.Rtsp);
|
|
|
+ //registerWrVideo(returnVal.CallGuid,videoid,returnVal.Rtsp);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //强拆 挂断
|
|
|
+ F_HangUp: function (gongHao: any) {
|
|
|
+ const modelJson = {"Action": "HangUp", "GongHao": gongHao, "FenJi": "", "PlatFormCode": SystemAttr.CurrentUser.DepartmentID, "Params": ""};
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //转接
|
|
|
+ TeleSwitch: function (gongHao: any) {
|
|
|
+ const modelJson = this.GetSendModel("TeleSwitch", gongHao);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //转接 回调
|
|
|
+ Back_TeleSwitch: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message,'转接成功');
|
|
|
+ ElMessage.success(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 转接挂机通知事件
|
|
|
+ Back_TransferTrunkTalkingEnd: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ console.log(returnVal,'转接挂断事件')
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telArea: "", // 电话区号
|
|
|
+ telGuid: "", // 电话guid
|
|
|
+ telIVR: "", // 电话IVR
|
|
|
+ telType: "", //来电 外呼 转接
|
|
|
+ fromTel: "", // 来电号码
|
|
|
+ });
|
|
|
+ useTelStatusStore.clearCallTime();
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ },
|
|
|
+ // 转接开始通知事件
|
|
|
+ Back_BeginTransferTalking: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ console.log(returnVal,'转接开始事件')
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telArea: "", // 电话区号
|
|
|
+ telGuid: "", // 电话guid
|
|
|
+ telIVR: "", // 电话IVR
|
|
|
+ telType: "", //来电 外呼 转接
|
|
|
+ fromTel: "", // 来电号码
|
|
|
+ });
|
|
|
+ useTelStatusStore.clearCallTime();
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ },
|
|
|
+ //代接
|
|
|
+ InsteadOfTele: function (gonghao:any) {
|
|
|
+ const modelJson = this.GetSendModel("InsteadOfTele", gonghao);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //代接 回调
|
|
|
+ Back_InsteadOfTele: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强插
|
|
|
+ CancleChannel: function (gongHao: any) {
|
|
|
+ const modelJson = this.GetSendModel("CancleChannel", gongHao);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //强插 回调
|
|
|
+ Back_CancleChannel: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //监听
|
|
|
+ LinkTele: function (gongHao: any) {
|
|
|
+ const modelJson = this.GetSendModel("LinkTele", gongHao);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //开启会议 音频
|
|
|
+ StartMeeting: function (meetId: string, tels: string) {
|
|
|
+ const param = meetId + "|" + tels;
|
|
|
+ const modelJson = this.GetSendModel("StartMeeting", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 开启会议 音频 回调
|
|
|
+ Back_StartMeeting: function (returnVal: any) {
|
|
|
+ console.log(returnVal,'开启会议 音频 回调');
|
|
|
+ },
|
|
|
+ //开启会议 视频
|
|
|
+ Back_OnMeeting: function (returnVal: any) {
|
|
|
+ console.log(returnVal,'开启会议 音频 回调1');
|
|
|
+ },
|
|
|
+ //视频会议
|
|
|
+ StartVideoMeeting: function (meetId: string, tels: string) {
|
|
|
+ const param = meetId + "|" + tels;
|
|
|
+ const modelJson = this.GetSendModel("StartVideoMeeting", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //开启会议 视频
|
|
|
+ StartMeetingVideo: function (meetId: string, urls: string) {
|
|
|
+ const param = meetId + "|" + urls;
|
|
|
+ const modelJson = this.GetSendModel("StartMeetingVideo", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //视频推送
|
|
|
+ GetMcuVideo: function (meetId: string, guid: string) {
|
|
|
+ const param = meetId + "|" + guid;
|
|
|
+ const modelJson = this.GetSendModel("GetMcuVideo", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //视频推送 回调
|
|
|
+ Back_GetMcuVideo: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //禁言
|
|
|
+ ShutDownTalking: function (meetId: string, tel: string) {
|
|
|
+ const param = meetId + "|" + tel;
|
|
|
+ const modelJson = this.GetSendModel("ShutDownTalking", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //禁言 回调
|
|
|
+ Back_ShutDownTalking: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //踢人
|
|
|
+ ConferGetOut: function (meetId: string, tel: string) {
|
|
|
+ const param = meetId + "|" + tel;
|
|
|
+ const modelJson = this.GetSendModel("ConferGetOut", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //踢人 回调
|
|
|
+ Back_ConferGetOut: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //禁言所有
|
|
|
+ ShutDownAll: function (meetId: string) {
|
|
|
+ const param = meetId + "|" + SystemAttr.CurrentUser.TelNum;
|
|
|
+ const modelJson = this.GetSendModel("ShutDownAll", param);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ if (returnVal != 1) {
|
|
|
+ ElMessage(WebsocketInterface("GetError", returnVal))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //踢人 回调
|
|
|
+ Back_ShutDownAll: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //停止会议
|
|
|
+ StopMeeting: function (meetId: any) {
|
|
|
+ const modelJson = this.GetSendModel("StopMeeting", meetId);
|
|
|
+ const returnVal = WebsocketInterface("Send", JSON.stringify(modelJson));
|
|
|
+ //if (returnVal != 1) {
|
|
|
+ // console.info(WebsocketInterface("GetError", returnVal));
|
|
|
+ //}else{
|
|
|
+ // closeWrVideo("video1");
|
|
|
+ // closeWrVideo("video2");
|
|
|
+ // closeWrVideo("video3");
|
|
|
+ // closeWrVideo("video4");
|
|
|
+ // closeWrVideo("video5");
|
|
|
+ // closeWrVideo("video6");
|
|
|
+ // closeWrVideo("video7");
|
|
|
+ // closeWrVideo("video8");
|
|
|
+ // closeWrVideo("video9");
|
|
|
+ // $("video[name='meetvideo']").removeClass("play");
|
|
|
+ //}
|
|
|
+ },
|
|
|
+ // 停止会议 回调
|
|
|
+ Back_StopMeeting: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+ //会议结束 回调
|
|
|
+ Back_MeetingEnd: function (returnVal: any) {
|
|
|
+ ElMessage('会议结束')
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+ //监听 回调
|
|
|
+ Back_LinkTele: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ } else {
|
|
|
+ console.info(returnVal.Message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //分机注册状态回调
|
|
|
+ Back_RegNumberState: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+ //通话挂机事件
|
|
|
+ Back_TalkingEnd: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ console.info(returnVal.Message,'结束通话 挂机') //解析Message参数 有电话号码|电话唯一ID|录音文件名称
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telArea: "", // 电话区号
|
|
|
+ telGuid: "", // 电话guid
|
|
|
+ telIVR: "", // 电话IVR
|
|
|
+ telType: "", //来电 外呼 转接
|
|
|
+ fromTel: "", // 来电号码
|
|
|
+ });
|
|
|
+
|
|
|
+ useTelStatusStore.clearCallTime();
|
|
|
+ // 关闭定时器
|
|
|
+ removeTimer();
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ },
|
|
|
+ //振铃结束
|
|
|
+ Back_UserRingEnd: function (returnVal: any) {
|
|
|
+ const DialArray = returnVal.Message.split("|");
|
|
|
+ const telNum = DialArray[0]; //来电号码
|
|
|
+ const telGuid = DialArray[1]; //来电GUID
|
|
|
+ const telVoiceName = DialArray[2]; // 录音文件名
|
|
|
+
|
|
|
+ console.log(telNum,telGuid,telVoiceName)
|
|
|
+ useTelStatusStore.setCallInfo({
|
|
|
+ telArea: "", // 电话区号
|
|
|
+ telGuid: "", // 电话guid
|
|
|
+ telIVR: "", // 电话IVR
|
|
|
+ telType: "", //来电 外呼 转接
|
|
|
+ fromTel: "", // 来电号码
|
|
|
+ });
|
|
|
+ useTelStatusStore.clearCallTime();
|
|
|
+ // 设置电话状态
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
|
|
|
+ },
|
|
|
+ //开始通话事件
|
|
|
+ Back_BeginTalking: function (returnVal: { Params: string; Message: any; }) {
|
|
|
+ console.info(returnVal.Message,'开始通话'); //解析Message参数 有电话号码|电话唯一ID|录音文件名称
|
|
|
+ startTime();
|
|
|
+ // 设置电话状态 通话中
|
|
|
+ useTelStatusStore.setPhoneControlState(TelStates.onCall);
|
|
|
+ },
|
|
|
+ //获取视频流事件
|
|
|
+ Back_RtmpVideoMeeting: function (returnVal: { Params: string; Rtsp: any; Tel: any; CallGuid: any; }) {
|
|
|
+ console.info("Back_RtmpVideoMeeting");
|
|
|
+ console.log(returnVal);
|
|
|
+ if (returnVal.Params == "1") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const vid = $("video[name='meetvideo']:not('.play')").eq(0);
|
|
|
+ const vedioId = vid.prop("id");
|
|
|
+ const _td = vid.closest("td");
|
|
|
+ //var vedioId=$("#video1").prop("id");
|
|
|
+ const uuid = parseInt(String(Math.random() * 100000)) + '' + new Date().getTime();
|
|
|
+ registerWrVideo(uuid, vedioId, returnVal.Rtsp);
|
|
|
+ //registerWrVideo(returnVal.CallGuid, vedioId, returnVal.Rtsp);
|
|
|
+ _td.find("input[name='meet_num']").val(returnVal.Tel);
|
|
|
+ _td.find("input[name='meet_guid']").val(returnVal.CallGuid);
|
|
|
+ vid.addClass("play");
|
|
|
+ },
|
|
|
+ Back_EndVideoTalking: function (returnVal: { Params: string; Tel: string; }) {
|
|
|
+ console.log(returnVal);
|
|
|
+ if (returnVal.Params == "0") {
|
|
|
+ const _td = $("input[name='meet_num'][value='" + returnVal.Tel + "']").closest("td");
|
|
|
+ _td.find("input[name='meet_num']").val("");
|
|
|
+ _td.find("input[name='meet_guid']").val("");
|
|
|
+ _td.find("video").removeClass("play");
|
|
|
+ closeWrVideo(_td.find("video").attr("id"));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ Back_StartVideoMeeting: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+
|
|
|
+ Back_CloseRtmp: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+
|
|
|
+ Back_VideoCall: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+
|
|
|
+ Back_BeginVideoTalking: function (returnVal: any) {
|
|
|
+ console.log(returnVal);
|
|
|
+ },
|
|
|
+ //排队信息推送
|
|
|
+ Back_TelQuene: function (returnVal: any) {
|
|
|
+ // Params: "0" 表示正在排队 Params: "1" 表示排队结束
|
|
|
+ let telQuene = []; // 排队信息
|
|
|
+ telQuene.push(returnVal);
|
|
|
+ telQuene = telQuene.filter((item: any) => item.Params === '0');
|
|
|
+ console.log(telQuene,'21');
|
|
|
+ if (telQuene.length > 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: `当前排队人数:${telQuene.length}`,
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|