sip-connector 15.1.0 → 15.2.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.
Files changed (61) hide show
  1. package/README.md +160 -11
  2. package/dist/{@SipConnector-G96OmJEP.js → @SipConnector-BEZk1hmx.js} +548 -267
  3. package/dist/@SipConnector-hpySQIBa.cjs +1 -0
  4. package/dist/SipConnector/@SipConnector.d.ts +2 -0
  5. package/dist/SipConnector/eventNames.d.ts +1 -1
  6. package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +3 -0
  7. package/dist/StatsManager/@StatsManager.d.ts +19 -0
  8. package/dist/StatsManager/eventNames.d.ts +2 -0
  9. package/dist/StatsManager/index.d.ts +2 -0
  10. package/dist/StatsPeerConnection/StatsPeerConnection.d.ts +20 -0
  11. package/dist/StatsPeerConnection/__fixtures__/callStaticsState.d.ts +3923 -0
  12. package/dist/StatsPeerConnection/constants.d.ts +14 -0
  13. package/dist/StatsPeerConnection/eventNames.d.ts +10 -0
  14. package/dist/StatsPeerConnection/index.d.ts +4 -0
  15. package/dist/StatsPeerConnection/parseStatsReports.d.ts +14 -0
  16. package/dist/StatsPeerConnection/requestAllStatistics.d.ts +11 -0
  17. package/dist/StatsPeerConnection/typings.d.ts +194 -0
  18. package/dist/StatsPeerConnection/utils/hasAvailableStats.d.ts +2 -0
  19. package/dist/StatsPeerConnection/utils/index.d.ts +3 -0
  20. package/dist/StatsPeerConnection/utils/now.d.ts +2 -0
  21. package/dist/StatsPeerConnection/utils/statsReportToObject.d.ts +4 -0
  22. package/dist/{videoSendingBalancer → VideoSendingBalancer}/ParametersSetterWithQueue.d.ts +2 -2
  23. package/dist/{videoSendingBalancer → VideoSendingBalancer}/SenderBalancer.d.ts +2 -2
  24. package/dist/{videoSendingBalancer → VideoSendingBalancer}/VideoSendingBalancer.d.ts +2 -2
  25. package/dist/{videoSendingBalancer → VideoSendingBalancer}/types.d.ts +2 -2
  26. package/dist/doMock.cjs +1 -1
  27. package/dist/doMock.js +4 -4
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +270 -255
  31. package/dist/tools/createUaParser/createUaParser.d.ts +4 -0
  32. package/dist/tools/createUaParser/index.d.ts +1 -0
  33. package/dist/tools/createUaParser/isElectronEnvironment.d.ts +2 -0
  34. package/dist/tools/index.d.ts +4 -0
  35. package/dist/{setParametersToSender → tools/setParametersToSender}/configureDegradationPreference.d.ts +1 -1
  36. package/dist/{setParametersToSender → tools/setParametersToSender}/configureEncodings.d.ts +1 -1
  37. package/dist/{setParametersToSender → tools/setParametersToSender}/index.d.ts +1 -1
  38. package/dist/{setParametersToSender → tools/setParametersToSender}/setEncodingsToSender.d.ts +2 -2
  39. package/dist/{setParametersToSender → tools/setParametersToSender}/setMaxBitrateToSender.d.ts +1 -1
  40. package/dist/tools/setParametersToSender/setParametersToSender.d.ts +4 -0
  41. package/dist/{setParametersToSender → tools/setParametersToSender}/types.d.ts +1 -1
  42. package/package.json +7 -13
  43. package/dist/@SipConnector-BBhQzo-W.cjs +0 -1
  44. package/dist/setParametersToSender/setParametersToSender.d.ts +0 -4
  45. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/CodecProvider.d.ts +0 -0
  46. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/SenderFinder.d.ts +0 -0
  47. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/TaskQueue.d.ts +0 -0
  48. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/VideoSendingEventHandler.d.ts +0 -0
  49. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/calcMaxBitrateByWidth.d.ts +0 -0
  50. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/calcMaxBitrateByWidthAndCodec.d.ts +0 -0
  51. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/hasAv1Codec.d.ts +0 -0
  52. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/index.d.ts +0 -0
  53. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/scaleBitrateByCodec.d.ts +0 -0
  54. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcResolution/calcScaleResolutionDownBy.d.ts +0 -0
  55. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcResolution/index.d.ts +0 -0
  56. /package/dist/{videoSendingBalancer → VideoSendingBalancer}/index.d.ts +0 -0
  57. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  58. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  59. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  60. /package/dist/{setParametersToSender → tools/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  61. /package/dist/{setParametersToSender → tools/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
@@ -1,10 +1,13 @@
1
- import { Events as O } from "events-constructor";
2
- import "@krivega/cancelable-promise";
3
- import k from "debug";
4
- import { hasCanceledError as K, repeatedCallsAsync as V } from "repeated-calls";
5
- import { setup as j, createActor as Z } from "xstate";
6
- var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n))(N || {}), b = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(b || {});
7
- const H = [
1
+ import { Events as f, TypedEvents as ae } from "events-constructor";
2
+ import { CancelableRequest as oe } from "@krivega/cancelable-promise";
3
+ import B from "debug";
4
+ import { hasCanceledError as ce, repeatedCallsAsync as Y } from "repeated-calls";
5
+ import { setup as ge, createActor as de } from "xstate";
6
+ import { SetTimeoutRequest as Te } from "@krivega/timeout-requester";
7
+ import "ua-parser-js";
8
+ import "sequent-promises";
9
+ var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n))(N || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
10
+ const z = [
8
11
  "peerconnection",
9
12
  "connecting",
10
13
  "sending",
@@ -31,18 +34,18 @@ const H = [
31
34
  "peerconnection:createanswerfailed",
32
35
  "peerconnection:setlocaldescriptionfailed",
33
36
  "peerconnection:setremotedescriptionfailed"
34
- ], ee = [
37
+ ], he = [
35
38
  "peerconnection:confirmed",
36
39
  "peerconnection:ontrack",
37
40
  "ended:fromserver"
38
- ], G = [
39
- ...H,
40
- ...ee
41
- ], te = (n, e) => {
41
+ ], Q = [
42
+ ...z,
43
+ ...he
44
+ ], Ee = (n, e) => {
42
45
  n.getVideoTracks().forEach((s) => {
43
46
  "contentHint" in s && s.contentHint !== e && (s.contentHint = e);
44
47
  });
45
- }, v = (n, {
48
+ }, w = (n, {
46
49
  directionVideo: e,
47
50
  directionAudio: t,
48
51
  contentHint: s
@@ -50,16 +53,16 @@ const H = [
50
53
  if (!n || e === "recvonly" && t === "recvonly")
51
54
  return;
52
55
  const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
53
- return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && te(o, s), o;
56
+ return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ee(o, s), o;
54
57
  };
55
- function ne(n) {
58
+ function Se(n) {
56
59
  return (e) => `sip:${e}@${n}`;
57
60
  }
58
- const se = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, B = (n) => n.trim().replaceAll(" ", "_"), ie = se(1e5, 99999999), re = (n) => n.some((t) => {
61
+ const le = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, X = (n) => n.trim().replaceAll(" ", "_"), ue = le(1e5, 99999999), Ce = (n) => n.some((t) => {
59
62
  const { kind: s } = t;
60
63
  return s === "video";
61
64
  });
62
- class ae {
65
+ class Ne {
63
66
  isPendingCall = !1;
64
67
  isPendingAnswer = !1;
65
68
  rtcSession;
@@ -70,8 +73,8 @@ class ae {
70
73
  this.events = e;
71
74
  }
72
75
  }
73
- var x = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(x || {});
74
- class oe {
76
+ var J = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(J || {});
77
+ class Ae {
75
78
  remoteStreams = {};
76
79
  reset() {
77
80
  this.remoteStreams = {};
@@ -100,8 +103,8 @@ class oe {
100
103
  return e.map((t) => this.generateAudioStream(t));
101
104
  }
102
105
  }
103
- class ce extends ae {
104
- remoteStreamsManager = new oe();
106
+ class Re extends Ne {
107
+ remoteStreamsManager = new Ae();
105
108
  disposers = /* @__PURE__ */ new Set();
106
109
  constructor(e) {
107
110
  super(e), e.on(N.FAILED, this.handleEnded), e.on(N.ENDED, this.handleEnded);
@@ -125,37 +128,37 @@ class ce extends ae {
125
128
  ontrack: a,
126
129
  iceServers: o,
127
130
  directionVideo: c,
128
- directionAudio: T,
129
- contentHint: d,
130
- offerToReceiveAudio: l = !0,
131
- offerToReceiveVideo: E = !0,
131
+ directionAudio: g,
132
+ contentHint: E,
133
+ offerToReceiveAudio: u = !0,
134
+ offerToReceiveVideo: d = !0,
132
135
  sendEncodings: S,
133
- onAddedTransceiver: R
136
+ onAddedTransceiver: _
134
137
  }) => (this.isPendingCall = !0, new Promise((C, p) => {
135
- this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((w) => {
136
- p(w);
138
+ this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((D) => {
139
+ p(D);
137
140
  }), this.rtcSession = e.call(t(s), {
138
141
  extraHeaders: r,
139
- mediaStream: v(i, {
142
+ mediaStream: w(i, {
140
143
  directionVideo: c,
141
- directionAudio: T,
142
- contentHint: d
144
+ directionAudio: g,
145
+ contentHint: E
143
146
  }),
144
147
  // необходимо передавать в методе call, чтобы подписаться на события peerconnection,
145
148
  // так как в методе call создается RTCSession
146
149
  // и после создания нет возможности подписаться на события peerconnection через subscribeToSessionEvents
147
150
  eventHandlers: this.events.triggers,
148
151
  directionVideo: c,
149
- directionAudio: T,
152
+ directionAudio: g,
150
153
  pcConfig: {
151
154
  iceServers: o
152
155
  },
153
156
  rtcOfferConstraints: {
154
- offerToReceiveAudio: l,
155
- offerToReceiveVideo: E
157
+ offerToReceiveAudio: u,
158
+ offerToReceiveVideo: d
156
159
  },
157
160
  sendEncodings: S,
158
- onAddedTransceiver: R
161
+ onAddedTransceiver: _
159
162
  });
160
163
  }).finally(() => {
161
164
  this.isPendingCall = !1;
@@ -164,7 +167,7 @@ class ce extends ae {
164
167
  const { rtcSession: e } = this;
165
168
  if (e && !e.isEnded())
166
169
  return e.terminateAsync({
167
- cause: x.CANCELED
170
+ cause: J.CANCELED
168
171
  }).finally(() => {
169
172
  this.reset();
170
173
  });
@@ -178,20 +181,20 @@ class ce extends ae {
178
181
  directionVideo: a,
179
182
  directionAudio: o,
180
183
  offerToReceiveAudio: c,
181
- offerToReceiveVideo: T,
182
- contentHint: d,
183
- sendEncodings: l,
184
- onAddedTransceiver: E
185
- }) => (this.isPendingAnswer = !0, new Promise((S, R) => {
184
+ offerToReceiveVideo: g,
185
+ contentHint: E,
186
+ sendEncodings: u,
187
+ onAddedTransceiver: d
188
+ }) => (this.isPendingAnswer = !0, new Promise((S, _) => {
186
189
  try {
187
190
  const C = e();
188
- this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((w) => {
189
- R(w);
191
+ this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((D) => {
192
+ _(D);
190
193
  });
191
- const p = v(t, {
194
+ const p = w(t, {
192
195
  directionVideo: a,
193
196
  directionAudio: o,
194
- contentHint: d
197
+ contentHint: E
195
198
  });
196
199
  C.answer({
197
200
  extraHeaders: i,
@@ -203,13 +206,13 @@ class ce extends ae {
203
206
  },
204
207
  rtcOfferConstraints: {
205
208
  offerToReceiveAudio: c,
206
- offerToReceiveVideo: T
209
+ offerToReceiveVideo: g
207
210
  },
208
- sendEncodings: l,
209
- onAddedTransceiver: E
211
+ sendEncodings: u,
212
+ onAddedTransceiver: d
210
213
  });
211
214
  } catch (C) {
212
- R(C);
215
+ _(C);
213
216
  }
214
217
  }).finally(() => {
215
218
  this.isPendingAnswer = !1;
@@ -224,12 +227,12 @@ class ce extends ae {
224
227
  if (!this.connection)
225
228
  return;
226
229
  const t = this.connection.getReceivers().map(({ track: s }) => s);
227
- return re(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
230
+ return Ce(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
228
231
  }
229
232
  async replaceMediaStream(e, t) {
230
233
  if (!this.rtcSession)
231
234
  throw new Error("No rtcSession established");
232
- const { contentHint: s } = t ?? {}, i = v(e, { contentHint: s });
235
+ const { contentHint: s } = t ?? {}, i = w(e, { contentHint: s });
233
236
  if (i === void 0)
234
237
  throw new Error("No preparedMediaStream");
235
238
  return this.rtcSession.replaceMediaStream(i, t);
@@ -238,33 +241,33 @@ class ce extends ae {
238
241
  ontrack: e
239
242
  }) => new Promise((t, s) => {
240
243
  const i = () => {
241
- this.events.on(N.PEER_CONNECTION, d), this.events.on(N.CONFIRMED, l);
244
+ this.events.on(N.PEER_CONNECTION, E), this.events.on(N.CONFIRMED, u);
242
245
  }, r = () => {
243
- this.events.off(N.PEER_CONNECTION, d), this.events.off(N.CONFIRMED, l);
246
+ this.events.off(N.PEER_CONNECTION, E), this.events.off(N.CONFIRMED, u);
244
247
  }, a = () => {
245
248
  this.events.on(N.FAILED, c), this.events.on(N.ENDED, c);
246
249
  }, o = () => {
247
250
  this.events.off(N.FAILED, c), this.events.off(N.ENDED, c);
248
- }, c = (E) => {
249
- r(), o(), s(E);
251
+ }, c = (d) => {
252
+ r(), o(), s(d);
250
253
  };
251
- let T;
252
- const d = ({ peerconnection: E }) => {
253
- T = E;
254
- const S = (R) => {
255
- this.events.trigger(N.PEER_CONNECTION_ONTRACK, E), e && e(R);
254
+ let g;
255
+ const E = ({ peerconnection: d }) => {
256
+ g = d;
257
+ const S = (_) => {
258
+ this.events.trigger(N.PEER_CONNECTION_ONTRACK, d), e && e(_);
256
259
  };
257
- E.addEventListener("track", S), this.disposers.add(() => {
258
- E.removeEventListener("track", S);
260
+ d.addEventListener("track", S), this.disposers.add(() => {
261
+ d.removeEventListener("track", S);
259
262
  });
260
- }, l = () => {
261
- T !== void 0 && this.events.trigger(N.PEER_CONNECTION_CONFIRMED, T), r(), o(), t(T);
263
+ }, u = () => {
264
+ g !== void 0 && this.events.trigger(N.PEER_CONNECTION_CONFIRMED, g), r(), o(), t(g);
262
265
  };
263
266
  i(), a();
264
267
  });
265
268
  subscribeToSessionEvents(e) {
266
269
  this.events.eachTriggers((t, s) => {
267
- const i = H.find((r) => r === s);
270
+ const i = z.find((r) => r === s);
268
271
  i && (e.on(i, t), this.disposers.add(() => {
269
272
  e.off(i, t);
270
273
  }));
@@ -277,17 +280,17 @@ class ce extends ae {
277
280
  }
278
281
  handleEnded = (e) => {
279
282
  const { originator: t } = e;
280
- t === b.REMOTE && this.events.trigger(N.ENDED_FROM_SERVER, e), this.reset();
283
+ t === $.REMOTE && this.events.trigger(N.ENDED_FROM_SERVER, e), this.reset();
281
284
  };
282
285
  reset = () => {
283
286
  delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
284
287
  };
285
288
  }
286
- class ge {
289
+ class _e {
287
290
  events;
288
291
  strategy;
289
292
  constructor(e) {
290
- this.events = new O(G), this.strategy = e ?? new ce(this.events);
293
+ this.events = new f(Q), this.strategy = e ?? new Re(this.events);
291
294
  }
292
295
  get requested() {
293
296
  return this.strategy.requested;
@@ -331,13 +334,13 @@ class ge {
331
334
  getRemoteStreams = () => this.strategy.getRemoteStreams();
332
335
  replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
333
336
  }
334
- const W = "sip-connector", m = k(W), He = () => {
335
- k.enable(W);
336
- }, Ge = () => {
337
- k.enable(`-${W}`);
338
- }, Te = "Error decline with 603", he = 1006, de = (n) => typeof n == "object" && n !== null && "code" in n && n.code === he, Ee = (n) => n.message === Te;
339
- var h = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(h || {}), y = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(y || {}), U = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(U || {}), M = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(M || {}), _ = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(_ || {}), f = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(f || {}), L = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(F || {}), Se = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Se || {}), g = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(g || {});
340
- const q = [
337
+ const H = "sip-connector", O = B(H), ht = () => {
338
+ B.enable(H);
339
+ }, Et = () => {
340
+ B.enable(`-${H}`);
341
+ }, Ie = "Error decline with 603", Me = 1006, pe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Me, Pe = (n) => n.message === Ie;
342
+ var h = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(h || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), P = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(P || {}), I = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(I || {}), y = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(y || {}), k = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(k || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(W || {}), Oe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Oe || {}), T = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(T || {});
343
+ const j = [
341
344
  "participation:accepting-word-request",
342
345
  "participation:cancelling-word-request",
343
346
  "participant:move-request-to-stream",
@@ -367,8 +370,8 @@ const q = [
367
370
  "mustStopPresentation",
368
371
  "newDTMF"
369
372
  ];
370
- var A = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(A || {});
371
- class le {
373
+ var R = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(R || {});
374
+ class me {
372
375
  events;
373
376
  connectionManager;
374
377
  callManager;
@@ -376,13 +379,13 @@ class le {
376
379
  connectionManager: e,
377
380
  callManager: t
378
381
  }) {
379
- this.connectionManager = e, this.callManager = t, this.events = new O(q), this.subscribe();
382
+ this.connectionManager = e, this.callManager = t, this.events = new f(j), this.subscribe();
380
383
  }
381
384
  async waitChannels() {
382
- return this.wait(g.CHANNELS);
385
+ return this.wait(T.CHANNELS);
383
386
  }
384
387
  async waitSyncMediaState() {
385
- return this.wait(g.ADMIN_FORCE_SYNC_MEDIA_STATE);
388
+ return this.wait(T.ADMIN_FORCE_SYNC_MEDIA_STATE);
386
389
  }
387
390
  async sendDTMF(e) {
388
391
  return new Promise((t, s) => {
@@ -393,7 +396,7 @@ class le {
393
396
  s(r);
394
397
  }
395
398
  i && (this.callManager.once("newDTMF", ({ originator: r }) => {
396
- r === b.LOCAL && t();
399
+ r === $.LOCAL && t();
397
400
  }), i.sendDTMF(e, {
398
401
  duration: 120,
399
402
  interToneGap: 600
@@ -405,7 +408,7 @@ class le {
405
408
  i,
406
409
  r
407
410
  ];
408
- return s.sendInfo(_.CHANNELS, void 0, { extraHeaders: a });
411
+ return s.sendInfo(I.CHANNELS, void 0, { extraHeaders: a });
409
412
  }
410
413
  async sendMediaState({ cam: e, mic: t }, s = {}) {
411
414
  const i = this.getEstablishedRTCSessionProtected(), r = `${h.MEDIA_STATE}: currentstate`, a = `${h.MAIN_CAM_STATE}: ${Number(e)}`, o = `${h.MIC_STATE}: ${Number(t)}`, c = [
@@ -413,7 +416,7 @@ class le {
413
416
  a,
414
417
  o
415
418
  ];
416
- return i.sendInfo(_.MEDIA_STATE, void 0, {
419
+ return i.sendInfo(I.MEDIA_STATE, void 0, {
417
420
  noTerminateWhenError: !0,
418
421
  ...s,
419
422
  extraHeaders: c
@@ -421,7 +424,7 @@ class le {
421
424
  }
422
425
  async sendRefusalToTurnOn(e, t = {}) {
423
426
  const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
424
- return s.sendInfo(_.REFUSAL, void 0, {
427
+ return s.sendInfo(I.REFUSAL, void 0, {
425
428
  noTerminateWhenError: !0,
426
429
  ...t,
427
430
  extraHeaders: c
@@ -434,38 +437,38 @@ class le {
434
437
  return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
435
438
  }
436
439
  async sendMustStopPresentationP2P() {
437
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
440
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
438
441
  extraHeaders: [h.MUST_STOP_PRESENTATION_P2P]
439
442
  });
440
443
  }
441
444
  async sendStoppedPresentationP2P() {
442
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
445
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
443
446
  extraHeaders: [h.STOP_PRESENTATION_P2P]
444
447
  });
445
448
  }
446
449
  async sendStoppedPresentation() {
447
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
450
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
448
451
  extraHeaders: [h.STOP_PRESENTATION]
449
452
  });
450
453
  }
451
454
  async askPermissionToStartPresentationP2P() {
452
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
455
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
453
456
  extraHeaders: [h.START_PRESENTATION_P2P]
454
457
  });
455
458
  }
456
459
  async askPermissionToStartPresentation() {
457
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
460
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
458
461
  extraHeaders: [h.START_PRESENTATION]
459
462
  });
460
463
  }
461
464
  async askPermissionToEnableCam(e = {}) {
462
465
  const t = this.getEstablishedRTCSessionProtected(), s = [h.ENABLE_MAIN_CAM];
463
- return t.sendInfo(_.MAIN_CAM, void 0, {
466
+ return t.sendInfo(I.MAIN_CAM, void 0, {
464
467
  noTerminateWhenError: !0,
465
468
  ...e,
466
469
  extraHeaders: s
467
470
  }).catch((i) => {
468
- if (Ee(i))
471
+ if (Pe(i))
469
472
  throw i;
470
473
  });
471
474
  }
@@ -510,100 +513,100 @@ class le {
510
513
  this.handleNotify(s);
511
514
  }
512
515
  } catch (t) {
513
- m("error parse notify", t);
516
+ O("error parse notify", t);
514
517
  }
515
518
  };
516
519
  handleNotify = (e) => {
517
520
  switch (e.cmd) {
518
- case A.CHANNELS: {
521
+ case R.CHANNELS: {
519
522
  const t = e;
520
523
  this.triggerChannelsNotify(t);
521
524
  break;
522
525
  }
523
- case A.WEBCAST_STARTED: {
526
+ case R.WEBCAST_STARTED: {
524
527
  const t = e;
525
528
  this.triggerWebcastStartedNotify(t);
526
529
  break;
527
530
  }
528
- case A.WEBCAST_STOPPED: {
531
+ case R.WEBCAST_STOPPED: {
529
532
  const t = e;
530
533
  this.triggerWebcastStoppedNotify(t);
531
534
  break;
532
535
  }
533
- case A.ADDED_TO_LIST_MODERATORS: {
536
+ case R.ADDED_TO_LIST_MODERATORS: {
534
537
  const t = e;
535
538
  this.triggerAddedToListModeratorsNotify(t);
536
539
  break;
537
540
  }
538
- case A.REMOVED_FROM_LIST_MODERATORS: {
541
+ case R.REMOVED_FROM_LIST_MODERATORS: {
539
542
  const t = e;
540
543
  this.triggerRemovedFromListModeratorsNotify(t);
541
544
  break;
542
545
  }
543
- case A.ACCEPTING_WORD_REQUEST: {
546
+ case R.ACCEPTING_WORD_REQUEST: {
544
547
  const t = e;
545
548
  this.triggerParticipationAcceptingWordRequest(t);
546
549
  break;
547
550
  }
548
- case A.CANCELLING_WORD_REQUEST: {
551
+ case R.CANCELLING_WORD_REQUEST: {
549
552
  const t = e;
550
553
  this.triggerParticipationCancellingWordRequest(t);
551
554
  break;
552
555
  }
553
- case A.MOVE_REQUEST_TO_STREAM: {
556
+ case R.MOVE_REQUEST_TO_STREAM: {
554
557
  const t = e;
555
558
  this.triggerParticipantMoveRequestToStream(t);
556
559
  break;
557
560
  }
558
- case A.ACCOUNT_CHANGED: {
561
+ case R.ACCOUNT_CHANGED: {
559
562
  this.triggerAccountChangedNotify();
560
563
  break;
561
564
  }
562
- case A.ACCOUNT_DELETED: {
565
+ case R.ACCOUNT_DELETED: {
563
566
  this.triggerAccountDeletedNotify();
564
567
  break;
565
568
  }
566
- case A.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
569
+ case R.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
567
570
  const t = e;
568
571
  this.triggerConferenceParticipantTokenIssued(t);
569
572
  break;
570
573
  }
571
574
  default:
572
- m("unknown cmd", e);
575
+ O("unknown cmd", e);
573
576
  }
574
577
  };
575
578
  handleNewInfo = (e) => {
576
579
  const { originator: t } = e;
577
- if (t !== b.REMOTE)
580
+ if (t !== $.REMOTE)
578
581
  return;
579
582
  const { request: s } = e, i = s.getHeader(h.CONTENT_TYPE);
580
583
  if (i !== void 0)
581
584
  switch (i) {
582
- case M.ENTER_ROOM: {
585
+ case P.ENTER_ROOM: {
583
586
  this.triggerEnterRoom(s), this.maybeTriggerChannels(s);
584
587
  break;
585
588
  }
586
- case M.NOTIFY: {
589
+ case P.NOTIFY: {
587
590
  this.maybeHandleNotify(s);
588
591
  break;
589
592
  }
590
- case M.SHARE_STATE: {
593
+ case P.SHARE_STATE: {
591
594
  this.triggerShareState(s);
592
595
  break;
593
596
  }
594
- case M.MAIN_CAM: {
597
+ case P.MAIN_CAM: {
595
598
  this.triggerMainCamControl(s);
596
599
  break;
597
600
  }
598
- case M.MIC: {
601
+ case P.MIC: {
599
602
  this.triggerMicControl(s);
600
603
  break;
601
604
  }
602
- case M.USE_LICENSE: {
605
+ case P.USE_LICENSE: {
603
606
  this.triggerUseLicense(s);
604
607
  break;
605
608
  }
606
- case M.PARTICIPANT_STATE: {
609
+ case P.PARTICIPANT_STATE: {
607
610
  this.maybeTriggerParticipantMoveRequest(s);
608
611
  break;
609
612
  }
@@ -614,7 +617,7 @@ class le {
614
617
  inputChannels: t,
615
618
  outputChannels: s
616
619
  };
617
- this.events.trigger(g.CHANNELS_NOTIFY, i);
620
+ this.events.trigger(T.CHANNELS_NOTIFY, i);
618
621
  };
619
622
  triggerWebcastStartedNotify = ({
620
623
  body: { conference: e, type: t }
@@ -623,7 +626,7 @@ class le {
623
626
  conference: e,
624
627
  type: t
625
628
  };
626
- this.events.trigger(g.WEBCAST_STARTED, s);
629
+ this.events.trigger(T.WEBCAST_STARTED, s);
627
630
  };
628
631
  triggerWebcastStoppedNotify = ({
629
632
  body: { conference: e, type: t }
@@ -632,7 +635,7 @@ class le {
632
635
  conference: e,
633
636
  type: t
634
637
  };
635
- this.events.trigger(g.WEBCAST_STOPPED, s);
638
+ this.events.trigger(T.WEBCAST_STOPPED, s);
636
639
  };
637
640
  triggerAddedToListModeratorsNotify = ({
638
641
  conference: e
@@ -641,7 +644,7 @@ class le {
641
644
  conference: e
642
645
  };
643
646
  this.events.trigger(
644
- g.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
647
+ T.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
645
648
  t
646
649
  );
647
650
  };
@@ -652,7 +655,7 @@ class le {
652
655
  conference: e
653
656
  };
654
657
  this.events.trigger(
655
- g.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
658
+ T.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
656
659
  t
657
660
  );
658
661
  };
@@ -662,7 +665,7 @@ class le {
662
665
  const t = {
663
666
  conference: e
664
667
  };
665
- this.events.trigger(g.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
668
+ this.events.trigger(T.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
666
669
  };
667
670
  triggerParticipationCancellingWordRequest = ({
668
671
  body: { conference: e }
@@ -670,7 +673,7 @@ class le {
670
673
  const t = {
671
674
  conference: e
672
675
  };
673
- this.events.trigger(g.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
676
+ this.events.trigger(T.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
674
677
  };
675
678
  triggerParticipantMoveRequestToStream = ({
676
679
  body: { conference: e }
@@ -678,13 +681,13 @@ class le {
678
681
  const t = {
679
682
  conference: e
680
683
  };
681
- this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
684
+ this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
682
685
  };
683
686
  triggerAccountChangedNotify = () => {
684
- this.events.trigger(g.ACCOUNT_CHANGED, void 0);
687
+ this.events.trigger(T.ACCOUNT_CHANGED, void 0);
685
688
  };
686
689
  triggerAccountDeletedNotify = () => {
687
- this.events.trigger(g.ACCOUNT_DELETED, void 0);
690
+ this.events.trigger(T.ACCOUNT_DELETED, void 0);
688
691
  };
689
692
  triggerConferenceParticipantTokenIssued = ({
690
693
  body: { conference: e, participant: t, jwt: s }
@@ -695,7 +698,7 @@ class le {
695
698
  jwt: s
696
699
  };
697
700
  this.events.trigger(
698
- g.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
701
+ T.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
699
702
  i
700
703
  );
701
704
  };
@@ -706,70 +709,70 @@ class le {
706
709
  inputChannels: t,
707
710
  outputChannels: s
708
711
  };
709
- this.events.trigger(g.CHANNELS, i);
712
+ this.events.trigger(T.CHANNELS, i);
710
713
  }
711
714
  };
712
715
  triggerEnterRoom = (e) => {
713
716
  const t = e.getHeader(h.CONTENT_ENTER_ROOM), s = e.getHeader(h.PARTICIPANT_NAME);
714
- this.events.trigger(g.ENTER_ROOM, { room: t, participantName: s });
717
+ this.events.trigger(T.ENTER_ROOM, { room: t, participantName: s });
715
718
  };
716
719
  triggerShareState = (e) => {
717
720
  const t = e.getHeader(h.CONTENT_SHARE_STATE);
718
721
  if (t !== void 0)
719
722
  switch (t) {
720
- case y.AVAILABLE_SECOND_REMOTE_STREAM: {
721
- this.events.trigger(g.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
723
+ case L.AVAILABLE_SECOND_REMOTE_STREAM: {
724
+ this.events.trigger(T.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
722
725
  break;
723
726
  }
724
- case y.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
725
- this.events.trigger(g.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
727
+ case L.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
728
+ this.events.trigger(T.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
726
729
  break;
727
730
  }
728
- case y.MUST_STOP_PRESENTATION: {
729
- this.events.trigger(g.MUST_STOP_PRESENTATION, void 0);
731
+ case L.MUST_STOP_PRESENTATION: {
732
+ this.events.trigger(T.MUST_STOP_PRESENTATION, void 0);
730
733
  break;
731
734
  }
732
735
  }
733
736
  };
734
737
  maybeTriggerParticipantMoveRequest = (e) => {
735
738
  const t = e.getHeader(h.CONTENT_PARTICIPANT_STATE);
736
- t === U.SPECTATOR && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === U.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0), t === U.SPECTATOR_OVER_SFU && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU, void 0);
739
+ t === F.SPECTATOR && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === F.PARTICIPANT && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0), t === F.SPECTATOR_OVER_SFU && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU, void 0);
737
740
  };
738
741
  triggerMainCamControl = (e) => {
739
- const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), i = s === F.ADMIN_SYNC_FORCED;
740
- if (t === f.ADMIN_START_MAIN_CAM) {
741
- this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
742
+ const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), i = s === W.ADMIN_SYNC_FORCED;
743
+ if (t === y.ADMIN_START_MAIN_CAM) {
744
+ this.events.trigger(T.ADMIN_START_MAIN_CAM, { isSyncForced: i });
742
745
  return;
743
746
  }
744
- if (t === f.ADMIN_STOP_MAIN_CAM) {
745
- this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
747
+ if (t === y.ADMIN_STOP_MAIN_CAM) {
748
+ this.events.trigger(T.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
746
749
  return;
747
750
  }
748
- (t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
751
+ (t === y.RESUME_MAIN_CAM || t === y.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(T.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
749
752
  const r = e.getHeader(h.MAIN_CAM_RESOLUTION);
750
- this.events.trigger(g.MAIN_CAM_CONTROL, {
753
+ this.events.trigger(T.MAIN_CAM_CONTROL, {
751
754
  mainCam: t,
752
755
  resolutionMainCam: r
753
756
  });
754
757
  };
755
758
  triggerMicControl = (e) => {
756
- const t = e.getHeader(h.MIC), i = e.getHeader(h.MEDIA_SYNC) === F.ADMIN_SYNC_FORCED;
757
- t === L.ADMIN_START_MIC ? this.events.trigger(g.ADMIN_START_MIC, { isSyncForced: i }) : t === L.ADMIN_STOP_MIC && this.events.trigger(g.ADMIN_STOP_MIC, { isSyncForced: i });
759
+ const t = e.getHeader(h.MIC), i = e.getHeader(h.MEDIA_SYNC) === W.ADMIN_SYNC_FORCED;
760
+ t === k.ADMIN_START_MIC ? this.events.trigger(T.ADMIN_START_MIC, { isSyncForced: i }) : t === k.ADMIN_STOP_MIC && this.events.trigger(T.ADMIN_STOP_MIC, { isSyncForced: i });
758
761
  };
759
762
  triggerUseLicense = (e) => {
760
763
  const t = e.getHeader(h.CONTENT_USE_LICENSE);
761
- this.events.trigger(g.USE_LICENSE, t);
764
+ this.events.trigger(T.USE_LICENSE, t);
762
765
  };
763
766
  }
764
- var I = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(I || {});
765
- const Y = [
767
+ var M = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(M || {});
768
+ const K = [
766
769
  "presentation:start",
767
770
  "presentation:started",
768
771
  "presentation:end",
769
772
  "presentation:ended",
770
773
  "presentation:failed"
771
- ], Ce = 1, Be = (n) => K(n);
772
- class Ne {
774
+ ], fe = 1, St = (n) => ce(n);
775
+ class De {
773
776
  events;
774
777
  promisePendingStartPresentation;
775
778
  promisePendingStopPresentation;
@@ -777,7 +780,7 @@ class Ne {
777
780
  cancelableSendPresentationWithRepeatedCalls;
778
781
  callManager;
779
782
  constructor({ callManager: e }) {
780
- this.callManager = e, this.events = new O(Y), this.subscribe();
783
+ this.callManager = e, this.events = new f(K), this.subscribe();
781
784
  }
782
785
  get isPendingPresentation() {
783
786
  return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
@@ -790,11 +793,11 @@ class Ne {
790
793
  sendEncodings: a,
791
794
  onAddedTransceiver: o
792
795
  } = {}, c) {
793
- const T = this.getRtcSessionProtected();
796
+ const g = this.getRtcSessionProtected();
794
797
  if (this.streamPresentationCurrent)
795
798
  throw new Error("Presentation is already started");
796
799
  return this.sendPresentationWithDuplicatedCalls(e, {
797
- rtcSession: T,
800
+ rtcSession: g,
798
801
  stream: t,
799
802
  presentationOptions: {
800
803
  isNeedReinvite: s,
@@ -812,8 +815,8 @@ class Ne {
812
815
  let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
813
816
  const i = this.callManager.getEstablishedRTCSession();
814
817
  return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
815
- throw this.events.trigger(I.FAILED_PRESENTATION, r), r;
816
- }) : t && this.events.trigger(I.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
818
+ throw this.events.trigger(M.FAILED_PRESENTATION, r), r;
819
+ }) : t && this.events.trigger(M.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
817
820
  this.resetPresentation();
818
821
  });
819
822
  }
@@ -858,15 +861,15 @@ class Ne {
858
861
  }
859
862
  subscribe() {
860
863
  this.callManager.on("presentation:start", (e) => {
861
- this.events.trigger(I.START_PRESENTATION, e);
864
+ this.events.trigger(M.START_PRESENTATION, e);
862
865
  }), this.callManager.on("presentation:started", (e) => {
863
- this.events.trigger(I.STARTED_PRESENTATION, e);
866
+ this.events.trigger(M.STARTED_PRESENTATION, e);
864
867
  }), this.callManager.on("presentation:end", (e) => {
865
- this.events.trigger(I.END_PRESENTATION, e);
868
+ this.events.trigger(M.END_PRESENTATION, e);
866
869
  }), this.callManager.on("presentation:ended", (e) => {
867
- this.events.trigger(I.ENDED_PRESENTATION, e);
870
+ this.events.trigger(M.ENDED_PRESENTATION, e);
868
871
  }), this.callManager.on("presentation:failed", (e) => {
869
- this.events.trigger(I.FAILED_PRESENTATION, e);
872
+ this.events.trigger(M.FAILED_PRESENTATION, e);
870
873
  }), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
871
874
  }
872
875
  async sendPresentationWithDuplicatedCalls(e, {
@@ -874,7 +877,7 @@ class Ne {
874
877
  stream: s,
875
878
  presentationOptions: i,
876
879
  options: r = {
877
- callLimit: Ce
880
+ callLimit: fe
878
881
  }
879
882
  }) {
880
883
  const a = async () => this.sendPresentation(
@@ -883,7 +886,7 @@ class Ne {
883
886
  s,
884
887
  i
885
888
  ), o = () => !!this.streamPresentationCurrent;
886
- return this.cancelableSendPresentationWithRepeatedCalls = V({
889
+ return this.cancelableSendPresentationWithRepeatedCalls = Y({
887
890
  targetFunction: a,
888
891
  isComplete: o,
889
892
  isRejectAsValid: !0,
@@ -898,17 +901,17 @@ class Ne {
898
901
  sendEncodings: a,
899
902
  onAddedTransceiver: o
900
903
  }) {
901
- const c = v(s, { contentHint: r });
904
+ const c = w(s, { contentHint: r });
902
905
  if (c === void 0)
903
906
  throw new Error("No streamPresentationTarget");
904
907
  this.streamPresentationCurrent = c;
905
- const T = e().then(async () => t.startPresentation(c, i, {
908
+ const g = e().then(async () => t.startPresentation(c, i, {
906
909
  sendEncodings: a,
907
910
  onAddedTransceiver: o
908
- })).then(() => s).catch((d) => {
909
- throw this.removeStreamPresentationCurrent(), this.events.trigger(I.FAILED_PRESENTATION, d), d;
911
+ })).then(() => s).catch((E) => {
912
+ throw this.removeStreamPresentationCurrent(), this.events.trigger(M.FAILED_PRESENTATION, E), E;
910
913
  });
911
- return this.promisePendingStartPresentation = T, T.finally(() => {
914
+ return this.promisePendingStartPresentation = g, g.finally(() => {
912
915
  this.promisePendingStartPresentation = void 0;
913
916
  });
914
917
  }
@@ -931,7 +934,7 @@ class Ne {
931
934
  delete this.streamPresentationCurrent;
932
935
  }
933
936
  }
934
- class ue {
937
+ class ve {
935
938
  data = {};
936
939
  getUa;
937
940
  constructor(e) {
@@ -1004,8 +1007,8 @@ class ue {
1004
1007
  return this.data.register === !0;
1005
1008
  }
1006
1009
  }
1007
- var u = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n))(u || {});
1008
- const Q = [
1010
+ var A = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n))(A || {});
1011
+ const Z = [
1009
1012
  "connecting",
1010
1013
  "connected",
1011
1014
  "disconnected",
@@ -1015,8 +1018,8 @@ const Q = [
1015
1018
  "registrationFailed",
1016
1019
  "newMessage",
1017
1020
  "sipEvent"
1018
- ], z = [...Q], Ae = 3;
1019
- class _e {
1021
+ ], ee = [...Z], ye = 3;
1022
+ class Ue {
1020
1023
  cancelableConnectWithRepeatedCalls;
1021
1024
  JsSIP;
1022
1025
  events;
@@ -1042,29 +1045,29 @@ class _e {
1042
1045
  }
1043
1046
  let r = !1;
1044
1047
  const a = this.getConnectionConfiguration();
1045
- e !== void 0 && e !== a.displayName && (r = i.set("display_name", B(e)), this.updateConnectionConfiguration("displayName", e));
1048
+ e !== void 0 && e !== a.displayName && (r = i.set("display_name", X(e)), this.updateConnectionConfiguration("displayName", e));
1046
1049
  const o = r;
1047
1050
  o ? t(o) : s(new Error("nothing changed"));
1048
1051
  });
1049
1052
  disconnect = async () => {
1050
1053
  const e = new Promise((s) => {
1051
- this.events.once(u.DISCONNECTED, () => {
1054
+ this.events.once(A.DISCONNECTED, () => {
1052
1055
  s();
1053
1056
  });
1054
1057
  }), t = this.getUa();
1055
- return t ? t.stop() : this.events.trigger(u.DISCONNECTED, void 0), e.finally(() => {
1058
+ return t ? t.stop() : this.events.trigger(A.DISCONNECTED, void 0), e.finally(() => {
1056
1059
  this.setUa(void 0), this.stateMachine.reset();
1057
1060
  });
1058
1061
  };
1059
1062
  cancelRequests() {
1060
1063
  this.cancelConnectWithRepeatedCalls();
1061
1064
  }
1062
- connectWithDuplicatedCalls = async (e, { callLimit: t = Ae } = {}) => {
1065
+ connectWithDuplicatedCalls = async (e, { callLimit: t = ye } = {}) => {
1063
1066
  const s = async () => this.connectInner(e), i = (r) => {
1064
- const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), T = r != null && !de(r);
1065
- return c || T;
1067
+ const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = r != null && !pe(r);
1068
+ return c || g;
1066
1069
  };
1067
- return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = V({
1070
+ return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = Y({
1068
1071
  targetFunction: s,
1069
1072
  isComplete: i,
1070
1073
  callLimit: t,
@@ -1090,16 +1093,16 @@ class _e {
1090
1093
  sessionTimers: a,
1091
1094
  registerExpires: o,
1092
1095
  connectionRecoveryMinInterval: c,
1093
- connectionRecoveryMaxInterval: T,
1094
- userAgent: d,
1095
- displayName: l = "",
1096
- register: E = !1,
1096
+ connectionRecoveryMaxInterval: g,
1097
+ userAgent: E,
1098
+ displayName: u = "",
1099
+ register: d = !1,
1097
1100
  extraHeaders: S = []
1098
1101
  }) => {
1099
1102
  this.stateMachine.startInitUa(), this.setConnectionConfiguration({
1100
1103
  sipServerUrl: s,
1101
- displayName: l,
1102
- register: E,
1104
+ displayName: u,
1105
+ register: d,
1103
1106
  user: e,
1104
1107
  password: t
1105
1108
  }), this.getUa() && await this.disconnect();
@@ -1109,13 +1112,13 @@ class _e {
1109
1112
  password: t,
1110
1113
  sipServerUrl: s,
1111
1114
  sipWebSocketServerURL: i,
1112
- displayName: l,
1113
- register: E,
1115
+ displayName: u,
1116
+ register: d,
1114
1117
  sessionTimers: a,
1115
1118
  registerExpires: o,
1116
1119
  connectionRecoveryMinInterval: c,
1117
- connectionRecoveryMaxInterval: T,
1118
- userAgent: d,
1120
+ connectionRecoveryMaxInterval: g,
1121
+ userAgent: E,
1119
1122
  remoteAddress: r,
1120
1123
  extraHeaders: S
1121
1124
  },
@@ -1130,15 +1133,15 @@ class _e {
1130
1133
  return;
1131
1134
  }
1132
1135
  let i;
1133
- i = ((c, T) => {
1136
+ i = ((c, g) => {
1134
1137
  if (this.getConnectionConfiguration().register === !0)
1135
- return this.registrationManager.subscribeToStartEvents(c, T);
1136
- const l = u.CONNECTED, E = [u.DISCONNECTED];
1137
- return this.events.on(l, c), E.forEach((S) => {
1138
- this.events.on(S, T);
1138
+ return this.registrationManager.subscribeToStartEvents(c, g);
1139
+ const u = A.CONNECTED, d = [A.DISCONNECTED];
1140
+ return this.events.on(u, c), d.forEach((S) => {
1141
+ this.events.on(S, g);
1139
1142
  }), () => {
1140
- this.events.off(l, c), E.forEach((S) => {
1141
- this.events.off(S, T);
1143
+ this.events.off(u, c), d.forEach((S) => {
1144
+ this.events.off(S, g);
1142
1145
  });
1143
1146
  };
1144
1147
  })(() => {
@@ -1151,18 +1154,18 @@ class _e {
1151
1154
  this.cancelableConnectWithRepeatedCalls?.cancel();
1152
1155
  }
1153
1156
  }
1154
- var X = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(X || {});
1155
- const Re = j({
1157
+ var te = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(te || {});
1158
+ const be = ge({
1156
1159
  types: {
1157
1160
  context: {},
1158
1161
  events: {}
1159
1162
  },
1160
1163
  actions: {
1161
1164
  logTransition: (n, e) => {
1162
- m(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1165
+ O(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1163
1166
  },
1164
1167
  logStateChange: (n, e) => {
1165
- m("ConnectionStateMachine state changed", e.state);
1168
+ O("ConnectionStateMachine state changed", e.state);
1166
1169
  }
1167
1170
  }
1168
1171
  }).createMachine({
@@ -1466,14 +1469,14 @@ const Re = j({
1466
1469
  }
1467
1470
  }
1468
1471
  });
1469
- class Ie {
1472
+ class we {
1470
1473
  actor;
1471
1474
  stateChangeListeners = /* @__PURE__ */ new Set();
1472
1475
  events;
1473
1476
  unsubscribeFromEvents;
1474
1477
  actorSubscription;
1475
1478
  constructor(e) {
1476
- this.events = e, this.actor = Z(Re), this.actorSubscription = this.actor.subscribe((t) => {
1479
+ this.events = e, this.actor = de(be), this.actorSubscription = this.actor.subscribe((t) => {
1477
1480
  const s = t.value;
1478
1481
  this.stateChangeListeners.forEach((i) => {
1479
1482
  i(s);
@@ -1559,7 +1562,7 @@ class Ie {
1559
1562
  return this.actor.getSnapshot().can({ type: e });
1560
1563
  }
1561
1564
  getValidEvents() {
1562
- return Object.values(X).filter((e) => this.canTransition(e));
1565
+ return Object.values(te).filter((e) => this.canTransition(e));
1563
1566
  }
1564
1567
  hasState(e) {
1565
1568
  return this.actor.getSnapshot().matches(e);
@@ -1567,7 +1570,7 @@ class Ie {
1567
1570
  sendEvent(e) {
1568
1571
  const t = this.actor.getSnapshot(), s = { type: e };
1569
1572
  if (!t.can(s)) {
1570
- m(
1573
+ O(
1571
1574
  `Invalid transition: ${s.type} from ${this.state}. Event cannot be processed in current state.`
1572
1575
  );
1573
1576
  return;
@@ -1628,7 +1631,7 @@ class Ie {
1628
1631
  };
1629
1632
  }
1630
1633
  }
1631
- class Me {
1634
+ class Le {
1632
1635
  events;
1633
1636
  getUaProtected;
1634
1637
  constructor(e) {
@@ -1637,25 +1640,25 @@ class Me {
1637
1640
  async register() {
1638
1641
  const e = this.getUaProtected();
1639
1642
  return new Promise((t, s) => {
1640
- e.on(u.REGISTERED, t), e.on(u.REGISTRATION_FAILED, s), e.register();
1643
+ e.on(A.REGISTERED, t), e.on(A.REGISTRATION_FAILED, s), e.register();
1641
1644
  });
1642
1645
  }
1643
1646
  async unregister() {
1644
1647
  const e = this.getUaProtected();
1645
1648
  return new Promise((t) => {
1646
- e.on(u.UNREGISTERED, t), e.unregister();
1649
+ e.on(A.UNREGISTERED, t), e.unregister();
1647
1650
  });
1648
1651
  }
1649
1652
  async tryRegister() {
1650
1653
  try {
1651
1654
  await this.unregister();
1652
1655
  } catch (e) {
1653
- m("tryRegister", e);
1656
+ O("tryRegister", e);
1654
1657
  }
1655
1658
  return this.register();
1656
1659
  }
1657
1660
  subscribeToStartEvents(e, t) {
1658
- const s = u.REGISTERED, i = [u.REGISTRATION_FAILED, u.DISCONNECTED];
1661
+ const s = A.REGISTERED, i = [A.REGISTRATION_FAILED, A.DISCONNECTED];
1659
1662
  return this.events.on(s, e), i.forEach((r) => {
1660
1663
  this.events.on(r, t);
1661
1664
  }), () => {
@@ -1665,7 +1668,7 @@ class Me {
1665
1668
  };
1666
1669
  }
1667
1670
  }
1668
- class pe {
1671
+ class Fe {
1669
1672
  uaFactory;
1670
1673
  getUaProtected;
1671
1674
  constructor(e) {
@@ -1711,30 +1714,30 @@ class pe {
1711
1714
  extraHeaders: a
1712
1715
  }) {
1713
1716
  return new Promise((o, c) => {
1714
- const { configuration: T } = this.uaFactory.createConfiguration({
1717
+ const { configuration: g } = this.uaFactory.createConfiguration({
1715
1718
  sipWebSocketServerURL: i,
1716
1719
  displayName: t,
1717
1720
  userAgent: e,
1718
1721
  sipServerUrl: s
1719
- }), d = this.uaFactory.createUA({ ...T, remoteAddress: r, extraHeaders: a }), l = () => {
1722
+ }), E = this.uaFactory.createUA({ ...g, remoteAddress: r, extraHeaders: a }), u = () => {
1720
1723
  const S = new Error("Telephony is not available");
1721
1724
  c(S);
1722
1725
  };
1723
- d.once(u.DISCONNECTED, l);
1724
- const E = () => {
1725
- d.removeAllListeners(), d.once(u.DISCONNECTED, () => {
1726
+ E.once(A.DISCONNECTED, u);
1727
+ const d = () => {
1728
+ E.removeAllListeners(), E.once(A.DISCONNECTED, () => {
1726
1729
  o();
1727
- }), d.stop();
1730
+ }), E.stop();
1728
1731
  };
1729
- d.once(u.CONNECTED, E), d.start();
1732
+ E.once(A.CONNECTED, d), E.start();
1730
1733
  });
1731
1734
  }
1732
1735
  }
1733
- const Pe = (n) => {
1736
+ const $e = (n) => {
1734
1737
  const e = [];
1735
1738
  return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
1736
1739
  };
1737
- class P {
1740
+ class m {
1738
1741
  JsSIP;
1739
1742
  constructor(e) {
1740
1743
  this.JsSIP = e;
@@ -1759,10 +1762,10 @@ class P {
1759
1762
  throw new Error("user is required for authorized connection");
1760
1763
  }
1761
1764
  static resolveAuthorizationUser(e, t) {
1762
- return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${ie()}`;
1765
+ return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${ue()}`;
1763
1766
  }
1764
1767
  static buildExtraHeaders(e, t) {
1765
- const s = e !== void 0 && e !== "" ? Pe(e) : [];
1768
+ const s = e !== void 0 && e !== "" ? $e(e) : [];
1766
1769
  return t === void 0 ? s : [...s, ...t];
1767
1770
  }
1768
1771
  createConfiguration({
@@ -1775,31 +1778,31 @@ class P {
1775
1778
  sessionTimers: o = !1,
1776
1779
  registerExpires: c = 300,
1777
1780
  // 5 minutes in sec
1778
- connectionRecoveryMinInterval: T = 2,
1779
- connectionRecoveryMaxInterval: d = 6,
1780
- userAgent: l
1781
+ connectionRecoveryMinInterval: g = 2,
1782
+ connectionRecoveryMaxInterval: E = 6,
1783
+ userAgent: u
1781
1784
  }) {
1782
- P.validateConfiguration({
1785
+ m.validateConfiguration({
1783
1786
  register: a,
1784
1787
  password: t,
1785
1788
  user: e,
1786
1789
  sipServerUrl: r,
1787
1790
  sipWebSocketServerURL: s
1788
1791
  });
1789
- const E = P.resolveAuthorizationUser(a, e), S = ne(r), R = S(E), C = new this.JsSIP.WebSocketInterface(s);
1792
+ const d = m.resolveAuthorizationUser(a, e), S = Se(r), _ = S(d), C = new this.JsSIP.WebSocketInterface(s);
1790
1793
  return {
1791
1794
  configuration: {
1792
1795
  password: t,
1793
1796
  register: a,
1794
- uri: R,
1795
- display_name: B(i),
1796
- user_agent: l,
1797
+ uri: _,
1798
+ display_name: X(i),
1799
+ user_agent: u,
1797
1800
  sdpSemantics: "unified-plan",
1798
1801
  sockets: [C],
1799
1802
  session_timers: o,
1800
1803
  register_expires: c,
1801
- connection_recovery_min_interval: T,
1802
- connection_recovery_max_interval: d
1804
+ connection_recovery_min_interval: g,
1805
+ connection_recovery_max_interval: E
1803
1806
  },
1804
1807
  helpers: {
1805
1808
  socket: C,
@@ -1808,7 +1811,7 @@ class P {
1808
1811
  };
1809
1812
  }
1810
1813
  createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
1811
- const i = new this.JsSIP.UA(s), r = P.buildExtraHeaders(e, t);
1814
+ const i = new this.JsSIP.UA(s), r = m.buildExtraHeaders(e, t);
1812
1815
  return r.length > 0 && i.registrator().setExtraHeaders(r), i;
1813
1816
  }
1814
1817
  /**
@@ -1821,12 +1824,12 @@ class P {
1821
1824
  extraHeaders: e.extraHeaders
1822
1825
  });
1823
1826
  return t.eachTriggers((a, o) => {
1824
- const c = Q.find((T) => T === o);
1827
+ const c = Z.find((g) => g === o);
1825
1828
  c && r.on(c, a);
1826
1829
  }), { ua: r, helpers: i };
1827
1830
  }
1828
1831
  }
1829
- class me {
1832
+ class ke {
1830
1833
  events;
1831
1834
  ua;
1832
1835
  socket;
@@ -1838,15 +1841,15 @@ class me {
1838
1841
  configurationManager;
1839
1842
  JsSIP;
1840
1843
  constructor({ JsSIP: e }) {
1841
- this.JsSIP = e, this.events = new O(z), this.uaFactory = new P(e), this.registrationManager = new Me({
1844
+ this.JsSIP = e, this.events = new f(ee), this.uaFactory = new m(e), this.registrationManager = new Le({
1842
1845
  events: this.events,
1843
1846
  getUaProtected: this.getUaProtected
1844
- }), this.stateMachine = new Ie(this.events), this.configurationManager = new ue({
1847
+ }), this.stateMachine = new we(this.events), this.configurationManager = new ve({
1845
1848
  getUa: this.getUa
1846
- }), this.sipOperations = new pe({
1849
+ }), this.sipOperations = new Fe({
1847
1850
  uaFactory: this.uaFactory,
1848
1851
  getUaProtected: this.getUaProtected
1849
- }), this.connectionFlow = new _e({
1852
+ }), this.connectionFlow = new Ue({
1850
1853
  JsSIP: this.JsSIP,
1851
1854
  events: this.events,
1852
1855
  uaFactory: this.uaFactory,
@@ -1884,7 +1887,7 @@ class me {
1884
1887
  return this.stateMachine.state;
1885
1888
  }
1886
1889
  get isRegistered() {
1887
- return P.isRegisteredUA(this.ua);
1890
+ return m.isRegisteredUA(this.ua);
1888
1891
  }
1889
1892
  get isRegisterConfig() {
1890
1893
  return this.configurationManager.isRegister();
@@ -1928,7 +1931,7 @@ class me {
1928
1931
  destroy() {
1929
1932
  this.stateMachine.destroy();
1930
1933
  }
1931
- // eslint-disable-next-line class-methods-use-this
1934
+ // eslint-disable-next-line @typescript-eslint/class-methods-use-this
1932
1935
  getSipServerUrl = (e) => e;
1933
1936
  getUaProtected = () => {
1934
1937
  if (!this.ua)
@@ -1937,19 +1940,19 @@ class me {
1937
1940
  };
1938
1941
  getUa = () => this.ua;
1939
1942
  }
1940
- var D = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(D || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
1941
- const J = [
1943
+ var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {}), V = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(V || {});
1944
+ const ne = [
1942
1945
  "incomingCall",
1943
1946
  "declinedIncomingCall",
1944
1947
  "terminatedIncomingCall",
1945
1948
  "failedIncomingCall"
1946
- ], Oe = 486, fe = 487;
1947
- class De {
1949
+ ], We = 486, Ve = 487;
1950
+ class Be {
1948
1951
  events;
1949
1952
  incomingRTCSession;
1950
1953
  connectionManager;
1951
1954
  constructor(e) {
1952
- this.connectionManager = e, this.events = new O(J), this.start();
1955
+ this.connectionManager = e, this.events = new f(ne), this.start();
1953
1956
  }
1954
1957
  get remoteCallerData() {
1955
1958
  return {
@@ -1979,19 +1982,19 @@ class De {
1979
1982
  return this.removeIncomingSession(), e;
1980
1983
  };
1981
1984
  async declineToIncomingCall({
1982
- statusCode: e = fe
1985
+ statusCode: e = Ve
1983
1986
  } = {}) {
1984
1987
  return new Promise((t, s) => {
1985
1988
  try {
1986
1989
  const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
1987
- this.removeIncomingSession(), this.events.trigger(D.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
1990
+ this.removeIncomingSession(), this.events.trigger(U.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
1988
1991
  } catch (i) {
1989
1992
  s(i);
1990
1993
  }
1991
1994
  });
1992
1995
  }
1993
1996
  async busyIncomingCall() {
1994
- return this.declineToIncomingCall({ statusCode: Oe });
1997
+ return this.declineToIncomingCall({ statusCode: We });
1995
1998
  }
1996
1999
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
1997
2000
  on(e, t) {
@@ -2022,40 +2025,311 @@ class De {
2022
2025
  originator: e,
2023
2026
  session: t
2024
2027
  }) => {
2025
- e === $.REMOTE && this.setIncomingSession(t);
2028
+ e === V.REMOTE && this.setIncomingSession(t);
2026
2029
  };
2027
2030
  setIncomingSession(e) {
2028
2031
  this.incomingRTCSession = e;
2029
2032
  const t = this.remoteCallerData;
2030
2033
  e.on("failed", (s) => {
2031
- this.removeIncomingSession(), s.originator === $.LOCAL ? this.events.trigger(D.TERMINATED_INCOMING_CALL, t) : this.events.trigger(D.FAILED_INCOMING_CALL, t);
2032
- }), this.events.trigger(D.INCOMING_CALL, t);
2034
+ this.removeIncomingSession(), s.originator === V.LOCAL ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
2035
+ }), this.events.trigger(U.INCOMING_CALL, t);
2033
2036
  }
2034
2037
  removeIncomingSession() {
2035
2038
  delete this.incomingRTCSession;
2036
2039
  }
2037
2040
  }
2038
- const ve = z.map((n) => `connection:${n}`), ye = G.map((n) => `call:${n}`), Ue = q.map((n) => `api:${n}`), be = J.map((n) => `incoming-call:${n}`), we = Y.map((n) => `presentation:${n}`), Le = [
2039
- ...ve,
2040
- ...ye,
2041
- ...Ue,
2042
- ...be,
2043
- ...we
2041
+ const v = 1e3;
2042
+ var l = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(l || {});
2043
+ const se = ["collected"], q = () => "performance" in window ? performance.now() : Date.now(), b = (n) => [...n.keys()].reduce((e, t) => {
2044
+ const s = n.get(t);
2045
+ return s === void 0 ? e : { ...e, [s.type]: s };
2046
+ }, {}), He = (n) => {
2047
+ if (!n)
2048
+ return {
2049
+ outboundRtp: void 0,
2050
+ codec: void 0,
2051
+ mediaSource: void 0,
2052
+ remoteInboundRtp: void 0
2053
+ };
2054
+ const e = b(n);
2055
+ return {
2056
+ outboundRtp: e[l.OUTBOUND_RTP],
2057
+ codec: e[l.CODEC],
2058
+ mediaSource: e[l.MEDIA_SOURCE],
2059
+ remoteInboundRtp: e[l.REMOTE_INBOUND_RTP]
2060
+ };
2061
+ }, G = (n) => {
2062
+ if (!n)
2063
+ return {
2064
+ outboundRtp: void 0,
2065
+ codec: void 0,
2066
+ mediaSource: void 0,
2067
+ remoteInboundRtp: void 0
2068
+ };
2069
+ const e = b(n);
2070
+ return {
2071
+ outboundRtp: e[l.OUTBOUND_RTP],
2072
+ codec: e[l.CODEC],
2073
+ mediaSource: e[l.MEDIA_SOURCE],
2074
+ remoteInboundRtp: e[l.REMOTE_INBOUND_RTP]
2075
+ };
2076
+ }, x = ({
2077
+ videoReceiversStats: n,
2078
+ synchronizationSourcesVideo: e
2079
+ }) => {
2080
+ if (!n)
2081
+ return {
2082
+ inboundRtp: void 0,
2083
+ codec: void 0,
2084
+ synchronizationSources: e
2085
+ };
2086
+ const t = b(n);
2087
+ return {
2088
+ inboundRtp: t[l.INBOUND_RTP],
2089
+ codec: t[l.CODEC],
2090
+ synchronizationSources: e
2091
+ };
2092
+ }, qe = ({
2093
+ audioReceiverStats: n,
2094
+ synchronizationSourcesAudio: e
2095
+ }) => {
2096
+ if (!n)
2097
+ return {
2098
+ inboundRtp: void 0,
2099
+ codec: void 0,
2100
+ remoteOutboundRtp: void 0,
2101
+ synchronizationSources: e
2102
+ };
2103
+ const t = b(n);
2104
+ return {
2105
+ inboundRtp: t[l.INBOUND_RTP],
2106
+ codec: t[l.CODEC],
2107
+ remoteOutboundRtp: t[l.REMOTE_OUTBOUND_RTP],
2108
+ synchronizationSources: e
2109
+ };
2110
+ }, ie = (n) => {
2111
+ if (!n)
2112
+ return {
2113
+ candidatePair: void 0,
2114
+ certificate: void 0,
2115
+ localCandidate: void 0,
2116
+ remoteCandidate: void 0,
2117
+ transport: void 0
2118
+ };
2119
+ const e = b(n);
2120
+ return {
2121
+ candidatePair: e[l.CANDIDATE_PAIR],
2122
+ certificate: e[l.CERTIFICATE],
2123
+ localCandidate: e[l.LOCAL_CANDIDATE],
2124
+ remoteCandidate: e[l.REMOTE_CANDIDATE],
2125
+ transport: e[l.TRANSPORT]
2126
+ };
2127
+ }, Ge = ({
2128
+ audioSenderStats: n,
2129
+ videoSenderFirstStats: e,
2130
+ videoSenderSecondStats: t
2131
+ }) => ({
2132
+ video: G(e),
2133
+ secondVideo: G(t),
2134
+ audio: He(n),
2135
+ additional: ie(
2136
+ n ?? e ?? t
2137
+ )
2138
+ }), xe = ({
2139
+ audioReceiverStats: n,
2140
+ videoReceiverFirstStats: e,
2141
+ videoReceiverSecondStats: t,
2142
+ synchronizationSources: s
2143
+ }) => ({
2144
+ video: x({
2145
+ videoReceiversStats: e,
2146
+ synchronizationSourcesVideo: s.video
2147
+ }),
2148
+ secondVideo: x({
2149
+ videoReceiversStats: t,
2150
+ synchronizationSourcesVideo: s.video
2151
+ }),
2152
+ audio: qe({
2153
+ audioReceiverStats: n,
2154
+ synchronizationSourcesAudio: s.audio
2155
+ }),
2156
+ additional: ie(
2157
+ n ?? e ?? t
2158
+ )
2159
+ }), Ye = ({
2160
+ audioSenderStats: n,
2161
+ videoSenderFirstStats: e,
2162
+ videoSenderSecondStats: t,
2163
+ audioReceiverStats: s,
2164
+ videoReceiverFirstStats: i,
2165
+ videoReceiverSecondStats: r,
2166
+ synchronizationSources: a
2167
+ }) => {
2168
+ const o = Ge({
2169
+ audioSenderStats: n,
2170
+ videoSenderFirstStats: e,
2171
+ videoSenderSecondStats: t
2172
+ }), c = xe({
2173
+ audioReceiverStats: s,
2174
+ videoReceiverFirstStats: i,
2175
+ videoReceiverSecondStats: r,
2176
+ synchronizationSources: a
2177
+ });
2178
+ return {
2179
+ outbound: o,
2180
+ inbound: c
2181
+ };
2182
+ }, ze = async (n) => {
2183
+ const e = "audio", t = "video", s = n.getSenders(), i = s.find((d) => d.track?.kind === e), r = s.filter((d) => d.track?.kind === t), a = n.getReceivers(), o = a.find((d) => d.track.kind === e), c = a.filter((d) => d.track.kind === t), g = {
2184
+ trackIdentifier: o?.track.id,
2185
+ item: o?.getSynchronizationSources()[0]
2186
+ }, E = {
2187
+ trackIdentifier: c[0]?.track.id,
2188
+ item: c[0]?.getSynchronizationSources()[0]
2189
+ }, u = {
2190
+ audio: g,
2191
+ video: E
2192
+ };
2193
+ return Promise.all([
2194
+ i?.getStats(),
2195
+ r[0]?.getStats(),
2196
+ r[1]?.getStats(),
2197
+ o?.getStats(),
2198
+ c[0]?.getStats(),
2199
+ c[1]?.getStats()
2200
+ ]).then((d) => {
2201
+ const [
2202
+ S,
2203
+ _,
2204
+ C,
2205
+ p,
2206
+ D,
2207
+ re
2208
+ ] = d;
2209
+ return {
2210
+ synchronizationSources: u,
2211
+ audioSenderStats: S,
2212
+ videoSenderFirstStats: _,
2213
+ videoSenderSecondStats: C,
2214
+ audioReceiverStats: p,
2215
+ videoReceiverFirstStats: D,
2216
+ videoReceiverSecondStats: re
2217
+ };
2218
+ });
2219
+ }, Qe = (n) => {
2220
+ O(String(n));
2221
+ };
2222
+ class Xe {
2223
+ events;
2224
+ setTimeoutRequest;
2225
+ requesterAllStatistics = new oe(ze);
2226
+ constructor() {
2227
+ this.events = new ae(se), this.setTimeoutRequest = new Te();
2228
+ }
2229
+ get requested() {
2230
+ return this.setTimeoutRequest.requested;
2231
+ }
2232
+ start(e, {
2233
+ interval: t = v,
2234
+ onError: s = Qe
2235
+ } = {}) {
2236
+ const i = this.resolveCollectStatistics(e, {
2237
+ onError: s
2238
+ });
2239
+ this.stop(), this.setTimeoutRequest.request(i, t);
2240
+ }
2241
+ stop() {
2242
+ this.setTimeoutRequest.cancelRequest(), this.requesterAllStatistics.cancelRequest();
2243
+ }
2244
+ on(e, t) {
2245
+ return this.events.on(e, t);
2246
+ }
2247
+ once(e, t) {
2248
+ return this.events.once(e, t);
2249
+ }
2250
+ onceRace(e, t) {
2251
+ return this.events.onceRace(e, t);
2252
+ }
2253
+ async wait(e) {
2254
+ return this.events.wait(e);
2255
+ }
2256
+ off(e, t) {
2257
+ this.events.off(e, t);
2258
+ }
2259
+ resolveCollectStatistics = (e, {
2260
+ onError: t
2261
+ }) => () => {
2262
+ const s = q();
2263
+ this.requesterAllStatistics.request(e).then((i) => {
2264
+ this.events.trigger("collected", Ye(i));
2265
+ const a = q() - s;
2266
+ let o = v;
2267
+ a > 48 ? o = v * 4 : a > 32 ? o = v * 3 : a > 16 && (o = v * 2), this.start(e, {
2268
+ onError: t,
2269
+ interval: o
2270
+ });
2271
+ }).catch((i) => {
2272
+ t && t(i);
2273
+ });
2274
+ };
2275
+ }
2276
+ class Je {
2277
+ statsPeerConnection;
2278
+ callManager;
2279
+ constructor({ callManager: e }) {
2280
+ this.callManager = e, this.statsPeerConnection = new Xe(), this.subscribe();
2281
+ }
2282
+ get events() {
2283
+ return this.statsPeerConnection.events;
2284
+ }
2285
+ on(e, t) {
2286
+ return this.statsPeerConnection.on(e, t);
2287
+ }
2288
+ once(e, t) {
2289
+ return this.statsPeerConnection.once(e, t);
2290
+ }
2291
+ onceRace(e, t) {
2292
+ return this.statsPeerConnection.onceRace(e, t);
2293
+ }
2294
+ async wait(e) {
2295
+ return this.statsPeerConnection.wait(e);
2296
+ }
2297
+ off(e, t) {
2298
+ this.statsPeerConnection.off(e, t);
2299
+ }
2300
+ subscribe() {
2301
+ this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
2302
+ }
2303
+ handleStarted = (e) => {
2304
+ this.statsPeerConnection.start(e);
2305
+ };
2306
+ handleEnded = () => {
2307
+ this.statsPeerConnection.stop();
2308
+ };
2309
+ }
2310
+ const je = ee.map((n) => `connection:${n}`), Ke = Q.map((n) => `call:${n}`), Ze = j.map((n) => `api:${n}`), et = ne.map((n) => `incoming-call:${n}`), tt = K.map((n) => `presentation:${n}`), nt = se.map((n) => `stats:${n}`), st = [
2311
+ ...je,
2312
+ ...Ke,
2313
+ ...Ze,
2314
+ ...et,
2315
+ ...tt,
2316
+ ...nt
2044
2317
  ];
2045
- class xe {
2318
+ class lt {
2046
2319
  events;
2047
2320
  connectionManager;
2048
2321
  callManager;
2049
2322
  apiManager;
2050
2323
  incomingCallManager;
2051
2324
  presentationManager;
2325
+ statsManager;
2052
2326
  constructor({ JsSIP: e }) {
2053
- this.events = new O(Le), this.connectionManager = new me({ JsSIP: e }), this.callManager = new ge(), this.apiManager = new le({
2327
+ this.events = new f(st), this.connectionManager = new ke({ JsSIP: e }), this.callManager = new _e(), this.apiManager = new me({
2054
2328
  connectionManager: this.connectionManager,
2055
2329
  callManager: this.callManager
2056
- }), this.incomingCallManager = new De(this.connectionManager), this.presentationManager = new Ne({
2330
+ }), this.incomingCallManager = new Be(this.connectionManager), this.presentationManager = new De({
2057
2331
  callManager: this.callManager
2058
- }), this.subscribe();
2332
+ }), this.statsManager = new Je({ callManager: this.callManager }), this.subscribe();
2059
2333
  }
2060
2334
  get requestedConnection() {
2061
2335
  return this.connectionManager.requested;
@@ -2156,7 +2430,7 @@ class xe {
2156
2430
  async stopPresentation(e = {}) {
2157
2431
  const { isP2P: t } = e;
2158
2432
  return this.presentationManager.stopPresentation(async () => {
2159
- t === !0 ? await this.apiManager.sendMustStopPresentationP2P() : await this.apiManager.sendStoppedPresentation();
2433
+ await (t === !0 ? this.apiManager.sendMustStopPresentationP2P() : this.apiManager.sendStoppedPresentation());
2160
2434
  });
2161
2435
  }
2162
2436
  async updatePresentation(e, t = {}) {
@@ -2232,17 +2506,24 @@ class xe {
2232
2506
  this.presentationManager.on(t, (s) => {
2233
2507
  this.events.trigger(`presentation:${t}`, s);
2234
2508
  });
2509
+ }), this.statsManager.events.eachTriggers((e, t) => {
2510
+ this.statsManager.on(t, (s) => {
2511
+ this.events.trigger(`stats:${t}`, s);
2512
+ });
2235
2513
  });
2236
2514
  }
2237
2515
  }
2238
2516
  export {
2239
- x as E,
2240
- b as O,
2241
- xe as S,
2242
- f as a,
2243
- Se as b,
2244
- Ge as d,
2245
- He as e,
2246
- Be as h,
2247
- m as l
2517
+ J as E,
2518
+ $ as O,
2519
+ lt as S,
2520
+ y as a,
2521
+ Oe as b,
2522
+ l as c,
2523
+ Et as d,
2524
+ ht as e,
2525
+ Xe as f,
2526
+ St as h,
2527
+ O as l,
2528
+ w as p
2248
2529
  };