sip-connector 6.24.3 → 7.0.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 (62) hide show
  1. package/dist/{SipConnector-BfKQCTIn.js → SipConnector-B87yL77o.js} +299 -288
  2. package/dist/SipConnector-BSuVfStn.cjs +1 -0
  3. package/dist/SipConnector.d.ts +6 -4
  4. package/dist/__fixtures__/BaseSession.mock.d.ts +4 -4
  5. package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +3 -2
  6. package/dist/__fixtures__/Registrator.mock.d.ts +2 -1
  7. package/dist/__fixtures__/Request.mock.d.ts +1 -0
  8. package/dist/__fixtures__/Session.mock.d.ts +3 -3
  9. package/dist/__fixtures__/UA.mock.d.ts +6 -7
  10. package/dist/__fixtures__/enterRoom.d.ts +5 -0
  11. package/dist/__fixtures__/index.d.ts +5 -4
  12. package/dist/__fixtures__/jssip.mock.d.ts +5 -4
  13. package/dist/__fixtures__/participantMoveRequests.d.ts +1 -0
  14. package/dist/constants.d.ts +2 -0
  15. package/dist/doMock.cjs +1 -1
  16. package/dist/doMock.d.ts +2 -1
  17. package/dist/doMock.js +2 -2
  18. package/dist/eventNames.d.ts +2 -2
  19. package/dist/headers.d.ts +3 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +2 -1
  22. package/dist/index.js +156 -155
  23. package/dist/logger.d.ts +2 -1
  24. package/dist/tools/__fixtures__/call.d.ts +3 -3
  25. package/dist/tools/__fixtures__/connectToServer.d.ts +3 -2
  26. package/dist/tools/__fixtures__/hasValidUri.d.ts +2 -1
  27. package/dist/tools/__fixtures__/processRequest.d.ts +2 -1
  28. package/dist/tools/answerIncomingCall.d.ts +13 -12
  29. package/dist/tools/callToServer.d.ts +13 -12
  30. package/dist/tools/connectToServer.d.ts +3 -2
  31. package/dist/tools/disconnectFromServer.d.ts +2 -1
  32. package/dist/tools/error/getLinkError.d.ts +2 -1
  33. package/dist/tools/error/getTypeFromError.d.ts +2 -1
  34. package/dist/tools/error/getValuesFromError.d.ts +2 -1
  35. package/dist/tools/getExtraHeaders.d.ts +4 -4
  36. package/dist/tools/getUserAgent.d.ts +2 -2
  37. package/dist/tools/index.d.ts +1 -0
  38. package/dist/tools/resolveAskPermissionToEnableCam.d.ts +2 -1
  39. package/dist/tools/resolveGetRemoteStreams.d.ts +2 -1
  40. package/dist/tools/resolveOnMoveToSpectators.d.ts +4 -0
  41. package/dist/tools/resolveOnMustStopPresentation.d.ts +2 -1
  42. package/dist/tools/resolveOnUseLicense.d.ts +3 -2
  43. package/dist/tools/resolveSendMediaState.d.ts +2 -1
  44. package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +2 -1
  45. package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +2 -1
  46. package/dist/tools/resolveStartPresentation.d.ts +3 -2
  47. package/dist/tools/resolveStopShareSipConnector.d.ts +3 -2
  48. package/dist/tools/resolveUpdatePresentation.d.ts +3 -2
  49. package/dist/tools/sendDTMFAccumulated.d.ts +1 -1
  50. package/dist/tools/syncMediaState/index.d.ts +2 -1
  51. package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +2 -1
  52. package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +2 -1
  53. package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +2 -1
  54. package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +2 -1
  55. package/dist/types.d.ts +2 -1
  56. package/dist/utils.d.ts +2 -2
  57. package/dist/videoSendingBalancer/balance.d.ts +7 -6
  58. package/dist/videoSendingBalancer/index.d.ts +7 -6
  59. package/dist/videoSendingBalancer/processSender.d.ts +5 -4
  60. package/dist/videoSendingBalancer/scaleBitrate.d.ts +1 -1
  61. package/package.json +11 -11
  62. package/dist/SipConnector-BWd7Anni.cjs +0 -1
@@ -1,136 +1,138 @@
1
- var gt = Object.defineProperty;
2
- var Ct = (o, e, t) => e in o ? gt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var i = (o, e, t) => (Ct(o, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { CancelableRequest as N, isCanceledError as At } from "@krivega/cancelable-promise";
5
- import fe from "events-constructor";
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), t);
4
+ import { CancelableRequest as N, isCanceledError as It } from "@krivega/cancelable-promise";
5
+ import Oe from "events-constructor";
6
6
  import F from "debug";
7
- const Rt = "Connection Error", be = "Request Timeout", It = "SIP Failure Code", mt = "Internal Error", ft = "Busy", Ue = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", Pt = "Address Incomplete", pt = "Incompatible SDP", vt = "Missing SDP", wt = "Authentication Error", Le = "Terminated", yt = "WebRTC Error", He = "Canceled", bt = "No Answer", Ut = "Expires", Lt = "No ACK", Ht = "Dialog Error", kt = "User Denied Media Access", qt = "Bad Media Description", Wt = "RTP Timeout", Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7
+ const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code", Ot = "Internal Error", Pt = "Busy", Le = "Rejected", Mt = "Redirected", pt = "Unavailable", Dt = "Not Found", vt = "Address Incomplete", wt = "Incompatible SDP", yt = "Missing SDP", bt = "Authentication Error", He = "Terminated", Ut = "WebRTC Error", ke = "Canceled", Lt = "No Answer", Ht = "Expires", kt = "No ACK", qt = "Dialog Error", Wt = "User Denied Media Access", Ft = "Bad Media Description", Bt = "RTP Timeout", Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
8
  __proto__: null,
