sip-connector 9.0.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,109 +1,113 @@
1
- import { l as o, B as V, N as x, E as P, s as q, S as ze } from "./SipConnector-DagL4rCl.js";
2
- import { f as an, g as cn, i as un, c as ln, a as Sn, d as mn, b as dn, e as fn, h as Cn } from "./SipConnector-DagL4rCl.js";
3
- import { debounce as z } from "ts-debounce";
4
- import { isCanceledError as J } from "@krivega/cancelable-promise";
5
- import { hasCanceledError as Q } from "repeated-calls";
6
- import { sequentPromises as Z } from "sequent-promises";
7
- import { createStackPromises as ee } from "stack-promises";
8
- import { default as Rn } from "debug";
9
- const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), ne = ({ kind: e, readyState: t }) => e === "video" && t === "live", X = (e) => ({ track: t }) => {
10
- ne(t) && e();
11
- }, D = ({
1
+ import { l as o, B as x, N as $, E as B, s as z, S as Je } from "./SipConnector-Eb3K8Ixo.js";
2
+ import { f as cn, g as un, i as ln, c as Sn, a as mn, d as dn, b as fn, e as Cn, h as gn } from "./SipConnector-Eb3K8Ixo.js";
3
+ import { debounce as J } from "ts-debounce";
4
+ import { isCanceledError as Q } from "@krivega/cancelable-promise";
5
+ import { hasCanceledError as Z } from "repeated-calls";
6
+ import { sequentPromises as ee } from "sequent-promises";
7
+ import { createStackPromises as ne } from "stack-promises";
8
+ import { default as En } from "debug";
9
+ const X = "purgatory", A = (e) => e === X, D = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), te = ({ kind: e, readyState: t }) => e === "video" && t === "live", H = (e) => ({ track: t }) => {
10
+ te(t) && e();
11
+ }, F = ({
12
12
  getRemoteStreams: e,
13
13
  setRemoteStreams: t
14
- }) => z(() => {
14
+ }) => J(() => {
15
15
  const n = e();
16
16
  o("remoteStreams", n), n && t(n);
17
- }, 200), te = (e) => async (n) => {
17
+ }, 200), re = (e) => async (n) => {
18
18
  const {
19
19
  mediaStream: r,
20
20
  extraHeaders: s,
21
21
  iceServers: a,
22
22
  degradationPreference: c,
23
- setRemoteStreams: i,
24
- onBeforeProgressCall: l,
25
- onSuccessProgressCall: d,
26
- onEnterPurgatory: f,
23
+ contentHint: i,
24
+ setRemoteStreams: l,
25
+ onBeforeProgressCall: d,
26
+ onSuccessProgressCall: f,
27
+ onEnterPurgatory: m,
27
28
  onEnterConference: S,
28
- onFailProgressCall: m,
29
- onFinishProgressCall: T,
30
- onEndedCall: C
31
- } = n, R = D({
32
- setRemoteStreams: i,
33
- getRemoteStreams: w(e)
34
- }), y = X(R);
29
+ onFailProgressCall: g,
30
+ onFinishProgressCall: C,
31
+ onEndedCall: E
32
+ } = n, M = F({
33
+ setRemoteStreams: l,
34
+ getRemoteStreams: D(e)
35
+ }), b = H(M);
35
36
  o("answerIncomingCall", n);
