@shenyin/embedded-call-widget 2.6.4 → 2.6.6
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/README.md +1 -1
- package/checksums.txt +3 -3
- package/embedded-call-widget-runtime.iife.js +13 -13
- package/embedded-call-widget-runtime.js +210 -176
- package/manifest.json +11 -11
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Tt = "0.21.1";
|
|
2
2
|
class le extends Error {
|
|
3
3
|
constructor(e) {
|
|
4
4
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -15,7 +15,7 @@ class ye extends le {
|
|
|
15
15
|
super(e || "Request pending.");
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class Ct extends le {
|
|
19
19
|
constructor(e) {
|
|
20
20
|
super(e || "Unspecified session description handler error.");
|
|
21
21
|
}
|
|
@@ -30,7 +30,7 @@ class pe extends le {
|
|
|
30
30
|
super(e || "An error occurred during state transition.");
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class Et {
|
|
34
34
|
/** @internal */
|
|
35
35
|
constructor(e) {
|
|
36
36
|
this.incomingAckRequest = e;
|
|
@@ -40,7 +40,7 @@ class xt {
|
|
|
40
40
|
return this.incomingAckRequest.message;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class xt {
|
|
44
44
|
/** @internal */
|
|
45
45
|
constructor(e) {
|
|
46
46
|
this.incomingByeRequest = e;
|
|
@@ -58,7 +58,7 @@ class Rt {
|
|
|
58
58
|
return this.incomingByeRequest.reject(e), Promise.resolve();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class Rt {
|
|
62
62
|
/** @internal */
|
|
63
63
|
constructor(e) {
|
|
64
64
|
this.incomingCancelRequest = e;
|
|
@@ -130,7 +130,7 @@ class be {
|
|
|
130
130
|
return this.addListener(e, { once: !0 });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
class
|
|
133
|
+
class It {
|
|
134
134
|
/** @internal */
|
|
135
135
|
constructor(e) {
|
|
136
136
|
this.incomingInfoRequest = e;
|
|
@@ -204,7 +204,7 @@ class F extends nt {
|
|
|
204
204
|
return e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
class
|
|
207
|
+
class J extends nt {
|
|
208
208
|
/**
|
|
209
209
|
* Constructor
|
|
210
210
|
* @param scheme -
|
|
@@ -278,7 +278,7 @@ class Y extends nt {
|
|
|
278
278
|
this.headers = {};
|
|
279
279
|
}
|
|
280
280
|
clone() {
|
|
281
|
-
return new
|
|
281
|
+
return new J(this._raw.scheme, this._raw.user || "", this._raw.host, this._raw.port, JSON.parse(JSON.stringify(this.parameters)), JSON.parse(JSON.stringify(this.headers)));
|
|
282
282
|
}
|
|
283
283
|
toRaw() {
|
|
284
284
|
return this._toString(this._raw);
|
|
@@ -430,7 +430,7 @@ class he extends Error {
|
|
|
430
430
|
return t;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function _t(a, e) {
|
|
434
434
|
e = e !== void 0 ? e : {};
|
|
435
435
|
const t = {}, i = e.grammarSource, s = { Contact: 119, Name_Addr_Header: 156, Record_Route: 176, Request_Response: 81, SIP_URI: 45, Subscription_State: 186, Supported: 191, Require: 182, Via: 194, absoluteURI: 84, Call_ID: 118, Content_Disposition: 130, Content_Length: 135, Content_Type: 136, CSeq: 146, displayName: 122, Event: 149, From: 151, host: 52, Max_Forwards: 154, Min_SE: 213, Proxy_Authenticate: 157, quoted_string: 40, Refer_To: 178, Replaces: 179, Session_Expires: 210, stun_URI: 217, To: 192, turn_URI: 223, uuid: 226, WWW_Authenticate: 209, challenge: 158, sipfrag: 230, Referred_By: 231 };
|
|
436
436
|
let r = 119;
|
|
@@ -576,10 +576,10 @@ function At(a, e) {
|
|
|
576
576
|
/^[\x0E-\x7F]/,
|
|
577
577
|
A([["", ""]], !1, !1),
|
|
578
578
|
function() {
|
|
579
|
-
e = e || { data: {} }, e.data.uri = new
|
|
579
|
+
e = e || { data: {} }, e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port;
|
|
580
580
|
},
|
|
581
581
|
function() {
|
|
582
|
-
e = e || { data: {} }, e.data.uri = new
|
|
582
|
+
e = e || { data: {} }, e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port, e.data.uri_params, e.data.uri_headers), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port, delete e.data.uri_params, e.startRule === "SIP_URI" && (e.data = e.data.uri);
|
|
583
583
|
},
|
|
584
584
|
"sips",
|
|
585
585
|
f("sips", !0),
|
|
@@ -679,7 +679,7 @@ function At(a, e) {
|
|
|
679
679
|
l = l.join("").toLowerCase(), y = y.join(""), e = e || { data: {} }, e.data.uri_headers || (e.data.uri_headers = {}), e.data.uri_headers[l] ? e.data.uri_headers[l].push(y) : e.data.uri_headers[l] = [y];
|
|
680
680
|
},
|
|
681
681
|
function() {
|
|
682
|
-
e = e || { data: {} }, e.startRule === "Refer_To" && (e.data.uri = new
|
|
682
|
+
e = e || { data: {} }, e.startRule === "Refer_To" && (e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port, e.data.uri_params, e.data.uri_headers), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port, delete e.data.uri_params);
|
|
683
683
|
},
|
|
684
684
|
"//",
|
|
685
685
|
f("//", !1),
|
|
@@ -943,7 +943,7 @@ function At(a, e) {
|
|
|
943
943
|
return y;
|
|
944
944
|
},
|
|
945
945
|
function(l, y) {
|
|
946
|
-
return
|
|
946
|
+
return vt(l, y);
|
|
947
947
|
},
|
|
948
948
|
function(l) {
|
|
949
949
|
e = e || { data: {} }, e.startRule === "Require" && (e.data = l || []);
|
|
@@ -1374,7 +1374,7 @@ function At(a, e) {
|
|
|
1374
1374
|
function Ke(l) {
|
|
1375
1375
|
d < w || (d > w && (w = d, S = []), S.push(l));
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function bt(l, y, h) {
|
|
1378
1378
|
return new he(he.buildMessage(l, y), l, y, h);
|
|
1379
1379
|
}
|
|
1380
1380
|
function c(l) {
|
|
@@ -1469,8 +1469,8 @@ function At(a, e) {
|
|
|
1469
1469
|
p = d, h++;
|
|
1470
1470
|
break;
|
|
1471
1471
|
case 26:
|
|
1472
|
-
Ye = y.slice(h + 4, h + 4 + y[h + 3]).map(function(
|
|
1473
|
-
return C[C.length - 1 -
|
|
1472
|
+
Ye = y.slice(h + 4, h + 4 + y[h + 3]).map(function(St) {
|
|
1473
|
+
return C[C.length - 1 - St];
|
|
1474
1474
|
}), C.splice(C.length - y[h + 2], y[h + 2], n[y[h + 1]].apply(null, Ye)), h += 4 + y[h + 3];
|
|
1475
1475
|
break;
|
|
1476
1476
|
case 27:
|
|
@@ -1493,20 +1493,20 @@ function At(a, e) {
|
|
|
1493
1493
|
return C[0];
|
|
1494
1494
|
}
|
|
1495
1495
|
e.data = {};
|
|
1496
|
-
function
|
|
1496
|
+
function vt(l, y) {
|
|
1497
1497
|
return [l].concat(y);
|
|
1498
1498
|
}
|
|
1499
1499
|
if (_ = ze(r), _ !== t && d === a.length)
|
|
1500
1500
|
return _;
|
|
1501
|
-
throw _ !== t && d < a.length && Ke(ke()),
|
|
1501
|
+
throw _ !== t && d < a.length && Ke(ke()), bt(S, w < a.length ? a.charAt(w) : null, w < a.length ? Pe(w, w + 1) : Pe(w, w));
|
|
1502
1502
|
}
|
|
1503
|
-
const
|
|
1503
|
+
const At = _t;
|
|
1504
1504
|
var k;
|
|
1505
1505
|
(function(a) {
|
|
1506
1506
|
function e(s, r) {
|
|
1507
1507
|
const n = { startRule: r };
|
|
1508
1508
|
try {
|
|
1509
|
-
|
|
1509
|
+
At(s, n);
|
|
1510
1510
|
} catch {
|
|
1511
1511
|
n.data = -1;
|
|
1512
1512
|
}
|
|
@@ -1524,7 +1524,7 @@ var k;
|
|
|
1524
1524
|
}
|
|
1525
1525
|
a.URIParse = i;
|
|
1526
1526
|
})(k = k || (k = {}));
|
|
1527
|
-
const
|
|
1527
|
+
const $t = {
|
|
1528
1528
|
100: "Trying",
|
|
1529
1529
|
180: "Ringing",
|
|
1530
1530
|
181: "Call Is Being Forwarded",
|
|
@@ -1606,12 +1606,12 @@ function oe(a, e = 32) {
|
|
|
1606
1606
|
return t;
|
|
1607
1607
|
}
|
|
1608
1608
|
function _e(a) {
|
|
1609
|
-
return
|
|
1609
|
+
return $t[a] || "";
|
|
1610
1610
|
}
|
|
1611
1611
|
function Ae() {
|
|
1612
1612
|
return oe(10);
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function z(a) {
|
|
1615
1615
|
const e = {
|
|
1616
1616
|
"Call-Id": "Call-ID",
|
|
1617
1617
|
Cseq: "CSeq",
|
|
@@ -1640,7 +1640,7 @@ class at {
|
|
|
1640
1640
|
*/
|
|
1641
1641
|
addHeader(e, t) {
|
|
1642
1642
|
const i = { raw: t };
|
|
1643
|
-
e =
|
|
1643
|
+
e = z(e), this.headers[e] ? this.headers[e].push(i) : this.headers[e] = [i];
|
|
1644
1644
|
}
|
|
1645
1645
|
/**
|
|
1646
1646
|
* Get the value of the given header name at the given position.
|
|
@@ -1648,7 +1648,7 @@ class at {
|
|
|
1648
1648
|
* @returns Returns the specified header, undefined if header doesn't exist.
|
|
1649
1649
|
*/
|
|
1650
1650
|
getHeader(e) {
|
|
1651
|
-
const t = this.headers[
|
|
1651
|
+
const t = this.headers[z(e)];
|
|
1652
1652
|
if (t) {
|
|
1653
1653
|
if (t[0])
|
|
1654
1654
|
return t[0].raw;
|
|
@@ -1661,7 +1661,7 @@ class at {
|
|
|
1661
1661
|
* @returns Array - with all the headers of the specified name.
|
|
1662
1662
|
*/
|
|
1663
1663
|
getHeaders(e) {
|
|
1664
|
-
const t = this.headers[
|
|
1664
|
+
const t = this.headers[z(e)], i = [];
|
|
1665
1665
|
if (!t)
|
|
1666
1666
|
return [];
|
|
1667
1667
|
for (const s of t)
|
|
@@ -1674,7 +1674,7 @@ class at {
|
|
|
1674
1674
|
* @returns true if header with given name exists, false otherwise
|
|
1675
1675
|
*/
|
|
1676
1676
|
hasHeader(e) {
|
|
1677
|
-
return !!this.headers[
|
|
1677
|
+
return !!this.headers[z(e)];
|
|
1678
1678
|
}
|
|
1679
1679
|
/**
|
|
1680
1680
|
* Parse the given header on the given index.
|
|
@@ -1685,7 +1685,7 @@ class at {
|
|
|
1685
1685
|
*/
|
|
1686
1686
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1687
1687
|
parseHeader(e, t = 0) {
|
|
1688
|
-
if (e =
|
|
1688
|
+
if (e = z(e), this.headers[e]) {
|
|
1689
1689
|
if (t >= this.headers[e].length)
|
|
1690
1690
|
return;
|
|
1691
1691
|
} else return;
|
|
@@ -1719,7 +1719,7 @@ class at {
|
|
|
1719
1719
|
* @param value - header value
|
|
1720
1720
|
*/
|
|
1721
1721
|
setHeader(e, t) {
|
|
1722
|
-
this.headers[
|
|
1722
|
+
this.headers[z(e)] = [{ raw: t }];
|
|
1723
1723
|
}
|
|
1724
1724
|
toString() {
|
|
1725
1725
|
return this.data;
|
|
@@ -1770,7 +1770,7 @@ class de {
|
|
|
1770
1770
|
* @returns Returns the specified header, undefined if header doesn't exist.
|
|
1771
1771
|
*/
|
|
1772
1772
|
getHeader(e) {
|
|
1773
|
-
const t = this.headers[
|
|
1773
|
+
const t = this.headers[z(e)];
|
|
1774
1774
|
if (t) {
|
|
1775
1775
|
if (t[0])
|
|
1776
1776
|
return t[0];
|
|
@@ -1787,7 +1787,7 @@ class de {
|
|
|
1787
1787
|
* @returns Array with all the headers of the specified name.
|
|
1788
1788
|
*/
|
|
1789
1789
|
getHeaders(e) {
|
|
1790
|
-
const t = [], i = this.headers[
|
|
1790
|
+
const t = [], i = this.headers[z(e)];
|
|
1791
1791
|
if (i)
|
|
1792
1792
|
for (const s of i)
|
|
1793
1793
|
t.push(s);
|
|
@@ -1804,7 +1804,7 @@ class de {
|
|
|
1804
1804
|
* @returns true if header with given name exists, false otherwise
|
|
1805
1805
|
*/
|
|
1806
1806
|
hasHeader(e) {
|
|
1807
|
-
if (this.headers[
|
|
1807
|
+
if (this.headers[z(e)])
|
|
1808
1808
|
return !0;
|
|
1809
1809
|
{
|
|
1810
1810
|
const t = new RegExp("^\\s*" + e + "\\s*:", "i");
|
|
@@ -1820,7 +1820,7 @@ class de {
|
|
|
1820
1820
|
* @param value - header value
|
|
1821
1821
|
*/
|
|
1822
1822
|
setHeader(e, t) {
|
|
1823
|
-
this.headers[
|
|
1823
|
+
this.headers[z(e)] = t instanceof Array ? t : [t];
|
|
1824
1824
|
}
|
|
1825
1825
|
/**
|
|
1826
1826
|
* The Via header field indicates the transport used for the transaction
|
|
@@ -1920,19 +1920,19 @@ var b;
|
|
|
1920
1920
|
(function(a) {
|
|
1921
1921
|
a.Initial = "Initial", a.HaveLocalOffer = "HaveLocalOffer", a.HaveRemoteOffer = "HaveRemoteOffer", a.Stable = "Stable", a.Closed = "Closed";
|
|
1922
1922
|
})(b = b || (b = {}));
|
|
1923
|
-
const
|
|
1924
|
-
T1:
|
|
1925
|
-
T2:
|
|
1926
|
-
TIMER_B: 64 *
|
|
1927
|
-
TIMER_D: 0 *
|
|
1928
|
-
TIMER_F: 64 *
|
|
1929
|
-
TIMER_H: 64 *
|
|
1923
|
+
const X = 500, Dt = 4e3, Ze = 5e3, M = {
|
|
1924
|
+
T1: X,
|
|
1925
|
+
T2: Dt,
|
|
1926
|
+
TIMER_B: 64 * X,
|
|
1927
|
+
TIMER_D: 0 * X,
|
|
1928
|
+
TIMER_F: 64 * X,
|
|
1929
|
+
TIMER_H: 64 * X,
|
|
1930
1930
|
TIMER_I: 0 * Ze,
|
|
1931
|
-
TIMER_J: 0 *
|
|
1931
|
+
TIMER_J: 0 * X,
|
|
1932
1932
|
TIMER_K: 0 * Ze,
|
|
1933
|
-
TIMER_L: 64 *
|
|
1934
|
-
TIMER_M: 64 *
|
|
1935
|
-
TIMER_N: 64 *
|
|
1933
|
+
TIMER_L: 64 * X,
|
|
1934
|
+
TIMER_M: 64 * X,
|
|
1935
|
+
TIMER_N: 64 * X,
|
|
1936
1936
|
PROVISIONAL_RESPONSE_INTERVAL: 6e4
|
|
1937
1937
|
// See RFC 3261 Section 13.3.1.1
|
|
1938
1938
|
};
|
|
@@ -1995,7 +1995,7 @@ class je {
|
|
|
1995
1995
|
return this.incomingNotifyRequest.reject(e), Promise.resolve();
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
|
-
class
|
|
1998
|
+
class kt {
|
|
1999
1999
|
/** @internal */
|
|
2000
2000
|
constructor(e, t) {
|
|
2001
2001
|
this.incomingReferRequest = e, this.session = t;
|
|
@@ -2454,7 +2454,7 @@ class ge {
|
|
|
2454
2454
|
sessionDescriptionHandlerModifiers: this.pendingReinviteAck ? this._sessionDescriptionHandlerModifiersReInvite : this._sessionDescriptionHandlerModifiers
|
|
2455
2455
|
};
|
|
2456
2456
|
if (this.delegate && this.delegate.onAck) {
|
|
2457
|
-
const s = new
|
|
2457
|
+
const s = new Et(e);
|
|
2458
2458
|
this.delegate.onAck(s);
|
|
2459
2459
|
}
|
|
2460
2460
|
switch (this.pendingReinviteAck = !1, t.signalingState) {
|
|
@@ -2497,7 +2497,7 @@ class ge {
|
|
|
2497
2497
|
return;
|
|
2498
2498
|
}
|
|
2499
2499
|
if (this.delegate && this.delegate.onBye) {
|
|
2500
|
-
const t = new
|
|
2500
|
+
const t = new xt(e);
|
|
2501
2501
|
this.delegate.onBye(t);
|
|
2502
2502
|
} else
|
|
2503
2503
|
e.accept();
|
|
@@ -2513,7 +2513,7 @@ class ge {
|
|
|
2513
2513
|
return;
|
|
2514
2514
|
}
|
|
2515
2515
|
if (this.delegate && this.delegate.onInfo) {
|
|
2516
|
-
const t = new
|
|
2516
|
+
const t = new It(e);
|
|
2517
2517
|
this.delegate.onInfo(t);
|
|
2518
2518
|
} else
|
|
2519
2519
|
e.accept();
|
|
@@ -2626,7 +2626,7 @@ class ge {
|
|
|
2626
2626
|
this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."), e.reject();
|
|
2627
2627
|
return;
|
|
2628
2628
|
}
|
|
2629
|
-
const t = new
|
|
2629
|
+
const t = new kt(e, this);
|
|
2630
2630
|
this.delegate && this.delegate.onRefer ? this.delegate.onRefer(t) : (this.logger.log("No delegate available to handle REFER, automatically accepting and following."), t.accept().then(() => t.makeInviter(this._referralInviterOptions).invite()).catch((i) => {
|
|
2631
2631
|
this.logger.error(i.message);
|
|
2632
2632
|
}));
|
|
@@ -2828,7 +2828,7 @@ class ge {
|
|
|
2828
2828
|
}
|
|
2829
2829
|
referToString(e) {
|
|
2830
2830
|
let t;
|
|
2831
|
-
if (e instanceof
|
|
2831
|
+
if (e instanceof J)
|
|
2832
2832
|
t = e.toString();
|
|
2833
2833
|
else {
|
|
2834
2834
|
if (!e.dialog)
|
|
@@ -2843,7 +2843,7 @@ var G;
|
|
|
2843
2843
|
(function(a) {
|
|
2844
2844
|
a.Required = "Required", a.Supported = "Supported", a.Unsupported = "Unsupported";
|
|
2845
2845
|
})(G = G || (G = {}));
|
|
2846
|
-
const
|
|
2846
|
+
const Pt = {
|
|
2847
2847
|
"100rel": !0,
|
|
2848
2848
|
199: !0,
|
|
2849
2849
|
answermode: !0,
|
|
@@ -3049,7 +3049,7 @@ class ce extends ge {
|
|
|
3049
3049
|
return;
|
|
3050
3050
|
}
|
|
3051
3051
|
if (this.delegate && this.delegate.onCancel) {
|
|
3052
|
-
const t = new
|
|
3052
|
+
const t = new Rt(e);
|
|
3053
3053
|
this.delegate.onCancel(t);
|
|
3054
3054
|
}
|
|
3055
3055
|
this.isCanceled = !0, this.incomingInviteRequest.reject({ statusCode: 487 }), this.stateTransition(m.Terminated);
|
|
@@ -3092,7 +3092,7 @@ class ce extends ge {
|
|
|
3092
3092
|
*/
|
|
3093
3093
|
handleResponseError(e) {
|
|
3094
3094
|
let t = 480;
|
|
3095
|
-
if (e instanceof Error ? this.logger.error(e.message) : this.logger.error(e), e instanceof Be ? (this.logger.error("A session description handler occurred while sending response (content type unsupported"), t = 415) : e instanceof
|
|
3095
|
+
if (e instanceof Error ? this.logger.error(e.message) : this.logger.error(e), e instanceof Be ? (this.logger.error("A session description handler occurred while sending response (content type unsupported"), t = 415) : e instanceof Ct ? this.logger.error("A session description handler occurred while sending response") : e instanceof He ? this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)") : e instanceof ie && this.logger.error("Session changed state before response could be formulated and sent"), this.state === m.Initial || this.state === m.Establishing)
|
|
3096
3096
|
try {
|
|
3097
3097
|
this.incomingInviteRequest.reject({ statusCode: t }), this.stateTransition(m.Terminated);
|
|
3098
3098
|
} catch (i) {
|
|
@@ -3716,7 +3716,7 @@ class Ce extends ge {
|
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
-
class
|
|
3719
|
+
class Ht {
|
|
3720
3720
|
/**
|
|
3721
3721
|
* Constructs a new instance of the `Messager` class.
|
|
3722
3722
|
* @param userAgent - User agent. See {@link UserAgent} for details.
|
|
@@ -3751,7 +3751,7 @@ var x;
|
|
|
3751
3751
|
(function(a) {
|
|
3752
3752
|
a.Initial = "Initial", a.Registered = "Registered", a.Unregistered = "Unregistered", a.Terminated = "Terminated";
|
|
3753
3753
|
})(x = x || (x = {}));
|
|
3754
|
-
class
|
|
3754
|
+
class Y {
|
|
3755
3755
|
/**
|
|
3756
3756
|
* Constructs a new instance of the `Registerer` class.
|
|
3757
3757
|
* @param userAgent - User agent. See {@link UserAgent} for details.
|
|
@@ -3760,16 +3760,16 @@ class z {
|
|
|
3760
3760
|
constructor(e, t = {}) {
|
|
3761
3761
|
this.disposed = !1, this._contacts = [], this._retryAfter = void 0, this._state = x.Initial, this._waiting = !1, this._stateEventEmitter = new be(), this._waitingEventEmitter = new be(), this.userAgent = e;
|
|
3762
3762
|
const i = e.configuration.uri.clone();
|
|
3763
|
-
if (i.user = void 0, this.options = Object.assign(Object.assign(Object.assign({},
|
|
3763
|
+
if (i.user = void 0, this.options = Object.assign(Object.assign(Object.assign({}, Y.defaultOptions()), { registrar: i }), Y.stripUndefinedProperties(t)), this.options.extraContactHeaderParams = (this.options.extraContactHeaderParams || []).slice(), this.options.extraHeaders = (this.options.extraHeaders || []).slice(), !this.options.registrar)
|
|
3764
3764
|
throw new Error("Registrar undefined.");
|
|
3765
3765
|
if (this.options.registrar = this.options.registrar.clone(), this.options.regId && !this.options.instanceId ? this.options.instanceId = this.userAgent.instanceId : !this.options.regId && this.options.instanceId && (this.options.regId = 1), this.options.instanceId && k.parse(this.options.instanceId, "uuid") === -1)
|
|
3766
3766
|
throw new Error("Invalid instanceId.");
|
|
3767
3767
|
if (this.options.regId && this.options.regId < 0)
|
|
3768
3768
|
throw new Error("Invalid regId.");
|
|
3769
3769
|
const s = this.options.registrar, r = this.options.params && this.options.params.fromUri || e.userAgentCore.configuration.aor, n = this.options.params && this.options.params.toUri || e.configuration.uri, o = this.options.params || {}, d = (t.extraHeaders || []).slice();
|
|
3770
|
-
if (this.request = e.userAgentCore.makeOutgoingRequestMessage(v.REGISTER, s, r, n, o, d, void 0), this.expires = this.options.expires ||
|
|
3770
|
+
if (this.request = e.userAgentCore.makeOutgoingRequestMessage(v.REGISTER, s, r, n, o, d, void 0), this.expires = this.options.expires || Y.defaultExpires, this.expires < 0)
|
|
3771
3771
|
throw new Error("Invalid expires.");
|
|
3772
|
-
if (this.refreshFrequency = this.options.refreshFrequency ||
|
|
3772
|
+
if (this.refreshFrequency = this.options.refreshFrequency || Y.defaultRefreshFrequency, this.refreshFrequency < 50 || this.refreshFrequency > 99)
|
|
3773
3773
|
throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");
|
|
3774
3774
|
this.logger = e.getLogger("sip.Registerer"), this.options.logConfiguration && (this.logger.log("Configuration:"), Object.keys(this.options).forEach((p) => {
|
|
3775
3775
|
const u = this.options[p];
|
|
@@ -3779,15 +3779,15 @@ class z {
|
|
|
3779
3779
|
/** Default registerer options. */
|
|
3780
3780
|
static defaultOptions() {
|
|
3781
3781
|
return {
|
|
3782
|
-
expires:
|
|
3782
|
+
expires: Y.defaultExpires,
|
|
3783
3783
|
extraContactHeaderParams: [],
|
|
3784
3784
|
extraHeaders: [],
|
|
3785
3785
|
logConfiguration: !0,
|
|
3786
3786
|
instanceId: "",
|
|
3787
3787
|
params: {},
|
|
3788
3788
|
regId: 0,
|
|
3789
|
-
registrar: new
|
|
3790
|
-
refreshFrequency:
|
|
3789
|
+
registrar: new J("sip", "anonymous", "anonymous.invalid"),
|
|
3790
|
+
refreshFrequency: Y.defaultRefreshFrequency
|
|
3791
3791
|
};
|
|
3792
3792
|
}
|
|
3793
3793
|
/**
|
|
@@ -4084,8 +4084,8 @@ class z {
|
|
|
4084
4084
|
t += " The Registerer transitions to 'Terminated' when Registerer.dispose() is called.", t += " Perhaps you called UserAgent.stop() which dipsoses of all Registerers?", this.logger.error(t);
|
|
4085
4085
|
}
|
|
4086
4086
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4087
|
+
Y.defaultExpires = 600;
|
|
4088
|
+
Y.defaultRefreshFrequency = 99;
|
|
4089
4089
|
var R;
|
|
4090
4090
|
(function(a) {
|
|
4091
4091
|
a.Initial = "Initial", a.NotifyWait = "NotifyWait", a.Pending = "Pending", a.Active = "Active", a.Terminated = "Terminated";
|
|
@@ -4208,7 +4208,7 @@ P.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592" && console.error("Md5
|
|
|
4208
4208
|
function ee(a) {
|
|
4209
4209
|
return P.hashStr(a);
|
|
4210
4210
|
}
|
|
4211
|
-
class
|
|
4211
|
+
class Mt {
|
|
4212
4212
|
/**
|
|
4213
4213
|
* Constructor.
|
|
4214
4214
|
* @param loggerFactory - LoggerFactory.
|
|
@@ -4301,7 +4301,7 @@ class Xe {
|
|
|
4301
4301
|
this.logger.level = e;
|
|
4302
4302
|
}
|
|
4303
4303
|
}
|
|
4304
|
-
class
|
|
4304
|
+
class qt {
|
|
4305
4305
|
constructor() {
|
|
4306
4306
|
this.builtinEnabled = !0, this._level = H.log, this.loggers = {}, this.logger = this.getLogger("sip:loggerfactory");
|
|
4307
4307
|
}
|
|
@@ -5653,7 +5653,7 @@ class q {
|
|
|
5653
5653
|
this.core.userAgentClients.set(i, this);
|
|
5654
5654
|
}
|
|
5655
5655
|
}
|
|
5656
|
-
class
|
|
5656
|
+
class Ot extends q {
|
|
5657
5657
|
constructor(e, t, i) {
|
|
5658
5658
|
const s = e.createOutgoingRequestMessage(v.BYE, i);
|
|
5659
5659
|
super(L, e.userAgentCore, s, t), e.dispose();
|
|
@@ -5798,7 +5798,7 @@ class U extends ut {
|
|
|
5798
5798
|
this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`), this.state === g.Completed && this.stateTransition(g.Terminated);
|
|
5799
5799
|
}
|
|
5800
5800
|
}
|
|
5801
|
-
class
|
|
5801
|
+
class Z {
|
|
5802
5802
|
constructor(e, t, i, s) {
|
|
5803
5803
|
this.transactionConstructor = e, this.core = t, this.message = i, this.delegate = s, this.logger = this.loggerFactory.getLogger("sip.user-agent-server"), this.toTag = i.toTag ? i.toTag : Ae(), this.init();
|
|
5804
5804
|
}
|
|
@@ -5942,18 +5942,18 @@ class J {
|
|
|
5942
5942
|
this.core.userAgentServers.set(t.id, this);
|
|
5943
5943
|
}
|
|
5944
5944
|
}
|
|
5945
|
-
class
|
|
5945
|
+
class Ft extends Z {
|
|
5946
5946
|
constructor(e, t, i) {
|
|
5947
5947
|
super(U, e.userAgentCore, t, i);
|
|
5948
5948
|
}
|
|
5949
5949
|
}
|
|
5950
|
-
class
|
|
5950
|
+
class Nt extends q {
|
|
5951
5951
|
constructor(e, t, i) {
|
|
5952
5952
|
const s = e.createOutgoingRequestMessage(v.INFO, i);
|
|
5953
5953
|
super(L, e.userAgentCore, s, t);
|
|
5954
5954
|
}
|
|
5955
5955
|
}
|
|
5956
|
-
class
|
|
5956
|
+
class Ut extends Z {
|
|
5957
5957
|
constructor(e, t, i) {
|
|
5958
5958
|
super(U, e.userAgentCore, t, i);
|
|
5959
5959
|
}
|
|
@@ -5963,38 +5963,38 @@ class gt extends q {
|
|
|
5963
5963
|
super(L, e, t, i);
|
|
5964
5964
|
}
|
|
5965
5965
|
}
|
|
5966
|
-
class ft extends
|
|
5966
|
+
class ft extends Z {
|
|
5967
5967
|
constructor(e, t, i) {
|
|
5968
5968
|
super(U, e, t, i);
|
|
5969
5969
|
}
|
|
5970
5970
|
}
|
|
5971
|
-
class
|
|
5971
|
+
class Lt extends q {
|
|
5972
5972
|
constructor(e, t, i) {
|
|
5973
5973
|
const s = e.createOutgoingRequestMessage(v.NOTIFY, i);
|
|
5974
5974
|
super(L, e.userAgentCore, s, t);
|
|
5975
5975
|
}
|
|
5976
5976
|
}
|
|
5977
|
-
function
|
|
5977
|
+
function Bt(a) {
|
|
5978
5978
|
return a.userAgentCore !== void 0;
|
|
5979
5979
|
}
|
|
5980
|
-
class Re extends
|
|
5980
|
+
class Re extends Z {
|
|
5981
5981
|
/**
|
|
5982
5982
|
* NOTIFY UAS constructor.
|
|
5983
5983
|
* @param dialogOrCore - Dialog for in dialog NOTIFY, UserAgentCore for out of dialog NOTIFY (deprecated).
|
|
5984
5984
|
* @param message - Incoming NOTIFY request message.
|
|
5985
5985
|
*/
|
|
5986
5986
|
constructor(e, t, i) {
|
|
5987
|
-
const s =
|
|
5987
|
+
const s = Bt(e) ? e.userAgentCore : e;
|
|
5988
5988
|
super(U, s, t, i);
|
|
5989
5989
|
}
|
|
5990
5990
|
}
|
|
5991
|
-
class
|
|
5991
|
+
class jt extends q {
|
|
5992
5992
|
constructor(e, t, i) {
|
|
5993
5993
|
const s = e.createOutgoingRequestMessage(v.PRACK, i);
|
|
5994
5994
|
super(L, e.userAgentCore, s, t), e.signalingStateTransition(s);
|
|
5995
5995
|
}
|
|
5996
5996
|
}
|
|
5997
|
-
class
|
|
5997
|
+
class Vt extends Z {
|
|
5998
5998
|
constructor(e, t, i) {
|
|
5999
5999
|
super(U, e.userAgentCore, t, i), e.signalingStateTransition(t), this.dialog = e;
|
|
6000
6000
|
}
|
|
@@ -6006,7 +6006,7 @@ class Gt extends J {
|
|
|
6006
6006
|
return e.body && this.dialog.signalingStateTransition(e.body), super.accept(e);
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
|
-
class
|
|
6009
|
+
class Gt extends q {
|
|
6010
6010
|
constructor(e, t, i) {
|
|
6011
6011
|
const s = e.createOutgoingRequestMessage(v.INVITE, i);
|
|
6012
6012
|
super(re, e.userAgentCore, s, t), this.delegate = t, e.signalingStateTransition(s), e.reinviteUserAgentClient = this, this.dialog = e;
|
|
@@ -6049,7 +6049,7 @@ class Wt extends q {
|
|
|
6049
6049
|
}
|
|
6050
6050
|
}
|
|
6051
6051
|
}
|
|
6052
|
-
class
|
|
6052
|
+
class Wt extends Z {
|
|
6053
6053
|
constructor(e, t, i) {
|
|
6054
6054
|
super(N, e.userAgentCore, t, i), e.reinviteUserAgentServer = this, this.dialog = e;
|
|
6055
6055
|
}
|
|
@@ -6091,23 +6091,23 @@ class Kt extends J {
|
|
|
6091
6091
|
return this.dialog.signalingStateRollback(), this.dialog.reinviteUserAgentServer = void 0, super.reject(e);
|
|
6092
6092
|
}
|
|
6093
6093
|
}
|
|
6094
|
-
class
|
|
6094
|
+
class Kt extends q {
|
|
6095
6095
|
constructor(e, t, i) {
|
|
6096
6096
|
const s = e.createOutgoingRequestMessage(v.REFER, i);
|
|
6097
6097
|
super(L, e.userAgentCore, s, t);
|
|
6098
6098
|
}
|
|
6099
6099
|
}
|
|
6100
|
-
function
|
|
6100
|
+
function zt(a) {
|
|
6101
6101
|
return a.userAgentCore !== void 0;
|
|
6102
6102
|
}
|
|
6103
|
-
class pt extends
|
|
6103
|
+
class pt extends Z {
|
|
6104
6104
|
/**
|
|
6105
6105
|
* REFER UAS constructor.
|
|
6106
6106
|
* @param dialogOrCore - Dialog for in dialog REFER, UserAgentCore for out of dialog REFER.
|
|
6107
6107
|
* @param message - Incoming REFER request message.
|
|
6108
6108
|
*/
|
|
6109
6109
|
constructor(e, t, i) {
|
|
6110
|
-
const s =
|
|
6110
|
+
const s = zt(e) ? e.userAgentCore : e;
|
|
6111
6111
|
super(U, s, t, i);
|
|
6112
6112
|
}
|
|
6113
6113
|
}
|
|
@@ -6220,7 +6220,7 @@ class Ie extends fe {
|
|
|
6220
6220
|
if (this.ackWait && this.initialTransaction.state !== g.Terminated)
|
|
6221
6221
|
throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.");
|
|
6222
6222
|
}
|
|
6223
|
-
return new
|
|
6223
|
+
return new Ot(this, e, t);
|
|
6224
6224
|
}
|
|
6225
6225
|
/**
|
|
6226
6226
|
* An INFO request can be associated with an Info Package (see
|
|
@@ -6235,7 +6235,7 @@ class Ie extends fe {
|
|
|
6235
6235
|
info(e, t) {
|
|
6236
6236
|
if (this.logger.log(`INVITE dialog ${this.id} sending INFO request`), this.early)
|
|
6237
6237
|
throw new Error("Dialog not confirmed.");
|
|
6238
|
-
return new
|
|
6238
|
+
return new Nt(this, e, t);
|
|
6239
6239
|
}
|
|
6240
6240
|
/**
|
|
6241
6241
|
* Modifying an Existing Session
|
|
@@ -6265,7 +6265,7 @@ class Ie extends fe {
|
|
|
6265
6265
|
throw new Error("There is an ongoing re-INVITE client transaction.");
|
|
6266
6266
|
if (this.reinviteUserAgentServer)
|
|
6267
6267
|
throw new Error("There is an ongoing re-INVITE server transaction.");
|
|
6268
|
-
return new
|
|
6268
|
+
return new Gt(this, e, t);
|
|
6269
6269
|
}
|
|
6270
6270
|
/**
|
|
6271
6271
|
* A UAC MAY associate a MESSAGE request with an existing dialog. If a
|
|
@@ -6289,7 +6289,7 @@ class Ie extends fe {
|
|
|
6289
6289
|
notify(e, t) {
|
|
6290
6290
|
if (this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`), this.early)
|
|
6291
6291
|
throw new Error("Dialog not confirmed.");
|
|
6292
|
-
return new
|
|
6292
|
+
return new Lt(this, e, t);
|
|
6293
6293
|
}
|
|
6294
6294
|
/**
|
|
6295
6295
|
* Assuming the response is to be transmitted reliably, the UAC MUST
|
|
@@ -6302,7 +6302,7 @@ class Ie extends fe {
|
|
|
6302
6302
|
* @param options - Options bucket.
|
|
6303
6303
|
*/
|
|
6304
6304
|
prack(e, t) {
|
|
6305
|
-
return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`), new
|
|
6305
|
+
return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`), new jt(this, e, t);
|
|
6306
6306
|
}
|
|
6307
6307
|
/**
|
|
6308
6308
|
* REFER is a SIP request and is constructed as defined in [1]. A REFER
|
|
@@ -6313,7 +6313,7 @@ class Ie extends fe {
|
|
|
6313
6313
|
refer(e, t) {
|
|
6314
6314
|
if (this.logger.log(`INVITE dialog ${this.id} sending REFER request`), this.early)
|
|
6315
6315
|
throw new Error("Dialog not confirmed.");
|
|
6316
|
-
return new
|
|
6316
|
+
return new Kt(this, e, t);
|
|
6317
6317
|
}
|
|
6318
6318
|
/**
|
|
6319
6319
|
* Requests sent within a dialog, as any other requests, are atomic. If
|
|
@@ -6391,13 +6391,13 @@ class Ie extends fe {
|
|
|
6391
6391
|
switch (e.method) {
|
|
6392
6392
|
case v.BYE:
|
|
6393
6393
|
{
|
|
6394
|
-
const t = new
|
|
6394
|
+
const t = new Ft(this, e);
|
|
6395
6395
|
this.delegate && this.delegate.onBye ? this.delegate.onBye(t) : t.accept(), this.dispose();
|
|
6396
6396
|
}
|
|
6397
6397
|
break;
|
|
6398
6398
|
case v.INFO:
|
|
6399
6399
|
{
|
|
6400
|
-
const t = new
|
|
6400
|
+
const t = new Ut(this, e);
|
|
6401
6401
|
this.delegate && this.delegate.onInfo ? this.delegate.onInfo(t) : t.reject({
|
|
6402
6402
|
statusCode: 469,
|
|
6403
6403
|
extraHeaders: ["Recv-Info:"]
|
|
@@ -6406,7 +6406,7 @@ class Ie extends fe {
|
|
|
6406
6406
|
break;
|
|
6407
6407
|
case v.INVITE:
|
|
6408
6408
|
{
|
|
6409
|
-
const t = new
|
|
6409
|
+
const t = new Wt(this, e);
|
|
6410
6410
|
this.signalingStateTransition(e), this.delegate && this.delegate.onInvite ? this.delegate.onInvite(t) : t.reject({ statusCode: 488 });
|
|
6411
6411
|
}
|
|
6412
6412
|
break;
|
|
@@ -6424,7 +6424,7 @@ class Ie extends fe {
|
|
|
6424
6424
|
break;
|
|
6425
6425
|
case v.PRACK:
|
|
6426
6426
|
{
|
|
6427
|
-
const t = new
|
|
6427
|
+
const t = new Vt(this, e);
|
|
6428
6428
|
this.delegate && this.delegate.onPrack ? this.delegate.onPrack(t) : t.accept();
|
|
6429
6429
|
}
|
|
6430
6430
|
break;
|
|
@@ -6575,7 +6575,7 @@ class Ie extends fe {
|
|
|
6575
6575
|
}
|
|
6576
6576
|
}
|
|
6577
6577
|
}
|
|
6578
|
-
class
|
|
6578
|
+
class Yt extends q {
|
|
6579
6579
|
constructor(e, t, i) {
|
|
6580
6580
|
super(re, e, t, i), this.confirmedDialogAcks = /* @__PURE__ */ new Map(), this.confirmedDialogs = /* @__PURE__ */ new Map(), this.earlyDialogs = /* @__PURE__ */ new Map(), this.delegate = i;
|
|
6581
6581
|
}
|
|
@@ -6696,7 +6696,7 @@ class Jt extends q {
|
|
|
6696
6696
|
}
|
|
6697
6697
|
}
|
|
6698
6698
|
}
|
|
6699
|
-
class Oe extends
|
|
6699
|
+
class Oe extends Z {
|
|
6700
6700
|
constructor(e, t, i) {
|
|
6701
6701
|
super(N, e, t, i), this.core = e;
|
|
6702
6702
|
}
|
|
@@ -6799,22 +6799,22 @@ class Oe extends J {
|
|
|
6799
6799
|
return super.reject(e);
|
|
6800
6800
|
}
|
|
6801
6801
|
}
|
|
6802
|
-
class
|
|
6802
|
+
class Jt extends q {
|
|
6803
6803
|
constructor(e, t, i) {
|
|
6804
6804
|
super(L, e, t, i);
|
|
6805
6805
|
}
|
|
6806
6806
|
}
|
|
6807
|
-
class
|
|
6807
|
+
class Zt extends q {
|
|
6808
6808
|
constructor(e, t, i) {
|
|
6809
6809
|
super(L, e, t, i);
|
|
6810
6810
|
}
|
|
6811
6811
|
}
|
|
6812
|
-
class
|
|
6812
|
+
class Xt extends Z {
|
|
6813
6813
|
constructor(e, t, i) {
|
|
6814
6814
|
super(U, e, t, i), this.core = e;
|
|
6815
6815
|
}
|
|
6816
6816
|
}
|
|
6817
|
-
class
|
|
6817
|
+
class Qt extends q {
|
|
6818
6818
|
constructor(e, t, i) {
|
|
6819
6819
|
const s = e.createOutgoingRequestMessage(v.SUBSCRIBE, i);
|
|
6820
6820
|
super(L, e.userAgentCore, s, t), this.dialog = e;
|
|
@@ -6951,7 +6951,7 @@ class Qe extends fe {
|
|
|
6951
6951
|
if (this.subscriptionState !== R.Pending && this.subscriptionState !== R.Active)
|
|
6952
6952
|
throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);
|
|
6953
6953
|
this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);
|
|
6954
|
-
const s = new
|
|
6954
|
+
const s = new Qt(this, e, t);
|
|
6955
6955
|
return this.N && (clearTimeout(this.N), this.N = void 0), !((i = t.extraHeaders) === null || i === void 0) && i.includes("Expires: 0") || (this.N = setTimeout(() => this.timerN(), M.TIMER_N)), s;
|
|
6956
6956
|
}
|
|
6957
6957
|
/**
|
|
@@ -7074,7 +7074,7 @@ class Qe extends fe {
|
|
|
7074
7074
|
this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."), this.subscriptionState !== R.Terminated && (this.stateTransition(R.Terminated), this.onTerminated());
|
|
7075
7075
|
}
|
|
7076
7076
|
}
|
|
7077
|
-
class
|
|
7077
|
+
class ei extends q {
|
|
7078
7078
|
constructor(e, t, i) {
|
|
7079
7079
|
const s = t.getHeader("Event");
|
|
7080
7080
|
if (!s)
|
|
@@ -7191,13 +7191,13 @@ class ti extends q {
|
|
|
7191
7191
|
this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."), this.waitNotifyStop(), this.delegate && this.delegate.onNotifyTimeout && this.delegate.onNotifyTimeout();
|
|
7192
7192
|
}
|
|
7193
7193
|
}
|
|
7194
|
-
class
|
|
7194
|
+
class ti extends Z {
|
|
7195
7195
|
constructor(e, t, i) {
|
|
7196
7196
|
super(U, e, t, i), this.core = e;
|
|
7197
7197
|
}
|
|
7198
7198
|
}
|
|
7199
7199
|
const et = ["application/sdp", "application/dtmf-relay"];
|
|
7200
|
-
class
|
|
7200
|
+
class ii {
|
|
7201
7201
|
/**
|
|
7202
7202
|
* Constructor.
|
|
7203
7203
|
* @param configuration - Configuration.
|
|
@@ -7231,7 +7231,7 @@ class si {
|
|
|
7231
7231
|
* @param delegate - Request delegate.
|
|
7232
7232
|
*/
|
|
7233
7233
|
invite(e, t) {
|
|
7234
|
-
return new
|
|
7234
|
+
return new Yt(this, e, t);
|
|
7235
7235
|
}
|
|
7236
7236
|
/**
|
|
7237
7237
|
* Send MESSAGE.
|
|
@@ -7247,7 +7247,7 @@ class si {
|
|
|
7247
7247
|
* @param delegate - Request delegate.
|
|
7248
7248
|
*/
|
|
7249
7249
|
publish(e, t) {
|
|
7250
|
-
return new
|
|
7250
|
+
return new Jt(this, e, t);
|
|
7251
7251
|
}
|
|
7252
7252
|
/**
|
|
7253
7253
|
* Send REGISTER.
|
|
@@ -7255,7 +7255,7 @@ class si {
|
|
|
7255
7255
|
* @param delegate - Request delegate.
|
|
7256
7256
|
*/
|
|
7257
7257
|
register(e, t) {
|
|
7258
|
-
return new
|
|
7258
|
+
return new Zt(this, e, t);
|
|
7259
7259
|
}
|
|
7260
7260
|
/**
|
|
7261
7261
|
* Send SUBSCRIBE.
|
|
@@ -7263,7 +7263,7 @@ class si {
|
|
|
7263
7263
|
* @param delegate - Request delegate.
|
|
7264
7264
|
*/
|
|
7265
7265
|
subscribe(e, t) {
|
|
7266
|
-
return new
|
|
7266
|
+
return new ei(this, e, t);
|
|
7267
7267
|
}
|
|
7268
7268
|
/**
|
|
7269
7269
|
* Send a request.
|
|
@@ -7501,13 +7501,13 @@ class si {
|
|
|
7501
7501
|
break;
|
|
7502
7502
|
case v.REGISTER:
|
|
7503
7503
|
{
|
|
7504
|
-
const t = new
|
|
7504
|
+
const t = new Xt(this, e);
|
|
7505
7505
|
this.delegate.onRegister ? this.delegate.onRegister(t) : t.reject({ statusCode: 405 });
|
|
7506
7506
|
}
|
|
7507
7507
|
break;
|
|
7508
7508
|
case v.SUBSCRIBE:
|
|
7509
7509
|
{
|
|
7510
|
-
const t = new
|
|
7510
|
+
const t = new ti(this, e);
|
|
7511
7511
|
this.delegate.onSubscribe ? this.delegate.onSubscribe(t) : t.reject({ statusCode: 480 });
|
|
7512
7512
|
}
|
|
7513
7513
|
break;
|
|
@@ -7533,10 +7533,10 @@ class si {
|
|
|
7533
7533
|
i ? i.transaction.receiveResponse(e) : this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`);
|
|
7534
7534
|
}
|
|
7535
7535
|
}
|
|
7536
|
-
function
|
|
7536
|
+
function si() {
|
|
7537
7537
|
return (a) => !a.audio && !a.video ? Promise.resolve(new MediaStream()) : navigator.mediaDevices === void 0 ? Promise.reject(new Error("Media devices not available in insecure contexts.")) : navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices, a);
|
|
7538
7538
|
}
|
|
7539
|
-
function
|
|
7539
|
+
function ri() {
|
|
7540
7540
|
return {
|
|
7541
7541
|
bundlePolicy: "balanced",
|
|
7542
7542
|
certificates: void 0,
|
|
@@ -8078,12 +8078,12 @@ class O {
|
|
|
8078
8078
|
};
|
|
8079
8079
|
}
|
|
8080
8080
|
}
|
|
8081
|
-
function
|
|
8081
|
+
function ni(a) {
|
|
8082
8082
|
return (e, t) => {
|
|
8083
|
-
a === void 0 && (a =
|
|
8083
|
+
a === void 0 && (a = si());
|
|
8084
8084
|
const s = {
|
|
8085
8085
|
iceGatheringTimeout: t?.iceGatheringTimeout !== void 0 ? t?.iceGatheringTimeout : 5e3,
|
|
8086
|
-
peerConnectionConfiguration: Object.assign(Object.assign({},
|
|
8086
|
+
peerConnectionConfiguration: Object.assign(Object.assign({}, ri()), t?.peerConnectionConfiguration)
|
|
8087
8087
|
}, r = e.userAgent.getLogger("sip.SessionDescriptionHandler");
|
|
8088
8088
|
return new O(r, a, s);
|
|
8089
8089
|
};
|
|
@@ -8496,12 +8496,12 @@ class V {
|
|
|
8496
8496
|
* @param options - Options bucket. See {@link UserAgentOptions} for details.
|
|
8497
8497
|
*/
|
|
8498
8498
|
constructor(e = {}) {
|
|
8499
|
-
if (this._publishers = {}, this._registerers = {}, this._sessions = {}, this._subscriptions = {}, this._state = D.Stopped, this._stateEventEmitter = new be(), this.delegate = e.delegate, this.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, V.defaultOptions()), { sipjsId: oe(5) }), { uri: new
|
|
8499
|
+
if (this._publishers = {}, this._registerers = {}, this._sessions = {}, this._subscriptions = {}, this._state = D.Stopped, this._stateEventEmitter = new be(), this.delegate = e.delegate, this.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, V.defaultOptions()), { sipjsId: oe(5) }), { uri: new J("sip", "anonymous." + oe(6), "anonymous.invalid") }), { viaHost: oe(12) + ".invalid" }), V.stripUndefinedProperties(e)), this.options.hackIpInContact)
|
|
8500
8500
|
if (typeof this.options.hackIpInContact == "boolean" && this.options.hackIpInContact) {
|
|
8501
8501
|
const s = Math.floor(Math.random() * 254 + 1);
|
|
8502
8502
|
this.options.viaHost = "192.0.2." + s;
|
|
8503
8503
|
} else this.options.hackIpInContact && (this.options.viaHost = this.options.hackIpInContact);
|
|
8504
|
-
switch (this.loggerFactory = new
|
|
8504
|
+
switch (this.loggerFactory = new qt(), this.logger = this.loggerFactory.getLogger("sip.UserAgent"), this.loggerFactory.builtinEnabled = this.options.logBuiltinEnabled, this.loggerFactory.connector = this.options.logConnector, this.options.logLevel) {
|
|
8505
8505
|
case "error":
|
|
8506
8506
|
this.loggerFactory.level = H.error;
|
|
8507
8507
|
break;
|
|
@@ -8585,7 +8585,7 @@ class V {
|
|
|
8585
8585
|
reconnectionAttempts: 0,
|
|
8586
8586
|
reconnectionDelay: 4,
|
|
8587
8587
|
sendInitialProvisionalResponse: !0,
|
|
8588
|
-
sessionDescriptionHandlerFactory:
|
|
8588
|
+
sessionDescriptionHandlerFactory: ni(),
|
|
8589
8589
|
sessionDescriptionHandlerFactoryOptions: {},
|
|
8590
8590
|
sipExtension100rel: G.Unsupported,
|
|
8591
8591
|
sipExtensionReplaces: G.Unsupported,
|
|
@@ -8593,8 +8593,8 @@ class V {
|
|
|
8593
8593
|
sipjsId: "",
|
|
8594
8594
|
transportConstructor: Se,
|
|
8595
8595
|
transportOptions: {},
|
|
8596
|
-
uri: new
|
|
8597
|
-
userAgentString: "SIP.js/" +
|
|
8596
|
+
uri: new J("sip", "anonymous", "anonymous.invalid"),
|
|
8597
|
+
userAgentString: "SIP.js/" + Tt,
|
|
8598
8598
|
viaHost: ""
|
|
8599
8599
|
};
|
|
8600
8600
|
}
|
|
@@ -8797,7 +8797,7 @@ class V {
|
|
|
8797
8797
|
return {
|
|
8798
8798
|
pubGruu: void 0,
|
|
8799
8799
|
tempGruu: void 0,
|
|
8800
|
-
uri: new
|
|
8800
|
+
uri: new J("sip", e, this.options.viaHost, void 0, t),
|
|
8801
8801
|
toString: (s = {}) => {
|
|
8802
8802
|
const r = s.anonymous || !1, n = s.outbound || !1, o = s.register || !1;
|
|
8803
8803
|
let d = "<";
|
|
@@ -8810,7 +8810,7 @@ class V {
|
|
|
8810
8810
|
*/
|
|
8811
8811
|
initCore() {
|
|
8812
8812
|
let e = [];
|
|
8813
|
-
e.push("outbound"), this.options.sipExtension100rel === G.Supported && e.push("100rel"), this.options.sipExtensionReplaces === G.Supported && e.push("replaces"), this.options.sipExtensionExtraSupported && e.push(...this.options.sipExtensionExtraSupported), this.options.hackAllowUnregisteredOptionTags || (e = e.filter((r) =>
|
|
8813
|
+
e.push("outbound"), this.options.sipExtension100rel === G.Supported && e.push("100rel"), this.options.sipExtensionReplaces === G.Supported && e.push("replaces"), this.options.sipExtensionExtraSupported && e.push(...this.options.sipExtensionExtraSupported), this.options.hackAllowUnregisteredOptionTags || (e = e.filter((r) => Pt[r])), e = Array.from(new Set(e));
|
|
8814
8814
|
const t = e.slice();
|
|
8815
8815
|
(this.contact.pubGruu || this.contact.tempGruu) && t.push("gruu");
|
|
8816
8816
|
const i = {
|
|
@@ -8828,7 +8828,7 @@ class V {
|
|
|
8828
8828
|
viaHost: this.options.viaHost,
|
|
8829
8829
|
authenticationFactory: () => {
|
|
8830
8830
|
const r = this.options.authorizationUsername ? this.options.authorizationUsername : this.options.uri.user, n = this.options.authorizationPassword ? this.options.authorizationPassword : void 0, o = this.options.authorizationHa1 ? this.options.authorizationHa1 : void 0;
|
|
8831
|
-
return new
|
|
8831
|
+
return new Mt(this.getLoggerFactory(), o, r, n);
|
|
8832
8832
|
},
|
|
8833
8833
|
transportAccessor: () => this.transport
|
|
8834
8834
|
}, s = {
|
|
@@ -8909,7 +8909,7 @@ class V {
|
|
|
8909
8909
|
this.logger.warn("Received an out of dialog SUBSCRIBE request"), this.delegate && this.delegate.onSubscribeRequest ? this.delegate.onSubscribeRequest(r) : r.reject({ statusCode: 405 });
|
|
8910
8910
|
}
|
|
8911
8911
|
};
|
|
8912
|
-
return new
|
|
8912
|
+
return new ii(i, s);
|
|
8913
8913
|
}
|
|
8914
8914
|
initTransportCallbacks() {
|
|
8915
8915
|
this.transport.onConnect = () => this.onTransportConnect(), this.transport.onDisconnect = (e) => this.onTransportDisconnect(e), this.transport.onMessage = (e) => this.onTransportMessage(e);
|
|
@@ -9002,7 +9002,7 @@ class V {
|
|
|
9002
9002
|
this.logger.log(`Transitioned from ${this._state} to ${e}`), this._state = e, this._stateEventEmitter.emit(this._state);
|
|
9003
9003
|
}
|
|
9004
9004
|
}
|
|
9005
|
-
function
|
|
9005
|
+
function ai() {
|
|
9006
9006
|
return (a, e) => ({ session: e, held: !1, muted: !1 });
|
|
9007
9007
|
}
|
|
9008
9008
|
class Ge {
|
|
@@ -9017,7 +9017,7 @@ class Ge {
|
|
|
9017
9017
|
autoStop: !0,
|
|
9018
9018
|
delegate: {},
|
|
9019
9019
|
iceStopWaitingOnServerReflexive: !1,
|
|
9020
|
-
managedSessionFactory:
|
|
9020
|
+
managedSessionFactory: ai(),
|
|
9021
9021
|
maxSimultaneousSessions: 2,
|
|
9022
9022
|
media: {},
|
|
9023
9023
|
optionsPingInterval: -1,
|
|
@@ -9205,7 +9205,7 @@ class Ge {
|
|
|
9205
9205
|
* Attempts will be made to re-register as needed.
|
|
9206
9206
|
*/
|
|
9207
9207
|
async register(e) {
|
|
9208
|
-
return this.logger.log("Registering UserAgent..."), this.shouldBeRegistered = !0, e !== void 0 && (this.registererRegisterOptions = Object.assign({}, e)), this.registerer || (this.registerer = new
|
|
9208
|
+
return this.logger.log("Registering UserAgent..."), this.shouldBeRegistered = !0, e !== void 0 && (this.registererRegisterOptions = Object.assign({}, e)), this.registerer || (this.registerer = new Y(this.userAgent, this.registererOptions), this.registerer.stateChange.addListener((t) => {
|
|
9209
9209
|
switch (t) {
|
|
9210
9210
|
case x.Initial:
|
|
9211
9211
|
break;
|
|
@@ -9419,7 +9419,7 @@ Duration=` + 2e3
|
|
|
9419
9419
|
async message(e, t) {
|
|
9420
9420
|
this.logger.log("Sending message...");
|
|
9421
9421
|
const i = V.makeURI(e);
|
|
9422
|
-
return i ? new
|
|
9422
|
+
return i ? new Ht(this.userAgent, i, t).message() : Promise.reject(new Error(`Failed to create a valid URI from "${e}"`));
|
|
9423
9423
|
}
|
|
9424
9424
|
/** Media constraints. */
|
|
9425
9425
|
get constraints() {
|
|
@@ -9782,7 +9782,7 @@ Duration=` + 2e3
|
|
|
9782
9782
|
return this.logger.log(`[${e.id}] Terminating in state ${e.state}, no action taken`), Promise.resolve();
|
|
9783
9783
|
}
|
|
9784
9784
|
}
|
|
9785
|
-
class
|
|
9785
|
+
class oi {
|
|
9786
9786
|
/**
|
|
9787
9787
|
* Constructs a new instance of the `SimpleUser` class.
|
|
9788
9788
|
* @param server - SIP WebSocket Server URL.
|
|
@@ -10051,7 +10051,7 @@ class ci {
|
|
|
10051
10051
|
return this.logger.log(`[${this.id}] sending message...`), this.sessionManager.message(e, t);
|
|
10052
10052
|
}
|
|
10053
10053
|
}
|
|
10054
|
-
const
|
|
10054
|
+
const ci = 15e3, di = 15e3, Fe = (a, e, t) => {
|
|
10055
10055
|
const i = String(a?.name || a?.code || "").trim(), s = new Error(e);
|
|
10056
10056
|
return s.name = i || "MediaAccessError", s.code = t, s.cause = a, s;
|
|
10057
10057
|
}, Ne = (a) => {
|
|
@@ -10081,7 +10081,7 @@ const di = 15e3, li = 15e3, Fe = (a, e, t) => {
|
|
|
10081
10081
|
"麦克风当前被系统或其他应用占用,无法建立语音通话。请关闭占用麦克风的程序后重试。",
|
|
10082
10082
|
"media_device_unavailable"
|
|
10083
10083
|
) : a;
|
|
10084
|
-
},
|
|
10084
|
+
}, li = async (a = "call") => {
|
|
10085
10085
|
if (typeof navigator > "u" || !navigator.mediaDevices?.getUserMedia)
|
|
10086
10086
|
return null;
|
|
10087
10087
|
let e = null;
|
|
@@ -10091,7 +10091,7 @@ const di = 15e3, li = 15e3, Fe = (a, e, t) => {
|
|
|
10091
10091
|
throw await Ve(t, a);
|
|
10092
10092
|
}
|
|
10093
10093
|
};
|
|
10094
|
-
class
|
|
10094
|
+
class hi {
|
|
10095
10095
|
constructor(e, t = {}) {
|
|
10096
10096
|
this.account = { ...e }, this.remoteAudioElementId = t.remoteAudioElementId || "sipRemoteAudio", this.remoteAudioElement = t.remoteAudioElement || null, this.onStateChange = t.onStateChange, this.onError = t.onError, this.onAudioLevel = t.onAudioLevel, this.onAudioFrame = t.onAudioFrame, this.simpleUser = null, this.connected = !1, this.registered = !1, this.active = !1, this.lastFailureMeta = null, this.audioContext = null, this.audioMonitors = {
|
|
10097
10097
|
local: null,
|
|
@@ -10099,7 +10099,7 @@ class ui {
|
|
|
10099
10099
|
}, this.audioTrackMeta = {
|
|
10100
10100
|
local: null,
|
|
10101
10101
|
remote: null
|
|
10102
|
-
}, this.ringbackAudio = null, this.ringbackPlaying = !1, this.incomingAudio = null, this.incomingPlaying = !1, this.hangupInitiatedByLocal = !1, this.ringbackToneUrl = this._resolveToneUrl(t.ringbackTone || "ringback1.wav"), this.incomingToneUrl = this._resolveToneUrl(t.incomingTone || "ring1.wav"), this.pendingPlaybackTasks = /* @__PURE__ */ new Map(), this.audioUnlockHandler = null, this.lastSessionMeta = null, this.ensureReadyPromise = null, this.connectionWaiters = /* @__PURE__ */ new Set(), this.registrationWaiters = /* @__PURE__ */ new Set(), this.connectionConfirmTimeoutMs = Number.isFinite(Number(t.connectionConfirmTimeoutMs)) ? Number(t.connectionConfirmTimeoutMs) :
|
|
10102
|
+
}, this.ringbackAudio = null, this.ringbackPlaying = !1, this.incomingAudio = null, this.incomingPlaying = !1, this.hangupInitiatedByLocal = !1, this.ringbackToneUrl = this._resolveToneUrl(t.ringbackTone || "ringback1.wav"), this.incomingToneUrl = this._resolveToneUrl(t.incomingTone || "ring1.wav"), this.pendingPlaybackTasks = /* @__PURE__ */ new Map(), this.audioUnlockHandler = null, this.lastSessionMeta = null, this.ensureReadyPromise = null, this.connectionWaiters = /* @__PURE__ */ new Set(), this.registrationWaiters = /* @__PURE__ */ new Set(), this.connectionConfirmTimeoutMs = Number.isFinite(Number(t.connectionConfirmTimeoutMs)) ? Number(t.connectionConfirmTimeoutMs) : ci, this.registrationConfirmTimeoutMs = Number.isFinite(Number(t.registrationConfirmTimeoutMs)) ? Number(t.registrationConfirmTimeoutMs) : di, this.peerConnectionDebug = {
|
|
10103
10103
|
attached: !1,
|
|
10104
10104
|
events: [],
|
|
10105
10105
|
iceCandidates: [],
|
|
@@ -10323,7 +10323,7 @@ class ui {
|
|
|
10323
10323
|
registererOptions: {
|
|
10324
10324
|
expires: 1800
|
|
10325
10325
|
}
|
|
10326
|
-
}, w = new
|
|
10326
|
+
}, w = new oi(d, u);
|
|
10327
10327
|
return w.delegate = {
|
|
10328
10328
|
onServerConnect: () => {
|
|
10329
10329
|
this.connected = !0, this._resolveConnectionWaiters(), this.onStateChange && this.onStateChange("connected", this.getConnectionSnapshot());
|
|
@@ -10599,7 +10599,7 @@ class ui {
|
|
|
10599
10599
|
async _preflightAudioAccess(e = "call") {
|
|
10600
10600
|
let t = null;
|
|
10601
10601
|
try {
|
|
10602
|
-
t = await
|
|
10602
|
+
t = await li(e);
|
|
10603
10603
|
} catch (i) {
|
|
10604
10604
|
const s = await Ve(i, e);
|
|
10605
10605
|
throw this.onError && this.onError(s), this.lastFailureMeta = {
|
|
@@ -11052,15 +11052,15 @@ class ui {
|
|
|
11052
11052
|
this.audioContext = null;
|
|
11053
11053
|
}
|
|
11054
11054
|
}
|
|
11055
|
-
const
|
|
11056
|
-
function
|
|
11055
|
+
const ui = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
11056
|
+
function gi(a, e = "") {
|
|
11057
11057
|
const t = String(a || e || "").trim();
|
|
11058
11058
|
if (!t)
|
|
11059
11059
|
throw new Error("缺少统一服务基址");
|
|
11060
11060
|
return t;
|
|
11061
11061
|
}
|
|
11062
11062
|
function mt(a, e = "https://") {
|
|
11063
|
-
return
|
|
11063
|
+
return ui.test(a) ? a : `${e}${a.replace(/^\/+/, "")}`;
|
|
11064
11064
|
}
|
|
11065
11065
|
function wt(a = "/") {
|
|
11066
11066
|
return a.endsWith("/") ? a : `${a}/`;
|
|
@@ -11070,13 +11070,13 @@ function yt(a = "/", e = "") {
|
|
|
11070
11070
|
return i ? `${t}${i}` : t;
|
|
11071
11071
|
}
|
|
11072
11072
|
function De(a, e = "") {
|
|
11073
|
-
const t = mt(
|
|
11073
|
+
const t = mt(gi(a, e)), i = new URL(t);
|
|
11074
11074
|
return i.search = "", i.hash = "", i.pathname = wt(i.pathname || "/"), i;
|
|
11075
11075
|
}
|
|
11076
|
-
function
|
|
11076
|
+
function fi(a, e = "") {
|
|
11077
11077
|
return De(a, e).pathname !== "/";
|
|
11078
11078
|
}
|
|
11079
|
-
function
|
|
11079
|
+
function K(a, e, t = "") {
|
|
11080
11080
|
const i = De(a, t);
|
|
11081
11081
|
return i.pathname = yt(i.pathname, e), i.href;
|
|
11082
11082
|
}
|
|
@@ -11097,9 +11097,9 @@ function it({
|
|
|
11097
11097
|
fallbackPath: i = "ws"
|
|
11098
11098
|
}) {
|
|
11099
11099
|
const s = String(e || "").trim();
|
|
11100
|
-
return s ? Ue(s, tt(t, i)) :
|
|
11100
|
+
return s ? Ue(s, tt(t, i)) : fi(a) ? Ue(a, tt(t, i)) : String(t || "").trim() ? String(t).trim() : Ue(a, i);
|
|
11101
11101
|
}
|
|
11102
|
-
const
|
|
11102
|
+
const pi = `
|
|
11103
11103
|
:host { all: initial; }
|
|
11104
11104
|
.widget { font-family: "Noto Sans SC", "PingFang SC", sans-serif; color: #16302b; }
|
|
11105
11105
|
.panel { width: min(360px, 92vw); border-radius: 24px; overflow: hidden; background: linear-gradient(180deg, #fffdf6, #f4efe4); box-shadow: 0 22px 54px rgba(17, 30, 28, 0.22); border: 1px solid rgba(28, 78, 67, 0.12); }
|
|
@@ -11147,27 +11147,27 @@ const mi = `
|
|
|
11147
11147
|
rejected: "本次来电已拒接,widget 仍保持待机。",
|
|
11148
11148
|
missed: "本次来电未接听,widget 仍保持待机。",
|
|
11149
11149
|
failed: "本次呼叫失败,请先看下方日志。"
|
|
11150
|
-
},
|
|
11150
|
+
}, mi = "手机网页首次接入时,请允许麦克风权限;若切到后台后再回来,先确认页面仍保持前台活跃。", wi = 5e3, yi = 15e3, st = 2, me = 3e4, bi = 1200, vi = 3e4, Si = 4e3, Te = {
|
|
11151
11151
|
ready: "线路可用",
|
|
11152
11152
|
preparing: "正在准备",
|
|
11153
11153
|
working: "正在呼叫",
|
|
11154
11154
|
recovering: "正在恢复",
|
|
11155
11155
|
offline: "当前离线"
|
|
11156
11156
|
};
|
|
11157
|
-
function
|
|
11157
|
+
function Ti(a, e) {
|
|
11158
11158
|
return e ? `${a}
|
|
11159
11159
|
${JSON.stringify(e, null, 2)}` : a;
|
|
11160
11160
|
}
|
|
11161
|
-
function
|
|
11161
|
+
function Ci(a) {
|
|
11162
11162
|
return a === "outbound" ? "outbound" : "terminal";
|
|
11163
11163
|
}
|
|
11164
|
-
function
|
|
11164
|
+
function Ei(a) {
|
|
11165
11165
|
return typeof a == "function";
|
|
11166
11166
|
}
|
|
11167
|
-
function
|
|
11167
|
+
function xi() {
|
|
11168
11168
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).get("embeddedCallWidgetE2E") === "1";
|
|
11169
11169
|
}
|
|
11170
|
-
function
|
|
11170
|
+
function Ri() {
|
|
11171
11171
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `widget-${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;
|
|
11172
11172
|
}
|
|
11173
11173
|
function Le(a) {
|
|
@@ -11181,20 +11181,20 @@ function te(a = {}, e = null) {
|
|
|
11181
11181
|
const s = String(a?.businessKey ?? "").trim();
|
|
11182
11182
|
return s || String(e?.default_business_key ?? "").trim();
|
|
11183
11183
|
}
|
|
11184
|
-
function
|
|
11184
|
+
function Ii(a) {
|
|
11185
11185
|
const e = new Error(a);
|
|
11186
11186
|
return e.name = "EmbeddedCallWidgetLifecycleCancelledError", e.code = "widget_runtime_run_stale", e;
|
|
11187
11187
|
}
|
|
11188
11188
|
function rt(a) {
|
|
11189
11189
|
return a?.code === "sip_client_replaced" || a?.code === "widget_runtime_run_stale";
|
|
11190
11190
|
}
|
|
11191
|
-
class
|
|
11191
|
+
class _i {
|
|
11192
11192
|
constructor({ mount: e, shadowRoot: t, options: i }) {
|
|
11193
|
-
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode =
|
|
11193
|
+
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = Ci(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = De(i.apiBaseUrl || window.location.origin).href, this.client = null, this.issuedSession = null, this.bootstrap = null, this.turnIceServers = [], this.state = "idle", this.finalizing = !1, this.isMobileViewport = !1, this.pendingIncomingCall = null, this.visibilityHandler = null, this.sessionTouchTimer = null, this.sessionRecoveryInFlight = null, this.transportDisconnectTimer = null, this.transportDisconnectContext = null, this.e2eBridgeEnabled = xi(), this.terminalFailureOverride = "", this.presenceId = Ri(), this.presenceTouchTimer = null, this.presenceFailureCount = 0, this.availabilityState = "preparing", this.availabilityDetail = "正在连接后台并准备网页电话待机。", this.connectivityRecoveryInFlight = null, this.lifecycleRunId = 0, this.pendingLifecycleMode = null, this.expectedClientTeardown = null, this.expectedTermination = null, this.autoStandbyRecoveryTimer = null, this.recentlyReleasedSessions = /* @__PURE__ */ new Map(), this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible", this.onlineHandler = null, this.offlineHandler = null, this.beforeUnloadHandler = null, this.pageHideHandler = null, this.unloadCleanupStarted = !1, this.refs = {};
|
|
11194
11194
|
}
|
|
11195
11195
|
async mount() {
|
|
11196
11196
|
this.isMobileViewport = typeof window < "u" && window.matchMedia("(max-width: 480px)").matches, this.shadowRoot.innerHTML = `
|
|
11197
|
-
<style>${
|
|
11197
|
+
<style>${pi}</style>
|
|
11198
11198
|
<section class="widget">
|
|
11199
11199
|
<div class="panel">
|
|
11200
11200
|
<div class="hero">
|
|
@@ -11245,7 +11245,11 @@ class Ai {
|
|
|
11245
11245
|
this.networkOnline = !0, this.setAvailabilityState("recovering", "网络已恢复,正在重新连接网页电话。"), this.touchWidgetPresence("browser-online"), this.legacyOutboundOnly || this.restartStandbyAfterConnectivity("browser-online");
|
|
11246
11246
|
}, this.offlineHandler = () => {
|
|
11247
11247
|
this.networkOnline = !1, this.setAvailabilityState("offline", "当前网络连接已断开,正在等待恢复。"), ["incoming", "connected"].includes(this.state) ? this.render() : this.setState("failed", "当前网络连接已断开,正在等待恢复。");
|
|
11248
|
-
}, window.addEventListener("online", this.onlineHandler), window.addEventListener("offline", this.offlineHandler))
|
|
11248
|
+
}, window.addEventListener("online", this.onlineHandler), window.addEventListener("offline", this.offlineHandler), this.beforeUnloadHandler = () => {
|
|
11249
|
+
this.flushUnloadCleanup("beforeunload");
|
|
11250
|
+
}, this.pageHideHandler = (e) => {
|
|
11251
|
+
e?.persisted || this.flushUnloadCleanup("pagehide");
|
|
11252
|
+
}, window.addEventListener("beforeunload", this.beforeUnloadHandler), window.addEventListener("pagehide", this.pageHideHandler)));
|
|
11249
11253
|
}
|
|
11250
11254
|
open() {
|
|
11251
11255
|
this.mountNode.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
@@ -11255,11 +11259,11 @@ class Ai {
|
|
|
11255
11259
|
}
|
|
11256
11260
|
assertLifecycleRunCurrent(e) {
|
|
11257
11261
|
if (e !== this.lifecycleRunId)
|
|
11258
|
-
throw
|
|
11262
|
+
throw Ii("网页电话已切换到新的连接流程,旧流程不再继续。");
|
|
11259
11263
|
}
|
|
11260
11264
|
emitHostCallback(e, t) {
|
|
11261
11265
|
const i = this.options?.[e];
|
|
11262
|
-
if (
|
|
11266
|
+
if (Ei(i))
|
|
11263
11267
|
try {
|
|
11264
11268
|
i(t);
|
|
11265
11269
|
} catch (s) {
|
|
@@ -11422,7 +11426,7 @@ class Ai {
|
|
|
11422
11426
|
webrtc_url: e.transport,
|
|
11423
11427
|
ice_servers: this.turnIceServers
|
|
11424
11428
|
};
|
|
11425
|
-
this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new
|
|
11429
|
+
this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new hi(t, {
|
|
11426
11430
|
remoteAudioElement: this.refs.audio,
|
|
11427
11431
|
onStateChange: (i, s) => {
|
|
11428
11432
|
this.handleClientState(i, s);
|
|
@@ -11593,7 +11597,7 @@ class Ai {
|
|
|
11593
11597
|
async loadBootstrap() {
|
|
11594
11598
|
if (this.bootstrap)
|
|
11595
11599
|
return this.bootstrap;
|
|
11596
|
-
const e = await fetch(
|
|
11600
|
+
const e = await fetch(K(this.apiBaseUrl, "api/sip/embedded-call-demo-bootstrap"), {
|
|
11597
11601
|
credentials: "include",
|
|
11598
11602
|
cache: "no-store"
|
|
11599
11603
|
});
|
|
@@ -11602,7 +11606,7 @@ class Ai {
|
|
|
11602
11606
|
return this.bootstrap = await e.json(), this.bootstrap;
|
|
11603
11607
|
}
|
|
11604
11608
|
async fetchTurnIceServers() {
|
|
11605
|
-
const e = await fetch(
|
|
11609
|
+
const e = await fetch(K(this.apiBaseUrl, "api/sip/webrtc-turn-credentials"), {
|
|
11606
11610
|
credentials: "include",
|
|
11607
11611
|
cache: "no-store"
|
|
11608
11612
|
});
|
|
@@ -11625,7 +11629,7 @@ class Ai {
|
|
|
11625
11629
|
access_token: this.options.accessToken || void 0
|
|
11626
11630
|
};
|
|
11627
11631
|
t && (i.business_key = t);
|
|
11628
|
-
const s = await fetch(
|
|
11632
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/issue-call-session"), {
|
|
11629
11633
|
method: "POST",
|
|
11630
11634
|
credentials: "include",
|
|
11631
11635
|
cache: "no-store",
|
|
@@ -11679,7 +11683,7 @@ class Ai {
|
|
|
11679
11683
|
access_token: this.options.accessToken || void 0
|
|
11680
11684
|
};
|
|
11681
11685
|
t && (i.business_key = t);
|
|
11682
|
-
const s = await fetch(
|
|
11686
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/issue-widget-standby-session"), {
|
|
11683
11687
|
method: "POST",
|
|
11684
11688
|
credentials: "include",
|
|
11685
11689
|
cache: "no-store",
|
|
@@ -11721,7 +11725,7 @@ class Ai {
|
|
|
11721
11725
|
if (!this.issuedSession?.session_id)
|
|
11722
11726
|
return;
|
|
11723
11727
|
const i = this.issuedSession.session_id;
|
|
11724
|
-
this.markRecentlyReleasedSession(i, t), this.issuedSession = null, await fetch(
|
|
11728
|
+
this.markRecentlyReleasedSession(i, t), this.issuedSession = null, await fetch(K(this.apiBaseUrl, "api/sip/release-call-session"), {
|
|
11725
11729
|
method: "POST",
|
|
11726
11730
|
credentials: "include",
|
|
11727
11731
|
cache: "no-store",
|
|
@@ -11735,6 +11739,36 @@ class Ai {
|
|
|
11735
11739
|
}).catch(() => {
|
|
11736
11740
|
});
|
|
11737
11741
|
}
|
|
11742
|
+
postLifecycleBeacon(e, t) {
|
|
11743
|
+
const i = JSON.stringify(t), s = K(this.apiBaseUrl, e);
|
|
11744
|
+
if (typeof navigator < "u" && typeof navigator.sendBeacon == "function")
|
|
11745
|
+
try {
|
|
11746
|
+
const r = new Blob([i], { type: "application/json" });
|
|
11747
|
+
if (navigator.sendBeacon(s, r))
|
|
11748
|
+
return !0;
|
|
11749
|
+
} catch {
|
|
11750
|
+
}
|
|
11751
|
+
return fetch(s, {
|
|
11752
|
+
method: "POST",
|
|
11753
|
+
credentials: "include",
|
|
11754
|
+
cache: "no-store",
|
|
11755
|
+
keepalive: !0,
|
|
11756
|
+
headers: { "Content-Type": "application/json" },
|
|
11757
|
+
body: i
|
|
11758
|
+
}).catch(() => {
|
|
11759
|
+
}), !0;
|
|
11760
|
+
}
|
|
11761
|
+
flushUnloadCleanup(e) {
|
|
11762
|
+
if (this.unloadCleanupStarted || (this.unloadCleanupStarted = !0, this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), !this.issuedSession?.session_id))
|
|
11763
|
+
return;
|
|
11764
|
+
const t = this.issuedSession.session_id;
|
|
11765
|
+
this.markRecentlyReleasedSession(t, e), this.postLifecycleBeacon("api/sip/release-call-session", {
|
|
11766
|
+
session_id: t,
|
|
11767
|
+
status: "released",
|
|
11768
|
+
reason: e,
|
|
11769
|
+
client_summary: this.buildClientEvidenceSummary("released", { releaseReason: e })
|
|
11770
|
+
}), this.issuedSession = null;
|
|
11771
|
+
}
|
|
11738
11772
|
buildClientEvidenceSummary(e = null, t = null) {
|
|
11739
11773
|
const i = {
|
|
11740
11774
|
runtimeMode: "embedded-widget-runtime",
|
|
@@ -11761,7 +11795,7 @@ class Ai {
|
|
|
11761
11795
|
setAvailabilityState(e, t = "") {
|
|
11762
11796
|
this.availabilityState = e, this.availabilityDetail = t || this.availabilityDetail, this.refs.availability && (this.refs.availability.textContent = t ? `${Te[e] || Te.recovering} · ${t}` : Te[e] || Te.recovering, this.refs.availability.className = `availability availability--${e}`), this.render();
|
|
11763
11797
|
}
|
|
11764
|
-
suppressExpectedClientTeardown(e, t =
|
|
11798
|
+
suppressExpectedClientTeardown(e, t = Si) {
|
|
11765
11799
|
this.expectedClientTeardown = {
|
|
11766
11800
|
reason: e,
|
|
11767
11801
|
expiresAt: Date.now() + t
|
|
@@ -11787,7 +11821,7 @@ class Ai {
|
|
|
11787
11821
|
clearAutoStandbyRecovery() {
|
|
11788
11822
|
this.autoStandbyRecoveryTimer && (window.clearTimeout(this.autoStandbyRecoveryTimer), this.autoStandbyRecoveryTimer = null);
|
|
11789
11823
|
}
|
|
11790
|
-
scheduleAutoStandbyRecovery(e, t =
|
|
11824
|
+
scheduleAutoStandbyRecovery(e, t = bi) {
|
|
11791
11825
|
this.legacyOutboundOnly || this.networkOnline === !1 || this.autoStandbyRecoveryTimer || this.client || this.issuedSession?.session_id || this.finalizing || this.pendingLifecycleMode === "outbound" || this.sessionRecoveryInFlight || this.connectivityRecoveryInFlight || ["requesting", "standbyRequesting", "registering", "calling", "incoming", "connected"].includes(this.state) || (this.autoStandbyRecoveryTimer = window.setTimeout(() => {
|
|
11792
11826
|
this.autoStandbyRecoveryTimer = null, !(this.legacyOutboundOnly || this.networkOnline === !1) && (this.client || this.issuedSession?.session_id || this.finalizing || this.pendingLifecycleMode === "outbound" || (this.appendLog("检测到页面当前不在通话中,开始自动恢复待机。", { reason: e }), this.startStandby({ force: !0 })));
|
|
11793
11827
|
}, t));
|
|
@@ -11800,7 +11834,7 @@ class Ai {
|
|
|
11800
11834
|
markRecentlyReleasedSession(e, t) {
|
|
11801
11835
|
e && (this.pruneRecentlyReleasedSessions(), this.recentlyReleasedSessions.set(e, {
|
|
11802
11836
|
reason: t,
|
|
11803
|
-
expiresAt: Date.now() +
|
|
11837
|
+
expiresAt: Date.now() + vi
|
|
11804
11838
|
}));
|
|
11805
11839
|
}
|
|
11806
11840
|
wasSessionRecentlyReleased(e) {
|
|
@@ -11867,7 +11901,7 @@ class Ai {
|
|
|
11867
11901
|
this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible";
|
|
11868
11902
|
const t = this.availabilityState === "offline";
|
|
11869
11903
|
try {
|
|
11870
|
-
const i = await fetch(
|
|
11904
|
+
const i = await fetch(K(this.apiBaseUrl, "api/sip/touch-widget-presence"), {
|
|
11871
11905
|
method: "POST",
|
|
11872
11906
|
credentials: "include",
|
|
11873
11907
|
cache: "no-store",
|
|
@@ -11922,7 +11956,7 @@ class Ai {
|
|
|
11922
11956
|
return;
|
|
11923
11957
|
const i = this.issuedSession.session_id;
|
|
11924
11958
|
try {
|
|
11925
|
-
const s = await fetch(
|
|
11959
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/touch-call-session"), {
|
|
11926
11960
|
method: "POST",
|
|
11927
11961
|
credentials: "include",
|
|
11928
11962
|
cache: "no-store",
|
|
@@ -11971,7 +12005,7 @@ class Ai {
|
|
|
11971
12005
|
const s = this.issuedSession.session_id, r = i || this.state;
|
|
11972
12006
|
let n = null, o = "";
|
|
11973
12007
|
try {
|
|
11974
|
-
const d = await fetch(
|
|
12008
|
+
const d = await fetch(K(this.apiBaseUrl, "api/sip/report-call-session-event"), {
|
|
11975
12009
|
method: "POST",
|
|
11976
12010
|
credentials: "include",
|
|
11977
12011
|
cache: "no-store",
|
|
@@ -11991,7 +12025,7 @@ class Ai {
|
|
|
11991
12025
|
throw o = p?.detail ? String(p.detail) : "", new Error(o || `事件留证失败:${d.status}`);
|
|
11992
12026
|
}
|
|
11993
12027
|
} catch (d) {
|
|
11994
|
-
await fetch(
|
|
12028
|
+
await fetch(K(this.apiBaseUrl, "api/sip/report-call-session-event-delivery-failure"), {
|
|
11995
12029
|
method: "POST",
|
|
11996
12030
|
credentials: "include",
|
|
11997
12031
|
cache: "no-store",
|
|
@@ -12028,14 +12062,14 @@ class Ai {
|
|
|
12028
12062
|
}
|
|
12029
12063
|
this.touchIssuedSession(e), this.sessionTouchTimer || (this.sessionTouchTimer = window.setInterval(() => {
|
|
12030
12064
|
this.touchIssuedSession(this.state);
|
|
12031
|
-
},
|
|
12065
|
+
}, wi));
|
|
12032
12066
|
}
|
|
12033
12067
|
setState(e, t = "") {
|
|
12034
12068
|
this.state = e, this.refs.status.textContent = t || Q[e] || Q.idle, this.syncAvailabilityState(), this.render(), this.emitHostCallback("onStateChange", this.getSnapshot());
|
|
12035
12069
|
}
|
|
12036
12070
|
appendLog(e, t) {
|
|
12037
12071
|
const i = document.createElement("div");
|
|
12038
|
-
for (i.className = "log", i.textContent =
|
|
12072
|
+
for (i.className = "log", i.textContent = Ti(e, t), this.refs.logs.prepend(i); this.refs.logs.children.length > 8; )
|
|
12039
12073
|
this.refs.logs.lastElementChild?.remove();
|
|
12040
12074
|
}
|
|
12041
12075
|
render() {
|
|
@@ -12045,18 +12079,18 @@ class Ai {
|
|
|
12045
12079
|
this.availabilityState === "offline" ? "status--offline" : this.availabilityState === "recovering" ? "status--recovering" : ""
|
|
12046
12080
|
].filter(Boolean).join(" ")), this.legacyOutboundOnly ? (this.refs.primary.disabled = e, this.refs.primary.textContent = t ? "通话进行中" : "连接并呼叫", this.refs.secondary.disabled = !t && !i, this.refs.secondary.textContent = t ? "挂断并清理" : "断开并清理") : (this.refs.primary.disabled = e || s || this.state === "connected", this.state === "incoming" ? this.refs.primary.textContent = "接听来电" : this.state === "connected" ? this.refs.primary.textContent = "通话进行中" : e || s ? this.availabilityState === "working" ? this.refs.primary.textContent = "正在建立呼叫" : this.availabilityState === "preparing" ? this.refs.primary.textContent = "正在准备网页电话" : this.refs.primary.textContent = this.state === "calling" ? "通话进行中" : "正在恢复网页电话" : this.availabilityState === "offline" ? this.refs.primary.textContent = "网络恢复后再试" : !i || ["idle", "failed", "ended"].includes(this.state) ? this.refs.primary.textContent = "恢复网页电话待机" : this.refs.primary.textContent = "呼叫管理员", this.refs.secondary.disabled = !i, this.refs.secondary.textContent = this.state === "incoming" ? "拒接来电" : this.state === "connected" ? "挂断并恢复待机" : "断开电话");
|
|
12047
12081
|
const r = this.options.siteKey || this.bootstrap?.default_site_key || "等待服务端返回", n = this.issuedSession?.resolved_business_key || te(this.options, this.bootstrap) || "等待服务端返回";
|
|
12048
|
-
this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${n};站点键:${r}` : this.refs.meta.textContent = `站点键:${r};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${n}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.refs.hint.textContent = this.isMobileViewport ?
|
|
12082
|
+
this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${n};站点键:${r}` : this.refs.meta.textContent = `站点键:${r};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${n}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.refs.hint.textContent = this.isMobileViewport ? mi : "桌面网页可直接使用;若宿主站点启用了来源白名单或接入令牌,请按站点配置提供对应参数。";
|
|
12049
12083
|
}
|
|
12050
12084
|
async destroy() {
|
|
12051
|
-
await this.disconnectAndCleanup("destroy-widget"), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingIncomingCall = null, typeof window < "u" && (this.onlineHandler && (window.removeEventListener("online", this.onlineHandler), this.onlineHandler = null), this.offlineHandler && (window.removeEventListener("offline", this.offlineHandler), this.offlineHandler = null)), this.e2eBridgeEnabled && typeof window < "u" && window.__embeddedCallWidgetE2E__ && delete window.__embeddedCallWidgetE2E__, this.shadowRoot.innerHTML = "";
|
|
12085
|
+
await this.disconnectAndCleanup("destroy-widget"), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingIncomingCall = null, typeof window < "u" && (this.onlineHandler && (window.removeEventListener("online", this.onlineHandler), this.onlineHandler = null), this.offlineHandler && (window.removeEventListener("offline", this.offlineHandler), this.offlineHandler = null), this.beforeUnloadHandler && (window.removeEventListener("beforeunload", this.beforeUnloadHandler), this.beforeUnloadHandler = null), this.pageHideHandler && (window.removeEventListener("pagehide", this.pageHideHandler), this.pageHideHandler = null)), this.e2eBridgeEnabled && typeof window < "u" && window.__embeddedCallWidgetE2E__ && delete window.__embeddedCallWidgetE2E__, this.shadowRoot.innerHTML = "";
|
|
12052
12086
|
}
|
|
12053
12087
|
}
|
|
12054
|
-
function
|
|
12055
|
-
return new
|
|
12088
|
+
function Ai(a) {
|
|
12089
|
+
return new _i(a);
|
|
12056
12090
|
}
|
|
12057
12091
|
typeof window < "u" && (window.__EmbeddedCallWidgetRuntime__ = {
|
|
12058
|
-
createEmbeddedCallWidgetRuntime:
|
|
12092
|
+
createEmbeddedCallWidgetRuntime: Ai
|
|
12059
12093
|
});
|
|
12060
12094
|
export {
|
|
12061
|
-
|
|
12095
|
+
Ai as createEmbeddedCallWidgetRuntime
|
|
12062
12096
|
};
|