sip-connector 6.24.2 → 6.24.3
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-BWd7Anni.cjs +1 -0
- package/dist/{SipConnector-BmPmOGi6.js → SipConnector-BfKQCTIn.js} +194 -194
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/headers.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/SipConnector-DMjzYyq_.cjs +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var gt = Object.defineProperty;
|
|
2
|
-
var Ct = (
|
|
3
|
-
var i = (
|
|
2
|
+
var Ct = (o, e, t) => e in o ? gt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var i = (o, e, t) => (Ct(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import { CancelableRequest as N, isCanceledError as At } from "@krivega/cancelable-promise";
|
|
5
5
|
import fe from "events-constructor";
|
|
6
6
|
import F from "debug";
|
|
7
|
-
const Rt = "Connection Error",
|
|
7
|
+
const Rt = "Connection Error", be = "Request Timeout", It = "SIP Failure Code", mt = "Internal Error", ft = "Busy", Ue = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", Pt = "Address Incomplete", pt = "Incompatible SDP", vt = "Missing SDP", wt = "Authentication Error", Le = "Terminated", yt = "WebRTC Error", He = "Canceled", bt = "No Answer", Ut = "Expires", Lt = "No ACK", Ht = "Dialog Error", kt = "User Denied Media Access", qt = "Bad Media Description", Wt = "RTP Timeout", Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
8
|
__proto__: null,
|
|
9
9
|
ADDRESS_INCOMPLETE: Pt,
|
|
10
10
|
AUTHENTICATION_ERROR: wt,
|
|
11
11
|
BAD_MEDIA_DESCRIPTION: qt,
|
|
12
12
|
BUSY: ft,
|
|
13
|
-
BYE:
|
|
14
|
-
CANCELED:
|
|
13
|
+
BYE: Le,
|
|
14
|
+
CANCELED: He,
|
|
15
15
|
CONNECTION_ERROR: Rt,
|
|
16
16
|
DIALOG_ERROR: Ht,
|
|
17
17
|
EXPIRES: Ut,
|
|
@@ -22,47 +22,47 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
22
22
|
NO_ACK: Lt,
|
|
23
23
|
NO_ANSWER: bt,
|
|
24
24
|
REDIRECTED: Ot,
|
|
25
|
-
REJECTED:
|
|
26
|
-
REQUEST_TIMEOUT:
|
|
25
|
+
REJECTED: Ue,
|
|
26
|
+
REQUEST_TIMEOUT: be,
|
|
27
27
|
RTP_TIMEOUT: Wt,
|
|
28
28
|
SIP_FAILURE_CODE: It,
|
|
29
29
|
UNAVAILABLE: Dt,
|
|
30
30
|
USER_DENIED_MEDIA_ACCESS: kt,
|
|
31
31
|
WEBRTC_ERROR: yt
|
|
32
|
-
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting",
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting", m = "connected", T = "disconnected", P = "newRTCSession", f = "registered", $ = "unregistered", O = "registrationFailed", ke = "newMessage", G = "sipEvent", X = "availableSecondRemoteStream", J = "notAvailableSecondRemoteStream", z = "mustStopPresentation", p = "shareState", Q = "enterRoom", K = "useLicense", j = "peerconnection:confirmed", Z = "peerconnection:ontrack", v = "channels", ee = "channels:notify", te = "ended:fromserver", se = "main-cam-control", ne = "admin-stop-main-cam", ie = "admin-start-main-cam", oe = "admin-stop-mic", re = "admin-start-mic", w = "admin-force-sync-media-state", ae = "participant:added-to-list-moderators", ce = "participant:removed-from-list-moderators", Ee = "participant:move-request-to-stream", _e = "participation:accepting-word-request", he = "participation:cancelling-word-request", de = "webcast:started", le = "webcast:stopped", ue = "account:changed", Te = "account:deleted", Se = "conference:participant-token-issued", D = "ended", qe = "sending", We = "reinvite", Fe = "replaces", Be = "refer", Ve = "progress", Ye = "accepted", y = "confirmed", b = "peerconnection", C = "failed", xe = "muted", $e = "unmuted", Ne = "newDTMF", ge = "newInfo", Ge = "hold", Xe = "unhold", Je = "update", ze = "sdp", Qe = "icecandidate", Ke = "getusermediafailed", je = "peerconnection:createofferfailed", Ze = "peerconnection:createanswerfailed", et = "peerconnection:setlocaldescriptionfailed", tt = "peerconnection:setremotedescriptionfailed", st = "presentation:start", nt = "presentation:started", it = "presentation:end", Ce = "presentation:ended", U = "presentation:failed", xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
33
|
__proto__: null,
|
|
34
|
-
ACCEPTED:
|
|
34
|
+
ACCEPTED: Ye,
|
|
35
35
|
ACCOUNT_CHANGED: ue,
|
|
36
36
|
ACCOUNT_DELETED: Te,
|
|
37
37
|
ADMIN_FORCE_SYNC_MEDIA_STATE: w,
|
|
38
38
|
ADMIN_START_MAIN_CAM: ie,
|
|
39
|
-
ADMIN_START_MIC:
|
|
39
|
+
ADMIN_START_MIC: re,
|
|
40
40
|
ADMIN_STOP_MAIN_CAM: ne,
|
|
41
|
-
ADMIN_STOP_MIC:
|
|
41
|
+
ADMIN_STOP_MIC: oe,
|
|
42
42
|
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: X,
|
|
43
43
|
CHANNELS: v,
|
|
44
44
|
CHANNELS_NOTIFY: ee,
|
|
45
45
|
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Se,
|
|
46
46
|
CONFIRMED: y,
|
|
47
|
-
CONNECTED:
|
|
47
|
+
CONNECTED: m,
|
|
48
48
|
CONNECTING: L,
|
|
49
49
|
DECLINED_INCOMING_CALL: V,
|
|
50
50
|
DISCONNECTED: T,
|
|
51
|
-
ENDED:
|
|
51
|
+
ENDED: D,
|
|
52
52
|
ENDED_FROM_SERVER: te,
|
|
53
53
|
ENTER_ROOM: Q,
|
|
54
54
|
FAILED: C,
|
|
55
55
|
FAILED_INCOMING_CALL: Y,
|
|
56
|
-
GET_USER_MEDIA_FAILED:
|
|
57
|
-
HOLD:
|
|
58
|
-
ICE_CANDIDATE:
|
|
56
|
+
GET_USER_MEDIA_FAILED: Ke,
|
|
57
|
+
HOLD: Ge,
|
|
58
|
+
ICE_CANDIDATE: Qe,
|
|
59
59
|
INCOMING_CALL: B,
|
|
60
60
|
MAIN_CAM_CONTROL: se,
|
|
61
61
|
MUST_STOP_PRESENTATION_EVENT: z,
|
|
62
|
-
MUTED:
|
|
62
|
+
MUTED: xe,
|
|
63
63
|
NEW_DTMF: Ne,
|
|
64
64
|
NEW_INFO: ge,
|
|
65
|
-
NEW_MESSAGE:
|
|
65
|
+
NEW_MESSAGE: ke,
|
|
66
66
|
NEW_RTC_SESSION: P,
|
|
67
67
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
|
|
68
68
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ae,
|
|
@@ -72,31 +72,31 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
72
72
|
PARTICIPATION_CANCELLING_WORD_REQUEST: he,
|
|
73
73
|
PEER_CONNECTION: b,
|
|
74
74
|
PEER_CONNECTION_CONFIRMED: j,
|
|
75
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED:
|
|
76
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED:
|
|
75
|
+
PEER_CONNECTION_CREATE_ANSWER_FAILED: Ze,
|
|
76
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: je,
|
|
77
77
|
PEER_CONNECTION_ONTRACK: Z,
|
|
78
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:
|
|
79
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:
|
|
80
|
-
PRESENTATION_END:
|
|
78
|
+
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: et,
|
|
79
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: tt,
|
|
80
|
+
PRESENTATION_END: it,
|
|
81
81
|
PRESENTATION_ENDED: Ce,
|
|
82
82
|
PRESENTATION_FAILED: U,
|
|
83
|
-
PRESENTATION_START:
|
|
84
|
-
PRESENTATION_STARTED:
|
|
85
|
-
PROGRESS:
|
|
86
|
-
REFER:
|
|
87
|
-
REGISTERED:
|
|
88
|
-
REGISTRATION_FAILED:
|
|
89
|
-
REINVITE:
|
|
90
|
-
REPLACES:
|
|
91
|
-
SDP:
|
|
92
|
-
SENDING:
|
|
83
|
+
PRESENTATION_START: st,
|
|
84
|
+
PRESENTATION_STARTED: nt,
|
|
85
|
+
PROGRESS: Ve,
|
|
86
|
+
REFER: Be,
|
|
87
|
+
REGISTERED: f,
|
|
88
|
+
REGISTRATION_FAILED: O,
|
|
89
|
+
REINVITE: We,
|
|
90
|
+
REPLACES: Fe,
|
|
91
|
+
SDP: ze,
|
|
92
|
+
SENDING: qe,
|
|
93
93
|
SHARE_STATE: p,
|
|
94
|
-
SIP_EVENT:
|
|
94
|
+
SIP_EVENT: G,
|
|
95
95
|
TERMINATED_INCOMING_CALL: x,
|
|
96
|
-
UNHOLD:
|
|
96
|
+
UNHOLD: Xe,
|
|
97
97
|
UNMUTED: $e,
|
|
98
|
-
UNREGISTERED:
|
|
99
|
-
UPDATE:
|
|
98
|
+
UNREGISTERED: $,
|
|
99
|
+
UPDATE: Je,
|
|
100
100
|
USE_LICENSE: K,
|
|
101
101
|
WEBCAST_STARTED: de,
|
|
102
102
|
WEBCAST_STOPPED: le
|
|
@@ -118,15 +118,15 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
118
118
|
ce
|
|
119
119
|
], Ae = [
|
|
120
120
|
L,
|
|
121
|
-
|
|
121
|
+
m,
|
|
122
122
|
T,
|
|
123
123
|
P,
|
|
124
|
-
m,
|
|
125
|
-
G,
|
|
126
124
|
f,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
$,
|
|
126
|
+
O,
|
|
127
|
+
ke,
|
|
128
|
+
G
|
|
129
|
+
], rt = [
|
|
130
130
|
X,
|
|
131
131
|
J,
|
|
132
132
|
z,
|
|
@@ -140,25 +140,26 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
140
140
|
se,
|
|
141
141
|
ie,
|
|
142
142
|
ne,
|
|
143
|
-
re,
|
|
144
143
|
oe,
|
|
144
|
+
re,
|
|
145
145
|
w
|
|
146
146
|
], Re = [
|
|
147
|
-
|
|
147
|
+
D,
|
|
148
148
|
L,
|
|
149
|
+
qe,
|
|
149
150
|
We,
|
|
150
151
|
Fe,
|
|
151
152
|
Be,
|
|
152
153
|
Ve,
|
|
153
154
|
Ye,
|
|
154
|
-
xe,
|
|
155
155
|
y,
|
|
156
156
|
b,
|
|
157
157
|
C,
|
|
158
|
-
|
|
158
|
+
xe,
|
|
159
159
|
$e,
|
|
160
160
|
Ne,
|
|
161
161
|
ge,
|
|
162
|
+
Ge,
|
|
162
163
|
Xe,
|
|
163
164
|
Je,
|
|
164
165
|
ze,
|
|
@@ -171,75 +172,74 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
171
172
|
st,
|
|
172
173
|
nt,
|
|
173
174
|
it,
|
|
174
|
-
rt,
|
|
175
175
|
Ce,
|
|
176
176
|
U
|
|
177
|
-
],
|
|
177
|
+
], at = [...Ae, ...ot], ct = [
|
|
178
178
|
...Re,
|
|
179
|
-
...
|
|
180
|
-
],
|
|
179
|
+
...rt
|
|
180
|
+
], $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
181
181
|
__proto__: null,
|
|
182
|
-
SESSION_EVENT_NAMES:
|
|
182
|
+
SESSION_EVENT_NAMES: ct,
|
|
183
183
|
SESSION_JSSIP_EVENT_NAMES: Re,
|
|
184
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
185
|
-
UA_EVENT_NAMES:
|
|
184
|
+
SESSION_SYNTHETICS_EVENT_NAMES: rt,
|
|
185
|
+
UA_EVENT_NAMES: at,
|
|
186
186
|
UA_JSSIP_EVENT_NAMES: Ae,
|
|
187
187
|
UA_SYNTHETICS_EVENT_NAMES: ot
|
|
188
|
-
}, Symbol.toStringTag, { value: "Module" })), Ft = (
|
|
188
|
+
}, Symbol.toStringTag, { value: "Module" })), Ft = (o) => {
|
|
189
189
|
const e = [];
|
|
190
|
-
return
|
|
191
|
-
}, Bt = "content-type", Vt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", Yt = "application/vinteo.webrtc.roomname", xt = "application/vinteo.webrtc.channels",
|
|
190
|
+
return o && e.push(`X-Vinteo-Remote: ${o}`), e;
|
|
191
|
+
}, Bt = "content-type", Vt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", Yt = "application/vinteo.webrtc.roomname", xt = "application/vinteo.webrtc.channels", $t = "application/vinteo.webrtc.mediastate", Gt = "application/vinteo.webrtc.refusal", Oe = "application/vinteo.webrtc.maincam", Xt = "application/vinteo.webrtc.mic", Jt = "application/vinteo.webrtc.uselic", zt = "X-WEBRTC-USE-LICENSE", De = "X-WEBRTC-INPUT-CHANNELS", Me = "X-WEBRTC-OUTPUT-CHANNELS", Qt = "X-WEBRTC-MAINCAM", Kt = "X-WEBRTC-MIC", Pe = "X-WEBRTC-SYNC", jt = "X-WEBRTC-MAINCAM-RESOLUTION", Zt = "X-WEBRTC-MEDIA-STATE", es = "X-Vinteo-Media-Type", ts = "X-Vinteo-MainCam-State", ss = "X-Vinteo-Mic-State", ns = "application/vinteo.webrtc.notify", is = "X-VINTEO-NOTIFY", A = "x-webrtc-share-state", os = `${A}: LETMESTARTPRESENTATION`, rs = `${A}: STOPPRESENTATION`, Et = "YOUCANRECEIVECONTENT", _t = "CONTENTEND", ht = "YOUMUSTSTOPSENDCONTENT", as = `${A}: ${ht}`, cs = `${A}: ${Et}`, Es = `${A}: ${_t}`, _s = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", hs = `${_s}: LETMESTARTMAINCAM`, Ie = "sip-connector", pe = F(Ie), Gs = () => {
|
|
192
192
|
F.enable(Ie);
|
|
193
|
-
},
|
|
193
|
+
}, Xs = () => {
|
|
194
194
|
F.enable(`-${Ie}`);
|
|
195
195
|
};
|
|
196
|
-
var
|
|
197
|
-
function
|
|
198
|
-
return (e) => `sip:${e}@${
|
|
196
|
+
var I = /* @__PURE__ */ ((o) => (o.PAUSE_MAIN_CAM = "PAUSEMAINCAM", o.RESUME_MAIN_CAM = "RESUMEMAINCAM", o.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", o.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", o.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", o))(I || {}), k = /* @__PURE__ */ ((o) => (o.ADMIN_STOP_MIC = "ADMINSTOPMIC", o.ADMIN_START_MIC = "ADMINSTARTMIC", o))(k || {}), q = /* @__PURE__ */ ((o) => (o.ADMIN_SYNC_FORCED = "1", o.ADMIN_SYNC_NOT_FORCED = "0", o))(q || {}), ds = /* @__PURE__ */ ((o) => (o.AUDIO = "AUDIO", o.VIDEO = "VIDEO", o.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", o))(ds || {});
|
|
197
|
+
function ve(o) {
|
|
198
|
+
return (e) => `sip:${e}@${o}`;
|
|
199
199
|
}
|
|
200
|
-
const
|
|
200
|
+
const ls = (o, e) => () => Math.floor(Math.random() * (e - o)) + o, we = (o) => o.trim().replaceAll(" ", "_"), us = ls(1e5, 99999999), H = (o, {
|
|
201
201
|
videoMode: e,
|
|
202
202
|
audioMode: t
|
|
203
203
|
} = {}) => {
|
|
204
|
-
if (!
|
|
204
|
+
if (!o || e === "recvonly" && t === "recvonly")
|
|
205
205
|
return;
|
|
206
|
-
const s = t === "recvonly" ? [] :
|
|
206
|
+
const s = t === "recvonly" ? [] : o.getAudioTracks(), n = e === "recvonly" ? [] : o.getVideoTracks(), r = [...s, ...n], a = new MediaStream(r);
|
|
207
207
|
return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
|
|
208
|
-
},
|
|
208
|
+
}, Ts = (o) => o.some((t) => {
|
|
209
209
|
const { kind: s } = t;
|
|
210
210
|
return s === "video";
|
|
211
|
-
}),
|
|
211
|
+
}), Ss = "Error decline with 603", Ns = (o) => o.message === Ss, gs = (o, e) => o.find((t) => t.track && e.getTracks().includes(t.track)), dt = 1, lt = (o) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== o, Cs = lt(
|
|
212
212
|
dt
|
|
213
|
-
),
|
|
214
|
-
const t =
|
|
215
|
-
if (t !== void 0 &&
|
|
213
|
+
), As = (o, e) => {
|
|
214
|
+
const t = o === void 0 ? void 0 : Math.max(o, dt);
|
|
215
|
+
if (t !== void 0 && Cs(
|
|
216
216
|
t,
|
|
217
217
|
e
|
|
218
218
|
))
|
|
219
219
|
return t;
|
|
220
|
-
},
|
|
221
|
-
if (
|
|
222
|
-
return
|
|
223
|
-
},
|
|
224
|
-
const s =
|
|
220
|
+
}, Rs = lt(), Is = (o, e) => {
|
|
221
|
+
if (Rs(o, e))
|
|
222
|
+
return o;
|
|
223
|
+
}, ms = async (o, e, t) => {
|
|
224
|
+
const s = o.getParameters();
|
|
225
225
|
(s.encodings === void 0 || s.encodings.length === 0) && (s.encodings = [{}]);
|
|
226
|
-
const [n] = s.encodings,
|
|
226
|
+
const [n] = s.encodings, r = n.scaleResolutionDownBy, a = As(
|
|
227
227
|
e.scaleResolutionDownBy,
|
|
228
|
-
|
|
228
|
+
r
|
|
229
229
|
);
|
|
230
230
|
let c = !1;
|
|
231
231
|
a !== void 0 && (s.encodings[0].scaleResolutionDownBy = a, c = !0);
|
|
232
|
-
const E = n.maxBitrate, _ =
|
|
233
|
-
return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s),
|
|
234
|
-
},
|
|
235
|
-
const s =
|
|
232
|
+
const E = n.maxBitrate, _ = Is(e.maxBitrate, E);
|
|
233
|
+
return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), o.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
|
|
234
|
+
}, fs = async (o, e, t) => {
|
|
235
|
+
const s = gs(o, e);
|
|
236
236
|
if (s)
|
|
237
|
-
return
|
|
238
|
-
},
|
|
239
|
-
const { originator: e, cause: t } =
|
|
240
|
-
return At(
|
|
241
|
-
}, g = "SipConnector",
|
|
242
|
-
class
|
|
237
|
+
return ms(s, { maxBitrate: t });
|
|
238
|
+
}, Os = 486, Ds = 487, W = "local", ye = "remote", Js = (o = new Error()) => {
|
|
239
|
+
const { originator: e, cause: t } = o;
|
|
240
|
+
return At(o) ? !0 : typeof t == "string" ? t === be || t === Ue || e === W && (t === He || t === Le) : !1;
|
|
241
|
+
}, g = "SipConnector", Ms = "channels", Ps = "WebcastStarted", ps = "WebcastStopped", vs = "accountChanged", ws = "accountDeleted", ys = "addedToListModerators", bs = "removedFromListModerators", Us = "ParticipationRequestAccepted", Ls = "ParticipationRequestRejected", Hs = "ParticipantMovedToWebcast", ks = "ConferenceParticipantTokenIssued";
|
|
242
|
+
class zs {
|
|
243
243
|
constructor({ JsSIP: e }) {
|
|
244
244
|
i(this, "_isRegisterConfig", !1);
|
|
245
245
|
i(this, "_connectionConfiguration", {});
|
|
@@ -277,24 +277,24 @@ class Js {
|
|
|
277
277
|
try {
|
|
278
278
|
await this.unregister();
|
|
279
279
|
} catch (e) {
|
|
280
|
-
|
|
280
|
+
pe("tryRegister", e);
|
|
281
281
|
}
|
|
282
282
|
return this.register();
|
|
283
283
|
});
|
|
284
|
-
i(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
284
|
+
i(this, "declineToIncomingCall", async ({ statusCode: e = Ds } = {}) => new Promise((t, s) => {
|
|
285
285
|
if (!this.isAvailableIncomingCall) {
|
|
286
286
|
s(new Error("no incomingSession"));
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
const n = this.incomingSession,
|
|
290
|
-
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V,
|
|
289
|
+
const n = this.incomingSession, r = this.remoteCallerData;
|
|
290
|
+
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V, r), t(n.terminate({ status_code: e }));
|
|
291
291
|
}));
|
|
292
|
-
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
292
|
+
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: Os }));
|
|
293
293
|
i(this, "removeIncomingSession", () => {
|
|
294
294
|
delete this.incomingSession;
|
|
295
295
|
});
|
|
296
296
|
i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
297
|
-
if (e ===
|
|
297
|
+
if (e === ye) {
|
|
298
298
|
this.incomingSession = t;
|
|
299
299
|
const s = this.remoteCallerData;
|
|
300
300
|
t.on(C, (n) => {
|
|
@@ -308,7 +308,7 @@ class Js {
|
|
|
308
308
|
password: t,
|
|
309
309
|
sipServerUrl: s,
|
|
310
310
|
sipWebSocketServerURL: n,
|
|
311
|
-
remoteAddress:
|
|
311
|
+
remoteAddress: r,
|
|
312
312
|
sdpSemantics: a,
|
|
313
313
|
sessionTimers: c,
|
|
314
314
|
registerExpires: E,
|
|
@@ -333,12 +333,12 @@ class Js {
|
|
|
333
333
|
register: l,
|
|
334
334
|
user: e,
|
|
335
335
|
password: t
|
|
336
|
-
}, this.getSipServerUrl =
|
|
337
|
-
const { socket:
|
|
336
|
+
}, this.getSipServerUrl = ve(s), this.socket = new this.JsSIP.WebSocketInterface(n), this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l;
|
|
337
|
+
const { socket: R } = this;
|
|
338
338
|
this.ua = this._createUa({
|
|
339
339
|
user: e,
|
|
340
340
|
password: t,
|
|
341
|
-
socket:
|
|
341
|
+
socket: R,
|
|
342
342
|
displayName: d,
|
|
343
343
|
register: l,
|
|
344
344
|
sdpSemantics: a,
|
|
@@ -352,7 +352,7 @@ class Js {
|
|
|
352
352
|
const me = Ae.find((Nt) => Nt === St);
|
|
353
353
|
me && this.ua && this.ua.on(me, Tt);
|
|
354
354
|
});
|
|
355
|
-
const ut = [...Ft(
|
|
355
|
+
const ut = [...Ft(r), ...S];
|
|
356
356
|
return this.ua.registrator().setExtraHeaders(ut), this.ua;
|
|
357
357
|
});
|
|
358
358
|
i(this, "_createUa", ({
|
|
@@ -360,7 +360,7 @@ class Js {
|
|
|
360
360
|
password: t,
|
|
361
361
|
socket: s,
|
|
362
362
|
displayName: n,
|
|
363
|
-
getSipServerUrl:
|
|
363
|
+
getSipServerUrl: r,
|
|
364
364
|
register: a = !1,
|
|
365
365
|
sdpSemantics: c = "plan-b",
|
|
366
366
|
sessionTimers: E = !1,
|
|
@@ -372,11 +372,11 @@ class Js {
|
|
|
372
372
|
}) => {
|
|
373
373
|
if (a && !t)
|
|
374
374
|
throw new Error("password is required for authorized connection");
|
|
375
|
-
const l = a && e ? e.trim() : `${
|
|
375
|
+
const l = a && e ? e.trim() : `${us()}`, S = r(l), R = {
|
|
376
376
|
password: t,
|
|
377
377
|
register: a,
|
|
378
378
|
uri: S,
|
|
379
|
-
display_name:
|
|
379
|
+
display_name: we(n),
|
|
380
380
|
user_agent: d,
|
|
381
381
|
sdp_semantics: c,
|
|
382
382
|
sockets: [s],
|
|
@@ -385,7 +385,7 @@ class Js {
|
|
|
385
385
|
connection_recovery_min_interval: h,
|
|
386
386
|
connection_recovery_max_interval: u
|
|
387
387
|
};
|
|
388
|
-
return new this.JsSIP.UA(
|
|
388
|
+
return new this.JsSIP.UA(R);
|
|
389
389
|
});
|
|
390
390
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
391
391
|
const { ua: s } = this;
|
|
@@ -395,23 +395,23 @@ class Js {
|
|
|
395
395
|
}
|
|
396
396
|
const n = () => {
|
|
397
397
|
c(), e(s);
|
|
398
|
-
},
|
|
398
|
+
}, r = (E) => {
|
|
399
399
|
c(), t(E);
|
|
400
400
|
}, a = () => {
|
|
401
|
-
this.isRegisterConfig ? (this.on(
|
|
401
|
+
this.isRegisterConfig ? (this.on(f, n), this.on(O, r)) : this.on(m, n), this.on(T, r);
|
|
402
402
|
}, c = () => {
|
|
403
|
-
this.off(
|
|
403
|
+
this.off(f, n), this.off(O, r), this.off(m, n), this.off(T, r);
|
|
404
404
|
};
|
|
405
405
|
a(), this.on(P, this.handleNewRTCSession), s.start();
|
|
406
406
|
}));
|
|
407
407
|
i(this, "_set", async ({ displayName: e, password: t }) => new Promise((s, n) => {
|
|
408
|
-
const { ua:
|
|
409
|
-
if (!
|
|
408
|
+
const { ua: r } = this;
|
|
409
|
+
if (!r) {
|
|
410
410
|
n(new Error("this.ua is not initialized"));
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
let a = !1, c = !1;
|
|
414
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a =
|
|
414
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = r.set("display_name", we(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = r.set("password", t), this._connectionConfiguration.password = t);
|
|
415
415
|
const E = a || c;
|
|
416
416
|
c && this.isRegisterConfig ? this.register().then(() => {
|
|
417
417
|
s(E);
|
|
@@ -434,7 +434,7 @@ class Js {
|
|
|
434
434
|
mediaStream: t,
|
|
435
435
|
extraHeaders: s = [],
|
|
436
436
|
ontrack: n,
|
|
437
|
-
iceServers:
|
|
437
|
+
iceServers: r,
|
|
438
438
|
videoMode: a,
|
|
439
439
|
audioMode: c,
|
|
440
440
|
degradationPreference: E,
|
|
@@ -459,7 +459,7 @@ class Js {
|
|
|
459
459
|
audioMode: c,
|
|
460
460
|
degradationPreference: E,
|
|
461
461
|
pcConfig: {
|
|
462
|
-
iceServers:
|
|
462
|
+
iceServers: r
|
|
463
463
|
},
|
|
464
464
|
rtcOfferConstraints: {
|
|
465
465
|
offerToReceiveAudio: _,
|
|
@@ -472,7 +472,7 @@ class Js {
|
|
|
472
472
|
ontrack: t,
|
|
473
473
|
extraHeaders: s = [],
|
|
474
474
|
iceServers: n,
|
|
475
|
-
videoMode:
|
|
475
|
+
videoMode: r,
|
|
476
476
|
audioMode: a,
|
|
477
477
|
degradationPreference: c
|
|
478
478
|
}) => new Promise((E, _) => {
|
|
@@ -487,18 +487,18 @@ class Js {
|
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
489
|
this._sessionEvents.eachTriggers((d, l) => {
|
|
490
|
-
const S = Re.find((
|
|
490
|
+
const S = Re.find((R) => R === l);
|
|
491
491
|
S && h.on(S, d);
|
|
492
492
|
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((d) => {
|
|
493
493
|
_(d);
|
|
494
494
|
});
|
|
495
495
|
const u = H(e, {
|
|
496
|
-
videoMode:
|
|
496
|
+
videoMode: r,
|
|
497
497
|
audioMode: a
|
|
498
498
|
});
|
|
499
499
|
h.answer({
|
|
500
500
|
extraHeaders: s,
|
|
501
|
-
videoMode:
|
|
501
|
+
videoMode: r,
|
|
502
502
|
audioMode: a,
|
|
503
503
|
degradationPreference: c,
|
|
504
504
|
mediaStream: u,
|
|
@@ -510,14 +510,14 @@ class Js {
|
|
|
510
510
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
|
|
511
511
|
const n = () => {
|
|
512
512
|
this.onSession(b, h), this.onSession(y, u);
|
|
513
|
-
},
|
|
513
|
+
}, r = () => {
|
|
514
514
|
this.offSession(b, h), this.offSession(y, u);
|
|
515
515
|
}, a = () => {
|
|
516
|
-
this.onSession(C, E), this.onSession(
|
|
516
|
+
this.onSession(C, E), this.onSession(D, E);
|
|
517
517
|
}, c = () => {
|
|
518
|
-
this.offSession(C, E), this.offSession(
|
|
518
|
+
this.offSession(C, E), this.offSession(D, E);
|
|
519
519
|
}, E = (d) => {
|
|
520
|
-
|
|
520
|
+
r(), c(), s(d);
|
|
521
521
|
};
|
|
522
522
|
let _;
|
|
523
523
|
const h = ({ peerconnection: d }) => {
|
|
@@ -525,7 +525,7 @@ class Js {
|
|
|
525
525
|
this._sessionEvents.trigger(Z, _), e && e(l);
|
|
526
526
|
};
|
|
527
527
|
}, u = () => {
|
|
528
|
-
_ && this._sessionEvents.trigger(j, _),
|
|
528
|
+
_ && this._sessionEvents.trigger(j, _), r(), c(), t(_);
|
|
529
529
|
};
|
|
530
530
|
n(), a();
|
|
531
531
|
}));
|
|
@@ -538,8 +538,8 @@ class Js {
|
|
|
538
538
|
s(new Error("No session established"));
|
|
539
539
|
return;
|
|
540
540
|
}
|
|
541
|
-
this.onceSession(Ne, ({ originator:
|
|
542
|
-
|
|
541
|
+
this.onceSession(Ne, ({ originator: r }) => {
|
|
542
|
+
r === W && t();
|
|
543
543
|
}), n.sendDTMF(e, {
|
|
544
544
|
duration: 120,
|
|
545
545
|
interToneGap: 600
|
|
@@ -553,15 +553,15 @@ class Js {
|
|
|
553
553
|
});
|
|
554
554
|
i(this, "_handleShareState", (e) => {
|
|
555
555
|
switch (e) {
|
|
556
|
-
case
|
|
556
|
+
case Et: {
|
|
557
557
|
this._sessionEvents.trigger(X, void 0);
|
|
558
558
|
break;
|
|
559
559
|
}
|
|
560
|
-
case
|
|
560
|
+
case _t: {
|
|
561
561
|
this._sessionEvents.trigger(J, void 0);
|
|
562
562
|
break;
|
|
563
563
|
}
|
|
564
|
-
case
|
|
564
|
+
case ht: {
|
|
565
565
|
this._sessionEvents.trigger(z, void 0);
|
|
566
566
|
break;
|
|
567
567
|
}
|
|
@@ -579,61 +579,61 @@ class Js {
|
|
|
579
579
|
});
|
|
580
580
|
i(this, "_handleNotify", (e) => {
|
|
581
581
|
switch (e.cmd) {
|
|
582
|
-
case
|
|
582
|
+
case Ms: {
|
|
583
583
|
const t = e;
|
|
584
584
|
this._triggerChannelsNotify(t);
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
|
-
case
|
|
587
|
+
case Ps: {
|
|
588
588
|
const t = e;
|
|
589
589
|
this._triggerWebcastStartedNotify(t);
|
|
590
590
|
break;
|
|
591
591
|
}
|
|
592
|
-
case
|
|
592
|
+
case ps: {
|
|
593
593
|
const t = e;
|
|
594
594
|
this._triggerWebcastStoppedNotify(t);
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
597
|
-
case
|
|
597
|
+
case ys: {
|
|
598
598
|
const t = e;
|
|
599
599
|
this._triggerAddedToListModeratorsNotify(t);
|
|
600
600
|
break;
|
|
601
601
|
}
|
|
602
|
-
case
|
|
602
|
+
case bs: {
|
|
603
603
|
const t = e;
|
|
604
604
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
605
605
|
break;
|
|
606
606
|
}
|
|
607
|
-
case
|
|
607
|
+
case Us: {
|
|
608
608
|
const t = e;
|
|
609
609
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
610
610
|
break;
|
|
611
611
|
}
|
|
612
|
-
case
|
|
612
|
+
case Ls: {
|
|
613
613
|
const t = e;
|
|
614
614
|
this._triggerParticipationCancellingWordRequest(t);
|
|
615
615
|
break;
|
|
616
616
|
}
|
|
617
|
-
case
|
|
617
|
+
case Hs: {
|
|
618
618
|
const t = e;
|
|
619
619
|
this._triggerParticipantMoveRequestToStream(t);
|
|
620
620
|
break;
|
|
621
621
|
}
|
|
622
|
-
case
|
|
622
|
+
case vs: {
|
|
623
623
|
this._triggerAccountChangedNotify();
|
|
624
624
|
break;
|
|
625
625
|
}
|
|
626
|
-
case
|
|
626
|
+
case ws: {
|
|
627
627
|
this._triggerAccountDeletedNotify();
|
|
628
628
|
break;
|
|
629
629
|
}
|
|
630
|
-
case
|
|
630
|
+
case ks: {
|
|
631
631
|
const t = e;
|
|
632
632
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
633
633
|
break;
|
|
634
634
|
}
|
|
635
635
|
default:
|
|
636
|
-
|
|
636
|
+
pe("unknown cmd", e.cmd);
|
|
637
637
|
}
|
|
638
638
|
});
|
|
639
639
|
i(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -722,28 +722,28 @@ class Js {
|
|
|
722
722
|
this._sessionEvents.trigger(Q, t);
|
|
723
723
|
});
|
|
724
724
|
i(this, "_triggerShareState", (e) => {
|
|
725
|
-
const t = e.getHeader(
|
|
725
|
+
const t = e.getHeader(A);
|
|
726
726
|
this._sessionEvents.trigger(p, t);
|
|
727
727
|
});
|
|
728
728
|
i(this, "_triggerMainCamControl", (e) => {
|
|
729
729
|
const t = e.getHeader(Qt), s = e.getHeader(Pe), n = s === q.ADMIN_SYNC_FORCED;
|
|
730
|
-
if (t ===
|
|
730
|
+
if (t === I.ADMIN_START_MAIN_CAM)
|
|
731
731
|
this._sessionEvents.trigger(ie, { isSyncForced: n });
|
|
732
|
-
else if (t ===
|
|
732
|
+
else if (t === I.ADMIN_STOP_MAIN_CAM)
|
|
733
733
|
this._sessionEvents.trigger(ne, { isSyncForced: n });
|
|
734
|
-
else if ((t ===
|
|
734
|
+
else if ((t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && s)
|
|
735
735
|
this._sessionEvents.trigger(w, { isSyncForced: n });
|
|
736
736
|
else {
|
|
737
|
-
const
|
|
737
|
+
const r = e.getHeader(jt);
|
|
738
738
|
this._sessionEvents.trigger(se, {
|
|
739
739
|
mainCam: t,
|
|
740
|
-
resolutionMainCam:
|
|
740
|
+
resolutionMainCam: r
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
});
|
|
744
744
|
i(this, "_triggerMicControl", (e) => {
|
|
745
745
|
const t = e.getHeader(Kt), n = e.getHeader(Pe) === q.ADMIN_SYNC_FORCED;
|
|
746
|
-
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(
|
|
746
|
+
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(re, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(oe, { isSyncForced: n });
|
|
747
747
|
});
|
|
748
748
|
i(this, "_triggerUseLicense", (e) => {
|
|
749
749
|
const t = e.getHeader(zt);
|
|
@@ -794,9 +794,9 @@ class Js {
|
|
|
794
794
|
});
|
|
795
795
|
i(this, "_handleEnded", (e) => {
|
|
796
796
|
const { originator: t } = e;
|
|
797
|
-
t ===
|
|
797
|
+
t === ye && this._sessionEvents.trigger(te, e), this._restoreSession();
|
|
798
798
|
});
|
|
799
|
-
this.JsSIP = e, this._sessionEvents = new fe(
|
|
799
|
+
this.JsSIP = e, this._sessionEvents = new fe(ct), this._uaEvents = new fe(at), this._cancelableConnect = new N(
|
|
800
800
|
this._connect,
|
|
801
801
|
{
|
|
802
802
|
moduleName: g,
|
|
@@ -815,22 +815,22 @@ class Js {
|
|
|
815
815
|
}), this._cancelableCall = new N(
|
|
816
816
|
this._call,
|
|
817
817
|
{ moduleName: g }
|
|
818
|
-
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(p, this._handleShareState), this.onSession(ge, this._handleNewInfo), this.on(
|
|
818
|
+
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(p, this._handleShareState), this.onSession(ge, this._handleNewInfo), this.on(G, this._handleSipEvent), this.onSession(C, this._handleEnded), this.onSession(D, this._handleEnded);
|
|
819
819
|
}
|
|
820
820
|
async register() {
|
|
821
821
|
return new Promise((e, t) => {
|
|
822
|
-
this.isRegisterConfig && this.ua ? (this.ua.on(
|
|
822
|
+
this.isRegisterConfig && this.ua ? (this.ua.on(f, e), this.ua.on(O, t), this.ua.register()) : t(new Error("Config is not registered"));
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
async unregister() {
|
|
826
826
|
return new Promise((e, t) => {
|
|
827
|
-
this.isRegistered && this.ua ? (this.ua.on(
|
|
827
|
+
this.isRegistered && this.ua ? (this.ua.on($, e), this.ua.unregister()) : t(new Error("ua is not registered"));
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
830
|
async sendOptions(e, t, s) {
|
|
831
831
|
if (!this.ua)
|
|
832
832
|
throw new Error("is not connected");
|
|
833
|
-
return new Promise((n,
|
|
833
|
+
return new Promise((n, r) => {
|
|
834
834
|
try {
|
|
835
835
|
this.ua.sendOptions(e, t, {
|
|
836
836
|
extraHeaders: s,
|
|
@@ -838,11 +838,11 @@ class Js {
|
|
|
838
838
|
succeeded: () => {
|
|
839
839
|
n();
|
|
840
840
|
},
|
|
841
|
-
failed:
|
|
841
|
+
failed: r
|
|
842
842
|
}
|
|
843
843
|
});
|
|
844
844
|
} catch (a) {
|
|
845
|
-
|
|
845
|
+
r(a);
|
|
846
846
|
}
|
|
847
847
|
});
|
|
848
848
|
}
|
|
@@ -858,13 +858,13 @@ class Js {
|
|
|
858
858
|
displayName: t,
|
|
859
859
|
sipServerUrl: s,
|
|
860
860
|
sipWebSocketServerURL: n,
|
|
861
|
-
sdpSemantics:
|
|
861
|
+
sdpSemantics: r
|
|
862
862
|
}) {
|
|
863
863
|
return new Promise((a, c) => {
|
|
864
|
-
const E =
|
|
864
|
+
const E = ve(s), _ = new this.JsSIP.WebSocketInterface(n), h = this._createUa({
|
|
865
865
|
socket: _,
|
|
866
866
|
displayName: t,
|
|
867
|
-
sdpSemantics:
|
|
867
|
+
sdpSemantics: r,
|
|
868
868
|
userAgent: e,
|
|
869
869
|
getSipServerUrl: E
|
|
870
870
|
}), u = () => {
|
|
@@ -875,7 +875,7 @@ class Js {
|
|
|
875
875
|
const d = () => {
|
|
876
876
|
h.removeAllListeners(), h.once(T, a), h.stop();
|
|
877
877
|
};
|
|
878
|
-
h.once(
|
|
878
|
+
h.once(m, d), h.start();
|
|
879
879
|
});
|
|
880
880
|
}
|
|
881
881
|
async replaceMediaStream(e, t) {
|
|
@@ -886,13 +886,13 @@ class Js {
|
|
|
886
886
|
async askPermissionToEnableCam(e = {}) {
|
|
887
887
|
if (!this.session)
|
|
888
888
|
throw new Error("No session established");
|
|
889
|
-
const t = [
|
|
889
|
+
const t = [hs];
|
|
890
890
|
return this.session.sendInfo(Oe, void 0, {
|
|
891
891
|
noTerminateWhenError: !0,
|
|
892
892
|
...e,
|
|
893
893
|
extraHeaders: t
|
|
894
894
|
}).catch((s) => {
|
|
895
|
-
if (
|
|
895
|
+
if (Ns(s))
|
|
896
896
|
throw s;
|
|
897
897
|
});
|
|
898
898
|
}
|
|
@@ -902,23 +902,23 @@ class Js {
|
|
|
902
902
|
async _sendPresentation(e, t, {
|
|
903
903
|
maxBitrate: s,
|
|
904
904
|
degradationPreference: n,
|
|
905
|
-
isNeedReinvite:
|
|
905
|
+
isNeedReinvite: r = !0,
|
|
906
906
|
isP2P: a = !1
|
|
907
907
|
}) {
|
|
908
908
|
const c = H(t);
|
|
909
909
|
this._streamPresentationCurrent = c;
|
|
910
|
-
const E = a ? [
|
|
910
|
+
const E = a ? [cs] : [os], _ = e.sendInfo(M, void 0, {
|
|
911
911
|
extraHeaders: E
|
|
912
912
|
}).then(async () => e.startPresentation(
|
|
913
913
|
c,
|
|
914
|
-
|
|
914
|
+
r,
|
|
915
915
|
n
|
|
916
916
|
)).then(async () => {
|
|
917
917
|
const { connection: h } = this;
|
|
918
918
|
if (!h || s === void 0)
|
|
919
919
|
return;
|
|
920
920
|
const u = h.getSenders();
|
|
921
|
-
await
|
|
921
|
+
await fs(u, t, s);
|
|
922
922
|
}).then(() => t).catch((h) => {
|
|
923
923
|
throw this._sessionEvents.trigger(U, h), h;
|
|
924
924
|
});
|
|
@@ -930,7 +930,7 @@ class Js {
|
|
|
930
930
|
isNeedReinvite: t = !0,
|
|
931
931
|
isP2P: s = !1,
|
|
932
932
|
maxBitrate: n,
|
|
933
|
-
degradationPreference:
|
|
933
|
+
degradationPreference: r
|
|
934
934
|
} = {}) {
|
|
935
935
|
const a = this.establishedSession;
|
|
936
936
|
if (!a)
|
|
@@ -941,12 +941,12 @@ class Js {
|
|
|
941
941
|
isNeedReinvite: t,
|
|
942
942
|
isP2P: s,
|
|
943
943
|
maxBitrate: n,
|
|
944
|
-
degradationPreference:
|
|
944
|
+
degradationPreference: r
|
|
945
945
|
});
|
|
946
946
|
}
|
|
947
947
|
async sendMustStopPresentation(e) {
|
|
948
948
|
await e.sendInfo(M, void 0, {
|
|
949
|
-
extraHeaders: [
|
|
949
|
+
extraHeaders: [as]
|
|
950
950
|
});
|
|
951
951
|
}
|
|
952
952
|
async stopPresentation({
|
|
@@ -954,12 +954,12 @@ class Js {
|
|
|
954
954
|
} = {}) {
|
|
955
955
|
const t = this._streamPresentationCurrent;
|
|
956
956
|
let s = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
957
|
-
const n = e ? [
|
|
958
|
-
return
|
|
957
|
+
const n = e ? [Es] : [rs], r = this.establishedSession;
|
|
958
|
+
return r && t && (s = s.then(async () => r.sendInfo(M, void 0, {
|
|
959
959
|
extraHeaders: n
|
|
960
|
-
})).then(async () =>
|
|
960
|
+
})).then(async () => r.stopPresentation(t)).catch((a) => {
|
|
961
961
|
throw this._sessionEvents.trigger(U, a), a;
|
|
962
|
-
})), !
|
|
962
|
+
})), !r && t && this._sessionEvents.trigger(Ce, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
963
963
|
this._resetPresentation();
|
|
964
964
|
});
|
|
965
965
|
}
|
|
@@ -968,12 +968,12 @@ class Js {
|
|
|
968
968
|
maxBitrate: s,
|
|
969
969
|
degradationPreference: n
|
|
970
970
|
} = {}) {
|
|
971
|
-
const
|
|
972
|
-
if (!
|
|
971
|
+
const r = this.establishedSession;
|
|
972
|
+
if (!r)
|
|
973
973
|
throw new Error("No session established");
|
|
974
974
|
if (!this._streamPresentationCurrent)
|
|
975
975
|
throw new Error("Presentation has not started yet");
|
|
976
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(
|
|
976
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(r, e, {
|
|
977
977
|
isP2P: t,
|
|
978
978
|
maxBitrate: s,
|
|
979
979
|
degradationPreference: n,
|
|
@@ -1023,18 +1023,18 @@ class Js {
|
|
|
1023
1023
|
if (!this.connection)
|
|
1024
1024
|
return;
|
|
1025
1025
|
const t = this.connection.getReceivers().map(({ track: s }) => s);
|
|
1026
|
-
return
|
|
1026
|
+
return Ts(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1027
1027
|
}
|
|
1028
1028
|
get connection() {
|
|
1029
1029
|
var t;
|
|
1030
1030
|
return (t = this.session) == null ? void 0 : t.connection;
|
|
1031
1031
|
}
|
|
1032
1032
|
get remoteCallerData() {
|
|
1033
|
-
var e, t, s, n,
|
|
1033
|
+
var e, t, s, n, r, a;
|
|
1034
1034
|
return {
|
|
1035
1035
|
displayName: (t = (e = this.incomingSession) == null ? void 0 : e.remote_identity) == null ? void 0 : t.display_name,
|
|
1036
1036
|
host: (n = (s = this.incomingSession) == null ? void 0 : s.remote_identity) == null ? void 0 : n.uri.host,
|
|
1037
|
-
incomingNumber: (a = (
|
|
1037
|
+
incomingNumber: (a = (r = this.incomingSession) == null ? void 0 : r.remote_identity) == null ? void 0 : a.uri.user,
|
|
1038
1038
|
session: this.incomingSession
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
@@ -1069,10 +1069,10 @@ class Js {
|
|
|
1069
1069
|
return e.forEach((s, n) => {
|
|
1070
1070
|
if (s.kind === "audio")
|
|
1071
1071
|
return;
|
|
1072
|
-
const
|
|
1072
|
+
const r = s, a = e[n - 1];
|
|
1073
1073
|
let c;
|
|
1074
1074
|
a && a.kind === "audio" && (c = a);
|
|
1075
|
-
const E = this._generateStream(
|
|
1075
|
+
const E = this._generateStream(r, c);
|
|
1076
1076
|
t.push(E);
|
|
1077
1077
|
}), t;
|
|
1078
1078
|
}
|
|
@@ -1100,21 +1100,21 @@ class Js {
|
|
|
1100
1100
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1101
1101
|
if (!this.session)
|
|
1102
1102
|
throw new Error("No session established");
|
|
1103
|
-
const s = `${De}: ${e}`, n = `${Me}: ${t}`,
|
|
1103
|
+
const s = `${De}: ${e}`, n = `${Me}: ${t}`, r = [
|
|
1104
1104
|
s,
|
|
1105
1105
|
n
|
|
1106
1106
|
];
|
|
1107
|
-
return this.session.sendInfo(xt, void 0, { extraHeaders:
|
|
1107
|
+
return this.session.sendInfo(xt, void 0, { extraHeaders: r });
|
|
1108
1108
|
}
|
|
1109
1109
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
1110
1110
|
if (!this.session)
|
|
1111
1111
|
throw new Error("No session established");
|
|
1112
|
-
const n = `${Zt}: currentstate`,
|
|
1112
|
+
const n = `${Zt}: currentstate`, r = `${ts}: ${Number(e)}`, a = `${ss}: ${Number(t)}`, c = [
|
|
1113
1113
|
n,
|
|
1114
|
-
|
|
1114
|
+
r,
|
|
1115
1115
|
a
|
|
1116
1116
|
];
|
|
1117
|
-
return this.session.sendInfo(
|
|
1117
|
+
return this.session.sendInfo($t, void 0, {
|
|
1118
1118
|
noTerminateWhenError: !0,
|
|
1119
1119
|
...s,
|
|
1120
1120
|
extraHeaders: c
|
|
@@ -1124,7 +1124,7 @@ class Js {
|
|
|
1124
1124
|
if (!this.session)
|
|
1125
1125
|
throw new Error("No session established");
|
|
1126
1126
|
const c = [`${es}: ${e === "mic" ? 0 : 1}`];
|
|
1127
|
-
return this.session.sendInfo(
|
|
1127
|
+
return this.session.sendInfo(Gt, void 0, {
|
|
1128
1128
|
noTerminateWhenError: !0,
|
|
1129
1129
|
...t,
|
|
1130
1130
|
extraHeaders: c
|
|
@@ -1143,21 +1143,21 @@ class Js {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
export {
|
|
1145
1145
|
qt as B,
|
|
1146
|
-
|
|
1146
|
+
I as E,
|
|
1147
1147
|
Mt as N,
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1148
|
+
Ue as R,
|
|
1149
|
+
zs as S,
|
|
1150
|
+
at as U,
|
|
1151
|
+
xs as a,
|
|
1152
1152
|
Gs as b,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1153
|
+
Ys as c,
|
|
1154
|
+
Xs as d,
|
|
1155
|
+
$s as e,
|
|
1156
1156
|
k as f,
|
|
1157
1157
|
q as g,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1158
|
+
Js as h,
|
|
1159
|
+
ds as i,
|
|
1160
|
+
ct as j,
|
|
1161
|
+
pe as l,
|
|
1162
|
+
ms as s
|
|
1163
1163
|
};
|