sip-connector 8.2.1 → 8.3.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-BCc5pokv.cjs +1 -0
- package/dist/{SipConnector-CpJaoOHN.js → SipConnector-DagL4rCl.js} +216 -205
- package/dist/SipConnector.d.ts +6 -5
- package/dist/__fixtures__/BaseSession.mock.d.ts +0 -1
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +0 -1
- package/dist/__fixtures__/Registrator.mock.d.ts +0 -1
- package/dist/__fixtures__/Request.mock.d.ts +0 -1
- package/dist/__fixtures__/Session.mock.d.ts +0 -1
- package/dist/__fixtures__/UA.mock.d.ts +0 -1
- package/dist/__fixtures__/index.d.ts +0 -1
- package/dist/__fixtures__/jssip.mock.d.ts +0 -1
- package/dist/constants.d.ts +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.d.ts +0 -1
- package/dist/doMock.js +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +107 -105
- package/dist/logger.d.ts +0 -1
- package/dist/tools/__fixtures__/call.d.ts +0 -1
- package/dist/tools/__fixtures__/connectToServer.d.ts +0 -1
- package/dist/tools/__fixtures__/hasValidUri.d.ts +0 -1
- package/dist/tools/__fixtures__/processRequest.d.ts +0 -1
- package/dist/tools/answerIncomingCall.d.ts +0 -1
- package/dist/tools/callToServer.d.ts +0 -1
- package/dist/tools/connectToServer.d.ts +0 -1
- package/dist/tools/disconnectFromServer.d.ts +0 -1
- package/dist/tools/error/getLinkError.d.ts +0 -1
- package/dist/tools/error/getTypeFromError.d.ts +0 -1
- package/dist/tools/error/getValuesFromError.d.ts +0 -1
- package/dist/tools/prepareMediaStream.d.ts +7 -0
- package/dist/tools/resolveAskPermissionToEnableCam.d.ts +0 -1
- package/dist/tools/resolveGetRemoteStreams.d.ts +0 -1
- package/dist/tools/resolveOnMoveToSpectators.d.ts +0 -1
- package/dist/tools/resolveOnMustStopPresentation.d.ts +0 -1
- package/dist/tools/resolveOnUseLicense.d.ts +0 -1
- package/dist/tools/resolveSendMediaState.d.ts +0 -1
- package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +0 -1
- package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +0 -1
- package/dist/tools/resolveStartPresentation.d.ts +4 -4
- package/dist/tools/resolveStopShareSipConnector.d.ts +0 -1
- package/dist/tools/resolveUpdatePresentation.d.ts +0 -1
- package/dist/tools/resolveUpdateRemoteStreams.d.ts +1 -1
- package/dist/tools/setVideoTrackContentHints.d.ts +3 -0
- package/dist/tools/syncMediaState/index.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +0 -4
- package/dist/videoSendingBalancer/balance.d.ts +0 -1
- package/dist/videoSendingBalancer/index.d.ts +0 -1
- package/dist/videoSendingBalancer/processSender.d.ts +0 -1
- package/package.json +19 -17
- package/dist/SipConnector-Dg0Vq0lq.cjs +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
import { CancelableRequest as N, isCanceledError as
|
|
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
5
|
import Pe from "events-constructor";
|
|
6
6
|
import { repeatedCallsAsync as Oe } from "repeated-calls";
|
|
7
7
|
import B from "debug";
|
|
8
|
-
const
|
|
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({
|
|
9
9
|
__proto__: null,
|
|
10
|
-
ADDRESS_INCOMPLETE:
|
|
11
|
-
AUTHENTICATION_ERROR:
|
|
12
|
-
BAD_MEDIA_DESCRIPTION:
|
|
13
|
-
BUSY:
|
|
10
|
+
ADDRESS_INCOMPLETE: yt,
|
|
11
|
+
AUTHENTICATION_ERROR: Ut,
|
|
12
|
+
BAD_MEDIA_DESCRIPTION: Bt,
|
|
13
|
+
BUSY: Ot,
|
|
14
14
|
BYE: He,
|
|
15
15
|
CANCELED: We,
|
|
16
|
-
CONNECTION_ERROR:
|
|
17
|
-
DIALOG_ERROR:
|
|
18
|
-
EXPIRES:
|
|
19
|
-
INCOMPATIBLE_SDP:
|
|
20
|
-
INTERNAL_ERROR:
|
|
21
|
-
MISSING_SDP:
|
|
22
|
-
NOT_FOUND:
|
|
23
|
-
NO_ACK:
|
|
24
|
-
NO_ANSWER:
|
|
25
|
-
REDIRECTED:
|
|
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
26
|
REJECTED: Le,
|
|
27
27
|
REQUEST_TIMEOUT: Ue,
|
|
28
|
-
RTP_TIMEOUT:
|
|
29
|
-
SIP_FAILURE_CODE:
|
|
30
|
-
UNAVAILABLE:
|
|
31
|
-
USER_DENIED_MEDIA_ACCESS:
|
|
32
|
-
WEBRTC_ERROR:
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" })), V = "incomingCall", Y = "declinedIncomingCall", x = "failedIncomingCall", G = "terminatedIncomingCall", L = "connecting", m = "connected",
|
|
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({
|
|
34
34
|
__proto__: null,
|
|
35
35
|
ACCEPTED: xe,
|
|
36
|
-
ACCOUNT_CHANGED:
|
|
36
|
+
ACCOUNT_CHANGED: ue,
|
|
37
37
|
ACCOUNT_DELETED: Ce,
|
|
38
38
|
ADMIN_FORCE_SYNC_MEDIA_STATE: y,
|
|
39
39
|
ADMIN_START_MAIN_CAM: re,
|
|
@@ -48,7 +48,7 @@ const mt = "Connection Error", Ue = "Request Timeout", pt = "SIP Failure Code",
|
|
|
48
48
|
CONNECTED: m,
|
|
49
49
|
CONNECTING: L,
|
|
50
50
|
DECLINED_INCOMING_CALL: Y,
|
|
51
|
-
DISCONNECTED:
|
|
51
|
+
DISCONNECTED: S,
|
|
52
52
|
ENDED: P,
|
|
53
53
|
ENDED_FROM_SERVER: ne,
|
|
54
54
|
ENTER_ROOM: j,
|
|
@@ -66,12 +66,13 @@ const mt = "Connection Error", Ue = "Request Timeout", pt = "SIP Failure Code",
|
|
|
66
66
|
NEW_MESSAGE: ke,
|
|
67
67
|
NEW_RTC_SESSION: D,
|
|
68
68
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: z,
|
|
69
|
+
ONE_MEGABIT_IN_BITS: at,
|
|
69
70
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ce,
|
|
70
71
|
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: he,
|
|
71
72
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
|
|
72
73
|
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: _e,
|
|
73
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST:
|
|
74
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST:
|
|
74
|
+
PARTICIPATION_ACCEPTING_WORD_REQUEST: de,
|
|
75
|
+
PARTICIPATION_CANCELLING_WORD_REQUEST: le,
|
|
75
76
|
PEER_CONNECTION: w,
|
|
76
77
|
PEER_CONNECTION_CONFIRMED: Z,
|
|
77
78
|
PEER_CONNECTION_CREATE_ANSWER_FAILED: et,
|
|
@@ -102,34 +103,34 @@ const mt = "Connection Error", Ue = "Request Timeout", pt = "SIP Failure Code",
|
|
|
102
103
|
UPDATE: ze,
|
|
103
104
|
USE_LICENSE: K,
|
|
104
105
|
WEBCAST_STARTED: Te,
|
|
105
|
-
WEBCAST_STOPPED:
|
|
106
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
106
|
+
WEBCAST_STOPPED: Se
|
|
107
|
+
}, Symbol.toStringTag, { value: "Module" })), ct = [
|
|
107
108
|
V,
|
|
108
109
|
Y,
|
|
109
110
|
G,
|
|
110
111
|
x,
|
|
111
|
-
le,
|
|
112
112
|
de,
|
|
113
|
+
le,
|
|
113
114
|
Ee,
|
|
114
115
|
te,
|
|
115
116
|
Ne,
|
|
116
|
-
|
|
117
|
+
ue,
|
|
117
118
|
Ce,
|
|
118
119
|
Te,
|
|
119
|
-
|
|
120
|
+
Se,
|
|
120
121
|
ce,
|
|
121
122
|
_e
|
|
122
123
|
], Ie = [
|
|
123
124
|
L,
|
|
124
125
|
m,
|
|
125
|
-
|
|
126
|
+
S,
|
|
126
127
|
D,
|
|
127
128
|
p,
|
|
128
129
|
$,
|
|
129
130
|
f,
|
|
130
131
|
ke,
|
|
131
132
|
X
|
|
132
|
-
],
|
|
133
|
+
], _t = [
|
|
133
134
|
J,
|
|
134
135
|
z,
|
|
135
136
|
Q,
|
|
@@ -178,72 +179,77 @@ const mt = "Connection Error", Ue = "Request Timeout", pt = "SIP Failure Code",
|
|
|
178
179
|
rt,
|
|
179
180
|
Re,
|
|
180
181
|
U
|
|
181
|
-
],
|
|
182
|
+
], Et = [...Ie, ...ct], ht = [
|
|
182
183
|
...me,
|
|
183
|
-
...
|
|
184
|
-
],
|
|
184
|
+
..._t
|
|
185
|
+
], rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
185
186
|
__proto__: null,
|
|
186
|
-
SESSION_EVENT_NAMES:
|
|
187
|
+
SESSION_EVENT_NAMES: ht,
|
|
187
188
|
SESSION_JSSIP_EVENT_NAMES: me,
|
|
188
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
189
|
-
UA_EVENT_NAMES:
|
|
189
|
+
SESSION_SYNTHETICS_EVENT_NAMES: _t,
|
|
190
|
+
UA_EVENT_NAMES: Et,
|
|
190
191
|
UA_JSSIP_EVENT_NAMES: Ie,
|
|
191
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
192
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
192
|
+
UA_SYNTHETICS_EVENT_NAMES: ct
|
|
193
|
+
}, Symbol.toStringTag, { value: "Module" })), Yt = (r) => {
|
|
193
194
|
const e = [];
|
|
194
195
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
195
|
-
},
|
|
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 = () => {
|
|
196
197
|
B.enable(pe);
|
|
197
|
-
},
|
|
198
|
+
}, as = () => {
|
|
198
199
|
B.enable(`-${pe}`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
const An = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, be = (r) => r.trim().replaceAll(" ", "_"), Rn = An(1e5, 99999999), W = (r, {
|
|
200
|
+
}, gn = (r, e) => {
|
|
201
|
+
r.getVideoTracks().forEach((n) => {
|
|
202
|
+
"contentHint" in n && n.contentHint !== e && (n.contentHint = e);
|
|
203
|
+
});
|
|
204
|
+
}, W = (r, {
|
|
205
205
|
videoMode: e,
|
|
206
|
-
audioMode: t
|
|
206
|
+
audioMode: t,
|
|
207
|
+
contentHint: n
|
|
207
208
|
} = {}) => {
|
|
208
209
|
if (!r || e === "recvonly" && t === "recvonly")
|
|
209
210
|
return;
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
}
|
|
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;
|
|
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) {
|
|
216
|
+
return (e) => `sip:${e}@${r}`;
|
|
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) => {
|
|
213
219
|
const { kind: n } = t;
|
|
214
220
|
return n === "video";
|
|
215
|
-
}),
|
|
216
|
-
|
|
217
|
-
),
|
|
218
|
-
const t = r === void 0 ? void 0 : Math.max(r,
|
|
219
|
-
if (t !== void 0 &&
|
|
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(
|
|
220
226
|
t,
|
|
221
227
|
e
|
|
222
228
|
))
|
|
223
229
|
return t;
|
|
224
|
-
},
|
|
225
|
-
if (
|
|
230
|
+
}, bn = ut(), wn = (r, e) => {
|
|
231
|
+
if (bn(r, e))
|
|
226
232
|
return r;
|
|
227
|
-
},
|
|
233
|
+
}, Un = async (r, e, t) => {
|
|
228
234
|
const n = r.getParameters();
|
|
229
235
|
(n.encodings === void 0 || n.encodings.length === 0) && (n.encodings = [{}]);
|
|
230
|
-
const [s] = n.encodings, o = s.scaleResolutionDownBy, a =
|
|
236
|
+
const [s] = n.encodings, o = s.scaleResolutionDownBy, a = yn(
|
|
231
237
|
e.scaleResolutionDownBy,
|
|
232
238
|
o
|
|
233
239
|
);
|
|
234
240
|
let c = !1;
|
|
235
241
|
a !== void 0 && (n.encodings[0].scaleResolutionDownBy = a, c = !0);
|
|
236
|
-
const _ = s.maxBitrate, E =
|
|
242
|
+
const _ = s.maxBitrate, E = wn(e.maxBitrate, _);
|
|
237
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 };
|
|
238
|
-
},
|
|
239
|
-
const n =
|
|
244
|
+
}, Ln = async (r, e, t) => {
|
|
245
|
+
const n = Mn(r, e);
|
|
240
246
|
if (n)
|
|
241
|
-
return
|
|
242
|
-
},
|
|
247
|
+
return Un(n, { maxBitrate: t });
|
|
248
|
+
}, Hn = 486, Wn = 487, F = "local", we = "remote", kn = 3, qn = 1, cs = (r = new Error()) => {
|
|
243
249
|
const { originator: e, cause: t } = r;
|
|
244
|
-
return
|
|
245
|
-
}, g = "SipConnector",
|
|
246
|
-
class
|
|
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 {
|
|
247
253
|
constructor({ JsSIP: e }) {
|
|
248
254
|
i(this, "_isRegisterConfig", !1);
|
|
249
255
|
i(this, "_connectionConfiguration", {});
|
|
@@ -287,7 +293,7 @@ class as {
|
|
|
287
293
|
}
|
|
288
294
|
return this.register();
|
|
289
295
|
});
|
|
290
|
-
i(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
296
|
+
i(this, "declineToIncomingCall", async ({ statusCode: e = Wn } = {}) => new Promise((t, n) => {
|
|
291
297
|
if (!this.isAvailableIncomingCall) {
|
|
292
298
|
n(new Error("no incomingSession"));
|
|
293
299
|
return;
|
|
@@ -295,15 +301,15 @@ class as {
|
|
|
295
301
|
const s = this.incomingSession, o = this.remoteCallerData;
|
|
296
302
|
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(Y, o), t(s.terminate({ status_code: e }));
|
|
297
303
|
}));
|
|
298
|
-
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
304
|
+
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Hn }));
|
|
299
305
|
i(this, "removeIncomingSession", () => {
|
|
300
306
|
delete this.incomingSession;
|
|
301
307
|
});
|
|
302
|
-
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t =
|
|
308
|
+
i(this, "_connectWithDuplicatedCalls", async (e, { callLimit: t = kn } = {}) => {
|
|
303
309
|
let n = !0;
|
|
304
310
|
const s = async () => (n = !1, this._cancelableConnect.request(e)), o = (a) => {
|
|
305
311
|
var h;
|
|
306
|
-
const c = !!((h = this.ua) != null && h.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !
|
|
312
|
+
const c = !!((h = this.ua) != null && h.isConnected()), _ = !n && c && this.hasEqualConnectionConfiguration(e), E = !!a && !On(a);
|
|
307
313
|
return _ || E;
|
|
308
314
|
};
|
|
309
315
|
return this._cancelableConnectWithRepeatedCalls = Oe({
|
|
@@ -341,44 +347,44 @@ class as {
|
|
|
341
347
|
connectionRecoveryMinInterval: _,
|
|
342
348
|
connectionRecoveryMaxInterval: E,
|
|
343
349
|
userAgent: h,
|
|
344
|
-
displayName:
|
|
345
|
-
register:
|
|
350
|
+
displayName: l = "",
|
|
351
|
+
register: d = !1,
|
|
346
352
|
extraHeaders: T = []
|
|
347
353
|
}) => {
|
|
348
354
|
if (!n)
|
|
349
355
|
throw new Error("sipServerUrl is required");
|
|
350
356
|
if (!s)
|
|
351
357
|
throw new Error("sipWebSocketServerURL is required");
|
|
352
|
-
if (
|
|
358
|
+
if (d && !e)
|
|
353
359
|
throw new Error("user is required for authorized connection");
|
|
354
|
-
if (
|
|
360
|
+
if (d && !t)
|
|
355
361
|
throw new Error("password is required for authorized connection");
|
|
356
362
|
this._connectionConfiguration = {
|
|
357
363
|
sipServerUrl: n,
|
|
358
|
-
displayName:
|
|
359
|
-
register:
|
|
364
|
+
displayName: l,
|
|
365
|
+
register: d,
|
|
360
366
|
user: e,
|
|
361
367
|
password: t
|
|
362
368
|
};
|
|
363
|
-
const { configuration:
|
|
369
|
+
const { configuration: u, helpers: C } = this.createUaConfiguration({
|
|
364
370
|
user: e,
|
|
365
371
|
sipServerUrl: n,
|
|
366
372
|
sipWebSocketServerURL: s,
|
|
367
373
|
password: t,
|
|
368
|
-
displayName:
|
|
369
|
-
register:
|
|
374
|
+
displayName: l,
|
|
375
|
+
register: d,
|
|
370
376
|
sessionTimers: a,
|
|
371
377
|
registerExpires: c,
|
|
372
378
|
connectionRecoveryMinInterval: _,
|
|
373
379
|
connectionRecoveryMaxInterval: E,
|
|
374
380
|
userAgent: h
|
|
375
381
|
});
|
|
376
|
-
this.getSipServerUrl = C.getSipServerUrl, this.socket = C.socket, this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!
|
|
377
|
-
const fe = Ie.find((
|
|
378
|
-
fe && this.ua && this.ua.on(fe,
|
|
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);
|
|
379
385
|
});
|
|
380
|
-
const
|
|
381
|
-
return this.ua.registrator().setExtraHeaders(
|
|
386
|
+
const Ct = [...Yt(o), ...T];
|
|
387
|
+
return this.ua.registrator().setExtraHeaders(Ct), this.ua;
|
|
382
388
|
});
|
|
383
389
|
i(this, "_createUa", (e) => new this.JsSIP.UA(e));
|
|
384
390
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
@@ -392,9 +398,9 @@ class as {
|
|
|
392
398
|
}, o = (_) => {
|
|
393
399
|
c(), t(_);
|
|
394
400
|
}, a = () => {
|
|
395
|
-
this.isRegisterConfig ? (this.on(p, s), this.on(f, o)) : this.on(m, s), this.on(
|
|
401
|
+
this.isRegisterConfig ? (this.on(p, s), this.on(f, o)) : this.on(m, s), this.on(S, o);
|
|
396
402
|
}, c = () => {
|
|
397
|
-
this.off(p, s), this.off(f, o), this.off(m, s), this.off(
|
|
403
|
+
this.off(p, s), this.off(f, o), this.off(m, s), this.off(S, o);
|
|
398
404
|
};
|
|
399
405
|
a(), this.on(D, this.handleNewRTCSession), n.start();
|
|
400
406
|
}));
|
|
@@ -417,11 +423,11 @@ class as {
|
|
|
417
423
|
i(this, "_disconnect", async () => {
|
|
418
424
|
this.off(D, this.handleNewRTCSession);
|
|
419
425
|
const e = new Promise((t) => {
|
|
420
|
-
this.once(
|
|
426
|
+
this.once(S, () => {
|
|
421
427
|
delete this.ua, t();
|
|
422
428
|
});
|
|
423
429
|
});
|
|
424
|
-
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(
|
|
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;
|
|
425
431
|
});
|
|
426
432
|
i(this, "_call", async ({
|
|
427
433
|
number: e,
|
|
@@ -434,14 +440,14 @@ class as {
|
|
|
434
440
|
degradationPreference: _,
|
|
435
441
|
offerToReceiveAudio: E = !0,
|
|
436
442
|
offerToReceiveVideo: h = !0
|
|
437
|
-
}) => new Promise((
|
|
443
|
+
}) => new Promise((l, d) => {
|
|
438
444
|
const { ua: T } = this;
|
|
439
445
|
if (!T) {
|
|
440
|
-
|
|
446
|
+
d(new Error("this.ua is not initialized"));
|
|
441
447
|
return;
|
|
442
448
|
}
|
|
443
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(
|
|
444
|
-
|
|
449
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(l).catch((u) => {
|
|
450
|
+
d(u);
|
|
445
451
|
}), this.session = T.call(this.getSipServerUrl(e), {
|
|
446
452
|
extraHeaders: n,
|
|
447
453
|
mediaStream: W(t, {
|
|
@@ -480,13 +486,13 @@ class as {
|
|
|
480
486
|
E(new Error("No session established"));
|
|
481
487
|
return;
|
|
482
488
|
}
|
|
483
|
-
this._sessionEvents.eachTriggers((
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(_).catch((
|
|
487
|
-
E(
|
|
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);
|
|
488
494
|
});
|
|
489
|
-
const
|
|
495
|
+
const l = W(e, {
|
|
490
496
|
videoMode: o,
|
|
491
497
|
audioMode: a
|
|
492
498
|
});
|
|
@@ -495,7 +501,7 @@ class as {
|
|
|
495
501
|
videoMode: o,
|
|
496
502
|
audioMode: a,
|
|
497
503
|
degradationPreference: c,
|
|
498
|
-
mediaStream:
|
|
504
|
+
mediaStream: l,
|
|
499
505
|
pcConfig: {
|
|
500
506
|
iceServers: s
|
|
501
507
|
}
|
|
@@ -503,22 +509,22 @@ class as {
|
|
|
503
509
|
}));
|
|
504
510
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, n) => {
|
|
505
511
|
const s = () => {
|
|
506
|
-
this.onSession(w, h), this.onSession(b,
|
|
512
|
+
this.onSession(w, h), this.onSession(b, l);
|
|
507
513
|
}, o = () => {
|
|
508
|
-
this.offSession(w, h), this.offSession(b,
|
|
514
|
+
this.offSession(w, h), this.offSession(b, l);
|
|
509
515
|
}, a = () => {
|
|
510
516
|
this.onSession(A, _), this.onSession(P, _);
|
|
511
517
|
}, c = () => {
|
|
512
518
|
this.offSession(A, _), this.offSession(P, _);
|
|
513
|
-
}, _ = (
|
|
514
|
-
o(), c(), n(
|
|
519
|
+
}, _ = (d) => {
|
|
520
|
+
o(), c(), n(d);
|
|
515
521
|
};
|
|
516
522
|
let E;
|
|
517
|
-
const h = ({ peerconnection:
|
|
518
|
-
E =
|
|
523
|
+
const h = ({ peerconnection: d }) => {
|
|
524
|
+
E = d, E.ontrack = (T) => {
|
|
519
525
|
this._sessionEvents.trigger(ee, E), e && e(T);
|
|
520
526
|
};
|
|
521
|
-
},
|
|
527
|
+
}, l = () => {
|
|
522
528
|
E && this._sessionEvents.trigger(Z, E), o(), c(), t(E);
|
|
523
529
|
};
|
|
524
530
|
s(), a();
|
|
@@ -554,7 +560,7 @@ class as {
|
|
|
554
560
|
});
|
|
555
561
|
i(this, "_handleShareState", (e) => {
|
|
556
562
|
switch (e) {
|
|
557
|
-
case
|
|
563
|
+
case dt: {
|
|
558
564
|
this._sessionEvents.trigger(J, void 0);
|
|
559
565
|
break;
|
|
560
566
|
}
|
|
@@ -562,7 +568,7 @@ class as {
|
|
|
562
568
|
this._sessionEvents.trigger(z, void 0);
|
|
563
569
|
break;
|
|
564
570
|
}
|
|
565
|
-
case
|
|
571
|
+
case Tt: {
|
|
566
572
|
this._sessionEvents.trigger(Q, void 0);
|
|
567
573
|
break;
|
|
568
574
|
}
|
|
@@ -580,55 +586,55 @@ class as {
|
|
|
580
586
|
});
|
|
581
587
|
i(this, "_handleNotify", (e) => {
|
|
582
588
|
switch (e.cmd) {
|
|
583
|
-
case
|
|
589
|
+
case Fn: {
|
|
584
590
|
const t = e;
|
|
585
591
|
this._triggerChannelsNotify(t);
|
|
586
592
|
break;
|
|
587
593
|
}
|
|
588
|
-
case
|
|
594
|
+
case Bn: {
|
|
589
595
|
const t = e;
|
|
590
596
|
this._triggerWebcastStartedNotify(t);
|
|
591
597
|
break;
|
|
592
598
|
}
|
|
593
|
-
case
|
|
599
|
+
case Vn: {
|
|
594
600
|
const t = e;
|
|
595
601
|
this._triggerWebcastStoppedNotify(t);
|
|
596
602
|
break;
|
|
597
603
|
}
|
|
598
|
-
case
|
|
604
|
+
case Gn: {
|
|
599
605
|
const t = e;
|
|
600
606
|
this._triggerAddedToListModeratorsNotify(t);
|
|
601
607
|
break;
|
|
602
608
|
}
|
|
603
|
-
case
|
|
609
|
+
case $n: {
|
|
604
610
|
const t = e;
|
|
605
611
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
606
612
|
break;
|
|
607
613
|
}
|
|
608
|
-
case
|
|
614
|
+
case Xn: {
|
|
609
615
|
const t = e;
|
|
610
616
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
611
617
|
break;
|
|
612
618
|
}
|
|
613
|
-
case
|
|
619
|
+
case Jn: {
|
|
614
620
|
const t = e;
|
|
615
621
|
this._triggerParticipationCancellingWordRequest(t);
|
|
616
622
|
break;
|
|
617
623
|
}
|
|
618
|
-
case
|
|
624
|
+
case zn: {
|
|
619
625
|
const t = e;
|
|
620
626
|
this._triggerParticipantMoveRequestToStream(t);
|
|
621
627
|
break;
|
|
622
628
|
}
|
|
623
|
-
case
|
|
629
|
+
case Yn: {
|
|
624
630
|
this._triggerAccountChangedNotify();
|
|
625
631
|
break;
|
|
626
632
|
}
|
|
627
|
-
case
|
|
633
|
+
case xn: {
|
|
628
634
|
this._triggerAccountDeletedNotify();
|
|
629
635
|
break;
|
|
630
636
|
}
|
|
631
|
-
case
|
|
637
|
+
case Qn: {
|
|
632
638
|
const t = e;
|
|
633
639
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
634
640
|
break;
|
|
@@ -666,10 +672,10 @@ class as {
|
|
|
666
672
|
conference: e,
|
|
667
673
|
type: t
|
|
668
674
|
};
|
|
669
|
-
this._uaEvents.trigger(
|
|
675
|
+
this._uaEvents.trigger(Se, n);
|
|
670
676
|
});
|
|
671
677
|
i(this, "_triggerAccountChangedNotify", () => {
|
|
672
|
-
this._uaEvents.trigger(
|
|
678
|
+
this._uaEvents.trigger(ue, void 0);
|
|
673
679
|
});
|
|
674
680
|
i(this, "_triggerAccountDeletedNotify", () => {
|
|
675
681
|
this._uaEvents.trigger(Ce, void 0);
|
|
@@ -700,7 +706,7 @@ class as {
|
|
|
700
706
|
const t = {
|
|
701
707
|
conference: e
|
|
702
708
|
};
|
|
703
|
-
this._uaEvents.trigger(
|
|
709
|
+
this._uaEvents.trigger(de, t);
|
|
704
710
|
});
|
|
705
711
|
i(this, "_triggerParticipationCancellingWordRequest", ({
|
|
706
712
|
body: { conference: e }
|
|
@@ -708,7 +714,7 @@ class as {
|
|
|
708
714
|
const t = {
|
|
709
715
|
conference: e
|
|
710
716
|
};
|
|
711
|
-
this._uaEvents.trigger(
|
|
717
|
+
this._uaEvents.trigger(le, t);
|
|
712
718
|
});
|
|
713
719
|
i(this, "_triggerParticipantMoveRequestToStream", ({
|
|
714
720
|
body: { conference: e }
|
|
@@ -719,7 +725,7 @@ class as {
|
|
|
719
725
|
this._uaEvents.trigger(Ee, t);
|
|
720
726
|
});
|
|
721
727
|
i(this, "_triggerEnterRoom", (e) => {
|
|
722
|
-
const t = e.getHeader(
|
|
728
|
+
const t = e.getHeader(Gt), n = e.getHeader(Zt);
|
|
723
729
|
this._sessionEvents.trigger(j, { room: t, participantName: n });
|
|
724
730
|
});
|
|
725
731
|
i(this, "_triggerShareState", (e) => {
|
|
@@ -727,10 +733,10 @@ class as {
|
|
|
727
733
|
this._sessionEvents.trigger(M, t);
|
|
728
734
|
});
|
|
729
735
|
i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
730
|
-
e.getHeader(
|
|
736
|
+
e.getHeader(_n) === ot && this._sessionEvents.trigger(he, void 0);
|
|
731
737
|
});
|
|
732
738
|
i(this, "_triggerMainCamControl", (e) => {
|
|
733
|
-
const t = e.getHeader(
|
|
739
|
+
const t = e.getHeader(en), n = e.getHeader(ye), s = n === q.ADMIN_SYNC_FORCED;
|
|
734
740
|
if (t === I.ADMIN_START_MAIN_CAM) {
|
|
735
741
|
this._sessionEvents.trigger(re, { isSyncForced: s });
|
|
736
742
|
return;
|
|
@@ -740,32 +746,32 @@ class as {
|
|
|
740
746
|
return;
|
|
741
747
|
}
|
|
742
748
|
(t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && n && this._sessionEvents.trigger(y, { isSyncForced: s });
|
|
743
|
-
const o = e.getHeader(
|
|
749
|
+
const o = e.getHeader(nn);
|
|
744
750
|
this._sessionEvents.trigger(se, {
|
|
745
751
|
mainCam: t,
|
|
746
752
|
resolutionMainCam: o
|
|
747
753
|
});
|
|
748
754
|
});
|
|
749
755
|
i(this, "_triggerMicControl", (e) => {
|
|
750
|
-
const t = e.getHeader(
|
|
756
|
+
const t = e.getHeader(tn), s = e.getHeader(ye) === q.ADMIN_SYNC_FORCED;
|
|
751
757
|
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(ae, { isSyncForced: s }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: s });
|
|
752
758
|
});
|
|
753
759
|
i(this, "_triggerUseLicense", (e) => {
|
|
754
|
-
const t = e.getHeader(
|
|
760
|
+
const t = e.getHeader(Kt);
|
|
755
761
|
this._sessionEvents.trigger(K, t);
|
|
756
762
|
});
|
|
757
763
|
i(this, "_handleNewInfo", (e) => {
|
|
758
764
|
const { originator: t } = e;
|
|
759
765
|
if (t !== "remote")
|
|
760
766
|
return;
|
|
761
|
-
const { request: n } = e, s = n.getHeader(
|
|
767
|
+
const { request: n } = e, s = n.getHeader(xt);
|
|
762
768
|
if (s)
|
|
763
769
|
switch (s) {
|
|
764
|
-
case
|
|
770
|
+
case $t: {
|
|
765
771
|
this._triggerEnterRoom(n), this._maybeTriggerChannels(n);
|
|
766
772
|
break;
|
|
767
773
|
}
|
|
768
|
-
case
|
|
774
|
+
case En: {
|
|
769
775
|
this._maybeHandleNotify(n);
|
|
770
776
|
break;
|
|
771
777
|
}
|
|
@@ -777,15 +783,15 @@ class as {
|
|
|
777
783
|
this._triggerMainCamControl(n);
|
|
778
784
|
break;
|
|
779
785
|
}
|
|
780
|
-
case
|
|
786
|
+
case Qt: {
|
|
781
787
|
this._triggerMicControl(n);
|
|
782
788
|
break;
|
|
783
789
|
}
|
|
784
|
-
case
|
|
790
|
+
case jt: {
|
|
785
791
|
this._triggerUseLicense(n);
|
|
786
792
|
break;
|
|
787
793
|
}
|
|
788
|
-
case
|
|
794
|
+
case cn: {
|
|
789
795
|
this._maybeTriggerParticipantMoveRequestToSpectators(n);
|
|
790
796
|
break;
|
|
791
797
|
}
|
|
@@ -795,7 +801,7 @@ class as {
|
|
|
795
801
|
this._maybeHandleNotify(e);
|
|
796
802
|
});
|
|
797
803
|
i(this, "_maybeHandleNotify", (e) => {
|
|
798
|
-
const t = e.getHeader(
|
|
804
|
+
const t = e.getHeader(hn);
|
|
799
805
|
if (t) {
|
|
800
806
|
const n = JSON.parse(t);
|
|
801
807
|
this._handleNotify(n);
|
|
@@ -805,7 +811,7 @@ class as {
|
|
|
805
811
|
const { originator: t } = e;
|
|
806
812
|
t === we && this._sessionEvents.trigger(ne, e), this._restoreSession();
|
|
807
813
|
});
|
|
808
|
-
this.JsSIP = e, this._sessionEvents = new Pe(
|
|
814
|
+
this.JsSIP = e, this._sessionEvents = new Pe(ht), this._uaEvents = new Pe(Et), this._cancelableConnect = new N(
|
|
809
815
|
this._connect,
|
|
810
816
|
{
|
|
811
817
|
moduleName: g,
|
|
@@ -875,12 +881,12 @@ class as {
|
|
|
875
881
|
userAgent: e,
|
|
876
882
|
sipServerUrl: n
|
|
877
883
|
}), _ = this._createUa(c), E = () => {
|
|
878
|
-
const
|
|
879
|
-
a(
|
|
884
|
+
const l = new Error("Telephony is not available");
|
|
885
|
+
a(l);
|
|
880
886
|
};
|
|
881
|
-
_.once(
|
|
887
|
+
_.once(S, E);
|
|
882
888
|
const h = () => {
|
|
883
|
-
_.removeAllListeners(), _.once(
|
|
889
|
+
_.removeAllListeners(), _.once(S, o), _.stop();
|
|
884
890
|
};
|
|
885
891
|
_.once(m, h), _.start();
|
|
886
892
|
});
|
|
@@ -893,13 +899,13 @@ class as {
|
|
|
893
899
|
async askPermissionToEnableCam(e = {}) {
|
|
894
900
|
if (!this.session)
|
|
895
901
|
throw new Error("No session established");
|
|
896
|
-
const t = [
|
|
902
|
+
const t = [Nn];
|
|
897
903
|
return this.session.sendInfo(De, void 0, {
|
|
898
904
|
noTerminateWhenError: !0,
|
|
899
905
|
...e,
|
|
900
906
|
extraHeaders: t
|
|
901
907
|
}).catch((n) => {
|
|
902
|
-
if (
|
|
908
|
+
if (Dn(n))
|
|
903
909
|
throw n;
|
|
904
910
|
});
|
|
905
911
|
}
|
|
@@ -911,7 +917,7 @@ class as {
|
|
|
911
917
|
stream: t,
|
|
912
918
|
presentationOptions: n,
|
|
913
919
|
options: s = {
|
|
914
|
-
callLimit:
|
|
920
|
+
callLimit: qn
|
|
915
921
|
}
|
|
916
922
|
}) {
|
|
917
923
|
const o = async () => this._sendPresentation(e, t, n), a = () => !!this._streamPresentationCurrent;
|
|
@@ -939,18 +945,18 @@ class as {
|
|
|
939
945
|
// 5 minutes in sec
|
|
940
946
|
connectionRecoveryMinInterval: E = 2,
|
|
941
947
|
connectionRecoveryMaxInterval: h = 6,
|
|
942
|
-
userAgent:
|
|
948
|
+
userAgent: l
|
|
943
949
|
}) {
|
|
944
950
|
if (a && !t)
|
|
945
951
|
throw new Error("password is required for authorized connection");
|
|
946
|
-
const
|
|
952
|
+
const d = a && e ? e.trim() : `${mn()}`, T = Rn(o), u = T(d), C = new this.JsSIP.WebSocketInterface(n);
|
|
947
953
|
return {
|
|
948
954
|
configuration: {
|
|
949
955
|
password: t,
|
|
950
956
|
register: a,
|
|
951
|
-
uri:
|
|
957
|
+
uri: u,
|
|
952
958
|
display_name: be(s),
|
|
953
|
-
user_agent:
|
|
959
|
+
user_agent: l,
|
|
954
960
|
sdp_semantics: "unified-plan",
|
|
955
961
|
sockets: [C],
|
|
956
962
|
session_timers: c,
|
|
@@ -965,58 +971,61 @@ class as {
|
|
|
965
971
|
};
|
|
966
972
|
}
|
|
967
973
|
async _sendPresentation(e, t, {
|
|
968
|
-
maxBitrate: n,
|
|
969
|
-
degradationPreference: s,
|
|
974
|
+
maxBitrate: n = at,
|
|
975
|
+
degradationPreference: s = "maintain-resolution",
|
|
970
976
|
isNeedReinvite: o = !0,
|
|
971
|
-
isP2P: a = !1
|
|
977
|
+
isP2P: a = !1,
|
|
978
|
+
contentHint: c = "detail"
|
|
972
979
|
}) {
|
|
973
|
-
const
|
|
974
|
-
this._streamPresentationCurrent =
|
|
975
|
-
const
|
|
976
|
-
extraHeaders:
|
|
980
|
+
const _ = W(t, { contentHint: c });
|
|
981
|
+
this._streamPresentationCurrent = _;
|
|
982
|
+
const E = a ? [Sn] : [dn], h = e.sendInfo(O, void 0, {
|
|
983
|
+
extraHeaders: E
|
|
977
984
|
}).then(async () => e.startPresentation(
|
|
978
|
-
|
|
985
|
+
_,
|
|
979
986
|
o,
|
|
980
987
|
s
|
|
981
988
|
)).then(async () => {
|
|
982
|
-
const { connection:
|
|
983
|
-
if (!
|
|
989
|
+
const { connection: l } = this;
|
|
990
|
+
if (!l || n === void 0)
|
|
984
991
|
return;
|
|
985
|
-
const d =
|
|
986
|
-
await
|
|
987
|
-
}).then(() => t).catch((
|
|
988
|
-
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(U,
|
|
992
|
+
const d = l.getSenders();
|
|
993
|
+
await Ln(d, t, n);
|
|
994
|
+
}).then(() => t).catch((l) => {
|
|
995
|
+
throw this._removeStreamPresentationCurrent(), this._sessionEvents.trigger(U, l), l;
|
|
989
996
|
});
|
|
990
|
-
return this.promisePendingStartPresentation =
|
|
997
|
+
return this.promisePendingStartPresentation = h, h.finally(() => {
|
|
991
998
|
this.promisePendingStartPresentation = void 0;
|
|
992
999
|
});
|
|
993
1000
|
}
|
|
994
1001
|
async startPresentation(e, {
|
|
995
|
-
isNeedReinvite: t
|
|
996
|
-
isP2P: n
|
|
1002
|
+
isNeedReinvite: t,
|
|
1003
|
+
isP2P: n,
|
|
997
1004
|
maxBitrate: s,
|
|
998
|
-
degradationPreference: o
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1005
|
+
degradationPreference: o,
|
|
1006
|
+
contentHint: a
|
|
1007
|
+
} = {}, c) {
|
|
1008
|
+
const _ = this.establishedSession;
|
|
1009
|
+
if (!_)
|
|
1002
1010
|
throw new Error("No session established");
|
|
1003
1011
|
if (this._streamPresentationCurrent)
|
|
1004
1012
|
throw new Error("Presentation is already started");
|
|
1005
|
-
return n && await this.sendMustStopPresentation(
|
|
1006
|
-
session:
|
|
1013
|
+
return n && await this.sendMustStopPresentation(_), this._sendPresentationWithDuplicatedCalls({
|
|
1014
|
+
session: _,
|
|
1007
1015
|
stream: e,
|
|
1008
1016
|
presentationOptions: {
|
|
1009
1017
|
isNeedReinvite: t,
|
|
1010
1018
|
isP2P: n,
|
|
1011
1019
|
maxBitrate: s,
|
|
1012
|
-
degradationPreference: o
|
|
1020
|
+
degradationPreference: o,
|
|
1021
|
+
contentHint: a
|
|
1013
1022
|
},
|
|
1014
|
-
options:
|
|
1023
|
+
options: c
|
|
1015
1024
|
});
|
|
1016
1025
|
}
|
|
1017
1026
|
async sendMustStopPresentation(e) {
|
|
1018
1027
|
await e.sendInfo(O, void 0, {
|
|
1019
|
-
extraHeaders: [
|
|
1028
|
+
extraHeaders: [Tn]
|
|
1020
1029
|
});
|
|
1021
1030
|
}
|
|
1022
1031
|
async stopPresentation({
|
|
@@ -1035,19 +1044,21 @@ class as {
|
|
|
1035
1044
|
});
|
|
1036
1045
|
}
|
|
1037
1046
|
async updatePresentation(e, {
|
|
1038
|
-
isP2P: t
|
|
1047
|
+
isP2P: t,
|
|
1039
1048
|
maxBitrate: n,
|
|
1040
|
-
degradationPreference: s
|
|
1049
|
+
degradationPreference: s,
|
|
1050
|
+
contentHint: o
|
|
1041
1051
|
} = {}) {
|
|
1042
|
-
const
|
|
1043
|
-
if (!
|
|
1052
|
+
const a = this.establishedSession;
|
|
1053
|
+
if (!a)
|
|
1044
1054
|
throw new Error("No session established");
|
|
1045
1055
|
if (!this._streamPresentationCurrent)
|
|
1046
1056
|
throw new Error("Presentation has not started yet");
|
|
1047
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(
|
|
1057
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(a, e, {
|
|
1048
1058
|
isP2P: t,
|
|
1049
1059
|
maxBitrate: n,
|
|
1050
1060
|
degradationPreference: s,
|
|
1061
|
+
contentHint: o,
|
|
1051
1062
|
isNeedReinvite: !1
|
|
1052
1063
|
});
|
|
1053
1064
|
}
|
|
@@ -1100,7 +1111,7 @@ class as {
|
|
|
1100
1111
|
if (!this.connection)
|
|
1101
1112
|
return;
|
|
1102
1113
|
const t = this.connection.getReceivers().map(({ track: n }) => n);
|
|
1103
|
-
return
|
|
1114
|
+
return pn(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1104
1115
|
}
|
|
1105
1116
|
get connection() {
|
|
1106
1117
|
var t;
|
|
@@ -1187,17 +1198,17 @@ class as {
|
|
|
1187
1198
|
n,
|
|
1188
1199
|
s
|
|
1189
1200
|
];
|
|
1190
|
-
return this.session.sendInfo(
|
|
1201
|
+
return this.session.sendInfo(Xt, void 0, { extraHeaders: o });
|
|
1191
1202
|
}
|
|
1192
1203
|
async sendMediaState({ cam: e, mic: t }, n = {}) {
|
|
1193
1204
|
if (!this.session)
|
|
1194
1205
|
throw new Error("No session established");
|
|
1195
|
-
const s = `${
|
|
1206
|
+
const s = `${sn}: currentstate`, o = `${on}: ${Number(e)}`, a = `${an}: ${Number(t)}`, c = [
|
|
1196
1207
|
s,
|
|
1197
1208
|
o,
|
|
1198
1209
|
a
|
|
1199
1210
|
];
|
|
1200
|
-
return this.session.sendInfo(
|
|
1211
|
+
return this.session.sendInfo(Jt, void 0, {
|
|
1201
1212
|
noTerminateWhenError: !0,
|
|
1202
1213
|
...n,
|
|
1203
1214
|
extraHeaders: c
|
|
@@ -1206,8 +1217,8 @@ class as {
|
|
|
1206
1217
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1207
1218
|
if (!this.session)
|
|
1208
1219
|
throw new Error("No session established");
|
|
1209
|
-
const c = [`${
|
|
1210
|
-
return this.session.sendInfo(
|
|
1220
|
+
const c = [`${rn}: ${e === "mic" ? 0 : 1}`];
|
|
1221
|
+
return this.session.sendInfo(zt, void 0, {
|
|
1211
1222
|
noTerminateWhenError: !0,
|
|
1212
1223
|
...t,
|
|
1213
1224
|
extraHeaders: c
|
|
@@ -1225,22 +1236,22 @@ class as {
|
|
|
1225
1236
|
}
|
|
1226
1237
|
}
|
|
1227
1238
|
export {
|
|
1228
|
-
|
|
1239
|
+
Bt as B,
|
|
1229
1240
|
I as E,
|
|
1230
|
-
|
|
1241
|
+
vt as N,
|
|
1231
1242
|
Le as R,
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
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,
|
|
1239
1250
|
k as f,
|
|
1240
1251
|
q as g,
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1252
|
+
cs as h,
|
|
1253
|
+
An as i,
|
|
1254
|
+
ht as j,
|
|
1244
1255
|
H as l,
|
|
1245
|
-
|
|
1256
|
+
Un as s
|
|
1246
1257
|
};
|