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