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