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