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.
Files changed (163) hide show
  1. package/dist/commonjs-virtual-dir/Config.js +4 -0
  2. package/dist/commonjs-virtual-dir/Constants.js +5 -0
  3. package/dist/commonjs-virtual-dir/DTMF.js +4 -0
  4. package/dist/commonjs-virtual-dir/JsSIP.js +5 -0
  5. package/dist/commonjs-virtual-dir/Parser2.js +4 -0
  6. package/dist/commonjs-virtual-dir/Socket.js +4 -0
  7. package/dist/commonjs-virtual-dir/Utils.js +4 -0
  8. package/dist/commonjs-virtual-dir/___vite-browser-external.js +6 -0
  9. package/dist/commonjs-virtual-dir/__vite-browser-external.js +4 -0
  10. package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +6 -0
  11. package/dist/commonjs-virtual-dir/_commonjsHelpers.js +33 -0
  12. package/dist/{vite-plugins/index.es.js → commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js} +2 -31
  13. package/dist/commonjs-virtual-dir/_virtual_pc-compatibility-detection.js +4 -0
  14. package/dist/commonjs-virtual-dir/aes.js +4 -0
  15. package/dist/commonjs-virtual-dir/blowfish.js +4 -0
  16. package/dist/commonjs-virtual-dir/browser.js +4 -0
  17. package/dist/commonjs-virtual-dir/cipher-core.js +4 -0
  18. package/dist/commonjs-virtual-dir/core.js +4 -0
  19. package/dist/commonjs-virtual-dir/enc-base64.js +4 -0
  20. package/dist/commonjs-virtual-dir/enc-base64url.js +4 -0
  21. package/dist/commonjs-virtual-dir/enc-utf16.js +4 -0
  22. package/dist/commonjs-virtual-dir/events.js +4 -0
  23. package/dist/commonjs-virtual-dir/evpkdf.js +4 -0
  24. package/dist/commonjs-virtual-dir/format-hex.js +4 -0
  25. package/dist/commonjs-virtual-dir/grammar.js +4 -0
  26. package/dist/commonjs-virtual-dir/hmac.js +4 -0
  27. package/dist/commonjs-virtual-dir/index.js +5 -0
  28. package/dist/commonjs-virtual-dir/index2.js +5 -0
  29. package/dist/commonjs-virtual-dir/index3.js +7 -0
  30. package/dist/commonjs-virtual-dir/index4.js +4 -0
  31. package/dist/commonjs-virtual-dir/index5.js +7 -0
  32. package/dist/commonjs-virtual-dir/index6.js +4 -0
  33. package/dist/commonjs-virtual-dir/index7.js +4 -0
  34. package/dist/commonjs-virtual-dir/index8.js +4 -0
  35. package/dist/commonjs-virtual-dir/lib-typedarrays.js +4 -0
  36. package/dist/commonjs-virtual-dir/md5.js +4 -0
  37. package/dist/commonjs-virtual-dir/mode-cfb.js +4 -0
  38. package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +4 -0
  39. package/dist/commonjs-virtual-dir/mode-ctr.js +4 -0
  40. package/dist/commonjs-virtual-dir/mode-ecb.js +4 -0
  41. package/dist/commonjs-virtual-dir/mode-ofb.js +4 -0
  42. package/dist/commonjs-virtual-dir/pad-ansix923.js +4 -0
  43. package/dist/commonjs-virtual-dir/pad-iso10126.js +4 -0
  44. package/dist/commonjs-virtual-dir/pad-iso97971.js +4 -0
  45. package/dist/commonjs-virtual-dir/pad-nopadding.js +4 -0
  46. package/dist/commonjs-virtual-dir/pad-zeropadding.js +4 -0
  47. package/dist/commonjs-virtual-dir/parser.js +4 -0
  48. package/dist/commonjs-virtual-dir/pbkdf2.js +4 -0
  49. package/dist/commonjs-virtual-dir/rabbit-legacy.js +4 -0
  50. package/dist/commonjs-virtual-dir/rabbit.js +4 -0
  51. package/dist/commonjs-virtual-dir/rc4.js +4 -0
  52. package/dist/commonjs-virtual-dir/ripemd160.js +4 -0
  53. package/dist/commonjs-virtual-dir/sha1.js +4 -0
  54. package/dist/commonjs-virtual-dir/sha224.js +4 -0
  55. package/dist/commonjs-virtual-dir/sha256.js +4 -0
  56. package/dist/commonjs-virtual-dir/sha3.js +4 -0
  57. package/dist/commonjs-virtual-dir/sha384.js +4 -0
  58. package/dist/commonjs-virtual-dir/sha512.js +4 -0
  59. package/dist/commonjs-virtual-dir/tripledes.js +4 -0
  60. package/dist/commonjs-virtual-dir/x64-core.js +4 -0
  61. package/dist/main.js +25 -0
  62. package/dist/src/outside-call/CallManagement.js +249 -0
  63. package/dist/src/outside-call/constants.js +42 -0
  64. package/dist/src/outside-call/index.js +74 -0
  65. package/dist/src/outside-call/utils.js +50 -0
  66. package/dist/src/shield/crypto.js +28 -0
  67. package/dist/src/shield/index.js +59 -0
  68. package/dist/src/shield/no-debugger.js +26 -0
  69. package/dist/src/utils/eventBus.js +59 -0
  70. package/dist/src/vite-plugins/getCompatibilityPlugins.js +13 -0
  71. package/dist/src/vite-plugins/vitePluginCompatibilityDetection.js +26 -0
  72. package/dist/vendor/base64-js/index.js +52 -0
  73. package/dist/vendor/crypto-js/aes.js +69 -0
  74. package/dist/vendor/crypto-js/blowfish.js +1131 -0
  75. package/dist/vendor/crypto-js/cipher-core.js +544 -0
  76. package/dist/vendor/crypto-js/core.js +508 -0
  77. package/dist/vendor/crypto-js/enc-base64.js +80 -0
  78. package/dist/vendor/crypto-js/enc-base64url.js +87 -0
  79. package/dist/vendor/crypto-js/enc-utf16.js +99 -0
  80. package/dist/vendor/crypto-js/evpkdf.js +70 -0
  81. package/dist/vendor/crypto-js/format-hex.js +53 -0
  82. package/dist/vendor/crypto-js/hmac.js +83 -0
  83. package/dist/vendor/crypto-js/index.js +49 -0
  84. package/dist/vendor/crypto-js/lib-typedarrays.js +27 -0
  85. package/dist/vendor/crypto-js/md5.js +71 -0
  86. package/dist/vendor/crypto-js/mode-cfb.js +36 -0
  87. package/dist/vendor/crypto-js/mode-ctr-gladman.js +45 -0
  88. package/dist/vendor/crypto-js/mode-ctr.js +28 -0
  89. package/dist/vendor/crypto-js/mode-ecb.js +27 -0
  90. package/dist/vendor/crypto-js/mode-ofb.js +26 -0
  91. package/dist/vendor/crypto-js/pad-ansix923.js +25 -0
  92. package/dist/vendor/crypto-js/pad-iso10126.js +25 -0
  93. package/dist/vendor/crypto-js/pad-iso97971.js +23 -0
  94. package/dist/vendor/crypto-js/pad-nopadding.js +21 -0
  95. package/dist/vendor/crypto-js/pad-zeropadding.js +28 -0
  96. package/dist/vendor/crypto-js/pbkdf2.js +74 -0
  97. package/dist/vendor/crypto-js/rabbit-legacy.js +73 -0
  98. package/dist/vendor/crypto-js/rabbit.js +75 -0
  99. package/dist/vendor/crypto-js/rc4.js +63 -0
  100. package/dist/vendor/crypto-js/ripemd160.js +398 -0
  101. package/dist/vendor/crypto-js/sha1.js +49 -0
  102. package/dist/vendor/crypto-js/sha224.js +36 -0
  103. package/dist/vendor/crypto-js/sha256.js +57 -0
  104. package/dist/vendor/crypto-js/sha3.js +116 -0
  105. package/dist/vendor/crypto-js/sha384.js +37 -0
  106. package/dist/vendor/crypto-js/sha512.js +147 -0
  107. package/dist/vendor/crypto-js/tripledes.js +729 -0
  108. package/dist/vendor/crypto-js/x64-core.js +235 -0
  109. package/dist/vendor/debug/src/browser.js +146 -0
  110. package/dist/vendor/debug/src/common.js +97 -0
  111. package/dist/vendor/events/events.js +216 -0
  112. package/dist/vendor/gm-crypt/index.js +10 -0
  113. package/dist/vendor/gm-crypt/src/crypt.js +60 -0
  114. package/dist/vendor/gm-crypt/src/sm4.js +513 -0
  115. package/dist/vendor/jsbn/index.js +714 -0
  116. package/dist/vendor/jssip/lib/Constants.js +180 -0
  117. package/dist/vendor/jssip/lib-es5/Config.js +263 -0
  118. package/dist/vendor/jssip/lib-es5/Constants.js +180 -0
  119. package/dist/vendor/jssip/lib-es5/Dialog/RequestSender.js +84 -0
  120. package/dist/vendor/jssip/lib-es5/Dialog.js +179 -0
  121. package/dist/vendor/jssip/lib-es5/DigestAuthentication.js +93 -0
  122. package/dist/vendor/jssip/lib-es5/Exceptions.js +131 -0
  123. package/dist/vendor/jssip/lib-es5/Grammar.js +1937 -0
  124. package/dist/vendor/jssip/lib-es5/JsSIP.js +37 -0
  125. package/dist/vendor/jssip/lib-es5/Logger.js +44 -0
  126. package/dist/vendor/jssip/lib-es5/Message.js +229 -0
  127. package/dist/vendor/jssip/lib-es5/NameAddrHeader.js +107 -0
  128. package/dist/vendor/jssip/lib-es5/Options.js +227 -0
  129. package/dist/vendor/jssip/lib-es5/Parser.js +202 -0
  130. package/dist/vendor/jssip/lib-es5/RTCSession/DTMF.js +175 -0
  131. package/dist/vendor/jssip/lib-es5/RTCSession/Info.js +149 -0
  132. package/dist/vendor/jssip/lib-es5/RTCSession/ReferNotifier.js +52 -0
  133. package/dist/vendor/jssip/lib-es5/RTCSession/ReferSubscriber.js +187 -0
  134. package/dist/vendor/jssip/lib-es5/RTCSession.js +1799 -0
  135. package/dist/vendor/jssip/lib-es5/Registrator.js +194 -0
  136. package/dist/vendor/jssip/lib-es5/RequestSender.js +99 -0
  137. package/dist/vendor/jssip/lib-es5/SIPMessage.js +623 -0
  138. package/dist/vendor/jssip/lib-es5/Socket.js +38 -0
  139. package/dist/vendor/jssip/lib-es5/Timers.js +25 -0
  140. package/dist/vendor/jssip/lib-es5/Transactions.js +481 -0
  141. package/dist/vendor/jssip/lib-es5/Transport.js +220 -0
  142. package/dist/vendor/jssip/lib-es5/UA.js +663 -0
  143. package/dist/vendor/jssip/lib-es5/URI.js +221 -0
  144. package/dist/vendor/jssip/lib-es5/Utils.js +263 -0
  145. package/dist/vendor/jssip/lib-es5/WebSocketInterface.js +120 -0
  146. package/dist/vendor/jssip/lib-es5/sanityCheck.js +170 -0
  147. package/dist/vendor/jssip/package.json.js +9 -0
  148. package/dist/vendor/ms/index.js +85 -0
  149. package/dist/vendor/sdp-transform/lib/grammar.js +449 -0
  150. package/dist/vendor/sdp-transform/lib/index.js +14 -0
  151. package/dist/vendor/sdp-transform/lib/parser.js +70 -0
  152. package/dist/vendor/sdp-transform/lib/writer.js +74 -0
  153. package/dist/vendor/sm-crypto/src/index.js +14 -0
  154. package/dist/vendor/sm-crypto/src/sm2/asn1.js +86 -0
  155. package/dist/vendor/sm-crypto/src/sm2/ec.js +205 -0
  156. package/dist/vendor/sm-crypto/src/sm2/index.js +114 -0
  157. package/dist/vendor/sm-crypto/src/sm2/sm3.js +71 -0
  158. package/dist/vendor/sm-crypto/src/sm2/utils.js +95 -0
  159. package/dist/vendor/sm-crypto/src/sm3/index.js +50 -0
  160. package/dist/vendor/sm-crypto/src/sm4/index.js +408 -0
  161. package/dist/vite-plugins/index.js +6 -0
  162. package/package.json +6 -5
  163. package/dist/index.es.js +0 -18159