9
- ADDRESS_INCOMPLETE: Pt,
10
- AUTHENTICATION_ERROR: wt,
11
- BAD_MEDIA_DESCRIPTION: qt,
12
- BUSY: ft,
13
- BYE: Le,
14
- CANCELED: He,
15
- CONNECTION_ERROR: Rt,
16
- DIALOG_ERROR: Ht,
17
- EXPIRES: Ut,
18
- INCOMPATIBLE_SDP: pt,
19
- INTERNAL_ERROR: mt,
20
- MISSING_SDP: vt,
21
- NOT_FOUND: Mt,
22
- NO_ACK: Lt,
23
- NO_ANSWER: bt,
24
- REDIRECTED: Ot,
25
- REJECTED: Ue,
26
- REQUEST_TIMEOUT: be,
27
- RTP_TIMEOUT: Wt,
28
- SIP_FAILURE_CODE: It,
29
- UNAVAILABLE: Dt,
30
- USER_DENIED_MEDIA_ACCESS: kt,
31
- WEBRTC_ERROR: yt
32
- }, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting", m = "connected", T = "disconnected", P = "newRTCSession", f = "registered", $ = "unregistered", O = "registrationFailed", ke = "newMessage", G = "sipEvent", X = "availableSecondRemoteStream", J = "notAvailableSecondRemoteStream", z = "mustStopPresentation", p = "shareState", Q = "enterRoom", K = "useLicense", j = "peerconnection:confirmed", Z = "peerconnection:ontrack", v = "channels", ee = "channels:notify", te = "ended:fromserver", se = "main-cam-control", ne = "admin-stop-main-cam", ie = "admin-start-main-cam", oe = "admin-stop-mic", re = "admin-start-mic", w = "admin-force-sync-media-state", ae = "participant:added-to-list-moderators", ce = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", _e = "participation:accepting-word-request", he = "participation:cancelling-word-request", de = "webcast:started", le = "webcast:stopped", ue = "account:changed", Te = "account:deleted", Se = "conference:participant-token-issued", D = "ended", qe = "sending", We = "reinvite", Fe = "replaces", Be = "refer", Ve = "progress", Ye = "accepted", y = "confirmed", b = "peerconnection", C = "failed", xe = "muted", $e = "unmuted", Ne = "newDTMF", ge = "newInfo", Ge = "hold", Xe = "unhold", Je = "update", ze = "sdp", Qe = "icecandidate", Ke = "getusermediafailed", je = "peerconnection:createofferfailed", Ze = "peerconnection:createanswerfailed", et = "peerconnection:setlocaldescriptionfailed", tt = "peerconnection:setremotedescriptionfailed", st = "presentation:start", nt = "presentation:started", it = "presentation:end", Ce = "presentation:ended", U = "presentation:failed", xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9
+ ADDRESS_INCOMPLETE: vt,
10
+ AUTHENTICATION_ERROR: bt,
11
+ BAD_MEDIA_DESCRIPTION: Ft,
12
+ BUSY: Pt,
13
+ BYE: He,
14
+ CANCELED: ke,
15
+ CONNECTION_ERROR: mt,
16
+ DIALOG_ERROR: qt,
17
+ EXPIRES: Ht,
18
+ INCOMPATIBLE_SDP: wt,
19
+ INTERNAL_ERROR: Ot,
20
+ MISSING_SDP: yt,
21
+ NOT_FOUND: Dt,
22
+ NO_ACK: kt,
23
+ NO_ANSWER: Lt,
24
+ REDIRECTED: Mt,
25
+ REJECTED: Le,
26
+ REQUEST_TIMEOUT: Ue,
27
+ RTP_TIMEOUT: Bt,
28
+ SIP_FAILURE_CODE: ft,
29
+ UNAVAILABLE: pt,
30
+ USER_DENIED_MEDIA_ACCESS: Wt,
31
+ WEBRTC_ERROR: Ut
32
+ }, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting", m = "connected", u = "disconnected", p = "newRTCSession", f = "registered", $ = "unregistered", O = "registrationFailed", qe = "newMessage", G = "sipEvent", X = "availableSecondRemoteStream", J = "notAvailableSecondRemoteStream", z = "mustStopPresentation", D = "shareState", Q = "enterRoom", K = "useLicense", j = "peerconnection:confirmed", Z = "peerconnection:ontrack", v = "channels", ee = "channels:notify", te = "ended:fromserver", se = "main-cam-control", ne = "admin-stop-main-cam", ie = "admin-start-main-cam", re = "admin-stop-mic", oe = "admin-start-mic", w = "admin-force-sync-media-state", ae = "participant:added-to-list-moderators", ce = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", _e = "participant:move-request-to-spectators", he = "participation:accepting-word-request", de = "participation:cancelling-word-request", Te = "webcast:started", le = "webcast:stopped", ue = "account:changed", Se = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", We = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", y = "confirmed", b = "peerconnection", C = "failed", $e = "muted", Ge = "unmuted", ge = "newDTMF", Ce = "newInfo", Xe = "hold", Je = "unhold", ze = "update", Qe = "sdp", Ke = "icecandidate", je = "getusermediafailed", Ze = "peerconnection:createofferfailed", et = "peerconnection:createanswerfailed", tt = "peerconnection:setlocaldescriptionfailed", st = "peerconnection:setremotedescriptionfailed", nt = "presentation:start", it = "presentation:started", rt = "presentation:end", Ae = "presentation:ended", U = "presentation:failed", ot = "SPECTATOR", zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
33
33
  __proto__: null,
34
- ACCEPTED: Ye,
34
+ ACCEPTED: xe,
35
35
  ACCOUNT_CHANGED: ue,
36
- ACCOUNT_DELETED: Te,
36
+ ACCOUNT_DELETED: Se,
37
37
  ADMIN_FORCE_SYNC_MEDIA_STATE: w,
38
38
  ADMIN_START_MAIN_CAM: ie,
39
- ADMIN_START_MIC: re,
39
+ ADMIN_START_MIC: oe,
40
40
  ADMIN_STOP_MAIN_CAM: ne,
41
- ADMIN_STOP_MIC: oe,
41
+ ADMIN_STOP_MIC: re,
42
42
  AVAILABLE_SECOND_REMOTE_STREAM_EVENT: X,
43
43
  CHANNELS: v,
44
44
  CHANNELS_NOTIFY: ee,
45
- CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Se,
45
+ CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ne,
46
46
  CONFIRMED: y,
47
47
  CONNECTED: m,
48
48
  CONNECTING: L,
49
49
  DECLINED_INCOMING_CALL: V,
50
- DISCONNECTED: T,
51
- ENDED: D,
50
+ DISCONNECTED: u,
51
+ ENDED: P,
52
52
  ENDED_FROM_SERVER: te,
53
53
  ENTER_ROOM: Q,
54
54
  FAILED: C,
55
55
  FAILED_INCOMING_CALL: Y,
56
- GET_USER_MEDIA_FAILED: Ke,
57
- HOLD: Ge,
58
- ICE_CANDIDATE: Qe,
56
+ GET_USER_MEDIA_FAILED: je,
57
+ HOLD: Xe,
58
+ ICE_CANDIDATE: Ke,
59
59
  INCOMING_CALL: B,
60
60
  MAIN_CAM_CONTROL: se,
61
61
  MUST_STOP_PRESENTATION_EVENT: z,
62
- MUTED: xe,
63
- NEW_DTMF: Ne,
64
- NEW_INFO: ge,
65
- NEW_MESSAGE: ke,
66
- NEW_RTC_SESSION: P,
62
+ MUTED: $e,
63
+ NEW_DTMF: ge,
64
+ NEW_INFO: Ce,
65
+ NEW_MESSAGE: qe,
66
+ NEW_RTC_SESSION: p,
67
67
  NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
68
68
  PARTICIPANT_ADDED_TO_LIST_MODERATORS: ae,
69
+ PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: _e,
69
70
  PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
70
71
  PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: ce,
71
- PARTICIPATION_ACCEPTING_WORD_REQUEST: _e,
72
- PARTICIPATION_CANCELLING_WORD_REQUEST: he,
72
+ PARTICIPATION_ACCEPTING_WORD_REQUEST: he,
73
+ PARTICIPATION_CANCELLING_WORD_REQUEST: de,
73
74
  PEER_CONNECTION: b,
74
75
  PEER_CONNECTION_CONFIRMED: j,
75
- PEER_CONNECTION_CREATE_ANSWER_FAILED: Ze,
76
- PEER_CONNECTION_CREATE_OFFER_FAILED: je,
76
+ PEER_CONNECTION_CREATE_ANSWER_FAILED: et,
77
+ PEER_CONNECTION_CREATE_OFFER_FAILED: Ze,
77
78
  PEER_CONNECTION_ONTRACK: Z,
78
- PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: et,
79
- PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: tt,
80
- PRESENTATION_END: it,
81
- PRESENTATION_ENDED: Ce,
79
+ PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: tt,
80
+ PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: st,
81
+ PRESENTATION_END: rt,
82
+ PRESENTATION_ENDED: Ae,
82
83
  PRESENTATION_FAILED: U,
83
- PRESENTATION_START: st,
84
- PRESENTATION_STARTED: nt,
85
- PROGRESS: Ve,
86
- REFER: Be,
84
+ PRESENTATION_START: nt,
85
+ PRESENTATION_STARTED: it,
86
+ PROGRESS: Ye,
87
+ REFER: Ve,
87
88
  REGISTERED: f,
88
89
  REGISTRATION_FAILED: O,
89
- REINVITE: We,
90
- REPLACES: Fe,
91
- SDP: ze,
92
- SENDING: qe,
93
- SHARE_STATE: p,
90
+ REINVITE: Fe,
91
+ REPLACES: Be,
92
+ SDP: Qe,
93
+ SENDING: We,
94
+ SHARE_STATE: D,
94
95
  SIP_EVENT: G,
96
+ SPECTATOR: ot,
95
97
  TERMINATED_INCOMING_CALL: x,
96
- UNHOLD: Xe,
97
- UNMUTED: $e,
98
+ UNHOLD: Je,
99
+ UNMUTED: Ge,
98
100
  UNREGISTERED: $,
99
- UPDATE: Je,
101
+ UPDATE: ze,
100
102
  USE_LICENSE: K,
