sip-connector 6.22.3 → 6.24.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.
@@ -1,10 +1,10 @@
1
1
  var Nt = Object.defineProperty;
2
2
  var gt = (r, e, t) => e in r ? Nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var i = (r, e, t) => (gt(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { CancelableRequest as T, isCanceledError as Ct } from "@krivega/cancelable-promise";
5
- import Oe from "events-constructor";
6
- import W 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", Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4
+ import { CancelableRequest as S, isCanceledError as Ct } from "@krivega/cancelable-promise";
5
+ import fe from "events-constructor";
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({
8
8
  __proto__: null,
9
9
  ADDRESS_INCOMPLETE: Mt,
10
10
  AUTHENTICATION_ERROR: vt,
@@ -29,29 +29,29 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
29
29
  UNAVAILABLE: Ot,
30
30
  USER_DENIED_MEDIA_ACCESS: Ht,
31
31
  WEBRTC_ERROR: wt
32
- }, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", b = "connecting", O = "connected", N = "disconnected", D = "newRTCSession", A = "registered", G = "unregistered", R = "registrationFailed", ke = "newMessage", $ = "sipEvent", X = "availableSecondRemoteStream", J = "notAvailableSecondRemoteStream", z = "mustStopPresentation", M = "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", p = "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", I = "ended", qe = "sending", Fe = "reinvite", We = "replaces", Be = "refer", Ve = "progress", Ye = "accepted", v = "confirmed", w = "peerconnection", g = "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", y = "presentation:failed", xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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({
33
33
  __proto__: null,
34
34
  ACCEPTED: Ye,
35
35
  ACCOUNT_CHANGED: ue,
36
36
  ACCOUNT_DELETED: Te,
37
- ADMIN_FORCE_SYNC_MEDIA_STATE: p,
37
+ ADMIN_FORCE_SYNC_MEDIA_STATE: v,
38
38
  ADMIN_START_MAIN_CAM: ie,
39
39
  ADMIN_START_MIC: oe,
40
40
  ADMIN_STOP_MAIN_CAM: ne,
41
41
  ADMIN_STOP_MIC: re,
42
42
  AVAILABLE_SECOND_REMOTE_STREAM_EVENT: X,
43
- CHANNELS: P,
43
+ CHANNELS: p,
44
44
  CHANNELS_NOTIFY: ee,
45
45
  CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Se,
46
- CONFIRMED: v,
47
- CONNECTED: O,
48
- CONNECTING: b,
46
+ CONFIRMED: w,
47
+ CONNECTED: I,
48
+ CONNECTING: U,
49
49
  DECLINED_INCOMING_CALL: V,
50
- DISCONNECTED: N,
51
- ENDED: I,
50
+ DISCONNECTED: T,
51
+ ENDED: O,
52
52
  ENDED_FROM_SERVER: te,
53
53
  ENTER_ROOM: Q,
54
- FAILED: g,
54
+ FAILED: C,
55
55
  FAILED_INCOMING_CALL: Y,
56
56
  GET_USER_MEDIA_FAILED: Ke,
57
57
  HOLD: $e,
@@ -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: D,
66
+ NEW_RTC_SESSION: M,
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: w,
73
+ PEER_CONNECTION: y,
74
74
  PEER_CONNECTION_CONFIRMED: j,
75
75
  PEER_CONNECTION_CREATE_ANSWER_FAILED: Ze,
76
76
  PEER_CONNECTION_CREATE_OFFER_FAILED: je,
@@ -79,18 +79,18 @@ 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: y,
82
+ PRESENTATION_FAILED: b,
83
83
  PRESENTATION_START: st,
84
84
  PRESENTATION_STARTED: nt,
85
85
  PROGRESS: Ve,
86
86
  REFER: Be,
87
- REGISTERED: A,
88
- REGISTRATION_FAILED: R,
89
- REINVITE: Fe,
90
- REPLACES: We,
87
+ REGISTERED: m,
88
+ REGISTRATION_FAILED: f,
89
+ REINVITE: We,
90
+ REPLACES: Fe,
91
91
  SDP: ze,
92
92
  SENDING: qe,
93
- SHARE_STATE: M,
93
+ SHARE_STATE: P,
94
94
  SIP_EVENT: $,
95
95
  TERMINATED_INCOMING_CALL: x,
96
96
  UNHOLD: Xe,
@@ -117,44 +117,44 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
117
117
  ae,
118
118
  ce
119
119
  ], Ae = [
120
- b,
121
- O,
122
- N,
123
- D,
124
- A,
120
+ U,
121
+ I,
122
+ T,
123
+ M,
124
+ m,
125
125
  G,
126
- R,
126
+ f,
127
127
  ke,
128
128
  $
129
129
  ], ot = [
130
130
  X,
131
131
  J,
132
132
  z,
133
- M,
133
+ P,
134
134
  Q,
135
135
  K,
136
136
  j,
137
137
  Z,
138
- P,
138
+ p,
139
139
  te,
140
140
  se,
141
141
  ie,
142
142
  ne,
143
143
  re,
144
144
  oe,
145
- p
145
+ v
146
146
  ], Re = [
147
- I,
148
- b,
147
+ O,
148
+ U,
149
149
  qe,
150
- Fe,
151
150
  We,
151
+ Fe,
152
152
  Be,
153
153
  Ve,
154
154
  Ye,
155
- v,
156
155
  w,
157
- g,
156
+ y,
157
+ C,
158
158
  xe,
159
159
  Ge,
160
160
  Ne,
@@ -173,11 +173,11 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
173
173
  nt,
174
174
  it,
175
175
  Ce,
176
- y
176
+ b
177
177
  ], at = [...Ae, ...rt], ct = [
178
178
  ...Re,
179
179
  ...ot
180
- ], Gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
180
+ ], xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
181
181
  __proto__: null,
182
182
  SESSION_EVENT_NAMES: ct,
183
183
  SESSION_JSSIP_EVENT_NAMES: Re,
@@ -185,19 +185,19 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
185
185
  UA_EVENT_NAMES: at,
186
186
  UA_JSSIP_EVENT_NAMES: Ae,
187
187
  UA_SYNTHETICS_EVENT_NAMES: rt
188
- }, Symbol.toStringTag, { value: "Module" })), Ft = (r) => {
188
+ }, Symbol.toStringTag, { value: "Module" })), Wt = (r) => {
189
189
  const e = [];
190
190
  return r && e.push(`X-Vinteo-Remote: ${r}`), e;
191
- }, Wt = "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", De = "application/vinteo.webrtc.maincam", $t = "application/vinteo.webrtc.mic", Xt = "application/vinteo.webrtc.uselic", Jt = "X-WEBRTC-USE-LICENSE", Me = "X-WEBRTC-INPUT-CHANNELS", Pe = "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", m = "x-webrtc-share-state", is = `${m}: LETMESTARTPRESENTATION`, rs = `${m}: STOPPRESENTATION`, Et = "YOUCANRECEIVECONTENT", _t = "CONTENTEND", os = "YOUMUSTSTOPSENDCONTENT", as = `${m}: ${Et}`, cs = `${m}: ${_t}`, Es = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", _s = `${Es}: LETMESTARTMAINCAM`, Ie = "sip-connector", ve = W(Ie), $s = () => {
192
- W.enable(Ie);
193
- }, Xs = () => {
194
- W.enable(`-${Ie}`);
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 = () => {
192
+ F.enable(Ie);
193
+ }, $s = () => {
194
+ F.enable(`-${Ie}`);
195
195
  };
196
- var C = /* @__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))(C || {}), 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 ds(r) {
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
198
  return (e) => `sip:${e}@${r}`;
199
199
  }
200
- const ls = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) => r.trim().replaceAll(" ", "_"), us = ls(1e5, 99999999), H = (r, {
200
+ const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) => r.trim().replaceAll(" ", "_"), ls = ds(1e5, 99999999), H = (r, {
201
201
  videoMode: e,
202
202
  audioMode: t
203
203
  } = {}) => {
@@ -205,41 +205,41 @@ const ls = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) =>
205
205
  return;
206
206
  const s = t === "recvonly" ? [] : r.getAudioTracks(), n = e === "recvonly" ? [] : r.getVideoTracks(), o = [...s, ...n], a = new MediaStream(o);
207
207
  return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
208
- }, Ts = (r) => r.some((t) => {
208
+ }, us = (r) => r.some((t) => {
209
209
  const { kind: s } = t;
210
210
  return s === "video";
211
- }), Ss = "Error decline with 603", Ns = (r) => r.message === Ss, gs = (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, Cs = dt(
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
212
  ht
213
- ), As = (r, e) => {
213
+ ), Cs = (r, e) => {
214
214
  const t = r === void 0 ? void 0 : Math.max(r, ht);
215
- if (t !== void 0 && Cs(
215
+ if (t !== void 0 && gs(
216
216
  t,
217
217
  e
218
218
  ))
219
219
  return t;
220
- }, Rs = dt(), Is = (r, e) => {
221
- if (Rs(r, e))
220
+ }, As = dt(), Rs = (r, e) => {
221
+ if (As(r, e))
222
222
  return r;
223
- }, ms = async (r, e, t) => {
223
+ }, Is = async (r, e, t) => {
224
224
  const s = r.getParameters();
225
225
  (s.encodings === void 0 || s.encodings.length === 0) && (s.encodings = [{}]);
226
- const [n] = s.encodings, o = n.scaleResolutionDownBy, a = As(
226
+ const [n] = s.encodings, o = n.scaleResolutionDownBy, a = Cs(
227
227
  e.scaleResolutionDownBy,
228
228
  o
229
229
  );
230
230
  let c = !1;
231
231
  a !== void 0 && (s.encodings[0].scaleResolutionDownBy = a, c = !0);
232
- const E = n.maxBitrate, _ = Is(e.maxBitrate, E);
233
- return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), r.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
234
- }, fs = async (r, e, t) => {
235
- const s = gs(r, e);
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);
236
236
  if (s)
237
- return ms(s, { maxBitrate: t });
238
- }, Os = 486, Ds = 487, F = "local", ye = "remote", Js = (r = new Error()) => {
237
+ return Is(s, { maxBitrate: t });
238
+ }, fs = 486, Os = 487, W = "local", ye = "remote", Xs = (r = new Error()) => {
239
239
  const { originator: e, cause: t } = r;
240
- return Ct(r) ? !0 : typeof t == "string" ? t === be || t === Ue || e === F && (t === He || t === Le) : !1;
241
- }, S = "SipConnector", Ms = "channels", Ps = "WebcastStarted", ps = "WebcastStopped", vs = "accountChanged", ws = "accountDeleted", ys = "addedToListModerators", bs = "removedFromListModerators", Us = "ParticipationRequestAccepted", Ls = "ParticipationRequestRejected", Hs = "ParticipantMovedToWebcast", ks = "ConferenceParticipantTokenIssued";
242
- class zs {
240
+ return 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 {
243
243
  constructor({ JsSIP: e }) {
244
244
  i(this, "_isRegisterConfig", !1);
245
245
  i(this, "_connectionConfiguration", {});
@@ -248,7 +248,7 @@ class zs {
248
248
  i(this, "_sessionEvents");
249
249
  i(this, "_uaEvents");
250
250
  i(this, "_cancelableConnect");
251
- i(this, "_cancelableCreateUa");
251
+ i(this, "_cancelableInitUa");
252
252
  i(this, "_cancelableDisconnect");
253
253
  i(this, "_cancelableSet");
254
254
  i(this, "_cancelableCall");
@@ -263,7 +263,7 @@ class zs {
263
263
  i(this, "_streamPresentationCurrent");
264
264
  i(this, "socket");
265
265
  i(this, "connect", async (e) => (this._cancelRequests(), this._cancelableConnect.request(e)));
266
- i(this, "createUa", async (e) => this._cancelableCreateUa.request(e));
266
+ i(this, "initUa", async (e) => this._cancelableInitUa.request(e));
267
267
  i(this, "set", async (e) => this._cancelableSet.request(e));
268
268
  i(this, "call", async (e) => this._cancelableCall.request(e));
269
269
  i(this, "disconnect", async () => (this._cancelRequests(), this._disconnectWithoutCancelRequests()));
@@ -273,15 +273,15 @@ class zs {
273
273
  i(this, "tryRegister", async () => {
274
274
  if (!this.isRegisterConfig)
275
275
  throw new Error("Config is not registered");
276
- this._uaEvents.trigger(b, void 0);
276
+ this._uaEvents.trigger(U, void 0);
277
277
  try {
278
278
  await this.unregister();
279
279
  } catch (e) {
280
- ve("tryRegister", e);
280
+ pe("tryRegister", e);
281
281
  }
282
282
  return this.register();
283
283
  });
284
- i(this, "declineToIncomingCall", async ({ statusCode: e = Ds } = {}) => new Promise((t, s) => {
284
+ i(this, "declineToIncomingCall", async ({ statusCode: e = Os } = {}) => new Promise((t, s) => {
285
285
  if (!this.isAvailableIncomingCall) {
286
286
  s(new Error("no incomingSession"));
287
287
  return;
@@ -289,7 +289,7 @@ class zs {
289
289
  const n = this.incomingSession, o = this.remoteCallerData;
290
290
  this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V, o), t(n.terminate({ status_code: e }));
291
291
  }));
292
- i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Os }));
292
+ i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: fs }));
293
293
  i(this, "removeIncomingSession", () => {
294
294
  delete this.incomingSession;
295
295
  });
@@ -297,64 +297,96 @@ class zs {
297
297
  if (e === ye) {
298
298
  this.incomingSession = t;
299
299
  const s = this.remoteCallerData;
300
- t.on(g, (n) => {
301
- this.removeIncomingSession(), n.originator === F ? this._uaEvents.trigger(x, s) : this._uaEvents.trigger(Y, s);
300
+ t.on(C, (n) => {
301
+ this.removeIncomingSession(), n.originator === W ? this._uaEvents.trigger(x, s) : this._uaEvents.trigger(Y, s);
302
302
  }), this._uaEvents.trigger(B, s);
303
303
  }
304
304
  });
305
- i(this, "_connect", async (e) => this.createUa(e).then(async () => this._start()));
306
- i(this, "_createUa", async ({
307
- displayName: e = "",
308
- user: t,
309
- password: s,
310
- register: n = !1,
311
- sipServerUrl: o,
312
- sipWebSocketServerURL: a,
313
- remoteAddress: c,
314
- extraHeaders: E = [],
315
- sdpSemantics: _ = "plan-b",
316
- sessionTimers: h = !1,
317
- registerExpires: d = 60 * 5,
318
- // 5 minutes in sec
319
- connectionRecoveryMinInterval: l = 2,
320
- connectionRecoveryMaxInterval: u = 6,
321
- userAgent: f
305
+ i(this, "_connect", async (e) => this.initUa(e).then(async () => this._start()));
306
+ i(this, "_initUa", async ({
307
+ user: e,
308
+ password: t,
309
+ sipServerUrl: s,
310
+ sipWebSocketServerURL: n,
311
+ remoteAddress: o,
312
+ sdpSemantics: a,
313
+ sessionTimers: c,
314
+ registerExpires: E,
315
+ connectionRecoveryMinInterval: h,
316
+ connectionRecoveryMaxInterval: _,
317
+ userAgent: u,
318
+ displayName: l = "",
319
+ register: d = !1,
320
+ extraHeaders: g = []
322
321
  }) => {
323
- if (!o)
322
+ if (!s)
324
323
  throw new Error("sipServerUrl is required");
325
- if (!a)
324
+ if (!n)
326
325
  throw new Error("sipWebSocketServerURL is required");
327
- if (n && !t)
326
+ if (d && !e)
328
327
  throw new Error("user is required for authorized connection");
329
- if (n && !s)
328
+ if (d && !t)
330
329
  throw new Error("password is required for authorized connection");
331
330
  this._connectionConfiguration = {
332
- sipServerUrl: o,
333
- displayName: e,
334
- register: n,
335
- user: t,
336
- password: s
337
- }, this._init({ sipServerUrl: o, sipWebSocketServerURL: a });
338
- const U = n && t ? t.trim() : `${us()}`, me = {
339
- password: s,
340
- register: n,
341
- display_name: we(e),
342
- user_agent: f,
343
- sdp_semantics: _,
344
- sockets: [this.socket],
345
- uri: this.getSipServerUrl(U),
346
- session_timers: h,
347
- register_expires: d,
348
- connection_recovery_min_interval: l,
349
- connection_recovery_max_interval: u
350
- };
351
- this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!me.register, this.ua = new this.JsSIP.UA(me), this._uaEvents.eachTriggers((ut, Tt) => {
352
- const fe = Ae.find((St) => St === Tt);
353
- fe && this.ua && this.ua.on(fe, ut);
331
+ sipServerUrl: s,
332
+ displayName: l,
333
+ register: d,
334
+ user: e,
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;
338
+ this.ua = this._createUa({
339
+ user: e,
340
+ password: t,
341
+ socket: A,
342
+ displayName: l,
343
+ register: d,
344
+ sdpSemantics: a,
345
+ sessionTimers: c,
346
+ registerExpires: E,
347
+ connectionRecoveryMinInterval: h,
348
+ connectionRecoveryMaxInterval: _,
349
+ userAgent: u,
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);
354
354
  });
355
- const lt = [...Ft(c), ...E];
355
+ const lt = [...Wt(o), ...g];
356
356
  return this.ua.registrator().setExtraHeaders(lt), this.ua;
357
357
  });
358
+ i(this, "_createUa", ({
359
+ user: e,
360
+ password: t,
361
+ socket: s,
362
+ displayName: n,
363
+ getSipServerUrl: o,
364
+ register: a = !1,
365
+ sdpSemantics: c = "plan-b",
366
+ sessionTimers: E = !1,
367
+ registerExpires: h = 60 * 5,
368
+ // 5 minutes in sec
369
+ connectionRecoveryMinInterval: _ = 2,
370
+ connectionRecoveryMaxInterval: u = 6,
371
+ userAgent: l
372
+ }) => {
373
+ if (a && !t)
374
+ throw new Error("password is required for authorized connection");
375
+ const d = a && e ? e.trim() : `${ls()}`, g = o(d), A = {
376
+ password: t,
377
+ register: a,
378
+ uri: g,
379
+ display_name: we(n),
380
+ user_agent: l,
381
+ sdp_semantics: c,
382
+ sockets: [s],
383
+ session_timers: E,
384
+ register_expires: h,
385
+ connection_recovery_min_interval: _,
386
+ connection_recovery_max_interval: u
387
+ };
388
+ return new this.JsSIP.UA(A);
389
+ });
358
390
  i(this, "_start", async () => new Promise((e, t) => {
359
391
  const { ua: s } = this;
360
392
  if (!s) {
@@ -366,11 +398,11 @@ class zs {
366
398
  }, o = (E) => {
367
399
  c(), t(E);
368
400
  }, a = () => {
369
- this.isRegisterConfig ? (this.on(A, n), this.on(R, o)) : this.on(O, n), this.on(N, o);
401
+ this.isRegisterConfig ? (this.on(m, n), this.on(f, o)) : this.on(I, n), this.on(T, o);
370
402
  }, c = () => {
371
- this.off(A, n), this.off(R, o), this.off(O, n), this.off(N, o);
403
+ this.off(m, n), this.off(f, o), this.off(I, n), this.off(T, o);
372
404
  };
373
- a(), this.on(D, this.handleNewRTCSession), s.start();
405
+ a(), this.on(M, this.handleNewRTCSession), s.start();
374
406
  }));
375
407
  i(this, "_set", async ({ displayName: e, password: t }) => new Promise((s, n) => {
376
408
  const { ua: o } = this;
@@ -387,13 +419,13 @@ class zs {
387
419
  }));
388
420
  i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
389
421
  i(this, "_disconnect", async () => {
390
- this.off(D, this.handleNewRTCSession);
422
+ this.off(M, this.handleNewRTCSession);
391
423
  const e = new Promise((t) => {
392
- this.once(N, () => {
424
+ this.once(T, () => {
393
425
  delete this.ua, t();
394
426
  });
395
427
  });
396
- return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(N, void 0)) : this._uaEvents.trigger(N, void 0), e;
428
+ return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(T, void 0)) : this._uaEvents.trigger(T, void 0), e;
397
429
  });
398
430
  i(this, "_call", async ({
399
431
  number: e,
@@ -404,15 +436,15 @@ class zs {
404
436
  videoMode: a,
405
437
  audioMode: c,
406
438
  degradationPreference: E,
407
- offerToReceiveAudio: _ = !0,
408
- offerToReceiveVideo: h = !0
409
- }) => new Promise((d, l) => {
410
- const { ua: u } = this;
411
- if (!u) {
439
+ offerToReceiveAudio: h = !0,
440
+ offerToReceiveVideo: _ = !0
441
+ }) => new Promise((u, l) => {
442
+ const { ua: d } = this;
443
+ if (!d) {
412
444
  l(new Error("this.ua is not initialized"));
413
445
  return;
414
446
  }
415
- this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(d).catch(l), this.session = u.call(this.getSipServerUrl(e), {
447
+ this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(u).catch(l), this.session = d.call(this.getSipServerUrl(e), {
416
448
  extraHeaders: s,
417
449
  mediaStream: H(t, {
418
450
  videoMode: a,
@@ -426,8 +458,8 @@ class zs {
426
458
  iceServers: o
427
459
  },
428
460
  rtcOfferConstraints: {
429
- offerToReceiveAudio: _,
430
- offerToReceiveVideo: h
461
+ offerToReceiveAudio: h,
462
+ offerToReceiveVideo: _
431
463
  }
432
464
  });
433
465
  }));
@@ -439,31 +471,31 @@ class zs {
439
471
  videoMode: o,
440
472
  audioMode: a,
441
473
  degradationPreference: c
442
- }) => new Promise((E, _) => {
474
+ }) => new Promise((E, h) => {
443
475
  if (!this.isAvailableIncomingCall) {
444
- _(new Error("no incomingSession"));
476
+ h(new Error("no incomingSession"));
445
477
  return;
446
478
  }
447
479
  this.session = this.incomingSession, this.removeIncomingSession();
448
- const { session: h } = this;
449
- if (!h) {
450
- _(new Error("No session established"));
480
+ const { session: _ } = this;
481
+ if (!_) {
482
+ h(new Error("No session established"));
451
483
  return;
452
484
  }
453
- this._sessionEvents.eachTriggers((l, u) => {
454
- const f = Re.find((U) => U === u);
455
- f && h.on(f, l);
456
- }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch(_);
457
- const d = H(e, {
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
+ const u = H(e, {
458
490
  videoMode: o,
459
491
  audioMode: a
460
492
  });
461
- h.answer({
493
+ _.answer({
462
494
  extraHeaders: s,
463
495
  videoMode: o,
464
496
  audioMode: a,
465
497
  degradationPreference: c,
466
- mediaStream: d,
498
+ mediaStream: u,
467
499
  pcConfig: {
468
500
  iceServers: n
469
501
  }
@@ -471,23 +503,23 @@ class zs {
471
503
  }));
472
504
  i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
473
505
  const n = () => {
474
- this.onSession(w, h), this.onSession(v, d);
506
+ this.onSession(y, _), this.onSession(w, u);
475
507
  }, o = () => {
476
- this.offSession(w, h), this.offSession(v, d);
508
+ this.offSession(y, _), this.offSession(w, u);
477
509
  }, a = () => {
478
- this.onSession(g, E), this.onSession(I, E);
510
+ this.onSession(C, E), this.onSession(O, E);
479
511
  }, c = () => {
480
- this.offSession(g, E), this.offSession(I, E);
512
+ this.offSession(C, E), this.offSession(O, E);
481
513
  }, E = (l) => {
482
514
  o(), c(), s(l);
483
515
  };
484
- let _;
485
- const h = ({ peerconnection: l }) => {
486
- _ = l, _.ontrack = (u) => {
487
- this._sessionEvents.trigger(Z, _), e && e(u);
516
+ let h;
517
+ const _ = ({ peerconnection: l }) => {
518
+ h = l, h.ontrack = (d) => {
519
+ this._sessionEvents.trigger(Z, h), e && e(d);
488
520
  };
489
- }, d = () => {
490
- _ && this._sessionEvents.trigger(j, _), o(), c(), t(_);
521
+ }, u = () => {
522
+ h && this._sessionEvents.trigger(j, h), o(), c(), t(h);
491
523
  };
492
524
  n(), a();
493
525
  }));
@@ -501,7 +533,7 @@ class zs {
501
533
  return;
502
534
  }
503
535
  this.onceSession(Ne, ({ originator: o }) => {
504
- o === F && t();
536
+ o === W && t();
505
537
  }), n.sendDTMF(e, {
506
538
  duration: 120,
507
539
  interToneGap: 600
@@ -530,72 +562,72 @@ class zs {
530
562
  }
531
563
  });
532
564
  i(this, "_maybeTriggerChannels", (e) => {
533
- const t = e.getHeader(Me), s = e.getHeader(Pe);
565
+ const t = e.getHeader(De), s = e.getHeader(Me);
534
566
  if (t && s) {
535
567
  const n = {
536
568
  inputChannels: t,
537
569
  outputChannels: s
538
570
  };
539
- this._sessionEvents.trigger(P, n);
571
+ this._sessionEvents.trigger(p, n);
540
572
  }
541
573
  });
542
574
  i(this, "_handleNotify", (e) => {
543
575
  switch (e.cmd) {
544
- case Ms: {
576
+ case Ds: {
545
577
  const t = e;
546
578
  this._triggerChannelsNotify(t);
547
579
  break;
548
580
  }
549
- case Ps: {
581
+ case Ms: {
550
582
  const t = e;
551
583
  this._triggerWebcastStartedNotify(t);
552
584
  break;
553
585
  }
554
- case ps: {
586
+ case Ps: {
555
587
  const t = e;
556
588
  this._triggerWebcastStoppedNotify(t);
557
589
  break;
558
590
  }
559
- case ys: {
591
+ case ws: {
560
592
  const t = e;
561
593
  this._triggerAddedToListModeratorsNotify(t);
562
594
  break;
563
595
  }
564
- case bs: {
596
+ case ys: {
565
597
  const t = e;
566
598
  this._triggerRemovedFromListModeratorsNotify(t);
567
599
  break;
568
600
  }
569
- case Us: {
601
+ case bs: {
570
602
  const t = e;
571
603
  this._triggerParticipationAcceptingWordRequest(t);
572
604
  break;
573
605
  }
574
- case Ls: {
606
+ case Us: {
575
607
  const t = e;
576
608
  this._triggerParticipationCancellingWordRequest(t);
577
609
  break;
578
610
  }
579
- case Hs: {
611
+ case Ls: {
580
612
  const t = e;
581
613
  this._triggerParticipantMoveRequestToStream(t);
582
614
  break;
583
615
  }
584
- case vs: {
616
+ case ps: {
585
617
  this._triggerAccountChangedNotify();
586
618
  break;
587
619
  }
588
- case ws: {
620
+ case vs: {
589
621
  this._triggerAccountDeletedNotify();
590
622
  break;
591
623
  }
592
- case ks: {
624
+ case Hs: {
593
625
  const t = e;
594
626
  this._triggerConferenceParticipantTokenIssued(t);
595
627
  break;
596
628
  }
597
629
  default:
598
- ve("unknown cmd", e.cmd);
630
+ pe("unknown cmd", e.cmd);
599
631
  }
600
632
  });
601
633
  i(this, "_triggerRemovedFromListModeratorsNotify", ({
@@ -684,17 +716,17 @@ class zs {
684
716
  this._sessionEvents.trigger(Q, t);
685
717
  });
686
718
  i(this, "_triggerShareState", (e) => {
687
- const t = e.getHeader(m);
688
- this._sessionEvents.trigger(M, t);
719
+ const t = e.getHeader(D);
720
+ this._sessionEvents.trigger(P, t);
689
721
  });
690
722
  i(this, "_triggerMainCamControl", (e) => {
691
- const t = e.getHeader(zt), s = e.getHeader(pe), n = s === q.ADMIN_SYNC_FORCED;
692
- if (t === C.ADMIN_START_MAIN_CAM)
723
+ const t = e.getHeader(zt), s = e.getHeader(Pe), n = s === q.ADMIN_SYNC_FORCED;
724
+ if (t === R.ADMIN_START_MAIN_CAM)
693
725
  this._sessionEvents.trigger(ie, { isSyncForced: n });
694
- else if (t === C.ADMIN_STOP_MAIN_CAM)
726
+ else if (t === R.ADMIN_STOP_MAIN_CAM)
695
727
  this._sessionEvents.trigger(ne, { isSyncForced: n });
696
- else if ((t === C.RESUME_MAIN_CAM || t === C.PAUSE_MAIN_CAM) && s)
697
- this._sessionEvents.trigger(p, { isSyncForced: n });
728
+ else if ((t === R.RESUME_MAIN_CAM || t === R.PAUSE_MAIN_CAM) && s)
729
+ this._sessionEvents.trigger(v, { isSyncForced: n });
698
730
  else {
699
731
  const o = e.getHeader(Kt);
700
732
  this._sessionEvents.trigger(se, {
@@ -704,7 +736,7 @@ class zs {
704
736
  }
705
737
  });
706
738
  i(this, "_triggerMicControl", (e) => {
707
- const t = e.getHeader(Qt), n = e.getHeader(pe) === q.ADMIN_SYNC_FORCED;
739
+ const t = e.getHeader(Qt), n = e.getHeader(Pe) === q.ADMIN_SYNC_FORCED;
708
740
  t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(oe, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(re, { isSyncForced: n });
709
741
  });
710
742
  i(this, "_triggerUseLicense", (e) => {
@@ -715,7 +747,7 @@ class zs {
715
747
  const { originator: t } = e;
716
748
  if (t !== "remote")
717
749
  return;
718
- const { request: s } = e, n = s.getHeader(Wt);
750
+ const { request: s } = e, n = s.getHeader(Ft);
719
751
  if (n)
720
752
  switch (n) {
721
753
  case Vt: {
@@ -730,7 +762,7 @@ class zs {
730
762
  this._triggerShareState(s);
731
763
  break;
732
764
  }
733
- case De: {
765
+ case Oe: {
734
766
  this._triggerMainCamControl(s);
735
767
  break;
736
768
  }
@@ -758,27 +790,30 @@ class zs {
758
790
  const { originator: t } = e;
759
791
  t === ye && this._sessionEvents.trigger(te, e), this._restoreSession();
760
792
  });
761
- this.JsSIP = e, this._sessionEvents = new Oe(ct), this._uaEvents = new Oe(at), this._cancelableConnect = new T(
793
+ this.JsSIP = e, this._sessionEvents = new fe(ct), this._uaEvents = new fe(at), this._cancelableConnect = new S(
762
794
  this._connect,
763
795
  {
764
- moduleName: S,
796
+ moduleName: N,
765
797
  afterCancelRequest: () => {
766
- this._cancelableCreateUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
798
+ this._cancelableInitUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
767
799
  }
768
800
  }
769
- ), this._cancelableCreateUa = new T(this._createUa, { moduleName: S }), this._cancelableDisconnect = new T(
801
+ ), this._cancelableInitUa = new S(
802
+ this._initUa,
803
+ { moduleName: N }
804
+ ), this._cancelableDisconnect = new S(
770
805
  this._disconnect,
771
- { moduleName: S }
772
- ), this._cancelableSet = new T(this._set, {
773
- moduleName: S
774
- }), this._cancelableCall = new T(
806
+ { moduleName: N }
807
+ ), this._cancelableSet = new S(this._set, {
808
+ moduleName: N
809
+ }), this._cancelableCall = new S(
775
810
  this._call,
776
- { moduleName: S }
777
- ), this._cancelableAnswer = new T(this._answer, { moduleName: S }), this._cancelableSendDTMF = new T(this._sendDTMF, { moduleName: S }), this.onSession(M, this._handleShareState), this.onSession(ge, this._handleNewInfo), this.on($, this._handleSipEvent), this.onSession(g, this._handleEnded), this.onSession(I, this._handleEnded);
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);
778
813
  }
779
814
  async register() {
780
815
  return new Promise((e, t) => {
781
- this.isRegisterConfig && this.ua ? (this.ua.on(A, e), this.ua.on(R, t), this.ua.register()) : t(new Error("Config is not registered"));
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"));
782
817
  });
783
818
  }
784
819
  async unregister() {
@@ -812,6 +847,31 @@ class zs {
812
847
  const s = this.ua.configuration.uri;
813
848
  return this.sendOptions(s, e, t);
814
849
  }
850
+ async checkTelephony({
851
+ userAgent: e,
852
+ displayName: t,
853
+ sipServerUrl: s,
854
+ sipWebSocketServerURL: n,
855
+ sdpSemantics: o
856
+ }) {
857
+ return new Promise((a, c) => {
858
+ const E = ve(s), h = new this.JsSIP.WebSocketInterface(n), _ = this._createUa({
859
+ socket: h,
860
+ displayName: t,
861
+ sdpSemantics: o,
862
+ userAgent: e,
863
+ getSipServerUrl: E
864
+ }), u = () => {
865
+ const d = new Error("Telephony is not available");
866
+ c(d);
867
+ };
868
+ _.once(T, u);
869
+ const l = () => {
870
+ _.removeAllListeners(), _.once(T, a), _.stop();
871
+ };
872
+ _.once(I, l), _.start();
873
+ });
874
+ }
815
875
  async replaceMediaStream(e, t) {
816
876
  if (!this.session)
817
877
  throw new Error("No session established");
@@ -821,12 +881,12 @@ class zs {
821
881
  if (!this.session)
822
882
  throw new Error("No session established");
823
883
  const t = [_s];
824
- return this.session.sendInfo(De, void 0, {
884
+ return this.session.sendInfo(Oe, void 0, {
825
885
  noTerminateWhenError: !0,
826
886
  ...e,
827
887
  extraHeaders: t
828
888
  }).catch((s) => {
829
- if (Ns(s))
889
+ if (Ss(s))
830
890
  throw s;
831
891
  });
832
892
  }
@@ -841,22 +901,22 @@ class zs {
841
901
  }) {
842
902
  const c = H(t);
843
903
  this._streamPresentationCurrent = c;
844
- const E = a ? [as] : [is], _ = e.sendInfo(L, void 0, {
904
+ const E = a ? [as] : [is], h = e.sendInfo(L, void 0, {
845
905
  extraHeaders: E
846
906
  }).then(async () => e.startPresentation(
847
907
  c,
848
908
  o,
849
909
  n
850
910
  )).then(async () => {
851
- const { connection: h } = this;
852
- if (!h || s === void 0)
911
+ const { connection: _ } = this;
912
+ if (!_ || s === void 0)
853
913
  return;
854
- const d = h.getSenders();
855
- return fs(d, t, s);
856
- }).then(() => t).catch((h) => {
857
- throw this._sessionEvents.trigger(y, h), h;
914
+ const u = _.getSenders();
915
+ await ms(u, t, s);
916
+ }).then(() => t).catch((_) => {
917
+ throw this._sessionEvents.trigger(b, _), _;
858
918
  });
859
- return this.promisePendingStartPresentation = _, _.finally(() => {
919
+ return this.promisePendingStartPresentation = h, h.finally(() => {
860
920
  this.promisePendingStartPresentation = void 0;
861
921
  });
862
922
  }
@@ -887,7 +947,7 @@ class zs {
887
947
  return o && t && (s = s.then(async () => o.sendInfo(L, void 0, {
888
948
  extraHeaders: n
889
949
  })).then(async () => o.stopPresentation(t)).catch((a) => {
890
- throw this._sessionEvents.trigger(y, a), a;
950
+ throw this._sessionEvents.trigger(b, a), a;
891
951
  })), !o && t && this._sessionEvents.trigger(Ce, t), this.promisePendingStopPresentation = s, s.finally(() => {
892
952
  this._resetPresentation();
893
953
  });
@@ -952,7 +1012,7 @@ class zs {
952
1012
  if (!this.connection)
953
1013
  return;
954
1014
  const t = this.connection.getReceivers().map(({ track: s }) => s);
955
- return Ts(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
1015
+ return us(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
956
1016
  }
957
1017
  get connection() {
958
1018
  var t;
@@ -968,7 +1028,7 @@ class zs {
968
1028
  };
969
1029
  }
970
1030
  get requested() {
971
- return this._cancelableConnect.requested || this._cancelableCreateUa.requested || this._cancelableCall.requested || this._cancelableAnswer.requested;
1031
+ return this._cancelableConnect.requested || this._cancelableInitUa.requested || this._cancelableCall.requested || this._cancelableAnswer.requested;
972
1032
  }
973
1033
  get establishedSession() {
974
1034
  return this.session && this.session.isEstablished() ? this.session : void 0;
@@ -985,12 +1045,6 @@ class zs {
985
1045
  get isAvailableIncomingCall() {
986
1046
  return !!this.incomingSession;
987
1047
  }
988
- _init({
989
- sipServerUrl: e,
990
- sipWebSocketServerURL: t
991
- }) {
992
- this.getSipServerUrl = ds(e), this.socket = new this.JsSIP.WebSocketInterface(t);
993
- }
994
1048
  _generateStream(e, t) {
995
1049
  const { id: s } = e, n = this._remoteStreams[s] || new MediaStream();
996
1050
  return t && n.addTrack(t), n.addTrack(e), this._remoteStreams[s] = n, n;
@@ -1027,15 +1081,15 @@ class zs {
1027
1081
  this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
1028
1082
  }
1029
1083
  async waitChannels() {
1030
- return this.waitSession(P);
1084
+ return this.waitSession(p);
1031
1085
  }
1032
1086
  async waitSyncMediaState() {
1033
- return this.waitSession(p);
1087
+ return this.waitSession(v);
1034
1088
  }
1035
1089
  async sendChannels({ inputChannels: e, outputChannels: t }) {
1036
1090
  if (!this.session)
1037
1091
  throw new Error("No session established");
1038
- const s = `${Me}: ${e}`, n = `${Pe}: ${t}`, o = [
1092
+ const s = `${De}: ${e}`, n = `${Me}: ${t}`, o = [
1039
1093
  s,
1040
1094
  n
1041
1095
  ];
@@ -1078,21 +1132,21 @@ class zs {
1078
1132
  }
1079
1133
  export {
1080
1134
  kt as B,
1081
- C as E,
1135
+ R as E,
1082
1136
  Dt as N,
1083
1137
  Ue as R,
1084
- zs as S,
1138
+ Js as S,
1085
1139
  at as U,
1086
- xs as a,
1087
- $s as b,
1088
- Ys as c,
1089
- Xs as d,
1090
- Gs as e,
1140
+ Ys as a,
1141
+ Gs as b,
1142
+ Vs as c,
1143
+ $s as d,
1144
+ xs as e,
1091
1145
  k as f,
1092
1146
  q as g,
1093
- Js as h,
1147
+ Xs as h,
1094
1148
  hs as i,
1095
1149
  ct as j,
1096
- ve as l,
1097
- ms as s
1150
+ pe as l,
1151
+ Is as s
1098
1152
  };