sip-connector 8.2.0 → 8.3.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 (56) hide show
  1. package/dist/SipConnector-BCc5pokv.cjs +1 -0
  2. package/dist/{SipConnector-C5s0hhzA.js → SipConnector-DagL4rCl.js} +209 -202
  3. package/dist/SipConnector.d.ts +6 -5
  4. package/dist/__fixtures__/BaseSession.mock.d.ts +0 -1
  5. package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +0 -1
  6. package/dist/__fixtures__/Registrator.mock.d.ts +0 -1
  7. package/dist/__fixtures__/Request.mock.d.ts +0 -1
  8. package/dist/__fixtures__/Session.mock.d.ts +0 -1
  9. package/dist/__fixtures__/UA.mock.d.ts +0 -1
  10. package/dist/__fixtures__/index.d.ts +0 -1
  11. package/dist/__fixtures__/jssip.mock.d.ts +0 -1
  12. package/dist/constants.d.ts +1 -0
  13. package/dist/doMock.cjs +1 -1
  14. package/dist/doMock.d.ts +0 -1
  15. package/dist/doMock.js +2 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.ts +0 -1
  18. package/dist/index.js +107 -105
  19. package/dist/logger.d.ts +0 -1
  20. package/dist/tools/__fixtures__/call.d.ts +0 -1
  21. package/dist/tools/__fixtures__/connectToServer.d.ts +0 -1
  22. package/dist/tools/__fixtures__/hasValidUri.d.ts +0 -1
  23. package/dist/tools/__fixtures__/processRequest.d.ts +0 -1
  24. package/dist/tools/answerIncomingCall.d.ts +0 -1
  25. package/dist/tools/callToServer.d.ts +0 -1
  26. package/dist/tools/connectToServer.d.ts +0 -1
  27. package/dist/tools/disconnectFromServer.d.ts +0 -1
  28. package/dist/tools/error/getLinkError.d.ts +0 -1
  29. package/dist/tools/error/getTypeFromError.d.ts +0 -1
  30. package/dist/tools/error/getValuesFromError.d.ts +0 -1
  31. package/dist/tools/prepareMediaStream.d.ts +7 -0
  32. package/dist/tools/resolveAskPermissionToEnableCam.d.ts +0 -1
  33. package/dist/tools/resolveGetRemoteStreams.d.ts +0 -1
  34. package/dist/tools/resolveOnMoveToSpectators.d.ts +0 -1
  35. package/dist/tools/resolveOnMustStopPresentation.d.ts +0 -1
  36. package/dist/tools/resolveOnUseLicense.d.ts +0 -1
  37. package/dist/tools/resolveSendMediaState.d.ts +0 -1
  38. package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +0 -1
  39. package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +0 -1
  40. package/dist/tools/resolveStartPresentation.d.ts +4 -4
  41. package/dist/tools/resolveStopShareSipConnector.d.ts +0 -1
  42. package/dist/tools/resolveUpdatePresentation.d.ts +0 -1
  43. package/dist/tools/resolveUpdateRemoteStreams.d.ts +1 -1
  44. package/dist/tools/setVideoTrackContentHints.d.ts +3 -0
  45. package/dist/tools/syncMediaState/index.d.ts +0 -1
  46. package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +0 -1
  47. package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +0 -1
  48. package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +0 -1
  49. package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +0 -1
  50. package/dist/types.d.ts +1 -1
  51. package/dist/utils.d.ts +0 -4
  52. package/dist/videoSendingBalancer/balance.d.ts +0 -1
  53. package/dist/videoSendingBalancer/index.d.ts +0 -1
  54. package/dist/videoSendingBalancer/processSender.d.ts +0 -1
  55. package/package.json +19 -17
  56. package/dist/SipConnector-BA8w-WR5.cjs +0 -1