101
- WEBCAST_STARTED: de,
103
+ WEBCAST_STARTED: Te,
102
104
  WEBCAST_STOPPED: le
103
- }, Symbol.toStringTag, { value: "Module" })), ot = [
105
+ }, Symbol.toStringTag, { value: "Module" })), at = [
104
106
  B,
105
107
  V,
106
108
  x,
107
109
  Y,
108
- _e,
109
110
  he,
111
+ de,
110
112
  Ee,
111
113
  ee,
112
- Se,
114
+ Ne,
113
115
  ue,
116
+ Se,
114
117
  Te,
115
- de,
116
118
  le,
117
119
  ae,
118
120
  ce
119
- ], Ae = [
121
+ ], Re = [
120
122
  L,
121
123
  m,
122
- T,
123
- P,
124
+ u,
125
+ p,
124
126
  f,
125
127
  $,
126
128
  O,
127
- ke,
129
+ qe,
128
130
  G
129
- ], rt = [
131
+ ], ct = [
130
132
  X,
131
133
  J,
132
134
  z,
133
- p,
135
+ D,
134
136
  Q,
135
137
  K,
136
138
  j,
@@ -140,26 +142,26 @@ const Rt = "Connection Error", be = "Request Timeout", It = "SIP Failure Code",
140
142
  se,
141
143
  ie,
142
144
  ne,
143
- oe,
144
145
  re,
145
- w
146
- ], Re = [
147
- D,
146
+ oe,
147
+ w,
148
+ _e
149
+ ], Ie = [
150
+ P,
148
151
  L,
149
- qe,
150
152
  We,
151
153
  Fe,
152
154
  Be,
153
155
  Ve,
154
156
  Ye,
157
+ xe,
155
158
  y,
156
159
  b,
157
160
  C,
158
- xe,
159
161
  $e,
160
- Ne,
161
- ge,
162
162
  Ge,
163
+ ge,
164
+ Ce,
163
165
  Xe,
164
166
  Je,
165
167
  ze,
@@ -172,74 +174,75 @@ const Rt = "Connection Error", be = "Request Timeout", It = "SIP Failure Code",
172
174
  st,
173
175
  nt,
174
176
  it,
175
- Ce,
177
+ rt,
178
+ Ae,
176
179
  U
177
- ], at = [...Ae, ...ot], ct = [
178
- ...Re,
179
- ...rt
180
- ], $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
180
+ ], Et = [...Re, ...at], _t = [
181
+ ...Ie,
182
+ ...ct
183
+ ], Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
181
184
  __proto__: null,
182
- SESSION_EVENT_NAMES: ct,
183
- SESSION_JSSIP_EVENT_NAMES: Re,
184
- SESSION_SYNTHETICS_EVENT_NAMES: rt,
185
- UA_EVENT_NAMES: at,
186
- UA_JSSIP_EVENT_NAMES: Ae,
187
- UA_SYNTHETICS_EVENT_NAMES: ot
188
- }, Symbol.toStringTag, { value: "Module" })), Ft = (o) => {
185
+ SESSION_EVENT_NAMES: _t,
186
+ SESSION_JSSIP_EVENT_NAMES: Ie,
187
+ SESSION_SYNTHETICS_EVENT_NAMES: ct,
188
+ UA_EVENT_NAMES: Et,
189
+ UA_JSSIP_EVENT_NAMES: Re,
190
+ UA_SYNTHETICS_EVENT_NAMES: at
191
+ }, Symbol.toStringTag, { value: "Module" })), Vt = (r) => {
189
192
  const e = [];
190
- return o && e.push(`X-Vinteo-Remote: ${o}`), e;
191
- }, Bt = "content-type", Vt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", Yt = "application/vinteo.webrtc.roomname", xt = "application/vinteo.webrtc.channels", $t = "application/vinteo.webrtc.mediastate", Gt = "application/vinteo.webrtc.refusal", Oe = "application/vinteo.webrtc.maincam", Xt = "application/vinteo.webrtc.mic", Jt = "application/vinteo.webrtc.uselic", zt = "X-WEBRTC-USE-LICENSE", De = "X-WEBRTC-INPUT-CHANNELS", Me = "X-WEBRTC-OUTPUT-CHANNELS", Qt = "X-WEBRTC-MAINCAM", Kt = "X-WEBRTC-MIC", Pe = "X-WEBRTC-SYNC", jt = "X-WEBRTC-MAINCAM-RESOLUTION", Zt = "X-WEBRTC-MEDIA-STATE", es = "X-Vinteo-Media-Type", ts = "X-Vinteo-MainCam-State", ss = "X-Vinteo-Mic-State", ns = "application/vinteo.webrtc.notify", is = "X-VINTEO-NOTIFY", A = "x-webrtc-share-state", os = `${A}: LETMESTARTPRESENTATION`, rs = `${A}: STOPPRESENTATION`, Et = "YOUCANRECEIVECONTENT", _t = "CONTENTEND", ht = "YOUMUSTSTOPSENDCONTENT", as = `${A}: ${ht}`, cs = `${A}: ${Et}`, Es = `${A}: ${_t}`, _s = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", hs = `${_s}: LETMESTARTMAINCAM`, Ie = "sip-connector", pe = F(Ie), Gs = () => {
192
- F.enable(Ie);
193
- }, Xs = () => {
194
- F.enable(`-${Ie}`);
193
+ return r && e.push(`X-Vinteo-Remote: ${r}`), e;
194
+ }, Yt = "content-type", xt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", $t = "application/vinteo.webrtc.roomname", Gt = "application/vinteo.webrtc.channels", Xt = "application/vinteo.webrtc.mediastate", Jt = "application/vinteo.webrtc.refusal", Pe = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", Kt = "X-WEBRTC-USE-LICENSE", jt = "X-WEBRTC-PARTICIPANT-NAME", Me = "X-WEBRTC-INPUT-CHANNELS", pe = "X-WEBRTC-OUTPUT-CHANNELS", Zt = "X-WEBRTC-MAINCAM", es = "X-WEBRTC-MIC", De = "X-WEBRTC-SYNC", ts = "X-WEBRTC-MAINCAM-RESOLUTION", ss = "X-WEBRTC-MEDIA-STATE", ns = "X-Vinteo-Media-Type", is = "X-Vinteo-MainCam-State", rs = "X-Vinteo-Mic-State", os = "application/vinteo.webrtc.partstate", as = "X-WEBRTC-PARTSTATE", cs = "application/vinteo.webrtc.notify", Es = "X-VINTEO-NOTIFY", A = "x-webrtc-share-state", _s = `${A}: LETMESTARTPRESENTATION`, hs = `${A}: STOPPRESENTATION`, ht = "YOUCANRECEIVECONTENT", dt = "CONTENTEND", Tt = "YOUMUSTSTOPSENDCONTENT", ds = `${A}: ${Tt}`, Ts = `${A}: ${ht}`, ls = `${A}: ${dt}`, us = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Ss = `${us}: LETMESTARTMAINCAM`, me = "sip-connector", ve = F(me), Ks = () => {
195
+ F.enable(me);
196
+ }, js = () => {
197
+ F.enable(`-${me}`);
195
198
  };
196
- var I = /* @__PURE__ */ ((o) => (o.PAUSE_MAIN_CAM = "PAUSEMAINCAM", o.RESUME_MAIN_CAM = "RESUMEMAINCAM", o.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", o.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", o.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", o))(I || {}), k = /* @__PURE__ */ ((o) => (o.ADMIN_STOP_MIC = "ADMINSTOPMIC", o.ADMIN_START_MIC = "ADMINSTARTMIC", o))(k || {}), q = /* @__PURE__ */ ((o) => (o.ADMIN_SYNC_FORCED = "1", o.ADMIN_SYNC_NOT_FORCED = "0", o))(q || {}), ds = /* @__PURE__ */ ((o) => (o.AUDIO = "AUDIO", o.VIDEO = "VIDEO", o.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", o))(ds || {});
197
- function ve(o) {
198
- return (e) => `sip:${e}@${o}`;
199
+ 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 || {}), Ns = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(Ns || {});
200
+ function we(r) {
201
+ return (e) => `sip:${e}@${r}`;
199
202
  }
