@phonghq/go-chat 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/global/IconSms.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconUser.vue.d.ts +2 -0
- package/dist/chat/App.vue.d.ts +2 -9
- package/dist/chat/page/home/PhoneNumpad.vue.d.ts +11 -0
- package/dist/components/common/select/SelectBase.vue.d.ts +27 -1
- package/dist/components/layout/PageError.vue.d.ts +2 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +2 -2
- package/dist/composable/useListConversations.d.ts +1 -1
- package/dist/composable/useListentEvent.d.ts +1 -1
- package/dist/go-chat.es.js +11199 -10856
- package/dist/go-chat.umd.js +15 -15
- package/dist/plugins/sdk.d.ts +1 -2
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/call/IconPhoneBase.vue.js +20 -0
- package/dist/test/assets/icons/global/IconBackspace.vue.js +28 -0
- package/dist/test/chat/App.vue.js +165 -127
- package/dist/test/chat/page/customer-appointment/CustomerAppointment.vue.js +1 -1
- package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +1 -1
- package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +1 -1
- package/dist/test/chat/page/error/Error.vue.js +1 -1
- package/dist/test/chat/page/home/ChatList.vue.js +54 -39
- package/dist/test/chat/page/home/ChatMessage.vue.js +1 -1
- package/dist/test/chat/page/home/ChatMessageItem.vue.js +7 -5
- package/dist/test/chat/page/home/ChatMessageItem2.vue.js +1 -1
- package/dist/test/chat/page/home/Home.vue.js +42 -35
- package/dist/test/chat/page/home/HomeHeader.vue.js +6 -6
- package/dist/test/chat/page/home/InputChat.vue.js +3 -6
- package/dist/test/chat/page/home/PhoneNumpad.vue.js +127 -0
- package/dist/test/chat/page/setting/Setting.vue.js +1 -1
- package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +2 -0
- package/dist/test/components/chat/call/Calling.vue.js +5 -17
- package/dist/test/components/chat/common/input/InputSearch.vue.js +1 -1
- package/dist/test/components/chat/common/modal/Modal.vue.js +1 -1
- package/dist/test/components/chat/customer/Avatar.vue.js +1 -1
- package/dist/test/components/common/modal/ModalBase.vue.js +1 -1
- package/dist/test/components/common/select/SelectBase.vue.js +69 -106
- package/dist/test/components/layout/PageError.vue.js +91 -0
- package/dist/test/components/ui/select/SelectContent.vue.js +2 -2
- package/dist/test/components/ui/select/SelectItem.vue.js +9 -22
- package/dist/test/components/ui/select/SelectTrigger.vue.js +3 -30
- package/dist/test/composable/useInitData.js +2 -2
- package/dist/test/composable/useListConversations.js +5 -5
- package/dist/test/composable/useListentEvent.js +7 -4
- package/dist/test/composable/usePlivo.js +2 -5
- package/dist/test/plugins/axios.js +0 -2
- package/dist/test/plugins/mqtt.js +12 -4
- package/dist/test/plugins/pocketbase.js +1 -2
- package/dist/test/plugins/sdk.js +2 -12
- package/dist/test/plugins/websocket.js +1 -1
- package/dist/test/utils/chat/cache.js +1 -1
- package/dist/test/utils/chat/{auth.js → store/auth.js} +14 -5
- package/dist/test/utils/chat/{call.js → store/call.js} +3 -3
- package/dist/test/utils/chat/{conversation.js → store/conversation.js} +6 -6
- package/dist/test/utils/chat/{message.js → store/message.js} +25 -1
- package/dist/test/utils/chat/{user.js → store/user.js} +2 -2
- package/dist/test/views/home/phone-numpad/ConvercationList.vue.js +174 -0
- package/dist/test/views/home/phone-numpad/PhoneNumpad.vue.js +270 -0
- package/dist/types/chat/auth.d.ts +1 -0
- package/dist/utils/chat/{auth.d.ts → store/auth.d.ts} +4 -1
- package/dist/utils/chat/{call.d.ts → store/call.d.ts} +1 -1
- package/dist/utils/chat/{conversation.d.ts → store/conversation.d.ts} +3 -3
- package/dist/utils/chat/{message.d.ts → store/message.d.ts} +8 -2
- package/dist/utils/chat/{user.d.ts → store/user.d.ts} +2 -2
- package/dist/views/home/phone-numpad/ConvercationList.vue.d.ts +18 -0
- package/dist/views/home/phone-numpad/PhoneNumpad.vue.d.ts +26 -0
- package/package.json +1 -1
- package/dist/composable/useCallHelper.d.ts +0 -48
- package/dist/test/composable/data.json +0 -32
- package/dist/test/composable/useCallHelper.js +0 -339
- /package/dist/assets/icons/{IconAiCheck.vue.d.ts → call/IconPhoneBase.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconArrowLeft.vue.d.ts → global/IconAiCheck.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconCloseCircle.vue.d.ts → global/IconArrowLeft.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconPhone.vue.d.ts → global/IconBackspace.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconPlus.vue.d.ts → global/IconCloseCircle.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconSms.vue.d.ts → global/IconPhone.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconPlan.vue.d.ts → global/IconPlan.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconUser.vue.d.ts → global/IconPlus.vue.d.ts} +0 -0
- /package/dist/assets/icons/{IconSearch.vue.d.ts → global/IconSearch.vue.d.ts} +0 -0
- /package/dist/test/assets/icons/{IconAiCheck.vue.js → global/IconAiCheck.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconArrowLeft.vue.js → global/IconArrowLeft.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconCloseCircle.vue.js → global/IconCloseCircle.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconPhone.vue.js → global/IconPhone.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconPlan.vue.js → global/IconPlan.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconPlus.vue.js → global/IconPlus.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconSearch.vue.js → global/IconSearch.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconSms.vue.js → global/IconSms.vue.js} +0 -0
- /package/dist/test/assets/icons/{IconUser.vue.js → global/IconUser.vue.js} +0 -0
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { callClient, plivoCall, plivoEndCall } from '../utils/chat/call';
|
|
2
|
-
import { dataProfile } from '../utils/chat/auth';
|
|
3
|
-
import { ref } from 'vue';
|
|
4
|
-
import { WebSocketClient } from '../plugins/websocket';
|
|
5
|
-
import dataJson from './data.json';
|
|
6
|
-
export function useCallHelper() {
|
|
7
|
-
function _getAudioContext(sampleRate) {
|
|
8
|
-
return new (window.AudioContext || window.webkitAudioContext)({
|
|
9
|
-
sampleRate: sampleRate ?? PLIVO_SAMPLE_RATE
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
const PLIVO_SAMPLE_RATE = 8000;
|
|
13
|
-
const SAMPLE_RATE = 48000;
|
|
14
|
-
const CHUNK_LENGTH = 160;
|
|
15
|
-
const uuid = ref('');
|
|
16
|
-
let audioCtxListen = _getAudioContext();
|
|
17
|
-
let audioCtxCall = _getAudioContext();
|
|
18
|
-
let prebuffer = [];
|
|
19
|
-
let nextPlayTime = 0;
|
|
20
|
-
let processorCall;
|
|
21
|
-
let sourceCall;
|
|
22
|
-
let loopTimer = null;
|
|
23
|
-
let running = false;
|
|
24
|
-
let loopId = null;
|
|
25
|
-
const userRemoter = ref(null);
|
|
26
|
-
let websocket = null;
|
|
27
|
-
let stream;
|
|
28
|
-
function _int16ToFloat32(int16Array) {
|
|
29
|
-
const float32 = new Float32Array(int16Array.length);
|
|
30
|
-
for (let i = 0; i < int16Array.length; i++) {
|
|
31
|
-
const int = int16Array[i];
|
|
32
|
-
float32[i] = int < 0 ? int / 32768 : int / 32767;
|
|
33
|
-
}
|
|
34
|
-
return float32;
|
|
35
|
-
}
|
|
36
|
-
function _float32ToMuLaw8(float32Array) {
|
|
37
|
-
const MU_MAX = 0x1fff;
|
|
38
|
-
const BIAS = 0x84;
|
|
39
|
-
const muLawArray = new Uint8Array(float32Array.length);
|
|
40
|
-
for (let i = 0; i < float32Array.length; i++) {
|
|
41
|
-
let sample = float32Array[i];
|
|
42
|
-
// Clamp sample to [-1, 1]
|
|
43
|
-
sample = Math.max(-1, Math.min(1, sample));
|
|
44
|
-
// Convert to PCM value
|
|
45
|
-
let pcm_val = sample < 0 ? -sample * MU_MAX : sample * MU_MAX;
|
|
46
|
-
// Get sign
|
|
47
|
-
let sign = sample < 0 ? 0x80 : 0;
|
|
48
|
-
// Calculate exponent and mantissa
|
|
49
|
-
let exponent = 7;
|
|
50
|
-
for (let expMask = 0x4000; (pcm_val & expMask) === 0 && exponent > 0; expMask >>= 1) {
|
|
51
|
-
exponent--;
|
|
52
|
-
}
|
|
53
|
-
let mantissa = (pcm_val >> (exponent + 3)) & 0x0f;
|
|
54
|
-
// Compose µ-law byte
|
|
55
|
-
let muByte = ~(sign | (exponent << 4) | mantissa) & 0xff;
|
|
56
|
-
muLawArray[i] = muByte;
|
|
57
|
-
}
|
|
58
|
-
return muLawArray;
|
|
59
|
-
}
|
|
60
|
-
function float32To16Bit(float32Array) {
|
|
61
|
-
const buffer = new ArrayBuffer(float32Array.length * 2);
|
|
62
|
-
const view = new DataView(buffer);
|
|
63
|
-
for (let i = 0; i < float32Array.length; i++) {
|
|
64
|
-
let s = Math.max(-1, Math.min(1, float32Array[i]));
|
|
65
|
-
view.setInt16(i * 2, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
|
66
|
-
}
|
|
67
|
-
return buffer;
|
|
68
|
-
}
|
|
69
|
-
function floatToMuLawSample(sample) {
|
|
70
|
-
const MULAW_MAX = 0x1fff;
|
|
71
|
-
const MULAW_BIAS = 33;
|
|
72
|
-
const CLIP = 32635;
|
|
73
|
-
let sign = sample < 0 ? 0x80 : 0;
|
|
74
|
-
sample = Math.min(CLIP, Math.abs(sample * 32768));
|
|
75
|
-
let exponent = Math.floor(Math.log(sample / 256) / Math.log(2));
|
|
76
|
-
let mantissa = (sample >> (exponent + 3)) & 0x0f;
|
|
77
|
-
let muLawByte = ~(sign | (exponent << 4) | mantissa);
|
|
78
|
-
return muLawByte & 0xff;
|
|
79
|
-
}
|
|
80
|
-
function _float32ToUint8(float32Array) {
|
|
81
|
-
const uint8Array = new Uint8Array(float32Array.length);
|
|
82
|
-
for (let i = 0; i < float32Array.length; i++) {
|
|
83
|
-
// map từ [-1, 1] sang [0, 255]
|
|
84
|
-
let val = Math.max(-1, Math.min(1, float32Array[i])); // clamp
|
|
85
|
-
uint8Array[i] = Math.floor((val + 1) * 127.5); // chuyển về 0-255
|
|
86
|
-
}
|
|
87
|
-
return uint8Array;
|
|
88
|
-
}
|
|
89
|
-
function _encodeMuLaw(float32Array) {
|
|
90
|
-
const out = new Uint8Array(float32Array.length);
|
|
91
|
-
for (let i = 0; i < float32Array.length; i++) {
|
|
92
|
-
out[i] = floatToMuLawSample(float32Array[i]);
|
|
93
|
-
}
|
|
94
|
-
return out;
|
|
95
|
-
}
|
|
96
|
-
function _muLawDecode(muLawByte) {
|
|
97
|
-
const MULAW_MAX = 0x1fff;
|
|
98
|
-
const BIAS = 0x84;
|
|
99
|
-
muLawByte = ~muLawByte;
|
|
100
|
-
let sign = muLawByte & 0x80;
|
|
101
|
-
let exponent = (muLawByte >> 4) & 0x07;
|
|
102
|
-
let mantissa = muLawByte & 0x0f;
|
|
103
|
-
let magnitude = ((mantissa << 4) + 8) << (exponent + 3);
|
|
104
|
-
magnitude -= BIAS;
|
|
105
|
-
if (magnitude < 0)
|
|
106
|
-
magnitude = 0;
|
|
107
|
-
return sign ? -magnitude : magnitude;
|
|
108
|
-
}
|
|
109
|
-
function _muLawToFloat32(muLawArray) {
|
|
110
|
-
const pcm = new Float32Array(muLawArray.length);
|
|
111
|
-
for (let i = 0; i < muLawArray.length; i++) {
|
|
112
|
-
pcm[i] = _muLawDecode(muLawArray[i]) / 32768.0;
|
|
113
|
-
}
|
|
114
|
-
return pcm;
|
|
115
|
-
}
|
|
116
|
-
function _float32ToInt16(float32Array) {
|
|
117
|
-
const int16Array = new Int16Array(float32Array.length);
|
|
118
|
-
for (let i = 0; i < float32Array.length; i++) {
|
|
119
|
-
let s = Math.max(-1, Math.min(1, float32Array[i]));
|
|
120
|
-
int16Array[i] = s < 0 ? s * 0x8000 : s * 0x7fff;
|
|
121
|
-
}
|
|
122
|
-
return int16Array;
|
|
123
|
-
}
|
|
124
|
-
function _resample8kTo48k(float8k) {
|
|
125
|
-
const ratio = 48000 / 8000;
|
|
126
|
-
const float48k = new Float32Array(float8k.length * ratio);
|
|
127
|
-
for (let i = 0; i < float48k.length; i++) {
|
|
128
|
-
float48k[i] = float8k[Math.floor(i / ratio)] || 0;
|
|
129
|
-
}
|
|
130
|
-
return float48k;
|
|
131
|
-
}
|
|
132
|
-
const call = async (user) => {
|
|
133
|
-
userRemoter.value = user;
|
|
134
|
-
uuid.value = '';
|
|
135
|
-
const res = await plivoCall(user);
|
|
136
|
-
uuid.value = res?.call?.requestUuid;
|
|
137
|
-
};
|
|
138
|
-
const end = async () => {
|
|
139
|
-
processorCall?.disconnect?.();
|
|
140
|
-
sourceCall?.disconnect?.(processorCall);
|
|
141
|
-
stopQueue();
|
|
142
|
-
websocket?.disconnect();
|
|
143
|
-
stream?.getAudioTracks?.()?.forEach((track) => track?.stop());
|
|
144
|
-
if (!uuid)
|
|
145
|
-
return;
|
|
146
|
-
await plivoEndCall(uuid.value);
|
|
147
|
-
return;
|
|
148
|
-
};
|
|
149
|
-
const startPeerConnection = async () => {
|
|
150
|
-
try {
|
|
151
|
-
if (!audioCtxCall) {
|
|
152
|
-
audioCtxCall = _getAudioContext();
|
|
153
|
-
}
|
|
154
|
-
if (audioCtxCall.state === 'suspended')
|
|
155
|
-
await audioCtxCall.resume();
|
|
156
|
-
stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
157
|
-
sourceCall = audioCtxCall.createMediaStreamSource(stream);
|
|
158
|
-
processorCall = audioCtxCall.createScriptProcessor(256, 1, 1);
|
|
159
|
-
processorCall.onaudioprocess = (e) => {
|
|
160
|
-
const input = e.inputBuffer.getChannelData(0);
|
|
161
|
-
for (let i = 0; i < input.length; i += CHUNK_LENGTH) {
|
|
162
|
-
const slice = input.slice(i, i + CHUNK_LENGTH);
|
|
163
|
-
const binaryChunk = _float32ToMuLaw8(slice);
|
|
164
|
-
// socketSend(binaryChunk)
|
|
165
|
-
// const data = {
|
|
166
|
-
// event: 'testPlaySound',
|
|
167
|
-
// media: {
|
|
168
|
-
// payload: binaryChunk
|
|
169
|
-
// }
|
|
170
|
-
// }
|
|
171
|
-
// console.log(data)
|
|
172
|
-
// addQueueListen(binaryChunk)
|
|
173
|
-
// socketSend(binaryChunk)
|
|
174
|
-
// websocket.binaryType = "arraybuffer";
|
|
175
|
-
// console.log(binaryChunk)
|
|
176
|
-
// websocket.sendDefault(binaryChunk)
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
sourceCall.connect(processorCall);
|
|
180
|
-
processorCall.connect(audioCtxCall.destination);
|
|
181
|
-
}
|
|
182
|
-
catch (e) {
|
|
183
|
-
console.log(e);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
const handleOffer = async (data) => { };
|
|
187
|
-
const sendOfferOk = async () => { };
|
|
188
|
-
const handleOfferResponse = async (data) => { };
|
|
189
|
-
const addQueueListen = (arrayBuffer) => {
|
|
190
|
-
// const int16View = new Int16Array(arrayBuffer)
|
|
191
|
-
const ulawBytes = new Uint8Array(arrayBuffer);
|
|
192
|
-
// const float32Data = int16ToFloat32(int16View)
|
|
193
|
-
const floatData = _muLawToFloat32(ulawBytes);
|
|
194
|
-
prebuffer.push(floatData);
|
|
195
|
-
if (prebuffer.length > 3) {
|
|
196
|
-
prebuffer.shift(); // bỏ gói cũ
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
async function scheduleNext() {
|
|
200
|
-
try {
|
|
201
|
-
const chunk = prebuffer.shift();
|
|
202
|
-
if (chunk) {
|
|
203
|
-
const float48k = _resample8kTo48k(chunk);
|
|
204
|
-
const audioBuffer = audioCtxListen.createBuffer(1, chunk.length, PLIVO_SAMPLE_RATE);
|
|
205
|
-
audioBuffer.getChannelData(0).set(chunk);
|
|
206
|
-
const source = audioCtxListen.createBufferSource();
|
|
207
|
-
source.buffer = audioBuffer;
|
|
208
|
-
source.connect(audioCtxListen.destination);
|
|
209
|
-
// console.log(
|
|
210
|
-
// 'Scheduling chunk',
|
|
211
|
-
// 'nextPlayTime:', nextPlayTime,
|
|
212
|
-
// 'currentTime:', audioCtxListen.currentTime
|
|
213
|
-
// );
|
|
214
|
-
if (nextPlayTime < audioCtxListen.currentTime + (CHUNK_LENGTH / PLIVO_SAMPLE_RATE)) {
|
|
215
|
-
nextPlayTime = audioCtxListen.currentTime + (CHUNK_LENGTH / PLIVO_SAMPLE_RATE);
|
|
216
|
-
}
|
|
217
|
-
source.start(nextPlayTime);
|
|
218
|
-
// console.log(
|
|
219
|
-
// 'Started chunk',
|
|
220
|
-
// 'sourceStartTime:', nextPlayTime,
|
|
221
|
-
// 'audioCtxCurrentTime:', audioCtxListen.currentTime
|
|
222
|
-
// );
|
|
223
|
-
// nextPlayTime += audioBuffer.duration
|
|
224
|
-
nextPlayTime += audioBuffer.duration;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
catch (e) {
|
|
228
|
-
console.log(e);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
let startTime = 0;
|
|
232
|
-
const playQueueLoop = () => {
|
|
233
|
-
if (!running)
|
|
234
|
-
return;
|
|
235
|
-
while (prebuffer.length > 0 && nextPlayTime < audioCtxListen.currentTime + 0.1) {
|
|
236
|
-
scheduleNext();
|
|
237
|
-
}
|
|
238
|
-
loopId = requestAnimationFrame(playQueueLoop);
|
|
239
|
-
};
|
|
240
|
-
async function processSpeakerQueue() {
|
|
241
|
-
try {
|
|
242
|
-
// console.log(prebuffer)
|
|
243
|
-
if (prebuffer.length > 0) {
|
|
244
|
-
const chunk = prebuffer.shift();
|
|
245
|
-
if (chunk) {
|
|
246
|
-
// console.log(chunk.length)
|
|
247
|
-
const audioBuffer = audioCtxListen.createBuffer(1, chunk.length, 8000);
|
|
248
|
-
audioBuffer.getChannelData(0).set(chunk);
|
|
249
|
-
const source = audioCtxListen.createBufferSource();
|
|
250
|
-
source.buffer = audioBuffer;
|
|
251
|
-
source.connect(audioCtxListen.destination);
|
|
252
|
-
if (nextPlayTime < audioCtxListen.currentTime + audioBuffer.duration) {
|
|
253
|
-
nextPlayTime = audioCtxListen.currentTime + audioBuffer.duration;
|
|
254
|
-
}
|
|
255
|
-
source.start(nextPlayTime);
|
|
256
|
-
// console.log(`🎧 Played samples (${audioBuffer.duration.toFixed(3)}s)`);
|
|
257
|
-
nextPlayTime += audioBuffer.duration;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
catch (e) {
|
|
262
|
-
console.log(e);
|
|
263
|
-
}
|
|
264
|
-
requestAnimationFrame(processSpeakerQueue);
|
|
265
|
-
}
|
|
266
|
-
function stopQueue() {
|
|
267
|
-
running = false;
|
|
268
|
-
if (loopTimer)
|
|
269
|
-
clearTimeout(loopTimer);
|
|
270
|
-
if (loopId !== null) {
|
|
271
|
-
cancelAnimationFrame(loopId);
|
|
272
|
-
loopId = null;
|
|
273
|
-
}
|
|
274
|
-
prebuffer.length = 0;
|
|
275
|
-
}
|
|
276
|
-
const handleMedia = async (message) => {
|
|
277
|
-
addQueueListen(message);
|
|
278
|
-
};
|
|
279
|
-
const handleMqttMessage = async (message) => {
|
|
280
|
-
handleMedia(message);
|
|
281
|
-
};
|
|
282
|
-
const startIncomingCall = async (uuid_request) => {
|
|
283
|
-
try {
|
|
284
|
-
if (uuid_request && uuid_request != uuid.value) {
|
|
285
|
-
throw new Error('This call isn’t yours');
|
|
286
|
-
}
|
|
287
|
-
websocket = new WebSocketClient(uuid_request, handleMqttMessage);
|
|
288
|
-
await websocket?.init();
|
|
289
|
-
if (running)
|
|
290
|
-
return;
|
|
291
|
-
running = true;
|
|
292
|
-
if (!audioCtxListen) {
|
|
293
|
-
audioCtxListen = _getAudioContext();
|
|
294
|
-
}
|
|
295
|
-
if (audioCtxListen.state === 'suspended')
|
|
296
|
-
await audioCtxListen.resume();
|
|
297
|
-
nextPlayTime = audioCtxListen.currentTime;
|
|
298
|
-
playQueueLoop();
|
|
299
|
-
// processSpeakerQueue()
|
|
300
|
-
}
|
|
301
|
-
catch (e) {
|
|
302
|
-
end();
|
|
303
|
-
throw new Error(e);
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
const testPlay = () => {
|
|
307
|
-
for (let i = 0; i < dataJson.length; i++) {
|
|
308
|
-
addQueueListen(dataJson[i]);
|
|
309
|
-
}
|
|
310
|
-
if (running)
|
|
311
|
-
return;
|
|
312
|
-
running = true;
|
|
313
|
-
playQueueLoop();
|
|
314
|
-
};
|
|
315
|
-
const handleCallAnswer = (data) => {
|
|
316
|
-
uuid.value = data?.data?.call_uuid ?? '';
|
|
317
|
-
};
|
|
318
|
-
const callAnswer = async (uuid_request) => {
|
|
319
|
-
if (uuid_request && uuid_request != uuid.value) {
|
|
320
|
-
throw new Error('This call isn’t yours');
|
|
321
|
-
}
|
|
322
|
-
await callClient({ call_uuid: uuid.value, clientId: dataProfile.value?.tenant_id ?? '' });
|
|
323
|
-
};
|
|
324
|
-
return {
|
|
325
|
-
call,
|
|
326
|
-
end,
|
|
327
|
-
handleOfferResponse,
|
|
328
|
-
handleOffer,
|
|
329
|
-
sendOfferOk,
|
|
330
|
-
handleMedia,
|
|
331
|
-
userRemoter,
|
|
332
|
-
testPlay,
|
|
333
|
-
handleCallAnswer,
|
|
334
|
-
callAnswer,
|
|
335
|
-
startPeerConnection,
|
|
336
|
-
startIncomingCall,
|
|
337
|
-
uuid
|
|
338
|
-
};
|
|
339
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|