@tbisoftware/phone 2.0.8 → 2.0.9
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/context/PhoneContext.d.ts +10 -1
- package/dist/context/PhoneContext.d.ts.map +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/{index-BTMeEufy.cjs → index-1EBiLrV_.cjs} +1 -1
- package/dist/{index-D8BnjTav.js → index-8z_LWKp3.js} +4 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/react/Phone.d.ts.map +1 -1
- package/dist/react/PhoneContext.d.ts +10 -1
- package/dist/react/PhoneContext.d.ts.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +2 -2
- package/dist/types/index.d.ts +6 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/usePhoneManager-CfG7kttP.cjs +1 -0
- package/dist/usePhoneManager-CjRcDBFA.js +650 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.js +557 -384
- package/dist/vue/usePhone.d.ts +9 -0
- package/dist/vue/usePhone.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/usePhoneManager-B0omS154.js +0 -555
- package/dist/usePhoneManager-DYQFwNDy.cjs +0 -1
package/dist/vue/index.js
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { d as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as fe, ref as b, computed as ie, onMounted as ae, onUnmounted as re, createElementBlock as w, openBlock as y, normalizeClass as Z, unref as G, createCommentVNode as F, createBlock as ge, createElementVNode as e, withDirectives as me, vModelText as he, toDisplayString as I, createTextVNode as ee, Teleport as pe, Fragment as te, renderList as Ce, normalizeStyle as ye, readonly as j, provide as xe, inject as we } from "vue";
|
|
2
|
+
import { d as be, f as le, c as ne, J as oe, P as Se } from "../index-8z_LWKp3.js";
|
|
3
|
+
const Ee = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "flex gap-2 items-center"
|
|
6
|
-
},
|
|
6
|
+
}, _e = ["placeholder"], ke = ["disabled", "title"], ze = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"
|
|
9
|
-
},
|
|
9
|
+
}, Ie = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "w-4 h-4",
|
|
12
12
|
viewBox: "0 0 24 24",
|
|
13
13
|
fill: "currentColor"
|
|
14
|
-
},
|
|
14
|
+
}, Me = {
|
|
15
15
|
key: 1,
|
|
16
16
|
class: "flex flex-col items-center gap-3 py-6"
|
|
17
|
-
},
|
|
17
|
+
}, De = { class: "text-center" }, He = { class: "text-base font-semibold" }, Ue = { class: "text-sm text-gray-500" }, Re = {
|
|
18
18
|
key: 2,
|
|
19
|
-
class: "flex flex-col items-center gap-
|
|
20
|
-
},
|
|
19
|
+
class: "flex flex-col items-center gap-3 py-6"
|
|
20
|
+
}, Te = { class: "text-center" }, Le = { class: "text-sm text-gray-500" }, je = { class: "text-base font-semibold" }, Be = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "text-sm text-gray-600"
|
|
23
|
+
}, Ne = { class: "flex gap-3" }, Pe = {
|
|
21
24
|
key: 3,
|
|
25
|
+
class: "flex flex-col items-center gap-4 py-6"
|
|
26
|
+
}, Oe = { class: "text-center space-y-1" }, $e = { class: "text-xl font-bold" }, Ae = { class: "text-2xl font-mono text-green-600 tabular-nums" }, Ve = {
|
|
27
|
+
key: 4,
|
|
22
28
|
class: "flex flex-col items-center gap-3 py-6"
|
|
23
|
-
},
|
|
29
|
+
}, Fe = {
|
|
24
30
|
key: 0,
|
|
25
31
|
d: "M6.5 5.5 12 11l7-7-1-1-6 6-4.5-4.5H11V3H5v6h1.5V5.5zm17.21 11.17C20.66 13.78 16.54 12 12 12 7.46 12 3.34 13.78.29 16.67c-.18.18-.29.43-.29.71s.11.53.29.71l2.48 2.48c.18.18.43.29.71.29.27 0 .52-.11.7-.28.79-.74 1.69-1.36 2.66-1.85.33-.16.56-.5.56-.9v-3.1c1.45-.48 3-.73 4.6-.73 1.6 0 3.15.25 4.6.72v3.1c0 .39.23.74.56.9.98.49 1.87 1.12 2.67 1.85.18.18.43.28.7.28.28 0 .53-.11.71-.29l2.48-2.48c.18-.18.29-.43.29-.71s-.12-.52-.3-.7z"
|
|
26
|
-
},
|
|
32
|
+
}, Ke = {
|
|
27
33
|
key: 1,
|
|
28
34
|
d: "M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.956.956 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z"
|
|
29
|
-
},
|
|
35
|
+
}, Je = { class: "text-center" }, We = { class: "text-base font-semibold" }, qe = {
|
|
30
36
|
key: 0,
|
|
31
37
|
class: "fixed inset-0 z-50 flex"
|
|
32
|
-
},
|
|
38
|
+
}, Ge = {
|
|
33
39
|
class: "fixed right-0 top-0 h-full w-full max-w-md bg-white shadow-xl",
|
|
34
40
|
style: { "background-color": "white" }
|
|
35
|
-
},
|
|
41
|
+
}, Qe = { class: "flex flex-col h-full" }, Xe = { class: "flex items-center justify-between p-4 border-b" }, Ye = { class: "text-lg font-semibold" }, Ze = { class: "text-sm text-gray-500" }, et = { class: "flex-1 overflow-y-auto p-4" }, tt = {
|
|
36
42
|
key: 0,
|
|
37
43
|
class: "text-center py-12 text-gray-500"
|
|
38
|
-
},
|
|
44
|
+
}, nt = {
|
|
39
45
|
key: 1,
|
|
40
46
|
class: "space-y-2"
|
|
41
|
-
},
|
|
47
|
+
}, ot = {
|
|
42
48
|
key: 2,
|
|
43
49
|
d: "M6.5 5.5 12 11l7-7-1-1-6 6-4.5-4.5H11V3H5v6h1.5V5.5zm17.21 11.17C20.66 13.78 16.54 12 12 12 7.46 12 3.34 13.78.29 16.67c-.18.18-.29.43-.29.71s.11.53.29.71l2.48 2.48c.18.18.43.29.71.29.27 0 .52-.11.7-.28.79-.74 1.69-1.36 2.66-1.85.33-.16.56-.5.56-.9v-3.1c1.45-.48 3-.73 4.6-.73 1.6 0 3.15.25 4.6.72v3.1c0 .39.23.74.56.9.98.49 1.87 1.12 2.67 1.85.18.18.43.28.7.28.28 0 .53-.11.71-.29l2.48-2.48c.18-.18.29-.43.29-.71s-.12-.52-.3-.7z"
|
|
44
|
-
},
|
|
50
|
+
}, lt = { class: "flex-1 min-w-0" }, st = { class: "font-medium text-sm truncate" }, at = { class: "flex items-center gap-2 text-xs text-gray-500" }, rt = { class: "font-mono tabular-nums" }, it = ["onClick"], ft = /* @__PURE__ */ fe({
|
|
45
51
|
__name: "Phone",
|
|
46
52
|
props: {
|
|
47
53
|
config: {},
|
|
@@ -49,146 +55,186 @@ const ye = {
|
|
|
49
55
|
labels: { default: () => ({}) },
|
|
50
56
|
onCallStart: {},
|
|
51
57
|
onCallEnd: {},
|
|
52
|
-
onStatusChange: {}
|
|
58
|
+
onStatusChange: {},
|
|
59
|
+
onIncomingCall: {}
|
|
53
60
|
},
|
|
54
|
-
emits: ["callStart", "callEnd", "statusChange"],
|
|
55
|
-
setup(
|
|
56
|
-
const
|
|
57
|
-
let
|
|
58
|
-
function
|
|
59
|
-
return `${
|
|
61
|
+
emits: ["callStart", "callEnd", "statusChange", "incomingCall"],
|
|
62
|
+
setup(S, { emit: O }) {
|
|
63
|
+
const c = S, d = O;
|
|
64
|
+
let a = null, B = null;
|
|
65
|
+
function r(l) {
|
|
66
|
+
return `${l.websocketUrl}|${l.sipUri}|${l.authorizationUser}`;
|
|
60
67
|
}
|
|
61
|
-
function
|
|
62
|
-
const t =
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
65
|
-
if (
|
|
68
|
+
function p(l) {
|
|
69
|
+
const t = r(l);
|
|
70
|
+
if (a && B === t)
|
|
71
|
+
return a;
|
|
72
|
+
if (a && B !== t) {
|
|
66
73
|
try {
|
|
67
|
-
|
|
74
|
+
a.ua.stop();
|
|
68
75
|
} catch {
|
|
69
76
|
}
|
|
70
|
-
|
|
77
|
+
a = null;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
sockets: [new
|
|
75
|
-
uri:
|
|
76
|
-
password:
|
|
77
|
-
registrar_server:
|
|
78
|
-
display_name:
|
|
79
|
-
authorization_user:
|
|
79
|
+
B = t;
|
|
80
|
+
const m = {
|
|
81
|
+
sockets: [new oe.WebSocketInterface(l.websocketUrl)],
|
|
82
|
+
uri: l.sipUri,
|
|
83
|
+
password: l.password,
|
|
84
|
+
registrar_server: l.registrarServer,
|
|
85
|
+
display_name: l.displayName,
|
|
86
|
+
authorization_user: l.authorizationUser,
|
|
80
87
|
connection_recovery_min_interval: 2,
|
|
81
88
|
connection_recovery_max_interval: 30
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
ua:
|
|
86
|
-
audio:
|
|
89
|
+
}, D = new oe.UA(m), V = document.createElement("audio");
|
|
90
|
+
V.autoplay = !0;
|
|
91
|
+
const P = {
|
|
92
|
+
ua: D,
|
|
93
|
+
audio: V,
|
|
87
94
|
isStarted: !1,
|
|
88
95
|
listeners: /* @__PURE__ */ new Set()
|
|
89
96
|
};
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
|
|
96
|
-
}),
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
}),
|
|
101
|
-
|
|
102
|
-
}),
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
return D.on("connecting", () => {
|
|
98
|
+
P.listeners.forEach((U) => U.onConnecting?.());
|
|
99
|
+
}), D.on("connected", () => {
|
|
100
|
+
P.listeners.forEach((U) => U.onConnected?.());
|
|
101
|
+
}), D.on("disconnected", () => {
|
|
102
|
+
P.listeners.forEach((U) => U.onDisconnected?.());
|
|
103
|
+
}), D.on("registered", () => {
|
|
104
|
+
P.listeners.forEach((U) => U.onRegistered?.());
|
|
105
|
+
}), D.on("unregistered", () => {
|
|
106
|
+
P.listeners.forEach((U) => U.onUnregistered?.());
|
|
107
|
+
}), D.on("registrationFailed", (U) => {
|
|
108
|
+
P.listeners.forEach((T) => T.onRegistrationFailed?.(U?.cause));
|
|
109
|
+
}), D.on("newRTCSession", (U) => {
|
|
110
|
+
const T = U.session;
|
|
111
|
+
if (T.direction === "incoming") {
|
|
112
|
+
const A = T.remote_identity, K = A?.uri?.user || "Unknown", ve = A?.display_name || void 0;
|
|
113
|
+
P.listeners.forEach((q) => q.onIncomingSession?.(T, K, ve)), T.on("peerconnection", () => {
|
|
114
|
+
T.connection.addEventListener("addstream", (q) => {
|
|
115
|
+
if (!q.streams?.length) return;
|
|
116
|
+
const X = document.createElement("audio");
|
|
117
|
+
X.srcObject = q.streams[0], X.play();
|
|
118
|
+
}), T.connection.addEventListener("track", (q) => {
|
|
119
|
+
const X = document.createElement("audio");
|
|
120
|
+
X.srcObject = q.streams[0], X.play();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
P.listeners.forEach((A) => A.onNewSession?.(T)), T.connection && (T.connection.addEventListener("addstream", (A) => {
|
|
126
|
+
if (!A.streams?.length) return;
|
|
127
|
+
const K = document.createElement("audio");
|
|
128
|
+
K.srcObject = A.streams[0], K.play();
|
|
129
|
+
}), T.connection.addEventListener("track", (A) => {
|
|
130
|
+
const K = document.createElement("audio");
|
|
131
|
+
K.srcObject = A.streams[0], K.play();
|
|
132
|
+
}));
|
|
133
|
+
}), a = P, P;
|
|
113
134
|
}
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
const
|
|
117
|
-
switch (
|
|
135
|
+
const n = b("disconnected"), u = b(""), f = b([]), _ = b(0), i = b(!1), g = b("connecting"), k = b(!1), o = b(null);
|
|
136
|
+
let h = null, M = null, x = null, H = null, E = null;
|
|
137
|
+
const z = ie(() => ({ ...be, ...c.labels })), Y = ie(() => {
|
|
138
|
+
switch (n.value) {
|
|
139
|
+
case "ringing":
|
|
140
|
+
return { text: z.value.incomingCall, color: "text-blue-500", icon: "ring" };
|
|
118
141
|
case "progress":
|
|
119
|
-
return { text: `${
|
|
142
|
+
return { text: `${z.value.calling}...`, color: "text-yellow-500", icon: "ring" };
|
|
120
143
|
case "confirmed":
|
|
121
|
-
return { text: `${
|
|
144
|
+
return { text: `${z.value.inCall} - ${le(_.value)}`, color: "text-green-500", icon: "inTalk" };
|
|
122
145
|
case "failed":
|
|
123
|
-
return { text:
|
|
146
|
+
return { text: z.value.callEnded, color: "text-red-500", icon: "missed" };
|
|
124
147
|
case "ended":
|
|
125
|
-
return { text:
|
|
148
|
+
return { text: z.value.callEnded, color: "text-gray-500", icon: "hangup" };
|
|
126
149
|
default:
|
|
127
|
-
return { text:
|
|
150
|
+
return { text: z.value.inactive, color: "text-gray-300", icon: "phone" };
|
|
128
151
|
}
|
|
129
152
|
});
|
|
130
|
-
function
|
|
131
|
-
const
|
|
153
|
+
function N(l, t, s) {
|
|
154
|
+
const m = {
|
|
132
155
|
id: Date.now().toString(),
|
|
133
|
-
number:
|
|
156
|
+
number: l,
|
|
134
157
|
timestamp: Date.now(),
|
|
135
158
|
duration: t,
|
|
136
|
-
status:
|
|
159
|
+
status: s
|
|
137
160
|
};
|
|
138
|
-
|
|
161
|
+
f.value = [m, ...f.value].slice(0, 50), localStorage.setItem("tbi-phone-call-history", JSON.stringify(f.value));
|
|
139
162
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
163
|
+
function C() {
|
|
164
|
+
M && (M.terminate(), M = null), o.value = null;
|
|
142
165
|
}
|
|
143
|
-
function
|
|
144
|
-
if (!
|
|
145
|
-
|
|
166
|
+
function R() {
|
|
167
|
+
if (!o.value) return;
|
|
168
|
+
const { session: l, callerNumber: t } = o.value, s = {
|
|
169
|
+
mediaConstraints: { audio: !0, video: !1 }
|
|
170
|
+
};
|
|
171
|
+
try {
|
|
172
|
+
l.answer(s), M = l, c.onCallStart?.(t), d("callStart", t);
|
|
173
|
+
} catch (m) {
|
|
174
|
+
console.error("Failed to answer call:", m), n.value = "failed", c.onStatusChange?.("failed"), d("statusChange", "failed"), N(t, 0, "missed"), o.value = null, setTimeout(() => {
|
|
175
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected");
|
|
176
|
+
}, 3e3);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function L() {
|
|
180
|
+
if (!o.value) return;
|
|
181
|
+
const { session: l, callerNumber: t } = o.value;
|
|
182
|
+
try {
|
|
183
|
+
l.terminate({ status_code: 603, reason_phrase: "Decline" });
|
|
184
|
+
} catch (s) {
|
|
185
|
+
console.error("Failed to reject call:", s);
|
|
186
|
+
}
|
|
187
|
+
N(t, 0, "missed"), o.value = null, n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected");
|
|
188
|
+
}
|
|
189
|
+
function v(l) {
|
|
190
|
+
if (!l.trim() || !h) return;
|
|
191
|
+
if (!i.value) {
|
|
146
192
|
console.warn("Phone is not ready yet. Please wait for registration.");
|
|
147
193
|
return;
|
|
148
194
|
}
|
|
149
|
-
|
|
150
|
-
const
|
|
195
|
+
u.value = l, c.onCallStart?.(l), d("callStart", l);
|
|
196
|
+
const s = {
|
|
151
197
|
eventHandlers: {
|
|
152
198
|
progress: () => {
|
|
153
|
-
|
|
199
|
+
n.value = "progress", c.onStatusChange?.("progress"), d("statusChange", "progress");
|
|
154
200
|
},
|
|
155
|
-
failed: (
|
|
156
|
-
console.error("Call failed:",
|
|
157
|
-
|
|
201
|
+
failed: (m) => {
|
|
202
|
+
console.error("Call failed:", m?.cause), n.value = "failed", c.onStatusChange?.("failed"), d("statusChange", "failed"), N(l, 0, "failed"), c.onCallEnd?.(l, 0, "failed"), d("callEnd", l, 0, "failed"), M = null, setTimeout(() => {
|
|
203
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected");
|
|
158
204
|
}, 3e3);
|
|
159
205
|
},
|
|
160
206
|
ended: () => {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
207
|
+
n.value = "ended", c.onStatusChange?.("ended"), d("statusChange", "ended");
|
|
208
|
+
const m = x ? Math.floor((Date.now() - x) / 1e3) : 0;
|
|
209
|
+
N(l, m, "completed"), c.onCallEnd?.(l, m, "completed"), d("callEnd", l, m, "completed"), M = null, H && (clearInterval(H), H = null), setTimeout(() => {
|
|
210
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected"), x = null, _.value = 0;
|
|
165
211
|
}, 2e3);
|
|
166
212
|
},
|
|
167
213
|
confirmed: () => {
|
|
168
|
-
|
|
169
|
-
|
|
214
|
+
n.value = "confirmed", c.onStatusChange?.("confirmed"), d("statusChange", "confirmed"), x = Date.now(), H = setInterval(() => {
|
|
215
|
+
x && (_.value = Math.floor((Date.now() - x) / 1e3));
|
|
170
216
|
}, 1e3);
|
|
171
217
|
}
|
|
172
218
|
},
|
|
173
219
|
mediaConstraints: { audio: !0, video: !1 }
|
|
174
220
|
};
|
|
175
|
-
|
|
221
|
+
n.value = "progress", c.onStatusChange?.("progress"), d("statusChange", "progress");
|
|
176
222
|
try {
|
|
177
|
-
|
|
178
|
-
} catch (
|
|
179
|
-
console.error("Failed to start call:",
|
|
180
|
-
|
|
223
|
+
M = h.ua.call(l, s);
|
|
224
|
+
} catch (m) {
|
|
225
|
+
console.error("Failed to start call:", m), n.value = "failed", c.onStatusChange?.("failed"), d("statusChange", "failed"), N(l, 0, "failed"), setTimeout(() => {
|
|
226
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected");
|
|
181
227
|
}, 3e3);
|
|
182
228
|
}
|
|
183
229
|
}
|
|
184
|
-
function
|
|
185
|
-
|
|
230
|
+
function $(l) {
|
|
231
|
+
l.key === "Enter" && v(u.value);
|
|
186
232
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
233
|
+
function J(l) {
|
|
234
|
+
u.value = l.number, k.value = !1, v(l.number);
|
|
189
235
|
}
|
|
190
|
-
function
|
|
191
|
-
switch (
|
|
236
|
+
function W(l) {
|
|
237
|
+
switch (l) {
|
|
192
238
|
case "completed":
|
|
193
239
|
return "bg-green-100";
|
|
194
240
|
case "failed":
|
|
@@ -197,8 +243,8 @@ const ye = {
|
|
|
197
243
|
return "bg-yellow-100";
|
|
198
244
|
}
|
|
199
245
|
}
|
|
200
|
-
function
|
|
201
|
-
switch (
|
|
246
|
+
function de(l) {
|
|
247
|
+
switch (l) {
|
|
202
248
|
case "completed":
|
|
203
249
|
return "text-green-600";
|
|
204
250
|
case "failed":
|
|
@@ -207,58 +253,79 @@ const ye = {
|
|
|
207
253
|
return "text-yellow-600";
|
|
208
254
|
}
|
|
209
255
|
}
|
|
210
|
-
function
|
|
211
|
-
return new Date(
|
|
256
|
+
function ue(l) {
|
|
257
|
+
return new Date(l).toLocaleString("es-ES", {
|
|
212
258
|
day: "2-digit",
|
|
213
259
|
month: "2-digit",
|
|
214
260
|
hour: "2-digit",
|
|
215
261
|
minute: "2-digit"
|
|
216
262
|
});
|
|
217
263
|
}
|
|
218
|
-
return
|
|
219
|
-
|
|
264
|
+
return ae(() => {
|
|
265
|
+
h = p(c.config), h.ua.isRegistered() ? (i.value = !0, g.value = "connected") : h.ua.isConnected() && (g.value = "connected"), E = {
|
|
220
266
|
onConnecting: () => {
|
|
221
|
-
|
|
267
|
+
g.value = "connecting";
|
|
222
268
|
},
|
|
223
269
|
onConnected: () => {
|
|
224
|
-
|
|
270
|
+
g.value = "connected";
|
|
225
271
|
},
|
|
226
272
|
onDisconnected: () => {
|
|
227
|
-
|
|
273
|
+
g.value = "disconnected", i.value = !1;
|
|
228
274
|
},
|
|
229
275
|
onRegistered: () => {
|
|
230
|
-
|
|
276
|
+
i.value = !0, g.value = "connected";
|
|
231
277
|
},
|
|
232
278
|
onUnregistered: () => {
|
|
233
|
-
|
|
279
|
+
i.value = !1;
|
|
234
280
|
},
|
|
235
|
-
onRegistrationFailed: (
|
|
236
|
-
console.error("Registration failed:",
|
|
281
|
+
onRegistrationFailed: (s) => {
|
|
282
|
+
console.error("Registration failed:", s), i.value = !1, g.value = "failed";
|
|
237
283
|
},
|
|
238
|
-
onNewSession: (
|
|
239
|
-
|
|
284
|
+
onNewSession: (s) => {
|
|
285
|
+
M = s;
|
|
286
|
+
},
|
|
287
|
+
onIncomingSession: (s, m, D) => {
|
|
288
|
+
if (M) {
|
|
289
|
+
s.terminate({ status_code: 486, reason_phrase: "Busy Here" });
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
o.value = { session: s, callerNumber: m, callerName: D }, u.value = m, n.value = "ringing", c.onStatusChange?.("ringing"), d("statusChange", "ringing"), c.onIncomingCall?.(m, D), d("incomingCall", m, D), s.on("failed", (V) => {
|
|
293
|
+
console.error("Incoming call failed:", V?.cause), n.value = "failed", c.onStatusChange?.("failed"), d("statusChange", "failed"), N(m, 0, "missed"), o.value = null, M = null, setTimeout(() => {
|
|
294
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected");
|
|
295
|
+
}, 3e3);
|
|
296
|
+
}), s.on("ended", () => {
|
|
297
|
+
n.value = "ended", c.onStatusChange?.("ended"), d("statusChange", "ended");
|
|
298
|
+
const V = x ? Math.floor((Date.now() - x) / 1e3) : 0;
|
|
299
|
+
N(m, V, "completed"), c.onCallEnd?.(m, V, "completed"), d("callEnd", m, V, "completed"), o.value = null, M = null, H && (clearInterval(H), H = null), setTimeout(() => {
|
|
300
|
+
n.value = "disconnected", c.onStatusChange?.("disconnected"), d("statusChange", "disconnected"), x = null, _.value = 0;
|
|
301
|
+
}, 2e3);
|
|
302
|
+
}), s.on("confirmed", () => {
|
|
303
|
+
n.value = "confirmed", c.onStatusChange?.("confirmed"), d("statusChange", "confirmed"), x = Date.now(), o.value = null, H = setInterval(() => {
|
|
304
|
+
x && (_.value = Math.floor((Date.now() - x) / 1e3));
|
|
305
|
+
}, 1e3);
|
|
306
|
+
});
|
|
240
307
|
}
|
|
241
|
-
},
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
308
|
+
}, h.listeners.add(E), h.isStarted || (h.ua.start(), h.isStarted = !0);
|
|
309
|
+
const l = localStorage.getItem("tbi-phone-call-history");
|
|
310
|
+
if (l)
|
|
244
311
|
try {
|
|
245
|
-
|
|
246
|
-
} catch (
|
|
247
|
-
console.error("Error loading call history",
|
|
312
|
+
f.value = JSON.parse(l);
|
|
313
|
+
} catch (s) {
|
|
314
|
+
console.error("Error loading call history", s);
|
|
248
315
|
}
|
|
249
|
-
const t = (
|
|
250
|
-
const
|
|
251
|
-
|
|
316
|
+
const t = (s) => {
|
|
317
|
+
const D = s.detail.number;
|
|
318
|
+
n.value === "disconnected" && v(D);
|
|
252
319
|
};
|
|
253
320
|
window.addEventListener("StartCallEvent", t);
|
|
254
|
-
}),
|
|
255
|
-
H && clearInterval(H),
|
|
256
|
-
}), (
|
|
257
|
-
class:
|
|
321
|
+
}), re(() => {
|
|
322
|
+
H && clearInterval(H), h && E && h.listeners.delete(E);
|
|
323
|
+
}), (l, t) => (y(), w("div", {
|
|
324
|
+
class: Z(G(ne)("tbi-phone w-full max-w-md mx-auto bg-white rounded-2xl shadow-lg border border-gray-200 p-2", S.className))
|
|
258
325
|
}, [
|
|
259
|
-
|
|
326
|
+
n.value === "disconnected" ? (y(), w("div", Ee, [
|
|
260
327
|
e("button", {
|
|
261
|
-
onClick: t[0] || (t[0] = (
|
|
328
|
+
onClick: t[0] || (t[0] = (s) => k.value = !0),
|
|
262
329
|
class: "h-8 w-8 flex items-center justify-center rounded-xl border border-gray-200 hover:bg-gray-50 transition-colors",
|
|
263
330
|
type: "button"
|
|
264
331
|
}, [...t[5] || (t[5] = [
|
|
@@ -270,28 +337,28 @@ const ye = {
|
|
|
270
337
|
e("path", { d: "M13 3a9 9 0 0 0-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0 0 13 21a9 9 0 0 0 0-18zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z" })
|
|
271
338
|
], -1)
|
|
272
339
|
])]),
|
|
273
|
-
|
|
340
|
+
me(e("input", {
|
|
274
341
|
type: "text",
|
|
275
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
276
|
-
onKeydown:
|
|
277
|
-
placeholder:
|
|
342
|
+
"onUpdate:modelValue": t[1] || (t[1] = (s) => u.value = s),
|
|
343
|
+
onKeydown: $,
|
|
344
|
+
placeholder: z.value.placeholder,
|
|
278
345
|
class: "flex-1 w-full h-8 px-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent"
|
|
279
|
-
}, null, 40,
|
|
280
|
-
[
|
|
346
|
+
}, null, 40, _e), [
|
|
347
|
+
[he, u.value]
|
|
281
348
|
]),
|
|
282
349
|
e("button", {
|
|
283
|
-
onClick: t[2] || (t[2] = (
|
|
284
|
-
disabled:
|
|
350
|
+
onClick: t[2] || (t[2] = (s) => v(u.value)),
|
|
351
|
+
disabled: u.value.length < 9 || !i.value,
|
|
285
352
|
class: "h-8 w-8 flex items-center justify-center rounded-xl bg-green-500 hover:bg-green-600 disabled:bg-gray-300 disabled:cursor-not-allowed text-white transition-colors",
|
|
286
353
|
type: "button",
|
|
287
|
-
title:
|
|
354
|
+
title: i.value ? "Call" : "Connecting..."
|
|
288
355
|
}, [
|
|
289
|
-
|
|
356
|
+
g.value === "connecting" ? (y(), w("div", ze)) : (y(), w("svg", Ie, [...t[6] || (t[6] = [
|
|
290
357
|
e("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }, null, -1)
|
|
291
358
|
])]))
|
|
292
|
-
], 8,
|
|
293
|
-
])) :
|
|
294
|
-
|
|
359
|
+
], 8, ke)
|
|
360
|
+
])) : F("", !0),
|
|
361
|
+
n.value === "progress" ? (y(), w("div", Me, [
|
|
295
362
|
t[8] || (t[8] = e("div", { class: "relative" }, [
|
|
296
363
|
e("svg", {
|
|
297
364
|
class: "w-12 h-12 text-yellow-500 animate-pulse",
|
|
@@ -302,12 +369,12 @@ const ye = {
|
|
|
302
369
|
]),
|
|
303
370
|
e("div", { class: "absolute inset-0 rounded-full border-4 border-yellow-500/30 animate-ping" })
|
|
304
371
|
], -1)),
|
|
305
|
-
e("div",
|
|
306
|
-
e("p",
|
|
307
|
-
e("p",
|
|
372
|
+
e("div", De, [
|
|
373
|
+
e("p", He, I(z.value.calling) + " " + I(u.value), 1),
|
|
374
|
+
e("p", Ue, I(z.value.waitingResponse), 1)
|
|
308
375
|
]),
|
|
309
376
|
e("button", {
|
|
310
|
-
onClick:
|
|
377
|
+
onClick: C,
|
|
311
378
|
class: "flex items-center gap-2 px-6 py-2 rounded-full bg-red-500 hover:bg-red-600 text-white text-sm font-medium transition-colors",
|
|
312
379
|
type: "button"
|
|
313
380
|
}, [
|
|
@@ -318,11 +385,58 @@ const ye = {
|
|
|
318
385
|
}, [
|
|
319
386
|
e("path", { d: "M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.956.956 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z" })
|
|
320
387
|
], -1)),
|
|
321
|
-
|
|
388
|
+
ee(" " + I(z.value.cancel), 1)
|
|
389
|
+
])
|
|
390
|
+
])) : F("", !0),
|
|
391
|
+
n.value === "ringing" && o.value ? (y(), w("div", Re, [
|
|
392
|
+
t[11] || (t[11] = e("div", { class: "relative" }, [
|
|
393
|
+
e("svg", {
|
|
394
|
+
class: "w-12 h-12 text-blue-500 animate-bounce",
|
|
395
|
+
viewBox: "0 0 24 24",
|
|
396
|
+
fill: "currentColor"
|
|
397
|
+
}, [
|
|
398
|
+
e("path", { d: "M15.05 5A7 7 0 0 1 19 8.95M15.05 1A11 11 0 0 1 23 8.94m-1 7.98v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" })
|
|
399
|
+
]),
|
|
400
|
+
e("div", { class: "absolute inset-0 rounded-full border-4 border-blue-500/30 animate-ping" })
|
|
401
|
+
], -1)),
|
|
402
|
+
e("div", Te, [
|
|
403
|
+
e("p", Le, I(z.value.incomingCall), 1),
|
|
404
|
+
e("p", je, I(o.value.callerNumber), 1),
|
|
405
|
+
o.value.callerName ? (y(), w("p", Be, I(o.value.callerName), 1)) : F("", !0)
|
|
406
|
+
]),
|
|
407
|
+
e("div", Ne, [
|
|
408
|
+
e("button", {
|
|
409
|
+
onClick: L,
|
|
410
|
+
class: "flex items-center gap-2 px-6 py-2 rounded-full bg-red-500 hover:bg-red-600 text-white text-sm font-medium transition-colors",
|
|
411
|
+
type: "button"
|
|
412
|
+
}, [
|
|
413
|
+
t[9] || (t[9] = e("svg", {
|
|
414
|
+
class: "w-4 h-4",
|
|
415
|
+
viewBox: "0 0 24 24",
|
|
416
|
+
fill: "currentColor"
|
|
417
|
+
}, [
|
|
418
|
+
e("path", { d: "M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.956.956 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z" })
|
|
419
|
+
], -1)),
|
|
420
|
+
ee(" " + I(z.value.reject), 1)
|
|
421
|
+
]),
|
|
422
|
+
e("button", {
|
|
423
|
+
onClick: R,
|
|
424
|
+
class: "flex items-center gap-2 px-6 py-2 rounded-full bg-green-500 hover:bg-green-600 text-white text-sm font-medium transition-colors",
|
|
425
|
+
type: "button"
|
|
426
|
+
}, [
|
|
427
|
+
t[10] || (t[10] = e("svg", {
|
|
428
|
+
class: "w-4 h-4",
|
|
429
|
+
viewBox: "0 0 24 24",
|
|
430
|
+
fill: "currentColor"
|
|
431
|
+
}, [
|
|
432
|
+
e("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" })
|
|
433
|
+
], -1)),
|
|
434
|
+
ee(" " + I(z.value.answer), 1)
|
|
435
|
+
])
|
|
322
436
|
])
|
|
323
|
-
])) :
|
|
324
|
-
|
|
325
|
-
t[
|
|
437
|
+
])) : F("", !0),
|
|
438
|
+
n.value === "confirmed" ? (y(), w("div", Pe, [
|
|
439
|
+
t[13] || (t[13] = e("div", { class: "relative" }, [
|
|
326
440
|
e("svg", {
|
|
327
441
|
class: "w-12 h-12 text-green-500",
|
|
328
442
|
viewBox: "0 0 24 24",
|
|
@@ -332,55 +446,55 @@ const ye = {
|
|
|
332
446
|
]),
|
|
333
447
|
e("div", { class: "absolute inset-0 rounded-full bg-green-500/20 animate-pulse" })
|
|
334
448
|
], -1)),
|
|
335
|
-
e("div",
|
|
336
|
-
e("p",
|
|
337
|
-
e("p",
|
|
449
|
+
e("div", Oe, [
|
|
450
|
+
e("p", $e, I(u.value), 1),
|
|
451
|
+
e("p", Ae, I(G(le)(_.value)), 1)
|
|
338
452
|
]),
|
|
339
453
|
e("button", {
|
|
340
|
-
onClick:
|
|
454
|
+
onClick: C,
|
|
341
455
|
class: "flex items-center gap-2 px-6 py-2 rounded-full bg-red-500 hover:bg-red-600 text-white text-sm font-medium transition-colors",
|
|
342
456
|
type: "button"
|
|
343
457
|
}, [
|
|
344
|
-
t[
|
|
458
|
+
t[12] || (t[12] = e("svg", {
|
|
345
459
|
class: "w-4 h-4",
|
|
346
460
|
viewBox: "0 0 24 24",
|
|
347
461
|
fill: "currentColor"
|
|
348
462
|
}, [
|
|
349
463
|
e("path", { d: "M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.956.956 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z" })
|
|
350
464
|
], -1)),
|
|
351
|
-
|
|
465
|
+
ee(" " + I(z.value.hangUp), 1)
|
|
352
466
|
])
|
|
353
|
-
])) :
|
|
354
|
-
|
|
355
|
-
(
|
|
356
|
-
class:
|
|
467
|
+
])) : F("", !0),
|
|
468
|
+
n.value === "failed" || n.value === "ended" ? (y(), w("div", Ve, [
|
|
469
|
+
(y(), w("svg", {
|
|
470
|
+
class: Z(G(ne)("w-12 h-12", n.value === "failed" ? "text-red-500" : "text-gray-500")),
|
|
357
471
|
viewBox: "0 0 24 24",
|
|
358
472
|
fill: "currentColor"
|
|
359
473
|
}, [
|
|
360
|
-
|
|
474
|
+
n.value === "failed" ? (y(), w("path", Fe)) : (y(), w("path", Ke))
|
|
361
475
|
], 2)),
|
|
362
|
-
e("div",
|
|
363
|
-
e("p",
|
|
476
|
+
e("div", Je, [
|
|
477
|
+
e("p", We, I(Y.value.text), 1)
|
|
364
478
|
])
|
|
365
|
-
])) :
|
|
366
|
-
(
|
|
367
|
-
|
|
479
|
+
])) : F("", !0),
|
|
480
|
+
(y(), ge(pe, { to: "body" }, [
|
|
481
|
+
k.value ? (y(), w("div", qe, [
|
|
368
482
|
e("div", {
|
|
369
483
|
class: "fixed inset-0 bg-black/50",
|
|
370
|
-
onClick: t[3] || (t[3] = (
|
|
484
|
+
onClick: t[3] || (t[3] = (s) => k.value = !1)
|
|
371
485
|
}),
|
|
372
|
-
e("div",
|
|
373
|
-
e("div",
|
|
374
|
-
e("div",
|
|
486
|
+
e("div", Ge, [
|
|
487
|
+
e("div", Qe, [
|
|
488
|
+
e("div", Xe, [
|
|
375
489
|
e("div", null, [
|
|
376
|
-
e("h2",
|
|
377
|
-
e("p",
|
|
490
|
+
e("h2", Ye, I(z.value.callHistory), 1),
|
|
491
|
+
e("p", Ze, I(f.value.length === 0 ? z.value.noCallsRegistered : `${f.value.length} ${z.value.callsRegistered}`), 1)
|
|
378
492
|
]),
|
|
379
493
|
e("button", {
|
|
380
|
-
onClick: t[4] || (t[4] = (
|
|
494
|
+
onClick: t[4] || (t[4] = (s) => k.value = !1),
|
|
381
495
|
class: "h-8 w-8 flex items-center justify-center rounded-lg hover:bg-gray-100 transition-colors",
|
|
382
496
|
type: "button"
|
|
383
|
-
}, [...t[
|
|
497
|
+
}, [...t[14] || (t[14] = [
|
|
384
498
|
e("svg", {
|
|
385
499
|
class: "w-5 h-5",
|
|
386
500
|
viewBox: "0 0 24 24",
|
|
@@ -390,54 +504,54 @@ const ye = {
|
|
|
390
504
|
], -1)
|
|
391
505
|
])])
|
|
392
506
|
]),
|
|
393
|
-
e("div",
|
|
394
|
-
|
|
395
|
-
t[
|
|
507
|
+
e("div", et, [
|
|
508
|
+
f.value.length === 0 ? (y(), w("div", tt, [
|
|
509
|
+
t[15] || (t[15] = e("svg", {
|
|
396
510
|
class: "w-12 h-12 mx-auto mb-2 opacity-50",
|
|
397
511
|
viewBox: "0 0 24 24",
|
|
398
512
|
fill: "currentColor"
|
|
399
513
|
}, [
|
|
400
514
|
e("path", { d: "M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.956.956 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z" })
|
|
401
515
|
], -1)),
|
|
402
|
-
e("p", null,
|
|
403
|
-
])) : (
|
|
404
|
-
(
|
|
405
|
-
key:
|
|
516
|
+
e("p", null, I(z.value.noCalls), 1)
|
|
517
|
+
])) : (y(), w("div", nt, [
|
|
518
|
+
(y(!0), w(te, null, Ce(f.value, (s, m) => (y(), w("div", {
|
|
519
|
+
key: s.id,
|
|
406
520
|
class: "flex items-center gap-3 p-3 rounded-lg hover:bg-gray-50 transition-colors duration-200",
|
|
407
|
-
style:
|
|
521
|
+
style: ye({ animationDelay: `${m * 30}ms` })
|
|
408
522
|
}, [
|
|
409
523
|
e("div", {
|
|
410
|
-
class:
|
|
524
|
+
class: Z(G(ne)("w-9 h-9 rounded-full flex items-center justify-center shrink-0", W(s.status)))
|
|
411
525
|
}, [
|
|
412
|
-
(
|
|
413
|
-
class:
|
|
526
|
+
(y(), w("svg", {
|
|
527
|
+
class: Z(G(ne)("w-4 h-4", de(s.status))),
|
|
414
528
|
viewBox: "0 0 24 24",
|
|
415
529
|
fill: "currentColor"
|
|
416
530
|
}, [
|
|
417
|
-
|
|
418
|
-
t[
|
|
419
|
-
t[
|
|
420
|
-
], 64)) :
|
|
421
|
-
t[
|
|
422
|
-
t[
|
|
423
|
-
], 64)) : (
|
|
531
|
+
s.status === "completed" ? (y(), w(te, { key: 0 }, [
|
|
532
|
+
t[16] || (t[16] = e("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }, null, -1)),
|
|
533
|
+
t[17] || (t[17] = e("path", { d: "M16 3l-5 5-2-2-1.5 1.5L11 11l6.5-6.5z" }, null, -1))
|
|
534
|
+
], 64)) : s.status === "failed" ? (y(), w(te, { key: 1 }, [
|
|
535
|
+
t[18] || (t[18] = e("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }, null, -1)),
|
|
536
|
+
t[19] || (t[19] = e("path", { d: "M19 6.41L17.59 5 15 7.59 12.41 5 11 6.41 13.59 9 11 11.59 12.41 13 15 10.41 17.59 13 19 11.59 16.41 9z" }, null, -1))
|
|
537
|
+
], 64)) : (y(), w("path", ot))
|
|
424
538
|
], 2))
|
|
425
539
|
], 2),
|
|
426
|
-
e("div",
|
|
427
|
-
e("p",
|
|
428
|
-
e("div",
|
|
429
|
-
e("span", null,
|
|
430
|
-
|
|
431
|
-
t[
|
|
432
|
-
e("span",
|
|
433
|
-
], 64)) :
|
|
540
|
+
e("div", lt, [
|
|
541
|
+
e("p", st, I(s.number), 1),
|
|
542
|
+
e("div", at, [
|
|
543
|
+
e("span", null, I(ue(s.timestamp)), 1),
|
|
544
|
+
s.duration > 0 ? (y(), w(te, { key: 0 }, [
|
|
545
|
+
t[20] || (t[20] = e("span", null, "•", -1)),
|
|
546
|
+
e("span", rt, I(G(le)(s.duration)), 1)
|
|
547
|
+
], 64)) : F("", !0)
|
|
434
548
|
])
|
|
435
549
|
]),
|
|
436
550
|
e("button", {
|
|
437
|
-
onClick: (
|
|
551
|
+
onClick: (D) => J(s),
|
|
438
552
|
class: "h-8 w-8 flex items-center justify-center shrink-0 rounded-lg hover:bg-gray-100 transition-colors",
|
|
439
553
|
type: "button"
|
|
440
|
-
}, [...t[
|
|
554
|
+
}, [...t[21] || (t[21] = [
|
|
441
555
|
e("svg", {
|
|
442
556
|
class: "w-4 h-4",
|
|
443
557
|
viewBox: "0 0 24 24",
|
|
@@ -445,262 +559,321 @@ const ye = {
|
|
|
445
559
|
}, [
|
|
446
560
|
e("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" })
|
|
447
561
|
], -1)
|
|
448
|
-
])], 8,
|
|
562
|
+
])], 8, it)
|
|
449
563
|
], 4))), 128))
|
|
450
564
|
]))
|
|
451
565
|
])
|
|
452
566
|
])
|
|
453
567
|
])
|
|
454
|
-
])) :
|
|
568
|
+
])) : F("", !0)
|
|
455
569
|
]))
|
|
456
570
|
], 2));
|
|
457
571
|
}
|
|
458
|
-
}),
|
|
459
|
-
let
|
|
460
|
-
function
|
|
461
|
-
return `${
|
|
572
|
+
}), ce = /* @__PURE__ */ Symbol("Phone");
|
|
573
|
+
let Q = null, se = null;
|
|
574
|
+
function ct(S) {
|
|
575
|
+
return `${S.websocketUrl}|${S.sipUri}|${S.authorizationUser}`;
|
|
462
576
|
}
|
|
463
|
-
function
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
return
|
|
467
|
-
if (
|
|
577
|
+
function dt(S) {
|
|
578
|
+
const O = ct(S);
|
|
579
|
+
if (Q && se === O)
|
|
580
|
+
return Q;
|
|
581
|
+
if (Q && se !== O) {
|
|
468
582
|
try {
|
|
469
|
-
|
|
583
|
+
Q.ua.stop();
|
|
470
584
|
} catch {
|
|
471
585
|
}
|
|
472
|
-
|
|
586
|
+
Q = null;
|
|
473
587
|
}
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
sockets: [new
|
|
477
|
-
uri:
|
|
478
|
-
password:
|
|
479
|
-
registrar_server:
|
|
480
|
-
display_name:
|
|
481
|
-
authorization_user:
|
|
588
|
+
se = O;
|
|
589
|
+
const d = {
|
|
590
|
+
sockets: [new oe.WebSocketInterface(S.websocketUrl)],
|
|
591
|
+
uri: S.sipUri,
|
|
592
|
+
password: S.password,
|
|
593
|
+
registrar_server: S.registrarServer,
|
|
594
|
+
display_name: S.displayName,
|
|
595
|
+
authorization_user: S.authorizationUser,
|
|
482
596
|
connection_recovery_min_interval: 2,
|
|
483
597
|
connection_recovery_max_interval: 30
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
ua:
|
|
488
|
-
audio:
|
|
598
|
+
}, a = new oe.UA(d), B = document.createElement("audio");
|
|
599
|
+
B.autoplay = !0;
|
|
600
|
+
const r = {
|
|
601
|
+
ua: a,
|
|
602
|
+
audio: B,
|
|
489
603
|
isStarted: !1,
|
|
490
604
|
listeners: /* @__PURE__ */ new Set()
|
|
491
605
|
};
|
|
492
|
-
return
|
|
493
|
-
|
|
494
|
-
}),
|
|
495
|
-
|
|
496
|
-
}),
|
|
497
|
-
|
|
498
|
-
}),
|
|
499
|
-
|
|
500
|
-
}),
|
|
501
|
-
|
|
502
|
-
}),
|
|
503
|
-
|
|
504
|
-
}),
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
606
|
+
return a.on("connecting", () => {
|
|
607
|
+
r.listeners.forEach((p) => p.onConnecting?.());
|
|
608
|
+
}), a.on("connected", () => {
|
|
609
|
+
r.listeners.forEach((p) => p.onConnected?.());
|
|
610
|
+
}), a.on("disconnected", () => {
|
|
611
|
+
r.listeners.forEach((p) => p.onDisconnected?.());
|
|
612
|
+
}), a.on("registered", () => {
|
|
613
|
+
r.listeners.forEach((p) => p.onRegistered?.());
|
|
614
|
+
}), a.on("unregistered", () => {
|
|
615
|
+
r.listeners.forEach((p) => p.onUnregistered?.());
|
|
616
|
+
}), a.on("registrationFailed", (p) => {
|
|
617
|
+
r.listeners.forEach((n) => n.onRegistrationFailed?.(p?.cause));
|
|
618
|
+
}), a.on("newRTCSession", (p) => {
|
|
619
|
+
const n = p.session;
|
|
620
|
+
if (n.direction === "incoming") {
|
|
621
|
+
const u = n.remote_identity, f = u?.uri?.user || "Unknown", _ = u?.display_name || void 0;
|
|
622
|
+
r.listeners.forEach((i) => i.onIncomingSession?.(n, f, _)), n.on("peerconnection", () => {
|
|
623
|
+
n.connection.addEventListener("addstream", (i) => {
|
|
624
|
+
if (!i.streams?.length) return;
|
|
625
|
+
const g = document.createElement("audio");
|
|
626
|
+
g.srcObject = i.streams[0], g.play();
|
|
627
|
+
}), n.connection.addEventListener("track", (i) => {
|
|
628
|
+
const g = document.createElement("audio");
|
|
629
|
+
g.srcObject = i.streams[0], g.play();
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
r.listeners.forEach((u) => u.onNewSession?.(n)), n.connection && (n.connection.addEventListener("addstream", (u) => {
|
|
635
|
+
if (!u.streams?.length) return;
|
|
636
|
+
const f = document.createElement("audio");
|
|
637
|
+
f.srcObject = u.streams[0], f.play();
|
|
638
|
+
}), n.connection.addEventListener("track", (u) => {
|
|
639
|
+
const f = document.createElement("audio");
|
|
640
|
+
f.srcObject = u.streams[0], f.play();
|
|
641
|
+
}));
|
|
642
|
+
}), Q = r, r;
|
|
515
643
|
}
|
|
516
|
-
function
|
|
517
|
-
const { config:
|
|
518
|
-
let
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
},
|
|
522
|
-
const
|
|
644
|
+
function gt(S) {
|
|
645
|
+
const { config: O, onCallStart: c, onCallEnd: d, onStatusChange: a, onIncomingCall: B } = S, r = b("disconnected"), p = b(""), n = b([]), u = b(0), f = b(!1), _ = b("connecting"), i = b(null);
|
|
646
|
+
let g = null, k = null, o = null, h = null;
|
|
647
|
+
const M = (C) => {
|
|
648
|
+
p.value = C;
|
|
649
|
+
}, x = (C, R, L) => {
|
|
650
|
+
const v = {
|
|
523
651
|
id: Date.now().toString(),
|
|
524
|
-
number:
|
|
652
|
+
number: C,
|
|
525
653
|
timestamp: Date.now(),
|
|
526
|
-
duration:
|
|
527
|
-
status:
|
|
654
|
+
duration: R,
|
|
655
|
+
status: L
|
|
528
656
|
};
|
|
529
|
-
|
|
530
|
-
},
|
|
531
|
-
|
|
532
|
-
},
|
|
533
|
-
if (!
|
|
534
|
-
|
|
657
|
+
n.value = [v, ...n.value].slice(0, 50), localStorage.setItem("tbi-phone-call-history", JSON.stringify(n.value));
|
|
658
|
+
}, H = () => {
|
|
659
|
+
k && (k.terminate(), k = null), i.value = null;
|
|
660
|
+
}, E = () => {
|
|
661
|
+
if (!i.value) return;
|
|
662
|
+
const { session: C, callerNumber: R } = i.value, L = {
|
|
663
|
+
mediaConstraints: { audio: !0, video: !1 }
|
|
664
|
+
};
|
|
665
|
+
try {
|
|
666
|
+
C.answer(L), k = C, c?.(R);
|
|
667
|
+
} catch (v) {
|
|
668
|
+
console.error("Failed to answer call:", v), r.value = "failed", a?.("failed"), x(R, 0, "missed"), i.value = null, setTimeout(() => {
|
|
669
|
+
r.value = "disconnected", a?.("disconnected");
|
|
670
|
+
}, 3e3);
|
|
671
|
+
}
|
|
672
|
+
}, z = () => {
|
|
673
|
+
if (!i.value) return;
|
|
674
|
+
const { session: C, callerNumber: R } = i.value;
|
|
675
|
+
try {
|
|
676
|
+
C.terminate({ status_code: 603, reason_phrase: "Decline" });
|
|
677
|
+
} catch (L) {
|
|
678
|
+
console.error("Failed to reject call:", L);
|
|
679
|
+
}
|
|
680
|
+
x(R, 0, "missed"), i.value = null, r.value = "disconnected", a?.("disconnected");
|
|
681
|
+
}, Y = (C) => {
|
|
682
|
+
if (!C.trim() || !g) return;
|
|
683
|
+
if (!f.value) {
|
|
535
684
|
console.warn("Phone is not ready yet. Please wait for registration.");
|
|
536
685
|
return;
|
|
537
686
|
}
|
|
538
|
-
|
|
539
|
-
const
|
|
687
|
+
p.value = C, c?.(C);
|
|
688
|
+
const L = {
|
|
540
689
|
eventHandlers: {
|
|
541
690
|
progress: () => {
|
|
542
|
-
|
|
691
|
+
r.value = "progress", a?.("progress");
|
|
543
692
|
},
|
|
544
|
-
failed: (
|
|
545
|
-
console.error("Call failed:",
|
|
546
|
-
|
|
693
|
+
failed: (v) => {
|
|
694
|
+
console.error("Call failed:", v?.cause), r.value = "failed", a?.("failed"), x(C, 0, "failed"), d?.(C, 0, "failed"), k = null, setTimeout(() => {
|
|
695
|
+
r.value = "disconnected", a?.("disconnected");
|
|
547
696
|
}, 3e3);
|
|
548
697
|
},
|
|
549
698
|
ended: () => {
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
699
|
+
r.value = "ended", a?.("ended");
|
|
700
|
+
const v = o ? Math.floor((Date.now() - o) / 1e3) : 0;
|
|
701
|
+
x(C, v, "completed"), d?.(C, v, "completed"), k = null, h && (clearInterval(h), h = null), setTimeout(() => {
|
|
702
|
+
r.value = "disconnected", a?.("disconnected"), o = null, u.value = 0;
|
|
554
703
|
}, 2e3);
|
|
555
704
|
},
|
|
556
705
|
confirmed: () => {
|
|
557
|
-
|
|
558
|
-
|
|
706
|
+
r.value = "confirmed", a?.("confirmed"), o = Date.now(), h = setInterval(() => {
|
|
707
|
+
o && (u.value = Math.floor((Date.now() - o) / 1e3));
|
|
559
708
|
}, 1e3);
|
|
560
709
|
}
|
|
561
710
|
},
|
|
562
711
|
mediaConstraints: { audio: !0, video: !1 }
|
|
563
712
|
};
|
|
564
|
-
|
|
713
|
+
r.value = "progress", a?.("progress");
|
|
565
714
|
try {
|
|
566
|
-
|
|
567
|
-
} catch (
|
|
568
|
-
console.error("Failed to start call:",
|
|
569
|
-
|
|
715
|
+
k = g.ua.call(C, L);
|
|
716
|
+
} catch (v) {
|
|
717
|
+
console.error("Failed to start call:", v), r.value = "failed", a?.("failed"), x(C, 0, "failed"), setTimeout(() => {
|
|
718
|
+
r.value = "disconnected", a?.("disconnected");
|
|
570
719
|
}, 3e3);
|
|
571
720
|
}
|
|
572
721
|
};
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const
|
|
722
|
+
ae(() => {
|
|
723
|
+
g = dt(O), g.ua.isRegistered() ? (f.value = !0, _.value = "connected") : g.ua.isConnected() && (_.value = "connected");
|
|
724
|
+
const C = {
|
|
576
725
|
onConnecting: () => {
|
|
577
|
-
|
|
726
|
+
_.value = "connecting";
|
|
578
727
|
},
|
|
579
728
|
onConnected: () => {
|
|
580
|
-
|
|
729
|
+
_.value = "connected";
|
|
581
730
|
},
|
|
582
731
|
onDisconnected: () => {
|
|
583
|
-
|
|
732
|
+
_.value = "disconnected", f.value = !1;
|
|
584
733
|
},
|
|
585
734
|
onRegistered: () => {
|
|
586
|
-
|
|
735
|
+
f.value = !0, _.value = "connected";
|
|
587
736
|
},
|
|
588
737
|
onUnregistered: () => {
|
|
589
|
-
|
|
738
|
+
f.value = !1;
|
|
739
|
+
},
|
|
740
|
+
onRegistrationFailed: (v) => {
|
|
741
|
+
console.error("Registration failed:", v), f.value = !1, _.value = "failed";
|
|
590
742
|
},
|
|
591
|
-
|
|
592
|
-
|
|
743
|
+
onNewSession: (v) => {
|
|
744
|
+
k = v;
|
|
593
745
|
},
|
|
594
|
-
|
|
595
|
-
|
|
746
|
+
onIncomingSession: (v, $, J) => {
|
|
747
|
+
if (k) {
|
|
748
|
+
v.terminate({ status_code: 486, reason_phrase: "Busy Here" });
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
i.value = { session: v, callerNumber: $, callerName: J }, p.value = $, r.value = "ringing", a?.("ringing"), B?.($, J), v.on("failed", (W) => {
|
|
752
|
+
console.error("Incoming call failed:", W?.cause), r.value = "failed", a?.("failed"), x($, 0, "missed"), i.value = null, k = null, setTimeout(() => {
|
|
753
|
+
r.value = "disconnected", a?.("disconnected");
|
|
754
|
+
}, 3e3);
|
|
755
|
+
}), v.on("ended", () => {
|
|
756
|
+
r.value = "ended", a?.("ended");
|
|
757
|
+
const W = o ? Math.floor((Date.now() - o) / 1e3) : 0;
|
|
758
|
+
x($, W, "completed"), d?.($, W, "completed"), i.value = null, k = null, h && (clearInterval(h), h = null), setTimeout(() => {
|
|
759
|
+
r.value = "disconnected", a?.("disconnected"), o = null, u.value = 0;
|
|
760
|
+
}, 2e3);
|
|
761
|
+
}), v.on("confirmed", () => {
|
|
762
|
+
r.value = "confirmed", a?.("confirmed"), o = Date.now(), i.value = null, h = setInterval(() => {
|
|
763
|
+
o && (u.value = Math.floor((Date.now() - o) / 1e3));
|
|
764
|
+
}, 1e3);
|
|
765
|
+
});
|
|
596
766
|
}
|
|
597
767
|
};
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
768
|
+
g.listeners.add(C), g.isStarted || (g.ua.start(), g.isStarted = !0);
|
|
769
|
+
const R = localStorage.getItem("tbi-phone-call-history");
|
|
770
|
+
if (R)
|
|
601
771
|
try {
|
|
602
|
-
|
|
603
|
-
} catch (
|
|
604
|
-
console.error("Error loading call history",
|
|
772
|
+
n.value = JSON.parse(R);
|
|
773
|
+
} catch (v) {
|
|
774
|
+
console.error("Error loading call history", v);
|
|
605
775
|
}
|
|
606
|
-
const
|
|
607
|
-
const
|
|
608
|
-
|
|
776
|
+
const L = (v) => {
|
|
777
|
+
const J = v.detail.number;
|
|
778
|
+
r.value === "disconnected" && Y(J);
|
|
609
779
|
};
|
|
610
|
-
window.addEventListener("StartCallEvent",
|
|
611
|
-
}),
|
|
612
|
-
|
|
780
|
+
window.addEventListener("StartCallEvent", L);
|
|
781
|
+
}), re(() => {
|
|
782
|
+
h && clearInterval(h);
|
|
613
783
|
});
|
|
614
784
|
const N = {
|
|
615
|
-
status:
|
|
616
|
-
callNumber:
|
|
617
|
-
setCallNumber:
|
|
618
|
-
callHistory:
|
|
619
|
-
currentCallDuration:
|
|
620
|
-
startCall:
|
|
621
|
-
endCall:
|
|
622
|
-
|
|
623
|
-
|
|
785
|
+
status: j(r),
|
|
786
|
+
callNumber: p,
|
|
787
|
+
setCallNumber: M,
|
|
788
|
+
callHistory: j(n),
|
|
789
|
+
currentCallDuration: j(u),
|
|
790
|
+
startCall: Y,
|
|
791
|
+
endCall: H,
|
|
792
|
+
answerCall: E,
|
|
793
|
+
rejectCall: z,
|
|
794
|
+
isReady: j(f),
|
|
795
|
+
connectionStatus: j(_),
|
|
796
|
+
incomingCall: j(i)
|
|
624
797
|
};
|
|
625
|
-
return
|
|
798
|
+
return xe(ce, N), N;
|
|
626
799
|
}
|
|
627
|
-
function
|
|
628
|
-
const
|
|
629
|
-
if (!
|
|
800
|
+
function mt() {
|
|
801
|
+
const S = we(ce);
|
|
802
|
+
if (!S)
|
|
630
803
|
throw new Error("usePhone must be used within a component that has called usePhoneProvider");
|
|
631
|
-
return
|
|
804
|
+
return S;
|
|
632
805
|
}
|
|
633
|
-
function
|
|
806
|
+
function ht(S, O = {}) {
|
|
634
807
|
const {
|
|
635
|
-
onCallStart:
|
|
636
|
-
onCallEnd:
|
|
637
|
-
onStatusChange:
|
|
638
|
-
onConnectionChange:
|
|
639
|
-
persistHistory:
|
|
640
|
-
historyKey:
|
|
641
|
-
} =
|
|
642
|
-
let
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
808
|
+
onCallStart: c,
|
|
809
|
+
onCallEnd: d,
|
|
810
|
+
onStatusChange: a,
|
|
811
|
+
onConnectionChange: B,
|
|
812
|
+
persistHistory: r = !0,
|
|
813
|
+
historyKey: p = "tbi-phone-call-history"
|
|
814
|
+
} = O, n = b("disconnected"), u = b(""), f = b([]), _ = b(0), i = b(!1), g = b("connecting"), k = b(null);
|
|
815
|
+
let o = null;
|
|
816
|
+
ae(() => {
|
|
817
|
+
o = new Se(
|
|
818
|
+
S,
|
|
646
819
|
{
|
|
647
|
-
onStatusChange: (
|
|
648
|
-
|
|
820
|
+
onStatusChange: (E) => {
|
|
821
|
+
n.value = E, a?.(E);
|
|
649
822
|
},
|
|
650
|
-
onConnectionChange: (
|
|
651
|
-
|
|
823
|
+
onConnectionChange: (E) => {
|
|
824
|
+
g.value = E, o && (i.value = o.state.isReady), B?.(E);
|
|
652
825
|
},
|
|
653
|
-
onCallStart:
|
|
654
|
-
onCallEnd:
|
|
655
|
-
onDurationUpdate: (
|
|
656
|
-
|
|
826
|
+
onCallStart: c,
|
|
827
|
+
onCallEnd: d,
|
|
828
|
+
onDurationUpdate: (E) => {
|
|
829
|
+
_.value = E;
|
|
657
830
|
},
|
|
658
|
-
onHistoryUpdate: (
|
|
659
|
-
|
|
831
|
+
onHistoryUpdate: (E) => {
|
|
832
|
+
f.value = E;
|
|
660
833
|
},
|
|
661
834
|
onRegistered: () => {
|
|
662
|
-
|
|
835
|
+
i.value = !0;
|
|
663
836
|
},
|
|
664
837
|
onUnregistered: () => {
|
|
665
|
-
|
|
838
|
+
i.value = !1;
|
|
666
839
|
}
|
|
667
840
|
},
|
|
668
841
|
{
|
|
669
|
-
persistHistory:
|
|
670
|
-
historyKey:
|
|
842
|
+
persistHistory: r,
|
|
843
|
+
historyKey: p
|
|
671
844
|
}
|
|
672
|
-
),
|
|
673
|
-
}),
|
|
674
|
-
|
|
845
|
+
), o.initialize(), n.value = o.state.status, u.value = o.state.callNumber, f.value = o.state.callHistory, i.value = o.state.isReady, g.value = o.state.connectionStatus, k.value = o.ua;
|
|
846
|
+
}), re(() => {
|
|
847
|
+
o && (o.destroy(), o = null);
|
|
675
848
|
});
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
}, M = (
|
|
679
|
-
|
|
849
|
+
const h = (E) => {
|
|
850
|
+
u.value = E, o?.setCallNumber(E);
|
|
851
|
+
}, M = (E) => {
|
|
852
|
+
o?.startCall(E);
|
|
853
|
+
}, x = () => {
|
|
854
|
+
o?.endCall();
|
|
680
855
|
}, H = () => {
|
|
681
|
-
|
|
682
|
-
}, N = () => {
|
|
683
|
-
l?.clearHistory(), i.value = [];
|
|
856
|
+
o?.clearHistory(), f.value = [];
|
|
684
857
|
};
|
|
685
858
|
return {
|
|
686
|
-
status:
|
|
687
|
-
callNumber:
|
|
688
|
-
setCallNumber:
|
|
689
|
-
callHistory:
|
|
690
|
-
clearCallHistory:
|
|
691
|
-
currentCallDuration:
|
|
859
|
+
status: j(n),
|
|
860
|
+
callNumber: u,
|
|
861
|
+
setCallNumber: h,
|
|
862
|
+
callHistory: j(f),
|
|
863
|
+
clearCallHistory: H,
|
|
864
|
+
currentCallDuration: j(_),
|
|
692
865
|
startCall: M,
|
|
693
|
-
endCall:
|
|
694
|
-
isReady:
|
|
695
|
-
connectionStatus:
|
|
696
|
-
ua:
|
|
866
|
+
endCall: x,
|
|
867
|
+
isReady: j(i),
|
|
868
|
+
connectionStatus: j(g),
|
|
869
|
+
ua: k
|
|
697
870
|
};
|
|
698
871
|
}
|
|
699
872
|
export {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
873
|
+
ft as Phone,
|
|
874
|
+
ce as PhoneKey,
|
|
875
|
+
ft as default,
|
|
876
|
+
mt as usePhone,
|
|
877
|
+
ht as usePhoneManager,
|
|
878
|
+
gt as usePhoneProvider
|
|
706
879
|
};
|