@16x/webphone-sdk 3.1.9 → 3.1.10
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/CHANGELOG.md +15 -0
- package/dist/{CCBarClient-CfHT0tl2.js → CCBarClient-Sr_zlDBu.js} +189 -120
- package/dist/CCBarClient-z-TFUjTB.cjs +1 -0
- package/dist/{Diagnostics-CfbmMp-b.js → Diagnostics-WkQagE6_.js} +1 -1
- package/dist/Diagnostics-x4G0ho6W.cjs +1 -0
- package/dist/core/CCBarClient.d.ts +5 -1
- package/dist/diagnostics/index.cjs +1 -1
- package/dist/diagnostics/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/index.umd.js +17 -17
- package/dist/legacy/index.cjs +1 -1
- package/dist/legacy/index.js +74 -105
- package/dist/legacy/legacyAes.d.ts +4 -26
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/CCBarClient-B6WqgloY.cjs +0 -1
- package/dist/Diagnostics-DkKlZQnY.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as e, t } from "./SharedWorkerProtocol-DKVQ5-po.js";
|
|
2
|
-
import { r as n, t as r } from "./Diagnostics-
|
|
2
|
+
import { r as n, t as r } from "./Diagnostics-WkQagE6_.js";
|
|
3
3
|
//#region src/events/TypedEventBus.ts
|
|
4
4
|
var i = class {
|
|
5
5
|
handlers = /* @__PURE__ */ new Map();
|
|
@@ -637,7 +637,7 @@ var v = class {
|
|
|
637
637
|
reason: b(n)
|
|
638
638
|
}) : this.events.emit("call.failed", {
|
|
639
639
|
callId: e.id,
|
|
640
|
-
error:
|
|
640
|
+
error: re(n, e.id)
|
|
641
641
|
}));
|
|
642
642
|
}
|
|
643
643
|
async switchAutomaticActiveCall(e, t, n) {
|
|
@@ -874,7 +874,7 @@ function b(e) {
|
|
|
874
874
|
let t = e.reason;
|
|
875
875
|
return typeof t == "string" && t !== "" ? t : "ended";
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function re(t, n) {
|
|
878
878
|
if (t instanceof e) return new e(t.code, t.category, t.retryable, {
|
|
879
879
|
requestId: t.requestId,
|
|
880
880
|
callId: n,
|
|
@@ -898,8 +898,65 @@ function x(t, n) {
|
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
900
|
//#endregion
|
|
901
|
+
//#region src/crypto/legacySipTicket.ts
|
|
902
|
+
var ie = "q7X4p6MvK1z8Lb3A", ae = "W9e2T4mN0aQ7Ru6C", oe = 16, se = "�";
|
|
903
|
+
function ce(e) {
|
|
904
|
+
for (let t of e) {
|
|
905
|
+
let e = t.codePointAt(0) ?? 0;
|
|
906
|
+
if (e === 127 || e < 32 && e !== 9) return !0;
|
|
907
|
+
}
|
|
908
|
+
return !1;
|
|
909
|
+
}
|
|
910
|
+
async function x(t, n = {}) {
|
|
911
|
+
let r = String(t ?? "").replace(/\s+/g, "");
|
|
912
|
+
if (!r) throw new e("LEGACY_PLATFORM_REJECTED", "auth", !1, { cause: "解密的密文为空:坐席账号里没有 password/registerPassword" });
|
|
913
|
+
let i = n.subtle ?? globalThis.crypto?.subtle;
|
|
914
|
+
if (i === void 0) throw new e("CONFIG_INVALID", "configuration", !1, { cause: "需要 WebCrypto 才能解 SIP 密码:请在安全上下文(https / localhost)或 Node 18+ 里运行" });
|
|
915
|
+
let a = S(r);
|
|
916
|
+
if (a === void 0) throw new e("LEGACY_PLATFORM_REJECTED", "auth", !1, { cause: "密文不是合法的 Base64:确认取的是 password/registerPassword 原值,没有被截断或转义" });
|
|
917
|
+
let o = await i.importKey("raw", C(n.key ?? ie), "AES-CBC", !1, ["decrypt"]);
|
|
918
|
+
try {
|
|
919
|
+
let e = await i.decrypt({
|
|
920
|
+
name: "AES-CBC",
|
|
921
|
+
iv: C(n.iv ?? ae)
|
|
922
|
+
}, o, a);
|
|
923
|
+
return new TextDecoder("utf-8").decode(e).trim();
|
|
924
|
+
} catch (t) {
|
|
925
|
+
throw new e("LEGACY_PLATFORM_REJECTED", "auth", !1, { cause: `SIP 密码解密失败(检查 key/iv 与该环境是否一致):${t instanceof Error ? t.message : String(t)}` });
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
async function le(e, t = {}) {
|
|
929
|
+
let n = String(e ?? "").replace(/\s+/g, "");
|
|
930
|
+
if (ue(n)) try {
|
|
931
|
+
let e = await x(n, t);
|
|
932
|
+
return de(e) ? e : void 0;
|
|
933
|
+
} catch {
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
function ue(e) {
|
|
938
|
+
let t = S(e);
|
|
939
|
+
return t !== void 0 && t.byteLength > 0 && t.byteLength % oe === 0;
|
|
940
|
+
}
|
|
941
|
+
function de(e) {
|
|
942
|
+
return e.length === 0 || e.includes(se) ? !1 : !ce(e);
|
|
943
|
+
}
|
|
944
|
+
function S(e) {
|
|
945
|
+
if (e.length !== 0 && e.length % 4 == 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(e)) try {
|
|
946
|
+
let t = atob(e), n = new Uint8Array(new ArrayBuffer(t.length));
|
|
947
|
+
for (let e = 0; e < t.length; e += 1) n[e] = t.charCodeAt(e);
|
|
948
|
+
return n;
|
|
949
|
+
} catch {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
function C(e) {
|
|
954
|
+
let t = new TextEncoder().encode(e), n = new Uint8Array(new ArrayBuffer(t.byteLength));
|
|
955
|
+
return n.set(t), n;
|
|
956
|
+
}
|
|
957
|
+
//#endregion
|
|
901
958
|
//#region src/shared/SharedWorkerClient.ts
|
|
902
|
-
var
|
|
959
|
+
var fe = class {
|
|
903
960
|
port;
|
|
904
961
|
timeoutMs;
|
|
905
962
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -936,13 +993,13 @@ var S = class {
|
|
|
936
993
|
try {
|
|
937
994
|
let n = t(e);
|
|
938
995
|
if (n.type === "event") {
|
|
939
|
-
n.event === "connection.stateChanged" &&
|
|
996
|
+
n.event === "connection.stateChanged" && pe(n.payload) && (this.lifecycleState = n.payload.state), this.eventHandlers.forEach((e) => e(n));
|
|
940
997
|
return;
|
|
941
998
|
}
|
|
942
999
|
if (n.type !== "response") return;
|
|
943
1000
|
let r = this.pending.get(n.requestId);
|
|
944
1001
|
if (r === void 0) return;
|
|
945
|
-
this.pending.delete(n.requestId), clearTimeout(r.timer), n.ok ? r.resolve(n.result) : r.reject(
|
|
1002
|
+
this.pending.delete(n.requestId), clearTimeout(r.timer), n.ok ? r.resolve(n.result) : r.reject(me(n));
|
|
946
1003
|
} catch (e) {
|
|
947
1004
|
this.pending.forEach((t) => {
|
|
948
1005
|
clearTimeout(t.timer), t.reject(e);
|
|
@@ -950,10 +1007,10 @@ var S = class {
|
|
|
950
1007
|
}
|
|
951
1008
|
}
|
|
952
1009
|
};
|
|
953
|
-
function
|
|
1010
|
+
function pe(e) {
|
|
954
1011
|
return typeof e == "object" && !!e && "state" in e && (e.state === "connected" || e.state === "reconnecting");
|
|
955
1012
|
}
|
|
956
|
-
function
|
|
1013
|
+
function me(t) {
|
|
957
1014
|
let n = t.error;
|
|
958
1015
|
return new e(n?.code ?? "SDK_INTERNAL_ERROR", n?.category ?? "internal", n?.retryable ?? !1, {
|
|
959
1016
|
requestId: t.requestId,
|
|
@@ -964,12 +1021,12 @@ function ie(t) {
|
|
|
964
1021
|
}
|
|
965
1022
|
//#endregion
|
|
966
1023
|
//#region src/shared/SharedWorkerFactory.ts
|
|
967
|
-
function
|
|
1024
|
+
function w(t = {}) {
|
|
968
1025
|
if ((t.enabled ?? "auto") === !1) return {
|
|
969
1026
|
mode: "single-tab",
|
|
970
1027
|
reason: "disabled"
|
|
971
1028
|
};
|
|
972
|
-
let n = t.locationHref ??
|
|
1029
|
+
let n = t.locationHref ?? E(), r = T(t.url, n), i = (n) => {
|
|
973
1030
|
if (t.fallback === "error") throw new e("CONFIG_INVALID", "configuration", !1, { cause: n });
|
|
974
1031
|
return {
|
|
975
1032
|
mode: "single-tab",
|
|
@@ -977,8 +1034,8 @@ function C(t = {}) {
|
|
|
977
1034
|
};
|
|
978
1035
|
};
|
|
979
1036
|
if (r === void 0) return i("SharedWorker URL is unavailable");
|
|
980
|
-
if (!
|
|
981
|
-
let a = t.workerCtor ??
|
|
1037
|
+
if (!O(r, n)) return i("SharedWorker URL must be same-origin");
|
|
1038
|
+
let a = t.workerCtor ?? D();
|
|
982
1039
|
if (a === void 0) return i("SharedWorker is not supported");
|
|
983
1040
|
let o;
|
|
984
1041
|
try {
|
|
@@ -986,10 +1043,10 @@ function C(t = {}) {
|
|
|
986
1043
|
} catch (e) {
|
|
987
1044
|
return i(`SharedWorker construction failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
988
1045
|
}
|
|
989
|
-
let s = t.tabId ??
|
|
1046
|
+
let s = t.tabId ?? k(), c = new fe(o.port), l = {
|
|
990
1047
|
version: 1,
|
|
991
1048
|
type: "attach",
|
|
992
|
-
requestId:
|
|
1049
|
+
requestId: A(),
|
|
993
1050
|
tabId: s
|
|
994
1051
|
}, u = c.request(l).then(() => void 0).catch((e) => {
|
|
995
1052
|
throw c.close(), e;
|
|
@@ -1003,20 +1060,20 @@ function C(t = {}) {
|
|
|
1003
1060
|
ready: u
|
|
1004
1061
|
};
|
|
1005
1062
|
}
|
|
1006
|
-
function
|
|
1063
|
+
function T(e, t = E()) {
|
|
1007
1064
|
try {
|
|
1008
1065
|
return t === void 0 ? void 0 : new URL(e ?? "./shared-worker.js", t).toString();
|
|
1009
1066
|
} catch {
|
|
1010
1067
|
return;
|
|
1011
1068
|
}
|
|
1012
1069
|
}
|
|
1013
|
-
function
|
|
1070
|
+
function E() {
|
|
1014
1071
|
return typeof location > "u" ? void 0 : location.href;
|
|
1015
1072
|
}
|
|
1016
|
-
function
|
|
1073
|
+
function D() {
|
|
1017
1074
|
if (typeof SharedWorker == "function") return SharedWorker;
|
|
1018
1075
|
}
|
|
1019
|
-
function
|
|
1076
|
+
function O(e, t) {
|
|
1020
1077
|
if (t === void 0) return !0;
|
|
1021
1078
|
try {
|
|
1022
1079
|
return new URL(e, t).origin === new URL(t).origin;
|
|
@@ -1024,15 +1081,15 @@ function oe(e, t) {
|
|
|
1024
1081
|
return !1;
|
|
1025
1082
|
}
|
|
1026
1083
|
}
|
|
1027
|
-
function
|
|
1084
|
+
function k() {
|
|
1028
1085
|
return `tab-${typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : Math.random().toString(36).slice(2)}`;
|
|
1029
1086
|
}
|
|
1030
|
-
function
|
|
1087
|
+
function A() {
|
|
1031
1088
|
return `attach-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1032
1089
|
}
|
|
1033
1090
|
//#endregion
|
|
1034
1091
|
//#region src/media/DeviceManager.ts
|
|
1035
|
-
var
|
|
1092
|
+
var j = class {
|
|
1036
1093
|
mediaDevices;
|
|
1037
1094
|
createAudioElement;
|
|
1038
1095
|
outputCapability;
|
|
@@ -1040,23 +1097,23 @@ var D = class {
|
|
|
1040
1097
|
outputGeneration = 0;
|
|
1041
1098
|
outputTail;
|
|
1042
1099
|
constructor(e = {}) {
|
|
1043
|
-
this.mediaDevices = e.mediaDevices === null ? void 0 : e.mediaDevices ??
|
|
1100
|
+
this.mediaDevices = e.mediaDevices === null ? void 0 : e.mediaDevices ?? M(), this.createAudioElement = e.createAudioElement;
|
|
1044
1101
|
}
|
|
1045
1102
|
async requestPermission(e = {}) {
|
|
1046
1103
|
let t = this.requireMediaDevices(), n;
|
|
1047
1104
|
try {
|
|
1048
1105
|
n = await t.getUserMedia({ audio: e });
|
|
1049
1106
|
} catch (e) {
|
|
1050
|
-
throw
|
|
1107
|
+
throw F(e);
|
|
1051
1108
|
}
|
|
1052
|
-
|
|
1109
|
+
N(n);
|
|
1053
1110
|
}
|
|
1054
1111
|
async getDevices() {
|
|
1055
1112
|
if (this.mediaDevices === void 0) return [];
|
|
1056
1113
|
try {
|
|
1057
1114
|
return (await this.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "audiooutput" && this.supportsOutputSelection());
|
|
1058
1115
|
} catch (e) {
|
|
1059
|
-
throw
|
|
1116
|
+
throw I(e);
|
|
1060
1117
|
}
|
|
1061
1118
|
}
|
|
1062
1119
|
getCapabilities() {
|
|
@@ -1094,7 +1151,7 @@ var D = class {
|
|
|
1094
1151
|
try {
|
|
1095
1152
|
await r.setSinkId(t);
|
|
1096
1153
|
} catch (e) {
|
|
1097
|
-
throw
|
|
1154
|
+
throw L(e);
|
|
1098
1155
|
}
|
|
1099
1156
|
}
|
|
1100
1157
|
enqueueOutput(e) {
|
|
@@ -1108,7 +1165,7 @@ var D = class {
|
|
|
1108
1165
|
try {
|
|
1109
1166
|
return await t.getUserMedia({ audio: { deviceId: { exact: e } } });
|
|
1110
1167
|
} catch (e) {
|
|
1111
|
-
throw
|
|
1168
|
+
throw P(e);
|
|
1112
1169
|
}
|
|
1113
1170
|
}
|
|
1114
1171
|
requireMediaDevices() {
|
|
@@ -1128,10 +1185,10 @@ var D = class {
|
|
|
1128
1185
|
}
|
|
1129
1186
|
}
|
|
1130
1187
|
};
|
|
1131
|
-
function
|
|
1188
|
+
function M() {
|
|
1132
1189
|
return globalThis.navigator?.mediaDevices;
|
|
1133
1190
|
}
|
|
1134
|
-
function
|
|
1191
|
+
function N(e) {
|
|
1135
1192
|
let t;
|
|
1136
1193
|
try {
|
|
1137
1194
|
t = e.getTracks();
|
|
@@ -1144,57 +1201,57 @@ function k(e) {
|
|
|
1144
1201
|
} catch {}
|
|
1145
1202
|
});
|
|
1146
1203
|
}
|
|
1147
|
-
function
|
|
1148
|
-
let n =
|
|
1204
|
+
function P(t) {
|
|
1205
|
+
let n = R(t);
|
|
1149
1206
|
return n === "NotFoundError" || n === "OverconstrainedError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotReadableError" || n === "AbortError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
|
|
1150
1207
|
}
|
|
1151
|
-
function
|
|
1152
|
-
let n =
|
|
1208
|
+
function F(t) {
|
|
1209
|
+
let n = R(t);
|
|
1153
1210
|
return n === "NotFoundError" || n === "OverconstrainedError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotReadableError" || n === "AbortError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
|
|
1154
1211
|
}
|
|
1155
|
-
function
|
|
1156
|
-
let n =
|
|
1212
|
+
function I(t) {
|
|
1213
|
+
let n = R(t);
|
|
1157
1214
|
return n === "NotFoundError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : n === "AbortError" || n === "NotReadableError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
|
|
1158
1215
|
}
|
|
1159
|
-
function
|
|
1160
|
-
let n =
|
|
1216
|
+
function L(t) {
|
|
1217
|
+
let n = R(t);
|
|
1161
1218
|
return n === "NotFoundError" ? new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { cause: t }) : n === "NotAllowedError" || n === "SecurityError" ? new e("MEDIA_PERMISSION_DENIED", "media", !1, { cause: t }) : n === "AbortError" || n === "NotReadableError" ? new e("MEDIA_DEVICE_IN_USE", "media", !0, { cause: t }) : new e("SDK_INTERNAL_ERROR", "internal", !1, { cause: t });
|
|
1162
1219
|
}
|
|
1163
|
-
function
|
|
1220
|
+
function R(e) {
|
|
1164
1221
|
if (typeof e != "object" || !e || !("name" in e)) return;
|
|
1165
1222
|
let t = e.name;
|
|
1166
1223
|
return typeof t == "string" ? t : void 0;
|
|
1167
1224
|
}
|
|
1168
1225
|
//#endregion
|
|
1169
1226
|
//#region src/media/RemoteAudio.ts
|
|
1170
|
-
var
|
|
1227
|
+
var z = class {
|
|
1171
1228
|
createAudioElement;
|
|
1172
1229
|
bindings = /* @__PURE__ */ new Map();
|
|
1173
1230
|
audioOwners = /* @__PURE__ */ new Map();
|
|
1174
1231
|
trackOwners = /* @__PURE__ */ new Map();
|
|
1175
1232
|
generations = /* @__PURE__ */ new Map();
|
|
1176
1233
|
pendingPlays = /* @__PURE__ */ new Map();
|
|
1177
|
-
constructor(e =
|
|
1234
|
+
constructor(e = he) {
|
|
1178
1235
|
this.createAudioElement = e;
|
|
1179
1236
|
}
|
|
1180
1237
|
async bind(t, n) {
|
|
1181
1238
|
let r = this.bindings.get(t);
|
|
1182
1239
|
if (r?.stream === n) return;
|
|
1183
|
-
let i =
|
|
1240
|
+
let i = ge(t, n), a;
|
|
1184
1241
|
try {
|
|
1185
1242
|
a = this.createAudioElement();
|
|
1186
1243
|
} catch (n) {
|
|
1187
|
-
throw
|
|
1244
|
+
throw B(i, this.trackOwners), new e("CAPABILITY_NOT_SUPPORTED", "capability", !1, {
|
|
1188
1245
|
callId: t,
|
|
1189
1246
|
cause: n
|
|
1190
1247
|
});
|
|
1191
1248
|
}
|
|
1192
1249
|
let o = this.audioOwners.get(a);
|
|
1193
|
-
if (o !== void 0 && o !== t) throw
|
|
1250
|
+
if (o !== void 0 && o !== t) throw B(i, this.trackOwners), new e("CALL_OPERATION_NOT_ALLOWED", "call", !1, { callId: t });
|
|
1194
1251
|
try {
|
|
1195
1252
|
a.autoplay = !0, a.playsInline = !0;
|
|
1196
1253
|
} catch (n) {
|
|
1197
|
-
throw
|
|
1254
|
+
throw B(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
|
|
1198
1255
|
callId: t,
|
|
1199
1256
|
cause: n
|
|
1200
1257
|
});
|
|
@@ -1202,7 +1259,7 @@ var F = class {
|
|
|
1202
1259
|
try {
|
|
1203
1260
|
a.srcObject = n;
|
|
1204
1261
|
} catch (n) {
|
|
1205
|
-
throw
|
|
1262
|
+
throw B(i, this.trackOwners), new e("SDK_INTERNAL_ERROR", "internal", !1, {
|
|
1206
1263
|
callId: t,
|
|
1207
1264
|
cause: n
|
|
1208
1265
|
});
|
|
@@ -1278,7 +1335,7 @@ var F = class {
|
|
|
1278
1335
|
releaseTrack(e) {
|
|
1279
1336
|
let t = this.trackOwners.get(e);
|
|
1280
1337
|
if (t === void 0 || t <= 1) {
|
|
1281
|
-
this.trackOwners.delete(e),
|
|
1338
|
+
this.trackOwners.delete(e), V(e);
|
|
1282
1339
|
return;
|
|
1283
1340
|
}
|
|
1284
1341
|
this.trackOwners.set(e, t - 1);
|
|
@@ -1301,42 +1358,42 @@ var F = class {
|
|
|
1301
1358
|
return this.generations.get(e) === t && this.bindings.get(e)?.generation === t;
|
|
1302
1359
|
}
|
|
1303
1360
|
};
|
|
1304
|
-
function
|
|
1361
|
+
function he() {
|
|
1305
1362
|
if (typeof document > "u") throw new e("CAPABILITY_NOT_SUPPORTED", "capability", !1);
|
|
1306
1363
|
return document.createElement("audio");
|
|
1307
1364
|
}
|
|
1308
|
-
function
|
|
1365
|
+
function ge(t, n) {
|
|
1309
1366
|
try {
|
|
1310
1367
|
return [...new Set(n.getAudioTracks())].filter((e) => e.kind === "audio");
|
|
1311
1368
|
} catch (r) {
|
|
1312
1369
|
try {
|
|
1313
1370
|
return [...new Set(n.getTracks())].filter((e) => e.kind === "audio");
|
|
1314
1371
|
} catch (i) {
|
|
1315
|
-
throw
|
|
1372
|
+
throw _e(n), new e("SDK_INTERNAL_ERROR", "internal", !1, {
|
|
1316
1373
|
callId: t,
|
|
1317
1374
|
cause: r ?? i
|
|
1318
1375
|
});
|
|
1319
1376
|
}
|
|
1320
1377
|
}
|
|
1321
1378
|
}
|
|
1322
|
-
function
|
|
1379
|
+
function B(e, t) {
|
|
1323
1380
|
e.forEach((e) => {
|
|
1324
|
-
(t.get(e) ?? 0) === 0 &&
|
|
1381
|
+
(t.get(e) ?? 0) === 0 && V(e);
|
|
1325
1382
|
});
|
|
1326
1383
|
}
|
|
1327
|
-
function
|
|
1384
|
+
function _e(e) {
|
|
1328
1385
|
try {
|
|
1329
|
-
[...new Set(e.getTracks())].filter((e) => e.kind === "audio").forEach(
|
|
1386
|
+
[...new Set(e.getTracks())].filter((e) => e.kind === "audio").forEach(V);
|
|
1330
1387
|
} catch {}
|
|
1331
1388
|
}
|
|
1332
|
-
function
|
|
1389
|
+
function V(e) {
|
|
1333
1390
|
try {
|
|
1334
1391
|
e.stop();
|
|
1335
1392
|
} catch {}
|
|
1336
1393
|
}
|
|
1337
1394
|
//#endregion
|
|
1338
1395
|
//#region src/media/MediaManager.ts
|
|
1339
|
-
var
|
|
1396
|
+
var ve = class {
|
|
1340
1397
|
deviceManager;
|
|
1341
1398
|
remoteAudio;
|
|
1342
1399
|
getActiveCall;
|
|
@@ -1357,7 +1414,7 @@ var V = class {
|
|
|
1357
1414
|
mediaDevices: e.mediaDevices,
|
|
1358
1415
|
createAudioElement: e.createAudioElement
|
|
1359
1416
|
};
|
|
1360
|
-
this.deviceManager = new
|
|
1417
|
+
this.deviceManager = new j(t), this.remoteAudio = new z(e.createAudioElement), this.getActiveCall = e.getActiveCall, this.createRemoteStream = e.createRemoteStream ?? xe;
|
|
1361
1418
|
}
|
|
1362
1419
|
requestPermission(e) {
|
|
1363
1420
|
return this.assertNotDisposed(), this.deviceManager.requestPermission(e);
|
|
@@ -1377,7 +1434,7 @@ var V = class {
|
|
|
1377
1434
|
n !== void 0 && this.releaseResource(n).catch((e) => {
|
|
1378
1435
|
this.releaseErrors.set(n, e);
|
|
1379
1436
|
});
|
|
1380
|
-
let r =
|
|
1437
|
+
let r = ye(t) ? t : { peerConnection: t }, i = {
|
|
1381
1438
|
callId: e,
|
|
1382
1439
|
peerConnection: r.peerConnection,
|
|
1383
1440
|
senders: /* @__PURE__ */ new Map(),
|
|
@@ -1459,7 +1516,7 @@ var V = class {
|
|
|
1459
1516
|
this.remoteAudio.release(r), this.releaseErrors.delete(t), this.calls.get(r) === t && this.calls.delete(r), t.generation += 1, t.released = !0, this.unsubscribeTrackSource(t);
|
|
1460
1517
|
let i = /* @__PURE__ */ new Set([...t.localTracks, ...t.pendingTracks]), a = [...t.senders.values()].filter((e) => e.audio).map((e) => ({
|
|
1461
1518
|
senderResource: e,
|
|
1462
|
-
promise: this.enqueueSender(t, e, () =>
|
|
1519
|
+
promise: this.enqueueSender(t, e, () => W(e.sender), !0)
|
|
1463
1520
|
})), o = Promise.all(a.map(async (e) => {
|
|
1464
1521
|
try {
|
|
1465
1522
|
return await e.promise, {
|
|
@@ -1477,14 +1534,14 @@ var V = class {
|
|
|
1477
1534
|
if (n.forEach((e) => {
|
|
1478
1535
|
if (e.cause !== void 0) {
|
|
1479
1536
|
o.push(e.cause);
|
|
1480
|
-
let t =
|
|
1537
|
+
let t = H(e.senderResource.sender);
|
|
1481
1538
|
t?.kind === "audio" && a.add(t);
|
|
1482
1539
|
return;
|
|
1483
1540
|
}
|
|
1484
|
-
let t =
|
|
1541
|
+
let t = H(e.senderResource.sender);
|
|
1485
1542
|
t?.kind === "audio" && i.add(t);
|
|
1486
1543
|
}), i.forEach((e) => {
|
|
1487
|
-
a.has(e) ||
|
|
1544
|
+
a.has(e) || K(e);
|
|
1488
1545
|
}), o.length > 0) throw t.localTracks.clear(), t.pendingTracks.clear(), a.forEach((e) => t.localTracks.add(e)), new e("SDK_INTERNAL_ERROR", "internal", !0, {
|
|
1489
1546
|
callId: r,
|
|
1490
1547
|
cause: o[0]
|
|
@@ -1492,7 +1549,7 @@ var V = class {
|
|
|
1492
1549
|
if (!t.peerClosed && t.peerConnection.close !== void 0) try {
|
|
1493
1550
|
await t.peerConnection.close(), t.peerClosed = !0;
|
|
1494
1551
|
} catch (n) {
|
|
1495
|
-
let i = [...t.senders.values()].map((e) =>
|
|
1552
|
+
let i = [...t.senders.values()].map((e) => H(e.sender)).find((e) => e?.kind === "audio");
|
|
1496
1553
|
throw t.localTracks.clear(), t.pendingTracks.clear(), i != null && t.localTracks.add(i), new e("SDK_INTERNAL_ERROR", "internal", !0, {
|
|
1497
1554
|
callId: r,
|
|
1498
1555
|
cause: n
|
|
@@ -1560,11 +1617,11 @@ var V = class {
|
|
|
1560
1617
|
}
|
|
1561
1618
|
async performInputSwitch(t, n, r) {
|
|
1562
1619
|
if (this.assertActiveCall(n), this.assertDeviceSelectionCapability(n), !this.isCurrentResource(r) || n.peerConnection !== r.peerConnection) throw this.callOperationError(n.callId);
|
|
1563
|
-
let i = this.findAudioSender(r), a =
|
|
1620
|
+
let i = this.findAudioSender(r), a = H(i.sender), o = r.generation, s = await this.deviceManager.openInputStream(t), c;
|
|
1564
1621
|
try {
|
|
1565
1622
|
c = s.getTracks();
|
|
1566
1623
|
} catch (t) {
|
|
1567
|
-
throw
|
|
1624
|
+
throw be(s), new e("SDK_INTERNAL_ERROR", "internal", !1, {
|
|
1568
1625
|
callId: n.callId,
|
|
1569
1626
|
cause: t
|
|
1570
1627
|
});
|
|
@@ -1573,26 +1630,26 @@ var V = class {
|
|
|
1573
1630
|
try {
|
|
1574
1631
|
l = s.getAudioTracks();
|
|
1575
1632
|
} catch (t) {
|
|
1576
|
-
throw
|
|
1633
|
+
throw G(c), new e("SDK_INTERNAL_ERROR", "internal", !1, {
|
|
1577
1634
|
callId: n.callId,
|
|
1578
1635
|
cause: t
|
|
1579
1636
|
});
|
|
1580
1637
|
}
|
|
1581
1638
|
let u = l[0];
|
|
1582
|
-
if (u === void 0) throw
|
|
1583
|
-
if (!this.canCommitInputSwitch(n, r, i, a, o)) throw
|
|
1639
|
+
if (u === void 0) throw G(c), new e("MEDIA_DEVICE_NOT_FOUND", "media", !1, { callId: n.callId });
|
|
1640
|
+
if (!this.canCommitInputSwitch(n, r, i, a, o)) throw G(c), this.callOperationError(n.callId);
|
|
1584
1641
|
c.forEach((e) => r.pendingTracks.add(e)), r.pendingTracks.add(u);
|
|
1585
1642
|
try {
|
|
1586
1643
|
await this.enqueueSender(r, i, () => i.sender.replaceTrack(u));
|
|
1587
1644
|
} catch (t) {
|
|
1588
|
-
throw r.released ? this.callOperationError(n.callId) : (r.released || (c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), await this.rollbackSender(r, i, a, u),
|
|
1645
|
+
throw r.released ? this.callOperationError(n.callId) : (r.released || (c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), await this.rollbackSender(r, i, a, u), G(c)), new e("MEDIA_DEVICE_IN_USE", "media", !0, {
|
|
1589
1646
|
callId: n.callId,
|
|
1590
1647
|
cause: t
|
|
1591
1648
|
}));
|
|
1592
1649
|
}
|
|
1593
1650
|
if (!this.canCommitInputSwitch(n, r, i, u, o)) {
|
|
1594
1651
|
if (!r.released) try {
|
|
1595
|
-
await this.enqueueSender(r, i, () =>
|
|
1652
|
+
await this.enqueueSender(r, i, () => H(i.sender) === u ? W(i.sender) : Promise.resolve()), c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), G(c);
|
|
1596
1653
|
} catch (t) {
|
|
1597
1654
|
throw new e("SDK_INTERNAL_ERROR", "internal", !0, {
|
|
1598
1655
|
callId: n.callId,
|
|
@@ -1601,8 +1658,8 @@ var V = class {
|
|
|
1601
1658
|
}
|
|
1602
1659
|
throw this.callOperationError(n.callId);
|
|
1603
1660
|
}
|
|
1604
|
-
c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), r.localTracks.add(u), a !== null && a !== u && (r.localTracks.delete(a),
|
|
1605
|
-
e !== u &&
|
|
1661
|
+
c.forEach((e) => r.pendingTracks.delete(e)), r.pendingTracks.delete(u), r.localTracks.add(u), a !== null && a !== u && (r.localTracks.delete(a), K(a)), c.forEach((e) => {
|
|
1662
|
+
e !== u && K(e);
|
|
1606
1663
|
});
|
|
1607
1664
|
}
|
|
1608
1665
|
ensureCallMedia(e) {
|
|
@@ -1625,7 +1682,7 @@ var V = class {
|
|
|
1625
1682
|
});
|
|
1626
1683
|
}
|
|
1627
1684
|
r.forEach((r) => {
|
|
1628
|
-
let i =
|
|
1685
|
+
let i = H(r), a;
|
|
1629
1686
|
try {
|
|
1630
1687
|
a = n?.(r) ?? r.senderKind ?? r.kind;
|
|
1631
1688
|
} catch (n) {
|
|
@@ -1642,7 +1699,7 @@ var V = class {
|
|
|
1642
1699
|
});
|
|
1643
1700
|
}
|
|
1644
1701
|
findAudioSender(e) {
|
|
1645
|
-
let t = [...e.senders.values()].find((e) => e.audio && (
|
|
1702
|
+
let t = [...e.senders.values()].find((e) => e.audio && (H(e.sender)?.kind === "audio" || H(e.sender) === null));
|
|
1646
1703
|
if (t === void 0) throw this.capabilityError(e.callId);
|
|
1647
1704
|
return t;
|
|
1648
1705
|
}
|
|
@@ -1658,7 +1715,7 @@ var V = class {
|
|
|
1658
1715
|
} catch {
|
|
1659
1716
|
return !1;
|
|
1660
1717
|
}
|
|
1661
|
-
return
|
|
1718
|
+
return H(n.sender) === r;
|
|
1662
1719
|
}
|
|
1663
1720
|
enqueueSender(e, t, n, r = !1) {
|
|
1664
1721
|
t.queue.pending += 1;
|
|
@@ -1687,7 +1744,7 @@ var V = class {
|
|
|
1687
1744
|
});
|
|
1688
1745
|
}
|
|
1689
1746
|
async rollbackSender(e, t, n, r) {
|
|
1690
|
-
e.released ||
|
|
1747
|
+
e.released || H(t.sender) !== r || await this.enqueueSender(e, t, () => t.sender.replaceTrack(n)).catch(() => void 0);
|
|
1691
1748
|
}
|
|
1692
1749
|
isCurrentResource(e, t = e.generation) {
|
|
1693
1750
|
return !this.disposed && this.calls.get(e.callId) === e && e.generation === t;
|
|
@@ -1714,42 +1771,42 @@ var V = class {
|
|
|
1714
1771
|
if (this.disposed || this.disposing) throw new e("SDK_ALREADY_DISPOSED", "internal", !1);
|
|
1715
1772
|
}
|
|
1716
1773
|
};
|
|
1717
|
-
function
|
|
1774
|
+
function ye(e) {
|
|
1718
1775
|
return "peerConnection" in e;
|
|
1719
1776
|
}
|
|
1720
|
-
function
|
|
1777
|
+
function H(e) {
|
|
1721
1778
|
try {
|
|
1722
1779
|
return e.track;
|
|
1723
1780
|
} catch {
|
|
1724
1781
|
return null;
|
|
1725
1782
|
}
|
|
1726
1783
|
}
|
|
1727
|
-
function
|
|
1784
|
+
function U(e) {
|
|
1728
1785
|
return typeof e == "object" && !!e && e.name === "InvalidStateError";
|
|
1729
1786
|
}
|
|
1730
|
-
function
|
|
1787
|
+
function W(e) {
|
|
1731
1788
|
try {
|
|
1732
1789
|
return e.replaceTrack(null).catch((e) => {
|
|
1733
|
-
if (!
|
|
1790
|
+
if (!U(e)) throw e;
|
|
1734
1791
|
});
|
|
1735
1792
|
} catch (e) {
|
|
1736
|
-
return
|
|
1793
|
+
return U(e) ? Promise.resolve() : Promise.reject(e);
|
|
1737
1794
|
}
|
|
1738
1795
|
}
|
|
1739
|
-
function
|
|
1796
|
+
function be(e) {
|
|
1740
1797
|
try {
|
|
1741
|
-
|
|
1798
|
+
G(e.getTracks());
|
|
1742
1799
|
} catch {}
|
|
1743
1800
|
}
|
|
1744
|
-
function
|
|
1745
|
-
e.forEach(
|
|
1801
|
+
function G(e) {
|
|
1802
|
+
e.forEach(K);
|
|
1746
1803
|
}
|
|
1747
|
-
function
|
|
1804
|
+
function K(e) {
|
|
1748
1805
|
try {
|
|
1749
1806
|
e.stop();
|
|
1750
1807
|
} catch {}
|
|
1751
1808
|
}
|
|
1752
|
-
function
|
|
1809
|
+
function xe(e) {
|
|
1753
1810
|
if (typeof MediaStream < "u") try {
|
|
1754
1811
|
return new MediaStream([e]);
|
|
1755
1812
|
} catch {
|
|
@@ -1758,8 +1815,8 @@ function le(e) {
|
|
|
1758
1815
|
}
|
|
1759
1816
|
//#endregion
|
|
1760
1817
|
//#region src/core/mediaBridge.ts
|
|
1761
|
-
function
|
|
1762
|
-
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = n.ownershipRequired === !0, s = !1, c = !1, l, u = () => t(), d = new
|
|
1818
|
+
function Se(t, n = {}) {
|
|
1819
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = n.ownershipRequired === !0, s = !1, c = !1, l, u = () => t(), d = new ve({ getActiveCall: u });
|
|
1763
1820
|
return {
|
|
1764
1821
|
publicMedia: {
|
|
1765
1822
|
requestPermission: () => (f(), d.requestPermission()),
|
|
@@ -1772,7 +1829,7 @@ function ue(t, n = {}) {
|
|
|
1772
1829
|
releaseAll: () => (f(), d.releaseAll())
|
|
1773
1830
|
},
|
|
1774
1831
|
registerCall(e, t) {
|
|
1775
|
-
s || c || !
|
|
1832
|
+
s || c || !q(t) || (i.set(e, t), (!o || a.has(e)) && p(e, t));
|
|
1776
1833
|
},
|
|
1777
1834
|
async setCallOwnership(e, t) {
|
|
1778
1835
|
if (s) return;
|
|
@@ -1815,9 +1872,9 @@ function ue(t, n = {}) {
|
|
|
1815
1872
|
if (s) throw new e("SDK_ALREADY_DISPOSED", "internal", !1);
|
|
1816
1873
|
}
|
|
1817
1874
|
function p(e, t) {
|
|
1818
|
-
if (!
|
|
1875
|
+
if (!q(t) || typeof t.getMediaRegistration != "function") return;
|
|
1819
1876
|
let n = t.getMediaRegistration();
|
|
1820
|
-
if (
|
|
1877
|
+
if (Ce(n) && r.get(e)?.peerConnection !== n.peerConnection) {
|
|
1821
1878
|
r.set(e, n);
|
|
1822
1879
|
try {
|
|
1823
1880
|
d.registerCallMedia(e, n);
|
|
@@ -1827,22 +1884,22 @@ function ue(t, n = {}) {
|
|
|
1827
1884
|
}
|
|
1828
1885
|
}
|
|
1829
1886
|
}
|
|
1830
|
-
function
|
|
1887
|
+
function q(e) {
|
|
1831
1888
|
return typeof e == "object" && !!e;
|
|
1832
1889
|
}
|
|
1833
|
-
function
|
|
1890
|
+
function Ce(e) {
|
|
1834
1891
|
return typeof e == "object" && !!e && "peerConnection" in e && typeof e.peerConnection == "object" && e.peerConnection !== null;
|
|
1835
1892
|
}
|
|
1836
1893
|
//#endregion
|
|
1837
1894
|
//#region src/reconnect/backoff.ts
|
|
1838
|
-
var
|
|
1839
|
-
function
|
|
1840
|
-
let n = Math.min(
|
|
1895
|
+
var we = 1e3, Te = 3e4;
|
|
1896
|
+
function Ee(e, t = Math.random) {
|
|
1897
|
+
let n = Math.min(Te, we * 2 ** Math.max(0, Math.floor(e))), r = Math.min(1, Math.max(0, t()));
|
|
1841
1898
|
return Math.round(n * (1 + r * .2));
|
|
1842
1899
|
}
|
|
1843
1900
|
//#endregion
|
|
1844
1901
|
//#region src/reconnect/ReconnectManager.ts
|
|
1845
|
-
var
|
|
1902
|
+
var De = class {
|
|
1846
1903
|
recover;
|
|
1847
1904
|
random;
|
|
1848
1905
|
isOnline;
|
|
@@ -1859,7 +1916,7 @@ var he = class {
|
|
|
1859
1916
|
}
|
|
1860
1917
|
start() {
|
|
1861
1918
|
if (this.disposed || !this.online || !this.isOnline() || this.pendingTimer !== void 0 || this.running) return;
|
|
1862
|
-
let e = this.generation, t =
|
|
1919
|
+
let e = this.generation, t = Ee(this.attempt, this.random);
|
|
1863
1920
|
this.pendingTimer = setTimeout(() => {
|
|
1864
1921
|
this.pendingTimer = void 0, this.run(e);
|
|
1865
1922
|
}, t);
|
|
@@ -1901,7 +1958,7 @@ var he = class {
|
|
|
1901
1958
|
clearPendingTimer() {
|
|
1902
1959
|
this.pendingTimer !== void 0 && (clearTimeout(this.pendingTimer), this.pendingTimer = void 0);
|
|
1903
1960
|
}
|
|
1904
|
-
},
|
|
1961
|
+
}, Oe = class t {
|
|
1905
1962
|
media;
|
|
1906
1963
|
options;
|
|
1907
1964
|
api;
|
|
@@ -1938,7 +1995,7 @@ var he = class {
|
|
|
1938
1995
|
sharedWorkerSelection;
|
|
1939
1996
|
constructor(t) {
|
|
1940
1997
|
if (this.options = t, t.api === void 0 && t.sessionProvider === void 0) throw new e("CONFIG_INVALID", "configuration", !1, { cause: "CCBarClient 需要 sessionProvider" });
|
|
1941
|
-
this.api = t.api === void 0 ? X(
|
|
1998
|
+
this.api = t.api === void 0 ? J(X(t.sessionProvider)) : J(t.api), this.suppliedSip = t.sip === void 0 ? void 0 : je(t.sip), this.mediaBridge = Se(() => this.getActiveMediaContext()), this.media = this.mediaBridge.publicMedia, this.reconnect = new De({
|
|
1942
1999
|
recover: () => this.recoverConnection(),
|
|
1943
2000
|
onAttempt: (e) => {
|
|
1944
2001
|
this.disposed || this.events.emit("connection.reconnecting", { attempt: e });
|
|
@@ -1950,13 +2007,13 @@ var he = class {
|
|
|
1950
2007
|
}), this.sharedWorkerSelection = t.sharedWorker === void 0 ? {
|
|
1951
2008
|
mode: "single-tab",
|
|
1952
2009
|
reason: "disabled"
|
|
1953
|
-
} :
|
|
2010
|
+
} : w({
|
|
1954
2011
|
...t.sharedWorker,
|
|
1955
2012
|
...t.sharedWorkerHost ?? {}
|
|
1956
2013
|
});
|
|
1957
2014
|
}
|
|
1958
2015
|
static async checkSupport() {
|
|
1959
|
-
let e = typeof navigator < "u" && navigator.mediaDevices !== void 0, t = typeof WebSocket < "u", n =
|
|
2016
|
+
let e = typeof navigator < "u" && navigator.mediaDevices !== void 0, t = typeof WebSocket < "u", n = Ae(typeof navigator < "u" ? navigator.userAgent : "");
|
|
1960
2017
|
return {
|
|
1961
2018
|
supported: e && t,
|
|
1962
2019
|
platform: n,
|
|
@@ -2063,7 +2120,7 @@ var he = class {
|
|
|
2063
2120
|
sdkVersion: n,
|
|
2064
2121
|
platform: a === "mobile-web" ? "mobile_web" : "web",
|
|
2065
2122
|
...this.options.locale === void 0 ? {} : { locale: this.options.locale },
|
|
2066
|
-
requestedCapabilities: [...this.options.requestedCapabilities ??
|
|
2123
|
+
requestedCapabilities: [...this.options.requestedCapabilities ?? Fe(a)]
|
|
2067
2124
|
}), this.ownedSessionIds.add(t.sessionId), this.assertGeneration(e), r = await this.getSip(), this.assertGeneration(e), this.session = t;
|
|
2068
2125
|
let o = this.callManager ?? this.createCallManager(r, t, a);
|
|
2069
2126
|
this.callManager === void 0 && (i = o), o.updateSession(t), this.callManager = o, this.attachSipListener(r), this.attachNetworkListeners(), await r.connect(t), this.assertGeneration(e), this.setConnectionState("connected"), this.events.emit("connection.registered", { registered: !0 }), this.scheduleRefresh(t);
|
|
@@ -2169,7 +2226,7 @@ var he = class {
|
|
|
2169
2226
|
try {
|
|
2170
2227
|
await this.media.releaseAll();
|
|
2171
2228
|
} catch (t) {
|
|
2172
|
-
|
|
2229
|
+
Me(t) || (e ??= t);
|
|
2173
2230
|
}
|
|
2174
2231
|
try {
|
|
2175
2232
|
await this.mediaBridge.dispose();
|
|
@@ -2369,7 +2426,7 @@ var he = class {
|
|
|
2369
2426
|
destination: e.destination
|
|
2370
2427
|
})),
|
|
2371
2428
|
permission: this.support?.hasMediaDevices === !1 ? "unsupported" : "unknown",
|
|
2372
|
-
ice:
|
|
2429
|
+
ice: ke(e),
|
|
2373
2430
|
wss: {
|
|
2374
2431
|
configured: e !== void 0,
|
|
2375
2432
|
secure: e?.transport.wssUrl.toLowerCase().startsWith("wss://") ?? !1,
|
|
@@ -2486,7 +2543,7 @@ var he = class {
|
|
|
2486
2543
|
return new e("SDK_ALREADY_DISPOSED", "internal", !1);
|
|
2487
2544
|
}
|
|
2488
2545
|
};
|
|
2489
|
-
function
|
|
2546
|
+
function ke(e) {
|
|
2490
2547
|
if (e === void 0) return {
|
|
2491
2548
|
configured: !1,
|
|
2492
2549
|
serverCount: 0,
|
|
@@ -2504,20 +2561,32 @@ function _e(e) {
|
|
|
2504
2561
|
turnServerCount: n
|
|
2505
2562
|
};
|
|
2506
2563
|
}
|
|
2507
|
-
function
|
|
2564
|
+
function Ae(e) {
|
|
2508
2565
|
return e === "" ? "unknown" : /iPhone|iPad|Android/i.test(e) ? "mobile-web" : "web";
|
|
2509
2566
|
}
|
|
2510
|
-
function
|
|
2567
|
+
function J(t) {
|
|
2511
2568
|
if (typeof t != "object" || !t) throw new e("CONFIG_INVALID", "configuration", !1);
|
|
2512
2569
|
return t;
|
|
2513
2570
|
}
|
|
2514
|
-
function
|
|
2571
|
+
async function Y(e) {
|
|
2572
|
+
let t = e.sip?.registerTicket;
|
|
2573
|
+
if (typeof t != "string" || t === "") return e;
|
|
2574
|
+
let n = await le(t);
|
|
2575
|
+
return n === void 0 || n === t ? e : {
|
|
2576
|
+
...e,
|
|
2577
|
+
sip: {
|
|
2578
|
+
...e.sip,
|
|
2579
|
+
registerTicket: n
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
function X(t) {
|
|
2515
2584
|
let r = {
|
|
2516
|
-
createSession: (e) => t.createSession(e),
|
|
2517
|
-
refreshSession: (e) => t.refreshSession === void 0 ? t.createSession({
|
|
2585
|
+
createSession: async (e) => Y(await t.createSession(e)),
|
|
2586
|
+
refreshSession: async (e) => Y(t.refreshSession === void 0 ? await t.createSession({
|
|
2518
2587
|
sdkVersion: n,
|
|
2519
2588
|
platform: "web"
|
|
2520
|
-
}) : t.refreshSession(e),
|
|
2589
|
+
}) : await t.refreshSession(e)),
|
|
2521
2590
|
deleteSession: async (e) => {
|
|
2522
2591
|
t.deleteSession !== void 0 && await t.deleteSession(e);
|
|
2523
2592
|
},
|
|
@@ -2525,7 +2594,7 @@ function ve(t) {
|
|
|
2525
2594
|
}, i = t.invalidateToken;
|
|
2526
2595
|
return i !== void 0 && (r.invalidateToken = () => i()), r;
|
|
2527
2596
|
}
|
|
2528
|
-
function
|
|
2597
|
+
function je(t) {
|
|
2529
2598
|
if (typeof t != "object" || !t) throw new e("CONFIG_INVALID", "configuration", !1);
|
|
2530
2599
|
return t;
|
|
2531
2600
|
}
|
|
@@ -2544,13 +2613,13 @@ function Z(t, n, r, i, a) {
|
|
|
2544
2613
|
function Q(t) {
|
|
2545
2614
|
return t instanceof e ? t.status !== void 0 && t.status >= 400 && t.status < 500 || t.serverCode === "SESSION_NOT_FOUND" || t.serverCode === "SESSION_EXPIRED" || t.serverCode === "TOKEN_INVALID" || t.serverCode === "TOKEN_EXPIRED" || t.code === "AUTH_TOKEN_UNAVAILABLE" || t.code === "AUTH_TOKEN_EXPIRED" : !1;
|
|
2546
2615
|
}
|
|
2547
|
-
function
|
|
2616
|
+
function Me(t) {
|
|
2548
2617
|
return t instanceof e && t.code === "SDK_ALREADY_DISPOSED";
|
|
2549
2618
|
}
|
|
2550
2619
|
function $(t) {
|
|
2551
2620
|
return t instanceof e && (t.code === "SDK_ALREADY_DISPOSED" || t.code === "CALL_NOT_CONNECTED");
|
|
2552
2621
|
}
|
|
2553
|
-
var
|
|
2622
|
+
var Ne = [
|
|
2554
2623
|
"outbound",
|
|
2555
2624
|
"inbound",
|
|
2556
2625
|
"mute",
|
|
@@ -2558,13 +2627,13 @@ var xe = [
|
|
|
2558
2627
|
"dtmf",
|
|
2559
2628
|
"blind_transfer",
|
|
2560
2629
|
"device_selection"
|
|
2561
|
-
],
|
|
2630
|
+
], Pe = [
|
|
2562
2631
|
"outbound",
|
|
2563
2632
|
"mute",
|
|
2564
2633
|
"dtmf"
|
|
2565
2634
|
];
|
|
2566
|
-
function
|
|
2567
|
-
return e === "mobile-web" ?
|
|
2635
|
+
function Fe(e) {
|
|
2636
|
+
return e === "mobile-web" ? Pe : Ne;
|
|
2568
2637
|
}
|
|
2569
2638
|
//#endregion
|
|
2570
|
-
export {
|
|
2639
|
+
export { v as a, s as c, a as d, i as f, x as i, o as l, w as n, f as o, T as r, c as s, Oe as t, l as u };
|