@@ -1,36 +1,36 @@
1
- var At = Object.defineProperty;
2
- var Rt = (r, e, t) => e in r ? At(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => Rt(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { CancelableRequest as N, isCanceledError as It } from "@krivega/cancelable-promise";
1
+ var Rt = Object.defineProperty;
2
+ var It = (r, e, t) => e in r ? Rt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => It(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CancelableRequest as N, isCanceledError as mt } from "@krivega/cancelable-promise";
5
5
  import Pe from "events-constructor";
6
6
  import { repeatedCallsAsync as Oe } from "repeated-calls";
7
7
  import B from "debug";
8
- const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code", pt = "Internal Error", Pt = "Busy", Le = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", vt = "Address Incomplete", yt = "Incompatible SDP", bt = "Missing SDP", wt = "Authentication Error", He = "Terminated", Ut = "WebRTC Error", We = "Canceled", Lt = "No Answer", Ht = "Expires", Wt = "No ACK", kt = "Dialog Error", qt = "User Denied Media Access", Ft = "Bad Media Description", Bt = "RTP Timeout", ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
+ const pt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code", Pt = "Internal Error", Ot = "Busy", Le = "Rejected", Dt = "Redirected", Mt = "Unavailable", vt = "Not Found", yt = "Address Incomplete", bt = "Incompatible SDP", wt = "Missing SDP", Ut = "Authentication Error", He = "Terminated", Lt = "WebRTC Error", We = "Canceled", Ht = "No Answer", Wt = "Expires", kt = "No ACK", qt = "Dialog Error", Ft = "User Denied Media Access", Bt = "Bad Media Description", Vt = "RTP Timeout", ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9
9
  __proto__: null,
10
- ADDRESS_INCOMPLETE: vt,
11
- AUTHENTICATION_ERROR: wt,
12
- BAD_MEDIA_DESCRIPTION: Ft,
13
- BUSY: Pt,
10
+ ADDRESS_INCOMPLETE: yt,
11
+ AUTHENTICATION_ERROR: Ut,
12
+ BAD_MEDIA_DESCRIPTION: Bt,
13
+ BUSY: Ot,
14
14
  BYE: He,
15
15
  CANCELED: We,
16
- CONNECTION_ERROR: mt,
17
- DIALOG_ERROR: kt,
18
- EXPIRES: Ht,
19
- INCOMPATIBLE_SDP: yt,
20
- INTERNAL_ERROR: pt,
21
- MISSING_SDP: bt,
22
- NOT_FOUND: Mt,
23
- NO_ACK: Wt,
24
- NO_ANSWER: Lt,
25
- REDIRECTED: Ot,
16
+ CONNECTION_ERROR: pt,
17
+ DIALOG_ERROR: qt,
18
+ EXPIRES: Wt,
19
+ INCOMPATIBLE_SDP: bt,
20
+ INTERNAL_ERROR: Pt,
21
+ MISSING_SDP: wt,
22
+ NOT_FOUND: vt,
23
+ NO_ACK: kt,
24
+ NO_ANSWER: Ht,
25
+ REDIRECTED: Dt,
26
26
  REJECTED: Le,
27
27
  REQUEST_TIMEOUT: Ue,
28
- RTP_TIMEOUT: Bt,
28
+ RTP_TIMEOUT: Vt,
29
29
  SIP_FAILURE_CODE: ft,
30
- UNAVAILABLE: Dt,
31
- USER_DENIED_MEDIA_ACCESS: qt,
32
- WEBRTC_ERROR: Ut
33
- }, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall", L = "connecting", m = "connected", S = "disconnected", D = "newRTCSession", f = "registered", $ = "unregistered", p = "registrationFailed", ke = "newMessage", X = "sipEvent", J = "availableSecondRemoteStream", z = "notAvailableSecondRemoteStream", Q = "mustStopPresentation", M = "shareState", j = "enterRoom", K = "useLicense", Z = "peerconnection:confirmed", ee = "peerconnection:ontrack", v = "channels", te = "channels:notify", ne = "ended:fromserver", se = "main-cam-control", ie = "admin-stop-main-cam", re = "admin-start-main-cam", oe = "admin-stop-mic", ae = "admin-start-mic", y = "admin-force-sync-media-state", ce = "participant:added-to-list-moderators", _e = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", he = "participant:move-request-to-spectators", le = "participation:accepting-word-request", de = "participation:cancelling-word-request", Te = "webcast:started", Se = "webcast:stopped", ue = "account:changed", Ce = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", qe = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", b = "confirmed", w = "peerconnection", A = "failed", Ge = "muted", $e = "unmuted", ge = "newDTMF", Ae = "newInfo", Xe = "hold", Je = "unhold", ze = "update", Qe = "sdp", je = "icecandidate", Ke = "getusermediafailed", Ze = "peerconnection:createofferfailed", et = "peerconnection:createanswerfailed", tt = "peerconnection:setlocaldescriptionfailed", nt = "peerconnection:setremotedescriptionfailed", st = "presentation:start", it = "presentation:started", rt = "presentation:end", Re = "presentation:ended", U = "presentation:failed", ot = "SPECTATOR", ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30
+ UNAVAILABLE: Mt,
31
+ USER_DENIED_MEDIA_ACCESS: Ft,
32
+ WEBRTC_ERROR: Lt
33
+ }, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall", L = "connecting", m = "connected", S = "disconnected", D = "newRTCSession", p = "registered", $ = "unregistered", f = "registrationFailed", ke = "newMessage", X = "sipEvent", J = "availableSecondRemoteStream", z = "notAvailableSecondRemoteStream", Q = "mustStopPresentation", M = "shareState", j = "enterRoom", K = "useLicense", Z = "peerconnection:confirmed", ee = "peerconnection:ontrack", v = "channels", te = "channels:notify", ne = "ended:fromserver", se = "main-cam-control", ie = "admin-stop-main-cam", re = "admin-start-main-cam", oe = "admin-stop-mic", ae = "admin-start-mic", y = "admin-force-sync-media-state", ce = "participant:added-to-list-moderators", _e = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", he = "participant:move-request-to-spectators", de = "participation:accepting-word-request", le = "participation:cancelling-word-request", Te = "webcast:started", Se = "webcast:stopped", ue = "account:changed", Ce = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", qe = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", b = "confirmed", w = "peerconnection", A = "failed", Ge = "muted", $e = "unmuted", ge = "newDTMF", Ae = "newInfo", Xe = "hold", Je = "unhold", ze = "update", Qe = "sdp", je = "icecandidate", Ke = "getusermediafailed", Ze = "peerconnection:createofferfailed", et = "peerconnection:createanswerfailed", tt = "peerconnection:setlocaldescriptionfailed", nt = "peerconnection:setremotedescriptionfailed", st = "presentation:start", it = "presentation:started", rt = "presentation:end", Re = "presentation:ended", U = "presentation:failed", ot = "SPECTATOR", at = 1e6, is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
34
34
  __proto__: null,
35
35
  ACCEPTED: xe,
36
36
  ACCOUNT_CHANGED: ue,
@@ -66,12 +66,13 @@ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
66
66
  NEW_MESSAGE: ke,
67
67
  NEW_RTC_SESSION: D,
68
68
  NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: z,
69
+ ONE_MEGABIT_IN_BITS: at,
69
70
  PARTICIPANT_ADDED_TO_LIST_MODERATORS: ce,
70
71
  PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: he,
71
72
  PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
72
73
  PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: _e,
73
- PARTICIPATION_ACCEPTING_WORD_REQUEST: le,
74
- PARTICIPATION_CANCELLING_WORD_REQUEST: de,
74
+ PARTICIPATION_ACCEPTING_WORD_REQUEST: de,
75
+ PARTICIPATION_CANCELLING_WORD_REQUEST: le,
75
76
  PEER_CONNECTION: w,
76
77
  PEER_CONNECTION_CONFIRMED: Z,
77
78
  PEER_CONNECTION_CREATE_ANSWER_FAILED: et,
@@ -86,8 +87,8 @@ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
86
87
  PRESENTATION_STARTED: it,
87
88
  PROGRESS: Ye,
88
89
  REFER: Ve,
89
- REGISTERED: f,
90
- REGISTRATION_FAILED: p,
90
+ REGISTERED: p,
91
+ REGISTRATION_FAILED: f,
91
92
  REINVITE: Fe,
92
93
  REPLACES: Be,
93
94
  SDP: Qe,
@@ -103,13 +104,13 @@ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
103
104
  USE_LICENSE: K,
104
105
  WEBCAST_STARTED: Te,
105
106
  WEBCAST_STOPPED: Se