@@ -0,0 +1,1799 @@
1
+ import { __require as fe } from "../../events/events.js";
2
+ import { __require as he } from "../../sdp-transform/lib/index.js";
3
+ import { __require as Te } from "./Logger.js";
4
+ import { __require as me } from "./Constants.js";
5
+ import { __require as pe } from "./Exceptions.js";
6
+ import { __require as ve } from "./Transactions.js";
7
+ import { __require as ge } from "./Utils.js";
8
+ import { __require as Se } from "./Timers.js";
9
+ import { __require as Ee } from "./SIPMessage.js";
10
+ import { __require as Re } from "./Dialog.js";
11
+ import { __require as ye } from "./RequestSender.js";
12
+ import { __require as Ae } from "./RTCSession/DTMF.js";
13
+ import { __require as Ie } from "./RTCSession/Info.js";
14
+ import { __require as Ce } from "./RTCSession/ReferNotifier.js";
15
+ import { __require as be } from "./RTCSession/ReferSubscriber.js";
16
+ import { __require as we } from "./URI.js";
17
+ var F, z;
18
+ function Xe() {
19
+ if (z) return F;
20
+ z = 1;
21
+ function w(T) {
22
+ "@babel/helpers - typeof";
23
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? w = function(m) {
24
+ return typeof m;
25
+ } : w = function(m) {
26
+ return m && typeof Symbol == "function" && m.constructor === Symbol && m !== Symbol.prototype ? "symbol" : typeof m;
27
+ }, w(T);
28
+ }
29
+ function A(T, p) {
30
+ var m;
31
+ if (typeof Symbol > "u" || T[Symbol.iterator] == null) {
32
+ if (Array.isArray(T) || (m = J(T)) || p) {
33
+ m && (T = m);
34
+ var c = 0, e = function() {
35
+ };
36
+ return { s: e, n: function() {
37
+ return c >= T.length ? { done: !0 } : { done: !1, value: T[c++] };
38
+ }, e: function(r) {
39
+ throw r;
40
+ }, f: e };
41
+ }
42
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
43
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
44
+ }
45
+ var t = !0, i = !1, n;
46
+ return { s: function() {
47
+ m = T[Symbol.iterator]();
48
+ }, n: function() {
49
+ var r = m.next();
50
+ return t = r.done, r;
51
+ }, e: function(r) {
52
+ i = !0, n = r;
53
+ }, f: function() {
54
+ try {
55
+ !t && m.return != null && m.return();
56
+ } finally {
57
+ if (i) throw n;
58
+ }
59
+ } };
60
+ }
61
+ function J(T, p) {
62
+ if (T) {
63
+ if (typeof T == "string") return L(T, p);
64
+ var m = Object.prototype.toString.call(T).slice(8, -1);
65
+ if (m === "Object" && T.constructor && (m = T.constructor.name), m === "Map" || m === "Set") return Array.from(T);
66
+ if (m === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)) return L(T, p);
67
+ }
68
+ }
69
+ function L(T, p) {
70
+ (p == null || p > T.length) && (p = T.length);
71
+ for (var m = 0, c = new Array(p); m < p; m++)
72
+ c[m] = T[m];
73
+ return c;
74
+ }
75
+ function Z(T, p) {
76
+ if (!(T instanceof p))
77
+ throw new TypeError("Cannot call a class as a function");
78
+ }
79
+ function W(T, p) {
80
+ for (var m = 0; m < p.length; m++) {
81
+ var c = p[m];
82
+ c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(T, c.key, c);
83
+ }
84
+ }
85
+ function G(T, p, m) {
86
+ return p && W(T.prototype, p), m && W(T, m), T;
87
+ }
88
+ function ee(T, p) {
89
+ if (typeof p != "function" && p !== null)
90
+ throw new TypeError("Super expression must either be null or a function");
91
+ T.prototype = Object.create(p && p.prototype, { constructor: { value: T, writable: !0, configurable: !0 } }), p && H(T, p);
92
+ }
93
+ function H(T, p) {
94
+ return H = Object.setPrototypeOf || function(c, e) {
95
+ return c.__proto__ = e, c;
96
+ }, H(T, p);
97
+ }
98
+ function te(T) {
99
+ var p = re();
100
+ return function() {
101
+ var c = D(T), e;
102
+ if (p) {
103
+ var t = D(this).constructor;
104
+ e = Reflect.construct(c, arguments, t);
105
+ } else
106
+ e = c.apply(this, arguments);
107
+ return ie(this, e);
108
+ };
109
+ }
110
+ function ie(T, p) {
111
+ return p && (w(p) === "object" || typeof p == "function") ? p : ne(T);
112
+ }
113
+ function ne(T) {
114
+ if (T === void 0)
115
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
116
+ return T;
117
+ }
118
+ function re() {
119
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
120
+ if (typeof Proxy == "function") return !0;
121
+ try {
122
+ return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
123
+ })), !0;
124
+ } catch {
125
+ return !1;
126
+ }
127
+ }
128
+ function D(T) {
129
+ return D = Object.setPrototypeOf ? Object.getPrototypeOf : function(m) {
130
+ return m.__proto__ || Object.getPrototypeOf(m);
131
+ }, D(T);
132
+ }
133
+ var se = fe().EventEmitter, j = he(), oe = Te(), d = me(), I = pe(), V = ve(), g = ge(), b = Se(), ae = Ee(), N = Re(), ce = ye(), y = Ae(), K = Ie(), ue = Ce(), de = be(), X = we(), s = new oe("RTCSession"), a = {
134
+ // RTCSession states.
135
+ STATUS_NULL: 0,
136
+ STATUS_INVITE_SENT: 1,
137
+ STATUS_1XX_RECEIVED: 2,
138
+ STATUS_INVITE_RECEIVED: 3,
139
+ STATUS_WAITING_FOR_ANSWER: 4,
140
+ STATUS_ANSWERED: 5,
141
+ STATUS_WAITING_FOR_ACK: 6,
142
+ STATUS_CANCELED: 7,
143
+ STATUS_TERMINATED: 8,
144
+ STATUS_CONFIRMED: 9
145
+ }, O = ["audio", "video"];
146
+ return F = /* @__PURE__ */ function(T) {
147
+ ee(m, T);
148
+ var p = te(m);
149
+ G(m, null, [{
150
+ key: "C",
151
+ /**
152
+ * Expose C object.
153
+ */
154
+ get: function() {
155
+ return a;
156
+ }
157
+ }]);
158
+ function m(c) {
159
+ var e;
160
+ return Z(this, m), s.debug("new"), e = p.call(this), e._id = null, e._ua = c, e._status = a.STATUS_NULL, e._dialog = null, e._earlyDialogs = {}, e._contact = null, e._from_tag = null, e._to_tag = null, e._connection = null, e._connectionPromiseQueue = Promise.resolve(), e._request = null, e._is_canceled = !1, e._cancel_reason = "", e._is_confirmed = !1, e._late_sdp = !1, e._rtcOfferConstraints = null, e._rtcAnswerConstraints = null, e._localMediaStream = null, e._localMediaStreamLocallyGenerated = !1, e._rtcReady = !0, e._iceReady = !1, e._timers = {
161
+ ackTimer: null,
162
+ expiresTimer: null,
163
+ invite2xxTimer: null,
164
+ userNoAnswerTimer: null
165
+ }, e._direction = null, e._local_identity = null, e._remote_identity = null, e._start_time = null, e._end_time = null, e._tones = null, e._audioMuted = !1, e._videoMuted = !1, e._localHold = !1, e._remoteHold = !1, e._sessionTimers = {
166
+ enabled: e._ua.configuration.session_timers,
167
+ refreshMethod: e._ua.configuration.session_timers_refresh_method,
168
+ defaultExpires: d.SESSION_EXPIRES,
169
+ currentExpires: null,
170
+ running: !1,
171
+ refresher: !1,
172
+ timer: null
173
+ // A setTimeout.
174
+ }, e._referSubscribers = {}, e._data = {}, e;
175
+ }
176
+ return G(m, [{
177
+ key: "isInProgress",
178
+ value: function() {
179
+ switch (this._status) {
180
+ case a.STATUS_NULL:
181
+ case a.STATUS_INVITE_SENT:
182
+ case a.STATUS_1XX_RECEIVED:
183
+ case a.STATUS_INVITE_RECEIVED:
184
+ case a.STATUS_WAITING_FOR_ANSWER:
185
+ return !0;
186
+ default:
187
+ return !1;
188
+ }
189
+ }
190
+ }, {
191
+ key: "isEstablished",
192
+ value: function() {
193
+ switch (this._status) {
194
+ case a.STATUS_ANSWERED:
195
+ case a.STATUS_WAITING_FOR_ACK:
196
+ case a.STATUS_CONFIRMED:
197
+ return !0;
198
+ default:
199
+ return !1;
200
+ }
201
+ }
202
+ }, {
203
+ key: "isEnded",
204
+ value: function() {
205
+ switch (this._status) {
206
+ case a.STATUS_CANCELED:
207
+ case a.STATUS_TERMINATED:
208
+ return !0;
209
+ default:
210
+ return !1;
211
+ }
212
+ }
213
+ }, {
214
+ key: "isMuted",
215
+ value: function() {
216
+ return {
217
+ audio: this._audioMuted,
218
+ video: this._videoMuted
219
+ };
220
+ }
221
+ }, {
222
+ key: "isOnHold",
223
+ value: function() {
224
+ return {
225
+ local: this._localHold,
226
+ remote: this._remoteHold
227
+ };
228
+ }
229
+ }, {
230
+ key: "connect",
231
+ value: function(e) {
232
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = arguments.length > 2 ? arguments[2] : void 0;
233
+ s.debug("connect()");
234
+ var n = e, o = g.cloneObject(t.eventHandlers), r = g.cloneArray(t.extraHeaders), u = g.cloneObject(t.mediaConstraints, {
235
+ audio: !0,
236
+ video: !0
237
+ }), l = t.mediaStream || null, _ = g.cloneObject(t.pcConfig, {
238
+ iceServers: []
239
+ }), h = t.rtcConstraints || null, f = t.rtcOfferConstraints || null;
240
+ if (this._rtcOfferConstraints = f, this._rtcAnswerConstraints = t.rtcAnswerConstraints || null, this._data = t.data || this._data, e === void 0)
241
+ throw new TypeError("Not enough arguments");
242
+ if (this._status !== a.STATUS_NULL)
243
+ throw new I.InvalidStateError(this._status);
244
+ if (!window.RTCPeerConnection)
245
+ throw new I.NotSupportedError("WebRTC not supported");
246
+ if (e = this._ua.normalizeTarget(e), !e)
247
+ throw new TypeError("Invalid target: ".concat(n));
248
+ this._sessionTimers.enabled && g.isDecimal(t.sessionTimersExpires) && (t.sessionTimersExpires >= d.MIN_SESSION_EXPIRES ? this._sessionTimers.defaultExpires = t.sessionTimersExpires : this._sessionTimers.defaultExpires = d.SESSION_EXPIRES);
249
+ for (var v in o)
250
+ Object.prototype.hasOwnProperty.call(o, v) && this.on(v, o[v]);
251
+ this._from_tag = g.newTag();
252
+ var E = t.anonymous || !1, R = {
253
+ from_tag: this._from_tag
254
+ };
255
+ this._contact = this._ua.contact.toString({
256
+ anonymous: E,
257
+ outbound: !0
258
+ }), E ? (R.from_display_name = "Anonymous", R.from_uri = new X("sip", "anonymous", "anonymous.invalid"), r.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())), r.push("Privacy: id")) : t.fromUserName && (R.from_uri = new X("sip", t.fromUserName, this._ua.configuration.uri.host), r.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))), t.fromDisplayName && (R.from_display_name = t.fromDisplayName), r.push("Contact: ".concat(this._contact)), r.push("Content-Type: application/sdp"), this._sessionTimers.enabled && r.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher ? ";refresher=uac" : "")), this._request = new ae.InitialOutgoingInviteRequest(e, this._ua, R, r), this._id = this._request.call_id + this._from_tag, this._createRTCConnection(_, h), this._direction = "outgoing", this._local_identity = this._request.from, this._remote_identity = this._request.to, i && i(this), this._newRTCSession("local", this._request), this._sendInitialRequest(u, f, l);
259
+ }
260
+ }, {
261
+ key: "init_incoming",
262
+ value: function(e, t) {
263
+ var i = this;
264
+ s.debug("init_incoming()");
265
+ var n, o = e.hasHeader("Content-Type") ? e.getHeader("Content-Type").toLowerCase() : void 0;
266
+ if (e.body && o !== "application/sdp") {
267
+ e.reply(415);
268
+ return;
269
+ }
270
+ if (this._status = a.STATUS_INVITE_RECEIVED, this._from_tag = e.from_tag, this._id = e.call_id + this._from_tag, this._request = e, this._contact = this._ua.contact.toString(), e.hasHeader("expires") && (n = e.getHeader("expires") * 1e3), e.to_tag = g.newTag(), !this._createDialog(e, "UAS", !0)) {
271
+ e.reply(500, "Missing Contact header field");
272
+ return;
273
+ }
274
+ e.body ? this._late_sdp = !1 : this._late_sdp = !0, this._status = a.STATUS_WAITING_FOR_ANSWER, this._timers.userNoAnswerTimer = setTimeout(function() {
275
+ e.reply(408), i._failed("local", null, d.causes.NO_ANSWER);
276
+ }, this._ua.configuration.no_answer_timeout), n && (this._timers.expiresTimer = setTimeout(function() {
277
+ i._status === a.STATUS_WAITING_FOR_ANSWER && (e.reply(487), i._failed("system", null, d.causes.EXPIRES));
278
+ }, n)), this._direction = "incoming", this._local_identity = e.to, this._remote_identity = e.from, t && t(this), this._newRTCSession("remote", e), this._status !== a.STATUS_TERMINATED && (e.reply(180, null, ["Contact: ".concat(this._contact)]), this._progress("local", null));
279
+ }
280
+ /**
281
+ * Answer the call.
282
+ */
283
+ }, {
284
+ key: "answer",
285
+ value: function() {
286
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
287
+ s.debug("answer()");
288
+ var i = this._request, n = g.cloneArray(t.extraHeaders), o = g.cloneObject(t.mediaConstraints), r = t.mediaStream || null, u = g.cloneObject(t.pcConfig, {
289
+ iceServers: []
290
+ }), l = t.rtcConstraints || null, _ = t.rtcAnswerConstraints || null, h = g.cloneObject(t.rtcOfferConstraints), f, v = !1, E = !1, R = !1, q = !1;
291
+ if (this._rtcAnswerConstraints = _, this._rtcOfferConstraints = t.rtcOfferConstraints || null, this._data = t.data || this._data, this._direction !== "incoming")
292
+ throw new I.NotSupportedError('"answer" not supported for outgoing RTCSession');
293
+ if (this._status !== a.STATUS_WAITING_FOR_ANSWER)
294
+ throw new I.InvalidStateError(this._status);
295
+ if (this._sessionTimers.enabled && g.isDecimal(t.sessionTimersExpires) && (t.sessionTimersExpires >= d.MIN_SESSION_EXPIRES ? this._sessionTimers.defaultExpires = t.sessionTimersExpires : this._sessionTimers.defaultExpires = d.SESSION_EXPIRES), this._status = a.STATUS_ANSWERED, !this._createDialog(i, "UAS")) {
296
+ i.reply(500, "Error creating dialog");
297
+ return;
298
+ }
299
+ clearTimeout(this._timers.userNoAnswerTimer), n.unshift("Contact: ".concat(this._contact));
300
+ var U = i.parseSDP();
301
+ Array.isArray(U.media) || (U.media = [U.media]);
302
+ var M = A(U.media), Q;
303
+ try {
304
+ for (M.s(); !(Q = M.n()).done; ) {
305
+ var C = Q.value;
306
+ C.type === "audio" && (v = !0, (!C.direction || C.direction === "sendrecv") && (R = !0)), C.type === "video" && (E = !0, (!C.direction || C.direction === "sendrecv") && (q = !0));
307
+ }
308
+ } catch (S) {
309
+ M.e(S);
310
+ } finally {
311
+ M.f();
312
+ }
313
+ if (r && o.audio === !1) {
314
+ f = r.getAudioTracks();
315
+ var k = A(f), B;
316
+ try {
317
+ for (k.s(); !(B = k.n()).done; ) {
318
+ var le = B.value;
319
+ r.removeTrack(le);
320
+ }
321
+ } catch (S) {
322
+ k.e(S);
323
+ } finally {
324
+ k.f();
325
+ }
326
+ }
327
+ if (r && o.video === !1) {
328
+ f = r.getVideoTracks();
329
+ var x = A(f), Y;
330
+ try {
331
+ for (x.s(); !(Y = x.n()).done; ) {
332
+ var _e = Y.value;
333
+ r.removeTrack(_e);
334
+ }
335
+ } catch (S) {
336
+ x.e(S);
337
+ } finally {
338
+ x.f();
339
+ }
340
+ }
341
+ !r && o.audio === void 0 && (o.audio = R), !r && o.video === void 0 && (o.video = q), !r && !v && !h.offerToReceiveAudio && (o.audio = !1), !r && !E && !h.offerToReceiveVideo && (o.video = !1), this._createRTCConnection(u, l), Promise.resolve().then(function() {
342
+ if (r)
343
+ return r;
344
+ if (o.audio || o.video)
345
+ return e._localMediaStreamLocallyGenerated = !0, navigator.mediaDevices.getUserMedia(o).catch(function(S) {
346
+ throw e._status === a.STATUS_TERMINATED ? new Error("terminated") : (i.reply(480), e._failed("local", null, d.causes.USER_DENIED_MEDIA_ACCESS), s.warn('emit "getusermediafailed" [error:%o]', S), e.emit("getusermediafailed", S), new Error("getUserMedia() failed"));
347
+ });
348
+ }).then(function(S) {
349
+ if (e._status === a.STATUS_TERMINATED)
350
+ throw new Error("terminated");
351
+ e._localMediaStream = S, S && S.getTracks().forEach(function(P) {
352
+ e._connection.addTrack(P, S);
353
+ });
354
+ }).then(function() {
355
+ if (!e._late_sdp) {
356
+ var S = {
357
+ originator: "remote",
358
+ type: "offer",
359
+ sdp: i.body
360
+ };
361
+ s.debug('emit "sdp"'), e.emit("sdp", S);
362
+ var P = new RTCSessionDescription({
363
+ type: "offer",
364
+ sdp: S.sdp
365
+ });
366
+ return e._connectionPromiseQueue = e._connectionPromiseQueue.then(function() {
367
+ return e._connection.setRemoteDescription(P);
368
+ }).catch(function($) {
369
+ throw i.reply(488), e._failed("system", null, d.causes.WEBRTC_ERROR), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', $), e.emit("peerconnection:setremotedescriptionfailed", $), new Error("peerconnection.setRemoteDescription() failed");
370
+ }), e._connectionPromiseQueue;
371
+ }
372
+ }).then(function() {
373
+ if (e._status === a.STATUS_TERMINATED)
374
+ throw new Error("terminated");
375
+ return e._connecting(i), e._late_sdp ? e._createLocalDescription("offer", e._rtcOfferConstraints).catch(function() {
376
+ throw i.reply(500), new Error("_createLocalDescription() failed");
377
+ }) : e._createLocalDescription("answer", _).catch(function() {
378
+ throw i.reply(500), new Error("_createLocalDescription() failed");
379
+ });
380
+ }).then(function(S) {
381
+ if (e._status === a.STATUS_TERMINATED)
382
+ throw new Error("terminated");
383
+ e._handleSessionTimersInIncomingRequest(i, n), i.reply(200, null, n, S, function() {
384
+ e._status = a.STATUS_WAITING_FOR_ACK, e._setInvite2xxTimer(i, S), e._setACKTimer(), e._accepted("local");
385
+ }, function() {
386
+ e._failed("system", null, d.causes.CONNECTION_ERROR);
387
+ });
388
+ }).catch(function(S) {
389
+ e._status !== a.STATUS_TERMINATED && s.warn(S);
390
+ });
391
+ }
392
+ /**
393
+ * Terminate the call.
394
+ */
395
+ }, {
396
+ key: "terminate",
397
+ value: function() {
398
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
399
+ s.debug("terminate()");
400
+ var i = t.cause || d.causes.BYE, n = g.cloneArray(t.extraHeaders), o = t.body, r, u = t.status_code, l = t.reason_phrase;
401
+ if (this._status === a.STATUS_TERMINATED)
402
+ throw new I.InvalidStateError(this._status);
403
+ switch (this._status) {
404
+ // - UAC -
405
+ case a.STATUS_NULL:
406
+ case a.STATUS_INVITE_SENT:
407
+ case a.STATUS_1XX_RECEIVED:
408
+ if (s.debug("canceling session"), u && (u < 200 || u >= 700))
409
+ throw new TypeError("Invalid status_code: ".concat(u));
410
+ u && (l = l || d.REASON_PHRASE[u] || "", r = "SIP ;cause=".concat(u, ' ;text="').concat(l, '"')), this._status === a.STATUS_NULL || this._status === a.STATUS_INVITE_SENT ? (this._is_canceled = !0, this._cancel_reason = r) : this._status === a.STATUS_1XX_RECEIVED && this._request.cancel(r), this._status = a.STATUS_CANCELED, this._failed("local", null, d.causes.CANCELED);
411
+ break;
412
+ // - UAS -
413
+ case a.STATUS_WAITING_FOR_ANSWER:
414
+ case a.STATUS_ANSWERED:
415
+ if (s.debug("rejecting session"), u = u || 480, u < 300 || u >= 700)
416
+ throw new TypeError("Invalid status_code: ".concat(u));
417
+ this._request.reply(u, l, n, o), this._failed("local", null, d.causes.REJECTED);
418
+ break;
419
+ case a.STATUS_WAITING_FOR_ACK:
420
+ case a.STATUS_CONFIRMED:
421
+ if (s.debug("terminating session"), l = t.reason_phrase || d.REASON_PHRASE[u] || "", u && (u < 200 || u >= 700))
422
+ throw new TypeError("Invalid status_code: ".concat(u));
423
+ if (u && n.push("Reason: SIP ;cause=".concat(u, '; text="').concat(l, '"')), this._status === a.STATUS_WAITING_FOR_ACK && this._direction === "incoming" && this._request.server_transaction.state !== V.C.STATUS_TERMINATED) {
424
+ var _ = this._dialog;
425
+ this.receiveRequest = function(h) {
426
+ var f = h.method;
427
+ f === d.ACK && (e.sendRequest(d.BYE, {
428
+ extraHeaders: n,
429
+ body: o
430
+ }), _.terminate());
431
+ }, this._request.server_transaction.on("stateChanged", function() {
432
+ e._request.server_transaction.state === V.C.STATUS_TERMINATED && (e.sendRequest(d.BYE, {
433
+ extraHeaders: n,
434
+ body: o
435
+ }), _.terminate());
436
+ }), this._ended("local", null, i), this._dialog = _, this._ua.newDialog(_);
437
+ } else
438
+ this.sendRequest(d.BYE, {
439
+ extraHeaders: n,
440
+ body: o
441
+ }), this._ended("local", null, i);
442
+ }
443
+ }
444
+ }, {
445
+ key: "sendDTMF",
446
+ value: function(e) {
447
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
448
+ s.debug("sendDTMF() | tones: %s", e);
449
+ var i = 0, n = t.duration || null, o = t.interToneGap || null, r = t.transportType || d.DTMF_TRANSPORT.INFO;
450
+ if (e === void 0)
451
+ throw new TypeError("Not enough arguments");
452
+ if (this._status !== a.STATUS_CONFIRMED && this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_1XX_RECEIVED)
453
+ throw new I.InvalidStateError(this._status);
454
+ if (r !== d.DTMF_TRANSPORT.INFO && r !== d.DTMF_TRANSPORT.RFC2833)
455
+ throw new TypeError("invalid transportType: ".concat(r));
456
+ if (typeof e == "number" && (e = e.toString()), !e || typeof e != "string" || !e.match(/^[0-9A-DR#*,]+$/i))
457
+ throw new TypeError("Invalid tones: ".concat(e));
458
+ if (n && !g.isDecimal(n))
459
+ throw new TypeError("Invalid tone duration: ".concat(n));
460
+ if (n ? n < y.C.MIN_DURATION ? (s.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(y.C.MIN_DURATION, " milliseconds")), n = y.C.MIN_DURATION) : n > y.C.MAX_DURATION ? (s.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(y.C.MAX_DURATION, " milliseconds")), n = y.C.MAX_DURATION) : n = Math.abs(n) : n = y.C.DEFAULT_DURATION, t.duration = n, o && !g.isDecimal(o))
461
+ throw new TypeError("Invalid interToneGap: ".concat(o));
462
+ if (o ? o < y.C.MIN_INTER_TONE_GAP ? (s.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(y.C.MIN_INTER_TONE_GAP, " milliseconds")), o = y.C.MIN_INTER_TONE_GAP) : o = Math.abs(o) : o = y.C.DEFAULT_INTER_TONE_GAP, r === d.DTMF_TRANSPORT.RFC2833) {
463
+ var u = this._getDTMFRTPSender();
464
+ u && (e = u.toneBuffer + e, u.insertDTMF(e, n, o));
465
+ return;
466
+ }
467
+ if (this._tones) {
468
+ this._tones += e;
469
+ return;
470
+ }
471
+ this._tones = e, l.call(this);
472
+ function l() {
473
+ var _ = this, h;
474
+ if (this._status === a.STATUS_TERMINATED || !this._tones || i >= this._tones.length) {
475
+ this._tones = null;
476
+ return;
477
+ }
478
+ var f = this._tones[i];
479
+ if (i += 1, f === ",")
480
+ h = 2e3;
481
+ else {
482
+ var v = new y(this);
483
+ t.eventHandlers = {
484
+ onFailed: function() {
485
+ _._tones = null;
486
+ }
487
+ }, v.send(f, t), h = n + o;
488
+ }
489
+ setTimeout(l.bind(this), h);
490
+ }
491
+ }
492
+ }, {
493
+ key: "sendInfo",
494
+ value: function(e, t) {
495
+ var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
496
+ if (s.debug("sendInfo()"), this._status !== a.STATUS_CONFIRMED && this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_1XX_RECEIVED)
497
+ throw new I.InvalidStateError(this._status);
498
+ var n = new K(this);
499
+ n.send(e, t, i);
500
+ }
501
+ /**
502
+ * Mute
503
+ */
504
+ }, {
505
+ key: "mute",
506
+ value: function() {
507
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
508
+ audio: !0,
509
+ video: !1
510
+ };
511
+ s.debug("mute()");
512
+ var t = !1, i = !1;
513
+ this._audioMuted === !1 && e.audio && (t = !0, this._audioMuted = !0, this._toggleMuteAudio(!0)), this._videoMuted === !1 && e.video && (i = !0, this._videoMuted = !0, this._toggleMuteVideo(!0)), (t === !0 || i === !0) && this._onmute({
514
+ audio: t,
515
+ video: i
516
+ });
517
+ }
518
+ /**
519
+ * Unmute
520
+ */
521
+ }, {
522
+ key: "unmute",
523
+ value: function() {
524
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
525
+ audio: !0,
526
+ video: !0
527
+ };
528
+ s.debug("unmute()");
529
+ var t = !1, i = !1;
530
+ this._audioMuted === !0 && e.audio && (t = !0, this._audioMuted = !1, this._localHold === !1 && this._toggleMuteAudio(!1)), this._videoMuted === !0 && e.video && (i = !0, this._videoMuted = !1, this._localHold === !1 && this._toggleMuteVideo(!1)), (t === !0 || i === !0) && this._onunmute({
531
+ audio: t,
532
+ video: i
533
+ });
534
+ }
535
+ /**
536
+ * Hold
537
+ */
538
+ }, {
539
+ key: "hold",
540
+ value: function() {
541
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, i = arguments.length > 1 ? arguments[1] : void 0;
542
+ if (s.debug("hold()"), this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED || this._localHold === !0 || !this._isReadyToReOffer())
543
+ return !1;
544
+ this._localHold = !0, this._onhold("local");
545
+ var n = {
546
+ succeeded: function() {
547
+ i && i();
548
+ },
549
+ failed: function() {
550
+ e.terminate({
551
+ cause: d.causes.WEBRTC_ERROR,
552
+ status_code: 500,
553
+ reason_phrase: "Hold Failed"
554
+ });
555
+ }
556
+ };
557
+ return t.useUpdate ? this._sendUpdate({
558
+ sdpOffer: !0,
559
+ eventHandlers: n,
560
+ extraHeaders: t.extraHeaders
561
+ }) : this._sendReinvite({
562
+ eventHandlers: n,
563
+ extraHeaders: t.extraHeaders
564
+ }), !0;
565
+ }
566
+ }, {
567
+ key: "unhold",
568
+ value: function() {
569
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, i = arguments.length > 1 ? arguments[1] : void 0;
570
+ if (s.debug("unhold()"), this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED || this._localHold === !1 || !this._isReadyToReOffer())
571
+ return !1;
572
+ this._localHold = !1, this._onunhold("local");
573
+ var n = {
574
+ succeeded: function() {
575
+ i && i();
576
+ },
577
+ failed: function() {
578
+ e.terminate({
579
+ cause: d.causes.WEBRTC_ERROR,
580
+ status_code: 500,
581
+ reason_phrase: "Unhold Failed"
582
+ });
583
+ }
584
+ };
585
+ return t.useUpdate ? this._sendUpdate({
586
+ sdpOffer: !0,
587
+ eventHandlers: n,
588
+ extraHeaders: t.extraHeaders
589
+ }) : this._sendReinvite({
590
+ eventHandlers: n,
591
+ extraHeaders: t.extraHeaders
592
+ }), !0;
593
+ }
594
+ }, {
595
+ key: "renegotiate",
596
+ value: function() {
597
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, i = arguments.length > 1 ? arguments[1] : void 0;
598
+ s.debug("renegotiate()");
599
+ var n = t.rtcOfferConstraints || null;
600
+ if (this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED || !this._isReadyToReOffer())
601
+ return !1;
602
+ var o = {
603
+ succeeded: function() {
604
+ i && i();
605
+ },
606
+ failed: function() {
607
+ e.terminate({
608
+ cause: d.causes.WEBRTC_ERROR,
609
+ status_code: 500,
610
+ reason_phrase: "Media Renegotiation Failed"
611
+ });
612
+ }
613
+ };
614
+ return this._setLocalMediaStatus(), t.useUpdate ? this._sendUpdate({
615
+ sdpOffer: !0,
616
+ eventHandlers: o,
617
+ rtcOfferConstraints: n,
618
+ extraHeaders: t.extraHeaders
619
+ }) : this._sendReinvite({
620
+ eventHandlers: o,
621
+ rtcOfferConstraints: n,
622
+ extraHeaders: t.extraHeaders
623
+ }), !0;
624
+ }
625
+ /**
626
+ * Refer
627
+ */
628
+ }, {
629
+ key: "refer",
630
+ value: function(e, t) {
631
+ var i = this;
632
+ s.debug("refer()");
633
+ var n = e;
634
+ if (this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED)
635
+ return !1;
636
+ if (e = this._ua.normalizeTarget(e), !e)
637
+ throw new TypeError("Invalid target: ".concat(n));
638
+ var o = new de(this);
639
+ o.sendRefer(e, t);
640
+ var r = o.id;
641
+ return this._referSubscribers[r] = o, o.on("requestFailed", function() {
642
+ delete i._referSubscribers[r];
643
+ }), o.on("accepted", function() {
644
+ delete i._referSubscribers[r];
645
+ }), o.on("failed", function() {
646
+ delete i._referSubscribers[r];
647
+ }), o;
648
+ }
649
+ /**
650
+ * Send a generic in-dialog Request
651
+ */
652
+ }, {
653
+ key: "sendRequest",
654
+ value: function(e, t) {
655
+ return s.debug("sendRequest()"), this._dialog.sendRequest(e, t);
656
+ }
657
+ /**
658
+ * In dialog Request Reception
659
+ */
660
+ }, {
661
+ key: "receiveRequest",
662
+ value: function(e) {
663
+ var t = this;
664
+ if (s.debug("receiveRequest()"), e.method === d.CANCEL)
665
+ (this._status === a.STATUS_WAITING_FOR_ANSWER || this._status === a.STATUS_ANSWERED) && (this._status = a.STATUS_CANCELED, this._request.reply(487), this._failed("remote", e, d.causes.CANCELED));
666
+ else
667
+ switch (e.method) {
668
+ case d.ACK:
669
+ if (this._status !== a.STATUS_WAITING_FOR_ACK)
670
+ return;
671
+ if (this._status = a.STATUS_CONFIRMED, clearTimeout(this._timers.ackTimer), clearTimeout(this._timers.invite2xxTimer), this._late_sdp) {
672
+ if (!e.body) {
673
+ this.terminate({
674
+ cause: d.causes.MISSING_SDP,
675
+ status_code: 400
676
+ });
677
+ break;
678
+ }
679
+ var i = {
680
+ originator: "remote",
681
+ type: "answer",
682
+ sdp: e.body
683
+ };
684
+ s.debug('emit "sdp"'), this.emit("sdp", i);
685
+ var n = new RTCSessionDescription({
686
+ type: "answer",
687
+ sdp: i.sdp
688
+ });
689
+ this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
690
+ return t._connection.setRemoteDescription(n);
691
+ }).then(function() {
692
+ t._is_confirmed || t._confirmed("remote", e);
693
+ }).catch(function(r) {
694
+ t.terminate({
695
+ cause: d.causes.BAD_MEDIA_DESCRIPTION,
696
+ status_code: 488
697
+ }), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', r), t.emit("peerconnection:setremotedescriptionfailed", r);
698
+ });
699
+ } else this._is_confirmed || this._confirmed("remote", e);
700
+ break;
701
+ case d.BYE:
702
+ this._status === a.STATUS_CONFIRMED || this._status === a.STATUS_WAITING_FOR_ACK ? (e.reply(200), this._ended("remote", e, d.causes.BYE)) : this._status === a.STATUS_INVITE_RECEIVED || this._status === a.STATUS_WAITING_FOR_ANSWER ? (e.reply(200), this._request.reply(487, "BYE Received"), this._ended("remote", e, d.causes.BYE)) : e.reply(403, "Wrong Status");
703
+ break;
704
+ case d.INVITE:
705
+ this._status === a.STATUS_CONFIRMED ? e.hasHeader("replaces") ? this._receiveReplaces(e) : this._receiveReinvite(e) : e.reply(403, "Wrong Status");
706
+ break;
707
+ case d.INFO:
708
+ if (this._status === a.STATUS_1XX_RECEIVED || this._status === a.STATUS_WAITING_FOR_ANSWER || this._status === a.STATUS_ANSWERED || this._status === a.STATUS_WAITING_FOR_ACK || this._status === a.STATUS_CONFIRMED) {
709
+ var o = e.hasHeader("Content-Type") ? e.getHeader("Content-Type").toLowerCase() : void 0;
710
+ o && o.match(/^application\/dtmf-relay/i) ? new y(this).init_incoming(e) : o !== void 0 ? new K(this).init_incoming(e) : e.reply(415);
711
+ } else
712
+ e.reply(403, "Wrong Status");
713
+ break;
714
+ case d.UPDATE:
715
+ this._status === a.STATUS_CONFIRMED ? this._receiveUpdate(e) : e.reply(403, "Wrong Status");
716
+ break;
717
+ case d.REFER:
718
+ this._status === a.STATUS_CONFIRMED ? this._receiveRefer(e) : e.reply(403, "Wrong Status");
719
+ break;
720
+ case d.NOTIFY:
721
+ this._status === a.STATUS_CONFIRMED ? this._receiveNotify(e) : e.reply(403, "Wrong Status");
722
+ break;
723
+ default:
724
+ e.reply(501);
725
+ }
726
+ }
727
+ /**
728
+ * Session Callbacks
729
+ */
730
+ }, {
731
+ key: "onTransportError",
732
+ value: function() {
733
+ s.warn("onTransportError()"), this._status !== a.STATUS_TERMINATED && this.terminate({
734
+ status_code: 500,
735
+ reason_phrase: d.causes.CONNECTION_ERROR,
736
+ cause: d.causes.CONNECTION_ERROR
737
+ });
738
+ }
739
+ }, {
740
+ key: "onRequestTimeout",
741
+ value: function() {
742
+ s.warn("onRequestTimeout()"), this._status !== a.STATUS_TERMINATED && this.terminate({
743
+ status_code: 408,
744
+ reason_phrase: d.causes.REQUEST_TIMEOUT,
745
+ cause: d.causes.REQUEST_TIMEOUT
746
+ });
747
+ }
748
+ }, {
749
+ key: "onDialogError",
750
+ value: function() {
751
+ s.warn("onDialogError()"), this._status !== a.STATUS_TERMINATED && this.terminate({
752
+ status_code: 500,
753
+ reason_phrase: d.causes.DIALOG_ERROR,
754
+ cause: d.causes.DIALOG_ERROR
755
+ });
756
+ }
757
+ // Called from DTMF handler.
758
+ }, {
759
+ key: "newDTMF",
760
+ value: function(e) {
761
+ s.debug("newDTMF()"), this.emit("newDTMF", e);
762
+ }
763
+ // Called from Info handler.
764
+ }, {
765
+ key: "newInfo",
766
+ value: function(e) {
767
+ s.debug("newInfo()"), this.emit("newInfo", e);
768
+ }
769
+ /**
770
+ * Check if RTCSession is ready for an outgoing re-INVITE or UPDATE with SDP.
771
+ */
772
+ }, {
773
+ key: "_isReadyToReOffer",
774
+ value: function() {
775
+ return this._rtcReady ? this._dialog ? this._dialog.uac_pending_reply === !0 || this._dialog.uas_pending_reply === !0 ? (s.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"), !1) : !0 : (s.debug("_isReadyToReOffer() | session not established yet"), !1) : (s.debug("_isReadyToReOffer() | internal WebRTC status not ready"), !1);
776
+ }
777
+ }, {
778
+ key: "_close",
779
+ value: function() {
780
+ if (s.debug("close()"), this._localMediaStream && this._localMediaStreamLocallyGenerated && (s.debug("close() | closing local MediaStream"), g.closeMediaStream(this._localMediaStream)), this._status !== a.STATUS_TERMINATED) {
781
+ if (this._status = a.STATUS_TERMINATED, this._connection)
782
+ try {
783
+ this._connection.close();
784
+ } catch (n) {
785
+ s.warn("close() | error closing the RTCPeerConnection: %o", n);
786
+ }
787
+ for (var e in this._timers)
788
+ Object.prototype.hasOwnProperty.call(this._timers, e) && clearTimeout(this._timers[e]);
789
+ clearTimeout(this._sessionTimers.timer), this._dialog && (this._dialog.terminate(), delete this._dialog);
790
+ for (var t in this._earlyDialogs)
791
+ Object.prototype.hasOwnProperty.call(this._earlyDialogs, t) && (this._earlyDialogs[t].terminate(), delete this._earlyDialogs[t]);
792
+ for (var i in this._referSubscribers)
793
+ Object.prototype.hasOwnProperty.call(this._referSubscribers, i) && delete this._referSubscribers[i];
794
+ this._ua.destroyRTCSession(this);
795
+ }
796
+ }
797
+ /**
798
+ * Private API.
799
+ */
800
+ /**
801
+ * RFC3261 13.3.1.4
802
+ * Response retransmissions cannot be accomplished by transaction layer
803
+ * since it is destroyed when receiving the first 2xx answer
804
+ */
805
+ }, {
806
+ key: "_setInvite2xxTimer",
807
+ value: function(e, t) {
808
+ var i = b.T1;
809
+ function n() {
810
+ this._status === a.STATUS_WAITING_FOR_ACK && (e.reply(200, null, ["Contact: ".concat(this._contact)], t), i < b.T2 && (i = i * 2, i > b.T2 && (i = b.T2)), this._timers.invite2xxTimer = setTimeout(n.bind(this), i));
811
+ }
812
+ this._timers.invite2xxTimer = setTimeout(n.bind(this), i);
813
+ }
814
+ /**
815
+ * RFC3261 14.2
816
+ * If a UAS generates a 2xx response and never receives an ACK,
817
+ * it SHOULD generate a BYE to terminate the dialog.
818
+ */
819
+ }, {
820
+ key: "_setACKTimer",
821
+ value: function() {
822
+ var e = this;
823
+ this._timers.ackTimer = setTimeout(function() {
824
+ e._status === a.STATUS_WAITING_FOR_ACK && (s.debug("no ACK received, terminating the session"), clearTimeout(e._timers.invite2xxTimer), e.sendRequest(d.BYE), e._ended("remote", null, d.causes.NO_ACK));
825
+ }, b.TIMER_H);
826
+ }
827
+ }, {
828
+ key: "_createRTCConnection",
829
+ value: function(e, t) {
830
+ var i = this;
831
+ this._connection = new RTCPeerConnection(e, t), this._connection.addEventListener("iceconnectionstatechange", function() {
832
+ var n = i._connection.iceConnectionState;
833
+ n === "failed" && i.terminate({
834
+ cause: d.causes.RTP_TIMEOUT,
835
+ status_code: 408,
836
+ reason_phrase: d.causes.RTP_TIMEOUT
837
+ });
838
+ }), s.debug('emit "peerconnection"'), this.emit("peerconnection", {
839
+ peerconnection: this._connection
840
+ });
841
+ }
842
+ }, {
843
+ key: "_createLocalDescription",
844
+ value: function(e, t) {
845
+ var i = this;
846
+ if (s.debug("createLocalDescription()"), e !== "offer" && e !== "answer") throw new Error('createLocalDescription() | invalid type "'.concat(e, '"'));
847
+ var n = this._connection;
848
+ return this._rtcReady = !1, Promise.resolve().then(function() {
849
+ return e === "offer" ? n.createOffer(t).catch(function(o) {
850
+ return s.warn('emit "peerconnection:createofferfailed" [error:%o]', o), i.emit("peerconnection:createofferfailed", o), Promise.reject(o);
851
+ }) : n.createAnswer(t).catch(function(o) {
852
+ return s.warn('emit "peerconnection:createanswerfailed" [error:%o]', o), i.emit("peerconnection:createanswerfailed", o), Promise.reject(o);
853
+ });
854
+ }).then(function(o) {
855
+ return n.setLocalDescription(o).catch(function(r) {
856
+ return i._rtcReady = !0, s.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]', r), i.emit("peerconnection:setlocaldescriptionfailed", r), Promise.reject(r);
857
+ });
858
+ }).then(function() {
859
+ var o = t && t.iceRestart;
860
+ if (n.iceGatheringState === "complete" && !o || n.iceGatheringState === "gathering" && i._iceReady) {
861
+ i._rtcReady = !0;
862
+ var r = {
863
+ originator: "local",
864
+ type: e,
865
+ sdp: n.localDescription.sdp
866
+ };
867
+ return s.debug('emit "sdp"'), i.emit("sdp", r), Promise.resolve(r.sdp);
868
+ }
869
+ return new Promise(function(u) {
870
+ var l = !1, _, h;
871
+ i._iceReady = !1;
872
+ var f = function() {
873
+ if (!l) {
874
+ n.removeEventListener("icecandidate", _), n.removeEventListener("icegatheringstatechange", h), l = !0, i._rtcReady = !0, i._iceReady = !0;
875
+ var E = {
876
+ originator: "local",
877
+ type: e,
878
+ sdp: n.localDescription.sdp
879
+ };
880
+ s.debug('emit "sdp"'), i.emit("sdp", E), u(E.sdp);
881
+ }
882
+ };
883
+ n.addEventListener("icecandidate", _ = function(E) {
884
+ var R = E.candidate;
885
+ R ? i.emit("icecandidate", {
886
+ candidate: R,
887
+ ready: f
888
+ }) : f();
889
+ }), n.addEventListener("icegatheringstatechange", h = function() {
890
+ n.iceGatheringState === "complete" && f();
891
+ });
892
+ });
893
+ });
894
+ }
895
+ /**
896
+ * Dialog Management
897
+ */
898
+ }, {
899
+ key: "_createDialog",
900
+ value: function(e, t, i) {
901
+ var n = t === "UAS" ? e.to_tag : e.from_tag, o = t === "UAS" ? e.from_tag : e.to_tag, r = e.call_id + n + o, u = this._earlyDialogs[r];
902
+ if (i)
903
+ return u ? !0 : (u = new N(this, e, t, N.C.STATUS_EARLY), u.error ? (s.debug(u.error), this._failed("remote", e, d.causes.INTERNAL_ERROR), !1) : (this._earlyDialogs[r] = u, !0));
904
+ if (this._from_tag = e.from_tag, this._to_tag = e.to_tag, u)
905
+ return u.update(e, t), this._dialog = u, delete this._earlyDialogs[r], !0;
906
+ var l = new N(this, e, t);
907
+ return l.error ? (s.debug(l.error), this._failed("remote", e, d.causes.INTERNAL_ERROR), !1) : (this._dialog = l, !0);
908
+ }
909
+ /**
910
+ * In dialog INVITE Reception
911
+ */
912
+ }, {
913
+ key: "_receiveReinvite",
914
+ value: function(e) {
915
+ var t = this;
916
+ s.debug("receiveReinvite()");
917
+ var i = e.hasHeader("Content-Type") ? e.getHeader("Content-Type").toLowerCase() : void 0, n = {
918
+ request: e,
919
+ callback: void 0,
920
+ reject: r.bind(this)
921
+ }, o = !1;
922
+ function r() {
923
+ var l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
924
+ o = !0;
925
+ var _ = l.status_code || 403, h = l.reason_phrase || "", f = g.cloneArray(l.extraHeaders);
926
+ if (this._status !== a.STATUS_CONFIRMED)
927
+ return !1;
928
+ if (_ < 300 || _ >= 700)
929
+ throw new TypeError("Invalid status_code: ".concat(_));
930
+ e.reply(_, h, f);
931
+ }
932
+ if (this.emit("reinvite", n), o)
933
+ return;
934
+ if (this._late_sdp = !1, !e.body) {
935
+ this._late_sdp = !0, this._remoteHold && (this._remoteHold = !1, this._onunhold("remote")), this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
936
+ return t._createLocalDescription("offer", t._rtcOfferConstraints);
937
+ }).then(function(l) {
938
+ u.call(t, l);
939
+ }).catch(function() {
940
+ e.reply(500);
941
+ });
942
+ return;
943
+ }
944
+ if (i !== "application/sdp") {
945
+ s.debug("invalid Content-Type"), e.reply(415);
946
+ return;
947
+ }
948
+ this._processInDialogSdpOffer(e).then(function(l) {
949
+ t._status !== a.STATUS_TERMINATED && u.call(t, l);
950
+ }).catch(function(l) {
951
+ s.warn(l);
952
+ });
953
+ function u(l) {
954
+ var _ = this, h = ["Contact: ".concat(this._contact)];
955
+ this._handleSessionTimersInIncomingRequest(e, h), this._late_sdp && (l = this._mangleOffer(l)), e.reply(200, null, h, l, function() {
956
+ _._status = a.STATUS_WAITING_FOR_ACK, _._setInvite2xxTimer(e, l), _._setACKTimer();
957
+ }), typeof n.callback == "function" && n.callback();
958
+ }
959
+ }
960
+ /**
961
+ * In dialog UPDATE Reception
962
+ */
963
+ }, {
964
+ key: "_receiveUpdate",
965
+ value: function(e) {
966
+ var t = this;
967
+ s.debug("receiveUpdate()");
968
+ var i = e.hasHeader("Content-Type") ? e.getHeader("Content-Type").toLowerCase() : void 0, n = {
969
+ request: e,
970
+ callback: void 0,
971
+ reject: r.bind(this)
972
+ }, o = !1;
973
+ function r() {
974
+ var l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
975
+ o = !0;
976
+ var _ = l.status_code || 403, h = l.reason_phrase || "", f = g.cloneArray(l.extraHeaders);
977
+ if (this._status !== a.STATUS_CONFIRMED)
978
+ return !1;
979
+ if (_ < 300 || _ >= 700)
980
+ throw new TypeError("Invalid status_code: ".concat(_));
981
+ e.reply(_, h, f);
982
+ }
983
+ if (this.emit("update", n), o)
984
+ return;
985
+ if (!e.body) {
986
+ u.call(this, null);
987
+ return;
988
+ }
989
+ if (i !== "application/sdp") {
990
+ s.debug("invalid Content-Type"), e.reply(415);
991
+ return;
992
+ }
993
+ this._processInDialogSdpOffer(e).then(function(l) {
994
+ t._status !== a.STATUS_TERMINATED && u.call(t, l);
995
+ }).catch(function(l) {
996
+ s.warn(l);
997
+ });
998
+ function u(l) {
999
+ var _ = ["Contact: ".concat(this._contact)];
1000
+ this._handleSessionTimersInIncomingRequest(e, _), e.reply(200, null, _, l), typeof n.callback == "function" && n.callback();
1001
+ }
1002
+ }
1003
+ }, {
1004
+ key: "_processInDialogSdpOffer",
1005
+ value: function(e) {
1006
+ var t = this;
1007
+ s.debug("_processInDialogSdpOffer()");
1008
+ var i = e.parseSDP(), n = !1, o = A(i.media), r;
1009
+ try {
1010
+ for (o.s(); !(r = o.n()).done; ) {
1011
+ var u = r.value;
1012
+ if (O.indexOf(u.type) !== -1) {
1013
+ var l = u.direction || i.direction || "sendrecv";
1014
+ if (l === "sendonly" || l === "inactive")
1015
+ n = !0;
1016
+ else {
1017
+ n = !1;
1018
+ break;
1019
+ }
1020
+ }
1021
+ }
1022
+ } catch (f) {
1023
+ o.e(f);
1024
+ } finally {
1025
+ o.f();
1026
+ }
1027
+ var _ = {
1028
+ originator: "remote",
1029
+ type: "offer",
1030
+ sdp: e.body
1031
+ };
1032
+ s.debug('emit "sdp"'), this.emit("sdp", _);
1033
+ var h = new RTCSessionDescription({
1034
+ type: "offer",
1035
+ sdp: _.sdp
1036
+ });
1037
+ return this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1038
+ if (t._status === a.STATUS_TERMINATED)
1039
+ throw new Error("terminated");
1040
+ return t._connection.setRemoteDescription(h).catch(function(f) {
1041
+ throw e.reply(488), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', f), t.emit("peerconnection:setremotedescriptionfailed", f), f;
1042
+ });
1043
+ }).then(function() {
1044
+ if (t._status === a.STATUS_TERMINATED)
1045
+ throw new Error("terminated");
1046
+ t._remoteHold === !0 && n === !1 ? (t._remoteHold = !1, t._onunhold("remote")) : t._remoteHold === !1 && n === !0 && (t._remoteHold = !0, t._onhold("remote"));
1047
+ }).then(function() {
1048
+ if (t._status === a.STATUS_TERMINATED)
1049
+ throw new Error("terminated");
1050
+ return t._createLocalDescription("answer", t._rtcAnswerConstraints).catch(function(f) {
1051
+ throw e.reply(500), s.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]', f), f;
1052
+ });
1053
+ }).catch(function(f) {
1054
+ s.warn("_processInDialogSdpOffer() failed [error: %o]", f);
1055
+ }), this._connectionPromiseQueue;
1056
+ }
1057
+ /**
1058
+ * In dialog Refer Reception
1059
+ */
1060
+ }, {
1061
+ key: "_receiveRefer",
1062
+ value: function(e) {
1063
+ var t = this;
1064
+ if (s.debug("receiveRefer()"), !e.refer_to) {
1065
+ s.debug("no Refer-To header field present in REFER"), e.reply(400);
1066
+ return;
1067
+ }
1068
+ if (e.refer_to.uri.scheme !== d.SIP) {
1069
+ s.debug("Refer-To header field points to a non-SIP URI scheme"), e.reply(416);
1070
+ return;
1071
+ }
1072
+ e.reply(202);
1073
+ var i = new ue(this, e.cseq);
1074
+ s.debug('emit "refer"'), this.emit("refer", {
1075
+ request: e,
1076
+ accept: function(u, l) {
1077
+ n.call(t, u, l);
1078
+ },
1079
+ reject: function() {
1080
+ o.call(t);
1081
+ }
1082
+ });
1083
+ function n(r) {
1084
+ var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1085
+ if (r = typeof r == "function" ? r : null, this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED)
1086
+ return !1;
1087
+ var l = new m(this._ua);
1088
+ if (l.on("progress", function(h) {
1089
+ var f = h.response;
1090
+ i.notify(f.status_code, f.reason_phrase);
1091
+ }), l.on("accepted", function(h) {
1092
+ var f = h.response;
1093
+ i.notify(f.status_code, f.reason_phrase);
1094
+ }), l.on("_failed", function(h) {
1095
+ var f = h.message, v = h.cause;
1096
+ f ? i.notify(f.status_code, f.reason_phrase) : i.notify(487, v);
1097
+ }), e.refer_to.uri.hasHeader("replaces")) {
1098
+ var _ = decodeURIComponent(e.refer_to.uri.getHeader("replaces"));
1099
+ u.extraHeaders = g.cloneArray(u.extraHeaders), u.extraHeaders.push("Replaces: ".concat(_));
1100
+ }
1101
+ l.connect(e.refer_to.uri.toAor(), u, r);
1102
+ }
1103
+ function o() {
1104
+ i.notify(603);
1105
+ }
1106
+ }
1107
+ /**
1108
+ * In dialog Notify Reception
1109
+ */
1110
+ }, {
1111
+ key: "_receiveNotify",
1112
+ value: function(e) {
1113
+ switch (s.debug("receiveNotify()"), e.event || e.reply(400), e.event.event) {
1114
+ case "refer": {
1115
+ var t, i;
1116
+ if (e.event.params && e.event.params.id)
1117
+ t = e.event.params.id, i = this._referSubscribers[t];
1118
+ else if (Object.keys(this._referSubscribers).length === 1)
1119
+ i = this._referSubscribers[Object.keys(this._referSubscribers)[0]];
1120
+ else {
1121
+ e.reply(400, "Missing event id parameter");
1122
+ return;
1123
+ }
1124
+ if (!i) {
1125
+ e.reply(481, "Subscription does not exist");
1126
+ return;
1127
+ }
1128
+ i.receiveNotify(e), e.reply(200);
1129
+ break;
1130
+ }
1131
+ default:
1132
+ e.reply(489);
1133
+ }
1134
+ }
1135
+ /**
1136
+ * INVITE with Replaces Reception
1137
+ */
1138
+ }, {
1139
+ key: "_receiveReplaces",
1140
+ value: function(e) {
1141
+ var t = this;
1142
+ s.debug("receiveReplaces()");
1143
+ function i(o) {
1144
+ var r = this;
1145
+ if (this._status !== a.STATUS_WAITING_FOR_ACK && this._status !== a.STATUS_CONFIRMED)
1146
+ return !1;
1147
+ var u = new m(this._ua);
1148
+ u.on("confirmed", function() {
1149
+ r.terminate();
1150
+ }), u.init_incoming(e, o);
1151
+ }
1152
+ function n() {
1153
+ s.debug("Replaced INVITE rejected by the user"), e.reply(486);
1154
+ }
1155
+ this.emit("replaces", {
1156
+ request: e,
1157
+ accept: function(r) {
1158
+ i.call(t, r);
1159
+ },
1160
+ reject: function() {
1161
+ n.call(t);
1162
+ }
1163
+ });
1164
+ }
1165
+ /**
1166
+ * Initial Request Sender
1167
+ */
1168
+ }, {
1169
+ key: "_sendInitialRequest",
1170
+ value: function(e, t, i) {
1171
+ var n = this, o = new ce(this._ua, this._request, {
1172
+ onRequestTimeout: function() {
1173
+ n.onRequestTimeout();
1174
+ },
1175
+ onTransportError: function() {
1176
+ n.onTransportError();
1177
+ },
1178
+ // Update the request on authentication.
1179
+ onAuthenticated: function(u) {
1180
+ n._request = u;
1181
+ },
1182
+ onReceiveResponse: function(u) {
1183
+ n._receiveInviteResponse(u);
1184
+ }
1185
+ });
1186
+ Promise.resolve().then(function() {
1187
+ if (i)
1188
+ return i;
1189
+ if (e.audio || e.video)
1190
+ return n._localMediaStreamLocallyGenerated = !0, navigator.mediaDevices.getUserMedia(e).catch(function(r) {
1191
+ throw n._status === a.STATUS_TERMINATED ? new Error("terminated") : (n._failed("local", null, d.causes.USER_DENIED_MEDIA_ACCESS), s.warn('emit "getusermediafailed" [error:%o]', r), n.emit("getusermediafailed", r), r);
1192
+ });
1193
+ }).then(function(r) {
1194
+ if (n._status === a.STATUS_TERMINATED)
1195
+ throw new Error("terminated");
1196
+ return n._localMediaStream = r, r && r.getTracks().forEach(function(u) {
1197
+ n._connection.addTrack(u, r);
1198
+ }), n._connecting(n._request), n._createLocalDescription("offer", t).catch(function(u) {
1199
+ throw n._failed("local", null, d.causes.WEBRTC_ERROR), u;
1200
+ });
1201
+ }).then(function(r) {
1202
+ if (n._is_canceled || n._status === a.STATUS_TERMINATED)
1203
+ throw new Error("terminated");
1204
+ n._request.body = r, n._status = a.STATUS_INVITE_SENT, s.debug('emit "sending" [request:%o]', n._request), n.emit("sending", {
1205
+ request: n._request
1206
+ }), o.send();
1207
+ }).catch(function(r) {
1208
+ n._status !== a.STATUS_TERMINATED && s.warn(r);
1209
+ });
1210
+ }
1211
+ /**
1212
+ * Get DTMF RTCRtpSender.
1213
+ */
1214
+ }, {
1215
+ key: "_getDTMFRTPSender",
1216
+ value: function() {
1217
+ var e = this._connection.getSenders().find(function(t) {
1218
+ return t.track && t.track.kind === "audio";
1219
+ });
1220
+ if (!(e && e.dtmf)) {
1221
+ s.warn("sendDTMF() | no local audio track to send DTMF with");
1222
+ return;
1223
+ }
1224
+ return e.dtmf;
1225
+ }
1226
+ /**
1227
+ * Reception of Response for Initial INVITE
1228
+ */
1229
+ }, {
1230
+ key: "_receiveInviteResponse",
1231
+ value: function(e) {
1232
+ var t = this;
1233
+ if (s.debug("receiveInviteResponse()"), this._dialog && e.status_code >= 200 && e.status_code <= 299)
1234
+ if (this._dialog.id.call_id === e.call_id && this._dialog.id.local_tag === e.from_tag && this._dialog.id.remote_tag === e.to_tag) {
1235
+ this.sendRequest(d.ACK);
1236
+ return;
1237
+ } else {
1238
+ var i = new N(this, e, "UAC");
1239
+ if (i.error !== void 0) {
1240
+ s.debug(i.error);
1241
+ return;
1242
+ }
1243
+ this.sendRequest(d.ACK), this.sendRequest(d.BYE);
1244
+ return;
1245
+ }
1246
+ if (this._is_canceled) {
1247
+ e.status_code >= 100 && e.status_code < 200 ? this._request.cancel(this._cancel_reason) : e.status_code >= 200 && e.status_code < 299 && this._acceptAndTerminate(e);
1248
+ return;
1249
+ }
1250
+ if (!(this._status !== a.STATUS_INVITE_SENT && this._status !== a.STATUS_1XX_RECEIVED))
1251
+ switch (!0) {
1252
+ case /^100$/.test(e.status_code):
1253
+ this._status = a.STATUS_1XX_RECEIVED;
1254
+ break;
1255
+ case /^1[0-9]{2}$/.test(e.status_code): {
1256
+ if (!e.to_tag) {
1257
+ s.debug("1xx response received without to tag");
1258
+ break;
1259
+ }
1260
+ if (e.hasHeader("contact") && !this._createDialog(e, "UAC", !0))
1261
+ break;
1262
+ if (this._status = a.STATUS_1XX_RECEIVED, !e.body) {
1263
+ this._progress("remote", e);
1264
+ break;
1265
+ }
1266
+ var n = {
1267
+ originator: "remote",
1268
+ type: "answer",
1269
+ sdp: e.body
1270
+ };
1271
+ s.debug('emit "sdp"'), this.emit("sdp", n);
1272
+ var o = new RTCSessionDescription({
1273
+ type: "answer",
1274
+ sdp: n.sdp
1275
+ });
1276
+ this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1277
+ return t._connection.setRemoteDescription(o);
1278
+ }).then(function() {
1279
+ return t._progress("remote", e);
1280
+ }).catch(function(_) {
1281
+ s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', _), t.emit("peerconnection:setremotedescriptionfailed", _);
1282
+ });
1283
+ break;
1284
+ }
1285
+ case /^2[0-9]{2}$/.test(e.status_code): {
1286
+ if (this._status = a.STATUS_CONFIRMED, !e.body) {
1287
+ this._acceptAndTerminate(e, 400, d.causes.MISSING_SDP), this._failed("remote", e, d.causes.BAD_MEDIA_DESCRIPTION);
1288
+ break;
1289
+ }
1290
+ if (!this._createDialog(e, "UAC"))
1291
+ break;
1292
+ var r = {
1293
+ originator: "remote",
1294
+ type: "answer",
1295
+ sdp: e.body
1296
+ };
1297
+ s.debug('emit "sdp"'), this.emit("sdp", r);
1298
+ var u = new RTCSessionDescription({
1299
+ type: "answer",
1300
+ sdp: r.sdp
1301
+ });
1302
+ this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1303
+ if (t._connection.signalingState === "stable")
1304
+ return t._connection.createOffer(t._rtcOfferConstraints).then(function(_) {
1305
+ return t._connection.setLocalDescription(_);
1306
+ }).catch(function(_) {
1307
+ t._acceptAndTerminate(e, 500, _.toString()), t._failed("local", e, d.causes.WEBRTC_ERROR);
1308
+ });
1309
+ }).then(function() {
1310
+ t._connection.setRemoteDescription(u).then(function() {
1311
+ t._handleSessionTimersInIncomingResponse(e), t._accepted("remote", e), t.sendRequest(d.ACK), t._confirmed("local", null);
1312
+ }).catch(function(_) {
1313
+ t._acceptAndTerminate(e, 488, "Not Acceptable Here"), t._failed("remote", e, d.causes.BAD_MEDIA_DESCRIPTION), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', _), t.emit("peerconnection:setremotedescriptionfailed", _);
1314
+ });
1315
+ });
1316
+ break;
1317
+ }
1318
+ default: {
1319
+ var l = g.sipErrorCause(e.status_code);
1320
+ this._failed("remote", e, l);
1321
+ }
1322
+ }
1323
+ }
1324
+ /**
1325
+ * Send Re-INVITE
1326
+ */
1327
+ }, {
1328
+ key: "_sendReinvite",
1329
+ value: function() {
1330
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1331
+ s.debug("sendReinvite()");
1332
+ var i = g.cloneArray(t.extraHeaders), n = g.cloneObject(t.eventHandlers), o = t.rtcOfferConstraints || this._rtcOfferConstraints || null, r = !1;
1333
+ i.push("Contact: ".concat(this._contact)), i.push("Content-Type: application/sdp"), this._sessionTimers.running && i.push("Session-Expires: ".concat(this._sessionTimers.currentExpires, ";refresher=").concat(this._sessionTimers.refresher ? "uac" : "uas")), this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1334
+ return e._createLocalDescription("offer", o);
1335
+ }).then(function(_) {
1336
+ _ = e._mangleOffer(_);
1337
+ var h = {
1338
+ originator: "local",
1339
+ type: "offer",
1340
+ sdp: _
1341
+ };
1342
+ s.debug('emit "sdp"'), e.emit("sdp", h), e.sendRequest(d.INVITE, {
1343
+ extraHeaders: i,
1344
+ body: _,
1345
+ eventHandlers: {
1346
+ onSuccessResponse: function(v) {
1347
+ u.call(e, v), r = !0;
1348
+ },
1349
+ onErrorResponse: function(v) {
1350
+ l.call(e, v);
1351
+ },
1352
+ onTransportError: function() {
1353
+ e.onTransportError();
1354
+ },
1355
+ onRequestTimeout: function() {
1356
+ e.onRequestTimeout();
1357
+ },
1358
+ onDialogError: function() {
1359
+ e.onDialogError();
1360
+ }
1361
+ }
1362
+ });
1363
+ }).catch(function() {
1364
+ l();
1365
+ });
1366
+ function u(_) {
1367
+ var h = this;
1368
+ if (this._status !== a.STATUS_TERMINATED && (this.sendRequest(d.ACK), !r)) {
1369
+ if (this._handleSessionTimersInIncomingResponse(_), _.body) {
1370
+ if (!_.hasHeader("Content-Type") || _.getHeader("Content-Type").toLowerCase() !== "application/sdp") {
1371
+ l.call(this);
1372
+ return;
1373
+ }
1374
+ } else {
1375
+ l.call(this);
1376
+ return;
1377
+ }
1378
+ var f = {
1379
+ originator: "remote",
1380
+ type: "answer",
1381
+ sdp: _.body
1382
+ };
1383
+ s.debug('emit "sdp"'), this.emit("sdp", f);
1384
+ var v = new RTCSessionDescription({
1385
+ type: "answer",
1386
+ sdp: f.sdp
1387
+ });
1388
+ this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1389
+ return h._connection.setRemoteDescription(v);
1390
+ }).then(function() {
1391
+ n.succeeded && n.succeeded(_);
1392
+ }).catch(function(E) {
1393
+ l.call(h), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', E), h.emit("peerconnection:setremotedescriptionfailed", E);
1394
+ });
1395
+ }
1396
+ }
1397
+ function l(_) {
1398
+ n.failed && n.failed(_);
1399
+ }
1400
+ }
1401
+ /**
1402
+ * Send UPDATE
1403
+ */
1404
+ }, {
1405
+ key: "_sendUpdate",
1406
+ value: function() {
1407
+ var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1408
+ s.debug("sendUpdate()");
1409
+ var i = g.cloneArray(t.extraHeaders), n = g.cloneObject(t.eventHandlers), o = t.rtcOfferConstraints || this._rtcOfferConstraints || null, r = t.sdpOffer || !1, u = !1;
1410
+ i.push("Contact: ".concat(this._contact)), this._sessionTimers.running && i.push("Session-Expires: ".concat(this._sessionTimers.currentExpires, ";refresher=").concat(this._sessionTimers.refresher ? "uac" : "uas")), r ? (i.push("Content-Type: application/sdp"), this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1411
+ return e._createLocalDescription("offer", o);
1412
+ }).then(function(h) {
1413
+ h = e._mangleOffer(h);
1414
+ var f = {
1415
+ originator: "local",
1416
+ type: "offer",
1417
+ sdp: h
1418
+ };
1419
+ s.debug('emit "sdp"'), e.emit("sdp", f), e.sendRequest(d.UPDATE, {
1420
+ extraHeaders: i,
1421
+ body: h,
1422
+ eventHandlers: {
1423
+ onSuccessResponse: function(E) {
1424
+ l.call(e, E), u = !0;
1425
+ },
1426
+ onErrorResponse: function(E) {
1427
+ _.call(e, E);
1428
+ },
1429
+ onTransportError: function() {
1430
+ e.onTransportError();
1431
+ },
1432
+ onRequestTimeout: function() {
1433
+ e.onRequestTimeout();
1434
+ },
1435
+ onDialogError: function() {
1436
+ e.onDialogError();
1437
+ }
1438
+ }
1439
+ });
1440
+ }).catch(function() {
1441
+ _.call(e);
1442
+ })) : this.sendRequest(d.UPDATE, {
1443
+ extraHeaders: i,
1444
+ eventHandlers: {
1445
+ onSuccessResponse: function(f) {
1446
+ l.call(e, f);
1447
+ },
1448
+ onErrorResponse: function(f) {
1449
+ _.call(e, f);
1450
+ },
1451
+ onTransportError: function() {
1452
+ e.onTransportError();
1453
+ },
1454
+ onRequestTimeout: function() {
1455
+ e.onRequestTimeout();
1456
+ },
1457
+ onDialogError: function() {
1458
+ e.onDialogError();
1459
+ }
1460
+ }
1461
+ });
1462
+ function l(h) {
1463
+ var f = this;
1464
+ if (this._status !== a.STATUS_TERMINATED && !u)
1465
+ if (this._handleSessionTimersInIncomingResponse(h), r) {
1466
+ if (h.body) {
1467
+ if (!h.hasHeader("Content-Type") || h.getHeader("Content-Type").toLowerCase() !== "application/sdp") {
1468
+ _.call(this);
1469
+ return;
1470
+ }
1471
+ } else {
1472
+ _.call(this);
1473
+ return;
1474
+ }
1475
+ var v = {
1476
+ originator: "remote",
1477
+ type: "answer",
1478
+ sdp: h.body
1479
+ };
1480
+ s.debug('emit "sdp"'), this.emit("sdp", v);
1481
+ var E = new RTCSessionDescription({
1482
+ type: "answer",
1483
+ sdp: v.sdp
1484
+ });
1485
+ this._connectionPromiseQueue = this._connectionPromiseQueue.then(function() {
1486
+ return f._connection.setRemoteDescription(E);
1487
+ }).then(function() {
1488
+ n.succeeded && n.succeeded(h);
1489
+ }).catch(function(R) {
1490
+ _.call(f), s.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]', R), f.emit("peerconnection:setremotedescriptionfailed", R);
1491
+ });
1492
+ } else n.succeeded && n.succeeded(h);
1493
+ }
1494
+ function _(h) {
1495
+ n.failed && n.failed(h);
1496
+ }
1497
+ }
1498
+ }, {
1499
+ key: "_acceptAndTerminate",
1500
+ value: function(e, t, i) {
1501
+ s.debug("acceptAndTerminate()");
1502
+ var n = [];
1503
+ t && (i = i || d.REASON_PHRASE[t] || "", n.push("Reason: SIP ;cause=".concat(t, '; text="').concat(i, '"'))), (this._dialog || this._createDialog(e, "UAC")) && (this.sendRequest(d.ACK), this.sendRequest(d.BYE, {
1504
+ extraHeaders: n
1505
+ })), this._status = a.STATUS_TERMINATED;
1506
+ }
1507
+ /**
1508
+ * Correctly set the SDP direction attributes if the call is on local hold
1509
+ */
1510
+ }, {
1511
+ key: "_mangleOffer",
1512
+ value: function(e) {
1513
+ if (!this._localHold && !this._remoteHold)
1514
+ return e;
1515
+ if (e = j.parse(e), this._localHold && !this._remoteHold) {
1516
+ s.debug("mangleOffer() | me on hold, mangling offer");
1517
+ var t = A(e.media), i;
1518
+ try {
1519
+ for (t.s(); !(i = t.n()).done; ) {
1520
+ var n = i.value;
1521
+ O.indexOf(n.type) !== -1 && (n.direction ? n.direction === "sendrecv" ? n.direction = "sendonly" : n.direction === "recvonly" && (n.direction = "inactive") : n.direction = "sendonly");
1522
+ }
1523
+ } catch (f) {
1524
+ t.e(f);
1525
+ } finally {
1526
+ t.f();
1527
+ }
1528
+ } else if (this._localHold && this._remoteHold) {
1529
+ s.debug("mangleOffer() | both on hold, mangling offer");
1530
+ var o = A(e.media), r;
1531
+ try {
1532
+ for (o.s(); !(r = o.n()).done; ) {
1533
+ var u = r.value;
1534
+ O.indexOf(u.type) !== -1 && (u.direction = "inactive");
1535
+ }
1536
+ } catch (f) {
1537
+ o.e(f);
1538
+ } finally {
1539
+ o.f();
1540
+ }
1541
+ } else if (this._remoteHold) {
1542
+ s.debug("mangleOffer() | remote on hold, mangling offer");
1543
+ var l = A(e.media), _;
1544
+ try {
1545
+ for (l.s(); !(_ = l.n()).done; ) {
1546
+ var h = _.value;
1547
+ O.indexOf(h.type) !== -1 && (h.direction ? h.direction === "sendrecv" ? h.direction = "recvonly" : h.direction === "recvonly" && (h.direction = "inactive") : h.direction = "recvonly");
1548
+ }
1549
+ } catch (f) {
1550
+ l.e(f);
1551
+ } finally {
1552
+ l.f();
1553
+ }
1554
+ }
1555
+ return j.write(e);
1556
+ }
1557
+ }, {
1558
+ key: "_setLocalMediaStatus",
1559
+ value: function() {
1560
+ var e = !0, t = !0;
1561
+ (this._localHold || this._remoteHold) && (e = !1, t = !1), this._audioMuted && (e = !1), this._videoMuted && (t = !1), this._toggleMuteAudio(!e), this._toggleMuteVideo(!t);
1562
+ }
1563
+ /**
1564
+ * Handle SessionTimers for an incoming INVITE or UPDATE.
1565
+ * @param {IncomingRequest} request
1566
+ * @param {Array} responseExtraHeaders Extra headers for the 200 response.
1567
+ */
1568
+ }, {
1569
+ key: "_handleSessionTimersInIncomingRequest",
1570
+ value: function(e, t) {
1571
+ if (this._sessionTimers.enabled) {
1572
+ var i;
1573
+ e.session_expires && e.session_expires >= d.MIN_SESSION_EXPIRES ? (this._sessionTimers.currentExpires = e.session_expires, i = e.session_expires_refresher || "uas") : (this._sessionTimers.currentExpires = this._sessionTimers.defaultExpires, i = "uas"), t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires, ";refresher=").concat(i)), this._sessionTimers.refresher = i === "uas", this._runSessionTimer();
1574
+ }
1575
+ }
1576
+ /**
1577
+ * Handle SessionTimers for an incoming response to INVITE or UPDATE.
1578
+ * @param {IncomingResponse} response
1579
+ */
1580
+ }, {
1581
+ key: "_handleSessionTimersInIncomingResponse",
1582
+ value: function(e) {
1583
+ if (this._sessionTimers.enabled) {
1584
+ var t;
1585
+ e.session_expires && e.session_expires >= d.MIN_SESSION_EXPIRES ? (this._sessionTimers.currentExpires = e.session_expires, t = e.session_expires_refresher || "uac") : (this._sessionTimers.currentExpires = this._sessionTimers.defaultExpires, t = "uac"), this._sessionTimers.refresher = t === "uac", this._runSessionTimer();
1586
+ }
1587
+ }
1588
+ }, {
1589
+ key: "_runSessionTimer",
1590
+ value: function() {
1591
+ var e = this, t = this._sessionTimers.currentExpires;
1592
+ this._sessionTimers.running = !0, clearTimeout(this._sessionTimers.timer), this._sessionTimers.refresher ? this._sessionTimers.timer = setTimeout(function() {
1593
+ e._status !== a.STATUS_TERMINATED && e._isReadyToReOffer() && (s.debug("runSessionTimer() | sending session refresh request"), e._sessionTimers.refreshMethod === d.UPDATE ? e._sendUpdate() : e._sendReinvite());
1594
+ }, t * 500) : this._sessionTimers.timer = setTimeout(function() {
1595
+ e._status !== a.STATUS_TERMINATED && (s.warn("runSessionTimer() | timer expired, terminating the session"), e.terminate({
1596
+ cause: d.causes.REQUEST_TIMEOUT,
1597
+ status_code: 408,
1598
+ reason_phrase: "Session Timer Expired"
1599
+ }));
1600
+ }, t * 1100);
1601
+ }
1602
+ }, {
1603
+ key: "_toggleMuteAudio",
1604
+ value: function(e) {
1605
+ var t = this._connection.getSenders().filter(function(r) {
1606
+ return r.track && r.track.kind === "audio";
1607
+ }), i = A(t), n;
1608
+ try {
1609
+ for (i.s(); !(n = i.n()).done; ) {
1610
+ var o = n.value;
1611
+ o.track.enabled = !e;
1612
+ }
1613
+ } catch (r) {
1614
+ i.e(r);
1615
+ } finally {
1616
+ i.f();
1617
+ }
1618
+ }
1619
+ }, {
1620
+ key: "_toggleMuteVideo",
1621
+ value: function(e) {
1622
+ var t = this._connection.getSenders().filter(function(r) {
1623
+ return r.track && r.track.kind === "video";
1624
+ }), i = A(t), n;
1625
+ try {
1626
+ for (i.s(); !(n = i.n()).done; ) {
1627
+ var o = n.value;
1628
+ o.track.enabled = !e;
1629
+ }
1630
+ } catch (r) {
1631
+ i.e(r);
1632
+ } finally {
1633
+ i.f();
1634
+ }
1635
+ }
1636
+ }, {
1637
+ key: "_newRTCSession",
1638
+ value: function(e, t) {
1639
+ s.debug("newRTCSession()"), this._ua.newRTCSession(this, {
1640
+ originator: e,
1641
+ session: this,
1642
+ request: t
1643
+ });
1644
+ }
1645
+ }, {
1646
+ key: "_connecting",
1647
+ value: function(e) {
1648
+ s.debug("session connecting"), s.debug('emit "connecting"'), this.emit("connecting", {
1649
+ request: e
1650
+ });
1651
+ }
1652
+ }, {
1653
+ key: "_progress",
1654
+ value: function(e, t) {
1655
+ s.debug("session progress"), s.debug('emit "progress"'), this.emit("progress", {
1656
+ originator: e,
1657
+ response: t || null
1658
+ });
1659
+ }
1660
+ }, {
1661
+ key: "_accepted",
1662
+ value: function(e, t) {
1663
+ s.debug("session accepted"), this._start_time = /* @__PURE__ */ new Date(), s.debug('emit "accepted"'), this.emit("accepted", {
1664
+ originator: e,
1665
+ response: t || null
1666
+ });
1667
+ }
1668
+ }, {
1669
+ key: "_confirmed",
1670
+ value: function(e, t) {
1671
+ s.debug("session confirmed"), this._is_confirmed = !0, s.debug('emit "confirmed"'), this.emit("confirmed", {
1672
+ originator: e,
1673
+ ack: t || null
1674
+ });
1675
+ }
1676
+ }, {
1677
+ key: "_ended",
1678
+ value: function(e, t, i) {
1679
+ s.debug("session ended"), this._end_time = /* @__PURE__ */ new Date(), this._close(), s.debug('emit "ended"'), this.emit("ended", {
1680
+ originator: e,
1681
+ message: t || null,
1682
+ cause: i
1683
+ });
1684
+ }
1685
+ }, {
1686
+ key: "_failed",
1687
+ value: function(e, t, i) {
1688
+ s.debug("session failed"), s.debug('emit "_failed"'), this.emit("_failed", {
1689
+ originator: e,
1690
+ message: t || null,
1691
+ cause: i
1692
+ }), this._close(), s.debug('emit "failed"'), this.emit("failed", {
1693
+ originator: e,
1694
+ message: t || null,
1695
+ cause: i
1696
+ });
1697
+ }
1698
+ }, {
1699
+ key: "_onhold",
1700
+ value: function(e) {
1701
+ s.debug("session onhold"), this._setLocalMediaStatus(), s.debug('emit "hold"'), this.emit("hold", {
1702
+ originator: e
1703
+ });
1704
+ }
1705
+ }, {
1706
+ key: "_onunhold",
1707
+ value: function(e) {
1708
+ s.debug("session onunhold"), this._setLocalMediaStatus(), s.debug('emit "unhold"'), this.emit("unhold", {
1709
+ originator: e
1710
+ });
1711
+ }
1712
+ }, {
1713
+ key: "_onmute",
1714
+ value: function(e) {
1715
+ var t = e.audio, i = e.video;
1716
+ s.debug("session onmute"), this._setLocalMediaStatus(), s.debug('emit "muted"'), this.emit("muted", {
1717
+ audio: t,
1718
+ video: i
1719
+ });
1720
+ }
1721
+ }, {
1722
+ key: "_onunmute",
1723
+ value: function(e) {
1724
+ var t = e.audio, i = e.video;
1725
+ s.debug("session onunmute"), this._setLocalMediaStatus(), s.debug('emit "unmuted"'), this.emit("unmuted", {
1726
+ audio: t,
1727
+ video: i
1728
+ });
1729
+ }
1730
+ }, {
1731
+ key: "C",
1732
+ get: function() {
1733
+ return a;
1734
+ }
1735
+ // Expose session failed/ended causes as a property of the RTCSession instance.
1736
+ }, {
1737
+ key: "causes",
1738
+ get: function() {
1739
+ return d.causes;
1740
+ }
1741
+ }, {
1742
+ key: "id",
1743
+ get: function() {
1744
+ return this._id;
1745
+ }
1746
+ }, {
1747
+ key: "connection",
1748
+ get: function() {
1749
+ return this._connection;
1750
+ }
1751
+ }, {
1752
+ key: "contact",
1753
+ get: function() {
1754
+ return this._contact;
1755
+ }
1756
+ }, {
1757
+ key: "direction",
1758
+ get: function() {
1759
+ return this._direction;
1760
+ }
1761
+ }, {
1762
+ key: "local_identity",
1763
+ get: function() {
1764
+ return this._local_identity;
1765
+ }
1766
+ }, {
1767
+ key: "remote_identity",
1768
+ get: function() {
1769
+ return this._remote_identity;
1770
+ }
1771
+ }, {
1772
+ key: "start_time",
1773
+ get: function() {
1774
+ return this._start_time;
1775
+ }
1776
+ }, {
1777
+ key: "end_time",
1778
+ get: function() {
1779
+ return this._end_time;
1780
+ }
1781
+ }, {
1782
+ key: "data",
1783
+ get: function() {
1784
+ return this._data;
1785
+ },
1786
+ set: function(e) {
1787
+ this._data = e;
1788
+ }
1789
+ }, {
1790
+ key: "status",
1791
+ get: function() {
1792
+ return this._status;
1793
+ }
1794
+ }]), m;
1795
+ }(se), F;
1796
+ }
1797
+ export {
1798
+ Xe as __require
1799
+ };