Browse Source

reactor:通话ID统一;

zhangchong 10 months ago
parent
commit
a427b3d20a

+ 13 - 7
src/layout/navBars/breadcrumb/telControl.vue

@@ -556,6 +556,7 @@ import { useSocket } from '@/utils/websocket';
 import mittBus from '@/utils/mitt';
 import { voiceAssistant } from '@/api/todo/voiceAssistant';
 import { submitLog } from '@/api/public/log';
+import { B } from '@vueuse/motion/dist/shared/motion.5ee44005';
 // 引入组件
 const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
 const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
@@ -906,7 +907,7 @@ const onMessage = async (event: any) => {
 						console.log('呼叫中心:调用示闲');
 					}
 				}
-			}, 300);
+			}, 100);
 			console.log('呼叫中心:已签入');
 			ElMessage.success('签入成功');
 			stopReconnect(); // 停止重连
@@ -1175,12 +1176,12 @@ const onMessage = async (event: any) => {
 							state: {
 								createBy: 'tel',
 								fromTel: data.ani,
-								telGuid: data.call_accept,
+								telGuid: data.other_accept,
 								transfer: data.gateway,
 								telArea: '',
 							},
 							params: {
-								callId: data.call_accept,
+								callId: data.other_accept,
 								tagsViewName: '工单受理',
 							},
 						});
@@ -1240,10 +1241,11 @@ const submitLogFn = async (event: any) => {
 	}
 };
 // 呼叫中心链接关闭
+const isReconnect = ref<boolean>(true); // 是否需要重连
 const onClose = async (event: any) => {
 	const { result } = await getTelStatus();
-	console.log('呼叫中心断开链接', result ? '需要重连' : '不需要重连');
-	if (result) {
+	console.log('呼叫中心断开链接', result && isReconnect.value ? '需要重连' : '不需要重连');
+	if (result && isReconnect.value) {
 		// 签入状态需要重连
 		await reConnect(); // 重新链接呼叫中心
 	} else {
@@ -1281,6 +1283,7 @@ const reConnect = async () => {
 // 链接成功 停止重连
 const stopReconnect = () => {
 	clearTimeout(reconnectTimeout.value);
+	isReconnect.value = false;
 	console.log('停止重连');
 };
 const dutyFormRef = ref<RefType>();
@@ -1447,11 +1450,12 @@ const onCallOut = () => {
 					websocket_connect();
 					// 设置电话状态 外呼模式中
 					useTelStatusStore.setCallOut(true);
-					// 设置电话状态 保持
+					// 设置电话状态 外呼模式
 					useTelStatusStore.setPhoneControlState(TelStates.onCallOut);
-					state.loading = false;
 					getTelStatusFn();
 					seatAssistOff(); // 关闭坐席辅助
+					isReconnect.value = false;
+					state.loading = false;
 				})
 				.catch(() => {
 					state.loading = false;
@@ -1482,6 +1486,7 @@ const onUnCallOut = () => {
 					useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
 					state.loading = false;
 					getTelStatusFn();
+					isReconnect.value = false;
 				})
 				.catch(() => {
 					state.loading = false;
@@ -1922,6 +1927,7 @@ const resetState = () => {
 	clearInterval(pingTimer.value); // 清除心跳定时器
 	clearInterval(onDutyTimer.value); // 清除签入时长定时器
 	clearInterval(talkTimer.value); // 清除通话时长定时器
+	isReconnect.value = true;
 	state.loading = false;
 };
 // 获取当前分机状态

+ 1 - 1
src/views/business/visit/component/Visit-detail.vue

@@ -617,7 +617,7 @@ const callId = ref<string>('');
 onMounted(() => {
 	mittBus.on('outboundConnect', (data) => {
 		console.log(data, '外呼已经接通辣');
-		if (data.dnis === state.orderDetail.contact) callId.value = data.call_accept;
+		if (data.dnis === state.orderDetail.contact) callId.value = data.other_accept;
 	});
 });
 onBeforeUnmount(() => {