106
- }, Symbol.toStringTag, { value: "Module" })), at = [
107
+ }, Symbol.toStringTag, { value: "Module" })), ct = [
107
108
  V,
108
109
  Y,
109
110
  G,
110
111
  x,
111
- le,
112
112
  de,
113
+ le,
113
114
  Ee,
114
115
  te,
115
116
  Ne,
@@ -124,12 +125,12 @@ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
124
125
  m,
125
126
  S,
126
127
  D,
127
- f,
128
- $,
129
128
  p,
129
+ $,
130
+ f,
130
131
  ke,
131
132
  X
132
- ], ct = [
133
+ ], _t = [
133
134
  J,
134
135
  z,
135
136
  Q,
@@ -178,72 +179,77 @@ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code",
178
179
  rt,
179
180
  Re,
180
181
  U
181
- ], _t = [...Ie, ...at], Et = [
182
+ ], Et = [...Ie, ...ct], ht = [
182
183
  ...me,
183
- ...ct
184
- ], ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
184
+ ..._t
185
+ ], rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
185
186
  __proto__: null,
186
- SESSION_EVENT_NAMES: Et,
187
+ SESSION_EVENT_NAMES: ht,
187
188
  SESSION_JSSIP_EVENT_NAMES: me,
188
- SESSION_SYNTHETICS_EVENT_NAMES: ct,
189
- UA_EVENT_NAMES: _t,
189
+ SESSION_SYNTHETICS_EVENT_NAMES: _t,
190
+ UA_EVENT_NAMES: Et,
190
191
  UA_JSSIP_EVENT_NAMES: Ie,
