sip-connector 6.24.0 → 6.24.2
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-1HoiCnsj.js → SipConnector-BmPmOGi6.js} +229 -218
- package/dist/SipConnector-DMjzYyq_.cjs +1 -0
- package/dist/SipConnector.d.ts +9 -8
- package/dist/__fixtures__/BaseSession.mock.d.ts +4 -4
- package/dist/__fixtures__/RTCRtpSenderMock.d.ts +1 -0
- package/dist/__fixtures__/UA.mock.d.ts +2 -2
- package/dist/__fixtures__/index.d.ts +7 -6
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +118 -112
- package/dist/index.cjs +1 -1
- package/dist/index.js +55 -53
- package/dist/tools/__fixtures__/call.d.ts +1 -1
- package/dist/tools/__fixtures__/connectToServer.d.ts +6 -5
- package/dist/tools/__fixtures__/hasValidUri.d.ts +2 -8
- package/dist/tools/__fixtures__/processRequest.d.ts +1 -1
- package/dist/tools/disconnectFromServer.d.ts +5 -1
- package/dist/tools/hasPurgatory.d.ts +1 -1
- package/package.json +12 -12
- package/dist/SipConnector-eRr2JbY9.cjs +0 -1
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) => (
|
|
4
|
-
import { CancelableRequest as
|
|
1
|
+
var gt = Object.defineProperty;
|
|
2
|
+
var Ct = (r, e, t) => e in r ? gt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => (Ct(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
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
|
|
7
|
+
const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code", mt = "Internal Error", ft = "Busy", Le = "Rejected", Ot = "Redirected", Dt = "Unavailable", Mt = "Not Found", Pt = "Address Incomplete", pt = "Incompatible SDP", vt = "Missing SDP", wt = "Authentication Error", He = "Terminated", yt = "WebRTC Error", ke = "Canceled", bt = "No Answer", Ut = "Expires", Lt = "No ACK", Ht = "Dialog Error", kt = "User Denied Media Access", qt = "Bad Media Description", Wt = "RTP Timeout", Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
8
|
__proto__: null,
|
|
9
|
-
ADDRESS_INCOMPLETE:
|
|
10
|
-
AUTHENTICATION_ERROR:
|
|
11
|
-
BAD_MEDIA_DESCRIPTION:
|
|
12
|
-
BUSY:
|
|
13
|
-
BYE:
|
|
14
|
-
CANCELED:
|
|
15
|
-
CONNECTION_ERROR:
|
|
16
|
-
DIALOG_ERROR:
|
|
17
|
-
EXPIRES:
|
|
18
|
-
INCOMPATIBLE_SDP:
|
|
19
|
-
INTERNAL_ERROR:
|
|
20
|
-
MISSING_SDP:
|
|
21
|
-
NOT_FOUND:
|
|
22
|
-
NO_ACK:
|
|
23
|
-
NO_ANSWER:
|
|
24
|
-
REDIRECTED:
|
|
25
|
-
REJECTED:
|
|
26
|
-
REQUEST_TIMEOUT:
|
|
27
|
-
RTP_TIMEOUT:
|
|
28
|
-
SIP_FAILURE_CODE:
|
|
29
|
-
UNAVAILABLE:
|
|
30
|
-
USER_DENIED_MEDIA_ACCESS:
|
|
31
|
-
WEBRTC_ERROR:
|
|
32
|
-
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall",
|
|
9
|
+
ADDRESS_INCOMPLETE: Pt,
|
|
10
|
+
AUTHENTICATION_ERROR: wt,
|
|
11
|
+
BAD_MEDIA_DESCRIPTION: qt,
|
|
12
|
+
BUSY: ft,
|
|
13
|
+
BYE: He,
|
|
14
|
+
CANCELED: ke,
|
|
15
|
+
CONNECTION_ERROR: Rt,
|
|
16
|
+
DIALOG_ERROR: Ht,
|
|
17
|
+
EXPIRES: Ut,
|
|
18
|
+
INCOMPATIBLE_SDP: pt,
|
|
19
|
+
INTERNAL_ERROR: mt,
|
|
20
|
+
MISSING_SDP: vt,
|
|
21
|
+
NOT_FOUND: Mt,
|
|
22
|
+
NO_ACK: Lt,
|
|
23
|
+
NO_ANSWER: bt,
|
|
24
|
+
REDIRECTED: Ot,
|
|
25
|
+
REJECTED: Le,
|
|
26
|
+
REQUEST_TIMEOUT: Ue,
|
|
27
|
+
RTP_TIMEOUT: Wt,
|
|
28
|
+
SIP_FAILURE_CODE: It,
|
|
29
|
+
UNAVAILABLE: Dt,
|
|
30
|
+
USER_DENIED_MEDIA_ACCESS: kt,
|
|
31
|
+
WEBRTC_ERROR: yt
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting", I = "connected", T = "disconnected", P = "newRTCSession", m = "registered", G = "unregistered", f = "registrationFailed", qe = "newMessage", $ = "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", re = "admin-stop-mic", oe = "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", O = "ended", We = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", y = "confirmed", b = "peerconnection", C = "failed", Ge = "muted", $e = "unmuted", Ne = "newDTMF", ge = "newInfo", Xe = "hold", Je = "unhold", ze = "update", Qe = "sdp", Ke = "icecandidate", je = "getusermediafailed", Ze = "peerconnection:createofferfailed", et = "peerconnection:createanswerfailed", tt = "peerconnection:setlocaldescriptionfailed", st = "peerconnection:setremotedescriptionfailed", nt = "presentation:start", it = "presentation:started", rt = "presentation:end", Ce = "presentation:ended", U = "presentation:failed", Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
33
|
__proto__: null,
|
|
34
|
-
ACCEPTED:
|
|
34
|
+
ACCEPTED: xe,
|
|
35
35
|
ACCOUNT_CHANGED: ue,
|
|
36
36
|
ACCOUNT_DELETED: Te,
|
|
37
|
-
ADMIN_FORCE_SYNC_MEDIA_STATE:
|
|
37
|
+
ADMIN_FORCE_SYNC_MEDIA_STATE: w,
|
|
38
38
|
ADMIN_START_MAIN_CAM: ie,
|
|
39
39
|
ADMIN_START_MIC: oe,
|
|
40
40
|
ADMIN_STOP_MAIN_CAM: ne,
|
|
41
41
|
ADMIN_STOP_MIC: re,
|
|
42
42
|
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: X,
|
|
43
|
-
CHANNELS:
|
|
43
|
+
CHANNELS: v,
|
|
44
44
|
CHANNELS_NOTIFY: ee,
|
|
45
45
|
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Se,
|
|
46
|
-
CONFIRMED:
|
|
46
|
+
CONFIRMED: y,
|
|
47
47
|
CONNECTED: I,
|
|
48
|
-
CONNECTING:
|
|
48
|
+
CONNECTING: L,
|
|
49
49
|
DECLINED_INCOMING_CALL: V,
|
|
50
50
|
DISCONNECTED: T,
|
|
51
51
|
ENDED: O,
|
|
@@ -53,54 +53,54 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
|
|
|
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: je,
|
|
57
|
+
HOLD: Xe,
|
|
58
|
+
ICE_CANDIDATE: Ke,
|
|
59
59
|
INCOMING_CALL: B,
|
|
60
60
|
MAIN_CAM_CONTROL: se,
|
|
61
61
|
MUST_STOP_PRESENTATION_EVENT: z,
|
|
62
|
-
MUTED:
|
|
62
|
+
MUTED: Ge,
|
|
63
63
|
NEW_DTMF: Ne,
|
|
64
64
|
NEW_INFO: ge,
|
|
65
|
-
NEW_MESSAGE:
|
|
66
|
-
NEW_RTC_SESSION:
|
|
65
|
+
NEW_MESSAGE: qe,
|
|
66
|
+
NEW_RTC_SESSION: P,
|
|
67
67
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
|
|
68
68
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ae,
|
|
69
69
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
|
|
70
70
|
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: ce,
|
|
71
71
|
PARTICIPATION_ACCEPTING_WORD_REQUEST: _e,
|
|
72
72
|
PARTICIPATION_CANCELLING_WORD_REQUEST: he,
|
|
73
|
-
PEER_CONNECTION:
|
|
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: et,
|
|
76
|
+
PEER_CONNECTION_CREATE_OFFER_FAILED: Ze,
|
|
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: tt,
|
|
79
|
+
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: st,
|
|
80
|
+
PRESENTATION_END: rt,
|
|
81
81
|
PRESENTATION_ENDED: Ce,
|
|
82
|
-
PRESENTATION_FAILED:
|
|
83
|
-
PRESENTATION_START:
|
|
84
|
-
PRESENTATION_STARTED:
|
|
85
|
-
PROGRESS:
|
|
86
|
-
REFER:
|
|
82
|
+
PRESENTATION_FAILED: U,
|
|
83
|
+
PRESENTATION_START: nt,
|
|
84
|
+
PRESENTATION_STARTED: it,
|
|
85
|
+
PROGRESS: Ye,
|
|
86
|
+
REFER: Ve,
|
|
87
87
|
REGISTERED: m,
|
|
88
88
|
REGISTRATION_FAILED: f,
|
|
89
|
-
REINVITE:
|
|
90
|
-
REPLACES:
|
|
91
|
-
SDP:
|
|
92
|
-
SENDING:
|
|
93
|
-
SHARE_STATE:
|
|
89
|
+
REINVITE: Fe,
|
|
90
|
+
REPLACES: Be,
|
|
91
|
+
SDP: Qe,
|
|
92
|
+
SENDING: We,
|
|
93
|
+
SHARE_STATE: p,
|
|
94
94
|
SIP_EVENT: $,
|
|
95
95
|
TERMINATED_INCOMING_CALL: x,
|
|
96
|
-
UNHOLD:
|
|
97
|
-
UNMUTED:
|
|
96
|
+
UNHOLD: Je,
|
|
97
|
+
UNMUTED: $e,
|
|
98
98
|
UNREGISTERED: G,
|
|
99
|
-
UPDATE:
|
|
99
|
+
UPDATE: ze,
|
|
100
100
|
USE_LICENSE: K,
|
|
101
101
|
WEBCAST_STARTED: de,
|
|
102
102
|
WEBCAST_STOPPED: le
|
|
103
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
103
|
+
}, Symbol.toStringTag, { value: "Module" })), ot = [
|
|
104
104
|
B,
|
|
105
105
|
V,
|
|
106
106
|
x,
|
|
@@ -117,49 +117,48 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
|
|
|
117
117
|
ae,
|
|
118
118
|
ce
|
|
119
119
|
], Ae = [
|
|
120
|
-
|
|
120
|
+
L,
|
|
121
121
|
I,
|
|
122
122
|
T,
|
|
123
|
-
|
|
123
|
+
P,
|
|
124
124
|
m,
|
|
125
125
|
G,
|
|
126
126
|
f,
|
|
127
|
-
|
|
127
|
+
qe,
|
|
128
128
|
$
|
|
129
|
-
],
|
|
129
|
+
], at = [
|
|
130
130
|
X,
|
|
131
131
|
J,
|
|
132
132
|
z,
|
|
133
|
-
|
|
133
|
+
p,
|
|
134
134
|
Q,
|
|
135
135
|
K,
|
|
136
136
|
j,
|
|
137
137
|
Z,
|
|
138
|
-
|
|
138
|
+
v,
|
|
139
139
|
te,
|
|
140
140
|
se,
|
|
141
141
|
ie,
|
|
142
142
|
ne,
|
|
143
143
|
re,
|
|
144
144
|
oe,
|
|
145
|
-
|
|
145
|
+
w
|
|
146
146
|
], Re = [
|
|
147
147
|
O,
|
|
148
|
-
|
|
149
|
-
qe,
|
|
148
|
+
L,
|
|
150
149
|
We,
|
|
151
150
|
Fe,
|
|
152
151
|
Be,
|
|
153
152
|
Ve,
|
|
154
153
|
Ye,
|
|
155
|
-
|
|
154
|
+
xe,
|
|
156
155
|
y,
|
|
156
|
+
b,
|
|
157
157
|
C,
|
|
158
|
-
xe,
|
|
159
158
|
Ge,
|
|
159
|
+
$e,
|
|
160
160
|
Ne,
|
|
161
161
|
ge,
|
|
162
|
-
$e,
|
|
163
162
|
Xe,
|
|
164
163
|
Je,
|
|
165
164
|
ze,
|
|
@@ -172,32 +171,33 @@ const At = "Connection Error", be = "Request Timeout", Rt = "SIP Failure Code",
|
|
|
172
171
|
st,
|
|
173
172
|
nt,
|
|
174
173
|
it,
|
|
174
|
+
rt,
|
|
175
175
|
Ce,
|
|
176
|
-
|
|
177
|
-
],
|
|
176
|
+
U
|
|
177
|
+
], ct = [...Ae, ...ot], Et = [
|
|
178
178
|
...Re,
|
|
179
|
-
...
|
|
179
|
+
...at
|
|
180
180
|
], xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
181
181
|
__proto__: null,
|
|
182
|
-
SESSION_EVENT_NAMES:
|
|
182
|
+
SESSION_EVENT_NAMES: Et,
|
|
183
183
|
SESSION_JSSIP_EVENT_NAMES: Re,
|
|
184
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
185
|
-
UA_EVENT_NAMES:
|
|
184
|
+
SESSION_SYNTHETICS_EVENT_NAMES: at,
|
|
185
|
+
UA_EVENT_NAMES: ct,
|
|
186
186
|
UA_JSSIP_EVENT_NAMES: Ae,
|
|
187
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
188
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
187
|
+
UA_SYNTHETICS_EVENT_NAMES: ot
|
|
188
|
+
}, Symbol.toStringTag, { value: "Module" })), Ft = (r) => {
|
|
189
189
|
const e = [];
|
|
190
190
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
191
|
-
},
|
|
191
|
+
}, Bt = "content-type", Vt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", Yt = "application/vinteo.webrtc.roomname", xt = "application/vinteo.webrtc.channels", Gt = "application/vinteo.webrtc.mediastate", $t = "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", D = "x-webrtc-share-state", rs = `${D}: LETMESTARTPRESENTATION`, os = `${D}: STOPPRESENTATION`, _t = "YOUCANRECEIVECONTENT", ht = "CONTENTEND", pe = "YOUMUSTSTOPSENDCONTENT", as = `${D}: ${_t}`, cs = `${D}: ${ht}`, Es = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", _s = `${Es}: LETMESTARTMAINCAM`, Ie = "sip-connector", ve = F(Ie), Gs = () => {
|
|
192
192
|
F.enable(Ie);
|
|
193
193
|
}, $s = () => {
|
|
194
194
|
F.enable(`-${Ie}`);
|
|
195
195
|
};
|
|
196
196
|
var R = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(R || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}), hs = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(hs || {});
|
|
197
|
-
function
|
|
197
|
+
function we(r) {
|
|
198
198
|
return (e) => `sip:${e}@${r}`;
|
|
199
199
|
}
|
|
200
|
-
const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r,
|
|
200
|
+
const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, ye = (r) => r.trim().replaceAll(" ", "_"), ls = ds(1e5, 99999999), H = (r, {
|
|
201
201
|
videoMode: e,
|
|
202
202
|
audioMode: t
|
|
203
203
|
} = {}) => {
|
|
@@ -208,16 +208,16 @@ const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (r) =>
|
|
|
208
208
|
}, us = (r) => r.some((t) => {
|
|
209
209
|
const { kind: s } = t;
|
|
210
210
|
return s === "video";
|
|
211
|
-
}), Ts = "Error decline with 603", Ss = (r) => r.message === Ts, Ns = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)),
|
|
212
|
-
|
|
211
|
+
}), Ts = "Error decline with 603", Ss = (r) => r.message === Ts, Ns = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), dt = 1, lt = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, gs = lt(
|
|
212
|
+
dt
|
|
213
213
|
), Cs = (r, e) => {
|
|
214
|
-
const t = r === void 0 ? void 0 : Math.max(r,
|
|
214
|
+
const t = r === void 0 ? void 0 : Math.max(r, dt);
|
|
215
215
|
if (t !== void 0 && gs(
|
|
216
216
|
t,
|
|
217
217
|
e
|
|
218
218
|
))
|
|
219
219
|
return t;
|
|
220
|
-
}, As =
|
|
220
|
+
}, As = lt(), Rs = (r, e) => {
|
|
221
221
|
if (As(r, e))
|
|
222
222
|
return r;
|
|
223
223
|
}, Is = async (r, e, t) => {
|
|
@@ -229,16 +229,16 @@ const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, we = (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
|
|
232
|
+
const E = n.maxBitrate, _ = Rs(e.maxBitrate, E);
|
|
233
|
+
return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), r.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
|
|
234
234
|
}, ms = async (r, e, t) => {
|
|
235
235
|
const s = Ns(r, e);
|
|
236
236
|
if (s)
|
|
237
237
|
return Is(s, { maxBitrate: t });
|
|
238
|
-
}, fs = 486, Os = 487, W = "local",
|
|
238
|
+
}, fs = 486, Os = 487, W = "local", be = "remote", Xs = (r = new Error()) => {
|
|
239
239
|
const { originator: e, cause: t } = r;
|
|
240
|
-
return
|
|
241
|
-
},
|
|
240
|
+
return At(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === W && (t === ke || t === He) : !1;
|
|
241
|
+
}, g = "SipConnector", Ds = "channels", Ms = "WebcastStarted", Ps = "WebcastStopped", ps = "accountChanged", vs = "accountDeleted", ws = "addedToListModerators", ys = "removedFromListModerators", bs = "ParticipationRequestAccepted", Us = "ParticipationRequestRejected", Ls = "ParticipantMovedToWebcast", Hs = "ConferenceParticipantTokenIssued";
|
|
242
242
|
class Js {
|
|
243
243
|
constructor({ JsSIP: e }) {
|
|
244
244
|
i(this, "_isRegisterConfig", !1);
|
|
@@ -273,11 +273,11 @@ class Js {
|
|
|
273
273
|
i(this, "tryRegister", async () => {
|
|
274
274
|
if (!this.isRegisterConfig)
|
|
275
275
|
throw new Error("Config is not registered");
|
|
276
|
-
this._uaEvents.trigger(
|
|
276
|
+
this._uaEvents.trigger(L, void 0);
|
|
277
277
|
try {
|
|
278
278
|
await this.unregister();
|
|
279
279
|
} catch (e) {
|
|
280
|
-
|
|
280
|
+
ve("tryRegister", e);
|
|
281
281
|
}
|
|
282
282
|
return this.register();
|
|
283
283
|
});
|
|
@@ -294,7 +294,7 @@ class Js {
|
|
|
294
294
|
delete this.incomingSession;
|
|
295
295
|
});
|
|
296
296
|
i(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
|
|
297
|
-
if (e ===
|
|
297
|
+
if (e === be) {
|
|
298
298
|
this.incomingSession = t;
|
|
299
299
|
const s = this.remoteCallerData;
|
|
300
300
|
t.on(C, (n) => {
|
|
@@ -312,48 +312,48 @@ class Js {
|
|
|
312
312
|
sdpSemantics: a,
|
|
313
313
|
sessionTimers: c,
|
|
314
314
|
registerExpires: E,
|
|
315
|
-
connectionRecoveryMinInterval:
|
|
316
|
-
connectionRecoveryMaxInterval:
|
|
315
|
+
connectionRecoveryMinInterval: _,
|
|
316
|
+
connectionRecoveryMaxInterval: h,
|
|
317
317
|
userAgent: u,
|
|
318
|
-
displayName:
|
|
319
|
-
register:
|
|
320
|
-
extraHeaders:
|
|
318
|
+
displayName: d = "",
|
|
319
|
+
register: l = !1,
|
|
320
|
+
extraHeaders: S = []
|
|
321
321
|
}) => {
|
|
322
322
|
if (!s)
|
|
323
323
|
throw new Error("sipServerUrl is required");
|
|
324
324
|
if (!n)
|
|
325
325
|
throw new Error("sipWebSocketServerURL is required");
|
|
326
|
-
if (
|
|
326
|
+
if (l && !e)
|
|
327
327
|
throw new Error("user is required for authorized connection");
|
|
328
|
-
if (
|
|
328
|
+
if (l && !t)
|
|
329
329
|
throw new Error("password is required for authorized connection");
|
|
330
330
|
this._connectionConfiguration = {
|
|
331
331
|
sipServerUrl: s,
|
|
332
|
-
displayName:
|
|
333
|
-
register:
|
|
332
|
+
displayName: d,
|
|
333
|
+
register: l,
|
|
334
334
|
user: e,
|
|
335
335
|
password: t
|
|
336
|
-
}, this.getSipServerUrl =
|
|
336
|
+
}, this.getSipServerUrl = we(s), this.socket = new this.JsSIP.WebSocketInterface(n), this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l;
|
|
337
337
|
const { socket: A } = this;
|
|
338
338
|
this.ua = this._createUa({
|
|
339
339
|
user: e,
|
|
340
340
|
password: t,
|
|
341
341
|
socket: A,
|
|
342
|
-
displayName:
|
|
343
|
-
register:
|
|
342
|
+
displayName: d,
|
|
343
|
+
register: l,
|
|
344
344
|
sdpSemantics: a,
|
|
345
345
|
sessionTimers: c,
|
|
346
346
|
registerExpires: E,
|
|
347
|
-
connectionRecoveryMinInterval:
|
|
348
|
-
connectionRecoveryMaxInterval:
|
|
347
|
+
connectionRecoveryMinInterval: _,
|
|
348
|
+
connectionRecoveryMaxInterval: h,
|
|
349
349
|
userAgent: u,
|
|
350
350
|
getSipServerUrl: this.getSipServerUrl
|
|
351
|
-
}), this._uaEvents.eachTriggers((
|
|
352
|
-
const me = Ae.find((
|
|
353
|
-
me && this.ua && this.ua.on(me,
|
|
351
|
+
}), this._uaEvents.eachTriggers((Tt, St) => {
|
|
352
|
+
const me = Ae.find((Nt) => Nt === St);
|
|
353
|
+
me && this.ua && this.ua.on(me, Tt);
|
|
354
354
|
});
|
|
355
|
-
const
|
|
356
|
-
return this.ua.registrator().setExtraHeaders(
|
|
355
|
+
const ut = [...Ft(o), ...S];
|
|
356
|
+
return this.ua.registrator().setExtraHeaders(ut), this.ua;
|
|
357
357
|
});
|
|
358
358
|
i(this, "_createUa", ({
|
|
359
359
|
user: e,
|
|
@@ -364,25 +364,25 @@ class Js {
|
|
|
364
364
|
register: a = !1,
|
|
365
365
|
sdpSemantics: c = "plan-b",
|
|
366
366
|
sessionTimers: E = !1,
|
|
367
|
-
registerExpires:
|
|
367
|
+
registerExpires: _ = 60 * 5,
|
|
368
368
|
// 5 minutes in sec
|
|
369
|
-
connectionRecoveryMinInterval:
|
|
369
|
+
connectionRecoveryMinInterval: h = 2,
|
|
370
370
|
connectionRecoveryMaxInterval: u = 6,
|
|
371
|
-
userAgent:
|
|
371
|
+
userAgent: d
|
|
372
372
|
}) => {
|
|
373
373
|
if (a && !t)
|
|
374
374
|
throw new Error("password is required for authorized connection");
|
|
375
|
-
const
|
|
375
|
+
const l = a && e ? e.trim() : `${ls()}`, S = o(l), A = {
|
|
376
376
|
password: t,
|
|
377
377
|
register: a,
|
|
378
|
-
uri:
|
|
379
|
-
display_name:
|
|
380
|
-
user_agent:
|
|
378
|
+
uri: S,
|
|
379
|
+
display_name: ye(n),
|
|
380
|
+
user_agent: d,
|
|
381
381
|
sdp_semantics: c,
|
|
382
382
|
sockets: [s],
|
|
383
383
|
session_timers: E,
|
|
384
|
-
register_expires:
|
|
385
|
-
connection_recovery_min_interval:
|
|
384
|
+
register_expires: _,
|
|
385
|
+
connection_recovery_min_interval: h,
|
|
386
386
|
connection_recovery_max_interval: u
|
|
387
387
|
};
|
|
388
388
|
return new this.JsSIP.UA(A);
|
|
@@ -402,7 +402,7 @@ class Js {
|
|
|
402
402
|
}, c = () => {
|
|
403
403
|
this.off(m, n), this.off(f, o), this.off(I, n), this.off(T, o);
|
|
404
404
|
};
|
|
405
|
-
a(), this.on(
|
|
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
408
|
const { ua: o } = this;
|
|
@@ -411,15 +411,17 @@ class Js {
|
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
let a = !1, c = !1;
|
|
414
|
-
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name",
|
|
414
|
+
e !== void 0 && e !== this._connectionConfiguration.displayName && (a = o.set("display_name", ye(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = o.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);
|
|
418
|
-
}).catch(
|
|
418
|
+
}).catch((_) => {
|
|
419
|
+
n(_);
|
|
420
|
+
}) : E ? s(E) : n(new Error("nothing changed"));
|
|
419
421
|
}));
|
|
420
422
|
i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
421
423
|
i(this, "_disconnect", async () => {
|
|
422
|
-
this.off(
|
|
424
|
+
this.off(P, this.handleNewRTCSession);
|
|
423
425
|
const e = new Promise((t) => {
|
|
424
426
|
this.once(T, () => {
|
|
425
427
|
delete this.ua, t();
|
|
@@ -436,15 +438,17 @@ class Js {
|
|
|
436
438
|
videoMode: a,
|
|
437
439
|
audioMode: c,
|
|
438
440
|
degradationPreference: E,
|
|
439
|
-
offerToReceiveAudio:
|
|
440
|
-
offerToReceiveVideo:
|
|
441
|
-
}) => new Promise((u,
|
|
442
|
-
const { ua:
|
|
443
|
-
if (!
|
|
444
|
-
|
|
441
|
+
offerToReceiveAudio: _ = !0,
|
|
442
|
+
offerToReceiveVideo: h = !0
|
|
443
|
+
}) => new Promise((u, d) => {
|
|
444
|
+
const { ua: l } = this;
|
|
445
|
+
if (!l) {
|
|
446
|
+
d(new Error("this.ua is not initialized"));
|
|
445
447
|
return;
|
|
446
448
|
}
|
|
447
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(u).catch(
|
|
449
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(u).catch((S) => {
|
|
450
|
+
d(S);
|
|
451
|
+
}), this.session = l.call(this.getSipServerUrl(e), {
|
|
448
452
|
extraHeaders: s,
|
|
449
453
|
mediaStream: H(t, {
|
|
450
454
|
videoMode: a,
|
|
@@ -458,8 +462,8 @@ class Js {
|
|
|
458
462
|
iceServers: o
|
|
459
463
|
},
|
|
460
464
|
rtcOfferConstraints: {
|
|
461
|
-
offerToReceiveAudio:
|
|
462
|
-
offerToReceiveVideo:
|
|
465
|
+
offerToReceiveAudio: _,
|
|
466
|
+
offerToReceiveVideo: h
|
|
463
467
|
}
|
|
464
468
|
});
|
|
465
469
|
}));
|
|
@@ -471,26 +475,28 @@ class Js {
|
|
|
471
475
|
videoMode: o,
|
|
472
476
|
audioMode: a,
|
|
473
477
|
degradationPreference: c
|
|
474
|
-
}) => new Promise((E,
|
|
478
|
+
}) => new Promise((E, _) => {
|
|
475
479
|
if (!this.isAvailableIncomingCall) {
|
|
476
|
-
|
|
480
|
+
_(new Error("no incomingSession"));
|
|
477
481
|
return;
|
|
478
482
|
}
|
|
479
483
|
this.session = this.incomingSession, this.removeIncomingSession();
|
|
480
|
-
const { session:
|
|
481
|
-
if (!
|
|
482
|
-
|
|
484
|
+
const { session: h } = this;
|
|
485
|
+
if (!h) {
|
|
486
|
+
_(new Error("No session established"));
|
|
483
487
|
return;
|
|
484
488
|
}
|
|
485
|
-
this._sessionEvents.eachTriggers((
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number =
|
|
489
|
+
this._sessionEvents.eachTriggers((d, l) => {
|
|
490
|
+
const S = Re.find((A) => A === l);
|
|
491
|
+
S && h.on(S, d);
|
|
492
|
+
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((d) => {
|
|
493
|
+
_(d);
|
|
494
|
+
});
|
|
489
495
|
const u = H(e, {
|
|
490
496
|
videoMode: o,
|
|
491
497
|
audioMode: a
|
|
492
498
|
});
|
|
493
|
-
|
|
499
|
+
h.answer({
|
|
494
500
|
extraHeaders: s,
|
|
495
501
|
videoMode: o,
|
|
496
502
|
audioMode: a,
|
|
@@ -503,23 +509,23 @@ class Js {
|
|
|
503
509
|
}));
|
|
504
510
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
|
|
505
511
|
const n = () => {
|
|
506
|
-
this.onSession(
|
|
512
|
+
this.onSession(b, h), this.onSession(y, u);
|
|
507
513
|
}, o = () => {
|
|
508
|
-
this.offSession(
|
|
514
|
+
this.offSession(b, h), this.offSession(y, u);
|
|
509
515
|
}, a = () => {
|
|
510
516
|
this.onSession(C, E), this.onSession(O, E);
|
|
511
517
|
}, c = () => {
|
|
512
518
|
this.offSession(C, E), this.offSession(O, E);
|
|
513
|
-
}, E = (
|
|
514
|
-
o(), c(), s(
|
|
519
|
+
}, E = (d) => {
|
|
520
|
+
o(), c(), s(d);
|
|
515
521
|
};
|
|
516
|
-
let
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
this._sessionEvents.trigger(Z,
|
|
522
|
+
let _;
|
|
523
|
+
const h = ({ peerconnection: d }) => {
|
|
524
|
+
_ = d, _.ontrack = (l) => {
|
|
525
|
+
this._sessionEvents.trigger(Z, _), e && e(l);
|
|
520
526
|
};
|
|
521
527
|
}, u = () => {
|
|
522
|
-
|
|
528
|
+
_ && this._sessionEvents.trigger(j, _), o(), c(), t(_);
|
|
523
529
|
};
|
|
524
530
|
n(), a();
|
|
525
531
|
}));
|
|
@@ -547,15 +553,15 @@ class Js {
|
|
|
547
553
|
});
|
|
548
554
|
i(this, "_handleShareState", (e) => {
|
|
549
555
|
switch (e) {
|
|
550
|
-
case
|
|
556
|
+
case _t: {
|
|
551
557
|
this._sessionEvents.trigger(X, void 0);
|
|
552
558
|
break;
|
|
553
559
|
}
|
|
554
|
-
case
|
|
560
|
+
case ht: {
|
|
555
561
|
this._sessionEvents.trigger(J, void 0);
|
|
556
562
|
break;
|
|
557
563
|
}
|
|
558
|
-
case
|
|
564
|
+
case pe: {
|
|
559
565
|
this._sessionEvents.trigger(z, void 0);
|
|
560
566
|
break;
|
|
561
567
|
}
|
|
@@ -568,7 +574,7 @@ class Js {
|
|
|
568
574
|
inputChannels: t,
|
|
569
575
|
outputChannels: s
|
|
570
576
|
};
|
|
571
|
-
this._sessionEvents.trigger(
|
|
577
|
+
this._sessionEvents.trigger(v, n);
|
|
572
578
|
}
|
|
573
579
|
});
|
|
574
580
|
i(this, "_handleNotify", (e) => {
|
|
@@ -627,7 +633,7 @@ class Js {
|
|
|
627
633
|
break;
|
|
628
634
|
}
|
|
629
635
|
default:
|
|
630
|
-
|
|
636
|
+
ve("unknown cmd", e.cmd);
|
|
631
637
|
}
|
|
632
638
|
});
|
|
633
639
|
i(this, "_triggerRemovedFromListModeratorsNotify", ({
|
|
@@ -712,23 +718,23 @@ class Js {
|
|
|
712
718
|
this._uaEvents.trigger(Ee, t);
|
|
713
719
|
});
|
|
714
720
|
i(this, "_triggerEnterRoom", (e) => {
|
|
715
|
-
const t = e.getHeader(
|
|
721
|
+
const t = e.getHeader(Vt);
|
|
716
722
|
this._sessionEvents.trigger(Q, t);
|
|
717
723
|
});
|
|
718
724
|
i(this, "_triggerShareState", (e) => {
|
|
719
725
|
const t = e.getHeader(D);
|
|
720
|
-
this._sessionEvents.trigger(
|
|
726
|
+
this._sessionEvents.trigger(p, t);
|
|
721
727
|
});
|
|
722
728
|
i(this, "_triggerMainCamControl", (e) => {
|
|
723
|
-
const t = e.getHeader(
|
|
729
|
+
const t = e.getHeader(Qt), s = e.getHeader(Pe), n = s === q.ADMIN_SYNC_FORCED;
|
|
724
730
|
if (t === R.ADMIN_START_MAIN_CAM)
|
|
725
731
|
this._sessionEvents.trigger(ie, { isSyncForced: n });
|
|
726
732
|
else if (t === R.ADMIN_STOP_MAIN_CAM)
|
|
727
733
|
this._sessionEvents.trigger(ne, { isSyncForced: n });
|
|
728
734
|
else if ((t === R.RESUME_MAIN_CAM || t === R.PAUSE_MAIN_CAM) && s)
|
|
729
|
-
this._sessionEvents.trigger(
|
|
735
|
+
this._sessionEvents.trigger(w, { isSyncForced: n });
|
|
730
736
|
else {
|
|
731
|
-
const o = e.getHeader(
|
|
737
|
+
const o = e.getHeader(jt);
|
|
732
738
|
this._sessionEvents.trigger(se, {
|
|
733
739
|
mainCam: t,
|
|
734
740
|
resolutionMainCam: o
|
|
@@ -736,29 +742,29 @@ class Js {
|
|
|
736
742
|
}
|
|
737
743
|
});
|
|
738
744
|
i(this, "_triggerMicControl", (e) => {
|
|
739
|
-
const t = e.getHeader(
|
|
745
|
+
const t = e.getHeader(Kt), n = e.getHeader(Pe) === q.ADMIN_SYNC_FORCED;
|
|
740
746
|
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(oe, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(re, { isSyncForced: n });
|
|
741
747
|
});
|
|
742
748
|
i(this, "_triggerUseLicense", (e) => {
|
|
743
|
-
const t = e.getHeader(
|
|
749
|
+
const t = e.getHeader(zt);
|
|
744
750
|
this._sessionEvents.trigger(K, t);
|
|
745
751
|
});
|
|
746
752
|
i(this, "_handleNewInfo", (e) => {
|
|
747
753
|
const { originator: t } = e;
|
|
748
754
|
if (t !== "remote")
|
|
749
755
|
return;
|
|
750
|
-
const { request: s } = e, n = s.getHeader(
|
|
756
|
+
const { request: s } = e, n = s.getHeader(Bt);
|
|
751
757
|
if (n)
|
|
752
758
|
switch (n) {
|
|
753
|
-
case
|
|
759
|
+
case Yt: {
|
|
754
760
|
this._triggerEnterRoom(s), this._maybeTriggerChannels(s);
|
|
755
761
|
break;
|
|
756
762
|
}
|
|
757
|
-
case
|
|
763
|
+
case ns: {
|
|
758
764
|
this._maybeHandleNotify(s);
|
|
759
765
|
break;
|
|
760
766
|
}
|
|
761
|
-
case
|
|
767
|
+
case M: {
|
|
762
768
|
this._triggerShareState(s);
|
|
763
769
|
break;
|
|
764
770
|
}
|
|
@@ -766,11 +772,11 @@ class Js {
|
|
|
766
772
|
this._triggerMainCamControl(s);
|
|
767
773
|
break;
|
|
768
774
|
}
|
|
769
|
-
case
|
|
775
|
+
case Xt: {
|
|
770
776
|
this._triggerMicControl(s);
|
|
771
777
|
break;
|
|
772
778
|
}
|
|
773
|
-
case
|
|
779
|
+
case Jt: {
|
|
774
780
|
this._triggerUseLicense(s);
|
|
775
781
|
break;
|
|
776
782
|
}
|
|
@@ -780,7 +786,7 @@ class Js {
|
|
|
780
786
|
this._maybeHandleNotify(e);
|
|
781
787
|
});
|
|
782
788
|
i(this, "_maybeHandleNotify", (e) => {
|
|
783
|
-
const t = e.getHeader(
|
|
789
|
+
const t = e.getHeader(is);
|
|
784
790
|
if (t) {
|
|
785
791
|
const s = JSON.parse(t);
|
|
786
792
|
this._handleNotify(s);
|
|
@@ -788,28 +794,28 @@ class Js {
|
|
|
788
794
|
});
|
|
789
795
|
i(this, "_handleEnded", (e) => {
|
|
790
796
|
const { originator: t } = e;
|
|
791
|
-
t ===
|
|
797
|
+
t === be && this._sessionEvents.trigger(te, e), this._restoreSession();
|
|
792
798
|
});
|
|
793
|
-
this.JsSIP = e, this._sessionEvents = new fe(
|
|
799
|
+
this.JsSIP = e, this._sessionEvents = new fe(Et), this._uaEvents = new fe(ct), this._cancelableConnect = new N(
|
|
794
800
|
this._connect,
|
|
795
801
|
{
|
|
796
|
-
moduleName:
|
|
802
|
+
moduleName: g,
|
|
797
803
|
afterCancelRequest: () => {
|
|
798
804
|
this._cancelableInitUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
|
|
799
805
|
}
|
|
800
806
|
}
|
|
801
|
-
), this._cancelableInitUa = new
|
|
807
|
+
), this._cancelableInitUa = new N(
|
|
802
808
|
this._initUa,
|
|
803
|
-
{ moduleName:
|
|
804
|
-
), this._cancelableDisconnect = new
|
|
809
|
+
{ moduleName: g }
|
|
810
|
+
), this._cancelableDisconnect = new N(
|
|
805
811
|
this._disconnect,
|
|
806
|
-
{ moduleName:
|
|
807
|
-
), this._cancelableSet = new
|
|
808
|
-
moduleName:
|
|
809
|
-
}), this._cancelableCall = new
|
|
812
|
+
{ moduleName: g }
|
|
813
|
+
), this._cancelableSet = new N(this._set, {
|
|
814
|
+
moduleName: g
|
|
815
|
+
}), this._cancelableCall = new N(
|
|
810
816
|
this._call,
|
|
811
|
-
{ moduleName:
|
|
812
|
-
), this._cancelableAnswer = new
|
|
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($, this._handleSipEvent), this.onSession(C, this._handleEnded), this.onSession(O, this._handleEnded);
|
|
813
819
|
}
|
|
814
820
|
async register() {
|
|
815
821
|
return new Promise((e, t) => {
|
|
@@ -855,21 +861,21 @@ class Js {
|
|
|
855
861
|
sdpSemantics: o
|
|
856
862
|
}) {
|
|
857
863
|
return new Promise((a, c) => {
|
|
858
|
-
const E =
|
|
859
|
-
socket:
|
|
864
|
+
const E = we(s), _ = new this.JsSIP.WebSocketInterface(n), h = this._createUa({
|
|
865
|
+
socket: _,
|
|
860
866
|
displayName: t,
|
|
861
867
|
sdpSemantics: o,
|
|
862
868
|
userAgent: e,
|
|
863
869
|
getSipServerUrl: E
|
|
864
870
|
}), u = () => {
|
|
865
|
-
const
|
|
866
|
-
c(
|
|
871
|
+
const l = new Error("Telephony is not available");
|
|
872
|
+
c(l);
|
|
867
873
|
};
|
|
868
|
-
|
|
869
|
-
const
|
|
870
|
-
|
|
874
|
+
h.once(T, u);
|
|
875
|
+
const d = () => {
|
|
876
|
+
h.removeAllListeners(), h.once(T, a), h.stop();
|
|
871
877
|
};
|
|
872
|
-
|
|
878
|
+
h.once(I, d), h.start();
|
|
873
879
|
});
|
|
874
880
|
}
|
|
875
881
|
async replaceMediaStream(e, t) {
|
|
@@ -901,22 +907,22 @@ class Js {
|
|
|
901
907
|
}) {
|
|
902
908
|
const c = H(t);
|
|
903
909
|
this._streamPresentationCurrent = c;
|
|
904
|
-
const E = a ? [as] : [
|
|
910
|
+
const E = a ? [as] : [rs], _ = e.sendInfo(M, void 0, {
|
|
905
911
|
extraHeaders: E
|
|
906
912
|
}).then(async () => e.startPresentation(
|
|
907
913
|
c,
|
|
908
914
|
o,
|
|
909
915
|
n
|
|
910
916
|
)).then(async () => {
|
|
911
|
-
const { connection:
|
|
912
|
-
if (!
|
|
917
|
+
const { connection: h } = this;
|
|
918
|
+
if (!h || s === void 0)
|
|
913
919
|
return;
|
|
914
|
-
const u =
|
|
920
|
+
const u = h.getSenders();
|
|
915
921
|
await ms(u, t, s);
|
|
916
|
-
}).then(() => t).catch((
|
|
917
|
-
throw this._sessionEvents.trigger(
|
|
922
|
+
}).then(() => t).catch((h) => {
|
|
923
|
+
throw this._sessionEvents.trigger(U, h), h;
|
|
918
924
|
});
|
|
919
|
-
return this.promisePendingStartPresentation =
|
|
925
|
+
return this.promisePendingStartPresentation = _, _.finally(() => {
|
|
920
926
|
this.promisePendingStartPresentation = void 0;
|
|
921
927
|
});
|
|
922
928
|
}
|
|
@@ -931,23 +937,28 @@ class Js {
|
|
|
931
937
|
throw new Error("No session established");
|
|
932
938
|
if (this._streamPresentationCurrent)
|
|
933
939
|
throw new Error("Presentation is already started");
|
|
934
|
-
return this._sendPresentation(a, e, {
|
|
940
|
+
return s && await this.sendMustStopPresentation(a), this._sendPresentation(a, e, {
|
|
935
941
|
isNeedReinvite: t,
|
|
936
942
|
isP2P: s,
|
|
937
943
|
maxBitrate: n,
|
|
938
944
|
degradationPreference: o
|
|
939
945
|
});
|
|
940
946
|
}
|
|
947
|
+
async sendMustStopPresentation(e) {
|
|
948
|
+
await e.sendInfo(M, void 0, {
|
|
949
|
+
extraHeaders: [pe]
|
|
950
|
+
});
|
|
951
|
+
}
|
|
941
952
|
async stopPresentation({
|
|
942
953
|
isP2P: e = !1
|
|
943
954
|
} = {}) {
|
|
944
955
|
const t = this._streamPresentationCurrent;
|
|
945
956
|
let s = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
946
|
-
const n = e ? [cs] : [
|
|
947
|
-
return o && t && (s = s.then(async () => o.sendInfo(
|
|
957
|
+
const n = e ? [cs] : [os], o = this.establishedSession;
|
|
958
|
+
return o && t && (s = s.then(async () => o.sendInfo(M, void 0, {
|
|
948
959
|
extraHeaders: n
|
|
949
960
|
})).then(async () => o.stopPresentation(t)).catch((a) => {
|
|
950
|
-
throw this._sessionEvents.trigger(
|
|
961
|
+
throw this._sessionEvents.trigger(U, a), a;
|
|
951
962
|
})), !o && t && this._sessionEvents.trigger(Ce, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
952
963
|
this._resetPresentation();
|
|
953
964
|
});
|
|
@@ -1081,10 +1092,10 @@ class Js {
|
|
|
1081
1092
|
this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
|
|
1082
1093
|
}
|
|
1083
1094
|
async waitChannels() {
|
|
1084
|
-
return this.waitSession(
|
|
1095
|
+
return this.waitSession(v);
|
|
1085
1096
|
}
|
|
1086
1097
|
async waitSyncMediaState() {
|
|
1087
|
-
return this.waitSession(
|
|
1098
|
+
return this.waitSession(w);
|
|
1088
1099
|
}
|
|
1089
1100
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1090
1101
|
if (!this.session)
|
|
@@ -1093,17 +1104,17 @@ class Js {
|
|
|
1093
1104
|
s,
|
|
1094
1105
|
n
|
|
1095
1106
|
];
|
|
1096
|
-
return this.session.sendInfo(
|
|
1107
|
+
return this.session.sendInfo(xt, void 0, { extraHeaders: o });
|
|
1097
1108
|
}
|
|
1098
1109
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
1099
1110
|
if (!this.session)
|
|
1100
1111
|
throw new Error("No session established");
|
|
1101
|
-
const n = `${
|
|
1112
|
+
const n = `${Zt}: currentstate`, o = `${ts}: ${Number(e)}`, a = `${ss}: ${Number(t)}`, c = [
|
|
1102
1113
|
n,
|
|
1103
1114
|
o,
|
|
1104
1115
|
a
|
|
1105
1116
|
];
|
|
1106
|
-
return this.session.sendInfo(
|
|
1117
|
+
return this.session.sendInfo(Gt, void 0, {
|
|
1107
1118
|
noTerminateWhenError: !0,
|
|
1108
1119
|
...s,
|
|
1109
1120
|
extraHeaders: c
|
|
@@ -1112,8 +1123,8 @@ class Js {
|
|
|
1112
1123
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1113
1124
|
if (!this.session)
|
|
1114
1125
|
throw new Error("No session established");
|
|
1115
|
-
const c = [`${
|
|
1116
|
-
return this.session.sendInfo(
|
|
1126
|
+
const c = [`${es}: ${e === "mic" ? 0 : 1}`];
|
|
1127
|
+
return this.session.sendInfo($t, void 0, {
|
|
1117
1128
|
noTerminateWhenError: !0,
|
|
1118
1129
|
...t,
|
|
1119
1130
|
extraHeaders: c
|
|
@@ -1131,12 +1142,12 @@ class Js {
|
|
|
1131
1142
|
}
|
|
1132
1143
|
}
|
|
1133
1144
|
export {
|
|
1134
|
-
|
|
1145
|
+
qt as B,
|
|
1135
1146
|
R as E,
|
|
1136
|
-
|
|
1137
|
-
|
|
1147
|
+
Mt as N,
|
|
1148
|
+
Le as R,
|
|
1138
1149
|
Js as S,
|
|
1139
|
-
|
|
1150
|
+
ct as U,
|
|
1140
1151
|
Ys as a,
|
|
1141
1152
|
Gs as b,
|
|
1142
1153
|
Vs as c,
|
|
@@ -1146,7 +1157,7 @@ export {
|
|
|
1146
1157
|
q as g,
|
|
1147
1158
|
Xs as h,
|
|
1148
1159
|
hs as i,
|
|
1149
|
-
|
|
1150
|
-
|
|
1160
|
+
Et as j,
|
|
1161
|
+
ve as l,
|
|
1151
1162
|
Is as s
|
|
1152
1163
|
};
|