sip-connector 19.2.2 → 19.4.0

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/index.js CHANGED
@@ -1,169 +1,169 @@
1
1
  import "events-constructor";
2
- import { E as p, l as o, p as j, s as K, a as X, r as Y, h as G } from "./@SipConnector-D6QDb2P8.js";
3
- import { f as xe, b as Le, S as Ve, g as Be, d as $e, e as He, i as We, c as je } from "./@SipConnector-D6QDb2P8.js";
2
+ import { E as C, l as r, p as j, s as K, a as X, h as Y } from "./@SipConnector-DIeMny8m.js";
3
+ import { f as ke, b as xe, S as Le, g as Ve, d as Be, e as $e, i as He, c as We } from "./@SipConnector-DIeMny8m.js";
4
4
  import { isCanceledError as V } from "@krivega/cancelable-promise";
5
- import { hasCanceledError as q } from "repeated-calls";
6
- import { debounce as z } from "ts-debounce";
7
- import { UAParser as J } from "ua-parser-js";
8
- import { sequentPromises as Q } from "sequent-promises";
9
- import { isPromiseIsNotActualError as Xe } from "stack-promises";
10
- const Z = (n) => n instanceof Object && ("originator" in n || "cause" in n), De = (n) => {
5
+ import { hasCanceledError as G } from "repeated-calls";
6
+ import { debounce as q } from "ts-debounce";
7
+ import { UAParser as z } from "ua-parser-js";
8
+ import { sequentPromises as J } from "sequent-promises";
9
+ import { isPromiseIsNotActualError as Ke } from "stack-promises";
10
+ const Q = (n) => n instanceof Object && ("originator" in n || "cause" in n), Ae = (n) => {
11
11
  if (V(n))
12
12
  return !0;
13
- if (!Z(n))
13
+ if (!Q(n))
14
14
  return !1;
15
15
  const { originator: e, cause: t } = n;
16
- return typeof t == "string" ? t === p.REQUEST_TIMEOUT || t === p.REJECTED || e === "local" && (t === p.CANCELED || t === p.BYE) : !1;
17
- }, ee = () => globalThis.process?.versions?.electron !== void 0, B = () => {
18
- const n = new J(), { name: e } = n.getBrowser(), t = ee();
16
+ return typeof t == "string" ? t === C.REQUEST_TIMEOUT || t === C.REJECTED || e === "local" && (t === C.CANCELED || t === C.BYE) : !1;
17
+ }, Z = () => globalThis.process?.versions?.electron !== void 0, B = () => {
18
+ const n = new z(), { name: e } = n.getBrowser(), t = Z();
19
19
  return {
20
20
  isChrome: e === "Chrome" || t
21
21
  };
22
22
  }, D = (n) => {
23
23
  const { url: e, cause: t } = n;
24
- let r = e;
25
- return (t === p.BAD_MEDIA_DESCRIPTION || t === p.NOT_FOUND) && (r = `${n.message.to.uri.user}@${n.message.to.uri.host}`), r;
24
+ let o = e;
25
+ return (t === C.BAD_MEDIA_DESCRIPTION || t === C.NOT_FOUND) && (o = `${n.message.to.uri.user}@${n.message.to.uri.host}`), o;
26
26
  };
27
27
  var $ = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))($ || {});
