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