@phonghq/go-chat 1.0.67 → 1.0.68
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/components/chat/call/Calling.vue.js +2 -2
- package/dist/composable/usePlivo.d.ts +1 -1
- package/dist/composable/usePlivo.js +6 -1
- package/dist/go-chat.es.js +2594 -2594
- package/dist/go-chat.umd.js +14 -14
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ const handlePlivoCallBack = (status, data) => {
|
|
|
46
46
|
handleMedialPermissionError();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const { plivoLogin, plivoCallAnswer, plivoCall, plivoEndCall, plivoCallSwishMute, plivoCallSwishSpeaker, plivoRemoveCallBack, checkTimeLimit,
|
|
49
|
+
const { plivoLogin, plivoCallAnswer, plivoCall, plivoEndCall, plivoCallSwishMute, plivoCallSwishSpeaker, plivoRemoveCallBack, checkTimeLimit, isPlivoOn } = usePlivo(handlePlivoCallBack);
|
|
50
50
|
const STATUS_LABEL = computed(() => {
|
|
51
51
|
return {
|
|
52
52
|
[PLIVO_CALL_STATUS.CONNECTING]: 'Connecting...',
|
|
@@ -247,7 +247,7 @@ const getUserOffer = async (phone) => {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
const handleTimeLimitError = () => {
|
|
250
|
-
if (
|
|
250
|
+
if (!isPlivoOn.value)
|
|
251
251
|
return;
|
|
252
252
|
errorMessage.value = 'Call time limit reached. This call has ended.';
|
|
253
253
|
endCall();
|
|
@@ -12,5 +12,5 @@ export declare function usePlivo(callback: (status: PlivoCallStatusType, data?:
|
|
|
12
12
|
plivoCallSwishSpeaker: (id: any) => void;
|
|
13
13
|
plivoRemoveCallBack: () => void;
|
|
14
14
|
checkTimeLimit: () => Promise<number>;
|
|
15
|
-
|
|
15
|
+
isPlivoOn: import("vue").Ref<boolean, boolean>;
|
|
16
16
|
};
|
|
@@ -2,6 +2,7 @@ import { PLIVO_CALL_STATUS } from '../types/chat/call';
|
|
|
2
2
|
import { createSipAccount } from '../utils/chat/store/call';
|
|
3
3
|
import { dataProfile } from '../utils/chat/store/auth';
|
|
4
4
|
import { getPhoneTimeLimit } from '../utils/chat/store/message';
|
|
5
|
+
import { ref } from 'vue';
|
|
5
6
|
export function usePlivo(callback) {
|
|
6
7
|
var options = {
|
|
7
8
|
debug: 'ALL',
|
|
@@ -15,6 +16,7 @@ export function usePlivo(callback) {
|
|
|
15
16
|
let CallUuid = '';
|
|
16
17
|
let custom_resolve = null;
|
|
17
18
|
let custom_reject = null;
|
|
19
|
+
const isPlivoOn = ref(false);
|
|
18
20
|
const plivoLogin = async (data) => {
|
|
19
21
|
try {
|
|
20
22
|
if (!plivoBrowserSdk) {
|
|
@@ -41,8 +43,10 @@ export function usePlivo(callback) {
|
|
|
41
43
|
// await plivoBrowserSdk?.client?.login(payload.sub , null, token)
|
|
42
44
|
await plivoBrowserSdk?.client?.loginWithAccessToken(data.token);
|
|
43
45
|
plivoBrowserSdk?.client?.setRingTone(false);
|
|
46
|
+
isPlivoOn.value = true;
|
|
44
47
|
// await plivoBrowserSdk?.client?.on?.(payload)
|
|
45
48
|
// console.log('Registered with token')
|
|
49
|
+
console.log(plivoBrowserSdk);
|
|
46
50
|
}
|
|
47
51
|
catch (err) {
|
|
48
52
|
console.log('Login error: ' + err);
|
|
@@ -179,6 +183,7 @@ export function usePlivo(callback) {
|
|
|
179
183
|
plivoBrowserSdk?.client?.off?.('onMediaPermission', handleMediaPermission);
|
|
180
184
|
plivoBrowserSdk?.client?.off?.('onLoginFailed', handleLoginFailed);
|
|
181
185
|
plivoBrowserSdk = null;
|
|
186
|
+
isPlivoOn.value = false;
|
|
182
187
|
};
|
|
183
188
|
const sleep = () => {
|
|
184
189
|
return new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -193,6 +198,6 @@ export function usePlivo(callback) {
|
|
|
193
198
|
plivoCallSwishSpeaker,
|
|
194
199
|
plivoRemoveCallBack,
|
|
195
200
|
checkTimeLimit,
|
|
196
|
-
|
|
201
|
+
isPlivoOn
|
|
197
202
|
};
|
|
198
203
|
}
|