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