sip-connector 9.2.1 → 10.0.0

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