|
@@ -868,6 +868,7 @@ const clickOnDuty = (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
// 链接呼叫中心
|
|
|
const websocket_connect = () => {
|
|
|
+ console.log('链接呼叫中心');
|
|
|
if (ola.ws) {
|
|
|
// 如果已经连接 则先关闭
|
|
|
ola.close();
|
|
@@ -882,7 +883,7 @@ const onConnect = () => {
|
|
|
ola.subscribe('ola.agent.' + currentTel.value.telNo);
|
|
|
ola.subscribe('ola.caller.' + currentTel.value.telNo);
|
|
|
ola.get_agent_state(currentTel.value.telNo);
|
|
|
-
|
|
|
+ seatAssistOn(); // 坐席助手开启
|
|
|
// ola.logout(currentTel.value.telNo); //连接之后,先登出一次,防止其他地方已经登陆
|
|
|
let array_ola_queue: EmptyArrayType = []; // 队列
|
|
|
if (currentTel.value.queue) {
|
|
@@ -940,7 +941,6 @@ const onMessage = (event: any) => {
|
|
|
state.loading = false;
|
|
|
// ElMessage.success('示闲中');
|
|
|
console.log('呼叫中心:示闲中');
|
|
|
- seatAssistOn();
|
|
|
} else if (data.state == 'unready') {
|
|
|
// 示忙中
|
|
|
useTelStatusStore.setPhoneControlState(TelStates.rest);
|
|
@@ -1477,40 +1477,38 @@ const clickOnOutbound = (formEl: FormInstance | undefined) => {
|
|
|
const socket = ref<any>(null);
|
|
|
// 打开websocket链接
|
|
|
const seatAssistOn = () => {
|
|
|
- if (telStatusInfo.value.telsNo) {
|
|
|
- if (socket.value?.socket?.ws) {
|
|
|
- // 如果已经有连接了 先关闭
|
|
|
- socket.value.close();
|
|
|
- socket.value = null;
|
|
|
- }
|
|
|
- axios
|
|
|
- .get(`${import.meta.env.VITE_VOICE_ASSISTANT_API_URL}/users/getUserByAgentId/${telStatusInfo.value.telsNo}`)
|
|
|
- .then((res) => {
|
|
|
- const { data } = res;
|
|
|
- const { result } = data;
|
|
|
- const uid = `8#User-${result.uid}`;
|
|
|
- const subscribe = `/trans/${result.orgCode}/${result.groupUid}/${uid}`;
|
|
|
- socket.value = useSocket(import.meta.env.VITE_VOICE_ASSISTANT_SOCKET_URL, { uid, subscribe });
|
|
|
- socket.value.on('open', () => {
|
|
|
- console.log('坐席辅助:已开启');
|
|
|
- socket.value.send({
|
|
|
- // 调用登录
|
|
|
- id: '',
|
|
|
- type: 1,
|
|
|
- from: uid,
|
|
|
- to: 'sys',
|
|
|
- timestamps: new Date().getTime(),
|
|
|
- body: result.userName,
|
|
|
- });
|
|
|
+ if (socket.value?.socket?.ws) {
|
|
|
+ // 如果已经有连接了 先关闭
|
|
|
+ socket.value.close();
|
|
|
+ socket.value = null;
|
|
|
+ }
|
|
|
+ axios
|
|
|
+ .get(`${import.meta.env.VITE_VOICE_ASSISTANT_API_URL}/users/getUserByAgentId/${currentTel.value.telNo}`)
|
|
|
+ .then((res) => {
|
|
|
+ const { data } = res;
|
|
|
+ const { result } = data;
|
|
|
+ const uid = `8#User-${result.uid}`;
|
|
|
+ const subscribe = `/trans/${result.orgCode}/${result.groupUid}/${uid}`;
|
|
|
+ socket.value = useSocket(import.meta.env.VITE_VOICE_ASSISTANT_SOCKET_URL, { uid, subscribe });
|
|
|
+ socket.value.on('open', () => {
|
|
|
+ console.log('坐席辅助:已开启');
|
|
|
+ socket.value.send({
|
|
|
+ // 调用登录
|
|
|
+ id: '',
|
|
|
+ type: 1,
|
|
|
+ from: uid,
|
|
|
+ to: 'sys',
|
|
|
+ timestamps: new Date().getTime(),
|
|
|
+ body: result.userName,
|
|
|
});
|
|
|
- socket.value.on('message', wsReceive); // 接收消息
|
|
|
- /* socket.value.on('error', onError); // 错误
|
|
|
- socket.value.on('close', onClose); // 关闭*/
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err, '坐席辅助:获取到的坐席辅助用户信息失败');
|
|
|
});
|
|
|
- }
|
|
|
+ socket.value.on('message', wsReceive); // 接收消息
|
|
|
+ /* socket.value.on('error', onError); // 错误
|
|
|
+ socket.value.on('close', onClose); // 关闭*/
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err, '坐席辅助:获取到的坐席辅助用户信息失败');
|
|
|
+ });
|
|
|
};
|
|
|
// 坐席辅助关闭
|
|
|
const seatAssistOff = () => {
|