36
- const b = async () => e.answerToIncomingCall({
37
+ const _ = async () => e.answerToIncomingCall({
37
38
  mediaStream: r,
38
39
  extraHeaders: s,
39
40
  iceServers: a,
41
+ contentHint: i,
40
42
  degradationPreference: c,
41
- ontrack: y
42
- }), _ = () => {
43
+ ontrack: b
44
+ }), p = () => {
43
45
  const { remoteCallerData: u } = e;
44
46
  return u.incomingNumber;
45
47
  };
46
- let E = !1, M;
47
- const h = (o("subscribeEnterConference: onEnterConference", S), f ?? S ? e.onSession("enterRoom", (u) => {
48
- o("enterRoom", { _room: u, isSuccessProgressCall: E }), M = u, A(M) ? f && f() : S && S({ isSuccessProgressCall: E });
48
+ let T = !1, y;
49
+ const h = (o("subscribeEnterConference: onEnterConference", S), m ?? S ? e.onSession("enterRoom", (u) => {
50
+ o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? m && m() : S && S({ isSuccessProgressCall: T });
49
51
  }) : () => {
50
- }), p = (u) => (o("onSuccess"), E = !0, R(), d && d({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
51
- h(), C && C();
52
- }), u), O = (u) => {
53
- throw o("onFail"), m && m(), h(), u;
54
- }, v = () => {
55
- o("onFinish"), T && T();
52
+ }), O = (u) => (o("onSuccess"), T = !0, M(), f && f({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
53
+ h(), E && E();
54
+ }), u), v = (u) => {
55
+ throw o("onFail"), g && g(), h(), u;
56
+ }, P = () => {
57
+ o("onFinish"), C && C();
56
58
  };
57
- if (o("onBeforeProgressCall"), l) {
58
- const u = _();
59
- l(u);
59
+ if (o("onBeforeProgressCall"), d) {
60
+ const u = p();
61
+ d(u);
60
62
  }
61
- return b().then(p).catch((u) => O(u)).finally(v);
62
- }, re = (e) => async (n) => {
63
+ return _().then(O).catch((u) => v(u)).finally(P);
64
+ }, se = (e) => async (n) => {
63
65
  const {
64
66
  conference: r,
65
67
  mediaStream: s,
66
68
  extraHeaders: a,
67
69
  iceServers: c,
68
70
  degradationPreference: i,
69
- setRemoteStreams: l,
70
- onBeforeProgressCall: d,
71
- onSuccessProgressCall: f,
71
+ contentHint: l,
72
+ setRemoteStreams: d,
73
+ onBeforeProgressCall: f,
74
+ onSuccessProgressCall: m,
72
75
  onEnterPurgatory: S,
73
- onEnterConference: m,
74
- onFailProgressCall: T,
75
- onFinishProgressCall: C,
76
- onEndedCall: R
77
- } = n, y = D({
78
- setRemoteStreams: l,
79
- getRemoteStreams: w(e)
80
- }), b = X(y);
76
+ onEnterConference: g,
77
+ onFailProgressCall: C,
78
+ onFinishProgressCall: E,
79
+ onEndedCall: M
80
+ } = n, b = F({
81
+ setRemoteStreams: d,
82
+ getRemoteStreams: D(e)
83
+ }), _ = H(b);
81
84
  o("callToServer", n);
82
- const _ = async () => (o("startCall"), e.call({
85
+ const p = async () => (o("startCall"), e.call({
83
86
  mediaStream: s,
84
87
  extraHeaders: a,
85
88
  iceServers: c,
86
89
  degradationPreference: i,
90
+ contentHint: l,
87
91
  number: r,
88
- ontrack: b
92
+ ontrack: _
89
93
  }));
90
- let E = !1, M;
91
- const h = (o("subscribeEnterConference: onEnterConference", m), S ?? m ? e.onSession("enterRoom", ({ room: u }) => {
92
- o("enterRoom", { _room: u, isSuccessProgressCall: E }), M = u, A(M) ? S && S() : m && m({ isSuccessProgressCall: E });
94
+ let T = !1, y;
95
+ const h = (o("subscribeEnterConference: onEnterConference", g), S ?? g ? e.onSession("enterRoom", ({ room: u }) => {
96
+ o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? S && S() : g && g({ isSuccessProgressCall: T });
93
97
  }) : () => {
94
- }), p = (u) => (o("onSuccess"), E = !0, y(), f && f({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
95
- h(), R && R();
96
- }), u), O = (u) => {
97
- throw o("onFail"), T && T(), h(), u;
98
- }, v = () => {
99
- o("onFinish"), C && C();
98
+ }), O = (u) => (o("onSuccess"), T = !0, b(), m && m({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
99
+ h(), M && M();
100
+ }), u), v = (u) => {
101
+ throw o("onFail"), C && C(), h(), u;
102
+ }, P = () => {
103
+ o("onFinish"), E && E();
100
104
  };
101
- return o("onBeforeProgressCall"), d && d(r), _().then(p).catch((u) => O(u)).finally(v);
102
- }, B = (e) => {
103
- if (!J(e) && !Q(e))
105
+ return o("onBeforeProgressCall"), f && f(r), p().then(O).catch((u) => v(u)).finally(P);
106
+ }, I = (e) => {
107
+ if (!Q(e) && !Z(e))
104
108
  throw e;
105
109
  return { isSuccessful: !1 };
106
- }, se = (e) => async (n) => {
110
+ }, oe = (e) => async (n) => {
107
111
  const {
108
112
  userAgent: r,
109
113
  sipWebSocketServerURL: s,
@@ -113,7 +117,7 @@ const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams
113
117
  name: l,
114
118
  password: d,
115
119
  isRegisteredUser: f,
116
- isDisconnectOnFail: S
120
+ isDisconnectOnFail: m
117
121
  } = n;
118
122
  return o("connectToServer", n), e.connect({
119
123
  userAgent: r,
@@ -124,14 +128,14 @@ const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams
124
128
  password: d,
125
129
  user: l,
126
130
  register: f
127
- }).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m), S === !0 ? e.disconnect().then(() => B(m)).catch(() => B(m)) : B(m)));
128
- }, oe = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), F = (e) => {
131
+ }).then((S) => (o("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (o("connectToServer catch: error", S), m === !0 ? e.disconnect().then(() => I(S)).catch(() => I(S)) : I(S)));
132
+ }, ae = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), k = (e) => {
129
133
  const { url: t, cause: n } = e;
130
134
  let r = t;
131
- return (n === V || n === x) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
135
+ return (n === x || n === $) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
132
136
  };
133
137
  var W = /* @__PURE__ */ ((e) => (e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e))(W || {});
134
- const ae = (e = new Error()) => {
138
+ const ce = (e = new Error()) => {
135
139
  var s;
136
140
  const { cause: t, socket: n } = e;
137
141
  let r = "CONNECT_SERVER_FAILED";
@@ -140,19 +144,19 @@ const ae = (e = new Error()) => {
140
144
  r = "WRONG_USER_OR_PASSWORD";
141
145
  break;
142
146
  }
143
- case V: {
147
+ case x: {
144
148
  r = "BAD_MEDIA_ERROR";
145
149
  break;
146
150
  }
147
- case x: {
151
+ case $: {
148
152
  r = "NOT_FOUND_ERROR";
149
153
  break;
150
154
  }
151
155
  default:
152
- n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" : F(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
156
+ n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" : k(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
153
157
  }
154
158
  return r;
155
- }, ce = (e) => {
159
+ }, ie = (e) => {
156
160
  let t = "";
157
161
  try {
158
162
  t = JSON.stringify(e);
@@ -160,16 +164,16 @@ const ae = (e = new Error()) => {
160
164
  o("failed to stringify message", n);
161
165
  }
162
166
  return t;
163
- }, ie = (e = new Error()) => {
164
- const { code: t, cause: n, message: r } = e, s = F(e), a = { code: "", cause: "", message: "" };
165
- return typeof r == "object" && r !== null ? a.message = ce(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
166
- }, ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
167
+ }, ue = (e = new Error()) => {
168
+ const { code: t, cause: n, message: r } = e, s = k(e), a = { code: "", cause: "", message: "" };
169
+ return typeof r == "object" && r !== null ? a.message = ie(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
170
+ }, le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
167
171
  __proto__: null,
168
172
  EErrorTypes: W,
169
- getLinkError: F,
170
- getTypeFromError: ae,
171
- getValuesFromError: ie
172
- }, Symbol.toStringTag, { value: "Module" })), le = ({
173
+ getLinkError: k,
174
+ getTypeFromError: ce,
175
+ getValuesFromError: ue
176
+ }, Symbol.toStringTag, { value: "Module" })), Se = ({
173
177
  sessionId: e,
174
178
  remoteAddress: t,
175
179
  isMutedAudio: n,
@@ -179,43 +183,43 @@ const ae = (e = new Error()) => {
179
183
  }) => {
180
184
  const c = [], i = n ? "0" : "1", l = r ? "0" : "1";
181
185
  return c.push(`X-Vinteo-Mic-State: ${i}`, `X-Vinteo-MainCam-State: ${l}`), s || c.push("X-Vinteo-Purgatory-Call: yes"), e && c.push(`X-Vinteo-Session: ${e}`), a && c.push("X-Vinteo-Presentation-Call: yes"), t && c.push(`X-Vinteo-Remote: ${t}`), c;
182
- }, Se = "[@*!|]", me = "_", de = (e) => {
186
+ }, me = "[@*!|]", de = "_", fe = (e) => {
183
187
  let t = e;
184
- return t = t.replaceAll(new RegExp(Se, "g"), me), t;
185
- }, fe = ({
188
+ return t = t.replaceAll(new RegExp(me, "g"), de), t;
189
+ }, Ce = ({
186
190
  appName: e,
187
191
  appVersion: t,
188
192
  browserName: n,
189
193
  browserVersion: r
190
194
  }) => {
191
- const a = `${de(e)} ${t}`;
195
+ const a = `${fe(e)} ${t}`;
192
196
  return `ChromeNew - ${n ? `${n} ${r}, ${a}` : a}`;
193
- }, Ce = ({
197
+ }, ge = ({
194
198
  isUnifiedSdpSemantic: e,
195
199
  appVersion: t,
196
200
  browserName: n,
197
201
  browserVersion: r,
198
202
  appName: s
199
- }) => e ? fe({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", ge = (e) => async () => {
203
+ }) => e ? Ce({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", Re = (e) => async () => {
200
204
  if (e.isCallActive)
201
205
  return o("askPermissionToEnableCam"), e.askPermissionToEnableCam();
202
- }, Re = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Ee = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), Me = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), Te = (e) => async ({
206
+ }, Ee = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Me = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), Te = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), ye = (e) => async ({
203
207
  isEnabledCam: n,
204
208
  isEnabledMic: r
205
209
  }) => {
206
210
  if (e.isCallActive)
207
211
  return o("sendMediaState"), e.sendMediaState({ cam: n, mic: r });
208
- }, ye = (e) => async () => {
212
+ }, he = (e) => async () => {
209
213
  if (e.isCallActive)
210
214
  return o("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
211
215
  o("sendRefusalToTurnOnCam: error", n);
212
216
  });
213
- }, he = (e) => async () => {
217
+ }, be = (e) => async () => {
214
218
  if (e.isCallActive)
215
219
  return o("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
216
220
  o("sendRefusalToTurnOnMic: error", n);
217
221
  });
218
- }, be = (e) => async ({
222
+ }, _e = (e) => async ({
219
223
  mediaStream: n,
220
224
  isP2P: r,
221
225
  maxBitrate: s,
@@ -230,11 +234,11 @@ const ae = (e = new Error()) => {
230
234
  contentHint: c
231
235
  },
232
236
  i
233
- )), _e = (e) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
237
+ )), pe = (e) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
234
238
  isP2P: n
235
239
  }).catch((r) => {
236
240
  o(r);
237
- })), pe = (e) => async ({
241
+ })), Oe = (e) => async ({
238
242
  mediaStream: n,
239
243
  isP2P: r,
240
244
  maxBitrate: s,
@@ -245,21 +249,21 @@ const ae = (e = new Error()) => {
245
249
  maxBitrate: s,
246
250
  degradationPreference: a,
247
251
  contentHint: c
248
- })), Oe = (e) => (t) => [...t].map((r) => async () => e(r)), ve = async ({
252
+ })), ve = (e) => (t) => [...t].map((r) => async () => e(r)), Ae = async ({
249
253
  accumulatedKeys: e,
250
254
  sendKey: t,
251
255
  canRunTask: n
252
256
  }) => {
253
- const s = Oe(t)(e);
254
- return Z(s, n);
255
- }, Ae = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Ne = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Pe = (e) => (n) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), Be = (e) => (n) => (o("onStopMic"), e.onSession("admin-stop-mic", n)), Ie = ({ sipConnector: e }) => {
256
- const t = (C, R) => ({ isSyncForced: y = !1 }) => {
257
- if (y) {
257
+ const s = ve(t)(e);
258
+ return ee(s, n);
259
+ }, Ne = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Pe = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Be = (e) => (n) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), Ie = (e) => (n) => (o("onStopMic"), e.onSession("admin-stop-mic", n)), we = ({ sipConnector: e }) => {
260
+ const t = (C, E) => ({ isSyncForced: M = !1 }) => {
261
+ if (M) {
258
262
  C();
259
263
  return;
260
264
  }
261
- R();
262
- }, n = Ae(e), r = Pe(e), s = Ne(e), a = Be(e);
265
+ E();
266
+ }, n = Ne(e), r = Be(e), s = Pe(e), a = Ie(e);
263
267
  let c = () => {
264
268
  }, i = () => {
265
269
  }, l = () => {
@@ -267,29 +271,29 @@ const ae = (e = new Error()) => {
267
271
  };
268
272
  const f = ({
269
273
  onStartMainCamForced: C,
270
- onStartMainCamNotForced: R,
271
- onStopMainCamForced: y,
274
+ onStartMainCamNotForced: E,
275
+ onStopMainCamForced: M,
272
276
  onStopMainCamNotForced: b,
273
277
  onStartMicForced: _,
274
- onStartMicNotForced: E,
275
- onStopMicForced: M,
276
- onStopMicNotForced: N
278
+ onStartMicNotForced: p,
279
+ onStopMicForced: T,
280
+ onStopMicNotForced: y
277
281
  }) => {
278
- const h = t(
282
+ const N = t(
279
283
  C,
280
- R
284
+ E
281
285
  );
282
- c = n(h);
283
- const p = t(
284
- y,
286
+ c = n(N);
287
+ const h = t(
288
+ M,
285
289
  b
286
290
  );
287
- i = r(p);
288
- const O = t(_, E);
291
+ i = r(h);
292
+ const O = t(_, p);
289
293
  l = s(O);
290
- const v = t(M, N);
294
+ const v = t(T, y);
291
295
  d = a(v);
292
- }, S = () => {
296
+ }, m = () => {
293
297
  c(), i(), l(), d();
294
298
  };
295
299
  return {
@@ -297,80 +301,80 @@ const ae = (e = new Error()) => {
297
301
  f(C);
298
302
  },
299
303
  stop: () => {
300
- S();
304
+ m();
301
305
  }
302
306
  };
303
- }, tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
307
+ }, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
304
308
  __proto__: null,
305
- PURGATORY_CONFERENCE_NUMBER: $,
306
- createSyncMediaState: Ie,
307
- error: ue,
308
- getExtraHeaders: le,
309
- getUserAgent: Ce,
309
+ PURGATORY_CONFERENCE_NUMBER: X,
310
+ createSyncMediaState: we,
311
+ error: le,
312
+ getExtraHeaders: Se,
313
+ getUserAgent: ge,
310
314
  hasPurgatory: A,
311
- resolveAnswerIncomingCall: te,
312
- resolveAskPermissionToEnableCam: ge,
313
- resolveCallToServer: re,
314
- resolveConnectToServer: se,
315
- resolveDisconnectFromServer: oe,
316
- resolveGetRemoteStreams: w,
317
- resolveOnMoveToSpectators: Ee,
318
- resolveOnMustStopPresentation: Re,
319
- resolveOnUseLicense: Me,
320
- resolveSendMediaState: Te,
321
- resolveSendRefusalToTurnOnCam: ye,
322
- resolveSendRefusalToTurnOnMic: he,
323
- resolveStartPresentation: be,
324
- resolveStopShareSipConnector: _e,
325
- resolveUpdatePresentation: pe,
326
- resolveUpdateRemoteStreams: D,
327
- sendDTMFAccumulated: ve
328
- }, Symbol.toStringTag, { value: "Module" })), we = (e) => [...e.keys()].map((t) => e.get(t)), De = (e, t) => we(e).find((n) => n.type === t), Fe = async (e) => e.getStats().then((t) => {
329
- const n = De(t, "codec");
315
+ resolveAnswerIncomingCall: re,
316
+ resolveAskPermissionToEnableCam: Re,
317
+ resolveCallToServer: se,
318
+ resolveConnectToServer: oe,
319
+ resolveDisconnectFromServer: ae,
320
+ resolveGetRemoteStreams: D,
321
+ resolveOnMoveToSpectators: Me,
322
+ resolveOnMustStopPresentation: Ee,
323
+ resolveOnUseLicense: Te,
324
+ resolveSendMediaState: ye,
325
+ resolveSendRefusalToTurnOnCam: he,
326
+ resolveSendRefusalToTurnOnMic: be,
327
+ resolveStartPresentation: _e,
328
+ resolveStopShareSipConnector: pe,
329
+ resolveUpdatePresentation: Oe,
330
+ resolveUpdateRemoteStreams: F,
331
+ sendDTMFAccumulated: Ae
332
+ }, Symbol.toStringTag, { value: "Module" })), De = (e) => [...e.keys()].map((t) => e.get(t)), Fe = (e, t) => De(e).find((n) => n.type === t), ke = async (e) => e.getStats().then((t) => {
333
+ const n = Fe(t, "codec");
330
334
  return n == null ? void 0 : n.mimeType;
331
- }), ke = (e) => e.find((t) => {
335
+ }), Ue = (e) => e.find((t) => {
332
336
  var n;
333
337
  return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
334
- }), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Ue = 1e6, g = (e) => e * Ue, K = g(0.06), Le = g(4), Ve = (e) => e <= 64 ? K : e <= 128 ? g(0.12) : e <= 256 ? g(0.25) : e <= 384 ? g(0.32) : e <= 426 ? g(0.38) : e <= 640 ? g(0.5) : e <= 848 ? g(0.7) : e <= 1280 ? g(1) : e <= 1920 ? g(2) : Le, xe = "av1", $e = (e) => G(e, xe), Xe = 0.6, j = (e, t) => $e(t) ? e * Xe : e, We = (e) => j(K, e), H = (e, t) => {
335
- const n = Ve(e);
338
+ }), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Le = 1e6, R = (e) => e * Le, K = R(0.06), Ve = R(4), xe = (e) => e <= 64 ? K : e <= 128 ? R(0.12) : e <= 256 ? R(0.25) : e <= 384 ? R(0.32) : e <= 426 ? R(0.38) : e <= 640 ? R(0.5) : e <= 848 ? R(0.7) : e <= 1280 ? R(1) : e <= 1920 ? R(2) : Ve, $e = "av1", Xe = (e) => G(e, $e), He = 0.6, j = (e, t) => Xe(t) ? e * He : e, We = (e) => j(K, e), Y = (e, t) => {
339
+ const n = xe(e);
336
340
  return j(n, t);
337
- }, Y = ee(), Ge = async () => Y().catch((e) => {
341
+ }, q = ne(), Ge = async () => q().catch((e) => {
338
342
  o("videoSendingBalancer: error", e);
339
- }), Ke = async (e) => (Y.add(e), Ge()), k = async ({
343
+ }), Ke = async (e) => (q.add(e), Ge()), U = async ({
340
344
  sender: e,
341
345
  scaleResolutionDownBy: t,
342
346
  maxBitrate: n,
343
347
  onSetParameters: r
344
- }) => Ke(async () => q(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), je = async ({ sender: e, codec: t }, n) => {
348
+ }) => Ke(async () => z(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), je = async ({ sender: e, codec: t }, n) => {
345
349
  const s = We(t);
346
- return k({
350
+ return U({
347
351
  sender: e,
348
352
  maxBitrate: s,
349
353
  onSetParameters: n,
350
354
  scaleResolutionDownBy: 200
351
355
  });
352
- }, I = async ({ sender: e, track: t, codec: n }, r) => {
353
- const c = t.getSettings().width, i = H(c, n);
354
- return k({
356
+ }, w = async ({ sender: e, track: t, codec: n }, r) => {
357
+ const c = t.getSettings().width, i = Y(c, n);
358
+ return U({
355
359
  sender: e,
356
360
  maxBitrate: i,
357
361
  onSetParameters: r,
358
362
  scaleResolutionDownBy: 1
359
363
  });
360
- }, He = async ({
364
+ }, Ye = async ({
361
365
  sender: e,
362
366
  track: t,
363
367
  resolution: n,
364
368
  codec: r
365
369
  }, s) => {
366
- const a = t.getSettings(), c = a.width, i = a.height, [l, d] = n.split("x"), f = c / Number(l), S = i / Number(d), T = Math.max(f, S, 1), C = H(Number(l), r);
367
- return k({
370
+ const a = t.getSettings(), c = a.width, i = a.height, [l, d] = n.split("x"), f = c / Number(l), m = i / Number(d), g = Math.max(f, m, 1), C = Y(Number(l), r);
371
+ return U({
368
372
  sender: e,
369
373
  maxBitrate: C,
370
374
  onSetParameters: s,
371
- scaleResolutionDownBy: T
375
+ scaleResolutionDownBy: g
372
376
  });
373
- }, Ye = async ({
377
+ }, qe = async ({
374
378
  mainCam: e,
375
379
  resolutionMainCam: t,
376
380
  sender: n,
@@ -378,19 +382,19 @@ const ae = (e = new Error()) => {
378
382
  codec: s
379
383
  }, a) => {
380
384
  switch (e) {
381
- case P.PAUSE_MAIN_CAM:
385
+ case B.PAUSE_MAIN_CAM:
382
386
  return je({ sender: n, codec: s }, a);
383
- case P.RESUME_MAIN_CAM:
384
- return I({ sender: n, track: r, codec: s }, a);
385
- case P.MAX_MAIN_CAM_RESOLUTION:
386
- return t !== void 0 ? He(
387
+ case B.RESUME_MAIN_CAM:
388
+ return w({ sender: n, track: r, codec: s }, a);
389
+ case B.MAX_MAIN_CAM_RESOLUTION:
390
+ return t !== void 0 ? Ye(
387
391
  { sender: n, track: r, codec: s, resolution: t },
388
392
  a
389
- ) : I({ sender: n, track: r, codec: s }, a);
393
+ ) : w({ sender: n, track: r, codec: s }, a);
390
394
  default:
391
- return I({ sender: n, track: r, codec: s }, a);
395
+ return w({ sender: n, track: r, codec: s }, a);
392
396
  }
393
- }, U = {
397
+ }, L = {
394
398
  isChanged: !1,
395
399
  parameters: {
396
400
  encodings: [{}],
@@ -399,22 +403,22 @@ const ae = (e = new Error()) => {
399
403
  headerExtensions: [],
400
404
  rtcp: {}
401
405
  }
402
- }, L = async ({
406
+ }, V = async ({
403
407
  mainCam: e,
404
408
  resolutionMainCam: t,
405
409
  connection: n,
406
410
  onSetParameters: r,
407
411
  ignoreForCodec: s
408
412
  }) => {
409
- const a = n.getSenders(), c = ke(a);
413
+ const a = n.getSenders(), c = Ue(a);
410
414
  if (!(c != null && c.track))
411
- return U;
412
- const i = await Fe(c);
413
- return G(i, s) ? U : Ye(
415
+ return L;
416
+ const i = await ke(c);
417
+ return G(i, s) ? L : qe(
414
418
  { mainCam: e, resolutionMainCam: t, sender: c, codec: i, track: c.track },
415
419
  r
416
420
  );
417
- }, rn = (e, {
421
+ }, sn = (e, {
418
422
  ignoreForCodec: t,
419
423
  onSetParameters: n
420
424
  } = {}) => {
@@ -422,7 +426,7 @@ const ae = (e = new Error()) => {
422
426
  const { connection: l } = e;
423
427
  if (!l)
424
428
  throw new Error("connection is not exist");
425
- return L({
429
+ return V({
426
430
  connection: l,
427
431
  onSetParameters: n,
428
432
  ignoreForCodec: t
@@ -430,13 +434,13 @@ const ae = (e = new Error()) => {
430
434
  };
431
435
  let s = r;
432
436
  const a = async (l) => (s = async () => {
433
- const { mainCam: d, resolutionMainCam: f } = l, { connection: S } = e;
434
- if (!S)
437
+ const { mainCam: d, resolutionMainCam: f } = l, { connection: m } = e;
438
+ if (!m)
435
439
  throw new Error("connection is not exist");
436
- return L({
440
+ return V({
437
441
  mainCam: d,
438
442
  resolutionMainCam: f,
439
- connection: S,
443
+ connection: m,
440
444
  onSetParameters: n,
441
445
  ignoreForCodec: t
442
446
  });
@@ -458,19 +462,19 @@ const ae = (e = new Error()) => {
458
462
  };
459
463
  };
460
464
  export {
461
- P as EEventsMainCAM,
462
- an as EEventsMic,
463
- cn as EEventsSyncMediaState,
464
- un as EUseLicense,
465
- ln as causes,
466
- Sn as constants,
467
- Rn as debug,
468
- ze as default,
469
- mn as disableDebug,
470
- dn as enableDebug,
471
- fn as eventNames,
472
- Fe as getCodecFromSender,
473
- Cn as hasCanceledCallError,
474
- rn as resolveVideoSendingBalancer,
475
- tn as tools
465
+ B as EEventsMainCAM,
466
+ cn as EEventsMic,
467
+ un as EEventsSyncMediaState,
468
+ ln as EUseLicense,
469
+ Sn as causes,
470
+ mn as constants,
471
+ En as debug,
472
+ Je as default,
473
+ dn as disableDebug,
474
+ fn as enableDebug,
475
+ Cn as eventNames,
476
+ ke as getCodecFromSender,
477
+ gn as hasCanceledCallError,
478
+ sn as resolveVideoSendingBalancer,
479
+ rn as tools
476
480
  };
@@ -1,10 +1,12 @@
1
1
  import { default as SipConnector } from '../SipConnector';
2
+ import { TContentHint } from '../types';
2
3
  type TDegradationPreference = 'balanced' | 'maintain-framerate' | 'maintain-resolution';
3
4
  declare const resolveAnswerIncomingCall: (sipConnector: SipConnector) => (parameters: {
4
5
  mediaStream: MediaStream;
5
6
  extraHeaders?: string[] | undefined;
6
7
  iceServers?: RTCIceServer[];
7
8
  degradationPreference?: TDegradationPreference;
9
+ contentHint?: TContentHint;
8
10
  setRemoteStreams: (streams: MediaStream[]) => void;
9
11
  onBeforeProgressCall?: (conference?: string) => void;
10
12
  onSuccessProgressCall?: (parameters_: {