module-develop-kit 0.5.10 → 0.5.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/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/commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js +4 -0
- 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 +7 -0
- package/dist/commonjs-virtual-dir/index5.js +4 -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 +28 -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.d.ts +1 -1
- package/dist/vite-plugins/index.js +6 -0
- package/package.json +6 -5
- package/dist/index.es.js +0 -18159
- package/dist/vite-plugins/index.es.js +0 -33
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
import { __require as Q } from "../../events/events.js";
|
|
2
|
+
import { __require as X } from "./Logger.js";
|
|
3
|
+
import { __require as Z } from "./Constants.js";
|
|
4
|
+
import { __require as $ } from "./Registrator.js";
|
|
5
|
+
import { __require as tt } from "./RTCSession.js";
|
|
6
|
+
import { __require as et } from "./Message.js";
|
|
7
|
+
import { __require as it } from "./Options.js";
|
|
8
|
+
import { __require as nt } from "./Transactions.js";
|
|
9
|
+
import { __require as rt } from "./Transport.js";
|
|
10
|
+
import { __require as st } from "./Utils.js";
|
|
11
|
+
import { __require as ot } from "./Exceptions.js";
|
|
12
|
+
import { __require as at } from "./URI.js";
|
|
13
|
+
import { __require as ut } from "./Parser.js";
|
|
14
|
+
import { __require as ct } from "./SIPMessage.js";
|
|
15
|
+
import { __require as _t } from "./sanityCheck.js";
|
|
16
|
+
import { __require as ft } from "./Config.js";
|
|
17
|
+
var w, U;
|
|
18
|
+
function Ct() {
|
|
19
|
+
if (U) return w;
|
|
20
|
+
U = 1;
|
|
21
|
+
function d(r) {
|
|
22
|
+
"@babel/helpers - typeof";
|
|
23
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? d = function(n) {
|
|
24
|
+
return typeof n;
|
|
25
|
+
} : d = function(n) {
|
|
26
|
+
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
27
|
+
}, d(r);
|
|
28
|
+
}
|
|
29
|
+
function N(r, s) {
|
|
30
|
+
if (!(r instanceof s))
|
|
31
|
+
throw new TypeError("Cannot call a class as a function");
|
|
32
|
+
}
|
|
33
|
+
function R(r, s) {
|
|
34
|
+
for (var n = 0; n < s.length; n++) {
|
|
35
|
+
var e = s[n];
|
|
36
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(r, e.key, e);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function O(r, s, n) {
|
|
40
|
+
return s && R(r.prototype, s), n && R(r, n), r;
|
|
41
|
+
}
|
|
42
|
+
function D(r, s) {
|
|
43
|
+
if (typeof s != "function" && s !== null)
|
|
44
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
45
|
+
r.prototype = Object.create(s && s.prototype, { constructor: { value: r, writable: !0, configurable: !0 } }), s && m(r, s);
|
|
46
|
+
}
|
|
47
|
+
function m(r, s) {
|
|
48
|
+
return m = Object.setPrototypeOf || function(e, t) {
|
|
49
|
+
return e.__proto__ = t, e;
|
|
50
|
+
}, m(r, s);
|
|
51
|
+
}
|
|
52
|
+
function P(r) {
|
|
53
|
+
var s = z();
|
|
54
|
+
return function() {
|
|
55
|
+
var e = y(r), t;
|
|
56
|
+
if (s) {
|
|
57
|
+
var i = y(this).constructor;
|
|
58
|
+
t = Reflect.construct(e, arguments, i);
|
|
59
|
+
} else
|
|
60
|
+
t = e.apply(this, arguments);
|
|
61
|
+
return j(this, t);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function j(r, s) {
|
|
65
|
+
return s && (d(s) === "object" || typeof s == "function") ? s : k(r);
|
|
66
|
+
}
|
|
67
|
+
function k(r) {
|
|
68
|
+
if (r === void 0)
|
|
69
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
70
|
+
return r;
|
|
71
|
+
}
|
|
72
|
+
function z() {
|
|
73
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
74
|
+
if (typeof Proxy == "function") return !0;
|
|
75
|
+
try {
|
|
76
|
+
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
77
|
+
})), !0;
|
|
78
|
+
} catch {
|
|
79
|
+
return !1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function y(r) {
|
|
83
|
+
return y = Object.setPrototypeOf ? Object.getPrototypeOf : function(n) {
|
|
84
|
+
return n.__proto__ || Object.getPrototypeOf(n);
|
|
85
|
+
}, y(r);
|
|
86
|
+
}
|
|
87
|
+
var M = Q().EventEmitter, x = X(), f = Z(), L = $(), E = tt(), C = et(), A = it(), T = nt(), Y = rt(), v = st(), q = ot(), F = at(), K = ut(), S = ct(), V = _t(), b = ft(), o = new x("UA"), l = {
|
|
88
|
+
// UA status codes.
|
|
89
|
+
STATUS_INIT: 0,
|
|
90
|
+
STATUS_READY: 1,
|
|
91
|
+
STATUS_USER_CLOSED: 2,
|
|
92
|
+
STATUS_NOT_READY: 3,
|
|
93
|
+
// UA error codes.
|
|
94
|
+
CONFIGURATION_ERROR: 1,
|
|
95
|
+
NETWORK_ERROR: 2
|
|
96
|
+
};
|
|
97
|
+
w = /* @__PURE__ */ function(r) {
|
|
98
|
+
D(n, r);
|
|
99
|
+
var s = P(n);
|
|
100
|
+
O(n, null, [{
|
|
101
|
+
key: "C",
|
|
102
|
+
// Expose C object.
|
|
103
|
+
get: function() {
|
|
104
|
+
return l;
|
|
105
|
+
}
|
|
106
|
+
}]);
|
|
107
|
+
function n(e) {
|
|
108
|
+
var t;
|
|
109
|
+
if (N(this, n), o.debug("new() [configuration:%o]", e), t = s.call(this), t._cache = {
|
|
110
|
+
credentials: {}
|
|
111
|
+
}, t._configuration = Object.assign({}, b.settings), t._dynConfiguration = {}, t._dialogs = {}, t._applicants = {}, t._sessions = {}, t._transport = null, t._contact = null, t._status = l.STATUS_INIT, t._error = null, t._transactions = {
|
|
112
|
+
nist: {},
|
|
113
|
+
nict: {},
|
|
114
|
+
ist: {},
|
|
115
|
+
ict: {}
|
|
116
|
+
}, t._data = {}, t._closeTimer = null, e === void 0)
|
|
117
|
+
throw new TypeError("Not enough arguments");
|
|
118
|
+
try {
|
|
119
|
+
t._loadConfig(e);
|
|
120
|
+
} catch (i) {
|
|
121
|
+
throw t._status = l.STATUS_NOT_READY, t._error = l.CONFIGURATION_ERROR, i;
|
|
122
|
+
}
|
|
123
|
+
return t._registrator = new L(k(t)), t;
|
|
124
|
+
}
|
|
125
|
+
return O(n, [{
|
|
126
|
+
key: "start",
|
|
127
|
+
// =================
|
|
128
|
+
// High Level API
|
|
129
|
+
// =================
|
|
130
|
+
/**
|
|
131
|
+
* Connect to the server if status = STATUS_INIT.
|
|
132
|
+
* Resume UA after being closed.
|
|
133
|
+
*/
|
|
134
|
+
value: function() {
|
|
135
|
+
o.debug("start()"), this._status === l.STATUS_INIT ? this._transport.connect() : this._status === l.STATUS_USER_CLOSED ? (o.debug("restarting UA"), this._closeTimer !== null && (clearTimeout(this._closeTimer), this._closeTimer = null, this._transport.disconnect()), this._status = l.STATUS_INIT, this._transport.connect()) : this._status === l.STATUS_READY ? o.debug("UA is in READY status, not restarted") : o.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"), this._dynConfiguration.register = this._configuration.register;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Register.
|
|
139
|
+
*/
|
|
140
|
+
}, {
|
|
141
|
+
key: "register",
|
|
142
|
+
value: function() {
|
|
143
|
+
o.debug("register()"), this._dynConfiguration.register = !0, this._registrator.register();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Unregister.
|
|
147
|
+
*/
|
|
148
|
+
}, {
|
|
149
|
+
key: "unregister",
|
|
150
|
+
value: function(t) {
|
|
151
|
+
o.debug("unregister()"), this._dynConfiguration.register = !1, this._registrator.unregister(t);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get the Registrator instance.
|
|
155
|
+
*/
|
|
156
|
+
}, {
|
|
157
|
+
key: "registrator",
|
|
158
|
+
value: function() {
|
|
159
|
+
return this._registrator;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Registration state.
|
|
163
|
+
*/
|
|
164
|
+
}, {
|
|
165
|
+
key: "isRegistered",
|
|
166
|
+
value: function() {
|
|
167
|
+
return this._registrator.registered;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Connection state.
|
|
171
|
+
*/
|
|
172
|
+
}, {
|
|
173
|
+
key: "isConnected",
|
|
174
|
+
value: function() {
|
|
175
|
+
return this._transport.isConnected();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Make an outgoing call.
|
|
179
|
+
*
|
|
180
|
+
* -param {String} target
|
|
181
|
+
* -param {Object} [options]
|
|
182
|
+
*
|
|
183
|
+
* -throws {TypeError}
|
|
184
|
+
*
|
|
185
|
+
*/
|
|
186
|
+
}, {
|
|
187
|
+
key: "call",
|
|
188
|
+
value: function(t, i) {
|
|
189
|
+
o.debug("call()");
|
|
190
|
+
var u = new E(this);
|
|
191
|
+
return u.connect(t, i), u;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Send a message.
|
|
195
|
+
*
|
|
196
|
+
* -param {String} target
|
|
197
|
+
* -param {String} body
|
|
198
|
+
* -param {Object} [options]
|
|
199
|
+
*
|
|
200
|
+
* -throws {TypeError}
|
|
201
|
+
*
|
|
202
|
+
*/
|
|
203
|
+
}, {
|
|
204
|
+
key: "sendMessage",
|
|
205
|
+
value: function(t, i, u) {
|
|
206
|
+
o.debug("sendMessage()");
|
|
207
|
+
var _ = new C(this);
|
|
208
|
+
return _.send(t, i, u), _;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Send a SIP OPTIONS.
|
|
212
|
+
*
|
|
213
|
+
* -param {String} target
|
|
214
|
+
* -param {String} [body]
|
|
215
|
+
* -param {Object} [options]
|
|
216
|
+
*
|
|
217
|
+
* -throws {TypeError}
|
|
218
|
+
*
|
|
219
|
+
*/
|
|
220
|
+
}, {
|
|
221
|
+
key: "sendOptions",
|
|
222
|
+
value: function(t, i, u) {
|
|
223
|
+
o.debug("sendOptions()");
|
|
224
|
+
var _ = new A(this);
|
|
225
|
+
return _.send(t, i, u), _;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Terminate ongoing sessions.
|
|
229
|
+
*/
|
|
230
|
+
}, {
|
|
231
|
+
key: "terminateSessions",
|
|
232
|
+
value: function(t) {
|
|
233
|
+
o.debug("terminateSessions()");
|
|
234
|
+
for (var i in this._sessions)
|
|
235
|
+
this._sessions[i].isEnded() || this._sessions[i].terminate(t);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Gracefully close.
|
|
239
|
+
*
|
|
240
|
+
*/
|
|
241
|
+
}, {
|
|
242
|
+
key: "stop",
|
|
243
|
+
value: function() {
|
|
244
|
+
var t = this;
|
|
245
|
+
if (o.debug("stop()"), this._dynConfiguration = {}, this._status === l.STATUS_USER_CLOSED) {
|
|
246
|
+
o.debug("UA already closed");
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
this._registrator.close();
|
|
250
|
+
var i = Object.keys(this._sessions).length;
|
|
251
|
+
for (var u in this._sessions)
|
|
252
|
+
if (Object.prototype.hasOwnProperty.call(this._sessions, u)) {
|
|
253
|
+
o.debug("closing session ".concat(u));
|
|
254
|
+
try {
|
|
255
|
+
this._sessions[u].terminate();
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
for (var _ in this._applicants)
|
|
260
|
+
if (Object.prototype.hasOwnProperty.call(this._applicants, _)) try {
|
|
261
|
+
this._applicants[_].close();
|
|
262
|
+
} catch {
|
|
263
|
+
}
|
|
264
|
+
this._status = l.STATUS_USER_CLOSED;
|
|
265
|
+
var c = Object.keys(this._transactions.nict).length + Object.keys(this._transactions.nist).length + Object.keys(this._transactions.ict).length + Object.keys(this._transactions.ist).length;
|
|
266
|
+
c === 0 && i === 0 ? this._transport.disconnect() : this._closeTimer = setTimeout(function() {
|
|
267
|
+
t._closeTimer = null, t._transport.disconnect();
|
|
268
|
+
}, 2e3);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Normalice a string into a valid SIP request URI
|
|
272
|
+
* -param {String} target
|
|
273
|
+
* -returns {JsSIP.URI|undefined}
|
|
274
|
+
*/
|
|
275
|
+
}, {
|
|
276
|
+
key: "normalizeTarget",
|
|
277
|
+
value: function(t) {
|
|
278
|
+
return v.normalizeTarget(t, this._configuration.hostport_params);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Allow retrieving configuration and autogenerated fields in runtime.
|
|
282
|
+
*/
|
|
283
|
+
}, {
|
|
284
|
+
key: "get",
|
|
285
|
+
value: function(t) {
|
|
286
|
+
switch (t) {
|
|
287
|
+
case "authorization_user":
|
|
288
|
+
return this._configuration.authorization_user;
|
|
289
|
+
case "realm":
|
|
290
|
+
return this._configuration.realm;
|
|
291
|
+
case "ha1":
|
|
292
|
+
return this._configuration.ha1;
|
|
293
|
+
case "authorization_jwt":
|
|
294
|
+
return this._configuration.authorization_jwt;
|
|
295
|
+
default:
|
|
296
|
+
o.warn('get() | cannot get "%s" parameter in runtime', t);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Allow configuration changes in runtime.
|
|
302
|
+
* Returns true if the parameter could be set.
|
|
303
|
+
*/
|
|
304
|
+
}, {
|
|
305
|
+
key: "set",
|
|
306
|
+
value: function(t, i) {
|
|
307
|
+
switch (t) {
|
|
308
|
+
case "authorization_user": {
|
|
309
|
+
this._configuration.authorization_user = String(i);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case "password": {
|
|
313
|
+
this._configuration.password = String(i);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
case "realm": {
|
|
317
|
+
this._configuration.realm = String(i);
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
case "ha1": {
|
|
321
|
+
this._configuration.ha1 = String(i), this._configuration.password = null;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case "authorization_jwt": {
|
|
325
|
+
this._configuration.authorization_jwt = String(i);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case "display_name": {
|
|
329
|
+
this._configuration.display_name = i;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
case "extra_headers": {
|
|
333
|
+
this._configuration.extra_headers = i;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
default:
|
|
337
|
+
return o.warn('set() | cannot set "%s" parameter in runtime', t), !1;
|
|
338
|
+
}
|
|
339
|
+
return !0;
|
|
340
|
+
}
|
|
341
|
+
// ==========================
|
|
342
|
+
// Event Handlers.
|
|
343
|
+
// ==========================
|
|
344
|
+
/**
|
|
345
|
+
* new Transaction
|
|
346
|
+
*/
|
|
347
|
+
}, {
|
|
348
|
+
key: "newTransaction",
|
|
349
|
+
value: function(t) {
|
|
350
|
+
this._transactions[t.type][t.id] = t, this.emit("newTransaction", {
|
|
351
|
+
transaction: t
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Transaction destroyed.
|
|
356
|
+
*/
|
|
357
|
+
}, {
|
|
358
|
+
key: "destroyTransaction",
|
|
359
|
+
value: function(t) {
|
|
360
|
+
delete this._transactions[t.type][t.id], this.emit("transactionDestroyed", {
|
|
361
|
+
transaction: t
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* new Dialog
|
|
366
|
+
*/
|
|
367
|
+
}, {
|
|
368
|
+
key: "newDialog",
|
|
369
|
+
value: function(t) {
|
|
370
|
+
this._dialogs[t.id] = t;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Dialog destroyed.
|
|
374
|
+
*/
|
|
375
|
+
}, {
|
|
376
|
+
key: "destroyDialog",
|
|
377
|
+
value: function(t) {
|
|
378
|
+
delete this._dialogs[t.id];
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* new Message
|
|
382
|
+
*/
|
|
383
|
+
}, {
|
|
384
|
+
key: "newMessage",
|
|
385
|
+
value: function(t, i) {
|
|
386
|
+
this._applicants[t] = t, this.emit("newMessage", i);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* new Options
|
|
390
|
+
*/
|
|
391
|
+
}, {
|
|
392
|
+
key: "newOptions",
|
|
393
|
+
value: function(t, i) {
|
|
394
|
+
this._applicants[t] = t, this.emit("newOptions", i);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Message destroyed.
|
|
398
|
+
*/
|
|
399
|
+
}, {
|
|
400
|
+
key: "destroyMessage",
|
|
401
|
+
value: function(t) {
|
|
402
|
+
delete this._applicants[t];
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* new RTCSession
|
|
406
|
+
*/
|
|
407
|
+
}, {
|
|
408
|
+
key: "newRTCSession",
|
|
409
|
+
value: function(t, i) {
|
|
410
|
+
this._sessions[t.id] = t, this.emit("newRTCSession", i);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* RTCSession destroyed.
|
|
414
|
+
*/
|
|
415
|
+
}, {
|
|
416
|
+
key: "destroyRTCSession",
|
|
417
|
+
value: function(t) {
|
|
418
|
+
delete this._sessions[t.id];
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Registered
|
|
422
|
+
*/
|
|
423
|
+
}, {
|
|
424
|
+
key: "registered",
|
|
425
|
+
value: function(t) {
|
|
426
|
+
this.emit("registered", t);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Unregistered
|
|
430
|
+
*/
|
|
431
|
+
}, {
|
|
432
|
+
key: "unregistered",
|
|
433
|
+
value: function(t) {
|
|
434
|
+
this.emit("unregistered", t);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Registration Failed
|
|
438
|
+
*/
|
|
439
|
+
}, {
|
|
440
|
+
key: "registrationFailed",
|
|
441
|
+
value: function(t) {
|
|
442
|
+
this.emit("registrationFailed", t);
|
|
443
|
+
}
|
|
444
|
+
// =========================
|
|
445
|
+
// ReceiveRequest.
|
|
446
|
+
// =========================
|
|
447
|
+
/**
|
|
448
|
+
* Request reception
|
|
449
|
+
*/
|
|
450
|
+
}, {
|
|
451
|
+
key: "receiveRequest",
|
|
452
|
+
value: function(t) {
|
|
453
|
+
var i = t.method;
|
|
454
|
+
if (t.ruri.user !== this._configuration.uri.user && t.ruri.user !== this._contact.uri.user) {
|
|
455
|
+
o.debug("Request-URI does not point to us"), t.method !== f.ACK && t.reply_sl(404);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (t.ruri.scheme === f.SIPS) {
|
|
459
|
+
t.reply_sl(416);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (!T.checkTransaction(this, t)) {
|
|
463
|
+
if (i === f.INVITE ? new T.InviteServerTransaction(this, this._transport, t) : i !== f.ACK && i !== f.CANCEL && new T.NonInviteServerTransaction(this, this._transport, t), i === f.OPTIONS) {
|
|
464
|
+
if (this.listeners("newOptions").length === 0) {
|
|
465
|
+
t.reply(200);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
var u = new A(this);
|
|
469
|
+
u.init_incoming(t);
|
|
470
|
+
} else if (i === f.MESSAGE) {
|
|
471
|
+
if (this.listeners("newMessage").length === 0) {
|
|
472
|
+
t.reply(405);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
var _ = new C(this);
|
|
476
|
+
_.init_incoming(t);
|
|
477
|
+
} else if (i === f.INVITE && !t.to_tag && this.listeners("newRTCSession").length === 0) {
|
|
478
|
+
t.reply(405);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
var c, a;
|
|
482
|
+
if (t.to_tag)
|
|
483
|
+
c = this._findDialog(t.call_id, t.from_tag, t.to_tag), c ? c.receiveRequest(t) : i === f.NOTIFY ? (a = this._findSession(t), a ? a.receiveRequest(t) : (o.debug("received NOTIFY request for a non existent subscription"), t.reply(481, "Subscription does not exist"))) : i !== f.ACK && t.reply(481);
|
|
484
|
+
else
|
|
485
|
+
switch (i) {
|
|
486
|
+
case f.INVITE:
|
|
487
|
+
if (window.RTCPeerConnection)
|
|
488
|
+
if (t.hasHeader("replaces")) {
|
|
489
|
+
var h = t.replaces;
|
|
490
|
+
c = this._findDialog(h.call_id, h.from_tag, h.to_tag), c ? (a = c.owner, a.isEnded() ? t.reply(603) : a.receiveRequest(t)) : t.reply(481);
|
|
491
|
+
} else
|
|
492
|
+
a = new E(this), a.init_incoming(t);
|
|
493
|
+
else
|
|
494
|
+
o.warn("INVITE received but WebRTC is not supported"), t.reply(488);
|
|
495
|
+
break;
|
|
496
|
+
case f.BYE:
|
|
497
|
+
t.reply(481);
|
|
498
|
+
break;
|
|
499
|
+
case f.CANCEL:
|
|
500
|
+
a = this._findSession(t), a ? a.receiveRequest(t) : o.debug("received CANCEL request for a non existent session");
|
|
501
|
+
break;
|
|
502
|
+
case f.ACK:
|
|
503
|
+
break;
|
|
504
|
+
case f.NOTIFY:
|
|
505
|
+
this.emit("sipEvent", {
|
|
506
|
+
event: t.event,
|
|
507
|
+
request: t
|
|
508
|
+
}), t.reply(200);
|
|
509
|
+
break;
|
|
510
|
+
default:
|
|
511
|
+
t.reply(405);
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
// =================
|
|
517
|
+
// Utils.
|
|
518
|
+
// =================
|
|
519
|
+
/**
|
|
520
|
+
* Get the session to which the request belongs to, if any.
|
|
521
|
+
*/
|
|
522
|
+
}, {
|
|
523
|
+
key: "_findSession",
|
|
524
|
+
value: function(t) {
|
|
525
|
+
var i = t.call_id, u = t.from_tag, _ = t.to_tag, c = i + u, a = this._sessions[c], h = i + _, g = this._sessions[h];
|
|
526
|
+
return a || g || null;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Get the dialog to which the request belongs to, if any.
|
|
530
|
+
*/
|
|
531
|
+
}, {
|
|
532
|
+
key: "_findDialog",
|
|
533
|
+
value: function(t, i, u) {
|
|
534
|
+
var _ = t + i + u, c = this._dialogs[_];
|
|
535
|
+
return c || (_ = t + u + i, c = this._dialogs[_], c || null);
|
|
536
|
+
}
|
|
537
|
+
}, {
|
|
538
|
+
key: "_loadConfig",
|
|
539
|
+
value: function(t) {
|
|
540
|
+
try {
|
|
541
|
+
b.load(this._configuration, t);
|
|
542
|
+
} catch (h) {
|
|
543
|
+
throw h;
|
|
544
|
+
}
|
|
545
|
+
this._configuration.display_name === 0 && (this._configuration.display_name = "0"), this._configuration.instance_id || (this._configuration.instance_id = v.newUUID()), this._configuration.jssip_id = v.createRandomToken(5);
|
|
546
|
+
var i = this._configuration.uri.clone();
|
|
547
|
+
i.user = null, this._configuration.hostport_params = i.toString().replace(/^sip:/i, "");
|
|
548
|
+
try {
|
|
549
|
+
this._transport = new Y(this._configuration.sockets, {
|
|
550
|
+
// Recovery options.
|
|
551
|
+
max_interval: this._configuration.connection_recovery_max_interval,
|
|
552
|
+
min_interval: this._configuration.connection_recovery_min_interval
|
|
553
|
+
}), this._transport.onconnecting = W.bind(this), this._transport.onconnect = G.bind(this), this._transport.ondisconnect = H.bind(this), this._transport.ondata = B.bind(this);
|
|
554
|
+
} catch (h) {
|
|
555
|
+
throw o.warn(h), new q.ConfigurationError("sockets", this._configuration.sockets);
|
|
556
|
+
}
|
|
557
|
+
if (delete this._configuration.sockets, this._configuration.authorization_user || (this._configuration.authorization_user = this._configuration.uri.user), !this._configuration.registrar_server) {
|
|
558
|
+
var u = this._configuration.uri.clone();
|
|
559
|
+
u.user = null, u.clearParams(), u.clearHeaders(), this._configuration.registrar_server = u;
|
|
560
|
+
}
|
|
561
|
+
this._configuration.no_answer_timeout *= 1e3, this._configuration.contact_uri ? this._configuration.via_host = this._configuration.contact_uri.host : this._configuration.contact_uri = new F("sip", v.createRandomToken(8), this._configuration.via_host, null, {
|
|
562
|
+
transport: "ws"
|
|
563
|
+
}), this._contact = {
|
|
564
|
+
pub_gruu: null,
|
|
565
|
+
temp_gruu: null,
|
|
566
|
+
uri: this._configuration.contact_uri,
|
|
567
|
+
toString: function() {
|
|
568
|
+
var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, I = g.anonymous || null, J = g.outbound || null, p = "<";
|
|
569
|
+
return I ? p += this.temp_gruu || "sip:anonymous@anonymous.invalid;transport=ws" : p += this.pub_gruu || this.uri.toString(), J && (I ? !this.temp_gruu : !this.pub_gruu) && (p += ";ob"), p += ">", p;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
var _ = ["authorization_user", "password", "realm", "ha1", "authorization_jwt", "display_name", "register", "extra_headers"];
|
|
573
|
+
for (var c in this._configuration)
|
|
574
|
+
Object.prototype.hasOwnProperty.call(this._configuration, c) && (_.indexOf(c) !== -1 ? Object.defineProperty(this._configuration, c, {
|
|
575
|
+
writable: !0,
|
|
576
|
+
configurable: !1
|
|
577
|
+
}) : Object.defineProperty(this._configuration, c, {
|
|
578
|
+
writable: !1,
|
|
579
|
+
configurable: !1
|
|
580
|
+
}));
|
|
581
|
+
o.debug("configuration parameters after validation:");
|
|
582
|
+
for (var a in this._configuration)
|
|
583
|
+
if (Object.prototype.hasOwnProperty.call(b.settings, a))
|
|
584
|
+
switch (a) {
|
|
585
|
+
case "uri":
|
|
586
|
+
case "registrar_server":
|
|
587
|
+
o.debug("- ".concat(a, ": ").concat(this._configuration[a]));
|
|
588
|
+
break;
|
|
589
|
+
case "password":
|
|
590
|
+
case "ha1":
|
|
591
|
+
case "authorization_jwt":
|
|
592
|
+
o.debug("- ".concat(a, ": NOT SHOWN"));
|
|
593
|
+
break;
|
|
594
|
+
default:
|
|
595
|
+
o.debug("- ".concat(a, ": ").concat(JSON.stringify(this._configuration[a])));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}, {
|
|
599
|
+
key: "C",
|
|
600
|
+
get: function() {
|
|
601
|
+
return l;
|
|
602
|
+
}
|
|
603
|
+
}, {
|
|
604
|
+
key: "status",
|
|
605
|
+
get: function() {
|
|
606
|
+
return this._status;
|
|
607
|
+
}
|
|
608
|
+
}, {
|
|
609
|
+
key: "contact",
|
|
610
|
+
get: function() {
|
|
611
|
+
return this._contact;
|
|
612
|
+
}
|
|
613
|
+
}, {
|
|
614
|
+
key: "configuration",
|
|
615
|
+
get: function() {
|
|
616
|
+
return this._configuration;
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "transport",
|
|
620
|
+
get: function() {
|
|
621
|
+
return this._transport;
|
|
622
|
+
}
|
|
623
|
+
}]), n;
|
|
624
|
+
}(M);
|
|
625
|
+
function W(r) {
|
|
626
|
+
this.emit("connecting", r);
|
|
627
|
+
}
|
|
628
|
+
function G(r) {
|
|
629
|
+
this._status !== l.STATUS_USER_CLOSED && (this._status = l.STATUS_READY, this._error = null, this.emit("connected", r), this._dynConfiguration.register && this._registrator.register());
|
|
630
|
+
}
|
|
631
|
+
function H(r) {
|
|
632
|
+
for (var s = ["nict", "ict", "nist", "ist"], n = 0, e = s; n < e.length; n++) {
|
|
633
|
+
var t = e[n];
|
|
634
|
+
for (var i in this._transactions[t])
|
|
635
|
+
Object.prototype.hasOwnProperty.call(this._transactions[t], i) && this._transactions[t][i].onTransportError();
|
|
636
|
+
}
|
|
637
|
+
this.emit("disconnected", r), this._registrator.onTransportClosed(), this._status !== l.STATUS_USER_CLOSED && (this._status = l.STATUS_NOT_READY, this._error = l.NETWORK_ERROR);
|
|
638
|
+
}
|
|
639
|
+
function B(r) {
|
|
640
|
+
var s = r.transport, n = r.message;
|
|
641
|
+
if (n = K.parseMessage(n, this), !!n && !(this._status === l.STATUS_USER_CLOSED && n instanceof S.IncomingRequest) && V(n, this, s)) {
|
|
642
|
+
if (n instanceof S.IncomingRequest)
|
|
643
|
+
n.transport = s, this.receiveRequest(n);
|
|
644
|
+
else if (n instanceof S.IncomingResponse) {
|
|
645
|
+
var e;
|
|
646
|
+
switch (n.method) {
|
|
647
|
+
case f.INVITE:
|
|
648
|
+
e = this._transactions.ict[n.via_branch], e && e.receiveResponse(n);
|
|
649
|
+
break;
|
|
650
|
+
case f.ACK:
|
|
651
|
+
break;
|
|
652
|
+
default:
|
|
653
|
+
e = this._transactions.nict[n.via_branch], e && e.receiveResponse(n);
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return w;
|
|
660
|
+
}
|
|
661
|
+
export {
|
|
662
|
+
Ct as __require
|
|
663
|
+
};
|