200
- const ls = (o, e) => () => Math.floor(Math.random() * (e - o)) + o, we = (o) => o.trim().replaceAll(" ", "_"), us = ls(1e5, 99999999), H = (o, {
203
+ const gs = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, ye = (r) => r.trim().replaceAll(" ", "_"), Cs = gs(1e5, 99999999), H = (r, {
201
204
  videoMode: e,
202
205
  audioMode: t
203
206
  } = {}) => {
204
- if (!o || e === "recvonly" && t === "recvonly")
207
+ if (!r || e === "recvonly" && t === "recvonly")
205
208
  return;
206
- const s = t === "recvonly" ? [] : o.getAudioTracks(), n = e === "recvonly" ? [] : o.getVideoTracks(), r = [...s, ...n], a = new MediaStream(r);
209
+ const s = t === "recvonly" ? [] : r.getAudioTracks(), n = e === "recvonly" ? [] : r.getVideoTracks(), o = [...s, ...n], a = new MediaStream(o);
207
210
  return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
208
- }, Ts = (o) => o.some((t) => {
211
+ }, As = (r) => r.some((t) => {
209
212
  const { kind: s } = t;
210
213
  return s === "video";
211
- }), Ss = "Error decline with 603", Ns = (o) => o.message === Ss, gs = (o, e) => o.find((t) => t.track && e.getTracks().includes(t.track)), dt = 1, lt = (o) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== o, Cs = lt(
212
- dt
213
- ), As = (o, e) => {
214
- const t = o === void 0 ? void 0 : Math.max(o, dt);
215
- if (t !== void 0 && Cs(
214
+ }), Rs = "Error decline with 603", Is = (r) => r.message === Rs, ms = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), lt = 1, ut = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, fs = ut(
215
+ lt
216
+ ), Os = (r, e) => {
217
+ const t = r === void 0 ? void 0 : Math.max(r, lt);
218
+ if (t !== void 0 && fs(
216
219
  t,
217
220
  e
218
221
  ))
219
222
  return t;
220
- }, Rs = lt(), Is = (o, e) => {
221
- if (Rs(o, e))
222
- return o;
223
- }, ms = async (o, e, t) => {
224
- const s = o.getParameters();
223
+ }, Ps = ut(), Ms = (r, e) => {
224
+ if (Ps(r, e))
225
+ return r;
226
+ }, ps = async (r, e, t) => {
227
+ const s = r.getParameters();
225
228
  (s.encodings === void 0 || s.encodings.length === 0) && (s.encodings = [{}]);
226
- const [n] = s.encodings, r = n.scaleResolutionDownBy, a = As(
229
+ const [n] = s.encodings, o = n.scaleResolutionDownBy, a = Os(
227
230
  e.scaleResolutionDownBy,
228
- r
231
+ o
229
232
  );
230
233
  let c = !1;
231
234
  a !== void 0 && (s.encodings[0].scaleResolutionDownBy = a, c = !0);
232
- const E = n.maxBitrate, _ = Is(e.maxBitrate, E);
233
- return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), o.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
234
- }, fs = async (o, e, t) => {
235
- const s = gs(o, e);
235
+ const E = n.maxBitrate, _ = Ms(e.maxBitrate, E);
236
+ return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), r.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
237
+ }, Ds = async (r, e, t) => {
238
+ const s = ms(r, e);
236
239
  if (s)
237
- return ms(s, { maxBitrate: t });
238
- }, Os = 486, Ds = 487, W = "local", ye = "remote", Js = (o = new Error()) => {
239
- const { originator: e, cause: t } = o;
240
- return At(o) ? !0 : typeof t == "string" ? t === be || t === Ue || e === W && (t === He || t === Le) : !1;
241
- }, g = "SipConnector", Ms = "channels", Ps = "WebcastStarted", ps = "WebcastStopped", vs = "accountChanged", ws = "accountDeleted", ys = "addedToListModerators", bs = "removedFromListModerators", Us = "ParticipationRequestAccepted", Ls = "ParticipationRequestRejected", Hs = "ParticipantMovedToWebcast", ks = "ConferenceParticipantTokenIssued";
242
- class zs {
240
+ return ps(s, { maxBitrate: t });
241
+ }, vs = 486, ws = 487, W = "local", be = "remote", Zs = (r = new Error()) => {
242
+ const { originator: e, cause: t } = r;
243
+ return It(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === W && (t === ke || t === He) : !1;
244
+ }, g = "SipConnector", ys = "channels", bs = "WebcastStarted", Us = "WebcastStopped", Ls = "accountChanged", Hs = "accountDeleted", ks = "addedToListModerators", qs = "removedFromListModerators", Ws = "ParticipationRequestAccepted", Fs = "ParticipationRequestRejected", Bs = "ParticipantMovedToWebcast", Vs = "ConferenceParticipantTokenIssued";
245
+ class en {
243
246
  constructor({ JsSIP: e }) {
244
247
  i(this, "_isRegisterConfig", !1);
245
248
  i(this, "_connectionConfiguration", {});
@@ -277,24 +280,24 @@ class zs {
277
280
  try {
278
281
  await this.unregister();
279
282
  } catch (e) {
280
- pe("tryRegister", e);
283
+ ve("tryRegister", e);
281
284
  }
282
285
  return this.register();
283
286
  });
284
- i(this, "declineToIncomingCall", async ({ statusCode: e = Ds } = {}) => new Promise((t, s) => {
287
+ i(this, "declineToIncomingCall", async ({ statusCode: e = ws } = {}) => new Promise((t, s) => {
285
288
  if (!this.isAvailableIncomingCall) {
286
289
  s(new Error("no incomingSession"));
287
290
  return;
288
291
  }
289
- const n = this.incomingSession, r = this.remoteCallerData;
290
- this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V, r), t(n.terminate({ status_code: e }));
292
+ const n = this.incomingSession, o = this.remoteCallerData;
293
+ this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V, o), t(n.terminate({ status_code: e }));
291
294
  }));
292
- i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Os }));
295
+ i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: vs }));
293
296
  i(this, "removeIncomingSession", () => {
294
297
  delete this.incomingSession;
295
298
  });
296
299
  i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
