sip-connector 18.0.0 → 19.0.1

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