sip-connector 6.24.1 → 6.24.3

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