297
- if (e === ye) {
300
+ if (e === be) {
298
301
  this.incomingSession = t;
299
302
  const s = this.remoteCallerData;
300
303
  t.on(C, (n) => {
@@ -308,82 +311,82 @@ class zs {
308
311
  password: t,
309
312
  sipServerUrl: s,
310
313
  sipWebSocketServerURL: n,
311
- remoteAddress: r,
314
+ remoteAddress: o,
312
315
  sdpSemantics: a,
313
316
  sessionTimers: c,
314
317
  registerExpires: E,
315
318
  connectionRecoveryMinInterval: _,
316
319
  connectionRecoveryMaxInterval: h,
317
- userAgent: u,
320
+ userAgent: l,
318
321
  displayName: d = "",
319
- register: l = !1,
322
+ register: T = !1,
320
323
  extraHeaders: S = []
321
324
  }) => {
322
325
  if (!s)
323
326
  throw new Error("sipServerUrl is required");
324
327
  if (!n)
325
328
  throw new Error("sipWebSocketServerURL is required");
326
- if (l && !e)
329
+ if (T && !e)
327
330
  throw new Error("user is required for authorized connection");
328
- if (l && !t)
331
+ if (T && !t)
329
332
  throw new Error("password is required for authorized connection");
330
333
  this._connectionConfiguration = {
331
334
  sipServerUrl: s,
332
335
  displayName: d,
333
- register: l,
336
+ register: T,
334
337
  user: e,
335
338
  password: t
336
- }, this.getSipServerUrl = ve(s), this.socket = new this.JsSIP.WebSocketInterface(n), this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l;
339
+ }, this.getSipServerUrl = we(s), this.socket = new this.JsSIP.WebSocketInterface(n), this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!T;
337
340
  const { socket: R } = this;
338
341
  this.ua = this._createUa({
339
342
  user: e,
340
343
  password: t,
341
344
  socket: R,
342
345
  displayName: d,
343
- register: l,
346
+ register: T,
344
347
  sdpSemantics: a,
345
348
  sessionTimers: c,
346
349
  registerExpires: E,
347
350
  connectionRecoveryMinInterval: _,
348
351
  connectionRecoveryMaxInterval: h,
349
- userAgent: u,
352
+ userAgent: l,
350
353
  getSipServerUrl: this.getSipServerUrl
351
- }), this._uaEvents.eachTriggers((Tt, St) => {
352
- const me = Ae.find((Nt) => Nt === St);
353
- me && this.ua && this.ua.on(me, Tt);
354
+ }), this._uaEvents.eachTriggers((Nt, gt) => {
355
+ const fe = Re.find((Ct) => Ct === gt);
356
+ fe && this.ua && this.ua.on(fe, Nt);
354
357
  });
355
- const ut = [...Ft(r), ...S];
356
- return this.ua.registrator().setExtraHeaders(ut), this.ua;
358
+ const St = [...Vt(o), ...S];
359
+ return this.ua.registrator().setExtraHeaders(St), this.ua;
357
360
  });
358
361
  i(this, "_createUa", ({
359
362
  user: e,
360
363
  password: t,
361
364
  socket: s,
362
365
  displayName: n,
363
- getSipServerUrl: r,
366
+ getSipServerUrl: o,
364
367
  register: a = !1,
365
368
  sdpSemantics: c = "plan-b",
366
369
  sessionTimers: E = !1,
367
370
  registerExpires: _ = 60 * 5,
368
371
  // 5 minutes in sec
369
372
  connectionRecoveryMinInterval: h = 2,
370
- connectionRecoveryMaxInterval: u = 6,
373
+ connectionRecoveryMaxInterval: l = 6,
371
374
  userAgent: d
372
375
  }) => {
373
376
  if (a && !t)
374
377
  throw new Error("password is required for authorized connection");
375
- const l = a && e ? e.trim() : `${us()}`, S = r(l), R = {
378
+ const T = a && e ? e.trim() : `${Cs()}`, S = o(T), R = {
376
379
  password: t,
377
380
  register: a,
378
381
  uri: S,
379
- display_name: we(n),
382
+ display_name: ye(n),
380
383
  user_agent: d,
381
384
  sdp_semantics: c,
382
385
  sockets: [s],
383
386
  session_timers: E,
384
387
  register_expires: _,
385
388
  connection_recovery_min_interval: h,
386
- connection_recovery_max_interval: u
389
+ connection_recovery_max_interval: l
387
390
  };
388
391
  return new this.JsSIP.UA(R);
389
392
  });
@@ -395,23 +398,23 @@ class zs {
395
398
  }
396
399
  const n = () => {
397
400
  c(), e(s);
398
- }, r = (E) => {
401
+ }, o = (E) => {
399
402
  c(), t(E);
400
403
  }, a = () => {
401
- this.isRegisterConfig ? (this.on(f, n), this.on(O, r)) : this.on(m, n), this.on(T, r);
404
+ this.isRegisterConfig ? (this.on(f, n), this.on(O, o)) : this.on(m, n), this.on(u, o);
402
405
  }, c = () => {
403
- this.off(f, n), this.off(O, r), this.off(m, n), this.off(T, r);
406
+ this.off(f, n), this.off(O, o), this.off(m, n), this.off(u, o);
404
407
  };
405
- a(), this.on(P, this.handleNewRTCSession), s.start();
408
+ a(), this.on(p, this.handleNewRTCSession), s.start();
406
409
  }));
