sip-connector 7.0.10 → 8.1.0

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