@shenyin/embedded-call-widget 2.6.5 → 2.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/checksums.txt +3 -3
- package/embedded-call-widget-runtime.iife.js +5 -5
- package/embedded-call-widget-runtime.js +98 -64
- package/manifest.json +11 -11
- package/package.json +1 -1
|
@@ -204,7 +204,7 @@ class F extends nt {
|
|
|
204
204
|
return e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
class
|
|
207
|
+
class J extends nt {
|
|
208
208
|
/**
|
|
209
209
|
* Constructor
|
|
210
210
|
* @param scheme -
|
|
@@ -278,7 +278,7 @@ class Y extends nt {
|
|
|
278
278
|
this.headers = {};
|
|
279
279
|
}
|
|
280
280
|
clone() {
|
|
281
|
-
return new
|
|
281
|
+
return new J(this._raw.scheme, this._raw.user || "", this._raw.host, this._raw.port, JSON.parse(JSON.stringify(this.parameters)), JSON.parse(JSON.stringify(this.headers)));
|
|
282
282
|
}
|
|
283
283
|
toRaw() {
|
|
284
284
|
return this._toString(this._raw);
|
|
@@ -576,10 +576,10 @@ function _t(a, e) {
|
|
|
576
576
|
/^[\x0E-\x7F]/,
|
|
577
577
|
A([["", ""]], !1, !1),
|
|
578
578
|
function() {
|
|
579
|
-
e = e || { data: {} }, e.data.uri = new
|
|
579
|
+
e = e || { data: {} }, e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port;
|
|
580
580
|
},
|
|
581
581
|
function() {
|
|
582
|
-
e = e || { data: {} }, e.data.uri = new
|
|
582
|
+
e = e || { data: {} }, e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port, e.data.uri_params, e.data.uri_headers), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port, delete e.data.uri_params, e.startRule === "SIP_URI" && (e.data = e.data.uri);
|
|
583
583
|
},
|
|
584
584
|
"sips",
|
|
585
585
|
f("sips", !0),
|
|
@@ -679,7 +679,7 @@ function _t(a, e) {
|
|
|
679
679
|
l = l.join("").toLowerCase(), y = y.join(""), e = e || { data: {} }, e.data.uri_headers || (e.data.uri_headers = {}), e.data.uri_headers[l] ? e.data.uri_headers[l].push(y) : e.data.uri_headers[l] = [y];
|
|
680
680
|
},
|
|
681
681
|
function() {
|
|
682
|
-
e = e || { data: {} }, e.startRule === "Refer_To" && (e.data.uri = new
|
|
682
|
+
e = e || { data: {} }, e.startRule === "Refer_To" && (e.data.uri = new J(e.data.scheme, e.data.user, e.data.host, e.data.port, e.data.uri_params, e.data.uri_headers), delete e.data.scheme, delete e.data.user, delete e.data.host, delete e.data.host_type, delete e.data.port, delete e.data.uri_params);
|
|
683
683
|
},
|
|
684
684
|
"//",
|
|
685
685
|
f("//", !1),
|
|
@@ -1611,7 +1611,7 @@ function _e(a) {
|
|
|
1611
1611
|
function Ae() {
|
|
1612
1612
|
return oe(10);
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function z(a) {
|
|
1615
1615
|
const e = {
|
|
1616
1616
|
"Call-Id": "Call-ID",
|
|
1617
1617
|
Cseq: "CSeq",
|
|
@@ -1640,7 +1640,7 @@ class at {
|
|
|
1640
1640
|
*/
|
|
1641
1641
|
addHeader(e, t) {
|
|
1642
1642
|
const i = { raw: t };
|
|
1643
|
-
e =
|
|
1643
|
+
e = z(e), this.headers[e] ? this.headers[e].push(i) : this.headers[e] = [i];
|
|
1644
1644
|
}
|
|
1645
1645
|
/**
|
|
1646
1646
|
* Get the value of the given header name at the given position.
|
|
@@ -1648,7 +1648,7 @@ class at {
|
|
|
1648
1648
|
* @returns Returns the specified header, undefined if header doesn't exist.
|
|
1649
1649
|
*/
|
|
1650
1650
|
getHeader(e) {
|
|
1651
|
-
const t = this.headers[
|
|
1651
|
+
const t = this.headers[z(e)];
|
|
1652
1652
|
if (t) {
|
|
1653
1653
|
if (t[0])
|
|
1654
1654
|
return t[0].raw;
|
|
@@ -1661,7 +1661,7 @@ class at {
|
|
|
1661
1661
|
* @returns Array - with all the headers of the specified name.
|
|
1662
1662
|
*/
|
|
1663
1663
|
getHeaders(e) {
|
|
1664
|
-
const t = this.headers[
|
|
1664
|
+
const t = this.headers[z(e)], i = [];
|
|
1665
1665
|
if (!t)
|
|
1666
1666
|
return [];
|
|
1667
1667
|
for (const s of t)
|
|
@@ -1674,7 +1674,7 @@ class at {
|
|
|
1674
1674
|
* @returns true if header with given name exists, false otherwise
|
|
1675
1675
|
*/
|
|
1676
1676
|
hasHeader(e) {
|
|
1677
|
-
return !!this.headers[
|
|
1677
|
+
return !!this.headers[z(e)];
|
|
1678
1678
|
}
|
|
1679
1679
|
/**
|
|
1680
1680
|
* Parse the given header on the given index.
|
|
@@ -1685,7 +1685,7 @@ class at {
|
|
|
1685
1685
|
*/
|
|
1686
1686
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1687
1687
|
parseHeader(e, t = 0) {
|
|
1688
|
-
if (e =
|
|
1688
|
+
if (e = z(e), this.headers[e]) {
|
|
1689
1689
|
if (t >= this.headers[e].length)
|
|
1690
1690
|
return;
|
|
1691
1691
|
} else return;
|
|
@@ -1719,7 +1719,7 @@ class at {
|
|
|
1719
1719
|
* @param value - header value
|
|
1720
1720
|
*/
|
|
1721
1721
|
setHeader(e, t) {
|
|
1722
|
-
this.headers[
|
|
1722
|
+
this.headers[z(e)] = [{ raw: t }];
|
|
1723
1723
|
}
|
|
1724
1724
|
toString() {
|
|
1725
1725
|
return this.data;
|
|
@@ -1770,7 +1770,7 @@ class de {
|
|
|
1770
1770
|
* @returns Returns the specified header, undefined if header doesn't exist.
|
|
1771
1771
|
*/
|
|
1772
1772
|
getHeader(e) {
|
|
1773
|
-
const t = this.headers[
|
|
1773
|
+
const t = this.headers[z(e)];
|
|
1774
1774
|
if (t) {
|
|
1775
1775
|
if (t[0])
|
|
1776
1776
|
return t[0];
|
|
@@ -1787,7 +1787,7 @@ class de {
|
|
|
1787
1787
|
* @returns Array with all the headers of the specified name.
|
|
1788
1788
|
*/
|
|
1789
1789
|
getHeaders(e) {
|
|
1790
|
-
const t = [], i = this.headers[
|
|
1790
|
+
const t = [], i = this.headers[z(e)];
|
|
1791
1791
|
if (i)
|
|
1792
1792
|
for (const s of i)
|
|
1793
1793
|
t.push(s);
|
|
@@ -1804,7 +1804,7 @@ class de {
|
|
|
1804
1804
|
* @returns true if header with given name exists, false otherwise
|
|
1805
1805
|
*/
|
|
1806
1806
|
hasHeader(e) {
|
|
1807
|
-
if (this.headers[
|
|
1807
|
+
if (this.headers[z(e)])
|
|
1808
1808
|
return !0;
|
|
1809
1809
|
{
|
|
1810
1810
|
const t = new RegExp("^\\s*" + e + "\\s*:", "i");
|
|
@@ -1820,7 +1820,7 @@ class de {
|
|
|
1820
1820
|
* @param value - header value
|
|
1821
1821
|
*/
|
|
1822
1822
|
setHeader(e, t) {
|
|
1823
|
-
this.headers[
|
|
1823
|
+
this.headers[z(e)] = t instanceof Array ? t : [t];
|
|
1824
1824
|
}
|
|
1825
1825
|
/**
|
|
1826
1826
|
* The Via header field indicates the transport used for the transaction
|
|
@@ -1920,19 +1920,19 @@ var b;
|
|
|
1920
1920
|
(function(a) {
|
|
1921
1921
|
a.Initial = "Initial", a.HaveLocalOffer = "HaveLocalOffer", a.HaveRemoteOffer = "HaveRemoteOffer", a.Stable = "Stable", a.Closed = "Closed";
|
|
1922
1922
|
})(b = b || (b = {}));
|
|
1923
|
-
const
|
|
1924
|
-
T1:
|
|
1923
|
+
const X = 500, Dt = 4e3, Ze = 5e3, M = {
|
|
1924
|
+
T1: X,
|
|
1925
1925
|
T2: Dt,
|
|
1926
|
-
TIMER_B: 64 *
|
|
1927
|
-
TIMER_D: 0 *
|
|
1928
|
-
TIMER_F: 64 *
|
|
1929
|
-
TIMER_H: 64 *
|
|
1926
|
+
TIMER_B: 64 * X,
|
|
1927
|
+
TIMER_D: 0 * X,
|
|
1928
|
+
TIMER_F: 64 * X,
|
|
1929
|
+
TIMER_H: 64 * X,
|
|
1930
1930
|
TIMER_I: 0 * Ze,
|
|
1931
|
-
TIMER_J: 0 *
|
|
1931
|
+
TIMER_J: 0 * X,
|
|
1932
1932
|
TIMER_K: 0 * Ze,
|
|
1933
|
-
TIMER_L: 64 *
|
|
1934
|
-
TIMER_M: 64 *
|
|
1935
|
-
TIMER_N: 64 *
|
|
1933
|
+
TIMER_L: 64 * X,
|
|
1934
|
+
TIMER_M: 64 * X,
|
|
1935
|
+
TIMER_N: 64 * X,
|
|
1936
1936
|
PROVISIONAL_RESPONSE_INTERVAL: 6e4
|
|
1937
1937
|
// See RFC 3261 Section 13.3.1.1
|
|
1938
1938
|
};
|
|
@@ -2828,7 +2828,7 @@ class ge {
|
|
|
2828
2828
|
}
|
|
2829
2829
|
referToString(e) {
|
|
2830
2830
|
let t;
|
|
2831
|
-
if (e instanceof
|
|
2831
|
+
if (e instanceof J)
|
|
2832
2832
|
t = e.toString();
|
|
2833
2833
|
else {
|
|
2834
2834
|
if (!e.dialog)
|
|
@@ -3751,7 +3751,7 @@ var x;
|
|
|
3751
3751
|
(function(a) {
|
|
3752
3752
|
a.Initial = "Initial", a.Registered = "Registered", a.Unregistered = "Unregistered", a.Terminated = "Terminated";
|
|
3753
3753
|
})(x = x || (x = {}));
|
|
3754
|
-
class
|
|
3754
|
+
class Y {
|
|
3755
3755
|
/**
|
|
3756
3756
|
* Constructs a new instance of the `Registerer` class.
|
|
3757
3757
|
* @param userAgent - User agent. See {@link UserAgent} for details.
|
|
@@ -3760,16 +3760,16 @@ class z {
|
|
|
3760
3760
|
constructor(e, t = {}) {
|
|
3761
3761
|
this.disposed = !1, this._contacts = [], this._retryAfter = void 0, this._state = x.Initial, this._waiting = !1, this._stateEventEmitter = new be(), this._waitingEventEmitter = new be(), this.userAgent = e;
|
|
3762
3762
|
const i = e.configuration.uri.clone();
|
|
3763
|
-
if (i.user = void 0, this.options = Object.assign(Object.assign(Object.assign({},
|
|
3763
|
+
if (i.user = void 0, this.options = Object.assign(Object.assign(Object.assign({}, Y.defaultOptions()), { registrar: i }), Y.stripUndefinedProperties(t)), this.options.extraContactHeaderParams = (this.options.extraContactHeaderParams || []).slice(), this.options.extraHeaders = (this.options.extraHeaders || []).slice(), !this.options.registrar)
|
|
3764
3764
|
throw new Error("Registrar undefined.");
|
|
3765
3765
|
if (this.options.registrar = this.options.registrar.clone(), this.options.regId && !this.options.instanceId ? this.options.instanceId = this.userAgent.instanceId : !this.options.regId && this.options.instanceId && (this.options.regId = 1), this.options.instanceId && k.parse(this.options.instanceId, "uuid") === -1)
|
|
3766
3766
|
throw new Error("Invalid instanceId.");
|
|
3767
3767
|
if (this.options.regId && this.options.regId < 0)
|
|
3768
3768
|
throw new Error("Invalid regId.");
|
|
3769
3769
|
const s = this.options.registrar, r = this.options.params && this.options.params.fromUri || e.userAgentCore.configuration.aor, n = this.options.params && this.options.params.toUri || e.configuration.uri, o = this.options.params || {}, d = (t.extraHeaders || []).slice();
|
|
3770
|
-
if (this.request = e.userAgentCore.makeOutgoingRequestMessage(v.REGISTER, s, r, n, o, d, void 0), this.expires = this.options.expires ||
|
|
3770
|
+
if (this.request = e.userAgentCore.makeOutgoingRequestMessage(v.REGISTER, s, r, n, o, d, void 0), this.expires = this.options.expires || Y.defaultExpires, this.expires < 0)
|
|
3771
3771
|
throw new Error("Invalid expires.");
|
|
3772
|
-
if (this.refreshFrequency = this.options.refreshFrequency ||
|
|
3772
|
+
if (this.refreshFrequency = this.options.refreshFrequency || Y.defaultRefreshFrequency, this.refreshFrequency < 50 || this.refreshFrequency > 99)
|
|
3773
3773
|
throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");
|
|
3774
3774
|
this.logger = e.getLogger("sip.Registerer"), this.options.logConfiguration && (this.logger.log("Configuration:"), Object.keys(this.options).forEach((p) => {
|
|
3775
3775
|
const u = this.options[p];
|
|
@@ -3779,15 +3779,15 @@ class z {
|
|
|
3779
3779
|
/** Default registerer options. */
|
|
3780
3780
|
static defaultOptions() {
|
|
3781
3781
|
return {
|
|
3782
|
-
expires:
|
|
3782
|
+
expires: Y.defaultExpires,
|
|
3783
3783
|
extraContactHeaderParams: [],
|
|
3784
3784
|
extraHeaders: [],
|
|
3785
3785
|
logConfiguration: !0,
|
|
3786
3786
|
instanceId: "",
|
|
3787
3787
|
params: {},
|
|
3788
3788
|
regId: 0,
|
|
3789
|
-
registrar: new
|
|
3790
|
-
refreshFrequency:
|
|
3789
|
+
registrar: new J("sip", "anonymous", "anonymous.invalid"),
|
|
3790
|
+
refreshFrequency: Y.defaultRefreshFrequency
|
|
3791
3791
|
};
|
|
3792
3792
|
}
|
|
3793
3793
|
/**
|
|
@@ -4084,8 +4084,8 @@ class z {
|
|
|
4084
4084
|
t += " The Registerer transitions to 'Terminated' when Registerer.dispose() is called.", t += " Perhaps you called UserAgent.stop() which dipsoses of all Registerers?", this.logger.error(t);
|
|
4085
4085
|
}
|
|
4086
4086
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4087
|
+
Y.defaultExpires = 600;
|
|
4088
|
+
Y.defaultRefreshFrequency = 99;
|
|
4089
4089
|
var R;
|
|
4090
4090
|
(function(a) {
|
|
4091
4091
|
a.Initial = "Initial", a.NotifyWait = "NotifyWait", a.Pending = "Pending", a.Active = "Active", a.Terminated = "Terminated";
|
|
@@ -5798,7 +5798,7 @@ class U extends ut {
|
|
|
5798
5798
|
this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`), this.state === g.Completed && this.stateTransition(g.Terminated);
|
|
5799
5799
|
}
|
|
5800
5800
|
}
|
|
5801
|
-
class
|
|
5801
|
+
class Z {
|
|
5802
5802
|
constructor(e, t, i, s) {
|
|
5803
5803
|
this.transactionConstructor = e, this.core = t, this.message = i, this.delegate = s, this.logger = this.loggerFactory.getLogger("sip.user-agent-server"), this.toTag = i.toTag ? i.toTag : Ae(), this.init();
|
|
5804
5804
|
}
|
|
@@ -5942,7 +5942,7 @@ class J {
|
|
|
5942
5942
|
this.core.userAgentServers.set(t.id, this);
|
|
5943
5943
|
}
|
|
5944
5944
|
}
|
|
5945
|
-
class Ft extends
|
|
5945
|
+
class Ft extends Z {
|
|
5946
5946
|
constructor(e, t, i) {
|
|
5947
5947
|
super(U, e.userAgentCore, t, i);
|
|
5948
5948
|
}
|
|
@@ -5953,7 +5953,7 @@ class Nt extends q {
|
|
|
5953
5953
|
super(L, e.userAgentCore, s, t);
|
|
5954
5954
|
}
|
|
5955
5955
|
}
|
|
5956
|
-
class Ut extends
|
|
5956
|
+
class Ut extends Z {
|
|
5957
5957
|
constructor(e, t, i) {
|
|
5958
5958
|
super(U, e.userAgentCore, t, i);
|
|
5959
5959
|
}
|
|
@@ -5963,7 +5963,7 @@ class gt extends q {
|
|
|
5963
5963
|
super(L, e, t, i);
|
|
5964
5964
|
}
|
|
5965
5965
|
}
|
|
5966
|
-
class ft extends
|
|
5966
|
+
class ft extends Z {
|
|
5967
5967
|
constructor(e, t, i) {
|
|
5968
5968
|
super(U, e, t, i);
|
|
5969
5969
|
}
|
|
@@ -5977,7 +5977,7 @@ class Lt extends q {
|
|
|
5977
5977
|
function Bt(a) {
|
|
5978
5978
|
return a.userAgentCore !== void 0;
|
|
5979
5979
|
}
|
|
5980
|
-
class Re extends
|
|
5980
|
+
class Re extends Z {
|
|
5981
5981
|
/**
|
|
5982
5982
|
* NOTIFY UAS constructor.
|
|
5983
5983
|
* @param dialogOrCore - Dialog for in dialog NOTIFY, UserAgentCore for out of dialog NOTIFY (deprecated).
|
|
@@ -5994,7 +5994,7 @@ class jt extends q {
|
|
|
5994
5994
|
super(L, e.userAgentCore, s, t), e.signalingStateTransition(s);
|
|
5995
5995
|
}
|
|
5996
5996
|
}
|
|
5997
|
-
class Vt extends
|
|
5997
|
+
class Vt extends Z {
|
|
5998
5998
|
constructor(e, t, i) {
|
|
5999
5999
|
super(U, e.userAgentCore, t, i), e.signalingStateTransition(t), this.dialog = e;
|
|
6000
6000
|
}
|
|
@@ -6049,7 +6049,7 @@ class Gt extends q {
|
|
|
6049
6049
|
}
|
|
6050
6050
|
}
|
|
6051
6051
|
}
|
|
6052
|
-
class Wt extends
|
|
6052
|
+
class Wt extends Z {
|
|
6053
6053
|
constructor(e, t, i) {
|
|
6054
6054
|
super(N, e.userAgentCore, t, i), e.reinviteUserAgentServer = this, this.dialog = e;
|
|
6055
6055
|
}
|
|
@@ -6100,7 +6100,7 @@ class Kt extends q {
|
|
|
6100
6100
|
function zt(a) {
|
|
6101
6101
|
return a.userAgentCore !== void 0;
|
|
6102
6102
|
}
|
|
6103
|
-
class pt extends
|
|
6103
|
+
class pt extends Z {
|
|
6104
6104
|
/**
|
|
6105
6105
|
* REFER UAS constructor.
|
|
6106
6106
|
* @param dialogOrCore - Dialog for in dialog REFER, UserAgentCore for out of dialog REFER.
|
|
@@ -6696,7 +6696,7 @@ class Yt extends q {
|
|
|
6696
6696
|
}
|
|
6697
6697
|
}
|
|
6698
6698
|
}
|
|
6699
|
-
class Oe extends
|
|
6699
|
+
class Oe extends Z {
|
|
6700
6700
|
constructor(e, t, i) {
|
|
6701
6701
|
super(N, e, t, i), this.core = e;
|
|
6702
6702
|
}
|
|
@@ -6809,7 +6809,7 @@ class Zt extends q {
|
|
|
6809
6809
|
super(L, e, t, i);
|
|
6810
6810
|
}
|
|
6811
6811
|
}
|
|
6812
|
-
class Xt extends
|
|
6812
|
+
class Xt extends Z {
|
|
6813
6813
|
constructor(e, t, i) {
|
|
6814
6814
|
super(U, e, t, i), this.core = e;
|
|
6815
6815
|
}
|
|
@@ -7191,7 +7191,7 @@ class ei extends q {
|
|
|
7191
7191
|
this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."), this.waitNotifyStop(), this.delegate && this.delegate.onNotifyTimeout && this.delegate.onNotifyTimeout();
|
|
7192
7192
|
}
|
|
7193
7193
|
}
|
|
7194
|
-
class ti extends
|
|
7194
|
+
class ti extends Z {
|
|
7195
7195
|
constructor(e, t, i) {
|
|
7196
7196
|
super(U, e, t, i), this.core = e;
|
|
7197
7197
|
}
|
|
@@ -8496,7 +8496,7 @@ class V {
|
|
|
8496
8496
|
* @param options - Options bucket. See {@link UserAgentOptions} for details.
|
|
8497
8497
|
*/
|
|
8498
8498
|
constructor(e = {}) {
|
|
8499
|
-
if (this._publishers = {}, this._registerers = {}, this._sessions = {}, this._subscriptions = {}, this._state = D.Stopped, this._stateEventEmitter = new be(), this.delegate = e.delegate, this.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, V.defaultOptions()), { sipjsId: oe(5) }), { uri: new
|
|
8499
|
+
if (this._publishers = {}, this._registerers = {}, this._sessions = {}, this._subscriptions = {}, this._state = D.Stopped, this._stateEventEmitter = new be(), this.delegate = e.delegate, this.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, V.defaultOptions()), { sipjsId: oe(5) }), { uri: new J("sip", "anonymous." + oe(6), "anonymous.invalid") }), { viaHost: oe(12) + ".invalid" }), V.stripUndefinedProperties(e)), this.options.hackIpInContact)
|
|
8500
8500
|
if (typeof this.options.hackIpInContact == "boolean" && this.options.hackIpInContact) {
|
|
8501
8501
|
const s = Math.floor(Math.random() * 254 + 1);
|
|
8502
8502
|
this.options.viaHost = "192.0.2." + s;
|
|
@@ -8593,7 +8593,7 @@ class V {
|
|
|
8593
8593
|
sipjsId: "",
|
|
8594
8594
|
transportConstructor: Se,
|
|
8595
8595
|
transportOptions: {},
|
|
8596
|
-
uri: new
|
|
8596
|
+
uri: new J("sip", "anonymous", "anonymous.invalid"),
|
|
8597
8597
|
userAgentString: "SIP.js/" + Tt,
|
|
8598
8598
|
viaHost: ""
|
|
8599
8599
|
};
|
|
@@ -8797,7 +8797,7 @@ class V {
|
|
|
8797
8797
|
return {
|
|
8798
8798
|
pubGruu: void 0,
|
|
8799
8799
|
tempGruu: void 0,
|
|
8800
|
-
uri: new
|
|
8800
|
+
uri: new J("sip", e, this.options.viaHost, void 0, t),
|
|
8801
8801
|
toString: (s = {}) => {
|
|
8802
8802
|
const r = s.anonymous || !1, n = s.outbound || !1, o = s.register || !1;
|
|
8803
8803
|
let d = "<";
|
|
@@ -9205,7 +9205,7 @@ class Ge {
|
|
|
9205
9205
|
* Attempts will be made to re-register as needed.
|
|
9206
9206
|
*/
|
|
9207
9207
|
async register(e) {
|
|
9208
|
-
return this.logger.log("Registering UserAgent..."), this.shouldBeRegistered = !0, e !== void 0 && (this.registererRegisterOptions = Object.assign({}, e)), this.registerer || (this.registerer = new
|
|
9208
|
+
return this.logger.log("Registering UserAgent..."), this.shouldBeRegistered = !0, e !== void 0 && (this.registererRegisterOptions = Object.assign({}, e)), this.registerer || (this.registerer = new Y(this.userAgent, this.registererOptions), this.registerer.stateChange.addListener((t) => {
|
|
9209
9209
|
switch (t) {
|
|
9210
9210
|
case x.Initial:
|
|
9211
9211
|
break;
|
|
@@ -11076,7 +11076,7 @@ function De(a, e = "") {
|
|
|
11076
11076
|
function fi(a, e = "") {
|
|
11077
11077
|
return De(a, e).pathname !== "/";
|
|
11078
11078
|
}
|
|
11079
|
-
function
|
|
11079
|
+
function K(a, e, t = "") {
|
|
11080
11080
|
const i = De(a, t);
|
|
11081
11081
|
return i.pathname = yt(i.pathname, e), i.href;
|
|
11082
11082
|
}
|
|
@@ -11190,7 +11190,7 @@ function rt(a) {
|
|
|
11190
11190
|
}
|
|
11191
11191
|
class _i {
|
|
11192
11192
|
constructor({ mount: e, shadowRoot: t, options: i }) {
|
|
11193
|
-
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = Ci(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = De(i.apiBaseUrl || window.location.origin).href, this.client = null, this.issuedSession = null, this.bootstrap = null, this.turnIceServers = [], this.state = "idle", this.finalizing = !1, this.isMobileViewport = !1, this.pendingIncomingCall = null, this.visibilityHandler = null, this.sessionTouchTimer = null, this.sessionRecoveryInFlight = null, this.transportDisconnectTimer = null, this.transportDisconnectContext = null, this.e2eBridgeEnabled = xi(), this.terminalFailureOverride = "", this.presenceId = Ri(), this.presenceTouchTimer = null, this.presenceFailureCount = 0, this.availabilityState = "preparing", this.availabilityDetail = "正在连接后台并准备网页电话待机。", this.connectivityRecoveryInFlight = null, this.lifecycleRunId = 0, this.pendingLifecycleMode = null, this.expectedClientTeardown = null, this.expectedTermination = null, this.autoStandbyRecoveryTimer = null, this.recentlyReleasedSessions = /* @__PURE__ */ new Map(), this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible", this.onlineHandler = null, this.offlineHandler = null, this.refs = {};
|
|
11193
|
+
this.mountNode = e, this.shadowRoot = t, this.options = i, this.mode = Ci(i.mode), this.legacyOutboundOnly = this.mode === "outbound", this.apiBaseUrl = De(i.apiBaseUrl || window.location.origin).href, this.client = null, this.issuedSession = null, this.bootstrap = null, this.turnIceServers = [], this.state = "idle", this.finalizing = !1, this.isMobileViewport = !1, this.pendingIncomingCall = null, this.visibilityHandler = null, this.sessionTouchTimer = null, this.sessionRecoveryInFlight = null, this.transportDisconnectTimer = null, this.transportDisconnectContext = null, this.e2eBridgeEnabled = xi(), this.terminalFailureOverride = "", this.presenceId = Ri(), this.presenceTouchTimer = null, this.presenceFailureCount = 0, this.availabilityState = "preparing", this.availabilityDetail = "正在连接后台并准备网页电话待机。", this.connectivityRecoveryInFlight = null, this.lifecycleRunId = 0, this.pendingLifecycleMode = null, this.expectedClientTeardown = null, this.expectedTermination = null, this.autoStandbyRecoveryTimer = null, this.recentlyReleasedSessions = /* @__PURE__ */ new Map(), this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible", this.onlineHandler = null, this.offlineHandler = null, this.beforeUnloadHandler = null, this.pageHideHandler = null, this.unloadCleanupStarted = !1, this.refs = {};
|
|
11194
11194
|
}
|
|
11195
11195
|
async mount() {
|
|
11196
11196
|
this.isMobileViewport = typeof window < "u" && window.matchMedia("(max-width: 480px)").matches, this.shadowRoot.innerHTML = `
|
|
@@ -11245,7 +11245,11 @@ class _i {
|
|
|
11245
11245
|
this.networkOnline = !0, this.setAvailabilityState("recovering", "网络已恢复,正在重新连接网页电话。"), this.touchWidgetPresence("browser-online"), this.legacyOutboundOnly || this.restartStandbyAfterConnectivity("browser-online");
|
|
11246
11246
|
}, this.offlineHandler = () => {
|
|
11247
11247
|
this.networkOnline = !1, this.setAvailabilityState("offline", "当前网络连接已断开,正在等待恢复。"), ["incoming", "connected"].includes(this.state) ? this.render() : this.setState("failed", "当前网络连接已断开,正在等待恢复。");
|
|
11248
|
-
}, window.addEventListener("online", this.onlineHandler), window.addEventListener("offline", this.offlineHandler))
|
|
11248
|
+
}, window.addEventListener("online", this.onlineHandler), window.addEventListener("offline", this.offlineHandler), this.beforeUnloadHandler = () => {
|
|
11249
|
+
this.flushUnloadCleanup("beforeunload");
|
|
11250
|
+
}, this.pageHideHandler = (e) => {
|
|
11251
|
+
e?.persisted || this.flushUnloadCleanup("pagehide");
|
|
11252
|
+
}, window.addEventListener("beforeunload", this.beforeUnloadHandler), window.addEventListener("pagehide", this.pageHideHandler)));
|
|
11249
11253
|
}
|
|
11250
11254
|
open() {
|
|
11251
11255
|
this.mountNode.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
@@ -11593,7 +11597,7 @@ class _i {
|
|
|
11593
11597
|
async loadBootstrap() {
|
|
11594
11598
|
if (this.bootstrap)
|
|
11595
11599
|
return this.bootstrap;
|
|
11596
|
-
const e = await fetch(
|
|
11600
|
+
const e = await fetch(K(this.apiBaseUrl, "api/sip/embedded-call-demo-bootstrap"), {
|
|
11597
11601
|
credentials: "include",
|
|
11598
11602
|
cache: "no-store"
|
|
11599
11603
|
});
|
|
@@ -11602,7 +11606,7 @@ class _i {
|
|
|
11602
11606
|
return this.bootstrap = await e.json(), this.bootstrap;
|
|
11603
11607
|
}
|
|
11604
11608
|
async fetchTurnIceServers() {
|
|
11605
|
-
const e = await fetch(
|
|
11609
|
+
const e = await fetch(K(this.apiBaseUrl, "api/sip/webrtc-turn-credentials"), {
|
|
11606
11610
|
credentials: "include",
|
|
11607
11611
|
cache: "no-store"
|
|
11608
11612
|
});
|
|
@@ -11625,7 +11629,7 @@ class _i {
|
|
|
11625
11629
|
access_token: this.options.accessToken || void 0
|
|
11626
11630
|
};
|
|
11627
11631
|
t && (i.business_key = t);
|
|
11628
|
-
const s = await fetch(
|
|
11632
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/issue-call-session"), {
|
|
11629
11633
|
method: "POST",
|
|
11630
11634
|
credentials: "include",
|
|
11631
11635
|
cache: "no-store",
|
|
@@ -11679,7 +11683,7 @@ class _i {
|
|
|
11679
11683
|
access_token: this.options.accessToken || void 0
|
|
11680
11684
|
};
|
|
11681
11685
|
t && (i.business_key = t);
|
|
11682
|
-
const s = await fetch(
|
|
11686
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/issue-widget-standby-session"), {
|
|
11683
11687
|
method: "POST",
|
|
11684
11688
|
credentials: "include",
|
|
11685
11689
|
cache: "no-store",
|
|
@@ -11721,7 +11725,7 @@ class _i {
|
|
|
11721
11725
|
if (!this.issuedSession?.session_id)
|
|
11722
11726
|
return;
|
|
11723
11727
|
const i = this.issuedSession.session_id;
|
|
11724
|
-
this.markRecentlyReleasedSession(i, t), this.issuedSession = null, await fetch(
|
|
11728
|
+
this.markRecentlyReleasedSession(i, t), this.issuedSession = null, await fetch(K(this.apiBaseUrl, "api/sip/release-call-session"), {
|
|
11725
11729
|
method: "POST",
|
|
11726
11730
|
credentials: "include",
|
|
11727
11731
|
cache: "no-store",
|
|
@@ -11735,6 +11739,36 @@ class _i {
|
|
|
11735
11739
|
}).catch(() => {
|
|
11736
11740
|
});
|
|
11737
11741
|
}
|
|
11742
|
+
postLifecycleBeacon(e, t) {
|
|
11743
|
+
const i = JSON.stringify(t), s = K(this.apiBaseUrl, e);
|
|
11744
|
+
if (typeof navigator < "u" && typeof navigator.sendBeacon == "function")
|
|
11745
|
+
try {
|
|
11746
|
+
const r = new Blob([i], { type: "application/json" });
|
|
11747
|
+
if (navigator.sendBeacon(s, r))
|
|
11748
|
+
return !0;
|
|
11749
|
+
} catch {
|
|
11750
|
+
}
|
|
11751
|
+
return fetch(s, {
|
|
11752
|
+
method: "POST",
|
|
11753
|
+
credentials: "include",
|
|
11754
|
+
cache: "no-store",
|
|
11755
|
+
keepalive: !0,
|
|
11756
|
+
headers: { "Content-Type": "application/json" },
|
|
11757
|
+
body: i
|
|
11758
|
+
}).catch(() => {
|
|
11759
|
+
}), !0;
|
|
11760
|
+
}
|
|
11761
|
+
flushUnloadCleanup(e) {
|
|
11762
|
+
if (this.unloadCleanupStarted || (this.unloadCleanupStarted = !0, this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), !this.issuedSession?.session_id))
|
|
11763
|
+
return;
|
|
11764
|
+
const t = this.issuedSession.session_id;
|
|
11765
|
+
this.markRecentlyReleasedSession(t, e), this.postLifecycleBeacon("api/sip/release-call-session", {
|
|
11766
|
+
session_id: t,
|
|
11767
|
+
status: "released",
|
|
11768
|
+
reason: e,
|
|
11769
|
+
client_summary: this.buildClientEvidenceSummary("released", { releaseReason: e })
|
|
11770
|
+
}), this.issuedSession = null;
|
|
11771
|
+
}
|
|
11738
11772
|
buildClientEvidenceSummary(e = null, t = null) {
|
|
11739
11773
|
const i = {
|
|
11740
11774
|
runtimeMode: "embedded-widget-runtime",
|
|
@@ -11867,7 +11901,7 @@ class _i {
|
|
|
11867
11901
|
this.networkOnline = typeof navigator > "u" ? !0 : navigator.onLine !== !1, this.pageVisible = typeof document > "u" ? !0 : document.visibilityState === "visible";
|
|
11868
11902
|
const t = this.availabilityState === "offline";
|
|
11869
11903
|
try {
|
|
11870
|
-
const i = await fetch(
|
|
11904
|
+
const i = await fetch(K(this.apiBaseUrl, "api/sip/touch-widget-presence"), {
|
|
11871
11905
|
method: "POST",
|
|
11872
11906
|
credentials: "include",
|
|
11873
11907
|
cache: "no-store",
|
|
@@ -11922,7 +11956,7 @@ class _i {
|
|
|
11922
11956
|
return;
|
|
11923
11957
|
const i = this.issuedSession.session_id;
|
|
11924
11958
|
try {
|
|
11925
|
-
const s = await fetch(
|
|
11959
|
+
const s = await fetch(K(this.apiBaseUrl, "api/sip/touch-call-session"), {
|
|
11926
11960
|
method: "POST",
|
|
11927
11961
|
credentials: "include",
|
|
11928
11962
|
cache: "no-store",
|
|
@@ -11971,7 +12005,7 @@ class _i {
|
|
|
11971
12005
|
const s = this.issuedSession.session_id, r = i || this.state;
|
|
11972
12006
|
let n = null, o = "";
|
|
11973
12007
|
try {
|
|
11974
|
-
const d = await fetch(
|
|
12008
|
+
const d = await fetch(K(this.apiBaseUrl, "api/sip/report-call-session-event"), {
|
|
11975
12009
|
method: "POST",
|
|
11976
12010
|
credentials: "include",
|
|
11977
12011
|
cache: "no-store",
|
|
@@ -11991,7 +12025,7 @@ class _i {
|
|
|
11991
12025
|
throw o = p?.detail ? String(p.detail) : "", new Error(o || `事件留证失败:${d.status}`);
|
|
11992
12026
|
}
|
|
11993
12027
|
} catch (d) {
|
|
11994
|
-
await fetch(
|
|
12028
|
+
await fetch(K(this.apiBaseUrl, "api/sip/report-call-session-event-delivery-failure"), {
|
|
11995
12029
|
method: "POST",
|
|
11996
12030
|
credentials: "include",
|
|
11997
12031
|
cache: "no-store",
|
|
@@ -12048,7 +12082,7 @@ class _i {
|
|
|
12048
12082
|
this.legacyOutboundOnly ? this.refs.meta.textContent = `入站规则:${n};站点键:${r}` : this.refs.meta.textContent = `站点键:${r};网页电话会先进入可被叫待机;访客主动呼叫默认规则:${n}`, this.availabilityState === "offline" ? this.refs.hint.textContent = this.networkOnline === !1 ? "当前浏览器网络已断开。系统会在网络恢复后自动尝试重连网页电话。" : "当前无法连接通话服务。系统会继续自动恢复,暂时不要重复点击。" : this.availabilityState === "preparing" ? this.refs.hint.textContent = "当前正在准备待机能力。只要页面在线,系统会自动进入可呼入、可呼出的网页电话状态。" : this.availabilityState === "working" ? this.refs.hint.textContent = "当前正在切换到外呼链路,请等待振铃、接通或自动回到待机。" : this.availabilityState === "recovering" ? this.refs.hint.textContent = "当前页面仍在线,系统正在自动恢复可被叫待机,不需要刷新页面或手动切换模式。" : this.refs.hint.textContent = this.isMobileViewport ? mi : "桌面网页可直接使用;若宿主站点启用了来源白名单或接入令牌,请按站点配置提供对应参数。";
|
|
12049
12083
|
}
|
|
12050
12084
|
async destroy() {
|
|
12051
|
-
await this.disconnectAndCleanup("destroy-widget"), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingIncomingCall = null, typeof window < "u" && (this.onlineHandler && (window.removeEventListener("online", this.onlineHandler), this.onlineHandler = null), this.offlineHandler && (window.removeEventListener("offline", this.offlineHandler), this.offlineHandler = null)), this.e2eBridgeEnabled && typeof window < "u" && window.__embeddedCallWidgetE2E__ && delete window.__embeddedCallWidgetE2E__, this.shadowRoot.innerHTML = "";
|
|
12085
|
+
await this.disconnectAndCleanup("destroy-widget"), typeof document < "u" && this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.stopSessionTouch(), this.stopPresenceTouch(), this.stopTransportDisconnectGrace(), this.pendingIncomingCall = null, typeof window < "u" && (this.onlineHandler && (window.removeEventListener("online", this.onlineHandler), this.onlineHandler = null), this.offlineHandler && (window.removeEventListener("offline", this.offlineHandler), this.offlineHandler = null), this.beforeUnloadHandler && (window.removeEventListener("beforeunload", this.beforeUnloadHandler), this.beforeUnloadHandler = null), this.pageHideHandler && (window.removeEventListener("pagehide", this.pageHideHandler), this.pageHideHandler = null)), this.e2eBridgeEnabled && typeof window < "u" && window.__embeddedCallWidgetE2E__ && delete window.__embeddedCallWidgetE2E__, this.shadowRoot.innerHTML = "";
|
|
12052
12086
|
}
|
|
12053
12087
|
}
|
|
12054
12088
|
function Ai(a) {
|
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package_name": "@shenyin/embedded-call-widget",
|
|
3
|
-
"source_package_version": "2.6.
|
|
4
|
-
"built_at": "2026-04-07T04:
|
|
3
|
+
"source_package_version": "2.6.6",
|
|
4
|
+
"built_at": "2026-04-07T04:38:01.415Z",
|
|
5
5
|
"outputs": {
|
|
6
6
|
"esm_shell": "embedded-call-widget.js",
|
|
7
7
|
"esm_runtime": "embedded-call-widget-runtime.js",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"release_metadata": {
|
|
56
56
|
"npm_package_name": "@shenyin/embedded-call-widget",
|
|
57
|
-
"git_tag": "embedded-call-widget-v2.6.
|
|
58
|
-
"git_tag_alias": "v2.6.
|
|
59
|
-
"cdn_version_path": "embedded-call-widget/2.6.
|
|
57
|
+
"git_tag": "embedded-call-widget-v2.6.6",
|
|
58
|
+
"git_tag_alias": "v2.6.6",
|
|
59
|
+
"cdn_version_path": "embedded-call-widget/2.6.6/",
|
|
60
60
|
"cdn_latest_path": "embedded-call-widget/latest/",
|
|
61
61
|
"semver_channel": "stable"
|
|
62
62
|
},
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
},
|
|
70
70
|
"esm_runtime": {
|
|
71
71
|
"file": "embedded-call-widget-runtime.js",
|
|
72
|
-
"size_bytes":
|
|
73
|
-
"sha256": "
|
|
74
|
-
"sri_sha384": "sha384-
|
|
72
|
+
"size_bytes": 517629,
|
|
73
|
+
"sha256": "5be5eacbf9ebdab28f41aebd3deddbc4849c6526f7ad2facaf4479c37827da53",
|
|
74
|
+
"sri_sha384": "sha384-i8a0K1IA8Xxj9SLD8jkEo+4nP1fqjPMUz1MKMEpHj8+2kfgNPqMK53JFmZqdHcj0"
|
|
75
75
|
},
|
|
76
76
|
"iife_shell": {
|
|
77
77
|
"file": "embedded-call-widget.iife.js",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
},
|
|
82
82
|
"iife_runtime": {
|
|
83
83
|
"file": "embedded-call-widget-runtime.iife.js",
|
|
84
|
-
"size_bytes":
|
|
85
|
-
"sha256": "
|
|
86
|
-
"sri_sha384": "sha384-
|
|
84
|
+
"size_bytes": 334087,
|
|
85
|
+
"sha256": "07d8ff8c935d8b4d6773891c7ff1eb3a46954ebfca7f7e5fc77a29089ed88238",
|
|
86
|
+
"sri_sha384": "sha384-JTkBYGW68k1V1SUN6gQo8G0r25GxVWIuIqTxSuYKy5chTHwaaKP40yH/Dy2U30wo"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|