407
410
  i(this, "_set", async ({ displayName: e, password: t }) => new Promise((s, n) => {
408
- const { ua: r } = this;
409
- if (!r) {
411
+ const { ua: o } = this;
412
+ if (!o) {
410
413
  n(new Error("this.ua is not initialized"));
411
414
  return;
412
415
  }
413
416
  let a = !1, c = !1;
414
- e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name", we(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = r.set("password", t), this._connectionConfiguration.password = t);
417
+ e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name", ye(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = o.set("password", t), this._connectionConfiguration.password = t);
415
418
  const E = a || c;
416
419
  c && this.isRegisterConfig ? this.register().then(() => {
417
420
  s(E);
@@ -421,34 +424,34 @@ class zs {
421
424
  }));
422
425
  i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
423
426
  i(this, "_disconnect", async () => {
424
- this.off(P, this.handleNewRTCSession);
427
+ this.off(p, this.handleNewRTCSession);
425
428
  const e = new Promise((t) => {
426
- this.once(T, () => {
429
+ this.once(u, () => {
427
430
  delete this.ua, t();
428
431
  });
429
432
  });
430
- return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(T, void 0)) : this._uaEvents.trigger(T, void 0), e;
433
+ return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(u, void 0)) : this._uaEvents.trigger(u, void 0), e;
431
434
  });
432
435
  i(this, "_call", async ({
433
436
  number: e,
434
437
  mediaStream: t,
435
438
  extraHeaders: s = [],
436
439
  ontrack: n,
437
- iceServers: r,
440
+ iceServers: o,
438
441
  videoMode: a,
439
442
  audioMode: c,
440
443
  degradationPreference: E,
441
444
  offerToReceiveAudio: _ = !0,
442
445
  offerToReceiveVideo: h = !0
443
- }) => new Promise((u, d) => {
444
- const { ua: l } = this;
445
- if (!l) {
446
+ }) => new Promise((l, d) => {
447
+ const { ua: T } = this;
448
+ if (!T) {
446
449
  d(new Error("this.ua is not initialized"));
447
450
  return;
448
451
  }
449
- this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(u).catch((S) => {
452
+ this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(l).catch((S) => {
450
453
  d(S);
451
- }), this.session = l.call(this.getSipServerUrl(e), {
454
+ }), this.session = T.call(this.getSipServerUrl(e), {
452
455
  extraHeaders: s,
453
456
  mediaStream: H(t, {
454
457
  videoMode: a,
@@ -459,7 +462,7 @@ class zs {
459
462
  audioMode: c,
460
463
  degradationPreference: E,
461
464
  pcConfig: {
462
- iceServers: r
465
+ iceServers: o
463
466
  },
464
467
  rtcOfferConstraints: {
465
468
  offerToReceiveAudio: _,
@@ -472,7 +475,7 @@ class zs {
472
475
  ontrack: t,
473
476
  extraHeaders: s = [],
474
477
  iceServers: n,
475
- videoMode: r,
478
+ videoMode: o,
476
479
  audioMode: a,
477
480
  degradationPreference: c
478
481
  }) => new Promise((E, _) => {
@@ -486,22 +489,22 @@ class zs {
486
489
  _(new Error("No session established"));
487
490
  return;
488
491
  }
489
- this._sessionEvents.eachTriggers((d, l) => {
490
- const S = Re.find((R) => R === l);
492
+ this._sessionEvents.eachTriggers((d, T) => {
493
+ const S = Ie.find((R) => R === T);
491
494
  S && h.on(S, d);
492
495
  }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((d) => {
493
496
  _(d);
494
497
  });
495
- const u = H(e, {
496
- videoMode: r,
498
+ const l = H(e, {
499
+ videoMode: o,
497
500
  audioMode: a
498
501
  });
499
502
  h.answer({
500
503
  extraHeaders: s,
501
- videoMode: r,
504
+ videoMode: o,
502
505
  audioMode: a,
503
506
  degradationPreference: c,
504
- mediaStream: u,
507
+ mediaStream: l,
505
508
  pcConfig: {
506
509
  iceServers: n
507
510
  }
@@ -509,23 +512,23 @@ class zs {
509
512
  }));
510
513
  i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
511
514
  const n = () => {
512
- this.onSession(b, h), this.onSession(y, u);
513
- }, r = () => {
514
- this.offSession(b, h), this.offSession(y, u);
515
+ this.onSession(b, h), this.onSession(y, l);
516
+ }, o = () => {
517
+ this.offSession(b, h), this.offSession(y, l);
515
518
  }, a = () => {
516
- this.onSession(C, E), this.onSession(D, E);
519
+ this.onSession(C, E), this.onSession(P, E);
517
520
  }, c = () => {
518
- this.offSession(C, E), this.offSession(D, E);
521
+ this.offSession(C, E), this.offSession(P, E);
519
522
  }, E = (d) => {
520
- r(), c(), s(d);
523
+ o(), c(), s(d);
521
524
  };
522
525
  let _;
523
526
  const h = ({ peerconnection: d }) => {
524
- _ = d, _.ontrack = (l) => {
525
- this._sessionEvents.trigger(Z, _), e && e(l);
527
+ _ = d, _.ontrack = (T) => {
528
+ this._sessionEvents.trigger(Z, _), e && e(T);
526
529
  };
527
- }, u = () => {
528
- _ && this._sessionEvents.trigger(j, _), r(), c(), t(_);
530
+ }, l = () => {
531
+ _ && this._sessionEvents.trigger(j, _), o(), c(), t(_);
529
532
  };
530
533
  n(), a();
531
534
  }));
@@ -538,8 +541,8 @@ class zs {
538
541
  s(new Error("No session established"));
539
542
  return;
540
543
  }
541
- this.onceSession(Ne, ({ originator: r }) => {
542
- r === W && t();
544
+ this.onceSession(ge, ({ originator: o }) => {
545
+ o === W && t();
543
546
  }), n.sendDTMF(e, {
544
547
  duration: 120,
545
548
  interToneGap: 600
@@ -553,22 +556,22 @@ class zs {
553
556
  });
554
557
  i(this, "_handleShareState", (e) => {
555
558
  switch (e) {
556
- case Et: {
559
+ case ht: {
557
560
  this._sessionEvents.trigger(X, void 0);
558
561
  break;
559
562
  }
560
- case _t: {
563
+ case dt: {
561
564
  this._sessionEvents.trigger(J, void 0);
562
565
  break;
563
566
  }
564
- case ht: {
567
+ case Tt: {
565
568
  this._sessionEvents.trigger(z, void 0);
566
569
  break;
567
570
  }
568
571
  }
569
572
  });
570
573
  i(this, "_maybeTriggerChannels", (e) => {
571
- const t = e.getHeader(De), s = e.getHeader(Me);
574
+ const t = e.getHeader(Me), s = e.getHeader(pe);
572
575
  if (t && s) {
573
576
  const n = {
574
577
  inputChannels: t,
@@ -579,61 +582,61 @@ class zs {
579
582
  });
580
583
  i(this, "_handleNotify", (e) => {
581
584
  switch (e.cmd) {
582
- case Ms: {
585
+ case ys: {
583
586
  const t = e;
584
587
  this._triggerChannelsNotify(t);
585
588
  break;
586
589
  }
587
- case Ps: {
590
+ case bs: {
588
591
  const t = e;
589
592
  this._triggerWebcastStartedNotify(t);
590
593
  break;
591
594
  }
592
- case ps: {
595
+ case Us: {
593
596
  const t = e;
594
597
  this._triggerWebcastStoppedNotify(t);
595
598
  break;
596
599
  }
597
- case ys: {
600
+ case ks: {
598
601
  const t = e;
599
602
  this._triggerAddedToListModeratorsNotify(t);
600
603
  break;
601
604
  }
602
- case bs: {
605
+ case qs: {
603
606
  const t = e;
604
607
  this._triggerRemovedFromListModeratorsNotify(t);
605
608
  break;
606
609
  }
607
- case Us: {
610
+ case Ws: {
608
611
  const t = e;
609
612
  this._triggerParticipationAcceptingWordRequest(t);
610
613
  break;
611
614
  }
612
- case Ls: {
615
+ case Fs: {
613
616
  const t = e;
614
617
  this._triggerParticipationCancellingWordRequest(t);
615
618
  break;
616
619
  }
617
- case Hs: {
620
+ case Bs: {
618
621
  const t = e;
619
622
  this._triggerParticipantMoveRequestToStream(t);
620
623
  break;
621
624
  }
622
- case vs: {
625
+ case Ls: {
623
626
  this._triggerAccountChangedNotify();
624
627
  break;
625
628
  }
626
- case ws: {
629
+ case Hs: {
627
630
  this._triggerAccountDeletedNotify();
628
631
  break;
629
632
  }
630
- case ks: {
633
+ case Vs: {
631
634
  const t = e;
632
635
  this._triggerConferenceParticipantTokenIssued(t);
633
636
  break;
634
637
  }
635
638
  default:
636
- pe("unknown cmd", e.cmd);
639
+ ve("unknown cmd", e.cmd);
637
640
  }
638
641
  });
639
642
  i(this, "_triggerRemovedFromListModeratorsNotify", ({
@@ -658,7 +661,7 @@ class zs {
658
661
  conference: e,
659
662
  type: t
660
663
  };
661
- this._uaEvents.trigger(de, s);
664
+ this._uaEvents.trigger(Te, s);
662
665
  });
663
666
  i(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
664
667
  const s = {
@@ -671,7 +674,7 @@ class zs {
671
674
  this._uaEvents.trigger(ue, void 0);
672
675
  });
673
676
  i(this, "_triggerAccountDeletedNotify", () => {
674
- this._uaEvents.trigger(Te, void 0);
677
+ this._uaEvents.trigger(Se, void 0);
675
678
  });
676
679
  i(this, "_triggerConferenceParticipantTokenIssued", ({
677
680
  body: { conference: e, participant: t, jwt: s }
@@ -682,7 +685,7 @@ class zs {
682
685
  jwt: s
683
686
  };
684
687
  this._uaEvents.trigger(
685
- Se,
688
+ Ne,
686
689
  n
687
690
  );
688
691
  });
@@ -699,7 +702,7 @@ class zs {
699
702
  const t = {
700
703
  conference: e
701
704
  };
702
- this._uaEvents.trigger(_e, t);
705
+ this._uaEvents.trigger(he, t);
703
706
  });
704
707
  i(this, "_triggerParticipationCancellingWordRequest", ({
705
708
  body: { conference: e }
@@ -707,7 +710,7 @@ class zs {
707
710
  const t = {
708
711
  conference: e
709
712
  };
710
- this._uaEvents.trigger(he, t);
713
+ this._uaEvents.trigger(de, t);
711
714
  });
712
715
  i(this, "_triggerParticipantMoveRequestToStream", ({
713
716
  body: { conference: e }
@@ -718,15 +721,18 @@ class zs {
718
721
  this._uaEvents.trigger(Ee, t);
719
722
  });
720
723
  i(this, "_triggerEnterRoom", (e) => {
721
- const t = e.getHeader(Vt);
722
- this._sessionEvents.trigger(Q, t);
724
+ const t = e.getHeader(xt), s = e.getHeader(jt);
725
+ this._sessionEvents.trigger(Q, { room: t, participantName: s });
723
726
  });
724
727
  i(this, "_triggerShareState", (e) => {
725
728
  const t = e.getHeader(A);
726
- this._sessionEvents.trigger(p, t);
729
+ this._sessionEvents.trigger(D, t);
730
+ });
731
+ i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
732
+ e.getHeader(as) === ot && this._sessionEvents.trigger(_e, void 0);
727
733
  });
728
734
  i(this, "_triggerMainCamControl", (e) => {
729
- const t = e.getHeader(Qt), s = e.getHeader(Pe), n = s === q.ADMIN_SYNC_FORCED;
735
+ const t = e.getHeader(Zt), s = e.getHeader(De), n = s === q.ADMIN_SYNC_FORCED;
730
736
  if (t === I.ADMIN_START_MAIN_CAM)
731
737
  this._sessionEvents.trigger(ie, { isSyncForced: n });
732
738
  else if (t === I.ADMIN_STOP_MAIN_CAM)
@@ -734,33 +740,33 @@ class zs {
734
740
  else if ((t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && s)
735
741
  this._sessionEvents.trigger(w, { isSyncForced: n });
736
742
  else {
737
- const r = e.getHeader(jt);
743
+ const o = e.getHeader(ts);
738
744
  this._sessionEvents.trigger(se, {
739
745
  mainCam: t,
740
- resolutionMainCam: r
746
+ resolutionMainCam: o
741
747
  });
742
748
  }
743
749
  });
744
750
  i(this, "_triggerMicControl", (e) => {
745
- const t = e.getHeader(Kt), n = e.getHeader(Pe) === q.ADMIN_SYNC_FORCED;
746
- t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(re, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: n });
751
+ const t = e.getHeader(es), n = e.getHeader(De) === q.ADMIN_SYNC_FORCED;
752
+ t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(oe, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(re, { isSyncForced: n });
747
753
  });
748
754
  i(this, "_triggerUseLicense", (e) => {
749
- const t = e.getHeader(zt);
755
+ const t = e.getHeader(Kt);
750
756
  this._sessionEvents.trigger(K, t);
751
757
  });
752
758
  i(this, "_handleNewInfo", (e) => {
753
759
  const { originator: t } = e;
754
760
  if (t !== "remote")
755
761
  return;
756
- const { request: s } = e, n = s.getHeader(Bt);
762
+ const { request: s } = e, n = s.getHeader(Yt);
757
763
  if (n)
758
764
  switch (n) {
759
- case Yt: {
765
+ case $t: {
760
766
  this._triggerEnterRoom(s), this._maybeTriggerChannels(s);
761
767
  break;
762
768
  }
763
- case ns: {
769
+ case cs: {
764
770
  this._maybeHandleNotify(s);
765
771
  break;
766
772
  }
@@ -768,25 +774,29 @@ class zs {
768
774
  this._triggerShareState(s);
769
775
  break;
770
776
  }
771
- case Oe: {
777
+ case Pe: {
772
778
  this._triggerMainCamControl(s);
773
779
  break;
774
780
  }
775
- case Xt: {
781
+ case zt: {
776
782
  this._triggerMicControl(s);
777
783
  break;
778
784
  }
779
- case Jt: {
785
+ case Qt: {
780
786
  this._triggerUseLicense(s);
781
787
  break;
782
788
  }
789
+ case os: {
790
+ this._maybeTriggerParticipantMoveRequestToSpectators(s);
791
+ break;
792
+ }
783
793
  }
784
794
  });
785
795
  i(this, "_handleSipEvent", ({ request: e }) => {
786
796
  this._maybeHandleNotify(e);
787
797
  });
788
798
  i(this, "_maybeHandleNotify", (e) => {
789
- const t = e.getHeader(is);
799
+ const t = e.getHeader(Es);
790
800
  if (t) {
791
801
  const s = JSON.parse(t);
792
802
  this._handleNotify(s);
@@ -794,9 +804,9 @@ class zs {
794
804
  });
795
805
  i(this, "_handleEnded", (e) => {
796
806
  const { originator: t } = e;
797
- t === ye && this._sessionEvents.trigger(te, e), this._restoreSession();
807
+ t === be && this._sessionEvents.trigger(te, e), this._restoreSession();
798
808
  });
799
- this.JsSIP = e, this._sessionEvents = new fe(ct), this._uaEvents = new fe(at), this._cancelableConnect = new N(
809
+ this.JsSIP = e, this._sessionEvents = new Oe(_t), this._uaEvents = new Oe(Et), this._cancelableConnect = new N(
800
810
  this._connect,
801
811
  {
802
812
  moduleName: g,
@@ -815,7 +825,7 @@ class zs {
815
825
  }), this._cancelableCall = new N(
816
826
  this._call,
817
827
  { moduleName: g }
818
- ), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(p, this._handleShareState), this.onSession(ge, this._handleNewInfo), this.on(G, this._handleSipEvent), this.onSession(C, this._handleEnded), this.onSession(D, this._handleEnded);
828
+ ), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(D, this._handleShareState), this.onSession(Ce, this._handleNewInfo), this.on(G, this._handleSipEvent), this.onSession(C, this._handleEnded), this.onSession(P, this._handleEnded);
819
829
  }
820
830
  async register() {
821
831
  return new Promise((e, t) => {
@@ -830,7 +840,7 @@ class zs {
830
840
  async sendOptions(e, t, s) {
831
841
  if (!this.ua)
832
842
  throw new Error("is not connected");
833
- return new Promise((n, r) => {
843
+ return new Promise((n, o) => {
834
844
  try {
835
845
  this.ua.sendOptions(e, t, {
836
846
  extraHeaders: s,
@@ -838,11 +848,11 @@ class zs {
838
848
  succeeded: () => {
839
849
  n();
840
850
  },
841
- failed: r
851
+ failed: o
842
852
  }
843
853
  });
844
854
  } catch (a) {
845
- r(a);
855
+ o(a);
846
856
  }
847
857
  });
848
858
  }
@@ -858,22 +868,22 @@ class zs {
858
868
  displayName: t,
859
869
  sipServerUrl: s,
860
870
  sipWebSocketServerURL: n,
861
- sdpSemantics: r
871
+ sdpSemantics: o
862
872
  }) {
863
873
  return new Promise((a, c) => {
864
- const E = ve(s), _ = new this.JsSIP.WebSocketInterface(n), h = this._createUa({
874
+ const E = we(s), _ = new this.JsSIP.WebSocketInterface(n), h = this._createUa({
865
875
  socket: _,
866
876
  displayName: t,
867
- sdpSemantics: r,
877
+ sdpSemantics: o,
868
878
  userAgent: e,
869
879
  getSipServerUrl: E
870
- }), u = () => {
871
- const l = new Error("Telephony is not available");
872
- c(l);
880
+ }), l = () => {
881
+ const T = new Error("Telephony is not available");
882
+ c(T);
873
883
  };
874
- h.once(T, u);
884
+ h.once(u, l);
875
885
  const d = () => {
876
- h.removeAllListeners(), h.once(T, a), h.stop();
886
+ h.removeAllListeners(), h.once(u, a), h.stop();
877
887
  };
878
888
  h.once(m, d), h.start();
879
889
  });
@@ -886,13 +896,13 @@ class zs {
886
896
  async askPermissionToEnableCam(e = {}) {
887
897
  if (!this.session)
888
898
  throw new Error("No session established");
889
- const t = [hs];
890
- return this.session.sendInfo(Oe, void 0, {
899
+ const t = [Ss];
900
+ return this.session.sendInfo(Pe, void 0, {
891
901
  noTerminateWhenError: !0,
892
902
  ...e,
893
903
  extraHeaders: t
894
904
  }).catch((s) => {
895
- if (Ns(s))
905
+ if (Is(s))
896
906
  throw s;
897
907
  });
898
908
  }
@@ -902,23 +912,23 @@ class zs {
902
912
  async _sendPresentation(e, t, {
903
913
  maxBitrate: s,
904
914
  degradationPreference: n,
905
- isNeedReinvite: r = !0,
915
+ isNeedReinvite: o = !0,
906
916
  isP2P: a = !1
907
917
  }) {
908
918
  const c = H(t);
909
919
  this._streamPresentationCurrent = c;
910
- const E = a ? [cs] : [os], _ = e.sendInfo(M, void 0, {
920
+ const E = a ? [Ts] : [_s], _ = e.sendInfo(M, void 0, {
911
921
  extraHeaders: E
912
922
  }).then(async () => e.startPresentation(
913
923
  c,
914
- r,
924
+ o,
915
925
  n
916
926
  )).then(async () => {
917
927
  const { connection: h } = this;
918
928
  if (!h || s === void 0)
919
929
  return;
920
- const u = h.getSenders();
921
- await fs(u, t, s);
930
+ const l = h.getSenders();
931
+ await Ds(l, t, s);
922
932
  }).then(() => t).catch((h) => {
923
933
  throw this._sessionEvents.trigger(U, h), h;
924
934
  });
@@ -930,7 +940,7 @@ class zs {
930
940
  isNeedReinvite: t = !0,
931
941
  isP2P: s = !1,
932
942
  maxBitrate: n,
933
- degradationPreference: r
943
+ degradationPreference: o
934
944
  } = {}) {
935
945
  const a = this.establishedSession;
936
946
  if (!a)
@@ -941,12 +951,12 @@ class zs {
941
951
  isNeedReinvite: t,
942
952
  isP2P: s,
943
953
  maxBitrate: n,
944
- degradationPreference: r
954
+ degradationPreference: o
945
955
  });
946
956
  }
947
957
  async sendMustStopPresentation(e) {
948
958
  await e.sendInfo(M, void 0, {
949
- extraHeaders: [as]
959
+ extraHeaders: [ds]
950
960
  });
951
961
  }
952
962
  async stopPresentation({
@@ -954,12 +964,12 @@ class zs {
954
964
  } = {}) {
955
965
  const t = this._streamPresentationCurrent;
956
966
  let s = this.promisePendingStartPresentation ?? Promise.resolve();
957
- const n = e ? [Es] : [rs], r = this.establishedSession;
958
- return r && t && (s = s.then(async () => r.sendInfo(M, void 0, {
967
+ const n = e ? [ls] : [hs], o = this.establishedSession;
968
+ return o && t && (s = s.then(async () => o.sendInfo(M, void 0, {
959
969
  extraHeaders: n
960
- })).then(async () => r.stopPresentation(t)).catch((a) => {
970
+ })).then(async () => o.stopPresentation(t)).catch((a) => {
961
971
  throw this._sessionEvents.trigger(U, a), a;
962
- })), !r && t && this._sessionEvents.trigger(Ce, t), this.promisePendingStopPresentation = s, s.finally(() => {
972
+ })), !o && t && this._sessionEvents.trigger(Ae, t), this.promisePendingStopPresentation = s, s.finally(() => {
963
973
  this._resetPresentation();
964
974
  });
965
975
  }
@@ -968,12 +978,12 @@ class zs {
968
978
  maxBitrate: s,
969
979
  degradationPreference: n
970
980
  } = {}) {
971
- const r = this.establishedSession;
972
- if (!r)
981
+ const o = this.establishedSession;
982
+ if (!o)
973
983
  throw new Error("No session established");
974
984
  if (!this._streamPresentationCurrent)
975
985
  throw new Error("Presentation has not started yet");
976
- return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(r, e, {
986
+ return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(o, e, {
977
987
  isP2P: t,
978
988
  maxBitrate: s,
979
989
  degradationPreference: n,
@@ -1023,18 +1033,18 @@ class zs {
1023
1033
  if (!this.connection)
1024
1034
  return;
1025
1035
  const t = this.connection.getReceivers().map(({ track: s }) => s);
1026
- return Ts(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
1036
+ return As(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
1027
1037
  }
1028
1038
  get connection() {
1029
1039
  var t;
1030
1040
  return (t = this.session) == null ? void 0 : t.connection;
1031
1041
  }
1032
1042
  get remoteCallerData() {
1033
- var e, t, s, n, r, a;
1043
+ var e, t, s, n, o, a;
1034
1044
  return {
1035
1045
  displayName: (t = (e = this.incomingSession) == null ? void 0 : e.remote_identity) == null ? void 0 : t.display_name,
1036
1046
  host: (n = (s = this.incomingSession) == null ? void 0 : s.remote_identity) == null ? void 0 : n.uri.host,
1037
- incomingNumber: (a = (r = this.incomingSession) == null ? void 0 : r.remote_identity) == null ? void 0 : a.uri.user,
1047
+ incomingNumber: (a = (o = this.incomingSession) == null ? void 0 : o.remote_identity) == null ? void 0 : a.uri.user,
1038
1048
  session: this.incomingSession
1039
1049
  };
1040
1050
  }
@@ -1042,7 +1052,8 @@ class zs {
1042
1052
  return this._cancelableConnect.requested || this._cancelableInitUa.requested || this._cancelableCall.requested || this._cancelableAnswer.requested;
1043
1053
  }
1044
1054
  get establishedSession() {
1045
- return this.session && this.session.isEstablished() ? this.session : void 0;
1055
+ var e;
1056
+ return (e = this.session) != null && e.isEstablished() ? this.session : void 0;
1046
1057
  }
1047
1058
  get isRegistered() {
1048
1059
  return !!this.ua && this.ua.isRegistered();
@@ -1069,10 +1080,10 @@ class zs {
1069
1080
  return e.forEach((s, n) => {
1070
1081
  if (s.kind === "audio")
1071
1082
  return;
1072
- const r = s, a = e[n - 1];
1083
+ const o = s, a = e[n - 1];
1073
1084
  let c;
1074
1085
  a && a.kind === "audio" && (c = a);
1075
- const E = this._generateStream(r, c);
1086
+ const E = this._generateStream(o, c);
1076
1087
  t.push(E);
1077
1088
  }), t;
1078
1089
  }
@@ -1100,21 +1111,21 @@ class zs {
1100
1111
  async sendChannels({ inputChannels: e, outputChannels: t }) {
1101
1112
  if (!this.session)
1102
1113
  throw new Error("No session established");
1103
- const s = `${De}: ${e}`, n = `${Me}: ${t}`, r = [
1114
+ const s = `${Me}: ${e}`, n = `${pe}: ${t}`, o = [
1104
1115
  s,
1105
1116
  n
1106
1117
  ];
1107
- return this.session.sendInfo(xt, void 0, { extraHeaders: r });
1118
+ return this.session.sendInfo(Gt, void 0, { extraHeaders: o });
1108
1119
  }
1109
1120
  async sendMediaState({ cam: e, mic: t }, s = {}) {
1110
1121
  if (!this.session)
1111
1122
  throw new Error("No session established");
1112
- const n = `${Zt}: currentstate`, r = `${ts}: ${Number(e)}`, a = `${ss}: ${Number(t)}`, c = [
1123
+ const n = `${ss}: currentstate`, o = `${is}: ${Number(e)}`, a = `${rs}: ${Number(t)}`, c = [
1113
1124
  n,
1114
- r,
1125
+ o,
1115
1126
  a
1116
1127
  ];
1117
- return this.session.sendInfo($t, void 0, {
1128
+ return this.session.sendInfo(Xt, void 0, {
1118
1129
  noTerminateWhenError: !0,
1119
1130
  ...s,
1120
1131
  extraHeaders: c
@@ -1123,8 +1134,8 @@ class zs {
1123
1134
  async _sendRefusalToTurnOn(e, t = {}) {
1124
1135
  if (!this.session)
1125
1136
  throw new Error("No session established");
1126
- const c = [`${es}: ${e === "mic" ? 0 : 1}`];
1127
- return this.session.sendInfo(Gt, void 0, {
1137
+ const c = [`${ns}: ${e === "mic" ? 0 : 1}`];
1138
+ return this.session.sendInfo(Jt, void 0, {
1128
1139
  noTerminateWhenError: !0,
1129
1140
  ...t,
1130
1141
  extraHeaders: c
@@ -1142,22 +1153,22 @@ class zs {
1142
1153
  }
1143
1154
  }
1144
1155
  export {
1145
- qt as B,
1156
+ Ft as B,
1146
1157
  I as E,
1147
- Mt as N,
1148
- Ue as R,
1149
- zs as S,
1150
- at as U,
1151
- xs as a,
1152
- Gs as b,
1153
- Ys as c,
1154
- Xs as d,
1155
- $s as e,
1158
+ Dt as N,
1159
+ Le as R,
1160
+ en as S,
1161
+ Et as U,
1162
+ zs as a,
1163
+ Ks as b,
1164
+ Js as c,
1165
+ js as d,
1166
+ Qs as e,
1156
1167
  k as f,
1157
1168
  q as g,
1158
- Js as h,
1159
- ds as i,
1160
- ct as j,
1161
- pe as l,
1162
- ms as s
1169
+ Zs as h,
1170
+ Ns as i,
1171
+ _t as j,
1172
+ ve as l,
1173
+ ps as s
1163
1174
  };