@tmsoft/webphone 5.1.0 → 5.2.0
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/webphone.component.js +23 -23
- package/dist/webphone.es.js +360 -312
- package/dist/webphone.umd.js +4 -4
- package/package.json +1 -1
package/dist/webphone.es.js
CHANGED
|
@@ -7094,7 +7094,7 @@ var concatArrays = (e, t) => {
|
|
|
7094
7094
|
"max",
|
|
7095
7095
|
"fit",
|
|
7096
7096
|
...O()
|
|
7097
|
-
],
|
|
7097
|
+
], Tm = () => [
|
|
7098
7098
|
isFraction,
|
|
7099
7099
|
"screen",
|
|
7100
7100
|
"full",
|
|
@@ -7121,12 +7121,12 @@ var concatArrays = (e, t) => {
|
|
|
7121
7121
|
e,
|
|
7122
7122
|
isArbitraryVariable,
|
|
7123
7123
|
isArbitraryValue
|
|
7124
|
-
],
|
|
7124
|
+
], Em = () => [
|
|
7125
7125
|
...w(),
|
|
7126
7126
|
isArbitraryVariablePosition,
|
|
7127
7127
|
isArbitraryPosition,
|
|
7128
7128
|
{ position: [isArbitraryVariable, isArbitraryValue] }
|
|
7129
|
-
],
|
|
7129
|
+
], Dm = () => ["no-repeat", { repeat: [
|
|
7130
7130
|
"",
|
|
7131
7131
|
"x",
|
|
7132
7132
|
"y",
|
|
@@ -7155,12 +7155,12 @@ var concatArrays = (e, t) => {
|
|
|
7155
7155
|
isNumber,
|
|
7156
7156
|
isArbitraryVariableLength,
|
|
7157
7157
|
isArbitraryLength
|
|
7158
|
-
],
|
|
7158
|
+
], W = () => [
|
|
7159
7159
|
"solid",
|
|
7160
7160
|
"dashed",
|
|
7161
7161
|
"dotted",
|
|
7162
7162
|
"double"
|
|
7163
|
-
],
|
|
7163
|
+
], G = () => [
|
|
7164
7164
|
"normal",
|
|
7165
7165
|
"multiply",
|
|
7166
7166
|
"screen",
|
|
@@ -7177,28 +7177,28 @@ var concatArrays = (e, t) => {
|
|
|
7177
7177
|
"saturation",
|
|
7178
7178
|
"color",
|
|
7179
7179
|
"luminosity"
|
|
7180
|
-
],
|
|
7180
|
+
], K = () => [
|
|
7181
7181
|
isNumber,
|
|
7182
7182
|
isPercent,
|
|
7183
7183
|
isArbitraryVariablePosition,
|
|
7184
7184
|
isArbitraryPosition
|
|
7185
|
-
],
|
|
7185
|
+
], Om = () => [
|
|
7186
7186
|
"",
|
|
7187
7187
|
"none",
|
|
7188
7188
|
_,
|
|
7189
7189
|
isArbitraryVariable,
|
|
7190
7190
|
isArbitraryValue
|
|
7191
|
-
],
|
|
7191
|
+
], q = () => [
|
|
7192
7192
|
"none",
|
|
7193
7193
|
isNumber,
|
|
7194
7194
|
isArbitraryVariable,
|
|
7195
7195
|
isArbitraryValue
|
|
7196
|
-
],
|
|
7196
|
+
], km = () => [
|
|
7197
7197
|
"none",
|
|
7198
7198
|
isNumber,
|
|
7199
7199
|
isArbitraryVariable,
|
|
7200
7200
|
isArbitraryValue
|
|
7201
|
-
],
|
|
7201
|
+
], Am = () => [
|
|
7202
7202
|
isNumber,
|
|
7203
7203
|
isArbitraryVariable,
|
|
7204
7204
|
isArbitraryValue
|
|
@@ -7491,9 +7491,9 @@ var concatArrays = (e, t) => {
|
|
|
7491
7491
|
"space-y": [{ "space-y": O() }],
|
|
7492
7492
|
"space-y-reverse": ["space-y-reverse"],
|
|
7493
7493
|
size: [{ size: L() }],
|
|
7494
|
-
"inline-size": [{ inline: ["auto", ...
|
|
7495
|
-
"min-inline-size": [{ "min-inline": ["auto", ...
|
|
7496
|
-
"max-inline-size": [{ "max-inline": ["none", ...
|
|
7494
|
+
"inline-size": [{ inline: ["auto", ...Tm()] }],
|
|
7495
|
+
"min-inline-size": [{ "min-inline": ["auto", ...Tm()] }],
|
|
7496
|
+
"max-inline-size": [{ "max-inline": ["none", ...Tm()] }],
|
|
7497
7497
|
"block-size": [{ block: ["auto", ...R()] }],
|
|
7498
7498
|
"min-block-size": [{ "min-block": ["auto", ...R()] }],
|
|
7499
7499
|
"max-block-size": [{ "max-block": ["none", ...R()] }],
|
|
@@ -7611,7 +7611,7 @@ var concatArrays = (e, t) => {
|
|
|
7611
7611
|
"line-through",
|
|
7612
7612
|
"no-underline"
|
|
7613
7613
|
],
|
|
7614
|
-
"text-decoration-style": [{ decoration: [...
|
|
7614
|
+
"text-decoration-style": [{ decoration: [...W(), "wavy"] }],
|
|
7615
7615
|
"text-decoration-thickness": [{ decoration: [
|
|
7616
7616
|
isNumber,
|
|
7617
7617
|
"from-font",
|
|
@@ -7701,8 +7701,8 @@ var concatArrays = (e, t) => {
|
|
|
7701
7701
|
"padding",
|
|
7702
7702
|
"content"
|
|
7703
7703
|
] }],
|
|
7704
|
-
"bg-position": [{ bg:
|
|
7705
|
-
"bg-repeat": [{ bg:
|
|
7704
|
+
"bg-position": [{ bg: Em() }],
|
|
7705
|
+
"bg-repeat": [{ bg: Dm() }],
|
|
7706
7706
|
"bg-size": [{ bg: B() }],
|
|
7707
7707
|
"bg-image": [{ bg: [
|
|
7708
7708
|
"none",
|
|
@@ -7774,12 +7774,12 @@ var concatArrays = (e, t) => {
|
|
|
7774
7774
|
"divide-y": [{ "divide-y": U() }],
|
|
7775
7775
|
"divide-y-reverse": ["divide-y-reverse"],
|
|
7776
7776
|
"border-style": [{ border: [
|
|
7777
|
-
...
|
|
7777
|
+
...W(),
|
|
7778
7778
|
"hidden",
|
|
7779
7779
|
"none"
|
|
7780
7780
|
] }],
|
|
7781
7781
|
"divide-style": [{ divide: [
|
|
7782
|
-
...
|
|
7782
|
+
...W(),
|
|
7783
7783
|
"hidden",
|
|
7784
7784
|
"none"
|
|
7785
7785
|
] }],
|
|
@@ -7796,7 +7796,7 @@ var concatArrays = (e, t) => {
|
|
|
7796
7796
|
"border-color-l": [{ "border-l": z() }],
|
|
7797
7797
|
"divide-color": [{ divide: z() }],
|
|
7798
7798
|
"outline-style": [{ outline: [
|
|
7799
|
-
...
|
|
7799
|
+
...W(),
|
|
7800
7800
|
"none",
|
|
7801
7801
|
"hidden"
|
|
7802
7802
|
] }],
|
|
@@ -7847,11 +7847,11 @@ var concatArrays = (e, t) => {
|
|
|
7847
7847
|
isArbitraryValue
|
|
7848
7848
|
] }],
|
|
7849
7849
|
"mix-blend": [{ "mix-blend": [
|
|
7850
|
-
...
|
|
7850
|
+
...G(),
|
|
7851
7851
|
"plus-darker",
|
|
7852
7852
|
"plus-lighter"
|
|
7853
7853
|
] }],
|
|
7854
|
-
"bg-blend": [{ "bg-blend":
|
|
7854
|
+
"bg-blend": [{ "bg-blend": G() }],
|
|
7855
7855
|
"mask-clip": [{ "mask-clip": [
|
|
7856
7856
|
"border",
|
|
7857
7857
|
"padding",
|
|
@@ -7867,37 +7867,37 @@ var concatArrays = (e, t) => {
|
|
|
7867
7867
|
"exclude"
|
|
7868
7868
|
] }],
|
|
7869
7869
|
"mask-image-linear-pos": [{ "mask-linear": [isNumber] }],
|
|
7870
|
-
"mask-image-linear-from-pos": [{ "mask-linear-from":
|
|
7871
|
-
"mask-image-linear-to-pos": [{ "mask-linear-to":
|
|
7870
|
+
"mask-image-linear-from-pos": [{ "mask-linear-from": K() }],
|
|
7871
|
+
"mask-image-linear-to-pos": [{ "mask-linear-to": K() }],
|
|
7872
7872
|
"mask-image-linear-from-color": [{ "mask-linear-from": z() }],
|
|
7873
7873
|
"mask-image-linear-to-color": [{ "mask-linear-to": z() }],
|
|
7874
|
-
"mask-image-t-from-pos": [{ "mask-t-from":
|
|
7875
|
-
"mask-image-t-to-pos": [{ "mask-t-to":
|
|
7874
|
+
"mask-image-t-from-pos": [{ "mask-t-from": K() }],
|
|
7875
|
+
"mask-image-t-to-pos": [{ "mask-t-to": K() }],
|
|
7876
7876
|
"mask-image-t-from-color": [{ "mask-t-from": z() }],
|
|
7877
7877
|
"mask-image-t-to-color": [{ "mask-t-to": z() }],
|
|
7878
|
-
"mask-image-r-from-pos": [{ "mask-r-from":
|
|
7879
|
-
"mask-image-r-to-pos": [{ "mask-r-to":
|
|
7878
|
+
"mask-image-r-from-pos": [{ "mask-r-from": K() }],
|
|
7879
|
+
"mask-image-r-to-pos": [{ "mask-r-to": K() }],
|
|
7880
7880
|
"mask-image-r-from-color": [{ "mask-r-from": z() }],
|
|
7881
7881
|
"mask-image-r-to-color": [{ "mask-r-to": z() }],
|
|
7882
|
-
"mask-image-b-from-pos": [{ "mask-b-from":
|
|
7883
|
-
"mask-image-b-to-pos": [{ "mask-b-to":
|
|
7882
|
+
"mask-image-b-from-pos": [{ "mask-b-from": K() }],
|
|
7883
|
+
"mask-image-b-to-pos": [{ "mask-b-to": K() }],
|
|
7884
7884
|
"mask-image-b-from-color": [{ "mask-b-from": z() }],
|
|
7885
7885
|
"mask-image-b-to-color": [{ "mask-b-to": z() }],
|
|
7886
|
-
"mask-image-l-from-pos": [{ "mask-l-from":
|
|
7887
|
-
"mask-image-l-to-pos": [{ "mask-l-to":
|
|
7886
|
+
"mask-image-l-from-pos": [{ "mask-l-from": K() }],
|
|
7887
|
+
"mask-image-l-to-pos": [{ "mask-l-to": K() }],
|
|
7888
7888
|
"mask-image-l-from-color": [{ "mask-l-from": z() }],
|
|
7889
7889
|
"mask-image-l-to-color": [{ "mask-l-to": z() }],
|
|
7890
|
-
"mask-image-x-from-pos": [{ "mask-x-from":
|
|
7891
|
-
"mask-image-x-to-pos": [{ "mask-x-to":
|
|
7890
|
+
"mask-image-x-from-pos": [{ "mask-x-from": K() }],
|
|
7891
|
+
"mask-image-x-to-pos": [{ "mask-x-to": K() }],
|
|
7892
7892
|
"mask-image-x-from-color": [{ "mask-x-from": z() }],
|
|
7893
7893
|
"mask-image-x-to-color": [{ "mask-x-to": z() }],
|
|
7894
|
-
"mask-image-y-from-pos": [{ "mask-y-from":
|
|
7895
|
-
"mask-image-y-to-pos": [{ "mask-y-to":
|
|
7894
|
+
"mask-image-y-from-pos": [{ "mask-y-from": K() }],
|
|
7895
|
+
"mask-image-y-to-pos": [{ "mask-y-to": K() }],
|
|
7896
7896
|
"mask-image-y-from-color": [{ "mask-y-from": z() }],
|
|
7897
7897
|
"mask-image-y-to-color": [{ "mask-y-to": z() }],
|
|
7898
7898
|
"mask-image-radial": [{ "mask-radial": [isArbitraryVariable, isArbitraryValue] }],
|
|
7899
|
-
"mask-image-radial-from-pos": [{ "mask-radial-from":
|
|
7900
|
-
"mask-image-radial-to-pos": [{ "mask-radial-to":
|
|
7899
|
+
"mask-image-radial-from-pos": [{ "mask-radial-from": K() }],
|
|
7900
|
+
"mask-image-radial-to-pos": [{ "mask-radial-to": K() }],
|
|
7901
7901
|
"mask-image-radial-from-color": [{ "mask-radial-from": z() }],
|
|
7902
7902
|
"mask-image-radial-to-color": [{ "mask-radial-to": z() }],
|
|
7903
7903
|
"mask-image-radial-shape": [{ "mask-radial": ["circle", "ellipse"] }],
|
|
@@ -7907,8 +7907,8 @@ var concatArrays = (e, t) => {
|
|
|
7907
7907
|
}] }],
|
|
7908
7908
|
"mask-image-radial-pos": [{ "mask-radial-at": w() }],
|
|
7909
7909
|
"mask-image-conic-pos": [{ "mask-conic": [isNumber] }],
|
|
7910
|
-
"mask-image-conic-from-pos": [{ "mask-conic-from":
|
|
7911
|
-
"mask-image-conic-to-pos": [{ "mask-conic-to":
|
|
7910
|
+
"mask-image-conic-from-pos": [{ "mask-conic-from": K() }],
|
|
7911
|
+
"mask-image-conic-to-pos": [{ "mask-conic-to": K() }],
|
|
7912
7912
|
"mask-image-conic-from-color": [{ "mask-conic-from": z() }],
|
|
7913
7913
|
"mask-image-conic-to-color": [{ "mask-conic-to": z() }],
|
|
7914
7914
|
"mask-mode": [{ mask: [
|
|
@@ -7924,8 +7924,8 @@ var concatArrays = (e, t) => {
|
|
|
7924
7924
|
"stroke",
|
|
7925
7925
|
"view"
|
|
7926
7926
|
] }],
|
|
7927
|
-
"mask-position": [{ mask:
|
|
7928
|
-
"mask-repeat": [{ mask:
|
|
7927
|
+
"mask-position": [{ mask: Em() }],
|
|
7928
|
+
"mask-repeat": [{ mask: Dm() }],
|
|
7929
7929
|
"mask-size": [{ mask: B() }],
|
|
7930
7930
|
"mask-type": [{ "mask-type": ["alpha", "luminance"] }],
|
|
7931
7931
|
"mask-image": [{ mask: [
|
|
@@ -7939,7 +7939,7 @@ var concatArrays = (e, t) => {
|
|
|
7939
7939
|
isArbitraryVariable,
|
|
7940
7940
|
isArbitraryValue
|
|
7941
7941
|
] }],
|
|
7942
|
-
blur: [{ blur:
|
|
7942
|
+
blur: [{ blur: Om() }],
|
|
7943
7943
|
brightness: [{ brightness: [
|
|
7944
7944
|
isNumber,
|
|
7945
7945
|
isArbitraryVariable,
|
|
@@ -7992,7 +7992,7 @@ var concatArrays = (e, t) => {
|
|
|
7992
7992
|
isArbitraryVariable,
|
|
7993
7993
|
isArbitraryValue
|
|
7994
7994
|
] }],
|
|
7995
|
-
"backdrop-blur": [{ "backdrop-blur":
|
|
7995
|
+
"backdrop-blur": [{ "backdrop-blur": Om() }],
|
|
7996
7996
|
"backdrop-brightness": [{ "backdrop-brightness": [
|
|
7997
7997
|
isNumber,
|
|
7998
7998
|
isArbitraryVariable,
|
|
@@ -8085,18 +8085,18 @@ var concatArrays = (e, t) => {
|
|
|
8085
8085
|
isArbitraryValue
|
|
8086
8086
|
] }],
|
|
8087
8087
|
"perspective-origin": [{ "perspective-origin": T() }],
|
|
8088
|
-
rotate: [{ rotate:
|
|
8089
|
-
"rotate-x": [{ "rotate-x":
|
|
8090
|
-
"rotate-y": [{ "rotate-y":
|
|
8091
|
-
"rotate-z": [{ "rotate-z":
|
|
8092
|
-
scale: [{ scale:
|
|
8093
|
-
"scale-x": [{ "scale-x":
|
|
8094
|
-
"scale-y": [{ "scale-y":
|
|
8095
|
-
"scale-z": [{ "scale-z":
|
|
8088
|
+
rotate: [{ rotate: q() }],
|
|
8089
|
+
"rotate-x": [{ "rotate-x": q() }],
|
|
8090
|
+
"rotate-y": [{ "rotate-y": q() }],
|
|
8091
|
+
"rotate-z": [{ "rotate-z": q() }],
|
|
8092
|
+
scale: [{ scale: km() }],
|
|
8093
|
+
"scale-x": [{ "scale-x": km() }],
|
|
8094
|
+
"scale-y": [{ "scale-y": km() }],
|
|
8095
|
+
"scale-z": [{ "scale-z": km() }],
|
|
8096
8096
|
"scale-3d": ["scale-3d"],
|
|
8097
|
-
skew: [{ skew:
|
|
8098
|
-
"skew-x": [{ "skew-x":
|
|
8099
|
-
"skew-y": [{ "skew-y":
|
|
8097
|
+
skew: [{ skew: Am() }],
|
|
8098
|
+
"skew-x": [{ "skew-x": Am() }],
|
|
8099
|
+
"skew-y": [{ "skew-y": Am() }],
|
|
8100
8100
|
transform: [{ transform: [
|
|
8101
8101
|
isArbitraryVariable,
|
|
8102
8102
|
isArbitraryValue,
|
|
@@ -8565,12 +8565,54 @@ var sipSharedWorker_default = "/assets/sipSharedWorker-HqRmUaB2.js", SharedWorke
|
|
|
8565
8565
|
this.currentState !== e && (this.currentState = e, this.stateEventEmitter.emit(e));
|
|
8566
8566
|
}
|
|
8567
8567
|
};
|
|
8568
|
-
const buildUserAgentString = (e, t, n = "5.
|
|
8568
|
+
const buildUserAgentString = (e, t, n = "5.2.0") => {
|
|
8569
8569
|
let i = (e ?? "").replace(/[^A-Za-z0-9_.-]/g, "");
|
|
8570
8570
|
if (!i) return;
|
|
8571
8571
|
let a = n.replace(/[^A-Za-z0-9_.+-]/g, "");
|
|
8572
8572
|
return `Nebula-${i}${a ? `/${a}` : ""} ${t}`;
|
|
8573
8573
|
};
|
|
8574
|
+
var defaultStorage = () => {
|
|
8575
|
+
try {
|
|
8576
|
+
return typeof localStorage > "u" ? null : localStorage;
|
|
8577
|
+
} catch {
|
|
8578
|
+
return null;
|
|
8579
|
+
}
|
|
8580
|
+
};
|
|
8581
|
+
const readConnectionDrops = (e = defaultStorage()) => {
|
|
8582
|
+
if (!e) return [];
|
|
8583
|
+
try {
|
|
8584
|
+
let t = JSON.parse(e.getItem("webphone:connection-drops") ?? "[]");
|
|
8585
|
+
return Array.isArray(t) ? t : [];
|
|
8586
|
+
} catch {
|
|
8587
|
+
return [];
|
|
8588
|
+
}
|
|
8589
|
+
}, buildConnectionDrop = ({ connectedAt: e, inCall: t, error: n, now: i = Date.now() }) => {
|
|
8590
|
+
let a = typeof navigator > "u" ? void 0 : navigator.connection;
|
|
8591
|
+
return {
|
|
8592
|
+
at: new Date(i).toISOString(),
|
|
8593
|
+
connectedForMs: e === null ? null : Math.max(0, i - e),
|
|
8594
|
+
inCall: t,
|
|
8595
|
+
reason: n?.message || "clean",
|
|
8596
|
+
online: typeof navigator > "u" ? !0 : navigator.onLine,
|
|
8597
|
+
...a?.effectiveType ? { effectiveType: a.effectiveType } : {},
|
|
8598
|
+
...typeof a?.rtt == "number" ? { rttMs: a.rtt } : {},
|
|
8599
|
+
...typeof a?.downlink == "number" ? { downlinkMbps: a.downlink } : {}
|
|
8600
|
+
};
|
|
8601
|
+
};
|
|
8602
|
+
var emitConnectionDrop = (e) => {
|
|
8603
|
+
try {
|
|
8604
|
+
typeof window < "u" && window.dispatchEvent(new CustomEvent("webphone:connection-drop", { detail: e }));
|
|
8605
|
+
} catch {}
|
|
8606
|
+
};
|
|
8607
|
+
const recordConnectionDrop = (e, t = defaultStorage()) => {
|
|
8608
|
+
let n = buildConnectionDrop(e);
|
|
8609
|
+
if (console.warn("[SipJs] WebSocket dropped", n), emitConnectionDrop(n), !t) return n;
|
|
8610
|
+
try {
|
|
8611
|
+
let e = [...readConnectionDrops(t), n].slice(-50);
|
|
8612
|
+
t.setItem("webphone:connection-drops", JSON.stringify(e));
|
|
8613
|
+
} catch {}
|
|
8614
|
+
return n;
|
|
8615
|
+
};
|
|
8574
8616
|
var QUEUE_NAME_HEADER = "X-Nebula-Queue", QUEUE_ID_HEADER = "X-Nebula-Queue-Id";
|
|
8575
8617
|
const RECOVERY_DELAYS_MS = [
|
|
8576
8618
|
1e3,
|
|
@@ -8579,7 +8621,7 @@ const RECOVERY_DELAYS_MS = [
|
|
|
8579
8621
|
1e4,
|
|
8580
8622
|
2e4,
|
|
8581
8623
|
3e4
|
|
8582
|
-
];
|
|
8624
|
+
], isReconnectUnnecessary = (e, t) => e && t;
|
|
8583
8625
|
var InvalidUriError = class extends Error {
|
|
8584
8626
|
constructor() {
|
|
8585
8627
|
super("Invalid URI");
|
|
@@ -8588,7 +8630,7 @@ var InvalidUriError = class extends Error {
|
|
|
8588
8630
|
const createSipService = (e, t = {}) => {
|
|
8589
8631
|
let n = shallowRef(null), i = shallowRef(null), a = shallowRef(/* @__PURE__ */ new Map()), o = new Audio();
|
|
8590
8632
|
o.autoplay = !0;
|
|
8591
|
-
let l = shallowRef(void 0), u = shallowRef(null), d = shallowRef(null), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), _ = !1, v = null, y = null, b = null, x = null, S = null, w = null, T = 0, E = null, D = null, O =
|
|
8633
|
+
let l = shallowRef(void 0), u = shallowRef(null), d = shallowRef(null), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), _ = !1, v = null, y = null, b = null, x = null, S = null, w = null, T = 0, E = null, D = null, O = null, k = 0, A = 0, j = computed(() => n.value?.configuration.uri?.user || ""), { startRingtone: M, stopRingtone: N, startRingback: P, stopRingback: F, playAutoAnswerBeep: I, setNotificationVolume: L, setRingtoneVolume: Tm, setRingtoneTone: R } = useAudioSounds(), z = (e) => e instanceof Inviter || e instanceof Invitation ? e.request?.callId || e.dialog?.callId || e.id || crypto.randomUUID() : e.dialog?.callId || e.id || crypto.randomUUID(), Em = (e) => {
|
|
8592
8634
|
if (!(e instanceof Invitation)) return;
|
|
8593
8635
|
let t = e.request;
|
|
8594
8636
|
if (!t) return;
|
|
@@ -8597,23 +8639,23 @@ const createSipService = (e, t = {}) => {
|
|
|
8597
8639
|
...i ? { id: i } : {},
|
|
8598
8640
|
...n ? { name: n } : {}
|
|
8599
8641
|
};
|
|
8600
|
-
},
|
|
8601
|
-
let o =
|
|
8642
|
+
}, Dm = (e, n, i, a) => {
|
|
8643
|
+
let o = Em(e), s = {
|
|
8602
8644
|
channelId: n,
|
|
8603
|
-
sipCallId:
|
|
8645
|
+
sipCallId: z(e),
|
|
8604
8646
|
direction: i,
|
|
8605
8647
|
remoteNumber: a,
|
|
8606
8648
|
...o ? { queue: o } : {}
|
|
8607
8649
|
};
|
|
8608
8650
|
return f.set(n, s), t.onCallContext?.(s), s;
|
|
8609
|
-
},
|
|
8651
|
+
}, B = (e, n) => {
|
|
8610
8652
|
let i = f.get(e);
|
|
8611
8653
|
i && t.onCallState?.({
|
|
8612
8654
|
...i,
|
|
8613
8655
|
state: n,
|
|
8614
8656
|
timestamp: Date.now()
|
|
8615
8657
|
});
|
|
8616
|
-
},
|
|
8658
|
+
}, V = (e, n) => {
|
|
8617
8659
|
if (a.value.get(n) !== e || e.state !== SessionState.Established) return;
|
|
8618
8660
|
let i = f.get(n), o = e.sessionDescriptionHandler, s = o?.localMediaStream ?? d.value, l = o?.remoteMediaStream ?? u.value, m = s?.getAudioTracks() ?? [], g = l?.getAudioTracks() ?? [];
|
|
8619
8661
|
if (!i || !s || !l || m.length === 0 || g.length === 0) return;
|
|
@@ -8627,14 +8669,14 @@ const createSipService = (e, t = {}) => {
|
|
|
8627
8669
|
localStream: s,
|
|
8628
8670
|
remoteStream: l
|
|
8629
8671
|
}));
|
|
8630
|
-
},
|
|
8672
|
+
}, H = (e) => {
|
|
8631
8673
|
f.delete(e), p.delete(e), m.delete(e);
|
|
8632
|
-
},
|
|
8674
|
+
}, W = (n, i) => {
|
|
8633
8675
|
if (a.value.get(n) !== i) return;
|
|
8634
8676
|
let o = g.get(i);
|
|
8635
8677
|
o && clearTimeout(o), g.delete(i);
|
|
8636
8678
|
let s = e.channels.value.find((e) => e.id === n), l = f.get(n), u = m.has(n) || s?.status === "connected";
|
|
8637
|
-
|
|
8679
|
+
H(n), a.value.delete(n), e.updateChannelState(n, {
|
|
8638
8680
|
status: "idle",
|
|
8639
8681
|
remoteNumber: "",
|
|
8640
8682
|
remoteDisplayName: void 0,
|
|
@@ -8646,7 +8688,7 @@ const createSipService = (e, t = {}) => {
|
|
|
8646
8688
|
hasEarlyMedia: !1
|
|
8647
8689
|
});
|
|
8648
8690
|
let d = e.transferInProgress.value;
|
|
8649
|
-
if (d && (d.originalChannelId === n || d.consultationChannelId === n) && e.setTransferInProgress(null), e.activeChannelId.value === n &&
|
|
8691
|
+
if (d && (d.originalChannelId === n || d.consultationChannelId === n) && e.setTransferInProgress(null), e.activeChannelId.value === n && ih(), q(), l) {
|
|
8650
8692
|
try {
|
|
8651
8693
|
e.addCallLog({
|
|
8652
8694
|
number: l.remoteNumber,
|
|
@@ -8668,11 +8710,11 @@ const createSipService = (e, t = {}) => {
|
|
|
8668
8710
|
console.warn("[SipJs] Call ended, but the state callback failed:", e);
|
|
8669
8711
|
}
|
|
8670
8712
|
}
|
|
8671
|
-
},
|
|
8713
|
+
}, G = (e, t) => {
|
|
8672
8714
|
g.has(t) || g.set(t, setTimeout(() => {
|
|
8673
|
-
console.warn("[SipJs] Hangup did not terminate; releasing local call state"),
|
|
8715
|
+
console.warn("[SipJs] Hangup did not terminate; releasing local call state"), K(t), W(e, t);
|
|
8674
8716
|
}, 5e3));
|
|
8675
|
-
},
|
|
8717
|
+
}, K = (e) => {
|
|
8676
8718
|
if (e.state !== SessionState.Terminated) try {
|
|
8677
8719
|
e.dispose().catch((e) => {
|
|
8678
8720
|
console.warn("[SipJs] Session disposal failed:", e);
|
|
@@ -8680,17 +8722,17 @@ const createSipService = (e, t = {}) => {
|
|
|
8680
8722
|
} catch (e) {
|
|
8681
8723
|
console.warn("[SipJs] Session disposal failed:", e);
|
|
8682
8724
|
}
|
|
8683
|
-
},
|
|
8684
|
-
for (let [e, t] of a.value) t.state === SessionState.Initial && f.get(e)?.direction === "incoming" && (console.warn("[SipJs] Transport lost while ringing; releasing the incoming call"),
|
|
8685
|
-
},
|
|
8686
|
-
e.channels.value.some((e) => e.status === "incoming") && !isAutoAnswerEnabled() ?
|
|
8687
|
-
},
|
|
8688
|
-
await
|
|
8689
|
-
},
|
|
8725
|
+
}, Om = () => {
|
|
8726
|
+
for (let [e, t] of a.value) t.state === SessionState.Initial && f.get(e)?.direction === "incoming" && (console.warn("[SipJs] Transport lost while ringing; releasing the incoming call"), W(e, t), K(t));
|
|
8727
|
+
}, q = () => {
|
|
8728
|
+
e.channels.value.some((e) => e.status === "incoming") && !isAutoAnswerEnabled() ? M() : N(), e.activeChannel.value?.status === "calling" ? P() : F();
|
|
8729
|
+
}, km = async (e, t, n) => {
|
|
8730
|
+
await I(), isAutoAnswerEnabled() && a.value.get(e) === t && t.state === SessionState.Initial && await qm(n);
|
|
8731
|
+
}, Am = (e) => {
|
|
8690
8732
|
o.volume = e / 100;
|
|
8691
|
-
},
|
|
8733
|
+
}, J = async (e) => {
|
|
8692
8734
|
typeof o.setSinkId == "function" && await o.setSinkId(e);
|
|
8693
|
-
},
|
|
8735
|
+
}, jm = async (t) => {
|
|
8694
8736
|
if (!t) return;
|
|
8695
8737
|
let n = [...a.value.entries()].flatMap(([e, t]) => {
|
|
8696
8738
|
let n = t.sessionDescriptionHandler, i = n?.peerConnection?.getSenders().find((e) => e.track?.kind === "audio");
|
|
@@ -8708,7 +8750,7 @@ const createSipService = (e, t = {}) => {
|
|
|
8708
8750
|
let i = [], o = [];
|
|
8709
8751
|
try {
|
|
8710
8752
|
for (let { sender: e } of n) {
|
|
8711
|
-
let n = await navigator.mediaDevices.getUserMedia(
|
|
8753
|
+
let n = await navigator.mediaDevices.getUserMedia(Im(!1, t));
|
|
8712
8754
|
i.push(n);
|
|
8713
8755
|
let [a] = n.getAudioTracks(), s = e.track;
|
|
8714
8756
|
if (!a || !s) throw Error("Could not acquire an audio track for the selected microphone");
|
|
@@ -8729,7 +8771,7 @@ const createSipService = (e, t = {}) => {
|
|
|
8729
8771
|
e !== l && d.value?.removeTrack(e);
|
|
8730
8772
|
}), d.value.getTracks().includes(l) || d.value.addTrack(l)));
|
|
8731
8773
|
try {
|
|
8732
|
-
|
|
8774
|
+
V(n, t);
|
|
8733
8775
|
} catch (e) {
|
|
8734
8776
|
console.error("[SipJs] Media-ready callback failed after microphone switch:", e);
|
|
8735
8777
|
}
|
|
@@ -8745,32 +8787,32 @@ const createSipService = (e, t = {}) => {
|
|
|
8745
8787
|
} catch (e) {
|
|
8746
8788
|
await Promise.allSettled(o.map(({ sender: e, previousTrack: t }) => e.replaceTrack(t))), i.forEach((e) => e.getTracks().forEach((e) => e.stop())), console.warn("[SipJs] Failed to switch microphone:", e);
|
|
8747
8789
|
}
|
|
8748
|
-
},
|
|
8790
|
+
}, Mm = (e, t) => {
|
|
8749
8791
|
let n = !1, i = e.sessionDescriptionHandler;
|
|
8750
8792
|
return i?.peerConnection && i.peerConnection.getSenders().forEach((e) => {
|
|
8751
8793
|
e.track && e.track.kind === "audio" && (e.track.enabled = t, n = !0);
|
|
8752
8794
|
}), n;
|
|
8753
|
-
},
|
|
8795
|
+
}, Nm = (e) => {
|
|
8754
8796
|
let t = !1;
|
|
8755
8797
|
return d.value && d.value.getAudioTracks().forEach((n) => {
|
|
8756
8798
|
n.enabled = e, t = !0;
|
|
8757
8799
|
}), t;
|
|
8758
|
-
},
|
|
8759
|
-
let n = !(t?.isHeld || t?.isMuted), i =
|
|
8800
|
+
}, Pm = (e, t) => {
|
|
8801
|
+
let n = !(t?.isHeld || t?.isMuted), i = Mm(e, n), a = Nm(n);
|
|
8760
8802
|
!i && !a && console.warn("[SipJs] No audio tracks found to apply channel audio state");
|
|
8761
|
-
},
|
|
8803
|
+
}, Fm = (t) => {
|
|
8762
8804
|
for (let [n, i] of a.value.entries()) if (i === t) return e.channels.value.find((e) => e.id === n) || null;
|
|
8763
8805
|
return e.activeChannel.value || null;
|
|
8764
|
-
},
|
|
8806
|
+
}, Y = async (e) => {
|
|
8765
8807
|
let t = e.sessionDescriptionHandler?.peerConnection;
|
|
8766
8808
|
if (!t) return;
|
|
8767
|
-
let n =
|
|
8809
|
+
let n = Fm(e), i = !(n?.isHeld || n?.isMuted), o = t.getSenders().find((e) => e.track?.kind === "audio");
|
|
8768
8810
|
if (o?.track) {
|
|
8769
|
-
o.track.enabled = i, n &&
|
|
8811
|
+
o.track.enabled = i, n && V(e, n.id);
|
|
8770
8812
|
return;
|
|
8771
8813
|
}
|
|
8772
8814
|
try {
|
|
8773
|
-
let o = await navigator.mediaDevices.getUserMedia(
|
|
8815
|
+
let o = await navigator.mediaDevices.getUserMedia(Im(!1));
|
|
8774
8816
|
if (![...a.value.values()].includes(e)) {
|
|
8775
8817
|
o.getTracks().forEach((e) => e.stop());
|
|
8776
8818
|
return;
|
|
@@ -8781,11 +8823,11 @@ const createSipService = (e, t = {}) => {
|
|
|
8781
8823
|
let l = new MediaStream([s]);
|
|
8782
8824
|
d.value = l;
|
|
8783
8825
|
let u = t.getSenders().find((e) => e.track === null);
|
|
8784
|
-
u ? await u.replaceTrack(s) : t.addTrack(s, l),
|
|
8826
|
+
u ? await u.replaceTrack(s) : t.addTrack(s, l), Pm(e, n), n && V(e, n.id);
|
|
8785
8827
|
} catch (e) {
|
|
8786
8828
|
console.warn("[SipJs] Failed to recover outbound audio track:", e);
|
|
8787
8829
|
}
|
|
8788
|
-
},
|
|
8830
|
+
}, Im = (e = !1, t = l.value) => {
|
|
8789
8831
|
let n = {
|
|
8790
8832
|
echoCancellation: { ideal: !0 },
|
|
8791
8833
|
noiseSuppression: { ideal: !1 },
|
|
@@ -8796,7 +8838,7 @@ const createSipService = (e, t = {}) => {
|
|
|
8796
8838
|
audio: n,
|
|
8797
8839
|
video: e
|
|
8798
8840
|
};
|
|
8799
|
-
},
|
|
8841
|
+
}, Lm = async () => {
|
|
8800
8842
|
let t = i.value;
|
|
8801
8843
|
t && await t.register({ requestDelegate: {
|
|
8802
8844
|
onAccept: () => {
|
|
@@ -8805,13 +8847,13 @@ const createSipService = (e, t = {}) => {
|
|
|
8805
8847
|
onReject: (t) => {
|
|
8806
8848
|
e.setConnected(!1);
|
|
8807
8849
|
let n = t?.message?.statusCode;
|
|
8808
|
-
n === 401 || n === 403 || n === 404 ||
|
|
8850
|
+
n === 401 || n === 403 || n === 404 || Vm();
|
|
8809
8851
|
}
|
|
8810
8852
|
} });
|
|
8811
|
-
},
|
|
8853
|
+
}, Rm = async (t) => {
|
|
8812
8854
|
if (n.value) return;
|
|
8813
|
-
|
|
8814
|
-
let
|
|
8855
|
+
O &&= (clearTimeout(O), null);
|
|
8856
|
+
let o = A;
|
|
8815
8857
|
try {
|
|
8816
8858
|
(await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop());
|
|
8817
8859
|
} catch (e) {
|
|
@@ -8819,43 +8861,49 @@ const createSipService = (e, t = {}) => {
|
|
|
8819
8861
|
return;
|
|
8820
8862
|
}
|
|
8821
8863
|
try {
|
|
8822
|
-
let
|
|
8823
|
-
if (!
|
|
8864
|
+
let o = UserAgent.makeURI(t.uri);
|
|
8865
|
+
if (!o) throw new InvalidUriError();
|
|
8824
8866
|
_ = t.earlyMedia ?? !1;
|
|
8825
|
-
let
|
|
8867
|
+
let s = {
|
|
8826
8868
|
server: t.transportOptions.server,
|
|
8827
8869
|
keepAliveInterval: t.transportOptions.keepAliveInterval ?? 30
|
|
8828
|
-
},
|
|
8829
|
-
uri:
|
|
8870
|
+
}, l = {
|
|
8871
|
+
uri: o,
|
|
8830
8872
|
logLevel: "error",
|
|
8831
|
-
transportOptions:
|
|
8873
|
+
transportOptions: s,
|
|
8832
8874
|
authorizationUsername: t.authorizationUsername,
|
|
8833
8875
|
authorizationPassword: t.authorizationPassword,
|
|
8834
8876
|
userAgentString: buildUserAgentString(t.appName, `SIP.js/${version}`),
|
|
8835
8877
|
reconnectionAttempts: 0,
|
|
8836
8878
|
delegate: {
|
|
8837
|
-
onConnect: () => {
|
|
8838
|
-
|
|
8839
|
-
e.setConnected(!1), G(), Pm();
|
|
8879
|
+
onConnect: () => {
|
|
8880
|
+
E = Date.now();
|
|
8840
8881
|
},
|
|
8841
|
-
|
|
8882
|
+
onDisconnect: (t) => {
|
|
8883
|
+
recordConnectionDrop({
|
|
8884
|
+
connectedAt: E,
|
|
8885
|
+
inCall: a.value.size > 0,
|
|
8886
|
+
error: t
|
|
8887
|
+
}), E = null, e.setConnected(!1), Om(), Vm();
|
|
8888
|
+
},
|
|
8889
|
+
onInvite: (e) => Gm(e)
|
|
8842
8890
|
}
|
|
8843
|
-
},
|
|
8844
|
-
|
|
8845
|
-
...
|
|
8891
|
+
}, u = typeof SharedWorker < "u", d = u;
|
|
8892
|
+
u && (l.transportConstructor = SharedWorkerTransport, l.transportOptions = {
|
|
8893
|
+
...s,
|
|
8846
8894
|
clientId: crypto.randomUUID(),
|
|
8847
8895
|
connectionId: `${t.transportOptions.server}|${t.uri}|${crypto.randomUUID()}`
|
|
8848
8896
|
});
|
|
8849
8897
|
try {
|
|
8850
|
-
n.value = new UserAgent(
|
|
8898
|
+
n.value = new UserAgent(l);
|
|
8851
8899
|
} catch (e) {
|
|
8852
|
-
if (!
|
|
8853
|
-
|
|
8900
|
+
if (!u) throw e;
|
|
8901
|
+
d = !1, console.warn("[SipJs] SharedWorker unavailable, using native WebSocket transport", e), delete l.transportConstructor, l.transportOptions = s, n.value = new UserAgent(l);
|
|
8854
8902
|
}
|
|
8855
8903
|
try {
|
|
8856
|
-
await n.value.start(), i.value = new Registerer(n.value), await
|
|
8904
|
+
await n.value.start(), i.value = new Registerer(n.value), await Lm();
|
|
8857
8905
|
} catch (e) {
|
|
8858
|
-
if (!
|
|
8906
|
+
if (!d) throw e;
|
|
8859
8907
|
console.warn("[SipJs] SharedWorker connection failed, retrying with native WebSocket", e);
|
|
8860
8908
|
let t = n.value;
|
|
8861
8909
|
n.value = null, i.value = null;
|
|
@@ -8864,38 +8912,38 @@ const createSipService = (e, t = {}) => {
|
|
|
8864
8912
|
} catch (e) {
|
|
8865
8913
|
console.warn("[SipJs] Failed to clean up SharedWorker transport", e);
|
|
8866
8914
|
}
|
|
8867
|
-
delete
|
|
8915
|
+
delete l.transportConstructor, l.transportOptions = s, n.value = new UserAgent(l), await n.value.start(), i.value = new Registerer(n.value), await Lm();
|
|
8868
8916
|
}
|
|
8869
|
-
|
|
8917
|
+
Bm(), k = 0;
|
|
8870
8918
|
} catch (e) {
|
|
8871
8919
|
console.error("[SipJs] Failed to initialize WSS/SIP connection", e);
|
|
8872
|
-
let
|
|
8873
|
-
if (n.value = null, i.value = null,
|
|
8874
|
-
await
|
|
8920
|
+
let a = n.value;
|
|
8921
|
+
if (n.value = null, i.value = null, a !== null) try {
|
|
8922
|
+
await a.stop();
|
|
8875
8923
|
} catch (e) {
|
|
8876
8924
|
console.warn("[SipJs] Failed to clean up after connection error", e);
|
|
8877
8925
|
}
|
|
8878
|
-
!(e instanceof InvalidUriError) &&
|
|
8879
|
-
}
|
|
8880
|
-
},
|
|
8881
|
-
if (
|
|
8882
|
-
let t = RECOVERY_DELAYS_MS[Math.min(
|
|
8883
|
-
|
|
8884
|
-
if (
|
|
8885
|
-
console.log("[SipJs] Skipping initial connection retry, device is offline"),
|
|
8926
|
+
!(e instanceof InvalidUriError) && o === A && zm(t);
|
|
8927
|
+
}
|
|
8928
|
+
}, zm = (e) => {
|
|
8929
|
+
if (O) return;
|
|
8930
|
+
let t = RECOVERY_DELAYS_MS[Math.min(k, RECOVERY_DELAYS_MS.length - 1)];
|
|
8931
|
+
k++, O = setTimeout(async () => {
|
|
8932
|
+
if (O = null, !navigator.onLine) {
|
|
8933
|
+
console.log("[SipJs] Skipping initial connection retry, device is offline"), zm(e);
|
|
8886
8934
|
return;
|
|
8887
8935
|
}
|
|
8888
|
-
console.log("[SipJs] Retrying initial connection..."), await
|
|
8936
|
+
console.log("[SipJs] Retrying initial connection..."), await Rm(e);
|
|
8889
8937
|
}, t);
|
|
8890
|
-
},
|
|
8938
|
+
}, Bm = () => {
|
|
8891
8939
|
b = new AbortController();
|
|
8892
8940
|
let { signal: t } = b, n = Date.now(), i = (e = 1e3) => {
|
|
8893
8941
|
x && clearTimeout(x), x = setTimeout(async () => {
|
|
8894
|
-
x = null, await
|
|
8942
|
+
x = null, await Um();
|
|
8895
8943
|
}, e);
|
|
8896
8944
|
}, a = () => {
|
|
8897
8945
|
if (document.visibilityState === "visible") {
|
|
8898
|
-
|
|
8946
|
+
q();
|
|
8899
8947
|
let e = Date.now() - n;
|
|
8900
8948
|
e > 5e3 ? (console.log(`[SipJs] Device was suspended for ${Math.round(e / 1e3)}s, reconnecting...`), i(1500)) : i(500);
|
|
8901
8949
|
}
|
|
@@ -8913,9 +8961,9 @@ const createSipService = (e, t = {}) => {
|
|
|
8913
8961
|
document.addEventListener("visibilitychange", a, { signal: t }), window.addEventListener("online", o, { signal: t }), window.addEventListener("offline", s, { signal: t }), document.addEventListener("freeze", () => {
|
|
8914
8962
|
console.log("[SipJs] Page frozen"), S &&= (clearInterval(S), null);
|
|
8915
8963
|
}, { signal: t }), document.addEventListener("resume", () => {
|
|
8916
|
-
console.log("[SipJs] Page resumed"),
|
|
8917
|
-
}, { signal: t }), l(),
|
|
8918
|
-
},
|
|
8964
|
+
console.log("[SipJs] Page resumed"), q(), n = Date.now(), l(), i(1e3);
|
|
8965
|
+
}, { signal: t }), l(), Hm();
|
|
8966
|
+
}, Vm = () => {
|
|
8919
8967
|
if (w || !n.value) return;
|
|
8920
8968
|
let t = RECOVERY_DELAYS_MS[Math.min(T, RECOVERY_DELAYS_MS.length - 1)];
|
|
8921
8969
|
w = setTimeout(async () => {
|
|
@@ -8923,43 +8971,43 @@ const createSipService = (e, t = {}) => {
|
|
|
8923
8971
|
T = 0;
|
|
8924
8972
|
return;
|
|
8925
8973
|
}
|
|
8926
|
-
T++, await
|
|
8974
|
+
T++, await Um(), e.isConnected.value || Vm();
|
|
8927
8975
|
}, t);
|
|
8928
|
-
},
|
|
8929
|
-
|
|
8930
|
-
n.value && !e.isConnected.value &&
|
|
8976
|
+
}, Hm = () => {
|
|
8977
|
+
D && clearInterval(D), D = setInterval(() => {
|
|
8978
|
+
n.value && !e.isConnected.value && Vm();
|
|
8931
8979
|
}, 3e4);
|
|
8932
|
-
},
|
|
8980
|
+
}, Um = async () => {
|
|
8933
8981
|
if (n.value) {
|
|
8934
8982
|
if (!navigator.onLine) {
|
|
8935
8983
|
console.log("[SipJs] Skipping reconnect, device is offline");
|
|
8936
8984
|
return;
|
|
8937
8985
|
}
|
|
8938
|
-
if (a.value.size > 0) {
|
|
8939
|
-
console.log("[SipJs] Skipping reconnect,
|
|
8986
|
+
if (isReconnectUnnecessary(a.value.size > 0, e.isConnected.value)) {
|
|
8987
|
+
console.log("[SipJs] Skipping reconnect, call in progress and registration is healthy");
|
|
8940
8988
|
return;
|
|
8941
8989
|
}
|
|
8942
8990
|
try {
|
|
8943
8991
|
if (n.value.isConnected() || (console.log("[SipJs] Reconnecting..."), await n.value.reconnect()), i.value && n.value.isConnected()) try {
|
|
8944
|
-
await
|
|
8992
|
+
await Lm();
|
|
8945
8993
|
} catch {}
|
|
8946
8994
|
} catch (e) {
|
|
8947
8995
|
console.error("[SipJs] Reconnection failed:", e);
|
|
8948
8996
|
}
|
|
8949
8997
|
}
|
|
8950
|
-
},
|
|
8951
|
-
b?.abort(), b = null, x &&= (clearTimeout(x), null), S &&= (clearInterval(S), null),
|
|
8998
|
+
}, Wm = async () => {
|
|
8999
|
+
b?.abort(), b = null, x &&= (clearTimeout(x), null), S &&= (clearInterval(S), null), D &&= (clearInterval(D), null), w &&= (clearTimeout(w), null), T = 0, O &&= (clearTimeout(O), null), k = 0, A++;
|
|
8952
9000
|
for (let [e, t] of a.value.entries()) {
|
|
8953
9001
|
let n;
|
|
8954
9002
|
try {
|
|
8955
|
-
await Promise.race([
|
|
9003
|
+
await Promise.race([Jm(e, t), new Promise((e) => {
|
|
8956
9004
|
n = setTimeout(e, 1500);
|
|
8957
9005
|
})]);
|
|
8958
9006
|
} finally {
|
|
8959
9007
|
n && clearTimeout(n);
|
|
8960
9008
|
}
|
|
8961
9009
|
}
|
|
8962
|
-
|
|
9010
|
+
ih();
|
|
8963
9011
|
let e = i.value, t = n.value;
|
|
8964
9012
|
if (i.value = null, n.value = null, e) try {
|
|
8965
9013
|
await e.unregister();
|
|
@@ -8971,7 +9019,7 @@ const createSipService = (e, t = {}) => {
|
|
|
8971
9019
|
} catch (e) {
|
|
8972
9020
|
console.warn("[SipJs] UserAgent stop failed:", e);
|
|
8973
9021
|
}
|
|
8974
|
-
},
|
|
9022
|
+
}, Gm = (t) => {
|
|
8975
9023
|
console.log("[SipJs] 📞 Llamada entrante recibida"), console.log("[SipJs] Remote Identity URI:", t.remoteIdentity.uri.toString()), console.log("[SipJs] Remote Identity URI user:", t.remoteIdentity.uri.user), console.log("[SipJs] Remote Identity displayName:", t.remoteIdentity.displayName);
|
|
8976
9024
|
let n = e.channels.value.find((e) => e.status === "idle" && !a.value.has(e.id));
|
|
8977
9025
|
if (!n) {
|
|
@@ -8986,21 +9034,21 @@ const createSipService = (e, t = {}) => {
|
|
|
8986
9034
|
remoteNumber: s,
|
|
8987
9035
|
remoteDisplayName: t.remoteIdentity.displayName || void 0,
|
|
8988
9036
|
hasVideo: o
|
|
8989
|
-
}),
|
|
9037
|
+
}), Dm(t, i, "incoming", s), B(i, "ringing"), q(), e.setActiveChannelId(i), isAutoAnswerEnabled() && km(i, t, o), t.stateChange.addListener((n) => {
|
|
8990
9038
|
switch (n) {
|
|
8991
9039
|
case SessionState.Terminated:
|
|
8992
|
-
|
|
9040
|
+
W(i, t);
|
|
8993
9041
|
break;
|
|
8994
9042
|
case SessionState.Established:
|
|
8995
9043
|
if (a.value.get(i) !== t) break;
|
|
8996
9044
|
m.add(i), e.updateChannelState(i, {
|
|
8997
9045
|
status: "connected",
|
|
8998
9046
|
startTime: Date.now()
|
|
8999
|
-
}),
|
|
9047
|
+
}), B(i, "connected"), e.activeChannelId.value === i && ($(t), Y(t).then(() => V(t, i))), q();
|
|
9000
9048
|
break;
|
|
9001
9049
|
}
|
|
9002
9050
|
});
|
|
9003
|
-
},
|
|
9051
|
+
}, Km = async (t, i = !1) => {
|
|
9004
9052
|
if (!n.value) return;
|
|
9005
9053
|
let o = e.activeChannelId.value;
|
|
9006
9054
|
if (a.value.has(o)) return;
|
|
@@ -9011,71 +9059,71 @@ const createSipService = (e, t = {}) => {
|
|
|
9011
9059
|
}
|
|
9012
9060
|
if (!s) return;
|
|
9013
9061
|
let l = new Inviter(n.value, s, { earlyMedia: _ });
|
|
9014
|
-
a.value.set(o, l),
|
|
9062
|
+
a.value.set(o, l), Dm(l, o, "outgoing", t), B(o, "dialing"), e.updateChannelState(o, {
|
|
9015
9063
|
status: "calling",
|
|
9016
9064
|
remoteNumber: t,
|
|
9017
9065
|
hasVideo: i
|
|
9018
|
-
}), e.setLastDialedNumber(t),
|
|
9066
|
+
}), e.setLastDialedNumber(t), q(), l.stateChange.addListener((t) => {
|
|
9019
9067
|
switch (t) {
|
|
9020
9068
|
case SessionState.Established:
|
|
9021
9069
|
if (a.value.get(o) !== l) break;
|
|
9022
9070
|
m.add(o), e.channels.value.find((e) => e.id === o)?.status !== "connected" && (e.updateChannelState(o, {
|
|
9023
9071
|
status: "connected",
|
|
9024
9072
|
startTime: Date.now()
|
|
9025
|
-
}),
|
|
9073
|
+
}), B(o, "connected"), $(l), Y(l).then(() => V(l, o)), q());
|
|
9026
9074
|
break;
|
|
9027
9075
|
case SessionState.Terminated:
|
|
9028
|
-
|
|
9076
|
+
W(o, l);
|
|
9029
9077
|
break;
|
|
9030
9078
|
}
|
|
9031
9079
|
});
|
|
9032
9080
|
let u = {
|
|
9033
|
-
sessionDescriptionHandlerOptions: { constraints:
|
|
9081
|
+
sessionDescriptionHandlerOptions: { constraints: Im(i) },
|
|
9034
9082
|
requestDelegate: {
|
|
9035
9083
|
onProgress: (t) => {
|
|
9036
|
-
a.value.get(o) === l && (t.message.statusCode === 180 || t.message.statusCode === 183) && (t.message.body && (e.updateChannelState(o, { hasEarlyMedia: !0 }),
|
|
9084
|
+
a.value.get(o) === l && (t.message.statusCode === 180 || t.message.statusCode === 183) && (t.message.body && (e.updateChannelState(o, { hasEarlyMedia: !0 }), $(l)), q());
|
|
9037
9085
|
},
|
|
9038
9086
|
onAccept: (t) => {
|
|
9039
9087
|
a.value.get(o) === l && e.channels.value.find((e) => e.id === o)?.status !== "connected" && (m.add(o), e.updateChannelState(o, {
|
|
9040
9088
|
status: "connected",
|
|
9041
9089
|
startTime: Date.now()
|
|
9042
|
-
}),
|
|
9090
|
+
}), B(o, "connected"), $(l), Y(l).then(() => V(l, o)), q());
|
|
9043
9091
|
}
|
|
9044
9092
|
}
|
|
9045
9093
|
};
|
|
9046
9094
|
try {
|
|
9047
9095
|
await l.invite(u);
|
|
9048
9096
|
} catch (e) {
|
|
9049
|
-
throw
|
|
9097
|
+
throw W(o, l), e;
|
|
9050
9098
|
}
|
|
9051
|
-
},
|
|
9099
|
+
}, qm = async (t = !1) => {
|
|
9052
9100
|
let n = e.activeChannelId.value, i = a.value.get(n);
|
|
9053
9101
|
if (i instanceof Invitation && i.state === SessionState.Initial) {
|
|
9054
|
-
|
|
9102
|
+
N(), e.updateChannelState(n, {
|
|
9055
9103
|
status: "connected",
|
|
9056
9104
|
startTime: Date.now()
|
|
9057
|
-
}),
|
|
9105
|
+
}), q();
|
|
9058
9106
|
for (let [t, n] of a.value.entries()) if (t !== e.activeChannelId.value && n.state === SessionState.Established && !e.channels.value.find((e) => e.id === t)?.isHeld) try {
|
|
9059
|
-
await
|
|
9107
|
+
await Q(n, !0), e.updateChannelState(t, { isHeld: !0 });
|
|
9060
9108
|
} catch (e) {
|
|
9061
9109
|
console.error(`[SipJs] Failed to hold channel ${t}:`, e);
|
|
9062
9110
|
}
|
|
9063
9111
|
let o = { sessionDescriptionHandlerOptions: {
|
|
9064
|
-
constraints:
|
|
9112
|
+
constraints: Im(t),
|
|
9065
9113
|
iceGatheringTimeout: 1e3
|
|
9066
9114
|
} };
|
|
9067
9115
|
try {
|
|
9068
|
-
await i.accept(o),
|
|
9116
|
+
await i.accept(o), q();
|
|
9069
9117
|
} catch (t) {
|
|
9070
9118
|
let i = a.value.get(n);
|
|
9071
9119
|
throw i instanceof Invitation && i.state === SessionState.Initial && (e.updateChannelState(n, {
|
|
9072
9120
|
status: "incoming",
|
|
9073
9121
|
startTime: void 0
|
|
9074
|
-
}),
|
|
9122
|
+
}), q()), t;
|
|
9075
9123
|
}
|
|
9076
9124
|
}
|
|
9077
|
-
},
|
|
9078
|
-
|
|
9125
|
+
}, Jm = async (e, t) => {
|
|
9126
|
+
G(e, t);
|
|
9079
9127
|
try {
|
|
9080
9128
|
switch (t.state) {
|
|
9081
9129
|
case SessionState.Initial:
|
|
@@ -9089,40 +9137,40 @@ const createSipService = (e, t = {}) => {
|
|
|
9089
9137
|
} catch (e) {
|
|
9090
9138
|
console.warn("[SipJs] Hangup signaling failed:", e);
|
|
9091
9139
|
} finally {
|
|
9092
|
-
|
|
9140
|
+
K(t), W(e, t);
|
|
9093
9141
|
}
|
|
9094
|
-
},
|
|
9142
|
+
}, Ym = async () => {
|
|
9095
9143
|
let t = e.activeChannelId.value, n = a.value.get(t);
|
|
9096
|
-
n && await
|
|
9097
|
-
},
|
|
9144
|
+
n && await Jm(t, n);
|
|
9145
|
+
}, Z = () => {
|
|
9098
9146
|
let t = a.value.get(e.activeChannelId.value);
|
|
9099
9147
|
if (!t) return;
|
|
9100
9148
|
let n = !e.isMuted.value;
|
|
9101
|
-
e.setMuted(n),
|
|
9102
|
-
},
|
|
9149
|
+
e.setMuted(n), Pm(t, e.channels.value.find((t) => t.id === e.activeChannelId.value));
|
|
9150
|
+
}, Q = async (e, t) => {
|
|
9103
9151
|
let n = { sessionDescriptionHandlerOptions: { hold: t } };
|
|
9104
9152
|
await e.invite(n);
|
|
9105
|
-
},
|
|
9153
|
+
}, Xm = async () => {
|
|
9106
9154
|
let t = a.value.get(e.activeChannelId.value);
|
|
9107
9155
|
if (t?.state !== SessionState.Established) return;
|
|
9108
9156
|
let n = !e.isHeld.value;
|
|
9109
9157
|
try {
|
|
9110
|
-
await
|
|
9158
|
+
await Q(t, n), e.setHeld(n), Pm(t, e.channels.value.find((t) => t.id === e.activeChannelId.value));
|
|
9111
9159
|
} catch {}
|
|
9112
|
-
},
|
|
9160
|
+
}, Zm = async (t) => {
|
|
9113
9161
|
let n = e.activeChannelId.value;
|
|
9114
9162
|
if (n === t) return;
|
|
9115
9163
|
let i = a.value.get(n), o = a.value.get(t), s = e.channels.value.find((e) => e.id === n), l = e.channels.value.find((e) => e.id === t);
|
|
9116
9164
|
if (i && i.state === SessionState.Established && !s?.isHeld) try {
|
|
9117
|
-
await
|
|
9165
|
+
await Q(i, !0), e.updateChannelState(n, { isHeld: !0 }), Pm(i, e.channels.value.find((e) => e.id === n));
|
|
9118
9166
|
} catch {}
|
|
9119
|
-
if (e.setActiveChannelId(t),
|
|
9167
|
+
if (e.setActiveChannelId(t), q(), o && o.state === SessionState.Established) {
|
|
9120
9168
|
if (l?.isHeld) try {
|
|
9121
|
-
await
|
|
9169
|
+
await Q(o, !1), e.updateChannelState(t, { isHeld: !1 });
|
|
9122
9170
|
} catch {}
|
|
9123
|
-
|
|
9124
|
-
} else
|
|
9125
|
-
},
|
|
9171
|
+
Pm(o, e.channels.value.find((e) => e.id === t)), $(o);
|
|
9172
|
+
} else ih();
|
|
9173
|
+
}, Qm = (t) => {
|
|
9126
9174
|
if (!/^[0-9*#]$/.test(t)) return;
|
|
9127
9175
|
let n = a.value.get(e.activeChannelId.value);
|
|
9128
9176
|
if (n?.state !== SessionState.Established) return;
|
|
@@ -9137,10 +9185,10 @@ const createSipService = (e, t = {}) => {
|
|
|
9137
9185
|
contentDisposition: "signal"
|
|
9138
9186
|
} } };
|
|
9139
9187
|
n.info(o);
|
|
9140
|
-
},
|
|
9188
|
+
}, $m = (t, n) => {
|
|
9141
9189
|
let i = e.channels.value.find((e) => e.id === t);
|
|
9142
|
-
!i || i.status !== "connected" || (
|
|
9143
|
-
},
|
|
9190
|
+
!i || i.status !== "connected" || ($(n), Pm(n, i), Y(n), o.play().catch(() => {}));
|
|
9191
|
+
}, eh = async (t) => {
|
|
9144
9192
|
console.log("[SipJs] 🔄 transferCall iniciado"), console.log("[SipJs] Target:", t);
|
|
9145
9193
|
let i = e.activeChannelId.value, o = a.value.get(i);
|
|
9146
9194
|
if (!o) throw console.error("[SipJs] ❌ No hay sesión activa en el canal", i), Error("No active session to transfer");
|
|
@@ -9160,7 +9208,7 @@ const createSipService = (e, t = {}) => {
|
|
|
9160
9208
|
},
|
|
9161
9209
|
onReject: (e) => {
|
|
9162
9210
|
let t = e.message.statusCode;
|
|
9163
|
-
console.error("[SipJs] ❌ Transfer REFER rechazado:", t), console.error("[SipJs] Response completo:", e.message),
|
|
9211
|
+
console.error("[SipJs] ❌ Transfer REFER rechazado:", t), console.error("[SipJs] Response completo:", e.message), $m(i, o);
|
|
9164
9212
|
}
|
|
9165
9213
|
},
|
|
9166
9214
|
onNotify: (e) => {
|
|
@@ -9183,7 +9231,7 @@ const createSipService = (e, t = {}) => {
|
|
|
9183
9231
|
487: "Transferencia cancelada",
|
|
9184
9232
|
503: "Servicio no disponible - el destino puede estar fuera de línea"
|
|
9185
9233
|
}[t] || `Error en transferencia (código ${t})`;
|
|
9186
|
-
console.warn("[SipJs] 💬", e),
|
|
9234
|
+
console.warn("[SipJs] 💬", e), $m(i, o);
|
|
9187
9235
|
} else t >= 100 && t < 200 && console.log("[SipJs] 📞 Transferencia en progreso:", t, n);
|
|
9188
9236
|
} else console.warn("[SipJs] ⚠️ No se pudo extraer el código de estado del NOTIFY body");
|
|
9189
9237
|
} else console.warn("[SipJs] ⚠️ NOTIFY sin body");
|
|
@@ -9192,28 +9240,28 @@ const createSipService = (e, t = {}) => {
|
|
|
9192
9240
|
} catch (e) {
|
|
9193
9241
|
throw console.error("[SipJs] ❌ Error en transferCall:", e), console.error("[SipJs] Error type:", e?.constructor?.name), console.error("[SipJs] Error message:", e instanceof Error ? e.message : String(e)), console.error("[SipJs] Error stack:", e instanceof Error ? e.stack : "N/A"), e;
|
|
9194
9242
|
}
|
|
9195
|
-
},
|
|
9243
|
+
}, th = async (t) => {
|
|
9196
9244
|
console.log("[SipJs] 🔄 startAttendedTransfer iniciado"), console.log("[SipJs] Target:", t);
|
|
9197
9245
|
let n = e.activeChannelId.value, i = a.value.get(n);
|
|
9198
9246
|
if (console.log("[SipJs] Canal original:", n), console.log("[SipJs] Sesión original:", i?.state), !i || i.state !== SessionState.Established) throw console.error("[SipJs] ❌ No hay llamada establecida para transferir"), Error("No established call to transfer");
|
|
9199
9247
|
let o = e.channels.value.find((e) => e.status === "idle");
|
|
9200
9248
|
if (console.log("[SipJs] Canal de consulta encontrado:", o?.id), !o) throw console.error("[SipJs] ❌ No hay canales disponibles para llamada de consulta"), Error("No available channel for consultation call");
|
|
9201
9249
|
try {
|
|
9202
|
-
console.log("[SipJs] 🔇 Poniendo llamada original en hold..."), await
|
|
9250
|
+
console.log("[SipJs] 🔇 Poniendo llamada original en hold..."), await Q(i, !0), e.updateChannelState(n, { isHeld: !0 }), console.log("[SipJs] ✅ Llamada original en hold");
|
|
9203
9251
|
} catch (e) {
|
|
9204
9252
|
throw console.error("[SipJs] ❌ Failed to hold original call:", e), Error("Failed to put call on hold");
|
|
9205
9253
|
}
|
|
9206
9254
|
console.log("[SipJs] 🔄 Cambiando al canal de consulta:", o.id), e.setActiveChannelId(o.id);
|
|
9207
9255
|
try {
|
|
9208
|
-
console.log("[SipJs] 📞 Iniciando llamada de consulta a:", t), await
|
|
9256
|
+
console.log("[SipJs] 📞 Iniciando llamada de consulta a:", t), await Km(t, !1), console.log("[SipJs] ✅ Llamada de consulta iniciada"), e.setTransferInProgress({
|
|
9209
9257
|
originalChannelId: n,
|
|
9210
9258
|
consultationChannelId: o.id,
|
|
9211
9259
|
targetNumber: t
|
|
9212
9260
|
}), console.log("[SipJs] 📋 Transferencia en progreso registrada");
|
|
9213
9261
|
} catch (t) {
|
|
9214
|
-
throw console.error("[SipJs] ❌ Failed to start consultation call:", t), console.log("[SipJs] 🔄 Volviendo al canal original y quitando hold..."), e.setActiveChannelId(n), await
|
|
9262
|
+
throw console.error("[SipJs] ❌ Failed to start consultation call:", t), console.log("[SipJs] 🔄 Volviendo al canal original y quitando hold..."), e.setActiveChannelId(n), await Q(i, !1).catch(() => {}), e.updateChannelState(n, { isHeld: !1 }), Error("Failed to initiate consultation call");
|
|
9215
9263
|
}
|
|
9216
|
-
},
|
|
9264
|
+
}, nh = async () => {
|
|
9217
9265
|
console.log("[SipJs] 🔄 completeAttendedTransfer iniciado");
|
|
9218
9266
|
let t = e.transferInProgress.value;
|
|
9219
9267
|
if (!t) throw console.error("[SipJs] ❌ No hay transferencia en progreso"), Error("No transfer in progress");
|
|
@@ -9241,7 +9289,7 @@ const createSipService = (e, t = {}) => {
|
|
|
9241
9289
|
if (n && n[1]) {
|
|
9242
9290
|
let a = parseInt(n[1]);
|
|
9243
9291
|
a >= 200 && a < 300 ? setTimeout(() => {
|
|
9244
|
-
|
|
9292
|
+
Jm(t.originalChannelId, i), Jm(t.consultationChannelId, o), e.setTransferInProgress(null);
|
|
9245
9293
|
}, 500) : a >= 400 && (console.error("[SipJs] Attended transfer failed with status:", a), e.setTransferInProgress(null));
|
|
9246
9294
|
}
|
|
9247
9295
|
}
|
|
@@ -9256,23 +9304,23 @@ const createSipService = (e, t = {}) => {
|
|
|
9256
9304
|
} catch (e) {
|
|
9257
9305
|
throw console.error("[SipJs] Attended transfer failed:", e), e;
|
|
9258
9306
|
}
|
|
9259
|
-
},
|
|
9307
|
+
}, rh = async () => {
|
|
9260
9308
|
let t = e.transferInProgress.value;
|
|
9261
9309
|
if (!t) throw Error("No transfer in progress");
|
|
9262
9310
|
console.log("[SipJs] Canceling attended transfer...");
|
|
9263
9311
|
let n = a.value.get(t.originalChannelId), i = a.value.get(t.consultationChannelId);
|
|
9264
9312
|
if (i) try {
|
|
9265
|
-
await
|
|
9313
|
+
await Jm(t.consultationChannelId, i), console.log("[SipJs] Consultation call ended");
|
|
9266
9314
|
} catch (e) {
|
|
9267
9315
|
console.warn("[SipJs] Error ending consultation:", e);
|
|
9268
9316
|
}
|
|
9269
9317
|
if (n) try {
|
|
9270
|
-
e.setActiveChannelId(t.originalChannelId), await
|
|
9318
|
+
e.setActiveChannelId(t.originalChannelId), await Q(n, !1), e.updateChannelState(t.originalChannelId, { isHeld: !1 }), console.log("[SipJs] Returned to original call");
|
|
9271
9319
|
} catch (e) {
|
|
9272
9320
|
console.warn("[SipJs] Error resuming original call:", e);
|
|
9273
9321
|
}
|
|
9274
9322
|
e.setTransferInProgress(null);
|
|
9275
|
-
},
|
|
9323
|
+
}, $ = (e) => {
|
|
9276
9324
|
let t = e.sessionDescriptionHandler;
|
|
9277
9325
|
if (!t) {
|
|
9278
9326
|
console.error("[SipJs] setupRemoteMedia: no sessionDescriptionHandler");
|
|
@@ -9285,8 +9333,8 @@ const createSipService = (e, t = {}) => {
|
|
|
9285
9333
|
}
|
|
9286
9334
|
if (u.value === n) return;
|
|
9287
9335
|
o.pause(), o.srcObject = null, v?.abort(), v = new AbortController(), u.value = n, d.value = t.localMediaStream ?? null;
|
|
9288
|
-
let i =
|
|
9289
|
-
|
|
9336
|
+
let i = Fm(e);
|
|
9337
|
+
Pm(e, i), i && V(e, i.id);
|
|
9290
9338
|
let a = (e) => {
|
|
9291
9339
|
y?.abort(), y = new AbortController();
|
|
9292
9340
|
let { signal: t } = y, n = () => {
|
|
@@ -9299,34 +9347,34 @@ const createSipService = (e, t = {}) => {
|
|
|
9299
9347
|
}, { signal: t }), n();
|
|
9300
9348
|
};
|
|
9301
9349
|
n.addEventListener("addtrack", (t) => {
|
|
9302
|
-
t.track.kind === "audio" && (o.srcObject = null, o.srcObject = n, a(t.track), i &&
|
|
9350
|
+
t.track.kind === "audio" && (o.srcObject = null, o.srcObject = n, a(t.track), i && V(e, i.id));
|
|
9303
9351
|
}, { signal: v.signal });
|
|
9304
9352
|
let [s] = n.getTracks();
|
|
9305
|
-
s && (o.srcObject = n, a(s), i &&
|
|
9306
|
-
},
|
|
9353
|
+
s && (o.srcObject = n, a(s), i && V(e, i.id));
|
|
9354
|
+
}, ih = () => {
|
|
9307
9355
|
y?.abort(), y = null, v?.abort(), v = null, o.pause(), o.srcObject = null, u.value = null, d.value = null;
|
|
9308
9356
|
};
|
|
9309
9357
|
return {
|
|
9310
|
-
initUserAgent:
|
|
9311
|
-
stop:
|
|
9312
|
-
makeCall:
|
|
9313
|
-
answerCall:
|
|
9314
|
-
hangupCall:
|
|
9315
|
-
toggleMute:
|
|
9316
|
-
toggleHold:
|
|
9317
|
-
sendDTMF:
|
|
9318
|
-
transferCall:
|
|
9319
|
-
startAttendedTransfer:
|
|
9320
|
-
completeAttendedTransfer:
|
|
9321
|
-
cancelAttendedTransfer:
|
|
9322
|
-
switchChannel:
|
|
9323
|
-
extension:
|
|
9324
|
-
setVolume:
|
|
9325
|
-
setNotificationVolume:
|
|
9326
|
-
setRingtoneVolume:
|
|
9327
|
-
setRingtoneTone:
|
|
9328
|
-
setOutputDevice:
|
|
9329
|
-
setInputDevice:
|
|
9358
|
+
initUserAgent: Rm,
|
|
9359
|
+
stop: Wm,
|
|
9360
|
+
makeCall: Km,
|
|
9361
|
+
answerCall: qm,
|
|
9362
|
+
hangupCall: Ym,
|
|
9363
|
+
toggleMute: Z,
|
|
9364
|
+
toggleHold: Xm,
|
|
9365
|
+
sendDTMF: Qm,
|
|
9366
|
+
transferCall: eh,
|
|
9367
|
+
startAttendedTransfer: th,
|
|
9368
|
+
completeAttendedTransfer: nh,
|
|
9369
|
+
cancelAttendedTransfer: rh,
|
|
9370
|
+
switchChannel: Zm,
|
|
9371
|
+
extension: j,
|
|
9372
|
+
setVolume: Am,
|
|
9373
|
+
setNotificationVolume: L,
|
|
9374
|
+
setRingtoneVolume: Tm,
|
|
9375
|
+
setRingtoneTone: R,
|
|
9376
|
+
setOutputDevice: J,
|
|
9377
|
+
setInputDevice: jm,
|
|
9330
9378
|
remoteStream: u,
|
|
9331
9379
|
localStream: d
|
|
9332
9380
|
};
|
|
@@ -16404,7 +16452,7 @@ var IconDelete_default = { render: render$1 }, _hoisted_1$7 = ["data-call-status
|
|
|
16404
16452
|
let n = t.status === "connected" || t.status === "calling" || t.status === "incoming";
|
|
16405
16453
|
e[t.id] = n ? "wp:text-[var(--color-red)]" : "wp:text-[var(--color-avaible)]";
|
|
16406
16454
|
}), e;
|
|
16407
|
-
}),
|
|
16455
|
+
}), Em = computed(() => z.value[i.activeChannelId] ?? "wp:text-[var(--p-primary-color)]");
|
|
16408
16456
|
return (e, t) => (openBlock(), createElementBlock("div", {
|
|
16409
16457
|
class: "webphone-actions wp:flex wp:justify-center wp:items-center wp:gap-2 wp:px-4 wp:relative wp:mb-4",
|
|
16410
16458
|
"data-call-status": unref(i).callStatus
|
|
@@ -16427,7 +16475,7 @@ var IconDelete_default = { render: render$1 }, _hoisted_1$7 = ["data-call-status
|
|
|
16427
16475
|
"aria-label": "Video Call",
|
|
16428
16476
|
class: "webphone-actions__button webphone-actions__button--video wp:w-full wp:px-4 wp:bg-transparent wp:border wp:border-primary wp:hover:bg-[var(--p-primary-color)]/8"
|
|
16429
16477
|
}, {
|
|
16430
|
-
default: withCtx(() => [createVNode(unref(videocall_icon_default), { class: normalizeClass(["webphone-actions__button-icon wp:size-6 wp:text-primary wp:dark:text-white",
|
|
16478
|
+
default: withCtx(() => [createVNode(unref(videocall_icon_default), { class: normalizeClass(["webphone-actions__button-icon wp:size-6 wp:text-primary wp:dark:text-white", Em.value]) }, null, 8, ["class"]), t[13] ||= createElementVNode("span", { class: "webphone-actions__button-label wp:w-full wp:text-primary wp:text-xs wp:dark:text-white" }, " Video llamada a extensiones ", -1)]),
|
|
16431
16479
|
_: 1
|
|
16432
16480
|
})) : createCommentVNode("", !0)])) : createCommentVNode("", !0),
|
|
16433
16481
|
unref(i).callStatus === "incoming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
@@ -17494,14 +17542,14 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
17494
17542
|
set: (e) => {
|
|
17495
17543
|
j.value = e[0], y(j.value);
|
|
17496
17544
|
}
|
|
17497
|
-
}),
|
|
17545
|
+
}), G = computed({
|
|
17498
17546
|
get: () => [N.value],
|
|
17499
17547
|
set: (e) => {
|
|
17500
17548
|
N.value = e[0] ?? 100, b(N.value);
|
|
17501
17549
|
}
|
|
17502
|
-
}),
|
|
17550
|
+
}), K = (e) => {
|
|
17503
17551
|
F.value = String(e), x(F.value);
|
|
17504
|
-
},
|
|
17552
|
+
}, Om = (e) => {
|
|
17505
17553
|
I.value = e;
|
|
17506
17554
|
};
|
|
17507
17555
|
return onMounted(() => {
|
|
@@ -17601,8 +17649,8 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
17601
17649
|
default: withCtx(() => [...o[12] ||= [createTextVNode("Volumen del tono", -1)]]),
|
|
17602
17650
|
_: 1
|
|
17603
17651
|
}), createElementVNode("span", _hoisted_12$2, toDisplayString(unref(N)) + "%", 1)]), createVNode(unref(Slider_default), {
|
|
17604
|
-
modelValue:
|
|
17605
|
-
"onUpdate:modelValue": o[4] ||= (e) =>
|
|
17652
|
+
modelValue: G.value,
|
|
17653
|
+
"onUpdate:modelValue": o[4] ||= (e) => G.value = e,
|
|
17606
17654
|
max: 100,
|
|
17607
17655
|
step: 1
|
|
17608
17656
|
}, null, 8, ["modelValue"])]),
|
|
@@ -17611,7 +17659,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
17611
17659
|
_: 1
|
|
17612
17660
|
}), createVNode(unref(Select_default), {
|
|
17613
17661
|
"model-value": unref(F),
|
|
17614
|
-
"onUpdate:modelValue":
|
|
17662
|
+
"onUpdate:modelValue": K
|
|
17615
17663
|
}, {
|
|
17616
17664
|
default: withCtx(() => [createVNode(unref(SelectTrigger_default), { class: "wp:w-full" }, {
|
|
17617
17665
|
default: withCtx(() => [createVNode(unref(SelectValue_default), { placeholder: "Seleccionar tono" })]),
|
|
@@ -17650,7 +17698,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
17650
17698
|
"aria-label": unref(I) ? "Desactivar respuesta automática" : "Activar respuesta automática",
|
|
17651
17699
|
class: normalizeClass(["wp:flex wp:h-7 wp:w-12 wp:shrink-0 wp:cursor-pointer wp:items-center wp:justify-start wp:rounded-full wp:border-0 wp:p-0.5 wp:transition-colors wp:focus-visible:ring-2 wp:focus-visible:ring-primary/50"]),
|
|
17652
17700
|
style: normalizeStyle({ backgroundColor: unref(I) ? "var(--color-primary-500)" : "var(--muted)" }),
|
|
17653
|
-
"onUpdate:modelValue":
|
|
17701
|
+
"onUpdate:modelValue": Om
|
|
17654
17702
|
}, {
|
|
17655
17703
|
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(["wp:pointer-events-none wp:block wp:h-6 wp:w-6 wp:shrink-0 wp:rounded-full wp:bg-white wp:shadow-sm wp:transition-transform", unref(I) ? "wp:translate-x-5" : "wp:translate-x-0"]) }, null, 2)]),
|
|
17656
17704
|
_: 1
|
|
@@ -18071,7 +18119,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18071
18119
|
return i.autoOpenOnBlur !== !1 && e && o.value && t && !l.value && !u.value;
|
|
18072
18120
|
}, v = () => {
|
|
18073
18121
|
_() && (g && clearTimeout(g), g = setTimeout(() => {
|
|
18074
|
-
_() &&
|
|
18122
|
+
_() && Tm();
|
|
18075
18123
|
}, 120));
|
|
18076
18124
|
}, y = () => {
|
|
18077
18125
|
v();
|
|
@@ -18196,7 +18244,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18196
18244
|
}, 1e3));
|
|
18197
18245
|
}, L = () => {
|
|
18198
18246
|
m &&= (clearInterval(m), null);
|
|
18199
|
-
},
|
|
18247
|
+
}, Tm = async () => {
|
|
18200
18248
|
if (!(!o.value || l.value || u.value)) {
|
|
18201
18249
|
u.value = !0;
|
|
18202
18250
|
try {
|
|
@@ -18220,10 +18268,10 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18220
18268
|
L(), d.value && (d.value.close(), d.value = null, l.value = !1, a("update:active", !1));
|
|
18221
18269
|
};
|
|
18222
18270
|
return t({
|
|
18223
|
-
open:
|
|
18271
|
+
open: Tm,
|
|
18224
18272
|
close: R,
|
|
18225
18273
|
toggle: () => {
|
|
18226
|
-
l.value ? R() :
|
|
18274
|
+
l.value ? R() : Tm();
|
|
18227
18275
|
},
|
|
18228
18276
|
isActive: l,
|
|
18229
18277
|
isSupported: o,
|
|
@@ -18327,67 +18375,67 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18327
18375
|
}
|
|
18328
18376
|
e !== "idle" && x.isKeypadVisible && x.toggleKeypad();
|
|
18329
18377
|
});
|
|
18330
|
-
let
|
|
18378
|
+
let G = computed(() => x.channels.find((e) => e.id === x.activeChannelId) ?? null), K = (e) => {
|
|
18331
18379
|
if (!e) return "";
|
|
18332
18380
|
let t = e.trim(), n = t.startsWith("+"), i = t.replace(/[^\d]/g, "");
|
|
18333
18381
|
return n ? `+${i}` : i;
|
|
18334
|
-
},
|
|
18335
|
-
let e =
|
|
18382
|
+
}, Om = computed(() => {
|
|
18383
|
+
let e = G.value?.remoteNumber || x.remoteNumber, t = K(e), n = o.contacts.find((e) => K(e.number) === t);
|
|
18336
18384
|
return n?.name ? o.maskNumber && /^[+\d\s().*#-]+$/.test(n.name.trim()) ? maskPhoneNumber(n.name, o.extensions) : n.name : o.maskNumber && e ? maskPhoneNumber(e, o.extensions) : e || "Llamada";
|
|
18337
|
-
}),
|
|
18338
|
-
let e =
|
|
18385
|
+
}), q = computed(() => {
|
|
18386
|
+
let e = G.value?.remoteNumber || x.remoteNumber;
|
|
18339
18387
|
return o.maskNumber ? maskPhoneNumber(e, o.extensions) : e;
|
|
18340
|
-
}),
|
|
18341
|
-
|
|
18342
|
-
},
|
|
18388
|
+
}), km = computed(() => (H.value, !!G.value?.hasVideo || U(E.value) || U(D.value))), { isOnline: Am } = useNetwork(), J = computed(() => !Am.value), Mm = ref(null), Y = ref(!1), Rm = computed(() => o.enablePictureInPicture), zm = () => {
|
|
18389
|
+
Rm.value && Mm.value?.toggle();
|
|
18390
|
+
}, Bm = async (e, t) => {
|
|
18343
18391
|
try {
|
|
18344
18392
|
t === "blind" ? await S.transferCall(e) : await S.startAttendedTransfer(e);
|
|
18345
18393
|
} catch (e) {
|
|
18346
18394
|
console.error("[WebPhone] Transfer error:", e), alert(e instanceof Error ? e.message : "Transfer failed. Please try again.");
|
|
18347
18395
|
}
|
|
18348
|
-
},
|
|
18396
|
+
}, Vm = async () => {
|
|
18349
18397
|
try {
|
|
18350
18398
|
await S.completeAttendedTransfer();
|
|
18351
18399
|
} catch (e) {
|
|
18352
18400
|
console.error("[WebPhone] Complete transfer error:", e), alert(e instanceof Error ? e.message : "Failed to complete transfer.");
|
|
18353
18401
|
}
|
|
18354
|
-
},
|
|
18402
|
+
}, Hm = async () => {
|
|
18355
18403
|
try {
|
|
18356
18404
|
await S.cancelAttendedTransfer();
|
|
18357
18405
|
} catch (e) {
|
|
18358
18406
|
console.error("[WebPhone] Cancel transfer error:", e), alert(e instanceof Error ? e.message : "Failed to cancel transfer.");
|
|
18359
18407
|
}
|
|
18360
|
-
},
|
|
18408
|
+
}, Um = (e) => {
|
|
18361
18409
|
x.keypadValue = e, S.makeCall(e);
|
|
18362
|
-
},
|
|
18410
|
+
}, Wm = (e) => {
|
|
18363
18411
|
if (o.onAnswer) {
|
|
18364
18412
|
o.onAnswer(e);
|
|
18365
18413
|
return;
|
|
18366
18414
|
}
|
|
18367
18415
|
S.answerCall(e);
|
|
18368
|
-
},
|
|
18416
|
+
}, Gm = async () => {
|
|
18369
18417
|
await S.hangupCall(), await o.onHangup?.();
|
|
18370
|
-
},
|
|
18418
|
+
}, Km = () => {
|
|
18371
18419
|
if (o.onReject) {
|
|
18372
18420
|
o.onReject();
|
|
18373
18421
|
return;
|
|
18374
18422
|
}
|
|
18375
18423
|
S.hangupCall();
|
|
18376
|
-
},
|
|
18377
|
-
j.value = !0,
|
|
18378
|
-
},
|
|
18379
|
-
if (!
|
|
18424
|
+
}, qm = () => {
|
|
18425
|
+
j.value = !0, Mm.value?.close(), window.focus();
|
|
18426
|
+
}, Jm = () => {
|
|
18427
|
+
if (!Rm.value) return !1;
|
|
18380
18428
|
let e = x.callStatus !== "idle", t = document.hidden || !document.hasFocus();
|
|
18381
18429
|
return e && t && !Y.value;
|
|
18382
18430
|
}, Z = () => {
|
|
18383
18431
|
window.setTimeout(() => {
|
|
18384
|
-
|
|
18432
|
+
Jm() && Mm.value?.open();
|
|
18385
18433
|
}, 150);
|
|
18386
18434
|
};
|
|
18387
18435
|
watchEffect(() => {
|
|
18388
18436
|
F.value && (Y.value || !E.value ? F.value.srcObject = null : F.value.srcObject = E.value), L.value && (Y.value || !D.value ? L.value.srcObject = null : L.value.srcObject = D.value);
|
|
18389
18437
|
});
|
|
18390
|
-
let
|
|
18438
|
+
let Q = (e) => {
|
|
18391
18439
|
if (!e || typeof e.addEventListener != "function" || typeof e.removeEventListener != "function") return () => {};
|
|
18392
18440
|
let t = () => {
|
|
18393
18441
|
H.value += 1;
|
|
@@ -18397,11 +18445,11 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18397
18445
|
};
|
|
18398
18446
|
};
|
|
18399
18447
|
watch(E, (e, t, n) => {
|
|
18400
|
-
H.value += 1, n(
|
|
18448
|
+
H.value += 1, n(Q(e));
|
|
18401
18449
|
}, { immediate: !0 }), watch(D, (e, t, n) => {
|
|
18402
|
-
H.value += 1, n(
|
|
18450
|
+
H.value += 1, n(Q(e));
|
|
18403
18451
|
}, { immediate: !0 });
|
|
18404
|
-
let
|
|
18452
|
+
let Xm = [
|
|
18405
18453
|
"button",
|
|
18406
18454
|
"a",
|
|
18407
18455
|
"input",
|
|
@@ -18412,15 +18460,15 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18412
18460
|
"[role=\"button\"]",
|
|
18413
18461
|
"[role=\"radio\"]",
|
|
18414
18462
|
"[data-no-drag]"
|
|
18415
|
-
].join(", "),
|
|
18463
|
+
].join(", "), Qm = () => {
|
|
18416
18464
|
let e = window.innerWidth < 640, t = window.innerWidth < 1024, n = 360;
|
|
18417
18465
|
return e ? n = window.innerWidth * .9 : t && (n = 340), {
|
|
18418
18466
|
x: Math.max(0, (window.innerWidth - n) / 2),
|
|
18419
18467
|
y: e ? 30 : 80
|
|
18420
18468
|
};
|
|
18421
|
-
}, { x:
|
|
18469
|
+
}, { x: $m, y: eh, style: th } = useDraggable(N, {
|
|
18422
18470
|
initialValue: computed(() => {
|
|
18423
|
-
let e =
|
|
18471
|
+
let e = Qm();
|
|
18424
18472
|
return {
|
|
18425
18473
|
x: o.position.x ?? e.x,
|
|
18426
18474
|
y: o.position.y ?? e.y
|
|
@@ -18429,14 +18477,14 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18429
18477
|
preventDefault: !0,
|
|
18430
18478
|
onStart: (e, t) => {
|
|
18431
18479
|
let n = t.target;
|
|
18432
|
-
if (n instanceof HTMLElement && n.closest(
|
|
18480
|
+
if (n instanceof HTMLElement && n.closest(Xm)) return !1;
|
|
18433
18481
|
}
|
|
18434
18482
|
});
|
|
18435
18483
|
watch(() => o.position, (e) => {
|
|
18436
|
-
let t =
|
|
18437
|
-
|
|
18484
|
+
let t = Qm();
|
|
18485
|
+
$m.value = e.x ?? t.x, eh.value = e.y ?? t.y;
|
|
18438
18486
|
}, { deep: !0 });
|
|
18439
|
-
let
|
|
18487
|
+
let nh = [
|
|
18440
18488
|
{
|
|
18441
18489
|
label: "Canal 1",
|
|
18442
18490
|
value: 0
|
|
@@ -18449,27 +18497,27 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18449
18497
|
label: "Canal 3",
|
|
18450
18498
|
value: 2
|
|
18451
18499
|
}
|
|
18452
|
-
],
|
|
18500
|
+
], rh = ref(!1), $ = computed({
|
|
18453
18501
|
get: () => x.activeChannelId.toString(),
|
|
18454
18502
|
set: async (e) => {
|
|
18455
|
-
if (!J.value && e && !
|
|
18456
|
-
|
|
18503
|
+
if (!J.value && e && !rh.value) {
|
|
18504
|
+
rh.value = !0;
|
|
18457
18505
|
try {
|
|
18458
18506
|
await T(parseInt(e));
|
|
18459
18507
|
} finally {
|
|
18460
|
-
|
|
18508
|
+
rh.value = !1;
|
|
18461
18509
|
}
|
|
18462
18510
|
}
|
|
18463
18511
|
}
|
|
18464
|
-
}),
|
|
18512
|
+
}), ih = (e) => {
|
|
18465
18513
|
let t = x.channels.find((t) => t.id === e);
|
|
18466
18514
|
return t ? t.status === "connected" || t.status === "calling" || t.status === "incoming" : !1;
|
|
18467
|
-
},
|
|
18515
|
+
}, ah = (e) => {
|
|
18468
18516
|
let t = x.channels.find((t) => t.id === e);
|
|
18469
18517
|
return t ? t.isHeld || t.status === "held" : !1;
|
|
18470
|
-
},
|
|
18518
|
+
}, oh = (e) => {
|
|
18471
18519
|
J.value || ($.value = e.toString());
|
|
18472
|
-
},
|
|
18520
|
+
}, sh = (e) => {
|
|
18473
18521
|
if (!J.value && ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "h" && (e.preventDefault(), k.value = !0), (e.metaKey || e.ctrlKey) && e.key === "," && (e.preventDefault(), O.value = !0), (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k" && (e.preventDefault(), x.toggleKeypad()), (e.metaKey || e.ctrlKey) && [
|
|
18474
18522
|
"1",
|
|
18475
18523
|
"2",
|
|
@@ -18477,51 +18525,51 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18477
18525
|
].includes(e.key))) {
|
|
18478
18526
|
e.preventDefault();
|
|
18479
18527
|
let t = parseInt(e.key) - 1;
|
|
18480
|
-
|
|
18481
|
-
|
|
18528
|
+
rh.value || (rh.value = !0, T(t).finally(() => {
|
|
18529
|
+
rh.value = !1;
|
|
18482
18530
|
}));
|
|
18483
18531
|
}
|
|
18484
18532
|
};
|
|
18485
18533
|
watch(() => x.callStatus, () => {
|
|
18486
|
-
|
|
18534
|
+
Jm() && Z();
|
|
18487
18535
|
}), watch(() => x.isConnected, (e) => {
|
|
18488
18536
|
v.value && a.set(v.value, e);
|
|
18489
|
-
}, { immediate: !0 }), watch(
|
|
18490
|
-
!e && Y.value &&
|
|
18537
|
+
}, { immediate: !0 }), watch(Rm, (e) => {
|
|
18538
|
+
!e && Y.value && Mm.value?.close();
|
|
18491
18539
|
});
|
|
18492
|
-
let
|
|
18493
|
-
|
|
18540
|
+
let ch = ref(!1), lh = async () => {
|
|
18541
|
+
ch.value || J.value || !o.host || !o.extension || !o.password || (await w({
|
|
18494
18542
|
uri: `sip:${o.extension}@${o.host}`,
|
|
18495
18543
|
transportOptions: { server: _.value },
|
|
18496
18544
|
authorizationUsername: o.extension,
|
|
18497
18545
|
authorizationPassword: o.password,
|
|
18498
18546
|
earlyMedia: o.earlyMedia,
|
|
18499
18547
|
appName: o.appName
|
|
18500
|
-
}), S.extension.value && (
|
|
18548
|
+
}), S.extension.value && (ch.value = !0, o.mode === "webcall" && o.to && S.makeCall(o.to)));
|
|
18501
18549
|
};
|
|
18502
18550
|
return provide("webphoneRegistration", {
|
|
18503
18551
|
isConnected: computed(() => x.isConnected),
|
|
18504
|
-
register: () =>
|
|
18552
|
+
register: () => lh(),
|
|
18505
18553
|
unregister: async () => {
|
|
18506
|
-
await S.stop(),
|
|
18554
|
+
await S.stop(), ch.value = !1;
|
|
18507
18555
|
}
|
|
18508
18556
|
}), onMounted(async () => {
|
|
18509
|
-
window.addEventListener("keydown",
|
|
18510
|
-
}), watch(() =>
|
|
18511
|
-
e && await
|
|
18557
|
+
window.addEventListener("keydown", sh), document.addEventListener("visibilitychange", Z), window.addEventListener("blur", Z), window.addEventListener("pagehide", Z), !(o.mode === "webcall" && (!o.to || !o.logo)) && await lh();
|
|
18558
|
+
}), watch(() => Am.value, async (e) => {
|
|
18559
|
+
e && await lh();
|
|
18512
18560
|
}), onUnmounted(() => {
|
|
18513
|
-
S.stop(), window.removeEventListener("keydown",
|
|
18561
|
+
S.stop(), window.removeEventListener("keydown", sh), document.removeEventListener("visibilitychange", Z), window.removeEventListener("blur", Z), window.removeEventListener("pagehide", Z);
|
|
18514
18562
|
}), (e, t) => (openBlock(), createElementBlock(Fragment, null, [
|
|
18515
18563
|
createElementVNode("div", {
|
|
18516
18564
|
ref_key: "phoneRef",
|
|
18517
18565
|
ref: N,
|
|
18518
|
-
style: normalizeStyle(unref(
|
|
18566
|
+
style: normalizeStyle(unref(th)),
|
|
18519
18567
|
class: normalizeClass(["webphone webphone-container wp:bg-white wp:dark:bg-neutral-800 wp:rounded-lg wp:shadow-sm wp:inset-shadow-2xs wp:w-[min(92vw,330px)] wp:fixed wp:z-50 wp:select-none wp:[&_button]:cursor-pointer wp:**:[[role=button]]:cursor-pointer", J.value ? "wp:opacity-70" : ""]),
|
|
18520
18568
|
"data-mode": o.mode,
|
|
18521
18569
|
"data-call-status": x.callStatus,
|
|
18522
18570
|
"data-network-status": J.value ? "offline" : "online"
|
|
18523
18571
|
}, [
|
|
18524
|
-
|
|
18572
|
+
km.value && !Y.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("video", {
|
|
18525
18573
|
ref_key: "remoteVideoRef",
|
|
18526
18574
|
ref: F,
|
|
18527
18575
|
autoplay: "",
|
|
@@ -18537,22 +18585,22 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18537
18585
|
}, null, 512)])])) : createCommentVNode("", !0),
|
|
18538
18586
|
createElementVNode("div", _hoisted_4, [
|
|
18539
18587
|
V.value ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_5, [createElementVNode("div", _hoisted_6, [
|
|
18540
|
-
createElementVNode("div", _hoisted_7, [(openBlock(), createElementBlock(Fragment, null, renderList(
|
|
18588
|
+
createElementVNode("div", _hoisted_7, [(openBlock(), createElementBlock(Fragment, null, renderList(nh, (e) => createElementVNode("button", {
|
|
18541
18589
|
key: e.value,
|
|
18542
18590
|
type: "button",
|
|
18543
18591
|
role: "radio",
|
|
18544
18592
|
"aria-checked": $.value === e.value.toString(),
|
|
18545
18593
|
disabled: J.value,
|
|
18546
18594
|
title: `${e.label} (${unref(B)}${e.value + 1})`,
|
|
18547
|
-
class: normalizeClass(["webphone__channel-button wp:flex wp:items-center wp:gap-1 wp:px-2 wp:py-2 wp:rounded-lg wp:transition-colors wp:duration-200 wp:outline-none wp:focus-visible:ring-2 wp:focus-visible:ring-[var(--p-primary-color)] wp:focus-visible:ring-offset-2 wp:focus-visible:ring-offset-white wp:dark:focus-visible:ring-offset-neutral-900",
|
|
18595
|
+
class: normalizeClass(["webphone__channel-button wp:flex wp:items-center wp:gap-1 wp:px-2 wp:py-2 wp:rounded-lg wp:transition-colors wp:duration-200 wp:outline-none wp:focus-visible:ring-2 wp:focus-visible:ring-[var(--p-primary-color)] wp:focus-visible:ring-offset-2 wp:focus-visible:ring-offset-white wp:dark:focus-visible:ring-offset-neutral-900", ah(e.value) ? "wp:bg-status-hold/12 hover:wp:bg-status-hold/18" : ih(e.value) ? "wp:bg-[var(--color-red)]/12 hover:wp:bg-[var(--color-red)]/18" : $.value === e.value.toString() ? "wp:bg-[var(--p-primary-color)]/12" : "wp:hover:bg-neutral-100 wp:dark:hover:bg-neutral-800/80"]),
|
|
18548
18596
|
"data-channel-id": e.value,
|
|
18549
18597
|
"data-state": $.value === e.value.toString() ? "active" : "idle",
|
|
18550
|
-
"data-call-state":
|
|
18551
|
-
onClick: (t) =>
|
|
18598
|
+
"data-call-state": ah(e.value) ? "held" : ih(e.value) ? "busy" : "available",
|
|
18599
|
+
onClick: (t) => oh(e.value)
|
|
18552
18600
|
}, [createVNode(unref(icon_phone_default), {
|
|
18553
|
-
class: normalizeClass(["webphone__channel-icon wp:size-3 wp:shrink-0",
|
|
18601
|
+
class: normalizeClass(["webphone__channel-icon wp:size-3 wp:shrink-0", ah(e.value) ? "wp:text-status-hold" : ih(e.value) ? "wp:text-[var(--color-red)]" : $.value === e.value.toString() ? "wp:text-[var(--p-primary-color)]" : "wp:text-neutral-400"]),
|
|
18554
18602
|
"stroke-width": 1.8
|
|
18555
|
-
}, null, 8, ["class"]), createElementVNode("span", { class: normalizeClass(["webphone__channel-label wp:text-[11px] wp:leading-none manrope wp:font-bold",
|
|
18603
|
+
}, null, 8, ["class"]), createElementVNode("span", { class: normalizeClass(["webphone__channel-label wp:text-[11px] wp:leading-none manrope wp:font-bold", ah(e.value) ? "wp:text-status-hold" : ih(e.value) ? "wp:text-[var(--color-red)]" : $.value === e.value.toString() ? "wp:text-[var(--p-primary-color)]" : "wp:text-neutral-500 wp:dark:text-neutral-400"]) }, toDisplayString(e.label), 3)], 10, _hoisted_8)), 64))]),
|
|
18556
18604
|
createVNode(unref(TooltipProvider_default), null, {
|
|
18557
18605
|
default: withCtx(() => [createVNode(unref(Tooltip_default), null, {
|
|
18558
18606
|
default: withCtx(() => [createVNode(unref(TooltipTrigger_default), { "as-child": "" }, {
|
|
@@ -18561,7 +18609,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18561
18609
|
size: "icon",
|
|
18562
18610
|
class: normalizeClass(["wp:h-8 wp:w-8 wp:rounded-full", Y.value ? "wp:text-primary" : ""]),
|
|
18563
18611
|
title: "Picture-in-Picture",
|
|
18564
|
-
onClick:
|
|
18612
|
+
onClick: zm
|
|
18565
18613
|
}, {
|
|
18566
18614
|
default: withCtx(() => [createVNode(unref(PictureInPicture2), { class: "wp:w-4 wp:h-4 wp:text-[var(--color-settings)]" })]),
|
|
18567
18615
|
_: 1
|
|
@@ -18605,7 +18653,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18605
18653
|
"channel-id": e.id,
|
|
18606
18654
|
"allow-input": !V.value,
|
|
18607
18655
|
"is-web-call": V.value,
|
|
18608
|
-
"is-online": unref(
|
|
18656
|
+
"is-online": unref(Am),
|
|
18609
18657
|
contacts: o.contacts,
|
|
18610
18658
|
user: o.extension,
|
|
18611
18659
|
"mask-number": o.maskNumber,
|
|
@@ -18633,8 +18681,8 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18633
18681
|
"on-hangup": o.onHangup,
|
|
18634
18682
|
"on-reject": o.onReject,
|
|
18635
18683
|
onTransfer: t[1] ||= (e) => j.value = !0,
|
|
18636
|
-
onCompleteTransfer:
|
|
18637
|
-
onCancelTransfer:
|
|
18684
|
+
onCompleteTransfer: Vm,
|
|
18685
|
+
onCancelTransfer: Hm
|
|
18638
18686
|
}, null, 8, [
|
|
18639
18687
|
"style",
|
|
18640
18688
|
"destination",
|
|
@@ -18661,7 +18709,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18661
18709
|
contacts: o.contacts,
|
|
18662
18710
|
"mask-number": o.maskNumber,
|
|
18663
18711
|
extensions: o.extensions,
|
|
18664
|
-
onCall:
|
|
18712
|
+
onCall: Um
|
|
18665
18713
|
}, null, 8, [
|
|
18666
18714
|
"visible",
|
|
18667
18715
|
"contacts",
|
|
@@ -18674,7 +18722,7 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18674
18722
|
contacts: o.contacts,
|
|
18675
18723
|
"mask-number": o.maskNumber,
|
|
18676
18724
|
extensions: o.extensions,
|
|
18677
|
-
onTransfer:
|
|
18725
|
+
onTransfer: Bm
|
|
18678
18726
|
}, null, 8, [
|
|
18679
18727
|
"visible",
|
|
18680
18728
|
"contacts",
|
|
@@ -18683,14 +18731,14 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18683
18731
|
]),
|
|
18684
18732
|
createVNode(DocumentPip_default, {
|
|
18685
18733
|
ref_key: "documentPipRef",
|
|
18686
|
-
ref:
|
|
18734
|
+
ref: Mm,
|
|
18687
18735
|
active: Y.value,
|
|
18688
18736
|
"onUpdate:active": t[5] ||= (e) => Y.value = e,
|
|
18689
|
-
"auto-open-on-blur":
|
|
18737
|
+
"auto-open-on-blur": Rm.value,
|
|
18690
18738
|
"is-connected": x.isConnected,
|
|
18691
|
-
"remote-number":
|
|
18692
|
-
"caller-name":
|
|
18693
|
-
"has-video":
|
|
18739
|
+
"remote-number": q.value,
|
|
18740
|
+
"caller-name": Om.value,
|
|
18741
|
+
"has-video": km.value ?? !1,
|
|
18694
18742
|
"remote-stream": unref(E),
|
|
18695
18743
|
"local-stream": unref(D),
|
|
18696
18744
|
destination: V.value ? o.to : void 0,
|
|
@@ -18698,11 +18746,11 @@ var _hoisted_1$3 = { class: "wp:flex wp:flex-col wp:gap-6 wp:py-4" }, _hoisted_2
|
|
|
18698
18746
|
"call-status": x.callStatus,
|
|
18699
18747
|
"is-muted": x.isMuted,
|
|
18700
18748
|
"is-held": x.isHeld,
|
|
18701
|
-
onTransfer:
|
|
18702
|
-
onTransferRequest:
|
|
18703
|
-
onHangup:
|
|
18704
|
-
onReject:
|
|
18705
|
-
onAnswer:
|
|
18749
|
+
onTransfer: qm,
|
|
18750
|
+
onTransferRequest: Bm,
|
|
18751
|
+
onHangup: Gm,
|
|
18752
|
+
onReject: Km,
|
|
18753
|
+
onAnswer: Wm,
|
|
18706
18754
|
onToggleMute: t[6] ||= (e) => unref(S).toggleMute(),
|
|
18707
18755
|
onToggleHold: t[7] ||= (e) => unref(S).toggleHold()
|
|
18708
18756
|
}, null, 8, [
|