@shenyin/embedded-call-widget 2.6.11 → 2.6.12
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 +21 -21
- package/embedded-call-widget-runtime.js +356 -337
- package/manifest.json +11 -11
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
1
|
+
const kt = "0.21.1";
|
|
2
2
|
class ge extends Error {
|
|
3
3
|
constructor(e) {
|
|
4
4
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class ze extends ge {
|
|
8
8
|
constructor(e) {
|
|
9
9
|
super(e || "Unsupported content type.");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class Ce extends ge {
|
|
13
13
|
/** @internal */
|
|
14
14
|
constructor(e) {
|
|
15
15
|
super(e || "Request pending.");
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class Pt extends ge {
|
|
19
19
|
constructor(e) {
|
|
20
20
|
super(e || "Unspecified session description handler error.");
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class Ue extends ge {
|
|
24
24
|
constructor() {
|
|
25
25
|
super("The session has terminated.");
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class be extends ge {
|
|
29
29
|
constructor(e) {
|
|
30
30
|
super(e || "An error occurred during state transition.");
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class Ht {
|
|
34
34
|
/** @internal */
|
|
35
35
|
constructor(e) {
|
|
36
36
|
this.incomingAckRequest = e;
|
|
@@ -40,7 +40,7 @@ class kt {
|
|
|
40
40
|
return this.incomingAckRequest.message;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class Mt {
|
|
44
44
|
/** @internal */
|
|
45
45
|
constructor(e) {
|
|
46
46
|
this.incomingByeRequest = e;
|
|
@@ -58,7 +58,7 @@ class Pt {
|
|
|
58
58
|
return this.incomingByeRequest.reject(e), Promise.resolve();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class qt {
|
|
62
62
|
/** @internal */
|
|
63
63
|
constructor(e) {
|
|
64
64
|
this.incomingCancelRequest = e;
|
|
@@ -68,7 +68,7 @@ class Ht {
|
|
|
68
68
|
return this.incomingCancelRequest;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class Ee {
|
|
72
72
|
constructor() {
|
|
73
73
|
this.listeners = new Array();
|
|
74
74
|
}
|
|
@@ -130,7 +130,7 @@ class Ce {
|
|
|
130
130
|
return this.addListener(e, { once: !0 });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
class
|
|
133
|
+
class Ot {
|
|
134
134
|
/** @internal */
|
|
135
135
|
constructor(e) {
|
|
136
136
|
this.incomingInfoRequest = e;
|
|
@@ -148,7 +148,7 @@ class Mt {
|
|
|
148
148
|
return this.incomingInfoRequest.reject(e), Promise.resolve();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
class
|
|
151
|
+
class pt {
|
|
152
152
|
constructor(e) {
|
|
153
153
|
this.parameters = {};
|
|
154
154
|
for (const t in e)
|
|
@@ -174,7 +174,7 @@ class gt {
|
|
|
174
174
|
this.parameters = {};
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
class U extends
|
|
177
|
+
class U extends pt {
|
|
178
178
|
/**
|
|
179
179
|
* Constructor
|
|
180
180
|
* @param uri -
|
|
@@ -204,7 +204,7 @@ class U extends gt {
|
|
|
204
204
|
return e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
class X extends
|
|
207
|
+
class X extends pt {
|
|
208
208
|
/**
|
|
209
209
|
* Constructor
|
|
210
210
|
* @param scheme -
|
|
@@ -333,7 +333,7 @@ class X extends gt {
|
|
|
333
333
|
return t[r] && (r = t[r]), r;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function rt(o, e) {
|
|
337
337
|
if (o.scheme !== e.scheme || o.user !== e.user || o.host !== e.host || o.port !== e.port)
|
|
338
338
|
return !1;
|
|
339
339
|
function t(r, n) {
|
|
@@ -352,7 +352,7 @@ function it(o, e) {
|
|
|
352
352
|
}
|
|
353
353
|
return !0;
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function Le(o, e, t) {
|
|
356
356
|
return t = t || " ", o.length > e ? o : (e -= o.length, t += t.repeat(e), o + t.slice(0, e));
|
|
357
357
|
}
|
|
358
358
|
class fe extends Error {
|
|
@@ -417,12 +417,12 @@ class fe extends Error {
|
|
|
417
417
|
}
|
|
418
418
|
let r = this.location.start, n = this.location.source + ":" + r.line + ":" + r.column;
|
|
419
419
|
if (i) {
|
|
420
|
-
let a = this.location.end, d =
|
|
420
|
+
let a = this.location.end, d = Le("", r.line.toString().length, " "), f = i[r.line - 1], h = r.line === a.line ? a.column : f.length + 1;
|
|
421
421
|
t += `
|
|
422
422
|
--> ` + n + `
|
|
423
423
|
` + d + ` |
|
|
424
424
|
` + r.line + " | " + f + `
|
|
425
|
-
` + d + " | " +
|
|
425
|
+
` + d + " | " + Le("", r.column - 1, " ") + Le("", h - r.column, "^");
|
|
426
426
|
} else
|
|
427
427
|
t += `
|
|
428
428
|
at ` + n;
|
|
@@ -430,7 +430,7 @@ class fe extends Error {
|
|
|
430
430
|
return t;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function Ft(o, 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;
|
|
@@ -943,7 +943,7 @@ function qt(o, e) {
|
|
|
943
943
|
return y;
|
|
944
944
|
},
|
|
945
945
|
function(l, y) {
|
|
946
|
-
return
|
|
946
|
+
return $t(l, y);
|
|
947
947
|
},
|
|
948
948
|
function(l) {
|
|
949
949
|
e = e || { data: {} }, e.startRule === "Require" && (e.data = l || []);
|
|
@@ -1331,7 +1331,7 @@ function qt(o, e) {
|
|
|
1331
1331
|
return o.substring(f, d);
|
|
1332
1332
|
}
|
|
1333
1333
|
function de() {
|
|
1334
|
-
return
|
|
1334
|
+
return Ne(f, d);
|
|
1335
1335
|
}
|
|
1336
1336
|
function p(l, y) {
|
|
1337
1337
|
return { type: "literal", text: l, ignoreCase: y };
|
|
@@ -1339,10 +1339,10 @@ function qt(o, e) {
|
|
|
1339
1339
|
function A(l, y, u) {
|
|
1340
1340
|
return { type: "class", parts: l, inverted: y, ignoreCase: u };
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function Fe() {
|
|
1343
1343
|
return { type: "end" };
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1345
|
+
function et(l) {
|
|
1346
1346
|
let y = h[l], u;
|
|
1347
1347
|
if (y)
|
|
1348
1348
|
return y;
|
|
@@ -1355,8 +1355,8 @@ function qt(o, e) {
|
|
|
1355
1355
|
o.charCodeAt(u) === 10 ? (y.line++, y.column = 1) : y.column++, u++;
|
|
1356
1356
|
return h[l] = y, y;
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1359
|
-
const u =
|
|
1358
|
+
function Ne(l, y) {
|
|
1359
|
+
const u = et(l), V = et(y);
|
|
1360
1360
|
return {
|
|
1361
1361
|
source: i,
|
|
1362
1362
|
start: {
|
|
@@ -1371,22 +1371,22 @@ function qt(o, e) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function tt(l) {
|
|
1375
1375
|
d < w || (d > w && (w = d, S = []), S.push(l));
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function At(l, y, u) {
|
|
1378
1378
|
return new fe(fe.buildMessage(l, y), l, y, u);
|
|
1379
1379
|
}
|
|
1380
1380
|
function c(l) {
|
|
1381
1381
|
return l.split("").map((y) => y.charCodeAt(0) - 32);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function it(l) {
|
|
1384
1384
|
const y = a[l];
|
|
1385
1385
|
let u = 0;
|
|
1386
1386
|
const V = [];
|
|
1387
1387
|
let D = y.length;
|
|
1388
1388
|
const z = [], C = [];
|
|
1389
|
-
let
|
|
1389
|
+
let st;
|
|
1390
1390
|
for (; ; ) {
|
|
1391
1391
|
for (; u < D; )
|
|
1392
1392
|
switch (y[u]) {
|
|
@@ -1460,7 +1460,7 @@ function qt(o, e) {
|
|
|
1460
1460
|
C.push(n[y[u + 1]]), d += n[y[u + 1]].length, u += 2;
|
|
1461
1461
|
break;
|
|
1462
1462
|
case 23:
|
|
1463
|
-
C.push(t), x === 0 &&
|
|
1463
|
+
C.push(t), x === 0 && tt(n[y[u + 1]]), u += 2;
|
|
1464
1464
|
break;
|
|
1465
1465
|
case 24:
|
|
1466
1466
|
f = C[C.length - 1 - y[u + 1]], u += 2;
|
|
@@ -1469,12 +1469,12 @@ function qt(o, e) {
|
|
|
1469
1469
|
f = d, u++;
|
|
1470
1470
|
break;
|
|
1471
1471
|
case 26:
|
|
1472
|
-
|
|
1473
|
-
return C[C.length - 1 -
|
|
1474
|
-
}), C.splice(C.length - y[u + 2], y[u + 2], n[y[u + 1]].apply(null,
|
|
1472
|
+
st = y.slice(u + 4, u + 4 + y[u + 3]).map(function(Dt) {
|
|
1473
|
+
return C[C.length - 1 - Dt];
|
|
1474
|
+
}), C.splice(C.length - y[u + 2], y[u + 2], n[y[u + 1]].apply(null, st)), u += 4 + y[u + 3];
|
|
1475
1475
|
break;
|
|
1476
1476
|
case 27:
|
|
1477
|
-
C.push(
|
|
1477
|
+
C.push(it(y[u + 1])), u += 2;
|
|
1478
1478
|
break;
|
|
1479
1479
|
case 28:
|
|
1480
1480
|
x++, u++;
|
|
@@ -1493,20 +1493,20 @@ function qt(o, e) {
|
|
|
1493
1493
|
return C[0];
|
|
1494
1494
|
}
|
|
1495
1495
|
e.data = {};
|
|
1496
|
-
function
|
|
1496
|
+
function $t(l, y) {
|
|
1497
1497
|
return [l].concat(y);
|
|
1498
1498
|
}
|
|
1499
|
-
if (I =
|
|
1499
|
+
if (I = it(r), I !== t && d === o.length)
|
|
1500
1500
|
return I;
|
|
1501
|
-
throw I !== t && d < o.length &&
|
|
1501
|
+
throw I !== t && d < o.length && tt(Fe()), At(S, w < o.length ? o.charAt(w) : null, w < o.length ? Ne(w, w + 1) : Ne(w, w));
|
|
1502
1502
|
}
|
|
1503
|
-
const
|
|
1503
|
+
const Nt = Ft;
|
|
1504
1504
|
var P;
|
|
1505
1505
|
(function(o) {
|
|
1506
1506
|
function e(s, r) {
|
|
1507
1507
|
const n = { startRule: r };
|
|
1508
1508
|
try {
|
|
1509
|
-
|
|
1509
|
+
Nt(s, n);
|
|
1510
1510
|
} catch {
|
|
1511
1511
|
n.data = -1;
|
|
1512
1512
|
}
|
|
@@ -1524,7 +1524,7 @@ var P;
|
|
|
1524
1524
|
}
|
|
1525
1525
|
o.URIParse = i;
|
|
1526
1526
|
})(P = P || (P = {}));
|
|
1527
|
-
const
|
|
1527
|
+
const Ut = {
|
|
1528
1528
|
100: "Trying",
|
|
1529
1529
|
180: "Ringing",
|
|
1530
1530
|
181: "Call Is Being Forwarded",
|
|
@@ -1605,10 +1605,10 @@ function le(o, e = 32) {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
return t;
|
|
1607
1607
|
}
|
|
1608
|
-
function
|
|
1609
|
-
return
|
|
1608
|
+
function Me(o) {
|
|
1609
|
+
return Ut[o] || "";
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1611
|
+
function qe() {
|
|
1612
1612
|
return le(10);
|
|
1613
1613
|
}
|
|
1614
1614
|
function J(o) {
|
|
@@ -1625,10 +1625,10 @@ function J(o) {
|
|
|
1625
1625
|
r !== 0 && (s += "-"), s += t[r].charAt(0).toUpperCase() + t[r].substring(1);
|
|
1626
1626
|
return e[s] && (s = e[s]), s;
|
|
1627
1627
|
}
|
|
1628
|
-
function
|
|
1628
|
+
function _e(o) {
|
|
1629
1629
|
return encodeURIComponent(o).replace(/%[A-F\d]{2}/g, "U").length;
|
|
1630
1630
|
}
|
|
1631
|
-
class
|
|
1631
|
+
class mt {
|
|
1632
1632
|
constructor() {
|
|
1633
1633
|
this.headers = {};
|
|
1634
1634
|
}
|
|
@@ -1725,12 +1725,12 @@ class ft {
|
|
|
1725
1725
|
return this.data;
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
1728
|
-
class pe extends
|
|
1728
|
+
class pe extends mt {
|
|
1729
1729
|
constructor() {
|
|
1730
1730
|
super();
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
class ce extends
|
|
1733
|
+
class ce extends mt {
|
|
1734
1734
|
constructor() {
|
|
1735
1735
|
super();
|
|
1736
1736
|
}
|
|
@@ -1740,7 +1740,7 @@ class ue {
|
|
|
1740
1740
|
this.headers = {}, this.extraHeaders = [], this.options = ue.getDefaultOptions(), r && (this.options = Object.assign(Object.assign({}, this.options), r), this.options.optionTags && this.options.optionTags.length && (this.options.optionTags = this.options.optionTags.slice()), this.options.routeSet && this.options.routeSet.length && (this.options.routeSet = this.options.routeSet.slice())), n && n.length && (this.extraHeaders = n.slice()), a && (this.body = {
|
|
1741
1741
|
body: a.content,
|
|
1742
1742
|
contentType: a.contentType
|
|
1743
|
-
}), this.method = e, this.ruri = t.clone(), this.fromURI = i.clone(), this.fromTag = this.options.fromTag ? this.options.fromTag :
|
|
1743
|
+
}), this.method = e, this.ruri = t.clone(), this.fromURI = i.clone(), this.fromTag = this.options.fromTag ? this.options.fromTag : qe(), this.from = ue.makeNameAddrHeader(this.fromURI, this.options.fromDisplayName, this.fromTag), this.toURI = s.clone(), this.toTag = this.options.toTag, this.to = ue.makeNameAddrHeader(this.toURI, this.options.toDisplayName, this.toTag), this.callId = this.options.callId ? this.options.callId : this.options.callIdPrefix + le(15), this.cseq = this.options.cseq, this.setHeader("route", this.options.routeSet), this.setHeader("via", ""), this.setHeader("to", this.to.toString()), this.setHeader("from", this.from.toString()), this.setHeader("cseq", this.cseq + " " + this.method), this.setHeader("call-id", this.callId), this.setHeader("max-forwards", "70");
|
|
1744
1744
|
}
|
|
1745
1745
|
/** Get a copy of the default options. */
|
|
1746
1746
|
static getDefaultOptions() {
|
|
@@ -1858,10 +1858,10 @@ class ue {
|
|
|
1858
1858
|
`;
|
|
1859
1859
|
return e += "Supported: " + this.options.optionTags.join(", ") + `\r
|
|
1860
1860
|
`, e += "User-Agent: " + this.options.userAgentString + `\r
|
|
1861
|
-
`, this.body ? typeof this.body == "string" ? (e += "Content-Length: " +
|
|
1861
|
+
`, this.body ? typeof this.body == "string" ? (e += "Content-Length: " + _e(this.body) + `\r
|
|
1862
1862
|
\r
|
|
1863
1863
|
`, e += this.body) : this.body.body && this.body.contentType ? (e += "Content-Type: " + this.body.contentType + `\r
|
|
1864
|
-
`, e += "Content-Length: " +
|
|
1864
|
+
`, e += "Content-Length: " + _e(this.body.body) + `\r
|
|
1865
1865
|
\r
|
|
1866
1866
|
`, e += this.body.body) : e += `Content-Length: 0\r
|
|
1867
1867
|
\r
|
|
@@ -1870,17 +1870,17 @@ class ue {
|
|
|
1870
1870
|
`, e;
|
|
1871
1871
|
}
|
|
1872
1872
|
}
|
|
1873
|
-
function
|
|
1873
|
+
function wt(o) {
|
|
1874
1874
|
return o === "application/sdp" ? "session" : "render";
|
|
1875
1875
|
}
|
|
1876
|
-
function
|
|
1876
|
+
function ke(o) {
|
|
1877
1877
|
const e = typeof o == "string" ? o : o.body, t = typeof o == "string" ? "application/sdp" : o.contentType;
|
|
1878
|
-
return { contentDisposition:
|
|
1878
|
+
return { contentDisposition: wt(t), contentType: t, content: e };
|
|
1879
1879
|
}
|
|
1880
|
-
function
|
|
1880
|
+
function yt(o) {
|
|
1881
1881
|
return o && typeof o.content == "string" && typeof o.contentType == "string" && o.contentDisposition === void 0 ? !0 : typeof o.contentDisposition == "string";
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function Te(o) {
|
|
1884
1884
|
let e, t, i;
|
|
1885
1885
|
if (o instanceof pe && o.body) {
|
|
1886
1886
|
const s = o.parseHeader("Content-Disposition");
|
|
@@ -1900,8 +1900,8 @@ function Se(o) {
|
|
|
1900
1900
|
throw new Error("Header content type header does not equal body content type.");
|
|
1901
1901
|
t = o.body.contentType, i = o.body.body;
|
|
1902
1902
|
}
|
|
1903
|
-
if (
|
|
1904
|
-
if (t && !e && (e =
|
|
1903
|
+
if (yt(o) && (e = o.contentDisposition, t = o.contentType, i = o.content), !!i) {
|
|
1904
|
+
if (t && !e && (e = wt(t)), !e)
|
|
1905
1905
|
throw new Error("Content disposition undefined.");
|
|
1906
1906
|
if (!t)
|
|
1907
1907
|
throw new Error("Content type undefined.");
|
|
@@ -1920,16 +1920,16 @@ var b;
|
|
|
1920
1920
|
(function(o) {
|
|
1921
1921
|
o.Initial = "Initial", o.HaveLocalOffer = "HaveLocalOffer", o.HaveRemoteOffer = "HaveRemoteOffer", o.Stable = "Stable", o.Closed = "Closed";
|
|
1922
1922
|
})(b = b || (b = {}));
|
|
1923
|
-
const ee = 500,
|
|
1923
|
+
const ee = 500, Lt = 4e3, nt = 5e3, q = {
|
|
1924
1924
|
T1: ee,
|
|
1925
|
-
T2:
|
|
1925
|
+
T2: Lt,
|
|
1926
1926
|
TIMER_B: 64 * ee,
|
|
1927
1927
|
TIMER_D: 0 * ee,
|
|
1928
1928
|
TIMER_F: 64 * ee,
|
|
1929
1929
|
TIMER_H: 64 * ee,
|
|
1930
|
-
TIMER_I: 0 *
|
|
1930
|
+
TIMER_I: 0 * nt,
|
|
1931
1931
|
TIMER_J: 0 * ee,
|
|
1932
|
-
TIMER_K: 0 *
|
|
1932
|
+
TIMER_K: 0 * nt,
|
|
1933
1933
|
TIMER_L: 64 * ee,
|
|
1934
1934
|
TIMER_M: 64 * ee,
|
|
1935
1935
|
TIMER_N: 64 * ee,
|
|
@@ -1959,7 +1959,7 @@ const oe = [
|
|
|
1959
1959
|
v.REGISTER,
|
|
1960
1960
|
v.SUBSCRIBE
|
|
1961
1961
|
];
|
|
1962
|
-
class
|
|
1962
|
+
class bt {
|
|
1963
1963
|
/** @internal */
|
|
1964
1964
|
constructor(e) {
|
|
1965
1965
|
this.incomingMessageRequest = e;
|
|
@@ -1977,7 +1977,7 @@ class wt {
|
|
|
1977
1977
|
return this.incomingMessageRequest.reject(e), Promise.resolve();
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
|
-
class
|
|
1980
|
+
class Ye {
|
|
1981
1981
|
/** @internal */
|
|
1982
1982
|
constructor(e) {
|
|
1983
1983
|
this.incomingNotifyRequest = e;
|
|
@@ -1995,7 +1995,7 @@ class ze {
|
|
|
1995
1995
|
return this.incomingNotifyRequest.reject(e), Promise.resolve();
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
|
-
class
|
|
1998
|
+
class Bt {
|
|
1999
1999
|
/** @internal */
|
|
2000
2000
|
constructor(e, t) {
|
|
2001
2001
|
this.incomingReferRequest = e, this.session = t;
|
|
@@ -2060,7 +2060,7 @@ class me {
|
|
|
2060
2060
|
* @internal
|
|
2061
2061
|
*/
|
|
2062
2062
|
constructor(e, t = {}) {
|
|
2063
|
-
this.pendingReinvite = !1, this.pendingReinviteAck = !1, this._state = m.Initial, this.delegate = t.delegate, this._stateEventEmitter = new
|
|
2063
|
+
this.pendingReinvite = !1, this.pendingReinviteAck = !1, this._state = m.Initial, this.delegate = t.delegate, this._stateEventEmitter = new Ee(), this._userAgent = e;
|
|
2064
2064
|
}
|
|
2065
2065
|
/**
|
|
2066
2066
|
* Destructor.
|
|
@@ -2257,11 +2257,11 @@ class me {
|
|
|
2257
2257
|
if (this.logger.log("Session.invite"), this.state !== m.Established)
|
|
2258
2258
|
return Promise.reject(new Error(`Invalid session state ${this.state}`));
|
|
2259
2259
|
if (this.pendingReinvite)
|
|
2260
|
-
return Promise.reject(new
|
|
2260
|
+
return Promise.reject(new Ce("Reinvite in progress. Please wait until complete, then try again."));
|
|
2261
2261
|
this.pendingReinvite = !0, e.sessionDescriptionHandlerModifiers && (this.sessionDescriptionHandlerModifiersReInvite = e.sessionDescriptionHandlerModifiers), e.sessionDescriptionHandlerOptions && (this.sessionDescriptionHandlerOptionsReInvite = e.sessionDescriptionHandlerOptions);
|
|
2262
2262
|
const t = {
|
|
2263
2263
|
onAccept: (r) => {
|
|
2264
|
-
const n =
|
|
2264
|
+
const n = Te(r.message);
|
|
2265
2265
|
if (!n) {
|
|
2266
2266
|
this.logger.error("Received 2xx response to re-INVITE without a session description"), this.ackAndBye(r, 400, "Missing session description"), this.stateTransition(m.Terminated), this.pendingReinvite = !1;
|
|
2267
2267
|
return;
|
|
@@ -2454,7 +2454,7 @@ class me {
|
|
|
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 Ht(e);
|
|
2458
2458
|
this.delegate.onAck(s);
|
|
2459
2459
|
}
|
|
2460
2460
|
switch (this.pendingReinviteAck = !1, t.signalingState) {
|
|
@@ -2464,7 +2464,7 @@ class me {
|
|
|
2464
2464
|
return t.bye(void 0, { extraHeaders: s }), this.stateTransition(m.Terminated), Promise.resolve();
|
|
2465
2465
|
}
|
|
2466
2466
|
case b.Stable: {
|
|
2467
|
-
const s =
|
|
2467
|
+
const s = Te(e.message);
|
|
2468
2468
|
return s ? s.contentDisposition === "render" ? (this._renderbody = s.content, this._rendertype = s.contentType, Promise.resolve()) : s.contentDisposition !== "session" ? Promise.resolve() : this.setAnswer(s, i).catch((r) => {
|
|
2469
2469
|
this.logger.error(r.message);
|
|
2470
2470
|
const n = ["Reason: " + this.getReasonHeaderValue(488, "Bad Media Description")];
|
|
@@ -2497,7 +2497,7 @@ class me {
|
|
|
2497
2497
|
return;
|
|
2498
2498
|
}
|
|
2499
2499
|
if (this.delegate && this.delegate.onBye) {
|
|
2500
|
-
const t = new
|
|
2500
|
+
const t = new Mt(e);
|
|
2501
2501
|
this.delegate.onBye(t);
|
|
2502
2502
|
} else
|
|
2503
2503
|
e.accept();
|
|
@@ -2513,7 +2513,7 @@ class me {
|
|
|
2513
2513
|
return;
|
|
2514
2514
|
}
|
|
2515
2515
|
if (this.delegate && this.delegate.onInfo) {
|
|
2516
|
-
const t = new
|
|
2516
|
+
const t = new Ot(e);
|
|
2517
2517
|
this.delegate.onInfo(t);
|
|
2518
2518
|
} else
|
|
2519
2519
|
e.accept();
|
|
@@ -2576,7 +2576,7 @@ class me {
|
|
|
2576
2576
|
return;
|
|
2577
2577
|
}
|
|
2578
2578
|
if (this.delegate && this.delegate.onMessage) {
|
|
2579
|
-
const t = new
|
|
2579
|
+
const t = new bt(e);
|
|
2580
2580
|
this.delegate.onMessage(t);
|
|
2581
2581
|
} else
|
|
2582
2582
|
e.accept();
|
|
@@ -2591,12 +2591,12 @@ class me {
|
|
|
2591
2591
|
return;
|
|
2592
2592
|
}
|
|
2593
2593
|
if (this.onNotify) {
|
|
2594
|
-
const t = new
|
|
2594
|
+
const t = new Ye(e);
|
|
2595
2595
|
this.onNotify(t);
|
|
2596
2596
|
return;
|
|
2597
2597
|
}
|
|
2598
2598
|
if (this.delegate && this.delegate.onNotify) {
|
|
2599
|
-
const t = new
|
|
2599
|
+
const t = new Ye(e);
|
|
2600
2600
|
this.delegate.onNotify(t);
|
|
2601
2601
|
} else
|
|
2602
2602
|
e.accept();
|
|
@@ -2626,7 +2626,7 @@ class me {
|
|
|
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 Bt(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
|
}));
|
|
@@ -2641,7 +2641,7 @@ class me {
|
|
|
2641
2641
|
generateResponseOfferAnswer(e, t) {
|
|
2642
2642
|
if (this.dialog)
|
|
2643
2643
|
return this.generateResponseOfferAnswerInDialog(t);
|
|
2644
|
-
const i =
|
|
2644
|
+
const i = Te(e.message);
|
|
2645
2645
|
return !i || i.contentDisposition !== "session" ? this.getOffer(t) : this.setOfferAndGetAnswer(i, t);
|
|
2646
2646
|
}
|
|
2647
2647
|
/**
|
|
@@ -2677,7 +2677,7 @@ class me {
|
|
|
2677
2677
|
getOffer(e) {
|
|
2678
2678
|
const t = this.setupSessionDescriptionHandler(), i = e.sessionDescriptionHandlerOptions, s = e.sessionDescriptionHandlerModifiers;
|
|
2679
2679
|
try {
|
|
2680
|
-
return t.getDescription(i, s).then((r) =>
|
|
2680
|
+
return t.getDescription(i, s).then((r) => ke(r)).catch((r) => {
|
|
2681
2681
|
this.logger.error("Session.getOffer: SDH getDescription rejected...");
|
|
2682
2682
|
const n = r instanceof Error ? r : new Error("Session.getOffer unknown error.");
|
|
2683
2683
|
throw this.logger.error(n.message), n;
|
|
@@ -2716,7 +2716,7 @@ class me {
|
|
|
2716
2716
|
const i = this.setupSessionDescriptionHandler(), s = t.sessionDescriptionHandlerOptions, r = t.sessionDescriptionHandlerModifiers;
|
|
2717
2717
|
try {
|
|
2718
2718
|
if (!i.hasDescription(e.contentType))
|
|
2719
|
-
return Promise.reject(new
|
|
2719
|
+
return Promise.reject(new ze());
|
|
2720
2720
|
} catch (n) {
|
|
2721
2721
|
this.logger.error("Session.setAnswer: SDH hasDescription threw...");
|
|
2722
2722
|
const a = n instanceof Error ? n : new Error(n);
|
|
@@ -2742,14 +2742,14 @@ class me {
|
|
|
2742
2742
|
const i = this.setupSessionDescriptionHandler(), s = t.sessionDescriptionHandlerOptions, r = t.sessionDescriptionHandlerModifiers;
|
|
2743
2743
|
try {
|
|
2744
2744
|
if (!i.hasDescription(e.contentType))
|
|
2745
|
-
return Promise.reject(new
|
|
2745
|
+
return Promise.reject(new ze());
|
|
2746
2746
|
} catch (n) {
|
|
2747
2747
|
this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");
|
|
2748
2748
|
const a = n instanceof Error ? n : new Error(n);
|
|
2749
2749
|
return this.logger.error(a.message), Promise.reject(a);
|
|
2750
2750
|
}
|
|
2751
2751
|
try {
|
|
2752
|
-
return i.setDescription(e.content, s, r).then(() => i.getDescription(s, r)).then((n) =>
|
|
2752
|
+
return i.setDescription(e.content, s, r).then(() => i.getDescription(s, r)).then((n) => ke(n)).catch((n) => {
|
|
2753
2753
|
this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");
|
|
2754
2754
|
const a = n instanceof Error ? n : new Error("Session.setOfferAndGetAnswer unknown error.");
|
|
2755
2755
|
throw this.logger.error(a.message), a;
|
|
@@ -2819,7 +2819,7 @@ class me {
|
|
|
2819
2819
|
}
|
|
2820
2820
|
getReasonHeaderValue(e, t) {
|
|
2821
2821
|
const i = e;
|
|
2822
|
-
let s =
|
|
2822
|
+
let s = Me(e);
|
|
2823
2823
|
return !s && t && (s = t), "SIP;cause=" + i + ';text="' + s + '"';
|
|
2824
2824
|
}
|
|
2825
2825
|
referExtraHeaders(e) {
|
|
@@ -2843,7 +2843,7 @@ var K;
|
|
|
2843
2843
|
(function(o) {
|
|
2844
2844
|
o.Required = "Required", o.Supported = "Supported", o.Unsupported = "Unsupported";
|
|
2845
2845
|
})(K = K || (K = {}));
|
|
2846
|
-
const
|
|
2846
|
+
const jt = {
|
|
2847
2847
|
"100rel": !0,
|
|
2848
2848
|
199: !0,
|
|
2849
2849
|
answermode: !0,
|
|
@@ -3030,10 +3030,10 @@ class he extends me {
|
|
|
3030
3030
|
const n = new Error(`Invalid session state ${this.state}`);
|
|
3031
3031
|
return this.logger.error(n.message), Promise.reject(n);
|
|
3032
3032
|
}
|
|
3033
|
-
const t = e.statusCode || 480, i = e.reasonPhrase ? e.reasonPhrase :
|
|
3033
|
+
const t = e.statusCode || 480, i = e.reasonPhrase ? e.reasonPhrase : Me(t), s = e.extraHeaders || [];
|
|
3034
3034
|
if (t < 300 || t > 699)
|
|
3035
3035
|
throw new TypeError("Invalid statusCode: " + t);
|
|
3036
|
-
const r = e.body ?
|
|
3036
|
+
const r = e.body ? ke(e.body) : void 0;
|
|
3037
3037
|
return t < 400 ? this.incomingInviteRequest.redirect([], { statusCode: t, reasonPhrase: i, extraHeaders: s, body: r }) : this.incomingInviteRequest.reject({ statusCode: t, reasonPhrase: i, extraHeaders: s, body: r }), this.stateTransition(m.Terminated), Promise.resolve();
|
|
3038
3038
|
}
|
|
3039
3039
|
/**
|
|
@@ -3049,7 +3049,7 @@ class he extends me {
|
|
|
3049
3049
|
return;
|
|
3050
3050
|
}
|
|
3051
3051
|
if (this.delegate && this.delegate.onCancel) {
|
|
3052
|
-
const t = new
|
|
3052
|
+
const t = new qt(e);
|
|
3053
3053
|
this.delegate.onCancel(t);
|
|
3054
3054
|
}
|
|
3055
3055
|
this.isCanceled = !0, this.incomingInviteRequest.reject({ statusCode: 487 }), this.stateTransition(m.Terminated);
|
|
@@ -3060,7 +3060,7 @@ class he extends me {
|
|
|
3060
3060
|
handlePrackOfferAnswer(e) {
|
|
3061
3061
|
if (!this.dialog)
|
|
3062
3062
|
throw new Error("Dialog undefined.");
|
|
3063
|
-
const t =
|
|
3063
|
+
const t = Te(e.message);
|
|
3064
3064
|
if (!t || t.contentDisposition !== "session")
|
|
3065
3065
|
return Promise.resolve(void 0);
|
|
3066
3066
|
const i = {
|
|
@@ -3092,7 +3092,7 @@ class he extends me {
|
|
|
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
|
|
3095
|
+
if (e instanceof Error ? this.logger.error(e.message) : this.logger.error(e), e instanceof ze ? (this.logger.error("A session description handler occurred while sending response (content type unsupported"), t = 415) : e instanceof Pt ? this.logger.error("A session description handler occurred while sending response") : e instanceof Ue ? this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)") : e instanceof ne && 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) {
|
|
@@ -3129,7 +3129,7 @@ class he extends me {
|
|
|
3129
3129
|
* @param options - Options bucket.
|
|
3130
3130
|
*/
|
|
3131
3131
|
sendProgress(e = {}) {
|
|
3132
|
-
const t = e.statusCode || 180, i = e.reasonPhrase, s = (e.extraHeaders || []).slice(), r = e.body ?
|
|
3132
|
+
const t = e.statusCode || 180, i = e.reasonPhrase, s = (e.extraHeaders || []).slice(), r = e.body ? ke(e.body) : void 0;
|
|
3133
3133
|
if (t === 183 && !r)
|
|
3134
3134
|
return this.sendProgressWithSDP(e);
|
|
3135
3135
|
try {
|
|
@@ -3177,14 +3177,14 @@ class he extends me {
|
|
|
3177
3177
|
h = p, clearTimeout(x), clearTimeout(de), this.waitingForPrack && (this.waitingForPrack = !1, this.handlePrackOfferAnswer(h).then((A) => {
|
|
3178
3178
|
try {
|
|
3179
3179
|
w = h.accept({ statusCode: 200, body: A }), this.prackArrived(), a({ prackRequest: h, prackResponse: w, progressResponse: f });
|
|
3180
|
-
} catch (
|
|
3181
|
-
d(
|
|
3180
|
+
} catch (Fe) {
|
|
3181
|
+
d(Fe);
|
|
3182
3182
|
}
|
|
3183
3183
|
}).catch((A) => d(A)));
|
|
3184
3184
|
}
|
|
3185
3185
|
};
|
|
3186
3186
|
const x = setTimeout(() => {
|
|
3187
|
-
this.waitingForPrack && (this.waitingForPrack = !1, this.logger.warn("No PRACK received, rejecting INVITE."), clearTimeout(de), this.reject({ statusCode: 504 }).then(() => d(new
|
|
3187
|
+
this.waitingForPrack && (this.waitingForPrack = !1, this.logger.warn("No PRACK received, rejecting INVITE."), clearTimeout(de), this.reject({ statusCode: 504 }).then(() => d(new Ue())).catch((p) => d(p)));
|
|
3188
3188
|
}, q.T1 * 64), I = () => {
|
|
3189
3189
|
try {
|
|
3190
3190
|
this.incomingInviteRequest.progress({ statusCode: i, reasonPhrase: s, extraHeaders: r, body: n });
|
|
@@ -3236,10 +3236,10 @@ class he extends me {
|
|
|
3236
3236
|
* the accept to fail and the session to transition to "terminated".
|
|
3237
3237
|
*/
|
|
3238
3238
|
prackNeverArrived() {
|
|
3239
|
-
this.waitingForPrackReject && this.waitingForPrackReject(new
|
|
3239
|
+
this.waitingForPrackReject && this.waitingForPrackReject(new Ue()), this.waitingForPrackPromise = void 0, this.waitingForPrackResolve = void 0, this.waitingForPrackReject = void 0;
|
|
3240
3240
|
}
|
|
3241
3241
|
}
|
|
3242
|
-
class
|
|
3242
|
+
class $e extends me {
|
|
3243
3243
|
/**
|
|
3244
3244
|
* Constructs a new instance of the `Inviter` class.
|
|
3245
3245
|
* @param userAgent - User agent. See {@link UserAgent} for details.
|
|
@@ -3247,7 +3247,7 @@ class Ie extends me {
|
|
|
3247
3247
|
* @param options - Options bucket. See {@link InviterOptions} for details.
|
|
3248
3248
|
*/
|
|
3249
3249
|
constructor(e, t, i = {}) {
|
|
3250
|
-
super(e, i), this.disposed = !1, this.earlyMedia = !1, this.earlyMediaSessionDescriptionHandlers = /* @__PURE__ */ new Map(), this.isCanceled = !1, this.inviteWithoutSdp = !1, this.logger = e.getLogger("sip.Inviter"), this.earlyMedia = i.earlyMedia !== void 0 ? i.earlyMedia : this.earlyMedia, this.fromTag =
|
|
3250
|
+
super(e, i), this.disposed = !1, this.earlyMedia = !1, this.earlyMediaSessionDescriptionHandlers = /* @__PURE__ */ new Map(), this.isCanceled = !1, this.inviteWithoutSdp = !1, this.logger = e.getLogger("sip.Inviter"), this.earlyMedia = i.earlyMedia !== void 0 ? i.earlyMedia : this.earlyMedia, this.fromTag = qe(), this.inviteWithoutSdp = i.inviteWithoutSdp !== void 0 ? i.inviteWithoutSdp : this.inviteWithoutSdp;
|
|
3251
3251
|
const s = Object.assign({}, i);
|
|
3252
3252
|
s.params = Object.assign({}, i.params);
|
|
3253
3253
|
const r = i.anonymous || !1, n = e.contact.toString({
|
|
@@ -3339,7 +3339,7 @@ class Ie extends me {
|
|
|
3339
3339
|
if (i && i < 200 || i > 699)
|
|
3340
3340
|
throw new TypeError("Invalid statusCode: " + i);
|
|
3341
3341
|
if (i) {
|
|
3342
|
-
const r = i, n =
|
|
3342
|
+
const r = i, n = Me(i) || s;
|
|
3343
3343
|
return "SIP;cause=" + r + ';text="' + n + '"';
|
|
3344
3344
|
}
|
|
3345
3345
|
}
|
|
@@ -3716,7 +3716,7 @@ class Ie extends me {
|
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
-
class
|
|
3719
|
+
class Vt {
|
|
3720
3720
|
/**
|
|
3721
3721
|
* Constructs a new instance of the `Messager` class.
|
|
3722
3722
|
* @param userAgent - User agent. See {@link UserAgent} for details.
|
|
@@ -3758,7 +3758,7 @@ class Z {
|
|
|
3758
3758
|
* @param options - Options bucket. See {@link RegistererOptions} for details.
|
|
3759
3759
|
*/
|
|
3760
3760
|
constructor(e, t = {}) {
|
|
3761
|
-
this.disposed = !1, this._contacts = [], this._retryAfter = void 0, this._state = _.Initial, this._waiting = !1, this._stateEventEmitter = new
|
|
3761
|
+
this.disposed = !1, this._contacts = [], this._retryAfter = void 0, this._state = _.Initial, this._waiting = !1, this._stateEventEmitter = new Ee(), this._waitingEventEmitter = new Ee(), this.userAgent = e;
|
|
3762
3762
|
const i = e.configuration.uri.clone();
|
|
3763
3763
|
if (i.user = void 0, this.options = Object.assign(Object.assign(Object.assign({}, Z.defaultOptions()), { registrar: i }), Z.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.");
|
|
@@ -3877,7 +3877,7 @@ class Z {
|
|
|
3877
3877
|
throw this.stateError(), new Error("Registerer disposed. Unable to register.");
|
|
3878
3878
|
if (this.waiting) {
|
|
3879
3879
|
this.waitingWarning();
|
|
3880
|
-
const s = new
|
|
3880
|
+
const s = new Ce("REGISTER request already in progress, waiting for final response");
|
|
3881
3881
|
return Promise.reject(s);
|
|
3882
3882
|
}
|
|
3883
3883
|
e.requestOptions && (this.options = Object.assign(Object.assign({}, this.options), e.requestOptions));
|
|
@@ -3896,7 +3896,7 @@ class Z {
|
|
|
3896
3896
|
for (; n--; ) {
|
|
3897
3897
|
if (a = s.message.parseHeader("contact", n), !a)
|
|
3898
3898
|
throw new Error("Contact undefined");
|
|
3899
|
-
if (this.userAgent.contact.pubGruu &&
|
|
3899
|
+
if (this.userAgent.contact.pubGruu && rt(a.uri, this.userAgent.contact.pubGruu)) {
|
|
3900
3900
|
r = Number(a.getParam("expires"));
|
|
3901
3901
|
break;
|
|
3902
3902
|
}
|
|
@@ -3905,7 +3905,7 @@ class Z {
|
|
|
3905
3905
|
r = Number(a.getParam("expires"));
|
|
3906
3906
|
break;
|
|
3907
3907
|
}
|
|
3908
|
-
} else if (
|
|
3908
|
+
} else if (rt(a.uri, this.userAgent.contact.uri)) {
|
|
3909
3909
|
r = Number(a.getParam("expires"));
|
|
3910
3910
|
break;
|
|
3911
3911
|
}
|
|
@@ -3970,7 +3970,7 @@ class Z {
|
|
|
3970
3970
|
throw this.stateError(), new Error("Registerer disposed. Unable to register.");
|
|
3971
3971
|
if (this.waiting) {
|
|
3972
3972
|
this.waitingWarning();
|
|
3973
|
-
const s = new
|
|
3973
|
+
const s = new Ce("REGISTER request already in progress, waiting for final response");
|
|
3974
3974
|
return Promise.reject(s);
|
|
3975
3975
|
}
|
|
3976
3976
|
this._state !== _.Registered && !e.all && this.logger.warn("Not currently registered, but sending an unregister anyway.");
|
|
@@ -4208,7 +4208,7 @@ H.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592" && console.error("Md5
|
|
|
4208
4208
|
function se(o) {
|
|
4209
4209
|
return H.hashStr(o);
|
|
4210
4210
|
}
|
|
4211
|
-
class
|
|
4211
|
+
class Gt {
|
|
4212
4212
|
/**
|
|
4213
4213
|
* Constructor.
|
|
4214
4214
|
* @param loggerFactory - LoggerFactory.
|
|
@@ -4275,7 +4275,7 @@ var M;
|
|
|
4275
4275
|
(function(o) {
|
|
4276
4276
|
o[o.error = 0] = "error", o[o.warn = 1] = "warn", o[o.log = 2] = "log", o[o.debug = 3] = "debug";
|
|
4277
4277
|
})(M = M || (M = {}));
|
|
4278
|
-
class
|
|
4278
|
+
class ot {
|
|
4279
4279
|
constructor(e, t, i) {
|
|
4280
4280
|
this.logger = e, this.category = t, this.label = i;
|
|
4281
4281
|
}
|
|
@@ -4301,7 +4301,7 @@ class rt {
|
|
|
4301
4301
|
this.logger.level = e;
|
|
4302
4302
|
}
|
|
4303
4303
|
}
|
|
4304
|
-
class
|
|
4304
|
+
class Wt {
|
|
4305
4305
|
constructor() {
|
|
4306
4306
|
this.builtinEnabled = !0, this._level = M.log, this.loggers = {}, this.logger = this.getLogger("sip:loggerfactory");
|
|
4307
4307
|
}
|
|
@@ -4320,11 +4320,11 @@ class Vt {
|
|
|
4320
4320
|
}
|
|
4321
4321
|
getLogger(e, t) {
|
|
4322
4322
|
if (t && this.level === 3)
|
|
4323
|
-
return new
|
|
4323
|
+
return new ot(this, e, t);
|
|
4324
4324
|
if (this.loggers[e])
|
|
4325
4325
|
return this.loggers[e];
|
|
4326
4326
|
{
|
|
4327
|
-
const i = new
|
|
4327
|
+
const i = new ot(this, e);
|
|
4328
4328
|
return this.loggers[e] = i, i;
|
|
4329
4329
|
}
|
|
4330
4330
|
}
|
|
@@ -4354,7 +4354,7 @@ class Vt {
|
|
|
4354
4354
|
}
|
|
4355
4355
|
}
|
|
4356
4356
|
}
|
|
4357
|
-
var
|
|
4357
|
+
var De;
|
|
4358
4358
|
(function(o) {
|
|
4359
4359
|
function e(s, r) {
|
|
4360
4360
|
let n = r, a = 0, d = 0;
|
|
@@ -4481,11 +4481,11 @@ var Ae;
|
|
|
4481
4481
|
return h.hasHeader("content-length") ? h.body = s.substr(w, Number(h.getHeader("content-length"))) : h.body = s.substring(w), h;
|
|
4482
4482
|
}
|
|
4483
4483
|
o.parseMessage = i;
|
|
4484
|
-
})(
|
|
4485
|
-
function
|
|
4484
|
+
})(De = De || (De = {}));
|
|
4485
|
+
function vt(o, e) {
|
|
4486
4486
|
if (e.statusCode < 100 || e.statusCode > 699)
|
|
4487
4487
|
throw new TypeError("Invalid statusCode: " + e.statusCode);
|
|
4488
|
-
const i = e.reasonPhrase ? e.reasonPhrase :
|
|
4488
|
+
const i = e.reasonPhrase ? e.reasonPhrase : Me(e.statusCode);
|
|
4489
4489
|
let s = "SIP/2.0 " + e.statusCode + " " + i + `\r
|
|
4490
4490
|
`;
|
|
4491
4491
|
e.statusCode >= 100 && e.statusCode < 200, e.statusCode;
|
|
@@ -4497,7 +4497,7 @@ function yt(o, e) {
|
|
|
4497
4497
|
let f = "To: " + o.getHeader("to");
|
|
4498
4498
|
if (e.statusCode > 100 && !o.parseHeader("to").hasParam("tag")) {
|
|
4499
4499
|
let x = e.toTag;
|
|
4500
|
-
x || (x =
|
|
4500
|
+
x || (x = qe()), f += ";tag=" + x;
|
|
4501
4501
|
}
|
|
4502
4502
|
f += `\r
|
|
4503
4503
|
`;
|
|
@@ -4510,18 +4510,18 @@ function yt(o, e) {
|
|
|
4510
4510
|
let S = "";
|
|
4511
4511
|
return e.extraHeaders && (S = e.extraHeaders.reduce((x, I) => x + I.trim() + `\r
|
|
4512
4512
|
`, "")), s += d, s += r, s += f, s += a, s += n, s += h, s += w, s += S, e.body ? (s += "Content-Type: " + e.body.contentType + `\r
|
|
4513
|
-
`, s += "Content-Length: " +
|
|
4513
|
+
`, s += "Content-Length: " + _e(e.body.content) + `\r
|
|
4514
4514
|
\r
|
|
4515
4515
|
`, s += e.body.content) : s += `Content-Length: 0\r
|
|
4516
4516
|
\r
|
|
4517
4517
|
`, { message: s };
|
|
4518
4518
|
}
|
|
4519
|
-
class
|
|
4519
|
+
class Be extends ge {
|
|
4520
4520
|
constructor(e) {
|
|
4521
4521
|
super(e || "Unspecified transport error.");
|
|
4522
4522
|
}
|
|
4523
4523
|
}
|
|
4524
|
-
class
|
|
4524
|
+
class St {
|
|
4525
4525
|
constructor(e, t, i, s, r) {
|
|
4526
4526
|
this._transport = e, this._user = t, this._id = i, this._state = s, this.listeners = new Array(), this.logger = t.loggerFactory.getLogger(r, i), this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`);
|
|
4527
4527
|
}
|
|
@@ -4592,10 +4592,10 @@ class bt {
|
|
|
4592
4592
|
*/
|
|
4593
4593
|
send(e) {
|
|
4594
4594
|
return this.transport.send(e).catch((t) => {
|
|
4595
|
-
if (t instanceof
|
|
4595
|
+
if (t instanceof Be)
|
|
4596
4596
|
throw this.onTransportError(t), t;
|
|
4597
4597
|
let i;
|
|
4598
|
-
throw t && typeof t.message == "string" ? i = new
|
|
4598
|
+
throw t && typeof t.message == "string" ? i = new Be(t.message) : i = new Be(), this.onTransportError(i), i;
|
|
4599
4599
|
});
|
|
4600
4600
|
}
|
|
4601
4601
|
setState(e) {
|
|
@@ -4605,7 +4605,7 @@ class bt {
|
|
|
4605
4605
|
return "UnknownType";
|
|
4606
4606
|
}
|
|
4607
4607
|
}
|
|
4608
|
-
class
|
|
4608
|
+
class Tt extends St {
|
|
4609
4609
|
constructor(e, t, i, s, r) {
|
|
4610
4610
|
super(t, i, e.viaBranch, s, r), this._request = e, this.user = i;
|
|
4611
4611
|
}
|
|
@@ -4618,7 +4618,7 @@ var g;
|
|
|
4618
4618
|
(function(o) {
|
|
4619
4619
|
o.Accepted = "Accepted", o.Calling = "Calling", o.Completed = "Completed", o.Confirmed = "Confirmed", o.Proceeding = "Proceeding", o.Terminated = "Terminated", o.Trying = "Trying";
|
|
4620
4620
|
})(g = g || (g = {}));
|
|
4621
|
-
class L extends
|
|
4621
|
+
class L extends Tt {
|
|
4622
4622
|
/**
|
|
4623
4623
|
* Constructor.
|
|
4624
4624
|
* Upon construction, a "100 Trying" reply will be immediately sent.
|
|
@@ -4848,9 +4848,9 @@ class L extends vt {
|
|
|
4848
4848
|
this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`), this.state === g.Accepted && this.stateTransition(g.Terminated);
|
|
4849
4849
|
}
|
|
4850
4850
|
}
|
|
4851
|
-
class
|
|
4851
|
+
class Oe extends St {
|
|
4852
4852
|
constructor(e, t, i, s, r) {
|
|
4853
|
-
super(t, i,
|
|
4853
|
+
super(t, i, Oe.makeId(e), s, r), this._request = e, this.user = i, e.setViaHeader(this.id, t.protocol);
|
|
4854
4854
|
}
|
|
4855
4855
|
static makeId(e) {
|
|
4856
4856
|
if (e.method === "CANCEL") {
|
|
@@ -4878,7 +4878,7 @@ class Me extends bt {
|
|
|
4878
4878
|
this.user.onRequestTimeout && this.user.onRequestTimeout();
|
|
4879
4879
|
}
|
|
4880
4880
|
}
|
|
4881
|
-
class j extends
|
|
4881
|
+
class j extends Oe {
|
|
4882
4882
|
/**
|
|
4883
4883
|
* Constructor
|
|
4884
4884
|
* Upon construction, the outgoing request's Via header is updated by calling `setViaHeader`.
|
|
@@ -5267,7 +5267,7 @@ class we {
|
|
|
5267
5267
|
return e.method === v.ACK ? !0 : this.remoteSequenceNumber && e.cseq <= this.remoteSequenceNumber ? (this.core.replyStateless(e, { statusCode: 500 }), !1) : !0;
|
|
5268
5268
|
}
|
|
5269
5269
|
}
|
|
5270
|
-
class ae extends
|
|
5270
|
+
class ae extends Oe {
|
|
5271
5271
|
/**
|
|
5272
5272
|
* Constructor.
|
|
5273
5273
|
* Upon construction, the outgoing request's Via header is updated by calling `setViaHeader`.
|
|
@@ -5653,13 +5653,13 @@ class O {
|
|
|
5653
5653
|
this.core.userAgentClients.set(i, this);
|
|
5654
5654
|
}
|
|
5655
5655
|
}
|
|
5656
|
-
class
|
|
5656
|
+
class Kt extends O {
|
|
5657
5657
|
constructor(e, t, i) {
|
|
5658
5658
|
const s = e.createOutgoingRequestMessage(v.BYE, i);
|
|
5659
5659
|
super(j, e.userAgentCore, s, t), e.dispose();
|
|
5660
5660
|
}
|
|
5661
5661
|
}
|
|
5662
|
-
class B extends
|
|
5662
|
+
class B extends Tt {
|
|
5663
5663
|
/**
|
|
5664
5664
|
* Constructor.
|
|
5665
5665
|
* After construction the transaction will be in the "trying": state and the transaction
|
|
@@ -5800,7 +5800,7 @@ class B extends vt {
|
|
|
5800
5800
|
}
|
|
5801
5801
|
class Q {
|
|
5802
5802
|
constructor(e, t, i, s) {
|
|
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 :
|
|
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 : qe(), this.init();
|
|
5804
5804
|
}
|
|
5805
5805
|
dispose() {
|
|
5806
5806
|
this.transaction.dispose();
|
|
@@ -5924,7 +5924,7 @@ class Q {
|
|
|
5924
5924
|
*/
|
|
5925
5925
|
reply(e) {
|
|
5926
5926
|
!e.toTag && e.statusCode !== 100 && (e.toTag = this.toTag), e.userAgent = e.userAgent || this.core.configuration.userAgentHeaderFieldValue, e.supported = e.supported || this.core.configuration.supportedOptionTagsResponse;
|
|
5927
|
-
const t =
|
|
5927
|
+
const t = vt(this.message, e);
|
|
5928
5928
|
return this.transaction.receiveResponse(e.statusCode, t.message), t;
|
|
5929
5929
|
}
|
|
5930
5930
|
init() {
|
|
@@ -5942,59 +5942,59 @@ class Q {
|
|
|
5942
5942
|
this.core.userAgentServers.set(t.id, this);
|
|
5943
5943
|
}
|
|
5944
5944
|
}
|
|
5945
|
-
class
|
|
5945
|
+
class zt extends Q {
|
|
5946
5946
|
constructor(e, t, i) {
|
|
5947
5947
|
super(B, e.userAgentCore, t, i);
|
|
5948
5948
|
}
|
|
5949
5949
|
}
|
|
5950
|
-
class
|
|
5950
|
+
class Yt extends O {
|
|
5951
5951
|
constructor(e, t, i) {
|
|
5952
5952
|
const s = e.createOutgoingRequestMessage(v.INFO, i);
|
|
5953
5953
|
super(j, e.userAgentCore, s, t);
|
|
5954
5954
|
}
|
|
5955
5955
|
}
|
|
5956
|
-
class
|
|
5956
|
+
class Jt extends Q {
|
|
5957
5957
|
constructor(e, t, i) {
|
|
5958
5958
|
super(B, e.userAgentCore, t, i);
|
|
5959
5959
|
}
|
|
5960
5960
|
}
|
|
5961
|
-
class
|
|
5961
|
+
class Ct extends O {
|
|
5962
5962
|
constructor(e, t, i) {
|
|
5963
5963
|
super(j, e, t, i);
|
|
5964
5964
|
}
|
|
5965
5965
|
}
|
|
5966
|
-
class
|
|
5966
|
+
class Et extends Q {
|
|
5967
5967
|
constructor(e, t, i) {
|
|
5968
5968
|
super(B, e, t, i);
|
|
5969
5969
|
}
|
|
5970
5970
|
}
|
|
5971
|
-
class
|
|
5971
|
+
class Zt extends O {
|
|
5972
5972
|
constructor(e, t, i) {
|
|
5973
5973
|
const s = e.createOutgoingRequestMessage(v.NOTIFY, i);
|
|
5974
5974
|
super(j, e.userAgentCore, s, t);
|
|
5975
5975
|
}
|
|
5976
5976
|
}
|
|
5977
|
-
function
|
|
5977
|
+
function Xt(o) {
|
|
5978
5978
|
return o.userAgentCore !== void 0;
|
|
5979
5979
|
}
|
|
5980
|
-
class
|
|
5980
|
+
class Pe extends Q {
|
|
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 = Xt(e) ? e.userAgentCore : e;
|
|
5988
5988
|
super(B, s, t, i);
|
|
5989
5989
|
}
|
|
5990
5990
|
}
|
|
5991
|
-
class
|
|
5991
|
+
class Qt extends O {
|
|
5992
5992
|
constructor(e, t, i) {
|
|
5993
5993
|
const s = e.createOutgoingRequestMessage(v.PRACK, i);
|
|
5994
5994
|
super(j, e.userAgentCore, s, t), e.signalingStateTransition(s);
|
|
5995
5995
|
}
|
|
5996
5996
|
}
|
|
5997
|
-
class
|
|
5997
|
+
class ei extends Q {
|
|
5998
5998
|
constructor(e, t, i) {
|
|
5999
5999
|
super(B, e.userAgentCore, t, i), e.signalingStateTransition(t), this.dialog = e;
|
|
6000
6000
|
}
|
|
@@ -6006,7 +6006,7 @@ class Xt extends Q {
|
|
|
6006
6006
|
return e.body && this.dialog.signalingStateTransition(e.body), super.accept(e);
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
|
-
class
|
|
6009
|
+
class ti extends O {
|
|
6010
6010
|
constructor(e, t, i) {
|
|
6011
6011
|
const s = e.createOutgoingRequestMessage(v.INVITE, i);
|
|
6012
6012
|
super(ae, e.userAgentCore, s, t), this.delegate = t, e.signalingStateTransition(s), e.reinviteUserAgentClient = this, this.dialog = e;
|
|
@@ -6049,7 +6049,7 @@ class Qt extends O {
|
|
|
6049
6049
|
}
|
|
6050
6050
|
}
|
|
6051
6051
|
}
|
|
6052
|
-
class
|
|
6052
|
+
class ii extends Q {
|
|
6053
6053
|
constructor(e, t, i) {
|
|
6054
6054
|
super(L, e.userAgentCore, t, i), e.reinviteUserAgentServer = this, this.dialog = e;
|
|
6055
6055
|
}
|
|
@@ -6091,27 +6091,27 @@ class ei extends Q {
|
|
|
6091
6091
|
return this.dialog.signalingStateRollback(), this.dialog.reinviteUserAgentServer = void 0, super.reject(e);
|
|
6092
6092
|
}
|
|
6093
6093
|
}
|
|
6094
|
-
class
|
|
6094
|
+
class si extends O {
|
|
6095
6095
|
constructor(e, t, i) {
|
|
6096
6096
|
const s = e.createOutgoingRequestMessage(v.REFER, i);
|
|
6097
6097
|
super(j, e.userAgentCore, s, t);
|
|
6098
6098
|
}
|
|
6099
6099
|
}
|
|
6100
|
-
function
|
|
6100
|
+
function ri(o) {
|
|
6101
6101
|
return o.userAgentCore !== void 0;
|
|
6102
6102
|
}
|
|
6103
|
-
class
|
|
6103
|
+
class _t extends Q {
|
|
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 = ri(e) ? e.userAgentCore : e;
|
|
6111
6111
|
super(B, s, t, i);
|
|
6112
6112
|
}
|
|
6113
6113
|
}
|
|
6114
|
-
class
|
|
6114
|
+
class He extends we {
|
|
6115
6115
|
constructor(e, t, i, s) {
|
|
6116
6116
|
super(t, i), this.initialTransaction = e, this._signalingState = b.Initial, this.ackWait = !1, this.ackProcessing = !1, this.delegate = s, e instanceof L && (this.ackWait = !0), this.early || this.start2xxRetransmissionTimer(), this.signalingStateTransition(e.request), this.logger = t.loggerFactory.getLogger("sip.invite-dialog"), this.logger.log(`INVITE dialog ${this.id} constructed`);
|
|
6117
6117
|
}
|
|
@@ -6220,7 +6220,7 @@ class ke extends we {
|
|
|
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 Kt(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 ke extends we {
|
|
|
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 Yt(this, e, t);
|
|
6239
6239
|
}
|
|
6240
6240
|
/**
|
|
6241
6241
|
* Modifying an Existing Session
|
|
@@ -6265,7 +6265,7 @@ class ke extends we {
|
|
|
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 ti(this, e, t);
|
|
6269
6269
|
}
|
|
6270
6270
|
/**
|
|
6271
6271
|
* A UAC MAY associate a MESSAGE request with an existing dialog. If a
|
|
@@ -6278,7 +6278,7 @@ class ke extends we {
|
|
|
6278
6278
|
if (this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`), this.early)
|
|
6279
6279
|
throw new Error("Dialog not confirmed.");
|
|
6280
6280
|
const i = this.createOutgoingRequestMessage(v.MESSAGE, t);
|
|
6281
|
-
return new
|
|
6281
|
+
return new Ct(this.core, i, e);
|
|
6282
6282
|
}
|
|
6283
6283
|
/**
|
|
6284
6284
|
* The NOTIFY mechanism defined in [2] MUST be used to inform the agent
|
|
@@ -6289,7 +6289,7 @@ class ke extends we {
|
|
|
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 Zt(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 ke extends we {
|
|
|
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 Qt(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 ke extends we {
|
|
|
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 si(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 ke extends we {
|
|
|
6391
6391
|
switch (e.method) {
|
|
6392
6392
|
case v.BYE:
|
|
6393
6393
|
{
|
|
6394
|
-
const t = new
|
|
6394
|
+
const t = new zt(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 Jt(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,31 +6406,31 @@ class ke extends we {
|
|
|
6406
6406
|
break;
|
|
6407
6407
|
case v.INVITE:
|
|
6408
6408
|
{
|
|
6409
|
-
const t = new
|
|
6409
|
+
const t = new ii(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;
|
|
6413
6413
|
case v.MESSAGE:
|
|
6414
6414
|
{
|
|
6415
|
-
const t = new
|
|
6415
|
+
const t = new Et(this.core, e);
|
|
6416
6416
|
this.delegate && this.delegate.onMessage ? this.delegate.onMessage(t) : t.accept();
|
|
6417
6417
|
}
|
|
6418
6418
|
break;
|
|
6419
6419
|
case v.NOTIFY:
|
|
6420
6420
|
{
|
|
6421
|
-
const t = new
|
|
6421
|
+
const t = new Pe(this, e);
|
|
6422
6422
|
this.delegate && this.delegate.onNotify ? this.delegate.onNotify(t) : t.accept();
|
|
6423
6423
|
}
|
|
6424
6424
|
break;
|
|
6425
6425
|
case v.PRACK:
|
|
6426
6426
|
{
|
|
6427
|
-
const t = new
|
|
6427
|
+
const t = new ei(this, e);
|
|
6428
6428
|
this.delegate && this.delegate.onPrack ? this.delegate.onPrack(t) : t.accept();
|
|
6429
6429
|
}
|
|
6430
6430
|
break;
|
|
6431
6431
|
case v.REFER:
|
|
6432
6432
|
{
|
|
6433
|
-
const t = new
|
|
6433
|
+
const t = new _t(this, e);
|
|
6434
6434
|
this.delegate && this.delegate.onRefer ? this.delegate.onRefer(t) : t.reject();
|
|
6435
6435
|
}
|
|
6436
6436
|
break;
|
|
@@ -6469,7 +6469,7 @@ class ke extends we {
|
|
|
6469
6469
|
* @param message - The message to base the update off of.
|
|
6470
6470
|
*/
|
|
6471
6471
|
signalingStateTransition(e) {
|
|
6472
|
-
const t =
|
|
6472
|
+
const t = Te(e);
|
|
6473
6473
|
if (!(!t || t.contentDisposition !== "session")) {
|
|
6474
6474
|
if (this._signalingState === b.Stable && (this._rollbackOffer = this._offer, this._rollbackAnswer = this._answer), e instanceof pe)
|
|
6475
6475
|
switch (this._signalingState) {
|
|
@@ -6519,7 +6519,7 @@ class ke extends we {
|
|
|
6519
6519
|
default:
|
|
6520
6520
|
throw new Error("Unexpected signaling state.");
|
|
6521
6521
|
}
|
|
6522
|
-
if (
|
|
6522
|
+
if (yt(e))
|
|
6523
6523
|
switch (this._signalingState) {
|
|
6524
6524
|
case b.Initial:
|
|
6525
6525
|
case b.Stable:
|
|
@@ -6575,7 +6575,7 @@ class ke extends we {
|
|
|
6575
6575
|
}
|
|
6576
6576
|
}
|
|
6577
6577
|
}
|
|
6578
|
-
class
|
|
6578
|
+
class ni extends O {
|
|
6579
6579
|
constructor(e, t, i) {
|
|
6580
6580
|
super(ae, e, t, i), this.confirmedDialogAcks = /* @__PURE__ */ new Map(), this.confirmedDialogs = /* @__PURE__ */ new Map(), this.earlyDialogs = /* @__PURE__ */ new Map(), this.delegate = i;
|
|
6581
6581
|
}
|
|
@@ -6623,7 +6623,7 @@ class si extends O {
|
|
|
6623
6623
|
const a = this.transaction;
|
|
6624
6624
|
if (!(a instanceof ae))
|
|
6625
6625
|
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
6626
|
-
r = new
|
|
6626
|
+
r = new He(a, this.core, s), this.earlyDialogs.set(r.id, r);
|
|
6627
6627
|
}
|
|
6628
6628
|
if (!r.reliableSequenceGuard(e)) {
|
|
6629
6629
|
this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");
|
|
@@ -6666,7 +6666,7 @@ class si extends O {
|
|
|
6666
6666
|
const a = this.transaction;
|
|
6667
6667
|
if (!(a instanceof ae))
|
|
6668
6668
|
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
6669
|
-
r = new
|
|
6669
|
+
r = new He(a, this.core, s), this.confirmedDialogs.set(r.id, r);
|
|
6670
6670
|
}
|
|
6671
6671
|
(r.signalingState === b.Initial || r.signalingState === b.HaveLocalOffer) && r.signalingStateTransition(e);
|
|
6672
6672
|
const n = r;
|
|
@@ -6696,7 +6696,7 @@ class si extends O {
|
|
|
6696
6696
|
}
|
|
6697
6697
|
}
|
|
6698
6698
|
}
|
|
6699
|
-
class
|
|
6699
|
+
class je extends Q {
|
|
6700
6700
|
constructor(e, t, i) {
|
|
6701
6701
|
super(L, e, t, i), this.core = e;
|
|
6702
6702
|
}
|
|
@@ -6722,7 +6722,7 @@ class Be extends Q {
|
|
|
6722
6722
|
if (!(d instanceof L))
|
|
6723
6723
|
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
6724
6724
|
const f = we.initialDialogStateForUserAgentServer(this.message, this.toTag);
|
|
6725
|
-
this.confirmedDialog = new
|
|
6725
|
+
this.confirmedDialog = new He(d, this.core, f);
|
|
6726
6726
|
}
|
|
6727
6727
|
const t = this.message.getHeaders("record-route").map((d) => `Record-Route: ${d}`), i = `Contact: ${this.core.configuration.contact.toString()}`, s = "Allow: " + oe.toString();
|
|
6728
6728
|
if (!e.body) {
|
|
@@ -6765,7 +6765,7 @@ class Be extends Q {
|
|
|
6765
6765
|
if (!(a instanceof L))
|
|
6766
6766
|
throw new Error("Transaction not instance of InviteClientTransaction.");
|
|
6767
6767
|
const d = we.initialDialogStateForUserAgentServer(this.message, this.toTag, !0);
|
|
6768
|
-
this.earlyDialog = new
|
|
6768
|
+
this.earlyDialog = new He(a, this.core, d);
|
|
6769
6769
|
}
|
|
6770
6770
|
const t = this.message.getHeaders("record-route").map((a) => `Record-Route: ${a}`), i = `Contact: ${this.core.configuration.contact}`;
|
|
6771
6771
|
e.extraHeaders = e.extraHeaders || [], e.extraHeaders = e.extraHeaders.concat(t), e.extraHeaders.push(i);
|
|
@@ -6799,22 +6799,22 @@ class Be extends Q {
|
|
|
6799
6799
|
return super.reject(e);
|
|
6800
6800
|
}
|
|
6801
6801
|
}
|
|
6802
|
-
class
|
|
6802
|
+
class oi extends O {
|
|
6803
6803
|
constructor(e, t, i) {
|
|
6804
6804
|
super(j, e, t, i);
|
|
6805
6805
|
}
|
|
6806
6806
|
}
|
|
6807
|
-
class
|
|
6807
|
+
class ai extends O {
|
|
6808
6808
|
constructor(e, t, i) {
|
|
6809
6809
|
super(j, e, t, i);
|
|
6810
6810
|
}
|
|
6811
6811
|
}
|
|
6812
|
-
class
|
|
6812
|
+
class ci extends Q {
|
|
6813
6813
|
constructor(e, t, i) {
|
|
6814
6814
|
super(B, e, t, i), this.core = e;
|
|
6815
6815
|
}
|
|
6816
6816
|
}
|
|
6817
|
-
class
|
|
6817
|
+
class di extends O {
|
|
6818
6818
|
constructor(e, t, i) {
|
|
6819
6819
|
const s = e.createOutgoingRequestMessage(v.SUBSCRIBE, i);
|
|
6820
6820
|
super(j, e.userAgentCore, s, t), this.dialog = e;
|
|
@@ -6838,7 +6838,7 @@ class ai extends O {
|
|
|
6838
6838
|
e.statusCode && e.statusCode >= 400 && e.statusCode < 700 && [404, 405, 410, 416, 480, 481, 482, 483, 484, 485, 489, 501, 604].includes(e.statusCode) && this.dialog.terminate(), super.receiveResponse(e);
|
|
6839
6839
|
}
|
|
6840
6840
|
}
|
|
6841
|
-
class
|
|
6841
|
+
class at extends we {
|
|
6842
6842
|
constructor(e, t, i, s, r, n) {
|
|
6843
6843
|
super(s, r), this.delegate = n, this._autoRefresh = !1, this._subscriptionEvent = e, this._subscriptionExpires = t, this._subscriptionExpiresInitial = t, this._subscriptionExpiresLastSet = Math.floor(Date.now() / 1e3), this._subscriptionRefresh = void 0, this._subscriptionRefreshLastSet = void 0, this._subscriptionState = i, this.logger = s.loggerFactory.getLogger("sip.subscribe-dialog"), this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`);
|
|
6844
6844
|
}
|
|
@@ -6951,7 +6951,7 @@ class nt extends we {
|
|
|
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 di(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(), q.TIMER_N)), s;
|
|
6956
6956
|
}
|
|
6957
6957
|
/**
|
|
@@ -7004,7 +7004,7 @@ class nt extends we {
|
|
|
7004
7004
|
this.logger.warn("Unrecognized subscription state.");
|
|
7005
7005
|
break;
|
|
7006
7006
|
}
|
|
7007
|
-
const n = new
|
|
7007
|
+
const n = new Pe(this, e);
|
|
7008
7008
|
this.delegate && this.delegate.onNotify ? this.delegate.onNotify(n) : n.accept();
|
|
7009
7009
|
}
|
|
7010
7010
|
onRefresh(e) {
|
|
@@ -7074,7 +7074,7 @@ class nt extends we {
|
|
|
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 li extends O {
|
|
7078
7078
|
constructor(e, t, i) {
|
|
7079
7079
|
const s = t.getHeader("Event");
|
|
7080
7080
|
if (!s)
|
|
@@ -7144,8 +7144,8 @@ class ci extends O {
|
|
|
7144
7144
|
throw new Error(`Unrecognized state ${s}.`);
|
|
7145
7145
|
}
|
|
7146
7146
|
if (this.subscriptionState !== R.Terminated) {
|
|
7147
|
-
const r =
|
|
7148
|
-
this.dialog = new
|
|
7147
|
+
const r = at.initialDialogStateForSubscription(this.message, e.message);
|
|
7148
|
+
this.dialog = new at(this.subscriptionEvent, this.subscriptionExpires, this.subscriptionState, this.core, r);
|
|
7149
7149
|
}
|
|
7150
7150
|
if (this.delegate && this.delegate.onNotify) {
|
|
7151
7151
|
const r = e, n = this.dialog;
|
|
@@ -7191,13 +7191,13 @@ class ci extends O {
|
|
|
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 hi extends Q {
|
|
7195
7195
|
constructor(e, t, i) {
|
|
7196
7196
|
super(B, e, t, i), this.core = e;
|
|
7197
7197
|
}
|
|
7198
7198
|
}
|
|
7199
|
-
const
|
|
7200
|
-
class
|
|
7199
|
+
const ct = ["application/sdp", "application/dtmf-relay"];
|
|
7200
|
+
class ui {
|
|
7201
7201
|
/**
|
|
7202
7202
|
* Constructor.
|
|
7203
7203
|
* @param configuration - Configuration.
|
|
@@ -7231,7 +7231,7 @@ class li {
|
|
|
7231
7231
|
* @param delegate - Request delegate.
|
|
7232
7232
|
*/
|
|
7233
7233
|
invite(e, t) {
|
|
7234
|
-
return new
|
|
7234
|
+
return new ni(this, e, t);
|
|
7235
7235
|
}
|
|
7236
7236
|
/**
|
|
7237
7237
|
* Send MESSAGE.
|
|
@@ -7239,7 +7239,7 @@ class li {
|
|
|
7239
7239
|
* @param delegate - Request delegate.
|
|
7240
7240
|
*/
|
|
7241
7241
|
message(e, t) {
|
|
7242
|
-
return new
|
|
7242
|
+
return new Ct(this, e, t);
|
|
7243
7243
|
}
|
|
7244
7244
|
/**
|
|
7245
7245
|
* Send PUBLISH.
|
|
@@ -7247,7 +7247,7 @@ class li {
|
|
|
7247
7247
|
* @param delegate - Request delegate.
|
|
7248
7248
|
*/
|
|
7249
7249
|
publish(e, t) {
|
|
7250
|
-
return new
|
|
7250
|
+
return new oi(this, e, t);
|
|
7251
7251
|
}
|
|
7252
7252
|
/**
|
|
7253
7253
|
* Send REGISTER.
|
|
@@ -7255,7 +7255,7 @@ class li {
|
|
|
7255
7255
|
* @param delegate - Request delegate.
|
|
7256
7256
|
*/
|
|
7257
7257
|
register(e, t) {
|
|
7258
|
-
return new
|
|
7258
|
+
return new ai(this, e, t);
|
|
7259
7259
|
}
|
|
7260
7260
|
/**
|
|
7261
7261
|
* Send SUBSCRIBE.
|
|
@@ -7263,7 +7263,7 @@ class li {
|
|
|
7263
7263
|
* @param delegate - Request delegate.
|
|
7264
7264
|
*/
|
|
7265
7265
|
subscribe(e, t) {
|
|
7266
|
-
return new
|
|
7266
|
+
return new li(this, e, t);
|
|
7267
7267
|
}
|
|
7268
7268
|
/**
|
|
7269
7269
|
* Send a request.
|
|
@@ -7331,7 +7331,7 @@ class li {
|
|
|
7331
7331
|
replyStateless(e, t) {
|
|
7332
7332
|
const i = this.configuration.userAgentHeaderFieldValue, s = this.configuration.supportedOptionTagsResponse;
|
|
7333
7333
|
t = Object.assign(Object.assign({}, t), { userAgent: i, supported: s });
|
|
7334
|
-
const r =
|
|
7334
|
+
const r = vt(e, t);
|
|
7335
7335
|
return this.transport.send(r.message).catch((n) => {
|
|
7336
7336
|
n instanceof Error && this.logger.error(n.message), this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`);
|
|
7337
7337
|
}), r;
|
|
@@ -7350,12 +7350,12 @@ class li {
|
|
|
7350
7350
|
*/
|
|
7351
7351
|
receiveRequestFromTransport(e) {
|
|
7352
7352
|
const t = e.viaBranch, i = this.userAgentServers.get(t);
|
|
7353
|
-
if (e.method === v.ACK && i && i.transaction.state === g.Accepted && i instanceof
|
|
7353
|
+
if (e.method === v.ACK && i && i.transaction.state === g.Accepted && i instanceof je) {
|
|
7354
7354
|
this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);
|
|
7355
7355
|
return;
|
|
7356
7356
|
}
|
|
7357
7357
|
if (e.method === v.CANCEL) {
|
|
7358
|
-
i ? (this.replyStateless(e, { statusCode: 200 }), i.transaction instanceof L && i.transaction.state === g.Proceeding && i instanceof
|
|
7358
|
+
i ? (this.replyStateless(e, { statusCode: 200 }), i.transaction instanceof L && i.transaction.state === g.Proceeding && i instanceof je && i.receiveCancel(e)) : this.replyStateless(e, { statusCode: 481 });
|
|
7359
7359
|
return;
|
|
7360
7360
|
}
|
|
7361
7361
|
if (i) {
|
|
@@ -7428,7 +7428,7 @@ class li {
|
|
|
7428
7428
|
}
|
|
7429
7429
|
const r = e.callId + e.toTag + s.event, n = this.subscribers.get(r);
|
|
7430
7430
|
if (n) {
|
|
7431
|
-
const a = new
|
|
7431
|
+
const a = new Pe(this, e);
|
|
7432
7432
|
n.onNotify(a);
|
|
7433
7433
|
return;
|
|
7434
7434
|
}
|
|
@@ -7436,7 +7436,7 @@ class li {
|
|
|
7436
7436
|
const t = e.callId + e.toTag + e.fromTag, i = this.dialogs.get(t);
|
|
7437
7437
|
if (i) {
|
|
7438
7438
|
if (e.method === v.OPTIONS) {
|
|
7439
|
-
const s = "Allow: " + oe.toString(), r = "Accept: " +
|
|
7439
|
+
const s = "Allow: " + oe.toString(), r = "Accept: " + ct.toString();
|
|
7440
7440
|
this.replyStateless(e, {
|
|
7441
7441
|
statusCode: 200,
|
|
7442
7442
|
extraHeaders: [s, r]
|
|
@@ -7468,25 +7468,25 @@ class li {
|
|
|
7468
7468
|
break;
|
|
7469
7469
|
case v.INVITE:
|
|
7470
7470
|
{
|
|
7471
|
-
const t = new
|
|
7471
|
+
const t = new je(this, e);
|
|
7472
7472
|
this.delegate.onInvite ? this.delegate.onInvite(t) : t.reject();
|
|
7473
7473
|
}
|
|
7474
7474
|
break;
|
|
7475
7475
|
case v.MESSAGE:
|
|
7476
7476
|
{
|
|
7477
|
-
const t = new
|
|
7477
|
+
const t = new Et(this, e);
|
|
7478
7478
|
this.delegate.onMessage ? this.delegate.onMessage(t) : t.accept();
|
|
7479
7479
|
}
|
|
7480
7480
|
break;
|
|
7481
7481
|
case v.NOTIFY:
|
|
7482
7482
|
{
|
|
7483
|
-
const t = new
|
|
7483
|
+
const t = new Pe(this, e);
|
|
7484
7484
|
this.delegate.onNotify ? this.delegate.onNotify(t) : t.reject({ statusCode: 405 });
|
|
7485
7485
|
}
|
|
7486
7486
|
break;
|
|
7487
7487
|
case v.OPTIONS:
|
|
7488
7488
|
{
|
|
7489
|
-
const t = "Allow: " + oe.toString(), i = "Accept: " +
|
|
7489
|
+
const t = "Allow: " + oe.toString(), i = "Accept: " + ct.toString();
|
|
7490
7490
|
this.replyStateless(e, {
|
|
7491
7491
|
statusCode: 200,
|
|
7492
7492
|
extraHeaders: [t, i]
|
|
@@ -7495,19 +7495,19 @@ class li {
|
|
|
7495
7495
|
break;
|
|
7496
7496
|
case v.REFER:
|
|
7497
7497
|
{
|
|
7498
|
-
const t = new
|
|
7498
|
+
const t = new _t(this, e);
|
|
7499
7499
|
this.delegate.onRefer ? this.delegate.onRefer(t) : t.reject({ statusCode: 405 });
|
|
7500
7500
|
}
|
|
7501
7501
|
break;
|
|
7502
7502
|
case v.REGISTER:
|
|
7503
7503
|
{
|
|
7504
|
-
const t = new
|
|
7504
|
+
const t = new ci(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 hi(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 li {
|
|
|
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 gi() {
|
|
7537
7537
|
return (o) => !o.audio && !o.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, o);
|
|
7538
7538
|
}
|
|
7539
|
-
function
|
|
7539
|
+
function fi() {
|
|
7540
7540
|
return {
|
|
7541
7541
|
bundlePolicy: "balanced",
|
|
7542
7542
|
certificates: void 0,
|
|
@@ -8078,23 +8078,23 @@ class F {
|
|
|
8078
8078
|
};
|
|
8079
8079
|
}
|
|
8080
8080
|
}
|
|
8081
|
-
function
|
|
8081
|
+
function pi(o) {
|
|
8082
8082
|
return (e, t) => {
|
|
8083
|
-
o === void 0 && (o =
|
|
8083
|
+
o === void 0 && (o = gi());
|
|
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({}, fi()), t?.peerConnectionConfiguration)
|
|
8087
8087
|
}, r = e.userAgent.getLogger("sip.SessionDescriptionHandler");
|
|
8088
8088
|
return new F(r, o, s);
|
|
8089
8089
|
};
|
|
8090
8090
|
}
|
|
8091
|
-
class
|
|
8091
|
+
class Re {
|
|
8092
8092
|
constructor(e, t) {
|
|
8093
|
-
if (this._state = T.Disconnected, this.transitioningState = !1, this._stateEventEmitter = new
|
|
8093
|
+
if (this._state = T.Disconnected, this.transitioningState = !1, this._stateEventEmitter = new Ee(), this.logger = e, t) {
|
|
8094
8094
|
const r = t, n = r?.wsServers, a = r?.maxReconnectionAttempts;
|
|
8095
8095
|
n !== void 0 && this.logger.warn('The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'), a !== void 0 && this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'), n && !t.server && (typeof n == "string" && (t.server = n), n instanceof Array && (t.server = n[0]));
|
|
8096
8096
|
}
|
|
8097
|
-
this.configuration = Object.assign(Object.assign({},
|
|
8097
|
+
this.configuration = Object.assign(Object.assign({}, Re.defaultOptions), t);
|
|
8098
8098
|
const i = this.configuration.server, s = P.parse(i, "absoluteURI");
|
|
8099
8099
|
if (s === -1)
|
|
8100
8100
|
throw this.logger.error(`Invalid WebSocket Server URL "${i}"`), new Error("Invalid WebSocket Server URL");
|
|
@@ -8191,7 +8191,7 @@ class _e {
|
|
|
8191
8191
|
try {
|
|
8192
8192
|
this.transitionState(T.Connecting);
|
|
8193
8193
|
} catch (t) {
|
|
8194
|
-
if (t instanceof
|
|
8194
|
+
if (t instanceof be)
|
|
8195
8195
|
return Promise.reject(t);
|
|
8196
8196
|
throw t;
|
|
8197
8197
|
}
|
|
@@ -8202,7 +8202,7 @@ class _e {
|
|
|
8202
8202
|
try {
|
|
8203
8203
|
this.transitionState(T.Connecting);
|
|
8204
8204
|
} catch (t) {
|
|
8205
|
-
if (t instanceof
|
|
8205
|
+
if (t instanceof be)
|
|
8206
8206
|
return Promise.reject(t);
|
|
8207
8207
|
throw t;
|
|
8208
8208
|
}
|
|
@@ -8232,7 +8232,7 @@ class _e {
|
|
|
8232
8232
|
try {
|
|
8233
8233
|
this.transitionState(T.Disconnecting);
|
|
8234
8234
|
} catch (t) {
|
|
8235
|
-
if (t instanceof
|
|
8235
|
+
if (t instanceof be)
|
|
8236
8236
|
return Promise.reject(t);
|
|
8237
8237
|
throw t;
|
|
8238
8238
|
}
|
|
@@ -8243,7 +8243,7 @@ class _e {
|
|
|
8243
8243
|
try {
|
|
8244
8244
|
this.transitionState(T.Disconnecting);
|
|
8245
8245
|
} catch (t) {
|
|
8246
|
-
if (t instanceof
|
|
8246
|
+
if (t instanceof be)
|
|
8247
8247
|
return Promise.reject(t);
|
|
8248
8248
|
throw t;
|
|
8249
8249
|
}
|
|
@@ -8366,7 +8366,7 @@ class _e {
|
|
|
8366
8366
|
*/
|
|
8367
8367
|
transitionLoopDetectedError(e) {
|
|
8368
8368
|
let t = "A state transition loop has been detected.";
|
|
8369
|
-
return t += ` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`, t += " Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?", this.logger.error(t), new
|
|
8369
|
+
return t += ` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`, t += " Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?", this.logger.error(t), new be("Loop detected.");
|
|
8370
8370
|
}
|
|
8371
8371
|
/**
|
|
8372
8372
|
* Transition transport state.
|
|
@@ -8483,7 +8483,7 @@ class _e {
|
|
|
8483
8483
|
this.keepAliveInterval && clearInterval(this.keepAliveInterval), this.keepAliveDebounceTimeout && clearTimeout(this.keepAliveDebounceTimeout), this.keepAliveInterval = void 0, this.keepAliveDebounceTimeout = void 0;
|
|
8484
8484
|
}
|
|
8485
8485
|
}
|
|
8486
|
-
|
|
8486
|
+
Re.defaultOptions = {
|
|
8487
8487
|
server: "",
|
|
8488
8488
|
connectionTimeout: 5,
|
|
8489
8489
|
keepAliveInterval: 0,
|
|
@@ -8496,12 +8496,12 @@ class W {
|
|
|
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 = k.Stopped, this._stateEventEmitter = new
|
|
8499
|
+
if (this._publishers = {}, this._registerers = {}, this._sessions = {}, this._subscriptions = {}, this._state = k.Stopped, this._stateEventEmitter = new Ee(), this.delegate = e.delegate, this.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, W.defaultOptions()), { sipjsId: le(5) }), { uri: new X("sip", "anonymous." + le(6), "anonymous.invalid") }), { viaHost: le(12) + ".invalid" }), W.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 Wt(), 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 = M.error;
|
|
8507
8507
|
break;
|
|
@@ -8585,16 +8585,16 @@ class W {
|
|
|
8585
8585
|
reconnectionAttempts: 0,
|
|
8586
8586
|
reconnectionDelay: 4,
|
|
8587
8587
|
sendInitialProvisionalResponse: !0,
|
|
8588
|
-
sessionDescriptionHandlerFactory:
|
|
8588
|
+
sessionDescriptionHandlerFactory: pi(),
|
|
8589
8589
|
sessionDescriptionHandlerFactoryOptions: {},
|
|
8590
8590
|
sipExtension100rel: K.Unsupported,
|
|
8591
8591
|
sipExtensionReplaces: K.Unsupported,
|
|
8592
8592
|
sipExtensionExtraSupported: [],
|
|
8593
8593
|
sipjsId: "",
|
|
8594
|
-
transportConstructor:
|
|
8594
|
+
transportConstructor: Re,
|
|
8595
8595
|
transportOptions: {},
|
|
8596
8596
|
uri: new X("sip", "anonymous", "anonymous.invalid"),
|
|
8597
|
-
userAgentString: "SIP.js/" +
|
|
8597
|
+
userAgentString: "SIP.js/" + kt,
|
|
8598
8598
|
viaHost: ""
|
|
8599
8599
|
};
|
|
8600
8600
|
}
|
|
@@ -8769,7 +8769,7 @@ class W {
|
|
|
8769
8769
|
* @internal
|
|
8770
8770
|
*/
|
|
8771
8771
|
_makeInviter(e, t) {
|
|
8772
|
-
return new
|
|
8772
|
+
return new $e(this, e, t);
|
|
8773
8773
|
}
|
|
8774
8774
|
/**
|
|
8775
8775
|
* Attempt reconnection up to `maxReconnectionAttempts` times.
|
|
@@ -8810,7 +8810,7 @@ class W {
|
|
|
8810
8810
|
*/
|
|
8811
8811
|
initCore() {
|
|
8812
8812
|
let e = [];
|
|
8813
|
-
e.push("outbound"), this.options.sipExtension100rel === K.Supported && e.push("100rel"), this.options.sipExtensionReplaces === K.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 === K.Supported && e.push("100rel"), this.options.sipExtensionReplaces === K.Supported && e.push("replaces"), this.options.sipExtensionExtraSupported && e.push(...this.options.sipExtensionExtraSupported), this.options.hackAllowUnregisteredOptionTags || (e = e.filter((r) => jt[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 W {
|
|
|
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, a = this.options.authorizationHa1 ? this.options.authorizationHa1 : void 0;
|
|
8831
|
-
return new
|
|
8831
|
+
return new Gt(this.getLoggerFactory(), a, r, n);
|
|
8832
8832
|
},
|
|
8833
8833
|
transportAccessor: () => this.transport
|
|
8834
8834
|
}, s = {
|
|
@@ -8887,14 +8887,14 @@ class W {
|
|
|
8887
8887
|
},
|
|
8888
8888
|
onMessage: (r) => {
|
|
8889
8889
|
if (this.delegate && this.delegate.onMessage) {
|
|
8890
|
-
const n = new
|
|
8890
|
+
const n = new bt(r);
|
|
8891
8891
|
this.delegate.onMessage(n);
|
|
8892
8892
|
} else
|
|
8893
8893
|
r.accept();
|
|
8894
8894
|
},
|
|
8895
8895
|
onNotify: (r) => {
|
|
8896
8896
|
if (this.delegate && this.delegate.onNotify) {
|
|
8897
|
-
const n = new
|
|
8897
|
+
const n = new Ye(r);
|
|
8898
8898
|
this.delegate.onNotify(n);
|
|
8899
8899
|
} else
|
|
8900
8900
|
this.options.allowLegacyNotifications ? r.accept() : r.reject({ statusCode: 481 });
|
|
@@ -8909,7 +8909,7 @@ class W {
|
|
|
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 ui(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);
|
|
@@ -8921,7 +8921,7 @@ class W {
|
|
|
8921
8921
|
this.state !== k.Stopped && (this.delegate && this.delegate.onDisconnect && this.delegate.onDisconnect(e), e && this.options.reconnectionAttempts > 0 && this.attemptReconnection());
|
|
8922
8922
|
}
|
|
8923
8923
|
onTransportMessage(e) {
|
|
8924
|
-
const t =
|
|
8924
|
+
const t = De.parseMessage(e, this.getLogger("sip.Parser"));
|
|
8925
8925
|
if (!t) {
|
|
8926
8926
|
this.logger.warn("Failed to parse incoming message. Dropping.");
|
|
8927
8927
|
return;
|
|
@@ -8946,7 +8946,7 @@ class W {
|
|
|
8946
8946
|
this.userAgentCore.replyStateless(t, { statusCode: 482 });
|
|
8947
8947
|
return;
|
|
8948
8948
|
}
|
|
8949
|
-
const s =
|
|
8949
|
+
const s = _e(t.body), r = t.getHeader("content-length");
|
|
8950
8950
|
if (r && s < Number(r)) {
|
|
8951
8951
|
this.userAgentCore.replyStateless(t, { statusCode: 400 });
|
|
8952
8952
|
return;
|
|
@@ -8965,7 +8965,7 @@ class W {
|
|
|
8965
8965
|
this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");
|
|
8966
8966
|
return;
|
|
8967
8967
|
}
|
|
8968
|
-
const s =
|
|
8968
|
+
const s = _e(t.body), r = t.getHeader("content-length");
|
|
8969
8969
|
if (r && s < Number(r)) {
|
|
8970
8970
|
this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");
|
|
8971
8971
|
return;
|
|
@@ -9002,10 +9002,10 @@ class W {
|
|
|
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 mi() {
|
|
9006
9006
|
return (o, e) => ({ session: e, held: !1, muted: !1 });
|
|
9007
9007
|
}
|
|
9008
|
-
class
|
|
9008
|
+
class Xe {
|
|
9009
9009
|
/**
|
|
9010
9010
|
* Constructs a new instance of the `SessionManager` class.
|
|
9011
9011
|
* @param server - SIP WebSocket Server URL.
|
|
@@ -9017,7 +9017,7 @@ class Ze {
|
|
|
9017
9017
|
autoStop: !0,
|
|
9018
9018
|
delegate: {},
|
|
9019
9019
|
iceStopWaitingOnServerReflexive: !1,
|
|
9020
|
-
managedSessionFactory:
|
|
9020
|
+
managedSessionFactory: mi(),
|
|
9021
9021
|
maxSimultaneousSessions: 2,
|
|
9022
9022
|
media: {},
|
|
9023
9023
|
optionsPingInterval: -1,
|
|
@@ -9031,9 +9031,9 @@ class Ze {
|
|
|
9031
9031
|
registererRegisterOptions: {},
|
|
9032
9032
|
sendDTMFUsingSessionDescriptionHandler: !1,
|
|
9033
9033
|
userAgentOptions: {}
|
|
9034
|
-
},
|
|
9034
|
+
}, Xe.stripUndefinedProperties(t));
|
|
9035
9035
|
const i = Object.assign({}, t.userAgentOptions);
|
|
9036
|
-
if (i.transportConstructor || (i.transportConstructor =
|
|
9036
|
+
if (i.transportConstructor || (i.transportConstructor = Re), i.transportOptions || (i.transportOptions = {
|
|
9037
9037
|
server: e
|
|
9038
9038
|
}), !i.uri && t.aor) {
|
|
9039
9039
|
const s = W.makeURI(t.aor);
|
|
@@ -9267,7 +9267,7 @@ class Ze {
|
|
|
9267
9267
|
}
|
|
9268
9268
|
};
|
|
9269
9269
|
});
|
|
9270
|
-
const n = new
|
|
9270
|
+
const n = new $e(this.userAgent, r, t);
|
|
9271
9271
|
return this.sendInvite(n, t, i).then(() => n);
|
|
9272
9272
|
}
|
|
9273
9273
|
/**
|
|
@@ -9419,7 +9419,7 @@ Duration=` + 2e3
|
|
|
9419
9419
|
async message(e, t) {
|
|
9420
9420
|
this.logger.log("Sending message...");
|
|
9421
9421
|
const i = W.makeURI(e);
|
|
9422
|
-
return i ? new
|
|
9422
|
+
return i ? new Vt(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() {
|
|
@@ -9474,7 +9474,7 @@ Duration=` + 2e3
|
|
|
9474
9474
|
t().then(() => {
|
|
9475
9475
|
this.registrationAttemptTimeout = void 0, s();
|
|
9476
9476
|
}).catch((n) => {
|
|
9477
|
-
this.registrationAttemptTimeout = void 0, n instanceof
|
|
9477
|
+
this.registrationAttemptTimeout = void 0, n instanceof Ce ? s() : r(n);
|
|
9478
9478
|
});
|
|
9479
9479
|
}, e ? 0 : i(this.options.registrationRetryInterval));
|
|
9480
9480
|
});
|
|
@@ -9680,7 +9680,7 @@ Duration=` + 2e3
|
|
|
9680
9680
|
const a = this.sessionManaged(e);
|
|
9681
9681
|
a !== void 0 && (this.enableReceiverTracks(e, !a.held), this.enableSenderTracks(e, !a.held && !a.muted));
|
|
9682
9682
|
}).catch((a) => {
|
|
9683
|
-
throw n.held = !t, a instanceof
|
|
9683
|
+
throw n.held = !t, a instanceof Ce && this.logger.error(`[${e.id}] A hold request is already in progress.`), a;
|
|
9684
9684
|
});
|
|
9685
9685
|
}
|
|
9686
9686
|
/**
|
|
@@ -9749,7 +9749,7 @@ Duration=` + 2e3
|
|
|
9749
9749
|
async terminate(e) {
|
|
9750
9750
|
switch (this.logger.log(`[${e.id}] Terminating...`), e.state) {
|
|
9751
9751
|
case m.Initial:
|
|
9752
|
-
if (e instanceof
|
|
9752
|
+
if (e instanceof $e)
|
|
9753
9753
|
return e.cancel().then(() => {
|
|
9754
9754
|
this.logger.log(`[${e.id}] Inviter never sent INVITE (canceled)`);
|
|
9755
9755
|
});
|
|
@@ -9759,7 +9759,7 @@ Duration=` + 2e3
|
|
|
9759
9759
|
});
|
|
9760
9760
|
throw new Error("Unknown session type.");
|
|
9761
9761
|
case m.Establishing:
|
|
9762
|
-
if (e instanceof
|
|
9762
|
+
if (e instanceof $e)
|
|
9763
9763
|
return e.cancel().then(() => {
|
|
9764
9764
|
this.logger.log(`[${e.id}] Inviter canceled (sent CANCEL)`);
|
|
9765
9765
|
});
|
|
@@ -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 wi {
|
|
9786
9786
|
/**
|
|
9787
9787
|
* Constructs a new instance of the `SimpleUser` class.
|
|
9788
9788
|
* @param server - SIP WebSocket Server URL.
|
|
@@ -9846,7 +9846,7 @@ class pi {
|
|
|
9846
9846
|
sendDTMFUsingSessionDescriptionHandler: this.options.sendDTMFUsingSessionDescriptionHandler,
|
|
9847
9847
|
userAgentOptions: this.options.userAgentOptions
|
|
9848
9848
|
};
|
|
9849
|
-
this.sessionManager = new
|
|
9849
|
+
this.sessionManager = new Xe(e, i), this.logger = this.sessionManager.userAgent.getLogger("sip.SimpleUser");
|
|
9850
9850
|
}
|
|
9851
9851
|
/**
|
|
9852
9852
|
* Instance identifier.
|
|
@@ -10051,13 +10051,13 @@ class pi {
|
|
|
10051
10051
|
return this.logger.log(`[${this.id}] sending message...`), this.sessionManager.message(e, t);
|
|
10052
10052
|
}
|
|
10053
10053
|
}
|
|
10054
|
-
const
|
|
10054
|
+
const yi = 15e3, bi = 15e3, Ve = (o, e, t) => {
|
|
10055
10055
|
const i = String(o?.name || o?.code || "").trim(), s = new Error(e);
|
|
10056
10056
|
return s.name = i || "MediaAccessError", s.code = t, s.cause = o, s;
|
|
10057
|
-
},
|
|
10057
|
+
}, Ge = (o) => {
|
|
10058
10058
|
const e = new Error(o);
|
|
10059
10059
|
return e.name = "SipClientLifecycleCancelledError", e.code = "sip_client_replaced", e;
|
|
10060
|
-
},
|
|
10060
|
+
}, Je = async (o, e = "call") => {
|
|
10061
10061
|
const t = String(o?.name || o?.code || "").trim(), i = String(o?.message || "").trim(), s = `${t} ${i}`.toLowerCase();
|
|
10062
10062
|
let r = "";
|
|
10063
10063
|
try {
|
|
@@ -10068,30 +10068,30 @@ const mi = 15e3, wi = 15e3, je = (o, e, t) => {
|
|
|
10068
10068
|
} catch {
|
|
10069
10069
|
r = "";
|
|
10070
10070
|
}
|
|
10071
|
-
return r === "denied" || t === "NotAllowedError" || t === "SecurityError" || s.includes("notallowederror") || s.includes("permission denied") || s.includes("permission dismissed") || s.includes("microphone permission") || s.includes("getusermedia() no permission") ?
|
|
10071
|
+
return r === "denied" || t === "NotAllowedError" || t === "SecurityError" || s.includes("notallowederror") || s.includes("permission denied") || s.includes("permission dismissed") || s.includes("microphone permission") || s.includes("getusermedia() no permission") ? Ve(
|
|
10072
10072
|
o,
|
|
10073
10073
|
`浏览器未授予麦克风权限,无法${e === "answer" ? "接听来电" : "发起通话"}。请点击地址栏的麦克风权限并选择“允许”,然后刷新页面重试。`,
|
|
10074
10074
|
"media_permission_denied"
|
|
10075
|
-
) : t === "NotFoundError" || t === "DevicesNotFoundError" || s.includes("notfounderror") || s.includes("requested device not found") || s.includes("no audio input device") ?
|
|
10075
|
+
) : t === "NotFoundError" || t === "DevicesNotFoundError" || s.includes("notfounderror") || s.includes("requested device not found") || s.includes("no audio input device") ? Ve(
|
|
10076
10076
|
o,
|
|
10077
10077
|
"未检测到可用的麦克风设备,无法建立语音通话。请连接耳麦或启用系统麦克风后重试。",
|
|
10078
10078
|
"media_device_not_found"
|
|
10079
|
-
) : t === "NotReadableError" || t === "TrackStartError" || s.includes("notreadableerror") || s.includes("could not start audio source") ?
|
|
10079
|
+
) : t === "NotReadableError" || t === "TrackStartError" || s.includes("notreadableerror") || s.includes("could not start audio source") ? Ve(
|
|
10080
10080
|
o,
|
|
10081
10081
|
"麦克风当前被系统或其他应用占用,无法建立语音通话。请关闭占用麦克风的程序后重试。",
|
|
10082
10082
|
"media_device_unavailable"
|
|
10083
10083
|
) : o;
|
|
10084
|
-
},
|
|
10084
|
+
}, vi = async (o = "call") => {
|
|
10085
10085
|
if (typeof navigator > "u" || !navigator.mediaDevices?.getUserMedia)
|
|
10086
10086
|
return null;
|
|
10087
10087
|
let e = null;
|
|
10088
10088
|
try {
|
|
10089
10089
|
return e = await navigator.mediaDevices.getUserMedia({ audio: !0, video: !1 }), e;
|
|
10090
10090
|
} catch (t) {
|
|
10091
|
-
throw await
|
|
10091
|
+
throw await Je(t, o);
|
|
10092
10092
|
}
|
|
10093
10093
|
};
|
|
10094
|
-
class
|
|
10094
|
+
class Si {
|
|
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 bi {
|
|
|
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) : yi, this.registrationConfirmTimeoutMs = Number.isFinite(Number(t.registrationConfirmTimeoutMs)) ? Number(t.registrationConfirmTimeoutMs) : bi, this.peerConnectionDebug = {
|
|
10103
10103
|
attached: !1,
|
|
10104
10104
|
events: [],
|
|
10105
10105
|
iceCandidates: [],
|
|
@@ -10323,7 +10323,7 @@ class bi {
|
|
|
10323
10323
|
registererOptions: {
|
|
10324
10324
|
expires: 1800
|
|
10325
10325
|
}
|
|
10326
|
-
}, w = new
|
|
10326
|
+
}, w = new wi(d, h);
|
|
10327
10327
|
return w.delegate = {
|
|
10328
10328
|
onServerConnect: () => {
|
|
10329
10329
|
this.connected = !0, this._resolveConnectionWaiters(), this.onStateChange && this.onStateChange("connected", this.getConnectionSnapshot());
|
|
@@ -10402,7 +10402,7 @@ class bi {
|
|
|
10402
10402
|
}
|
|
10403
10403
|
_assertSimpleUserIsCurrent(e, t = "当前操作") {
|
|
10404
10404
|
if (!(e && this.simpleUser === e && this.account))
|
|
10405
|
-
throw
|
|
10405
|
+
throw Ge(`SIP 客户端已重置,已取消${t}。`);
|
|
10406
10406
|
}
|
|
10407
10407
|
_resolveRegistrationWaiters() {
|
|
10408
10408
|
if (!this.registrationWaiters.size)
|
|
@@ -10599,9 +10599,9 @@ class bi {
|
|
|
10599
10599
|
async _preflightAudioAccess(e = "call") {
|
|
10600
10600
|
let t = null;
|
|
10601
10601
|
try {
|
|
10602
|
-
t = await
|
|
10602
|
+
t = await vi(e);
|
|
10603
10603
|
} catch (i) {
|
|
10604
|
-
const s = await
|
|
10604
|
+
const s = await Je(i, e);
|
|
10605
10605
|
throw this.onError && this.onError(s), this.lastFailureMeta = {
|
|
10606
10606
|
source: "media-preflight",
|
|
10607
10607
|
code: s?.code || null,
|
|
@@ -10660,7 +10660,7 @@ class bi {
|
|
|
10660
10660
|
}
|
|
10661
10661
|
}
|
|
10662
10662
|
async _normalizeMediaAccessError(e, t = "call") {
|
|
10663
|
-
return
|
|
10663
|
+
return Je(e, t);
|
|
10664
10664
|
}
|
|
10665
10665
|
_createInviteRequestDelegate(e) {
|
|
10666
10666
|
const t = (s, ...r) => {
|
|
@@ -10766,7 +10766,7 @@ class bi {
|
|
|
10766
10766
|
}
|
|
10767
10767
|
}
|
|
10768
10768
|
async destroy() {
|
|
10769
|
-
this._rejectConnectionWaiters(
|
|
10769
|
+
this._rejectConnectionWaiters(Ge("SIP 客户端已销毁,已取消连接等待。")), this._rejectRegistrationWaiters(Ge("SIP 客户端已销毁,已取消注册等待。")), this.ensureReadyPromise = null;
|
|
10770
10770
|
const e = this.simpleUser;
|
|
10771
10771
|
if (e)
|
|
10772
10772
|
try {
|
|
@@ -11052,54 +11052,73 @@ class bi {
|
|
|
11052
11052
|
this.audioContext = null;
|
|
11053
11053
|
}
|
|
11054
11054
|
}
|
|
11055
|
-
const
|
|
11056
|
-
function
|
|
11055
|
+
const Ti = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
11056
|
+
function Ci(o, e = "") {
|
|
11057
11057
|
const t = String(o || e || "").trim();
|
|
11058
11058
|
if (!t)
|
|
11059
11059
|
throw new Error("缺少统一服务基址");
|
|
11060
11060
|
return t;
|
|
11061
11061
|
}
|
|
11062
|
-
function
|
|
11063
|
-
return
|
|
11062
|
+
function Rt(o, e = "https://") {
|
|
11063
|
+
return Ti.test(o) ? o : `${e}${o.replace(/^\/+/, "")}`;
|
|
11064
11064
|
}
|
|
11065
|
-
function
|
|
11065
|
+
function Qe(o = "/") {
|
|
11066
11066
|
return o.endsWith("/") ? o : `${o}/`;
|
|
11067
11067
|
}
|
|
11068
|
-
function
|
|
11069
|
-
const t =
|
|
11068
|
+
function xt(o = "/", e = "") {
|
|
11069
|
+
const t = Qe(o || "/"), i = String(e || "").replace(/^\/+/, "");
|
|
11070
11070
|
return i ? `${t}${i}` : t;
|
|
11071
11071
|
}
|
|
11072
|
-
function
|
|
11073
|
-
|
|
11074
|
-
|
|
11072
|
+
function ye(o = "") {
|
|
11073
|
+
return String(o || "").replace(/^\/+/, "");
|
|
11074
|
+
}
|
|
11075
|
+
function It(o = "") {
|
|
11076
|
+
const e = String(o || ""), t = e.indexOf("?");
|
|
11077
|
+
return t < 0 ? {
|
|
11078
|
+
pathname: ye(e),
|
|
11079
|
+
search: ""
|
|
11080
|
+
} : {
|
|
11081
|
+
pathname: ye(e.slice(0, t)),
|
|
11082
|
+
search: e.slice(t)
|
|
11083
|
+
};
|
|
11084
|
+
}
|
|
11085
|
+
function Ei(o = "/", e = "/") {
|
|
11086
|
+
const t = String(o || "/"), i = Qe(e || "/");
|
|
11087
|
+
return i !== "/" && t.startsWith(i) ? ye(t.slice(i.length)) : ye(t);
|
|
11075
11088
|
}
|
|
11076
|
-
function
|
|
11077
|
-
|
|
11089
|
+
function xe(o, e = "") {
|
|
11090
|
+
const t = Rt(Ci(o, e)), i = new URL(t);
|
|
11091
|
+
return i.search = "", i.hash = "", i.pathname = Qe(i.pathname || "/"), i;
|
|
11092
|
+
}
|
|
11093
|
+
function _i(o, e = "") {
|
|
11094
|
+
return xe(o, e).pathname !== "/";
|
|
11078
11095
|
}
|
|
11079
11096
|
function Y(o, e, t = "") {
|
|
11080
|
-
const i =
|
|
11081
|
-
return i.pathname =
|
|
11097
|
+
const i = xe(o, t), s = It(e);
|
|
11098
|
+
return i.pathname = xt(i.pathname, s.pathname), i.search = s.search, i.href;
|
|
11082
11099
|
}
|
|
11083
|
-
function
|
|
11084
|
-
const i =
|
|
11085
|
-
|
|
11100
|
+
function We(o, e = "ws", t = "") {
|
|
11101
|
+
const i = xe(o, t);
|
|
11102
|
+
i.protocol === "https:" ? i.protocol = "wss:" : i.protocol === "http:" ? i.protocol = "ws:" : i.protocol !== "ws:" && i.protocol !== "wss:" && (i.protocol = "wss:");
|
|
11103
|
+
const s = It(e);
|
|
11104
|
+
return i.pathname = xt(i.pathname, s.pathname), i.search = s.search, i.href;
|
|
11086
11105
|
}
|
|
11087
|
-
function
|
|
11106
|
+
function dt(o, e = "", t = "") {
|
|
11088
11107
|
if (!String(o || "").trim())
|
|
11089
|
-
return
|
|
11090
|
-
const
|
|
11091
|
-
return `${
|
|
11108
|
+
return ye(e);
|
|
11109
|
+
const i = new URL(Rt(String(o).trim())), s = String(t || "").trim() ? xe(t).pathname : "/", r = Ei(i.pathname || "/", s), n = String(i.search || "");
|
|
11110
|
+
return `${r}${n}` || ye(e);
|
|
11092
11111
|
}
|
|
11093
|
-
function
|
|
11112
|
+
function lt({
|
|
11094
11113
|
apiBaseUrl: o,
|
|
11095
11114
|
transportBaseUrl: e = "",
|
|
11096
11115
|
transportUrl: t = "",
|
|
11097
11116
|
fallbackPath: i = "ws"
|
|
11098
11117
|
}) {
|
|
11099
11118
|
const s = String(e || "").trim();
|
|
11100
|
-
return s ?
|
|
11119
|
+
return s ? We(s, dt(t, i, s)) : _i(o) ? We(o, dt(t, i, o)) : String(t || "").trim() ? String(t).trim() : We(o, i);
|
|
11101
11120
|
}
|
|
11102
|
-
const
|
|
11121
|
+
const Ri = `
|
|
11103
11122
|
:host { all: initial; }
|
|
11104
11123
|
.widget { font-family: "Noto Sans SC", "PingFang SC", sans-serif; color: #16302b; }
|
|
11105
11124
|
.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); }
|
|
@@ -11149,30 +11168,30 @@ const Ci = `
|
|
|
11149
11168
|
rejected: "本次来电已拒接,widget 仍保持待机。",
|
|
11150
11169
|
missed: "本次来电未接听,widget 仍保持待机。",
|
|
11151
11170
|
failed: "本次呼叫失败,请先看下方日志。"
|
|
11152
|
-
},
|
|
11171
|
+
}, xi = "手机网页首次接入时,请允许麦克风权限;若切到后台后再回来,先确认页面仍保持前台活跃。", Ii = 5e3, Ai = 15e3, ht = 2, ve = 3e4, $i = 1200, Di = 3e4, ki = 4e3, Ie = {
|
|
11153
11172
|
ready: "线路可用",
|
|
11154
11173
|
preparing: "正在准备",
|
|
11155
11174
|
working: "通话处理中",
|
|
11156
11175
|
recovering: "正在恢复",
|
|
11157
11176
|
offline: "当前离线",
|
|
11158
11177
|
conflicted: "协议冲突"
|
|
11159
|
-
},
|
|
11178
|
+
}, Se = Object.freeze({
|
|
11160
11179
|
standby: "widget_standby",
|
|
11161
11180
|
outbound: "outbound"
|
|
11162
|
-
}),
|
|
11181
|
+
}), ut = Object.freeze({
|
|
11163
11182
|
standby: "standby",
|
|
11164
11183
|
outbound: "outbound"
|
|
11165
|
-
}),
|
|
11184
|
+
}), Ze = Object.freeze({
|
|
11166
11185
|
keep: "keep",
|
|
11167
11186
|
restartStandby: "restart_standby"
|
|
11168
|
-
}),
|
|
11187
|
+
}), Pi = /* @__PURE__ */ new Set([
|
|
11169
11188
|
"session_missing_or_terminal",
|
|
11170
11189
|
"session_binding_changed",
|
|
11171
11190
|
"session_anchor_changed",
|
|
11172
11191
|
"browser_lease_lost",
|
|
11173
11192
|
"anchor_or_browser_conflict"
|
|
11174
11193
|
]);
|
|
11175
|
-
function
|
|
11194
|
+
function Hi(o, e) {
|
|
11176
11195
|
return e ? `${o}
|
|
11177
11196
|
${JSON.stringify(e, null, 2)}` : o;
|
|
11178
11197
|
}
|
|
@@ -11182,7 +11201,7 @@ function $(o, e, t) {
|
|
|
11182
11201
|
function ie(o) {
|
|
11183
11202
|
return typeof o == "string" ? o.trim() : "";
|
|
11184
11203
|
}
|
|
11185
|
-
function
|
|
11204
|
+
function gt(o, e, t) {
|
|
11186
11205
|
const i = ie(o?.session_mode);
|
|
11187
11206
|
if (!i)
|
|
11188
11207
|
throw N(`${t} 缺少必填字段 session_mode。`, {
|
|
@@ -11191,7 +11210,7 @@ function ht(o, e, t) {
|
|
|
11191
11210
|
expected_session_mode: e,
|
|
11192
11211
|
received_session_mode: null
|
|
11193
11212
|
});
|
|
11194
|
-
if (!Object.values(
|
|
11213
|
+
if (!Object.values(Se).includes(i))
|
|
11195
11214
|
throw N(`${t} 返回了未登记的 session_mode。`, {
|
|
11196
11215
|
source: t,
|
|
11197
11216
|
session_id: o?.session_id || null,
|
|
@@ -11207,7 +11226,7 @@ function ht(o, e, t) {
|
|
|
11207
11226
|
});
|
|
11208
11227
|
return i;
|
|
11209
11228
|
}
|
|
11210
|
-
function
|
|
11229
|
+
function Mi(o, e = {}) {
|
|
11211
11230
|
const t = ie(e?.session_action).toLowerCase(), i = ie(e?.session_action_reason) || null, s = ie(e?.session_action_detail) || null, r = ie(e?.resolved_session_id) || null, n = ie(e?.resolved_widget_anchor_number) || null, a = ie(e?.resolved_browser_sip_username) || null, d = {
|
|
11212
11231
|
source: o,
|
|
11213
11232
|
session_action: t || null,
|
|
@@ -11219,9 +11238,9 @@ function ki(o, e = {}) {
|
|
|
11219
11238
|
};
|
|
11220
11239
|
if (!t)
|
|
11221
11240
|
throw N("服务端缺少必填字段 session_action。", d);
|
|
11222
|
-
if (!Object.values(
|
|
11241
|
+
if (!Object.values(Ze).includes(t))
|
|
11223
11242
|
throw N("服务端返回了未登记的 session_action。", d);
|
|
11224
|
-
if (t ===
|
|
11243
|
+
if (t === Ze.keep) {
|
|
11225
11244
|
if (i || s)
|
|
11226
11245
|
throw N("session_action=keep 时不得携带 session_action_reason 或 session_action_detail。", d);
|
|
11227
11246
|
return {
|
|
@@ -11235,7 +11254,7 @@ function ki(o, e = {}) {
|
|
|
11235
11254
|
}
|
|
11236
11255
|
if (!i)
|
|
11237
11256
|
throw N("session_action=restart_standby 时必须携带 session_action_reason。", d);
|
|
11238
|
-
if (
|
|
11257
|
+
if (!Pi.has(i))
|
|
11239
11258
|
throw N("服务端返回了未登记的 session_action_reason。", d);
|
|
11240
11259
|
if (!s)
|
|
11241
11260
|
throw N("session_action=restart_standby 时必须携带非空的 session_action_detail。", d);
|
|
@@ -11259,19 +11278,19 @@ function ki(o, e = {}) {
|
|
|
11259
11278
|
resolvedBrowserSipUsername: a
|
|
11260
11279
|
};
|
|
11261
11280
|
}
|
|
11262
|
-
function
|
|
11281
|
+
function qi(o) {
|
|
11263
11282
|
return o === "outbound" ? "outbound" : "terminal";
|
|
11264
11283
|
}
|
|
11265
|
-
function
|
|
11284
|
+
function Oi(o) {
|
|
11266
11285
|
return typeof o == "function";
|
|
11267
11286
|
}
|
|
11268
|
-
function
|
|
11287
|
+
function Fi() {
|
|
11269
11288
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).get("embeddedCallWidgetE2E") === "1";
|
|
11270
11289
|
}
|
|
11271
|
-
function
|
|
11290
|
+
function Ni() {
|
|
11272
11291
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `widget-${Date.now()}-${Math.random().toString(16).slice(2, 10)}`;
|
|
11273
11292
|
}
|
|
11274
|
-
function
|
|
11293
|
+
function Ke(o) {
|
|
11275
11294
|
const e = String(o?.message || o || "");
|
|
11276
11295
|
return /Failed to fetch|NetworkError|Load failed|network/i.test(e);
|
|
11277
11296
|
}
|
|
@@ -11282,27 +11301,27 @@ function re(o = {}, e = null) {
|
|
|
11282
11301
|
const s = String(o?.businessKey ?? "").trim();
|
|
11283
11302
|
return s || "";
|
|
11284
11303
|
}
|
|
11285
|
-
function
|
|
11304
|
+
function Ui(o) {
|
|
11286
11305
|
const e = new Error(o);
|
|
11287
11306
|
return e.name = "EmbeddedCallWidgetLifecycleCancelledError", e.code = "widget_runtime_run_stale", e;
|
|
11288
11307
|
}
|
|
11289
|
-
function
|
|
11308
|
+
function ft(o) {
|
|
11290
11309
|
return o?.code === "sip_client_replaced" || o?.code === "widget_runtime_run_stale";
|
|
11291
11310
|
}
|
|
11292
11311
|
function N(o, e = {}) {
|
|
11293
11312
|
const t = new Error(o);
|
|
11294
11313
|
return t.name = "EmbeddedCallWidgetProtocolViolationError", t.code = "widget_protocol_violation", t.detail = e, t;
|
|
11295
11314
|
}
|
|
11296
|
-
function
|
|
11315
|
+
function Ae(o) {
|
|
11297
11316
|
return o?.code === "widget_protocol_violation";
|
|
11298
11317
|
}
|
|
11299
|
-
class
|
|
11318
|
+
class Li {
|
|
11300
11319
|
constructor({ mount: e, shadowRoot: t, options: i }) {
|
|
11301
|
-
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode =
|
|
11320
|
+
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = qi(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = xe(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 = Fi(), this.terminalFailureOverride = "", this.presenceId = Ni(), 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 = {};
|
|
11302
11321
|
}
|
|
11303
11322
|
async mount() {
|
|
11304
11323
|
this.isMobileViewport = typeof window < "u" && window.matchMedia("(max-width: 480px)").matches, this.shadowRoot.innerHTML = `
|
|
11305
|
-
<style>${
|
|
11324
|
+
<style>${Ri}</style>
|
|
11306
11325
|
<section class="widget">
|
|
11307
11326
|
<div class="panel">
|
|
11308
11327
|
<div class="hero">
|
|
@@ -11367,11 +11386,11 @@ class Fi {
|
|
|
11367
11386
|
}
|
|
11368
11387
|
assertLifecycleRunCurrent(e) {
|
|
11369
11388
|
if (e !== this.lifecycleRunId)
|
|
11370
|
-
throw
|
|
11389
|
+
throw Ui("网页电话已切换到新的连接流程,旧流程不再继续。");
|
|
11371
11390
|
}
|
|
11372
11391
|
emitHostCallback(e, t) {
|
|
11373
11392
|
const i = this.options?.[e];
|
|
11374
|
-
if (
|
|
11393
|
+
if (Oi(i))
|
|
11375
11394
|
try {
|
|
11376
11395
|
i(t);
|
|
11377
11396
|
} catch (s) {
|
|
@@ -11488,18 +11507,18 @@ class Fi {
|
|
|
11488
11507
|
route_note: i.routeNote || null
|
|
11489
11508
|
});
|
|
11490
11509
|
} catch (t) {
|
|
11491
|
-
if (this.pendingLifecycleMode = null,
|
|
11510
|
+
if (this.pendingLifecycleMode = null, ft(t)) {
|
|
11492
11511
|
this.appendLog("已忽略过期的网页电话呼叫流程", {
|
|
11493
11512
|
message: t?.message || String(t)
|
|
11494
11513
|
});
|
|
11495
11514
|
return;
|
|
11496
11515
|
}
|
|
11497
|
-
if (
|
|
11516
|
+
if (Ae(t)) {
|
|
11498
11517
|
await this.handleProtocolViolation(t);
|
|
11499
11518
|
return;
|
|
11500
11519
|
}
|
|
11501
11520
|
const i = t?.message || String(t);
|
|
11502
|
-
if (this.terminalFailureOverride = i, this.setState("failed", i),
|
|
11521
|
+
if (this.terminalFailureOverride = i, this.setState("failed", i), Ke(t) || this.networkOnline === !1 ? this.setAvailabilityState("offline", this.networkOnline === !1 ? "当前网络连接已断开,正在等待恢复。" : "当前无法连接通话服务,正在自动尝试恢复。") : this.setAvailabilityState("recovering", "呼叫失败,正在准备恢复网页电话待机。"), this.appendLog("连接并呼叫失败", { message: i }), await this.releaseIssuedSession("failed", "connect-and-call-failed"), !this.legacyOutboundOnly) {
|
|
11503
11522
|
this.appendLog("呼叫失败后,网页电话将恢复待机。", { message: i }), await this.startStandby({ force: !0 });
|
|
11504
11523
|
return;
|
|
11505
11524
|
}
|
|
@@ -11524,18 +11543,18 @@ class Fi {
|
|
|
11524
11543
|
browser_sip_username: this.issuedSession?.browser_sip_username || this.issuedSession?.sip_username || null
|
|
11525
11544
|
}), this.emitHostCallback("onStandbyReady", this.getSnapshot());
|
|
11526
11545
|
} catch (s) {
|
|
11527
|
-
if (
|
|
11546
|
+
if (ft(s)) {
|
|
11528
11547
|
this.appendLog("已忽略过期的网页电话待机流程", {
|
|
11529
11548
|
message: s?.message || String(s)
|
|
11530
11549
|
});
|
|
11531
11550
|
return;
|
|
11532
11551
|
}
|
|
11533
|
-
if (this.pendingLifecycleMode = null,
|
|
11552
|
+
if (this.pendingLifecycleMode = null, Ae(s)) {
|
|
11534
11553
|
await this.handleProtocolViolation(s);
|
|
11535
11554
|
return;
|
|
11536
11555
|
}
|
|
11537
11556
|
const r = s?.message || String(s);
|
|
11538
|
-
this.terminalFailureOverride = r, this.setState("failed", r),
|
|
11557
|
+
this.terminalFailureOverride = r, this.setState("failed", r), Ke(s) || this.networkOnline === !1 ? this.setAvailabilityState("offline", this.networkOnline === !1 ? "当前网络连接已断开,正在等待恢复。" : "当前无法连接通话服务,正在自动尝试恢复。") : this.setAvailabilityState("recovering", "当前未能完成待机注册,系统会继续自动恢复。"), this.appendLog("进入待机失败", { message: r }), await this.releaseIssuedSession("failed", "standby-start-failed"), this.setState("failed", r), !this.legacyOutboundOnly && this.networkOnline !== !1 && this.scheduleAutoStandbyRecovery("standby-start-failed");
|
|
11539
11558
|
}
|
|
11540
11559
|
}
|
|
11541
11560
|
async ensureClient(e) {
|
|
@@ -11546,7 +11565,7 @@ class Fi {
|
|
|
11546
11565
|
webrtc_url: e.transport,
|
|
11547
11566
|
ice_servers: this.turnIceServers
|
|
11548
11567
|
};
|
|
11549
|
-
this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new
|
|
11568
|
+
this.client?.matchesAccount(t) || (this.client && await this.client.destroy(), this.client = new Si(t, {
|
|
11550
11569
|
remoteAudioElement: this.refs.audio,
|
|
11551
11570
|
onStateChange: (i, s) => {
|
|
11552
11571
|
this.handleClientState(i, s);
|
|
@@ -11614,10 +11633,10 @@ class Fi {
|
|
|
11614
11633
|
const t = this.transportDisconnectContext, i = !!(e && t?.reported && this.sameTransportDisconnectContext(t));
|
|
11615
11634
|
this.stopTransportDisconnectGrace(), i && (await this.reportIssuedSessionEvent("transport-restored", {
|
|
11616
11635
|
disconnectDurationMs: Date.now() - (t.startedAt || Date.now()),
|
|
11617
|
-
graceMs:
|
|
11636
|
+
graceMs: ve
|
|
11618
11637
|
}, this.state), this.appendLog("网页通话信令已恢复", {
|
|
11619
11638
|
disconnectDurationMs: Date.now() - (t.startedAt || Date.now()),
|
|
11620
|
-
graceMs:
|
|
11639
|
+
graceMs: ve
|
|
11621
11640
|
}));
|
|
11622
11641
|
}
|
|
11623
11642
|
scheduleTransportDisconnectGrace(e) {
|
|
@@ -11633,12 +11652,12 @@ class Fi {
|
|
|
11633
11652
|
this.transportDisconnectContext = t, this.transportDisconnectTimer = window.setTimeout(() => {
|
|
11634
11653
|
this.transportDisconnectTimer = null, this.sameTransportDisconnectContext(t) && (t.reported = !0, this.reportIssuedSessionEvent("transport-disconnected", {
|
|
11635
11654
|
state: e,
|
|
11636
|
-
graceMs:
|
|
11655
|
+
graceMs: ve
|
|
11637
11656
|
}, this.state), this.appendLog("网页通话信令断开超过宽限窗口", {
|
|
11638
|
-
graceMs:
|
|
11657
|
+
graceMs: ve,
|
|
11639
11658
|
state: e
|
|
11640
11659
|
}));
|
|
11641
|
-
},
|
|
11660
|
+
}, ve);
|
|
11642
11661
|
}
|
|
11643
11662
|
async finalizeAfterTermination(e) {
|
|
11644
11663
|
if (!this.finalizing) {
|
|
@@ -11753,7 +11772,7 @@ class Fi {
|
|
|
11753
11772
|
const d = await r.json().catch(() => ({}));
|
|
11754
11773
|
throw new Error(d?.detail || `会话签发失败:${r.status}`);
|
|
11755
11774
|
}
|
|
11756
|
-
const n = await r.json(), a =
|
|
11775
|
+
const n = await r.json(), a = gt(n, Se.outbound, "issue-call-session");
|
|
11757
11776
|
return this.issuedSession = n, this.reportIssuedSessionEvent("issued-session-fetched", {
|
|
11758
11777
|
sessionId: n.session_id,
|
|
11759
11778
|
targetExtension: n.target_extension,
|
|
@@ -11773,7 +11792,7 @@ class Fi {
|
|
|
11773
11792
|
sipUsername: n.sip_username,
|
|
11774
11793
|
sipDomain: n.sip_domain,
|
|
11775
11794
|
password: n.sip_password,
|
|
11776
|
-
transport:
|
|
11795
|
+
transport: lt({
|
|
11777
11796
|
apiBaseUrl: this.apiBaseUrl,
|
|
11778
11797
|
transportBaseUrl: this.options.transportBaseUrl || "",
|
|
11779
11798
|
transportUrl: n.ws_server
|
|
@@ -11798,7 +11817,7 @@ class Fi {
|
|
|
11798
11817
|
const n = await i.json().catch(() => ({}));
|
|
11799
11818
|
throw new Error(n?.detail || `待机会话签发失败:${i.status}`);
|
|
11800
11819
|
}
|
|
11801
|
-
const s = await i.json(), r =
|
|
11820
|
+
const s = await i.json(), r = gt(s, Se.standby, "issue-widget-standby-session");
|
|
11802
11821
|
return this.issuedSession = s, this.reportIssuedSessionEvent("standby-session-fetched", {
|
|
11803
11822
|
sessionId: s.session_id,
|
|
11804
11823
|
resolvedBusinessKey: s.resolved_business_key || null,
|
|
@@ -11816,7 +11835,7 @@ class Fi {
|
|
|
11816
11835
|
sipUsername: s.sip_username,
|
|
11817
11836
|
sipDomain: s.sip_domain,
|
|
11818
11837
|
password: s.sip_password,
|
|
11819
|
-
transport:
|
|
11838
|
+
transport: lt({
|
|
11820
11839
|
apiBaseUrl: this.apiBaseUrl,
|
|
11821
11840
|
transportBaseUrl: this.options.transportBaseUrl || "",
|
|
11822
11841
|
transportUrl: s.ws_server
|
|
@@ -11897,9 +11916,9 @@ class Fi {
|
|
|
11897
11916
|
};
|
|
11898
11917
|
}
|
|
11899
11918
|
setAvailabilityState(e, t = "") {
|
|
11900
|
-
this.availabilityState = e, this.availabilityDetail = t || this.availabilityDetail, this.refs.availability && (this.refs.availability.textContent = t ? `${
|
|
11919
|
+
this.availabilityState = e, this.availabilityDetail = t || this.availabilityDetail, this.refs.availability && (this.refs.availability.textContent = t ? `${Ie[e] || Ie.recovering} · ${t}` : Ie[e] || Ie.recovering, this.refs.availability.className = `availability availability--${e}`), this.render();
|
|
11901
11920
|
}
|
|
11902
|
-
suppressExpectedClientTeardown(e, t =
|
|
11921
|
+
suppressExpectedClientTeardown(e, t = ki) {
|
|
11903
11922
|
this.expectedClientTeardown = {
|
|
11904
11923
|
reason: e,
|
|
11905
11924
|
expiresAt: Date.now() + t
|
|
@@ -11925,7 +11944,7 @@ class Fi {
|
|
|
11925
11944
|
clearAutoStandbyRecovery() {
|
|
11926
11945
|
this.autoStandbyRecoveryTimer && (window.clearTimeout(this.autoStandbyRecoveryTimer), this.autoStandbyRecoveryTimer = null);
|
|
11927
11946
|
}
|
|
11928
|
-
scheduleAutoStandbyRecovery(e, t =
|
|
11947
|
+
scheduleAutoStandbyRecovery(e, t = $i) {
|
|
11929
11948
|
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(() => {
|
|
11930
11949
|
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 })));
|
|
11931
11950
|
}, t));
|
|
@@ -11938,7 +11957,7 @@ class Fi {
|
|
|
11938
11957
|
markRecentlyReleasedSession(e, t) {
|
|
11939
11958
|
e && (this.pruneRecentlyReleasedSessions(), this.recentlyReleasedSessions.set(e, {
|
|
11940
11959
|
reason: t,
|
|
11941
|
-
expiresAt: Date.now() +
|
|
11960
|
+
expiresAt: Date.now() + Di
|
|
11942
11961
|
}));
|
|
11943
11962
|
}
|
|
11944
11963
|
wasSessionRecentlyReleased(e) {
|
|
@@ -12001,10 +12020,10 @@ class Fi {
|
|
|
12001
12020
|
async handleServerSessionAction(e, t = {}) {
|
|
12002
12021
|
if (this.legacyOutboundOnly)
|
|
12003
12022
|
return !1;
|
|
12004
|
-
const i =
|
|
12005
|
-
if (i.action !==
|
|
12023
|
+
const i = Mi(e, t);
|
|
12024
|
+
if (i.action !== Ze.restartStandby)
|
|
12006
12025
|
return !1;
|
|
12007
|
-
const s = ie(this.issuedSession?.session_mode), r = ie(this.pendingLifecycleMode), n = s ===
|
|
12026
|
+
const s = ie(this.issuedSession?.session_mode), r = ie(this.pendingLifecycleMode), n = s === Se.outbound || r === ut.outbound, a = s === Se.standby || r === ut.standby;
|
|
12008
12027
|
if (n || !a)
|
|
12009
12028
|
throw N("非待机协议上下文收到了非法的 restart_standby 指令。", {
|
|
12010
12029
|
source: e,
|
|
@@ -12089,16 +12108,16 @@ class Fi {
|
|
|
12089
12108
|
const s = await i.json().catch(() => ({}));
|
|
12090
12109
|
this.presenceFailureCount = 0, await this.handleServerSessionAction("touch-widget-presence", s) || this.syncAvailabilityState(), t && await this.restartStandbyAfterConnectivity(`presence-${e}`);
|
|
12091
12110
|
} catch (i) {
|
|
12092
|
-
if (
|
|
12111
|
+
if (Ae(i)) {
|
|
12093
12112
|
await this.handleProtocolViolation(i), this.syncAvailabilityState();
|
|
12094
12113
|
return;
|
|
12095
12114
|
}
|
|
12096
|
-
if (this.presenceFailureCount += 1, this.networkOnline === !1 ||
|
|
12115
|
+
if (this.presenceFailureCount += 1, this.networkOnline === !1 || Ke(i) || this.presenceFailureCount >= ht) {
|
|
12097
12116
|
const r = this.networkOnline === !1 ? "当前网络连接已断开,正在等待恢复。" : "当前无法连接通话服务,正在自动尝试恢复。";
|
|
12098
12117
|
this.setAvailabilityState("offline", r);
|
|
12099
12118
|
} else
|
|
12100
12119
|
this.setAvailabilityState("recovering", "正在确认后台连接状态。");
|
|
12101
|
-
this.presenceFailureCount <=
|
|
12120
|
+
this.presenceFailureCount <= ht && this.appendLog("widget 运行态心跳失败", {
|
|
12102
12121
|
trigger: e,
|
|
12103
12122
|
failure_count: this.presenceFailureCount,
|
|
12104
12123
|
message: i?.message || String(i)
|
|
@@ -12108,7 +12127,7 @@ class Fi {
|
|
|
12108
12127
|
startPresenceTouch() {
|
|
12109
12128
|
this.legacyOutboundOnly || (this.touchWidgetPresence("mount"), this.presenceTouchTimer || (this.presenceTouchTimer = window.setInterval(() => {
|
|
12110
12129
|
this.touchWidgetPresence("interval");
|
|
12111
|
-
},
|
|
12130
|
+
}, Ai)));
|
|
12112
12131
|
}
|
|
12113
12132
|
async touchIssuedSession(e, t = null) {
|
|
12114
12133
|
if (!this.issuedSession?.session_id)
|
|
@@ -12134,7 +12153,7 @@ class Fi {
|
|
|
12134
12153
|
const r = await s.json().catch(() => ({}));
|
|
12135
12154
|
await this.handleServerSessionAction("touch-call-session", r);
|
|
12136
12155
|
} catch (s) {
|
|
12137
|
-
if (
|
|
12156
|
+
if (Ae(s)) {
|
|
12138
12157
|
await this.handleProtocolViolation(s);
|
|
12139
12158
|
return;
|
|
12140
12159
|
}
|
|
@@ -12225,14 +12244,14 @@ class Fi {
|
|
|
12225
12244
|
}
|
|
12226
12245
|
this.touchIssuedSession(e), this.sessionTouchTimer || (this.sessionTouchTimer = window.setInterval(() => {
|
|
12227
12246
|
this.touchIssuedSession(this.state);
|
|
12228
|
-
},
|
|
12247
|
+
}, Ii));
|
|
12229
12248
|
}
|
|
12230
12249
|
setState(e, t = "") {
|
|
12231
12250
|
this.state = e, this.refs.status.textContent = t || te[e] || te.idle, this.syncAvailabilityState(), this.render(), this.emitHostCallback("onStateChange", this.getSnapshot());
|
|
12232
12251
|
}
|
|
12233
12252
|
appendLog(e, t) {
|
|
12234
12253
|
const i = document.createElement("div");
|
|
12235
|
-
for (i.className = "log", i.textContent =
|
|
12254
|
+
for (i.className = "log", i.textContent = Hi(e, t), this.refs.logs.prepend(i); this.refs.logs.children.length > 8; )
|
|
12236
12255
|
this.refs.logs.lastElementChild?.remove();
|
|
12237
12256
|
}
|
|
12238
12257
|
render() {
|
|
@@ -12242,18 +12261,18 @@ class Fi {
|
|
|
12242
12261
|
this.availabilityState === "offline" ? "status--offline" : this.availabilityState === "recovering" ? "status--recovering" : this.availabilityState === "conflicted" ? "status--conflicted" : ""
|
|
12243
12262
|
].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 = "网络恢复后再试" : this.availabilityState === "conflicted" ? 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" ? "挂断通话" : "断开电话");
|
|
12244
12263
|
const r = String(this.options.siteKey || "").trim(), n = String(this.bootstrap?.default_site_key || "").trim(), a = String(re(this.options) || "").trim(), d = String(this.bootstrap?.default_business_key || "").trim(), f = r || (n ? `${n}(服务端默认站点)` : "等待服务端解析"), h = this.issuedSession?.resolved_business_key || a || (d ? `${d}(服务端默认规则)` : "等待服务端解析");
|
|
12245
|
-
this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${h};站点键:${f}` : this.refs.meta.textContent = `站点键:${f};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${h}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.state === "incoming" ? this.refs.hint.textContent = "当前已有来电,直接接听或拒接即可;处理完成后会自动回到待机。" : this.state === "connected" ? this.refs.hint.textContent = "当前通话已接通,挂断后会自动回到待机,不需要额外刷新页面。" : this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.availabilityState === "conflicted" ? this.refs.hint.textContent = "检测到前后端协议不一致,当前已停止自动恢复。请先排查版本和协议口径,再继续使用。" : this.refs.hint.textContent = this.isMobileViewport ?
|
|
12264
|
+
this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${h};站点键:${f}` : this.refs.meta.textContent = `站点键:${f};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${h}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.state === "incoming" ? this.refs.hint.textContent = "当前已有来电,直接接听或拒接即可;处理完成后会自动回到待机。" : this.state === "connected" ? this.refs.hint.textContent = "当前通话已接通,挂断后会自动回到待机,不需要额外刷新页面。" : this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.availabilityState === "conflicted" ? this.refs.hint.textContent = "检测到前后端协议不一致,当前已停止自动恢复。请先排查版本和协议口径,再继续使用。" : this.refs.hint.textContent = this.isMobileViewport ? xi : "桌面网页可直接使用;若宿主站点启用了来源白名单或接入令牌,请按站点配置提供对应参数。";
|
|
12246
12265
|
}
|
|
12247
12266
|
async destroy() {
|
|
12248
12267
|
this.clearAutoStandbyRecovery(), await this.disconnectAndCleanup("destroy-widget", { suppressStateReset: !0 }), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingLifecycleMode = null, 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 = "";
|
|
12249
12268
|
}
|
|
12250
12269
|
}
|
|
12251
|
-
function
|
|
12252
|
-
return new
|
|
12270
|
+
function Bi(o) {
|
|
12271
|
+
return new Li(o);
|
|
12253
12272
|
}
|
|
12254
12273
|
typeof window < "u" && (window.__EmbeddedCallWidgetRuntime__ = {
|
|
12255
|
-
createEmbeddedCallWidgetRuntime:
|
|
12274
|
+
createEmbeddedCallWidgetRuntime: Bi
|
|
12256
12275
|
});
|
|
12257
12276
|
export {
|
|
12258
|
-
|
|
12277
|
+
Bi as createEmbeddedCallWidgetRuntime
|
|
12259
12278
|
};
|