191
- UA_SYNTHETICS_EVENT_NAMES: at
192
- }, Symbol.toStringTag, { value: "Module" })), Vt = (r) => {
192
+ UA_SYNTHETICS_EVENT_NAMES: ct
193
+ }, Symbol.toStringTag, { value: "Module" })), Yt = (r) => {
193
194
  const e = [];
194
195
  return r && e.push(`X-Vinteo-Remote: ${r}`), e;
195
- }, Yt = "content-type", xt = "x-webrtc-enter-room", O = "application/vinteo.webrtc.sharedesktop", Gt = "application/vinteo.webrtc.roomname", $t = "application/vinteo.webrtc.channels", Xt = "application/vinteo.webrtc.mediastate", Jt = "application/vinteo.webrtc.refusal", De = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", jt = "X-WEBRTC-USE-LICENSE", Kt = "X-WEBRTC-PARTICIPANT-NAME", Me = "X-WEBRTC-INPUT-CHANNELS", ve = "X-WEBRTC-OUTPUT-CHANNELS", Zt = "X-WEBRTC-MAINCAM", en = "X-WEBRTC-MIC", ye = "X-WEBRTC-SYNC", tn = "X-WEBRTC-MAINCAM-RESOLUTION", nn = "X-WEBRTC-MEDIA-STATE", sn = "X-Vinteo-Media-Type", rn = "X-Vinteo-MainCam-State", on = "X-Vinteo-Mic-State", an = "application/vinteo.webrtc.partstate", cn = "X-WEBRTC-PARTSTATE", _n = "application/vinteo.webrtc.notify", En = "X-VINTEO-NOTIFY", R = "x-webrtc-share-state", hn = `${R}: LETMESTARTPRESENTATION`, ln = `${R}: STOPPRESENTATION`, ht = "YOUCANRECEIVECONTENT", lt = "CONTENTEND", dt = "YOUMUSTSTOPSENDCONTENT", dn = `${R}: ${dt}`, Tn = `${R}: ${ht}`, Sn = `${R}: ${lt}`, un = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Cn = `${un}: LETMESTARTMAINCAM`, fe = "sip-connector", H = B(fe), is = () => {
196
- B.enable(fe);
197
- }, rs = () => {
198
- B.enable(`-${fe}`);
199
- };
200
- var I = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(I || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}), Nn = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(Nn || {});
201
- function gn(r) {
202
- return (e) => `sip:${e}@${r}`;
203
- }
204
- const An = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, be = (r) => r.trim().replaceAll(" ", "_"), Rn = An(1e5, 99999999), W = (r, {
196
+ }, xt = "content-type", Gt = "x-webrtc-enter-room", O = "application/vinteo.webrtc.sharedesktop", $t = "application/vinteo.webrtc.roomname", Xt = "application/vinteo.webrtc.channels", Jt = "application/vinteo.webrtc.mediastate", zt = "application/vinteo.webrtc.refusal", De = "application/vinteo.webrtc.maincam", Qt = "application/vinteo.webrtc.mic", jt = "application/vinteo.webrtc.uselic", Kt = "X-WEBRTC-USE-LICENSE", Zt = "X-WEBRTC-PARTICIPANT-NAME", Me = "X-WEBRTC-INPUT-CHANNELS", ve = "X-WEBRTC-OUTPUT-CHANNELS", en = "X-WEBRTC-MAINCAM", tn = "X-WEBRTC-MIC", ye = "X-WEBRTC-SYNC", nn = "X-WEBRTC-MAINCAM-RESOLUTION", sn = "X-WEBRTC-MEDIA-STATE", rn = "X-Vinteo-Media-Type", on = "X-Vinteo-MainCam-State", an = "X-Vinteo-Mic-State", cn = "application/vinteo.webrtc.partstate", _n = "X-WEBRTC-PARTSTATE", En = "application/vinteo.webrtc.notify", hn = "X-VINTEO-NOTIFY", R = "x-webrtc-share-state", dn = `${R}: LETMESTARTPRESENTATION`, ln = `${R}: STOPPRESENTATION`, dt = "YOUCANRECEIVECONTENT", lt = "CONTENTEND", Tt = "YOUMUSTSTOPSENDCONTENT", Tn = `${R}: ${Tt}`, Sn = `${R}: ${dt}`, un = `${R}: ${lt}`, Cn = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Nn = `${Cn}: LETMESTARTMAINCAM`, pe = "sip-connector", H = B(pe), os = () => {
197
+ B.enable(pe);
198
+ }, as = () => {
199
+ B.enable(`-${pe}`);
200
+ }, gn = (r, e) => {
201
+ r.getVideoTracks().forEach((n) => {
202
+ "contentHint" in n && n.contentHint !== e && (n.contentHint = e);
203
+ });
204
+ }, W = (r, {
205
205
  videoMode: e,
206
- audioMode: t
206
+ audioMode: t,
207
+ contentHint: n
207
208
  } = {}) => {
208
209
  if (!r || e === "recvonly" && t === "recvonly")
209
210
  return;
210
- const n = t === "recvonly" ? [] : r.getAudioTracks(), s = e === "recvonly" ? [] : r.getVideoTracks(), o = [...n, ...s], a = new MediaStream(o);
211
- return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
212
- }, In = (r) => r.some((t) => {
211
+ const s = t === "recvonly" ? [] : r.getAudioTracks(), o = e === "recvonly" ? [] : r.getVideoTracks(), a = [...s, ...o], c = new MediaStream(a);
212
+ return c.getTracks = () => [...c.getAudioTracks(), ...c.getVideoTracks()], n && n !== "none" && gn(c, n), c;
213
+ };
214
+ var I = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(I || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}), An = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(An || {});
215
+ function Rn(r) {
216
+ return (e) => `sip:${e}@${r}`;
217
+ }
218
+ const In = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, be = (r) => r.trim().replaceAll(" ", "_"), mn = In(1e5, 99999999), pn = (r) => r.some((t) => {
213
219
  const { kind: n } = t;
214
220
  return n === "video";
215
- }), mn = "Error decline with 603", fn = 1006, pn = (r) => typeof r == "object" && r !== null && "code" in r && r.code === fn, Pn = (r) => r.message === mn, On = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), Tt = 1, St = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, Dn = St(
216
- Tt
217
- ), Mn = (r, e) => {
218
- const t = r === void 0 ? void 0 : Math.max(r, Tt);
219
- if (t !== void 0 && Dn(
221
+ }), fn = "Error decline with 603", Pn = 1006, On = (r) => typeof r == "object" && r !== null && "code" in r && r.code === Pn, Dn = (r) => r.message === fn, Mn = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), St = 1, ut = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, vn = ut(
222
+ St
223
+ ), yn = (r, e) => {
224
+ const t = r === void 0 ? void 0 : Math.max(r, St);
225
+ if (t !== void 0 && vn(
220
226
  t,
221
227
  e
222
228
  ))
223
229
  return t;
224
- }, vn = St(), yn = (r, e) => {
225
- if (vn(r, e))
230
+ }, bn = ut(), wn = (r, e) => {
231
+ if (bn(r, e))
226
232
  return r;
227
- }, bn = async (r, e, t) => {
233
+ }, Un = async (r, e, t) => {
228
234
  const n = r.getParameters();
229
235
  (n.encodings === void 0 || n.encodings.length === 0) && (n.encodings = [{}]);
230
- const [s] = n.encodings, o = s.scaleResolutionDownBy, a = Mn(
236
+ const [s] = n.encodings, o = s.scaleResolutionDownBy, a = yn(
231
237
  e.scaleResolutionDownBy,
232
238
  o
233
239
  );
234
240
  let c = !1;
235
241
  a !== void 0 && (n.encodings[0].scaleResolutionDownBy = a, c = !0);
236
- const _ = s.maxBitrate, E = yn(e.maxBitrate, _);
242
+ const _ = s.maxBitrate, E = wn(e.maxBitrate, _);
237
243
  return E !== void 0 && (n.encodings[0].maxBitrate = E, c = !0), c ? (t && t(n), r.setParameters(n).then(() => ({ parameters: n, isChanged: c }))) : { parameters: n, isChanged: c };
238
- }, wn = async (r, e, t) => {
239
- const n = On(r, e);
244
+ }, Ln = async (r, e, t) => {
245
+ const n = Mn(r, e);
240
246
  if (n)
241
- return bn(n, { maxBitrate: t });
242
- }, Un = 486, Ln = 487, F = "local", we = "remote", Hn = 3, Wn = 1, os = (r = new Error()) => {
247
+ return Un(n, { maxBitrate: t });
248
+ }, Hn = 486, Wn = 487, F = "local", we = "remote", kn = 3, qn = 1, cs = (r = new Error()) => {
243
249
  const { originator: e, cause: t } = r;
244
- return It(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === F && (t === We || t === He) : !1;
245
- }, g = "SipConnector", kn = "channels", qn = "WebcastStarted", Fn = "WebcastStopped", Bn = "accountChanged", Vn = "accountDeleted", Yn = "addedToListModerators", xn = "removedFromListModerators", Gn = "ParticipationRequestAccepted", $n = "ParticipationRequestRejected", Xn = "ParticipantMovedToWebcast", Jn = "ConferenceParticipantTokenIssued";
246
- class as {
250
+ return mt(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === F && (t === We || t === He) : !1;
251
+ }, g = "SipConnector", Fn = "channels", Bn = "WebcastStarted", Vn = "WebcastStopped", Yn = "accountChanged", xn = "accountDeleted", Gn = "addedToListModerators", $n = "removedFromListModerators", Xn = "ParticipationRequestAccepted", Jn = "ParticipationRequestRejected", zn = "ParticipantMovedToWebcast", Qn = "ConferenceParticipantTokenIssued";
252
+ class _s {
247
253
  constructor({ JsSIP: e }) {
248
254
  i(this, "_isRegisterConfig", !1);
249
255
  i(this, "_connectionConfiguration", {});
@@ -287,7 +293,7 @@ class as {
287
293
  }
288
294
  return this.register();
289
295
  });
290
- i(this, "declineToIncomingCall", async ({ statusCode: e = Ln } = {}) => new Promise((t, n) => {
296
+ i(this, "declineToIncomingCall", async ({ statusCode: e = Wn } = {}) => new Promise((t, n) => {
291
297
  if (!this.isAvailableIncomingCall) {
292
298
  n(new Error("no incomingSession"));
293
299
  return;
@@ -295,15 +301,15 @@ class as {
295
301
  const s = this.incomingSession, o = this.remoteCallerData;
296
302
  this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(Y, o), t(s.terminate({ status_code: e }));
297
303
  }));
298
- i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Un }));
304
+ i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Hn }));
299
305
  i(this, "removeIncomingSession", () => {
300
306
  delete this.incomingSession;
301
307
  });
302
- i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = Hn } = {}) => {
308
+ i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = kn } = {}) => {
303
309
  let n = !0;
304
310
  const s = async () => (n = !1, this._cancelableConnect.request(e)), o = (a) => {
305
311
  var h;
306
- const c = !!((h = this.ua) != null && h.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !pn(a);
312
+ const c = !!((h = this.ua) != null && h.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !On(a);
307
313
  return _ || E;
308
314
  };
309
315
  return this._cancelableConnectWithRepeatedCalls = Oe({
@@ -341,22 +347,22 @@ class as {
341
347
  connectionRecoveryMinInterval: _,
342
348
  connectionRecoveryMaxInterval: E,
343
349
  userAgent: h,
344
- displayName: d = "",
345
- register: l = !1,
350
+ displayName: l = "",
351
+ register: d = !1,
346
352
  extraHeaders: T = []
347
353
  }) => {
348
354
  if (!n)
349
355
  throw new Error("sipServerUrl is required");
350
356
  if (!s)
351
357
  throw new Error("sipWebSocketServerURL is required");
352
- if (l && !e)
358
+ if (d && !e)
353
359
  throw new Error("user is required for authorized connection");
354
- if (l && !t)
360
+ if (d && !t)
355
361
  throw new Error("password is required for authorized connection");
356
362
  this._connectionConfiguration = {
357
363
  sipServerUrl: n,
358
- displayName: d,
359
- register: l,
364
+ displayName: l,
365
+ register: d,
360
366
  user: e,
361
367
  password: t
362
368
  };
@@ -365,20 +371,20 @@ class as {
365
371
  sipServerUrl: n,
366
372
  sipWebSocketServerURL: s,
367
373
  password: t,
368
- displayName: d,
369
- register: l,
374
+ displayName: l,
375
+ register: d,
370
376
  sessionTimers: a,
371
377
  registerExpires: c,
372
378
  connectionRecoveryMinInterval: _,
373
379
  connectionRecoveryMaxInterval: E,
374
380
  userAgent: h
375
381
  });
376
- this.getSipServerUrl = C.getSipServerUrl, this.socket = C.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l, this.ua = this._createUa(u), this._uaEvents.eachTriggers((Ct, Nt) => {
377
- const pe = Ie.find((gt) => gt === Nt);
378
- pe && this.ua && this.ua.on(pe, Ct);
382
+ this.getSipServerUrl = C.getSipServerUrl, this.socket = C.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!d, this.ua = this._createUa(u), this._uaEvents.eachTriggers((Nt, gt) => {
383
+ const fe = Ie.find((At) => At === gt);
384
+ fe && this.ua && this.ua.on(fe, Nt);
379
385
  });
380
- const ut = [...Vt(o), ...T];
381
- return this.ua.registrator().setExtraHeaders(ut), this.ua;
386
+ const Ct = [...Yt(o), ...T];
387
+ return this.ua.registrator().setExtraHeaders(Ct), this.ua;
382
388
  });
383
389
  i(this, "_createUa", (e) => new this.JsSIP.UA(e));
384
390
  i(this, "_start", async () => new Promise((e, t) => {
@@ -392,9 +398,9 @@ class as {
392
398
  }, o = (_) => {
393
399
  c(), t(_);
394
400
  }, a = () => {
395
- this.isRegisterConfig ? (this.on(f, s), this.on(p, o)) : this.on(m, s), this.on(S, o);
401
+ this.isRegisterConfig ? (this.on(p, s), this.on(f, o)) : this.on(m, s), this.on(S, o);
396
402
  }, c = () => {
397
- this.off(f, s), this.off(p, o), this.off(m, s), this.off(S, o);
403
+ this.off(p, s), this.off(f, o), this.off(m, s), this.off(S, o);
398
404
  };
399
405
  a(), this.on(D, this.handleNewRTCSession), n.start();
400
406
  }));
@@ -434,14 +440,14 @@ class as {
434
440
  degradationPreference: _,
435
441
  offerToReceiveAudio: E = !0,
436
442
  offerToReceiveVideo: h = !0
437
- }) => new Promise((d, l) => {
443
+ }) => new Promise((l, d) => {
438
444
  const { ua: T } = this;
439
445
  if (!T) {
440
- l(new Error("this.ua is not initialized"));
446
+ d(new Error("this.ua is not initialized"));
441
447
  return;
442
448
  }
443
- this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(d).catch((u) => {
444
- l(u);
449
+ this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(l).catch((u) => {
450
+ d(u);
445
451
  }), this.session = T.call(this.getSipServerUrl(e), {
446
452
  extraHeaders: n,
447
453
  mediaStream: W(t, {
@@ -480,13 +486,13 @@ class as {
480
486
  E(new Error("No session established"));
481
487
  return;
482
488
  }
483
- this._sessionEvents.eachTriggers((l, T) => {
489
+ this._sessionEvents.eachTriggers((d, T) => {
484
490
  const u = me.find((C) => C === T);
485
- u && h.on(u, l);
486
- }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((l) => {
487
- E(l);
491
+ u && h.on(u, d);
492
+ }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((d) => {
493
+ E(d);
488
494
  });
489
- const d = W(e, {
495
+ const l = W(e, {
490
496
  videoMode: o,
491
497
  audioMode: a
492
498
  });
@@ -495,7 +501,7 @@ class as {
495
501
  videoMode: o,
496
502
  audioMode: a,
497
503
  degradationPreference: c,
498
- mediaStream: d,
504
+ mediaStream: l,
499
505
  pcConfig: {
500
506
  iceServers: s
501
507
  }
@@ -503,22 +509,22 @@ class as {
503
509
  }));
504
510
  i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
505
511
  const s = () => {
506
- this.onSession(w, h), this.onSession(b, d);
512
+ this.onSession(w, h), this.onSession(b, l);
507
513
  }, o = () => {
508
- this.offSession(w, h), this.offSession(b, d);
514
+ this.offSession(w, h), this.offSession(b, l);
509
515
  }, a = () => {
510
516
  this.onSession(A, _), this.onSession(P, _);
511
517
  }, c = () => {
512
518
  this.offSession(A, _), this.offSession(P, _);
513
- }, _ = (l) => {
514
- o(), c(), n(l);
519
+ }, _ = (d) => {
520
+ o(), c(), n(d);
515
521
  };
516
522
  let E;
517
- const h = ({ peerconnection: l }) => {
518
- E = l, E.ontrack = (T) => {
523
+ const h = ({ peerconnection: d }) => {
524
+ E = d, E.ontrack = (T) => {
519
525
  this._sessionEvents.trigger(ee, E), e && e(T);
520
526
  };
521
- }, d = () => {
527
+ }, l = () => {
522
528
  E && this._sessionEvents.trigger(Z, E), o(), c(), t(E);
523
529
  };
524
530
  s(), a();
@@ -554,7 +560,7 @@ class as {
554
560
  });
555
561
  i(this, "_handleShareState", (e) => {
556
562
  switch (e) {
557
- case ht: {
563
+ case dt: {
558
564
  this._sessionEvents.trigger(J, void 0);
559
565
  break;
560
566
  }
@@ -562,7 +568,7 @@ class as {
562
568
  this._sessionEvents.trigger(z, void 0);
563
569
  break;
564
570
  }
565
- case dt: {
571
+ case Tt: {
566
572
  this._sessionEvents.trigger(Q, void 0);
567
573
  break;
568
574
  }
@@ -580,55 +586,55 @@ class as {
580
586
  });
581
587
  i(this, "_handleNotify", (e) => {
582
588
  switch (e.cmd) {
583
- case kn: {
589
+ case Fn: {
584
590
  const t = e;
585
591
  this._triggerChannelsNotify(t);
586
592
  break;
587
593
  }
588
- case qn: {
594
+ case Bn: {
589
595
  const t = e;
590
596
  this._triggerWebcastStartedNotify(t);
591
597
  break;
592
598
  }
593
- case Fn: {
599
+ case Vn: {
594
600
  const t = e;
595
601
  this._triggerWebcastStoppedNotify(t);
596
602
  break;
597
603
  }
598
- case Yn: {
604
+ case Gn: {
599
605
  const t = e;
600
606
  this._triggerAddedToListModeratorsNotify(t);
601
607
  break;
602
608
  }
603
- case xn: {
609
+ case $n: {
604
610
  const t = e;
605
611
  this._triggerRemovedFromListModeratorsNotify(t);
606
612
  break;
607
613
  }
608
- case Gn: {
614
+ case Xn: {
609
615
  const t = e;
610
616
  this._triggerParticipationAcceptingWordRequest(t);
611
617
  break;
612
618
  }
613
- case $n: {
619
+ case Jn: {
614
620
  const t = e;
615
621
  this._triggerParticipationCancellingWordRequest(t);
616
622
  break;
617
623
  }
618
- case Xn: {
624
+ case zn: {
619
625
  const t = e;
620
626
  this._triggerParticipantMoveRequestToStream(t);
621
627
  break;
622
628
  }
623
- case Bn: {
629
+ case Yn: {
624
630
  this._triggerAccountChangedNotify();
625
631
  break;
626
632
  }
627
- case Vn: {
633
+ case xn: {
628
634
  this._triggerAccountDeletedNotify();
629
635
  break;
630
636
  }
631
- case Jn: {
637
+ case Qn: {
632
638
  const t = e;
633
639
  this._triggerConferenceParticipantTokenIssued(t);
634
640
  break;
@@ -700,7 +706,7 @@ class as {
700
706
  const t = {
701
707
  conference: e
702
708
  };
703
- this._uaEvents.trigger(le, t);
709
+ this._uaEvents.trigger(de, t);
704
710
  });
705
711
  i(this, "_triggerParticipationCancellingWordRequest", ({
706
712
  body: { conference: e }
@@ -708,7 +714,7 @@ class as {
708
714
  const t = {
709
715
  conference: e
710
716
  };
711
- this._uaEvents.trigger(de, t);
717
+ this._uaEvents.trigger(le, t);
712
718
  });
713
719
  i(this, "_triggerParticipantMoveRequestToStream", ({
714
720
  body: { conference: e }
@@ -719,7 +725,7 @@ class as {
719
725
  this._uaEvents.trigger(Ee, t);
720
726
  });
721
727
  i(this, "_triggerEnterRoom", (e) => {
722
- const t = e.getHeader(xt), n = e.getHeader(Kt);
728
+ const t = e.getHeader(Gt), n = e.getHeader(Zt);
723
729
  this._sessionEvents.trigger(j, { room: t, participantName: n });
724
730
  });
725
731
  i(this, "_triggerShareState", (e) => {
@@ -727,10 +733,10 @@ class as {
727
733
  this._sessionEvents.trigger(M, t);
728
734
  });
729
735
  i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
730
- e.getHeader(cn) === ot && this._sessionEvents.trigger(he, void 0);
736
+ e.getHeader(_n) === ot && this._sessionEvents.trigger(he, void 0);
731
737
  });
732
738
  i(this, "_triggerMainCamControl", (e) => {
733
- const t = e.getHeader(Zt), n = e.getHeader(ye), s = n === q.ADMIN_SYNC_FORCED;
739
+ const t = e.getHeader(en), n = e.getHeader(ye), s = n === q.ADMIN_SYNC_FORCED;
734
740
  if (t === I.ADMIN_START_MAIN_CAM) {
735
741
  this._sessionEvents.trigger(re, { isSyncForced: s });
736
742
  return;
@@ -740,32 +746,32 @@ class as {
740
746
  return;
741
747
  }
742
748
  (t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(y, { isSyncForced: s });
743
- const o = e.getHeader(tn);
749
+ const o = e.getHeader(nn);
744
750
  this._sessionEvents.trigger(se, {
745
751
  mainCam: t,
746
752
  resolutionMainCam: o
747
753
  });
748
754
  });
749
755
  i(this, "_triggerMicControl", (e) => {
750
- const t = e.getHeader(en), s = e.getHeader(ye) === q.ADMIN_SYNC_FORCED;
756
+ const t = e.getHeader(tn), s = e.getHeader(ye) === q.ADMIN_SYNC_FORCED;
751
757
  t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(ae, { isSyncForced: s }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: s });
752
758
  });
753
759
  i(this, "_triggerUseLicense", (e) => {
754
- const t = e.getHeader(jt);
760
+ const t = e.getHeader(Kt);
755
761
  this._sessionEvents.trigger(K, t);
756
762
  });
757
763
  i(this, "_handleNewInfo", (e) => {
758
764
  const { originator: t } = e;
759
765
  if (t !== "remote")
760
766
  return;
761
- const { request: n } = e, s = n.getHeader(Yt);
767
+ const { request: n } = e, s = n.getHeader(xt);
762
768
  if (s)
763
769
  switch (s) {
764
- case Gt: {
770
+ case $t: {
765
771
  this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
766
772
  break;
767
773
  }
768
- case _n: {
774
+ case En: {
769
775
  this._maybeHandleNotify(n);
770
776
  break;
771
777
  }
@@ -777,15 +783,15 @@ class as {
777
783
  this._triggerMainCamControl(n);
778
784
  break;
779
785
  }
780
- case zt: {
786
+ case Qt: {
781
787
  this._triggerMicControl(n);
782
788
  break;
783
789
  }
784
- case Qt: {
790
+ case jt: {
785
791
  this._triggerUseLicense(n);
786
792
  break;
787
793
  }
788
- case an: {
794
+ case cn: {
789
795
  this._maybeTriggerParticipantMoveRequestToSpectators(n);
790
796
  break;
791
797
  }
@@ -795,7 +801,7 @@ class as {
795
801
  this._maybeHandleNotify(e);
796
802
  });
797
803
  i(this, "_maybeHandleNotify", (e) => {
798
- const t = e.getHeader(En);
804
+ const t = e.getHeader(hn);
799
805
  if (t) {
800
806
  const n = JSON.parse(t);
801
807
  this._handleNotify(n);
@@ -805,7 +811,7 @@ class as {
805
811
  const { originator: t } = e;
806
812
  t === we && this._sessionEvents.trigger(ne, e), this._restoreSession();
807
813
  });
808
- this.JsSIP = e, this._sessionEvents = new Pe(Et), this._uaEvents = new Pe(_t), this._cancelableConnect = new N(
814
+ this.JsSIP = e, this._sessionEvents = new Pe(ht), this._uaEvents = new Pe(Et), this._cancelableConnect = new N(
809
815
  this._connect,
810
816
  {
811
817
  moduleName: g,
@@ -828,7 +834,7 @@ class as {
828
834
  }
829
835
  async register() {
830
836
  return new Promise((e, t) => {
831
- this.isRegisterConfig && this.ua ? (this.ua.on(f, e), this.ua.on(p, t), this.ua.register()) : t(new Error("Config is not registered"));
837
+ this.isRegisterConfig && this.ua ? (this.ua.on(p, e), this.ua.on(f, t), this.ua.register()) : t(new Error("Config is not registered"));
832
838
  });
833
839
  }
834
840
  async unregister() {
@@ -875,8 +881,8 @@ class as {
875
881
  userAgent: e,
876
882
  sipServerUrl: n
877
883
  }), _ = this._createUa(c), E = () => {
878
- const d = new Error("Telephony is not available");
879
- a(d);
884
+ const l = new Error("Telephony is not available");
885
+ a(l);
880
886
  };
881
887
  _.once(S, E);
882
888
  const h = () => {
@@ -893,13 +899,13 @@ class as {
893
899
  async askPermissionToEnableCam(e = {}) {
894
900
  if (!this.session)
895
901
  throw new Error("No session established");
896
- const t = [Cn];
902
+ const t = [Nn];
897
903
  return this.session.sendInfo(De, void 0, {
898
904
  noTerminateWhenError: !0,
899
905
  ...e,
900
906
  extraHeaders: t
901
907
  }).catch((n) => {
902
- if (Pn(n))
908
+ if (Dn(n))
903
909
  throw n;
904
910
  });
905
911
  }
@@ -911,7 +917,7 @@ class as {
911
917
  stream: t,
912
918
  presentationOptions: n,
913
919
  options: s = {
914
- callLimit: Wn
920
+ callLimit: qn
915
921
  }
916
922
  }) {
917
923
  const o = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
@@ -920,11 +926,7 @@ class as {
920
926
  isComplete: a,
921
927
  isRejectAsValid: !0,
922
928
  ...s
923
- }), this._cancelableSendPresentationWithRepeatedCalls.then((c) => {
924
- if (c instanceof MediaStream)
925
- return c;
926
- throw c;
927
- });
929
+ }), this._cancelableSendPresentationWithRepeatedCalls.then((c) => c);
928
930
  }
929
931
  hasEqualConnectionConfiguration(e) {
930
932
  var s;
@@ -943,18 +945,18 @@ class as {
943
945
  // 5 minutes in sec
944
946
  connectionRecoveryMinInterval: E = 2,
945
947
  connectionRecoveryMaxInterval: h = 6,
946
- userAgent: d
948
+ userAgent: l
947
949
  }) {
948
950
  if (a && !t)
949
951
  throw new Error("password is required for authorized connection");
950
- const l = a && e ? e.trim() : `${Rn()}`, T = gn(o), u = T(l), C = new this.JsSIP.WebSocketInterface(n);
952
+ const d = a && e ? e.trim() : `${mn()}`, T = Rn(o), u = T(d), C = new this.JsSIP.WebSocketInterface(n);
951
953
  return {
952
954
  configuration: {
953
955
  password: t,
954
956
  register: a,
955
957
  uri: u,
956
958
  display_name: be(s),
957
- user_agent: d,
959
+ user_agent: l,
958
960
  sdp_semantics: "unified-plan",
959
961
  sockets: [C],
960
962
  session_timers: c,
@@ -969,58 +971,61 @@ class as {
969
971
  };
970
972
  }
971
973
  async _sendPresentation(e, t, {
972
- maxBitrate: n,
973
- degradationPreference: s,
974
+ maxBitrate: n = at,
975
+ degradationPreference: s = "maintain-resolution",
974
976
  isNeedReinvite: o = !0,
975
- isP2P: a = !1
977
+ isP2P: a = !1,
978
+ contentHint: c = "detail"
976
979
  }) {
977
- const c = W(t);
978
- this._streamPresentationCurrent = c;
979
- const _ = a ? [Tn] : [hn], E = e.sendInfo(O, void 0, {
980
- extraHeaders: _
980
+ const _ = W(t, { contentHint: c });
981
+ this._streamPresentationCurrent = _;
982
+ const E = a ? [Sn] : [dn], h = e.sendInfo(O, void 0, {
983
+ extraHeaders: E
981
984
  }).then(async () => e.startPresentation(
982
- c,
985
+ _,
983
986
  o,
984
987
  s
985
988
  )).then(async () => {
986
- const { connection: h } = this;
987
- if (!h || n === void 0)
989
+ const { connection: l } = this;
990
+ if (!l || n === void 0)
988
991
  return;
989
- const d = h.getSenders();
990
- await wn(d, t, n);
991
- }).then(() => t).catch((h) => {
992
- throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(U, h), h;
992
+ const d = l.getSenders();
993
+ await Ln(d, t, n);
994
+ }).then(() => t).catch((l) => {
995
+ throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(U, l), l;
993
996
  });
994
- return this.promisePendingStartPresentation = E, E.finally(() => {
997
+ return this.promisePendingStartPresentation = h, h.finally(() => {
995
998
  this.promisePendingStartPresentation = void 0;
996
999
  });
997
1000
  }
998
1001
  async startPresentation(e, {
999
- isNeedReinvite: t = !0,
1000
- isP2P: n = !1,
1002
+ isNeedReinvite: t,
1003
+ isP2P: n,
1001
1004
  maxBitrate: s,
1002
- degradationPreference: o
1003
- } = {}, a) {
1004
- const c = this.establishedSession;
1005
- if (!c)
1005
+ degradationPreference: o,
1006
+ contentHint: a
1007
+ } = {}, c) {
1008
+ const _ = this.establishedSession;
1009
+ if (!_)
1006
1010
  throw new Error("No session established");
1007
1011
  if (this._streamPresentationCurrent)
1008
1012
  throw new Error("Presentation is already started");
1009
- return n && await this.sendMustStopPresentation(c), this._sendPresentationWithDuplicatedCalls({
1010
- session: c,
1013
+ return n && await this.sendMustStopPresentation(_), this._sendPresentationWithDuplicatedCalls({
1014
+ session: _,
1011
1015
  stream: e,
1012
1016
  presentationOptions: {
1013
1017
  isNeedReinvite: t,
1014
1018
  isP2P: n,
1015
1019
  maxBitrate: s,
1016
- degradationPreference: o
1020
+ degradationPreference: o,
1021
+ contentHint: a
1017
1022
  },
1018
- options: a
1023
+ options: c
1019
1024
  });
1020
1025
  }
1021
1026
  async sendMustStopPresentation(e) {
1022
1027
  await e.sendInfo(O, void 0, {
1023
- extraHeaders: [dn]
1028
+ extraHeaders: [Tn]
1024
1029
  });
1025
1030
  }
1026
1031
  async stopPresentation({
@@ -1029,7 +1034,7 @@ class as {
1029
1034
  this._cancelSendPresentationWithRepeatedCalls();
1030
1035
  const t = this._streamPresentationCurrent;
1031
1036
  let n = this.promisePendingStartPresentation ?? Promise.resolve();
1032
- const s = e ? [Sn] : [ln], o = this.establishedSession;
1037
+ const s = e ? [un] : [ln], o = this.establishedSession;
1033
1038
  return o && t && (n = n.then(async () => o.sendInfo(O, void 0, {
1034
1039
  extraHeaders: s
1035
1040
  })).then(async () => o.stopPresentation(t)).catch((a) => {
@@ -1039,19 +1044,21 @@ class as {
1039
1044
  });
1040
1045
  }
1041
1046
  async updatePresentation(e, {
1042
- isP2P: t = !1,
1047
+ isP2P: t,
1043
1048
  maxBitrate: n,
1044
- degradationPreference: s
1049
+ degradationPreference: s,
1050
+ contentHint: o
1045
1051
  } = {}) {
1046
- const o = this.establishedSession;
1047
- if (!o)
1052
+ const a = this.establishedSession;
1053
+ if (!a)
1048
1054
  throw new Error("No session established");
1049
1055
  if (!this._streamPresentationCurrent)
1050
1056
  throw new Error("Presentation has not started yet");
1051
- return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(o, e, {
1057
+ return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(a, e, {
1052
1058
  isP2P: t,
1053
1059
  maxBitrate: n,
1054
1060
  degradationPreference: s,
1061
+ contentHint: o,
1055
1062
  isNeedReinvite: !1
1056
1063
  });
1057
1064
  }
@@ -1104,7 +1111,7 @@ class as {
1104
1111
  if (!this.connection)
1105
1112
  return;
1106
1113
  const t = this.connection.getReceivers().map(({ track: n }) => n);
1107
- return In(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
1114
+ return pn(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
1108
1115
  }
1109
1116
  get connection() {
1110
1117
  var t;
@@ -1191,17 +1198,17 @@ class as {
1191
1198
  n,
1192
1199
  s
1193
1200
  ];
1194
- return this.session.sendInfo($t, void 0, { extraHeaders: o });
1201
+ return this.session.sendInfo(Xt, void 0, { extraHeaders: o });
1195
1202
  }
1196
1203
  async sendMediaState({ cam: e, mic: t }, n = {}) {
1197
1204
  if (!this.session)
1198
1205
  throw new Error("No session established");
1199
- const s = `${nn}: currentstate`, o = `${rn}: ${Number(e)}`, a = `${on}: ${Number(t)}`, c = [
1206
+ const s = `${sn}: currentstate`, o = `${on}: ${Number(e)}`, a = `${an}: ${Number(t)}`, c = [
1200
1207
  s,
1201
1208
  o,
1202
1209
  a
1203
1210
  ];
1204
- return this.session.sendInfo(Xt, void 0, {
1211
+ return this.session.sendInfo(Jt, void 0, {
1205
1212
  noTerminateWhenError: !0,
1206
1213
  ...n,
1207
1214
  extraHeaders: c
@@ -1210,8 +1217,8 @@ class as {
1210
1217
  async _sendRefusalToTurnOn(e, t = {}) {
1211
1218
  if (!this.session)
1212
1219
  throw new Error("No session established");
1213
- const c = [`${sn}: ${e === "mic" ? 0 : 1}`];
1214
- return this.session.sendInfo(Jt, void 0, {
1220
+ const c = [`${rn}: ${e === "mic" ? 0 : 1}`];
1221
+ return this.session.sendInfo(zt, void 0, {
1215
1222
  noTerminateWhenError: !0,
1216
1223
  ...t,
1217
1224
  extraHeaders: c
@@ -1229,22 +1236,22 @@ class as {
1229
1236
  }
1230
1237
  }
1231
1238
  export {
1232
- Ft as B,
1239
+ Bt as B,
1233
1240
  I as E,
1234
- Mt as N,
1241
+ vt as N,
1235
1242
  Le as R,
1236
- as as S,
1237
- _t as U,
1238
- ns as a,
1239
- is as b,
1240
- ts as c,
1241
- rs as d,
1242
- ss as e,
1243
+ _s as S,
1244
+ Et as U,
1245
+ is as a,
1246
+ os as b,
1247
+ ss as c,
1248
+ as as d,
1249
+ rs as e,
1243
1250
  k as f,
1244
1251
  q as g,
1245
- os as h,
1246
- Nn as i,
1247
- Et as j,
1252
+ cs as h,
1253
+ An as i,
1254
+ ht as j,
1248
1255
  H as l,
1249
- bn as s
1256
+ Un as s
1250
1257
  };