28
- const ne = new Error("Unknown error"), te = (n = ne) => {
28
+ const ee = new Error("Unknown error"), ne = (n = ee) => {
29
29
  const { cause: e, socket: t } = n;
30
- let r = "CONNECT_SERVER_FAILED";
30
+ let o = "CONNECT_SERVER_FAILED";
31
31
  switch (e) {
32
32
  case "Forbidden": {
33
- r = "WRONG_USER_OR_PASSWORD";
33
+ o = "WRONG_USER_OR_PASSWORD";
34
34
  break;
35
35
  }
36
- case p.BAD_MEDIA_DESCRIPTION: {
37
- r = "BAD_MEDIA_ERROR";
36
+ case C.BAD_MEDIA_DESCRIPTION: {
37
+ o = "BAD_MEDIA_ERROR";
38
38
  break;
39
39
  }
40
- case p.NOT_FOUND: {
41
- r = "NOT_FOUND_ERROR";
40
+ case C.NOT_FOUND: {
41
+ o = "NOT_FOUND_ERROR";
42
42
  break;
43
43
  }
44
44
  default:
45
- t !== void 0 && t._ws?.readyState === 3 ? r = "WS_CONNECTION_FAILED" : D(n) !== void 0 && D(n) !== "" && (r = "CONNECT_SERVER_FAILED_BY_LINK");
45
+ t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : D(n) !== void 0 && D(n) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
46
46
  }
47
- return r;
48
- }, oe = (n) => {
47
+ return o;
48
+ }, te = (n) => {
49
49
  let e = "";
50
50
  try {
51
51
  e = JSON.stringify(n);
52
52
  } catch (t) {
53
- o("failed to stringify message", t);
53
+ r("failed to stringify message", t);
54
54
  }
55
55
  return e;
56
- }, re = new Error("Unknown error"), se = (n = re) => {
57
- const { code: e, cause: t, message: r } = n, s = D(n), a = { code: "", cause: "", message: "" };
58
- return typeof r == "object" && r !== null ? a.message = oe(r) : r && (a.message = String(r)), s !== void 0 && s !== "" && (a.link = s), e !== void 0 && e !== "" && (a.code = e), t !== void 0 && t !== "" && (a.cause = t), a;
59
- }, ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ }, oe = new Error("Unknown error"), re = (n = oe) => {
57
+ const { code: e, cause: t, message: o } = n, a = D(n), s = { code: "", cause: "", message: "" };
58
+ return typeof o == "object" && o !== null ? s.message = te(o) : o && (s.message = String(o)), a !== void 0 && a !== "" && (s.link = a), e !== void 0 && e !== "" && (s.code = e), t !== void 0 && t !== "" && (s.cause = t), s;
59
+ }, se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
60
60
  __proto__: null,
61
61
  EErrorTypes: $,
62
62
  getLinkError: D,
63
- getTypeFromError: te,
64
- getValuesFromError: se
65
- }, Symbol.toStringTag, { value: "Module" })), ce = ({
63
+ getTypeFromError: ne,
64
+ getValuesFromError: re
65
+ }, Symbol.toStringTag, { value: "Module" })), ae = ({
66
66
  sessionId: n,
67
67
  remoteAddress: e,
68
68
  isMutedAudio: t,
69
- isMutedVideo: r,
70
- isRegistered: s,
71
- isPresentationCall: a
69
+ isMutedVideo: o,
70
+ isRegistered: a,
71
+ isPresentationCall: s
72
72
  }) => {
73
- const c = [], u = t ? "0" : "1", l = r ? "0" : "1";
74
- return c.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${l}`), (s === !1 || s === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Session: ${n}`), a === !0 && c.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Remote: ${e}`), c;
75
- }, ie = "[@*!|]", ue = "_", le = (n) => {
73
+ const c = [], u = t ? "0" : "1", d = o ? "0" : "1";
74
+ return c.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${d}`), (a === !1 || a === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Session: ${n}`), s === !0 && c.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Remote: ${e}`), c;
75
+ }, ce = "[@*!|]", ie = "_", ue = (n) => {
76
76
  let e = n;
77
- return e = e.replaceAll(new RegExp(ie, "g"), ue), e;
78
- }, de = ({
77
+ return e = e.replaceAll(new RegExp(ce, "g"), ie), e;
78
+ }, le = ({
79
79
  appName: n,
80
80
  appVersion: e,
81
81
  browserName: t,
82
- browserVersion: r
82
+ browserVersion: o
83
83
  }) => {
84
- const a = `${le(n)} ${e}`;
85
- return `ChromeNew - ${t === void 0 ? a : `${t} ${r}, ${a}`}`;
86
- }, me = ({
84
+ const s = `${ue(n)} ${e}`;
85
+ return `ChromeNew - ${t === void 0 ? s : `${t} ${o}, ${s}`}`;
86
+ }, de = ({
87
87
  isUnifiedSdpSemantic: n,
88
88
  appVersion: e,
89
89
  browserName: t,
90
- browserVersion: r,
91
- appName: s
92
- }) => n ? de({ appVersion: e, browserName: t, browserVersion: r, appName: s }) : "Chrome", H = "purgatory", F = (n) => n === H, Se = (n) => (e) => [...e].map((r) => async () => n(r)), fe = async ({
90
+ browserVersion: o,
91
+ appName: a
92
+ }) => n ? le({ appVersion: e, browserName: t, browserVersion: o, appName: a }) : "Chrome", H = "purgatory", F = (n) => n === H, me = (n) => (e) => [...e].map((o) => async () => n(o)), Se = async ({
93
93
  accumulatedKeys: n,
94
94
  sendKey: e,
95
95
  canRunTask: t
96
96
  }) => {
97
- const s = Se(e)(n);
98
- return Q(s, t);
99
- }, Ce = (n) => (t) => (o("onStartMainCam"), n.on("api:admin-start-main-cam", t)), pe = (n) => (t) => (o("onStartMic"), n.on("api:admin-start-mic", t)), he = (n) => (t) => (o("onStopMainCam"), n.on("api:admin-stop-main-cam", t)), Re = (n) => (t) => (o("onStopMic"), n.on("api:admin-stop-mic", t)), ge = ({ sipConnector: n }) => {
100
- const e = (d, S) => ({ isSyncForced: m }) => {
97
+ const a = me(e)(n);
98
+ return J(a, t);
99
+ }, fe = (n) => (t) => (r("onStartMainCam"), n.on("api:admin-start-main-cam", t)), Ce = (n) => (t) => (r("onStartMic"), n.on("api:admin-start-mic", t)), pe = (n) => (t) => (r("onStopMainCam"), n.on("api:admin-stop-main-cam", t)), he = (n) => (t) => (r("onStopMic"), n.on("api:admin-stop-mic", t)), Re = ({ sipConnector: n }) => {
100
+ const e = (l, S) => ({ isSyncForced: m }) => {
101
101
  if (m === !0) {
102
- d();
102
+ l();
103
103
  return;
104
104
  }
105
105
  S();
106
- }, t = Ce(n), r = he(n), s = pe(n), a = Re(n);
107
- let c, u, l, C;
108
- const h = ({
109
- onStartMainCamForced: d,
106
+ }, t = fe(n), o = pe(n), a = Ce(n), s = he(n);
107
+ let c, u, d, R;
108
+ const T = ({
109
+ onStartMainCamForced: l,
110
110
  onStartMainCamNotForced: S,
111
111
  onStopMainCamForced: m,
112
- onStopMainCamNotForced: g,
113
- onStartMicForced: v,
114
- onStartMicNotForced: y,
115
- onStopMicForced: P,
116
- onStopMicNotForced: T
112
+ onStopMainCamNotForced: p,
113
+ onStartMicForced: E,
114
+ onStartMicNotForced: g,
115
+ onStopMicForced: O,
116
+ onStopMicNotForced: b
117
117
  }) => {
118
- const _ = e(
119
- d,
118
+ const v = e(
119
+ l,
120
120
  S
121
121
  );
122
- c = t(_);
123
- const M = e(
122
+ c = t(v);
123
+ const P = e(
124
124
  m,
125
- g
125
+ p
126
126
  );
127
- u = r(M);
128
- const N = e(v, y);
129
- l = s(N);
130
- const f = e(P, T);
131
- C = a(f);
132
- }, R = () => {
133
- c?.(), u?.(), l?.(), C?.();
127
+ u = o(P);
128
+ const M = e(E, g);
129
+ d = a(M);
130
+ const f = e(O, b);
131
+ R = s(f);
132
+ }, y = () => {
133
+ c?.(), u?.(), d?.(), R?.();
134
134
  };
135
135
  return {
136
- start: (d) => {
137
- h(d);
136
+ start: (l) => {
137
+ T(l);
138
138
  },
139
139
  stop: () => {
140
- R();
140
+ y();
141
141
  }
142
142
  };
143
- }, Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
143
+ }, De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
144
144
  __proto__: null,
145
145
  PURGATORY_CONFERENCE_NUMBER: H,
146
- createSyncMediaState: ge,
146
+ createSyncMediaState: Re,
147
147
  createUaParser: B,
148
- error: ae,
149
- getExtraHeaders: ce,
150
- getUserAgent: me,
148
+ error: se,
149
+ getExtraHeaders: ae,
150
+ getUserAgent: de,
151
151
  hasPurgatory: F,
152
152
  prepareMediaStream: j,
153
- sendDtmfAccumulated: fe,
153
+ sendDtmfAccumulated: Se,
154
154
  setEncodingsToSender: K,
155
155
  setParametersToSender: X
156
- }, Symbol.toStringTag, { value: "Module" })), we = () => B().isChrome, Ee = (n) => {
157
- if (!V(n) && !q(n) && !G(n))
156
+ }, Symbol.toStringTag, { value: "Module" })), Fe = () => B().isChrome, Ee = (n) => {
157
+ if (!V(n) && !G(n) && !Y(n))
158
158
  throw n;
159
- return { isSuccessful: !1 };
160
- }, be = ({ kind: n, readyState: e }) => n === "video" && e === "live", k = (n, e, { onEnterPurgatory: t, onEnterConference: r }) => {
161
- F(n) ? t && t() : r && r({ isSuccessProgressCall: e });
159
+ return { configuration: void 0, isSuccessful: !1 };
160
+ }, ge = ({ kind: n, readyState: e }) => n === "video" && e === "live", k = (n, e, { onEnterPurgatory: t, onEnterConference: o }) => {
161
+ F(n) ? t && t() : o && o({ isSuccessProgressCall: e });
162
162
  }, x = (n, e) => {
163
163
  n(), e && e();
164
164
  }, L = (n, e, t) => {
165
165
  throw n && n(), e(), t;
166
- }, ve = /* @__PURE__ */ new Set([
166
+ }, be = /* @__PURE__ */ new Set([
167
167
  "on",
168
168
  "once",
169
169
  "onceRace",
@@ -182,7 +182,7 @@ const ne = new Error("Unknown error"), te = (n = ne) => {
182
182
  "isConfigured",
183
183
  "isRegistered"
184
184
  ]);
185
- class Ie {
185
+ class we {
186
186
  // @ts-expect-error: proxy method
187
187
  on;
188
188
  // @ts-expect-error: proxy method
@@ -220,273 +220,247 @@ class Ie {
220
220
  sipConnector;
221
221
  constructor(e) {
222
222
  return this.sipConnector = e, new Proxy(this, {
223
- get: (t, r, s) => {
224
- if (typeof r == "string" && ve.has(r) && r in this.sipConnector) {
225
- const c = Reflect.get(this.sipConnector, r, this.sipConnector);
223
+ get: (t, o, a) => {
224
+ if (typeof o == "string" && be.has(o) && o in this.sipConnector) {
225
+ const c = Reflect.get(this.sipConnector, o, this.sipConnector);
226
226
  return typeof c == "function" ? c.bind(this.sipConnector) : c;
227
227
  }
228
- const a = Reflect.get(t, r, s);
229
- return typeof a == "function" ? a.bind(t) : a;
228
+ const s = Reflect.get(t, o, a);
229
+ return typeof s == "function" ? s.bind(t) : s;
230
230
  }
231
231
  });
232
232
  }
233
- connectToServer = async (e, t) => {
234
- const r = async () => {
235
- const s = await Y(e);
236
- o("connectToServer", s);
237
- const {
238
- userAgent: a,
239
- sipWebSocketServerURL: c,
240
- sipServerUrl: u,
241
- remoteAddress: l,
242
- displayName: C,
243
- name: h,
244
- password: R,
245
- isRegisteredUser: b
246
- } = s;
247
- return {
248
- userAgent: a,
249
- sipWebSocketServerURL: c,
250
- sipServerUrl: u,
251
- remoteAddress: l,
252
- displayName: C,
253
- password: R,
254
- user: h,
255
- register: b
256
- };
257
- };
258
- return this.sipConnector.connect(r, t).then((s) => (o("connectToServer then"), { ua: s, isSuccessful: !0 })).catch(async (s) => (o("connectToServer catch: error", s), Ee(s)));
259
- };
233
+ connectToServer = async (e, t) => this.sipConnector.connect(e, t).then((o) => (r("connectToServer then"), { configuration: o, isSuccessful: !0 })).catch(async (o) => (r("connectToServer catch: error", o), Ee(o)));
260
234
  callToServer = async (e) => {
261
235
  const {
262
236
  conference: t,
263
- mediaStream: r,
264
- extraHeaders: s,
265
- iceServers: a,
237
+ mediaStream: o,
238
+ extraHeaders: a,
239
+ iceServers: s,
266
240
  contentHint: c,
267
241
  degradationPreference: u,
268
- sendEncodings: l,
269
- offerToReceiveAudio: C,
270
- offerToReceiveVideo: h,
271
- directionVideo: R,
272
- directionAudio: b,
273
- setRemoteStreams: O,
274
- onBeforeProgressCall: d,
242
+ sendEncodings: d,
243
+ offerToReceiveAudio: R,
244
+ offerToReceiveVideo: T,
245
+ directionVideo: y,
246
+ directionAudio: A,
247
+ setRemoteStreams: _,
248
+ onBeforeProgressCall: l,
275
249
  onSuccessProgressCall: S,
276
250
  onEnterPurgatory: m,
277
- onEnterConference: g,
278
- onFailProgressCall: v,
279
- onFinishProgressCall: y,
280
- onEndedCall: P,
281
- onAddedTransceiver: T
282
- } = e, _ = this.resolveHandleReadyRemoteStreamsDebounced({
283
- onReadyRemoteStreams: O
284
- }), M = this.resolveHandleReadyRemoteStreams({
251
+ onEnterConference: p,
252
+ onFailProgressCall: E,
253
+ onFinishProgressCall: g,
254
+ onEndedCall: O,
255
+ onAddedTransceiver: b
256
+ } = e, v = this.resolveHandleReadyRemoteStreamsDebounced({
257
+ onReadyRemoteStreams: _
258
+ }), P = this.resolveHandleReadyRemoteStreams({
285
259
  onReadyRemoteStreams: () => {
286
- _().catch(o);
260
+ v().catch(r);
287
261
  }
288
262
  });
289
- o("callToServer", e);
290
- const N = async () => (o("startCall"), this.sipConnector.call({
291
- mediaStream: r,
292
- extraHeaders: s,
293
- iceServers: a,
263
+ r("callToServer", e);
264
+ const M = async () => (r("startCall"), this.sipConnector.call({
265
+ mediaStream: o,
266
+ extraHeaders: a,
267
+ iceServers: s,
294
268
  contentHint: c,
295
- offerToReceiveAudio: C,
296
- offerToReceiveVideo: h,
297
- directionVideo: R,
298
- directionAudio: b,
269
+ offerToReceiveAudio: R,
270
+ offerToReceiveVideo: T,
271
+ directionVideo: y,
272
+ directionAudio: A,
299
273
  degradationPreference: u,
300
- onAddedTransceiver: T,
301
- sendEncodings: l,
274
+ onAddedTransceiver: b,
275
+ sendEncodings: d,
302
276
  number: t,
303
- ontrack: M
277
+ ontrack: P
304
278
  }));
305
- let f = !1, E;
306
- const A = (o("subscribeEnterConference: onEnterConference", g), this.sipConnector.on("api:enterRoom", ({ room: i }) => {
307
- o("enterRoom", { _room: i, isSuccessProgressCall: f }), E = i, (m ?? g) && k(E, f, {
279
+ let f = !1, h;
280
+ const N = (r("subscribeEnterConference: onEnterConference", p), this.sipConnector.on("api:enterRoom", ({ room: i }) => {
281
+ r("enterRoom", { _room: i, isSuccessProgressCall: f }), h = i, (m ?? p) && k(h, f, {
308
282
  onEnterPurgatory: m,
309
- onEnterConference: g
283
+ onEnterConference: p
310
284
  });
311
- })), w = (i) => (o("onSuccess"), f = !0, _().catch(o), S && S({ isPurgatory: F(E) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
312
- x(A, P);
313
- }), i), I = (i) => (o("onFail"), L(v, A, i)), U = () => {
314
- o("onFinish"), y && y();
285
+ })), w = (i) => (r("onSuccess"), f = !0, v().catch(r), S && S({ isPurgatory: F(h) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
286
+ x(N, O);
287
+ }), i), I = (i) => (r("onFail"), L(E, N, i)), U = () => {
288
+ r("onFinish"), g && g();
315
289
  };
316
- return o("onBeforeProgressCall"), d && d(t), N().then(w).catch((i) => I(i)).finally(U);
290
+ return r("onBeforeProgressCall"), l && l(t), M().then(w).catch((i) => I(i)).finally(U);
317
291
  };
318
- disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (o("disconnectFromServer: catch", e), { isSuccessful: !1 }));
292
+ disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (r("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (r("disconnectFromServer: catch", e), { isSuccessful: !1 }));
319
293
  answerToIncomingCall = async (e) => {
320
294
  const {
321
295
  mediaStream: t,
322
- extraHeaders: r,
323
- iceServers: s,
324
- contentHint: a,
296
+ extraHeaders: o,
297
+ iceServers: a,
298
+ contentHint: s,
325
299
  degradationPreference: c,
326
300
  sendEncodings: u,
327
- offerToReceiveAudio: l,
328
- offerToReceiveVideo: C,
329
- directionVideo: h,
330
- directionAudio: R,
331
- setRemoteStreams: b,
332
- onBeforeProgressCall: O,
333
- onSuccessProgressCall: d,
301
+ offerToReceiveAudio: d,
302
+ offerToReceiveVideo: R,
303
+ directionVideo: T,
304
+ directionAudio: y,
305
+ setRemoteStreams: A,
306
+ onBeforeProgressCall: _,
307
+ onSuccessProgressCall: l,
334
308
  onEnterPurgatory: S,
335
309
  onEnterConference: m,
336
- onFailProgressCall: g,
337
- onFinishProgressCall: v,
338
- onEndedCall: y,
339
- onAddedTransceiver: P
340
- } = e, T = this.resolveHandleReadyRemoteStreamsDebounced({
341
- onReadyRemoteStreams: b
342
- }), _ = this.resolveHandleReadyRemoteStreams({
310
+ onFailProgressCall: p,
311
+ onFinishProgressCall: E,
312
+ onEndedCall: g,
313
+ onAddedTransceiver: O
314
+ } = e, b = this.resolveHandleReadyRemoteStreamsDebounced({
315
+ onReadyRemoteStreams: A
316
+ }), v = this.resolveHandleReadyRemoteStreams({
343
317
  onReadyRemoteStreams: () => {
344
- T().catch(o);
318
+ b().catch(r);
345
319
  }
346
320
  });
347
- o("answerToIncomingCall", e);
348
- const M = async () => this.sipConnector.answerToIncomingCall({
321
+ r("answerToIncomingCall", e);
322
+ const P = async () => this.sipConnector.answerToIncomingCall({
349
323
  mediaStream: t,
350
- extraHeaders: r,
351
- iceServers: s,
352
- contentHint: a,
353
- offerToReceiveAudio: l,
354
- offerToReceiveVideo: C,
355
- directionVideo: h,
356
- directionAudio: R,
324
+ extraHeaders: o,
325
+ iceServers: a,
326
+ contentHint: s,
327
+ offerToReceiveAudio: d,
328
+ offerToReceiveVideo: R,
329
+ directionVideo: T,
330
+ directionAudio: y,
357
331
  degradationPreference: c,
358
- onAddedTransceiver: P,
332
+ onAddedTransceiver: O,
359
333
  sendEncodings: u,
360
- ontrack: _
361
- }), N = () => {
334
+ ontrack: v
335
+ }), M = () => {
362
336
  const { remoteCallerData: i } = this.sipConnector;
363
337
  return i.incomingNumber;
364
338
  };
365
- let f = !1, E;
366
- const A = (o("subscribeEnterConference: onEnterConference", m), this.sipConnector.on("api:enterRoom", (i) => {
367
- o("enterRoom", { _room: i, isSuccessProgressCall: f }), E = i, (S ?? m) && k(E, f, {
339
+ let f = !1, h;
340
+ const N = (r("subscribeEnterConference: onEnterConference", m), this.sipConnector.on("api:enterRoom", (i) => {
341
+ r("enterRoom", { _room: i, isSuccessProgressCall: f }), h = i, (S ?? m) && k(h, f, {
368
342
  onEnterPurgatory: S,
369
343
  onEnterConference: m
370
344
  });
371
- })), w = (i) => (o("onSuccess"), f = !0, T().catch(o), d && d({ isPurgatory: F(E) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
372
- x(A, y);
373
- }), i), I = (i) => (o("onFail"), L(g, A, i)), U = () => {
374
- o("onFinish"), v && v();
345
+ })), w = (i) => (r("onSuccess"), f = !0, b().catch(r), l && l({ isPurgatory: F(h) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
346
+ x(N, g);
347
+ }), i), I = (i) => (r("onFail"), L(p, N, i)), U = () => {
348
+ r("onFinish"), E && E();
375
349
  };
376
- if (o("onBeforeProgressCall"), O) {
377
- const i = N();
378
- O(i);
350
+ if (r("onBeforeProgressCall"), _) {
351
+ const i = M();
352
+ _(i);
379
353
  }
380
- return M().then(w).catch((i) => I(i)).finally(U);
354
+ return P().then(w).catch((i) => I(i)).finally(U);
381
355
  };
382
356
  updatePresentation = async ({
383
357
  mediaStream: e,
384
358
  isP2P: t,
385
- contentHint: r,
386
- degradationPreference: s,
387
- sendEncodings: a,
359
+ contentHint: o,
360
+ degradationPreference: a,
361
+ sendEncodings: s,
388
362
  onAddedTransceiver: c
389
- }) => (o("updatePresentation"), this.sipConnector.updatePresentation(e, {
363
+ }) => (r("updatePresentation"), this.sipConnector.updatePresentation(e, {
390
364
  isP2P: t,
391
- contentHint: r,
392
- degradationPreference: s,
365
+ contentHint: o,
366
+ degradationPreference: a,
393
367
  onAddedTransceiver: c,
394
- sendEncodings: a
368
+ sendEncodings: s
395
369
  }));
396
370
  startPresentation = async ({
397
371
  mediaStream: e,
398
372
  isP2P: t,
399
- contentHint: r,
400
- degradationPreference: s,
401
- sendEncodings: a,
373
+ contentHint: o,
374
+ degradationPreference: a,
375
+ sendEncodings: s,
402
376
  callLimit: c,
403
377
  onAddedTransceiver: u
404
- }) => (o("startPresentation"), this.sipConnector.startPresentation(e, {
378
+ }) => (r("startPresentation"), this.sipConnector.startPresentation(e, {
405
379
  isP2P: t,
406
- contentHint: r,
380
+ contentHint: o,
407
381
  callLimit: c,
408
- degradationPreference: s,
382
+ degradationPreference: a,
409
383
  onAddedTransceiver: u,
410
- sendEncodings: a
384
+ sendEncodings: s
411
385
  }));
412
- stopShareSipConnector = async ({ isP2P: e = !1 } = {}) => (o("stopShareSipConnector"), this.sipConnector.stopPresentation({
386
+ stopShareSipConnector = async ({ isP2P: e = !1 } = {}) => (r("stopShareSipConnector"), this.sipConnector.stopPresentation({
413
387
  isP2P: e
414
388
  }).catch((t) => {
415
- o(t);
389
+ r(t);
416
390
  }));
417
391
  sendRefusalToTurnOnMic = async () => {
418
- o("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
419
- o("sendRefusalToTurnOnMic: error", e);
392
+ r("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
393
+ r("sendRefusalToTurnOnMic: error", e);
420
394
  });
421
395
  };
422
396
  sendRefusalToTurnOnCam = async () => {
423
- o("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
424
- o("sendRefusalToTurnOnCam: error", e);
397
+ r("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
398
+ r("sendRefusalToTurnOnCam: error", e);
425
399
  });
426
400
  };
427
401
  sendMediaState = async ({
428
402
  isEnabledCam: e,
429
403
  isEnabledMic: t
430
404
  }) => {
431
- o("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t });
405
+ r("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t });
432
406
  };
433
407
  replaceMediaStream = async (e, {
434
408
  deleteExisting: t,
435
- addMissing: r,
436
- forceRenegotiation: s,
437
- contentHint: a,
409
+ addMissing: o,
410
+ forceRenegotiation: a,
411
+ contentHint: s,
438
412
  degradationPreference: c,
439
413
  sendEncodings: u,
440
- onAddedTransceiver: l
441
- }) => (o("replaceMediaStream"), this.sipConnector.replaceMediaStream(e, {
414
+ onAddedTransceiver: d
415
+ }) => (r("replaceMediaStream"), this.sipConnector.replaceMediaStream(e, {
442
416
  deleteExisting: t,
443
- addMissing: r,
444
- forceRenegotiation: s,
445
- contentHint: a,
417
+ addMissing: o,
418
+ forceRenegotiation: a,
419
+ contentHint: s,
446
420
  degradationPreference: c,
447
- onAddedTransceiver: l,
421
+ onAddedTransceiver: d,
448
422
  sendEncodings: u
449
423
  }));
450
424
  askPermissionToEnableCam = async () => {
451
- o("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
425
+ r("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
452
426
  };
453
427
  resolveHandleReadyRemoteStreamsDebounced = ({
454
428
  onReadyRemoteStreams: e
455
- }) => z(() => {
429
+ }) => q(() => {
456
430
  const t = this.sipConnector.getRemoteStreams();
457
- o("remoteStreams", t), t && e(t);
431
+ r("remoteStreams", t), t && e(t);
458
432
  }, 200);
459
433
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
460
434
  resolveHandleReadyRemoteStreams = ({
461
435
  onReadyRemoteStreams: e
462
436
  }) => ({ track: t }) => {
463
- be(t) && e();
437
+ ge(t) && e();
464
438
  };
465
- getRemoteStreams = () => (o("getRemoteStreams"), this.sipConnector.getRemoteStreams());
466
- onUseLicense = (e) => (o("onUseLicense"), this.sipConnector.on("api:useLicense", e));
467
- onMustStopPresentation = (e) => (o("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", e));
468
- onMoveToSpectators = (e) => (o("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", e));
469
- onMoveToParticipants = (e) => (o("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", e));
470
- onStats = (e) => (o("onStats"), this.sipConnector.on("stats:collected", e));
439
+ getRemoteStreams = () => (r("getRemoteStreams"), this.sipConnector.getRemoteStreams());
440
+ onUseLicense = (e) => (r("onUseLicense"), this.sipConnector.on("api:useLicense", e));
441
+ onMustStopPresentation = (e) => (r("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", e));
442
+ onMoveToSpectators = (e) => (r("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", e));
443
+ onMoveToParticipants = (e) => (r("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", e));
444
+ onStats = (e) => (r("onStats"), this.sipConnector.on("stats:collected", e));
471
445
  offStats = (e) => {
472
- o("offStats"), this.sipConnector.off("stats:collected", e);
446
+ r("offStats"), this.sipConnector.off("stats:collected", e);
473
447
  };
474
448
  }
475
- var ye = /* @__PURE__ */ ((n) => (n.VP8 = "video/VP8", n.VP9 = "video/VP9", n.H264 = "video/H264", n.AV1 = "video/AV1", n.rtx = "video/rtx", n.red = "video/red", n.flexfec03 = "video/flexfec-03", n))(ye || {});
449
+ var ve = /* @__PURE__ */ ((n) => (n.VP8 = "video/VP8", n.VP9 = "video/VP9", n.H264 = "video/H264", n.AV1 = "video/AV1", n.rtx = "video/rtx", n.red = "video/red", n.flexfec03 = "video/flexfec-03", n))(ve || {});
476
450
  export {
477
- p as ECallCause,
478
- ye as EMimeTypesVideoCodecs,
479
- xe as EStatsTypes,
480
- Le as EUseLicense,
481
- Ve as SipConnector,
482
- Ie as SipConnectorFacade,
483
- Be as StatsPeerConnection,
484
- $e as disableDebug,
485
- He as enableDebug,
486
- We as getCodecFromSender,
487
- we as hasAvailableStats,
488
- De as hasCanceledCallError,
489
- je as hasCanceledStartPresentationError,
490
- Xe as hasConnectionPromiseIsNotActualError,
491
- Fe as tools
451
+ C as ECallCause,
452
+ ve as EMimeTypesVideoCodecs,
453
+ ke as EStatsTypes,
454
+ xe as EUseLicense,
455
+ Le as SipConnector,
456
+ we as SipConnectorFacade,
457
+ Ve as StatsPeerConnection,
458
+ Be as disableDebug,
459
+ $e as enableDebug,
460
+ He as getCodecFromSender,
461
+ Fe as hasAvailableStats,
462
+ Ae as hasCanceledCallError,
463
+ We as hasCanceledStartPresentationError,
464
+ Ke as hasConnectionPromiseIsNotActualError,
465
+ De as tools
492
466
  };