module-develop-kit 0.5.10 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs-virtual-dir/Config.js +4 -0
- package/dist/commonjs-virtual-dir/Constants.js +5 -0
- package/dist/commonjs-virtual-dir/DTMF.js +4 -0
- package/dist/commonjs-virtual-dir/JsSIP.js +5 -0
- package/dist/commonjs-virtual-dir/Parser2.js +4 -0
- package/dist/commonjs-virtual-dir/Socket.js +4 -0
- package/dist/commonjs-virtual-dir/Utils.js +4 -0
- package/dist/commonjs-virtual-dir/___vite-browser-external.js +6 -0
- package/dist/commonjs-virtual-dir/__vite-browser-external.js +4 -0
- package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +6 -0
- package/dist/commonjs-virtual-dir/_commonjsHelpers.js +33 -0
- package/dist/{vite-plugins/index.es.js → commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js} +2 -31
- package/dist/commonjs-virtual-dir/_virtual_pc-compatibility-detection.js +4 -0
- package/dist/commonjs-virtual-dir/aes.js +4 -0
- package/dist/commonjs-virtual-dir/blowfish.js +4 -0
- package/dist/commonjs-virtual-dir/browser.js +4 -0
- package/dist/commonjs-virtual-dir/cipher-core.js +4 -0
- package/dist/commonjs-virtual-dir/core.js +4 -0
- package/dist/commonjs-virtual-dir/enc-base64.js +4 -0
- package/dist/commonjs-virtual-dir/enc-base64url.js +4 -0
- package/dist/commonjs-virtual-dir/enc-utf16.js +4 -0
- package/dist/commonjs-virtual-dir/events.js +4 -0
- package/dist/commonjs-virtual-dir/evpkdf.js +4 -0
- package/dist/commonjs-virtual-dir/format-hex.js +4 -0
- package/dist/commonjs-virtual-dir/grammar.js +4 -0
- package/dist/commonjs-virtual-dir/hmac.js +4 -0
- package/dist/commonjs-virtual-dir/index.js +5 -0
- package/dist/commonjs-virtual-dir/index2.js +5 -0
- package/dist/commonjs-virtual-dir/index3.js +7 -0
- package/dist/commonjs-virtual-dir/index4.js +4 -0
- package/dist/commonjs-virtual-dir/index5.js +7 -0
- package/dist/commonjs-virtual-dir/index6.js +4 -0
- package/dist/commonjs-virtual-dir/index7.js +4 -0
- package/dist/commonjs-virtual-dir/index8.js +4 -0
- package/dist/commonjs-virtual-dir/lib-typedarrays.js +4 -0
- package/dist/commonjs-virtual-dir/md5.js +4 -0
- package/dist/commonjs-virtual-dir/mode-cfb.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ctr.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ecb.js +4 -0
- package/dist/commonjs-virtual-dir/mode-ofb.js +4 -0
- package/dist/commonjs-virtual-dir/pad-ansix923.js +4 -0
- package/dist/commonjs-virtual-dir/pad-iso10126.js +4 -0
- package/dist/commonjs-virtual-dir/pad-iso97971.js +4 -0
- package/dist/commonjs-virtual-dir/pad-nopadding.js +4 -0
- package/dist/commonjs-virtual-dir/pad-zeropadding.js +4 -0
- package/dist/commonjs-virtual-dir/parser.js +4 -0
- package/dist/commonjs-virtual-dir/pbkdf2.js +4 -0
- package/dist/commonjs-virtual-dir/rabbit-legacy.js +4 -0
- package/dist/commonjs-virtual-dir/rabbit.js +4 -0
- package/dist/commonjs-virtual-dir/rc4.js +4 -0
- package/dist/commonjs-virtual-dir/ripemd160.js +4 -0
- package/dist/commonjs-virtual-dir/sha1.js +4 -0
- package/dist/commonjs-virtual-dir/sha224.js +4 -0
- package/dist/commonjs-virtual-dir/sha256.js +4 -0
- package/dist/commonjs-virtual-dir/sha3.js +4 -0
- package/dist/commonjs-virtual-dir/sha384.js +4 -0
- package/dist/commonjs-virtual-dir/sha512.js +4 -0
- package/dist/commonjs-virtual-dir/tripledes.js +4 -0
- package/dist/commonjs-virtual-dir/x64-core.js +4 -0
- package/dist/main.js +25 -0
- package/dist/src/outside-call/CallManagement.js +249 -0
- package/dist/src/outside-call/constants.js +42 -0
- package/dist/src/outside-call/index.js +74 -0
- package/dist/src/outside-call/utils.js +50 -0
- package/dist/src/shield/crypto.js +28 -0
- package/dist/src/shield/index.js +59 -0
- package/dist/src/shield/no-debugger.js +26 -0
- package/dist/src/utils/eventBus.js +59 -0
- package/dist/src/vite-plugins/getCompatibilityPlugins.js +13 -0
- package/dist/src/vite-plugins/vitePluginCompatibilityDetection.js +26 -0
- package/dist/vendor/base64-js/index.js +52 -0
- package/dist/vendor/crypto-js/aes.js +69 -0
- package/dist/vendor/crypto-js/blowfish.js +1131 -0
- package/dist/vendor/crypto-js/cipher-core.js +544 -0
- package/dist/vendor/crypto-js/core.js +508 -0
- package/dist/vendor/crypto-js/enc-base64.js +80 -0
- package/dist/vendor/crypto-js/enc-base64url.js +87 -0
- package/dist/vendor/crypto-js/enc-utf16.js +99 -0
- package/dist/vendor/crypto-js/evpkdf.js +70 -0
- package/dist/vendor/crypto-js/format-hex.js +53 -0
- package/dist/vendor/crypto-js/hmac.js +83 -0
- package/dist/vendor/crypto-js/index.js +49 -0
- package/dist/vendor/crypto-js/lib-typedarrays.js +27 -0
- package/dist/vendor/crypto-js/md5.js +71 -0
- package/dist/vendor/crypto-js/mode-cfb.js +36 -0
- package/dist/vendor/crypto-js/mode-ctr-gladman.js +45 -0
- package/dist/vendor/crypto-js/mode-ctr.js +28 -0
- package/dist/vendor/crypto-js/mode-ecb.js +27 -0
- package/dist/vendor/crypto-js/mode-ofb.js +26 -0
- package/dist/vendor/crypto-js/pad-ansix923.js +25 -0
- package/dist/vendor/crypto-js/pad-iso10126.js +25 -0
- package/dist/vendor/crypto-js/pad-iso97971.js +23 -0
- package/dist/vendor/crypto-js/pad-nopadding.js +21 -0
- package/dist/vendor/crypto-js/pad-zeropadding.js +28 -0
- package/dist/vendor/crypto-js/pbkdf2.js +74 -0
- package/dist/vendor/crypto-js/rabbit-legacy.js +73 -0
- package/dist/vendor/crypto-js/rabbit.js +75 -0
- package/dist/vendor/crypto-js/rc4.js +63 -0
- package/dist/vendor/crypto-js/ripemd160.js +398 -0
- package/dist/vendor/crypto-js/sha1.js +49 -0
- package/dist/vendor/crypto-js/sha224.js +36 -0
- package/dist/vendor/crypto-js/sha256.js +57 -0
- package/dist/vendor/crypto-js/sha3.js +116 -0
- package/dist/vendor/crypto-js/sha384.js +37 -0
- package/dist/vendor/crypto-js/sha512.js +147 -0
- package/dist/vendor/crypto-js/tripledes.js +729 -0
- package/dist/vendor/crypto-js/x64-core.js +235 -0
- package/dist/vendor/debug/src/browser.js +146 -0
- package/dist/vendor/debug/src/common.js +97 -0
- package/dist/vendor/events/events.js +216 -0
- package/dist/vendor/gm-crypt/index.js +10 -0
- package/dist/vendor/gm-crypt/src/crypt.js +60 -0
- package/dist/vendor/gm-crypt/src/sm4.js +513 -0
- package/dist/vendor/jsbn/index.js +714 -0
- package/dist/vendor/jssip/lib/Constants.js +180 -0
- package/dist/vendor/jssip/lib-es5/Config.js +263 -0
- package/dist/vendor/jssip/lib-es5/Constants.js +180 -0
- package/dist/vendor/jssip/lib-es5/Dialog/RequestSender.js +84 -0
- package/dist/vendor/jssip/lib-es5/Dialog.js +179 -0
- package/dist/vendor/jssip/lib-es5/DigestAuthentication.js +93 -0
- package/dist/vendor/jssip/lib-es5/Exceptions.js +131 -0
- package/dist/vendor/jssip/lib-es5/Grammar.js +1937 -0
- package/dist/vendor/jssip/lib-es5/JsSIP.js +37 -0
- package/dist/vendor/jssip/lib-es5/Logger.js +44 -0
- package/dist/vendor/jssip/lib-es5/Message.js +229 -0
- package/dist/vendor/jssip/lib-es5/NameAddrHeader.js +107 -0
- package/dist/vendor/jssip/lib-es5/Options.js +227 -0
- package/dist/vendor/jssip/lib-es5/Parser.js +202 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/DTMF.js +175 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/Info.js +149 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/ReferNotifier.js +52 -0
- package/dist/vendor/jssip/lib-es5/RTCSession/ReferSubscriber.js +187 -0
- package/dist/vendor/jssip/lib-es5/RTCSession.js +1799 -0
- package/dist/vendor/jssip/lib-es5/Registrator.js +194 -0
- package/dist/vendor/jssip/lib-es5/RequestSender.js +99 -0
- package/dist/vendor/jssip/lib-es5/SIPMessage.js +623 -0
- package/dist/vendor/jssip/lib-es5/Socket.js +38 -0
- package/dist/vendor/jssip/lib-es5/Timers.js +25 -0
- package/dist/vendor/jssip/lib-es5/Transactions.js +481 -0
- package/dist/vendor/jssip/lib-es5/Transport.js +220 -0
- package/dist/vendor/jssip/lib-es5/UA.js +663 -0
- package/dist/vendor/jssip/lib-es5/URI.js +221 -0
- package/dist/vendor/jssip/lib-es5/Utils.js +263 -0
- package/dist/vendor/jssip/lib-es5/WebSocketInterface.js +120 -0
- package/dist/vendor/jssip/lib-es5/sanityCheck.js +170 -0
- package/dist/vendor/jssip/package.json.js +9 -0
- package/dist/vendor/ms/index.js +85 -0
- package/dist/vendor/sdp-transform/lib/grammar.js +449 -0
- package/dist/vendor/sdp-transform/lib/index.js +14 -0
- package/dist/vendor/sdp-transform/lib/parser.js +70 -0
- package/dist/vendor/sdp-transform/lib/writer.js +74 -0
- package/dist/vendor/sm-crypto/src/index.js +14 -0
- package/dist/vendor/sm-crypto/src/sm2/asn1.js +86 -0
- package/dist/vendor/sm-crypto/src/sm2/ec.js +205 -0
- package/dist/vendor/sm-crypto/src/sm2/index.js +114 -0
- package/dist/vendor/sm-crypto/src/sm2/sm3.js +71 -0
- package/dist/vendor/sm-crypto/src/sm2/utils.js +95 -0
- package/dist/vendor/sm-crypto/src/sm3/index.js +50 -0
- package/dist/vendor/sm-crypto/src/sm4/index.js +408 -0
- package/dist/vite-plugins/index.js +6 -0
- package/package.json +6 -5
- package/dist/index.es.js +0 -18159
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { __require as P } from "./Logger.js";
|
|
2
|
+
import { __require as k } from "./Utils.js";
|
|
3
|
+
import { __require as y } from "./Constants.js";
|
|
4
|
+
import { __require as O } from "./SIPMessage.js";
|
|
5
|
+
import { __require as S } from "./RequestSender.js";
|
|
6
|
+
var m, T;
|
|
7
|
+
function A() {
|
|
8
|
+
if (T) return m;
|
|
9
|
+
T = 1;
|
|
10
|
+
function E(a, r) {
|
|
11
|
+
if (!(a instanceof r))
|
|
12
|
+
throw new TypeError("Cannot call a class as a function");
|
|
13
|
+
}
|
|
14
|
+
function p(a, r) {
|
|
15
|
+
for (var e = 0; e < r.length; e++) {
|
|
16
|
+
var t = r[e];
|
|
17
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(a, t.key, t);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function q(a, r, e) {
|
|
21
|
+
return r && p(a.prototype, r), a;
|
|
22
|
+
}
|
|
23
|
+
var C = P(), f = k(), _ = y(), R = O(), v = S(), g = new C("Registrator"), h = 10;
|
|
24
|
+
return m = /* @__PURE__ */ function() {
|
|
25
|
+
function a(r, e) {
|
|
26
|
+
E(this, a), this._reg_id = 1, this._ua = r, this._transport = e, this._registrar = r.configuration.registrar_server, this._expires = r.configuration.register_expires, this._call_id = f.createRandomToken(22), this._cseq = 0, this._to_uri = r.configuration.uri, this._registrationTimer = null, this._registering = !1, this._registered = !1, this._contact = this._ua.contact.toString(), this._contact += ";+sip.ice", this._extraHeaders = [], this._extraContactParams = "", this._sipInstance = '"<urn:uuid:'.concat(this._ua.configuration.instance_id, '>"'), this._contact += ";reg-id=".concat(this._reg_id), this._contact += ";+sip.instance=".concat(this._sipInstance);
|
|
27
|
+
}
|
|
28
|
+
return q(a, [{
|
|
29
|
+
key: "setExtraHeaders",
|
|
30
|
+
value: function(e) {
|
|
31
|
+
Array.isArray(e) || (e = []), this._extraHeaders = e.slice();
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "setExtraContactParams",
|
|
35
|
+
value: function(e) {
|
|
36
|
+
e instanceof Object || (e = {}), this._extraContactParams = "";
|
|
37
|
+
for (var t in e)
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) {
|
|
39
|
+
var u = e[t];
|
|
40
|
+
this._extraContactParams += ";".concat(t), u && (this._extraContactParams += "=".concat(u));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "register",
|
|
45
|
+
value: function() {
|
|
46
|
+
var e = this;
|
|
47
|
+
if (this._registering) {
|
|
48
|
+
g.debug("Register request in progress...");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
var t = this._extraHeaders.slice();
|
|
52
|
+
t.push("Contact: ".concat(this._contact, ";expires=").concat(this._expires).concat(this._extraContactParams)), t.push("Expires: ".concat(this._expires));
|
|
53
|
+
var u = new R.OutgoingRequest(_.REGISTER, this._registrar, this._ua, {
|
|
54
|
+
to_uri: this._to_uri,
|
|
55
|
+
call_id: this._call_id,
|
|
56
|
+
cseq: this._cseq += 1
|
|
57
|
+
}, t), d = new v(this._ua, u, {
|
|
58
|
+
onRequestTimeout: function() {
|
|
59
|
+
e._registrationFailure(null, _.causes.REQUEST_TIMEOUT);
|
|
60
|
+
},
|
|
61
|
+
onTransportError: function() {
|
|
62
|
+
e._registrationFailure(null, _.causes.CONNECTION_ERROR);
|
|
63
|
+
},
|
|
64
|
+
// Increase the CSeq on authentication.
|
|
65
|
+
onAuthenticated: function() {
|
|
66
|
+
e._cseq += 1;
|
|
67
|
+
},
|
|
68
|
+
onReceiveResponse: function(i) {
|
|
69
|
+
if (i.cseq === e._cseq)
|
|
70
|
+
switch (e._registrationTimer !== null && (clearTimeout(e._registrationTimer), e._registrationTimer = null), !0) {
|
|
71
|
+
case /^1[0-9]{2}$/.test(i.status_code):
|
|
72
|
+
break;
|
|
73
|
+
case /^2[0-9]{2}$/.test(i.status_code): {
|
|
74
|
+
if (e._registering = !1, !i.hasHeader("Contact")) {
|
|
75
|
+
g.debug("no Contact header in response to REGISTER, response ignored");
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
var o = i.headers.Contact.reduce(function(c, I) {
|
|
79
|
+
return c.concat(I.parsed);
|
|
80
|
+
}, []), n = o.find(function(c) {
|
|
81
|
+
return e._sipInstance === c.getParam("+sip.instance") && e._reg_id === parseInt(c.getParam("reg-id"));
|
|
82
|
+
});
|
|
83
|
+
if (n || (n = o.find(function(c) {
|
|
84
|
+
return c.uri.user === e._ua.contact.uri.user;
|
|
85
|
+
})), !n) {
|
|
86
|
+
g.debug("no Contact header pointing to us, response ignored");
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
var s = n.getParam("expires");
|
|
90
|
+
!s && i.hasHeader("expires") && (s = i.getHeader("expires")), s || (s = e._expires), s = Number(s), s < h && (s = h);
|
|
91
|
+
var b = s > 64 ? s * 1e3 / 2 + Math.floor((s / 2 - 32) * 1e3 * Math.random()) : s * 1e3 - 5e3;
|
|
92
|
+
e._registrationTimer = setTimeout(function() {
|
|
93
|
+
e._registrationTimer = null, e._ua.listeners("registrationExpiring").length === 0 ? e.register() : e._ua.emit("registrationExpiring");
|
|
94
|
+
}, b), n.hasParam("temp-gruu") && (e._ua.contact.temp_gruu = n.getParam("temp-gruu").replace(/"/g, "")), n.hasParam("pub-gruu") && (e._ua.contact.pub_gruu = n.getParam("pub-gruu").replace(/"/g, "")), e._registered || (e._registered = !0, e._ua.registered({
|
|
95
|
+
response: i
|
|
96
|
+
}));
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
// Interval too brief RFC3261 10.2.8.
|
|
100
|
+
case /^423$/.test(i.status_code): {
|
|
101
|
+
i.hasHeader("min-expires") ? (e._expires = Number(i.getHeader("min-expires")), e._expires < h && (e._expires = h), e.register()) : (g.debug("423 response received for REGISTER without Min-Expires"), e._registrationFailure(i, _.causes.SIP_FAILURE_CODE));
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
default: {
|
|
105
|
+
var x = f.sipErrorCause(i.status_code);
|
|
106
|
+
e._registrationFailure(i, x);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
this._registering = !0, d.send();
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "unregister",
|
|
115
|
+
value: function() {
|
|
116
|
+
var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
117
|
+
if (!this._registered) {
|
|
118
|
+
g.debug("already unregistered");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this._registered = !1, this._registrationTimer !== null && (clearTimeout(this._registrationTimer), this._registrationTimer = null);
|
|
122
|
+
var u = this._extraHeaders.slice();
|
|
123
|
+
t.all ? u.push("Contact: *".concat(this._extraContactParams)) : u.push("Contact: ".concat(this._contact, ";expires=0").concat(this._extraContactParams)), u.push("Expires: 0");
|
|
124
|
+
var d = new R.OutgoingRequest(_.REGISTER, this._registrar, this._ua, {
|
|
125
|
+
to_uri: this._to_uri,
|
|
126
|
+
call_id: this._call_id,
|
|
127
|
+
cseq: this._cseq += 1
|
|
128
|
+
}, u), l = new v(this._ua, d, {
|
|
129
|
+
onRequestTimeout: function() {
|
|
130
|
+
e._unregistered(null, _.causes.REQUEST_TIMEOUT);
|
|
131
|
+
},
|
|
132
|
+
onTransportError: function() {
|
|
133
|
+
e._unregistered(null, _.causes.CONNECTION_ERROR);
|
|
134
|
+
},
|
|
135
|
+
// Increase the CSeq on authentication.
|
|
136
|
+
onAuthenticated: function() {
|
|
137
|
+
e._cseq += 1;
|
|
138
|
+
},
|
|
139
|
+
onReceiveResponse: function(o) {
|
|
140
|
+
switch (!0) {
|
|
141
|
+
case /^1[0-9]{2}$/.test(o.status_code):
|
|
142
|
+
break;
|
|
143
|
+
case /^2[0-9]{2}$/.test(o.status_code):
|
|
144
|
+
e._unregistered(o);
|
|
145
|
+
break;
|
|
146
|
+
default: {
|
|
147
|
+
var n = f.sipErrorCause(o.status_code);
|
|
148
|
+
e._unregistered(o, n);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
l.send();
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "close",
|
|
157
|
+
value: function() {
|
|
158
|
+
this._registered && this.unregister();
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "onTransportClosed",
|
|
162
|
+
value: function() {
|
|
163
|
+
this._registering = !1, this._registrationTimer !== null && (clearTimeout(this._registrationTimer), this._registrationTimer = null), this._registered && (this._registered = !1, this._ua.unregistered({}));
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "_registrationFailure",
|
|
167
|
+
value: function(e, t) {
|
|
168
|
+
this._registering = !1, this._ua.registrationFailed({
|
|
169
|
+
response: e || null,
|
|
170
|
+
cause: t
|
|
171
|
+
}), this._registered && (this._registered = !1, this._ua.unregistered({
|
|
172
|
+
response: e || null,
|
|
173
|
+
cause: t
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "_unregistered",
|
|
178
|
+
value: function(e, t) {
|
|
179
|
+
this._registering = !1, this._registered = !1, this._ua.unregistered({
|
|
180
|
+
response: e || null,
|
|
181
|
+
cause: t || null
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "registered",
|
|
186
|
+
get: function() {
|
|
187
|
+
return this._registered;
|
|
188
|
+
}
|
|
189
|
+
}]), a;
|
|
190
|
+
}(), m;
|
|
191
|
+
}
|
|
192
|
+
export {
|
|
193
|
+
A as __require
|
|
194
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { __require as R } from "./Logger.js";
|
|
2
|
+
import { __require as g } from "./Constants.js";
|
|
3
|
+
import { __require as m } from "./DigestAuthentication.js";
|
|
4
|
+
import { __require as T } from "./Transactions.js";
|
|
5
|
+
var u, _;
|
|
6
|
+
function E() {
|
|
7
|
+
if (_) return u;
|
|
8
|
+
_ = 1;
|
|
9
|
+
function c(n, i) {
|
|
10
|
+
if (!(n instanceof i))
|
|
11
|
+
throw new TypeError("Cannot call a class as a function");
|
|
12
|
+
}
|
|
13
|
+
function l(n, i) {
|
|
14
|
+
for (var e = 0; e < i.length; e++) {
|
|
15
|
+
var t = i[e];
|
|
16
|
+
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(n, t.key, t);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function f(n, i, e) {
|
|
20
|
+
return i && l(n.prototype, i), n;
|
|
21
|
+
}
|
|
22
|
+
var d = R(), h = g(), v = m(), r = T(), q = new d("RequestSender"), o = {
|
|
23
|
+
onRequestTimeout: function() {
|
|
24
|
+
},
|
|
25
|
+
onTransportError: function() {
|
|
26
|
+
},
|
|
27
|
+
onReceiveResponse: function() {
|
|
28
|
+
},
|
|
29
|
+
onAuthenticated: function() {
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return u = /* @__PURE__ */ function() {
|
|
33
|
+
function n(i, e, t) {
|
|
34
|
+
c(this, n), this._ua = i, this._eventHandlers = t, this._method = e.method, this._request = e, this._auth = null, this._challenged = !1, this._staled = !1;
|
|
35
|
+
for (var s in o)
|
|
36
|
+
Object.prototype.hasOwnProperty.call(o, s) && (this._eventHandlers[s] || (this._eventHandlers[s] = o[s]));
|
|
37
|
+
i.status === i.C.STATUS_USER_CLOSED && (this._method !== h.BYE || this._method !== h.ACK) && this._eventHandlers.onTransportError();
|
|
38
|
+
}
|
|
39
|
+
return f(n, [{
|
|
40
|
+
key: "send",
|
|
41
|
+
value: function() {
|
|
42
|
+
var e = this, t = {
|
|
43
|
+
onRequestTimeout: function() {
|
|
44
|
+
e._eventHandlers.onRequestTimeout();
|
|
45
|
+
},
|
|
46
|
+
onTransportError: function() {
|
|
47
|
+
e._eventHandlers.onTransportError();
|
|
48
|
+
},
|
|
49
|
+
onReceiveResponse: function(a) {
|
|
50
|
+
e._receiveResponse(a);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
switch (this._method) {
|
|
54
|
+
case "INVITE":
|
|
55
|
+
this.clientTransaction = new r.InviteClientTransaction(this._ua, this._ua.transport, this._request, t);
|
|
56
|
+
break;
|
|
57
|
+
case "ACK":
|
|
58
|
+
this.clientTransaction = new r.AckClientTransaction(this._ua, this._ua.transport, this._request, t);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
this.clientTransaction = new r.NonInviteClientTransaction(this._ua, this._ua.transport, this._request, t);
|
|
62
|
+
}
|
|
63
|
+
this._ua._configuration.authorization_jwt && this._request.setHeader("Authorization", this._ua._configuration.authorization_jwt), this.clientTransaction.send();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Called from client transaction when receiving a correct response to the request.
|
|
67
|
+
* Authenticate request if needed or pass the response back to the applicant.
|
|
68
|
+
*/
|
|
69
|
+
}, {
|
|
70
|
+
key: "_receiveResponse",
|
|
71
|
+
value: function(e) {
|
|
72
|
+
var t, s, a = e.status_code;
|
|
73
|
+
if ((a === 401 || a === 407) && (this._ua.configuration.password !== null || this._ua.configuration.ha1 !== null)) {
|
|
74
|
+
if (e.status_code === 401 ? (t = e.parseHeader("www-authenticate"), s = "authorization") : (t = e.parseHeader("proxy-authenticate"), s = "proxy-authorization"), !t) {
|
|
75
|
+
q.debug("".concat(e.status_code, " with wrong or missing challenge, cannot authenticate")), this._eventHandlers.onReceiveResponse(e);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!this._challenged || !this._staled && t.stale === !0) {
|
|
79
|
+
if (this._auth || (this._auth = new v({
|
|
80
|
+
username: this._ua.configuration.authorization_user,
|
|
81
|
+
password: this._ua.configuration.password,
|
|
82
|
+
realm: this._ua.configuration.realm,
|
|
83
|
+
ha1: this._ua.configuration.ha1
|
|
84
|
+
})), !this._auth.authenticate(this._request, t)) {
|
|
85
|
+
this._eventHandlers.onReceiveResponse(e);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this._challenged = !0, this._ua.set("realm", this._auth.get("realm")), this._ua.set("ha1", this._auth.get("ha1")), t.stale && (this._staled = !0), this._request = this._request.clone(), this._request.cseq += 1, this._request.setHeader("cseq", "".concat(this._request.cseq, " ").concat(this._method)), this._request.setHeader(s, this._auth.toString()), this._eventHandlers.onAuthenticated(this._request), this.send();
|
|
89
|
+
} else
|
|
90
|
+
this._eventHandlers.onReceiveResponse(e);
|
|
91
|
+
} else
|
|
92
|
+
this._eventHandlers.onReceiveResponse(e);
|
|
93
|
+
}
|
|
94
|
+
}]), n;
|
|
95
|
+
}(), u;
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
E as __require
|
|
99
|
+
};
|