sip-connector 6.24.2 → 6.25.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-BrUmibLH.cjs +1 -0
- package/dist/{SipConnector-BmPmOGi6.js → SipConnector-Dq76GLMy.js} +216 -205
- package/dist/SipConnector.d.ts +6 -4
- package/dist/__fixtures__/BaseSession.mock.d.ts +4 -4
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +3 -2
- package/dist/__fixtures__/Registrator.mock.d.ts +2 -1
- package/dist/__fixtures__/Request.mock.d.ts +1 -0
- package/dist/__fixtures__/Session.mock.d.ts +3 -3
- package/dist/__fixtures__/UA.mock.d.ts +6 -7
- package/dist/__fixtures__/index.d.ts +5 -4
- package/dist/__fixtures__/jssip.mock.d.ts +5 -4
- package/dist/__fixtures__/participantMoveRequests.d.ts +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.d.ts +2 -1
- package/dist/doMock.js +1 -1
- package/dist/eventNames.d.ts +2 -2
- package/dist/headers.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +156 -155
- package/dist/logger.d.ts +2 -1
- package/dist/tools/__fixtures__/call.d.ts +3 -3
- package/dist/tools/__fixtures__/connectToServer.d.ts +3 -2
- package/dist/tools/__fixtures__/hasValidUri.d.ts +2 -1
- package/dist/tools/__fixtures__/processRequest.d.ts +2 -1
- package/dist/tools/answerIncomingCall.d.ts +13 -12
- package/dist/tools/callToServer.d.ts +13 -12
- package/dist/tools/connectToServer.d.ts +3 -2
- package/dist/tools/disconnectFromServer.d.ts +2 -1
- package/dist/tools/error/getLinkError.d.ts +2 -1
- package/dist/tools/error/getTypeFromError.d.ts +2 -1
- package/dist/tools/error/getValuesFromError.d.ts +2 -1
- package/dist/tools/getExtraHeaders.d.ts +4 -4
- package/dist/tools/getUserAgent.d.ts +2 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/resolveAskPermissionToEnableCam.d.ts +2 -1
- package/dist/tools/resolveGetRemoteStreams.d.ts +2 -1
- package/dist/tools/resolveOnMoveToSpectators.d.ts +4 -0
- package/dist/tools/resolveOnMustStopPresentation.d.ts +2 -1
- package/dist/tools/resolveOnUseLicense.d.ts +3 -2
- package/dist/tools/resolveSendMediaState.d.ts +2 -1
- package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +2 -1
- package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +2 -1
- package/dist/tools/resolveStartPresentation.d.ts +3 -2
- package/dist/tools/resolveStopShareSipConnector.d.ts +3 -2
- package/dist/tools/resolveUpdatePresentation.d.ts +3 -2
- package/dist/tools/sendDTMFAccumulated.d.ts +1 -1
- package/dist/tools/syncMediaState/index.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/utils.d.ts +2 -2
- package/dist/videoSendingBalancer/balance.d.ts +7 -6
- package/dist/videoSendingBalancer/index.d.ts +7 -6
- package/dist/videoSendingBalancer/processSender.d.ts +5 -4
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +1 -1
- package/package.json +8 -8
- package/dist/SipConnector-DMjzYyq_.cjs +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) => (
|
|
4
|
-
import { CancelableRequest as N, isCanceledError as
|
|
5
|
-
import
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var Rt = (r, e, t) => e in r ? At(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => (Rt(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { CancelableRequest as N, isCanceledError as It } from "@krivega/cancelable-promise";
|
|
5
|
+
import Oe from "events-constructor";
|
|
6
6
|
import F from "debug";
|
|
7
|
-
const
|
|
7
|
+
const mt = "Connection Error", Ue = "Request Timeout", ft = "SIP Failure Code", Ot = "Internal Error", Pt = "Busy", Le = "Rejected", Mt = "Redirected", Dt = "Unavailable", pt = "Not Found", vt = "Address Incomplete", wt = "Incompatible SDP", yt = "Missing SDP", bt = "Authentication Error", He = "Terminated", Ut = "WebRTC Error", ke = "Canceled", Lt = "No Answer", Ht = "Expires", kt = "No ACK", qt = "Dialog Error", Wt = "User Denied Media Access", Ft = "Bad Media Description", Bt = "RTP Timeout", Xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
8
|
__proto__: null,
|
|
9
|
-
ADDRESS_INCOMPLETE:
|
|
10
|
-
AUTHENTICATION_ERROR:
|
|
11
|
-
BAD_MEDIA_DESCRIPTION:
|
|
12
|
-
BUSY:
|
|
9
|
+
ADDRESS_INCOMPLETE: vt,
|
|
10
|
+
AUTHENTICATION_ERROR: bt,
|
|
11
|
+
BAD_MEDIA_DESCRIPTION: Ft,
|
|
12
|
+
BUSY: Pt,
|
|
13
13
|
BYE: He,
|
|
14
14
|
CANCELED: ke,
|
|
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:
|
|
15
|
+
CONNECTION_ERROR: mt,
|
|
16
|
+
DIALOG_ERROR: qt,
|
|
17
|
+
EXPIRES: Ht,
|
|
18
|
+
INCOMPATIBLE_SDP: wt,
|
|
19
|
+
INTERNAL_ERROR: Ot,
|
|
20
|
+
MISSING_SDP: yt,
|
|
21
|
+
NOT_FOUND: pt,
|
|
22
|
+
NO_ACK: kt,
|
|
23
|
+
NO_ANSWER: Lt,
|
|
24
|
+
REDIRECTED: Mt,
|
|
25
25
|
REJECTED: Le,
|
|
26
26
|
REQUEST_TIMEOUT: Ue,
|
|
27
|
-
RTP_TIMEOUT:
|
|
28
|
-
SIP_FAILURE_CODE:
|
|
27
|
+
RTP_TIMEOUT: Bt,
|
|
28
|
+
SIP_FAILURE_CODE: ft,
|
|
29
29
|
UNAVAILABLE: Dt,
|
|
30
|
-
USER_DENIED_MEDIA_ACCESS:
|
|
31
|
-
WEBRTC_ERROR:
|
|
32
|
-
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting",
|
|
30
|
+
USER_DENIED_MEDIA_ACCESS: Wt,
|
|
31
|
+
WEBRTC_ERROR: Ut
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), B = "incomingCall", V = "declinedIncomingCall", Y = "failedIncomingCall", x = "terminatedIncomingCall", L = "connecting", m = "connected", u = "disconnected", D = "newRTCSession", f = "registered", $ = "unregistered", O = "registrationFailed", qe = "newMessage", G = "sipEvent", X = "availableSecondRemoteStream", J = "notAvailableSecondRemoteStream", z = "mustStopPresentation", p = "shareState", Q = "enterRoom", K = "useLicense", j = "peerconnection:confirmed", Z = "peerconnection:ontrack", v = "channels", ee = "channels:notify", te = "ended:fromserver", se = "main-cam-control", ne = "admin-stop-main-cam", ie = "admin-start-main-cam", 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 = "participant:move-request-to-spectators", he = "participation:accepting-word-request", de = "participation:cancelling-word-request", le = "webcast:started", Te = "webcast:stopped", ue = "account:changed", Se = "account:deleted", Ne = "conference:participant-token-issued", P = "ended", We = "sending", Fe = "reinvite", Be = "replaces", Ve = "refer", Ye = "progress", xe = "accepted", y = "confirmed", b = "peerconnection", C = "failed", $e = "muted", Ge = "unmuted", ge = "newDTMF", Ce = "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", Ae = "presentation:ended", U = "presentation:failed", ot = "SPECTATOR", Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33
33
|
__proto__: null,
|
|
34
34
|
ACCEPTED: xe,
|
|
35
35
|
ACCOUNT_CHANGED: ue,
|
|
36
|
-
ACCOUNT_DELETED:
|
|
36
|
+
ACCOUNT_DELETED: Se,
|
|
37
37
|
ADMIN_FORCE_SYNC_MEDIA_STATE: w,
|
|
38
38
|
ADMIN_START_MAIN_CAM: ie,
|
|
39
39
|
ADMIN_START_MIC: oe,
|
|
@@ -42,13 +42,13 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
42
42
|
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: X,
|
|
43
43
|
CHANNELS: v,
|
|
44
44
|
CHANNELS_NOTIFY: ee,
|
|
45
|
-
CONFERENCE_PARTICIPANT_TOKEN_ISSUED:
|
|
45
|
+
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ne,
|
|
46
46
|
CONFIRMED: y,
|
|
47
|
-
CONNECTED:
|
|
47
|
+
CONNECTED: m,
|
|
48
48
|
CONNECTING: L,
|
|
49
49
|
DECLINED_INCOMING_CALL: V,
|
|
50
|
-
DISCONNECTED:
|
|
51
|
-
ENDED:
|
|
50
|
+
DISCONNECTED: u,
|
|
51
|
+
ENDED: P,
|
|
52
52
|
ENDED_FROM_SERVER: te,
|
|
53
53
|
ENTER_ROOM: Q,
|
|
54
54
|
FAILED: C,
|
|
@@ -59,17 +59,18 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
59
59
|
INCOMING_CALL: B,
|
|
60
60
|
MAIN_CAM_CONTROL: se,
|
|
61
61
|
MUST_STOP_PRESENTATION_EVENT: z,
|
|
62
|
-
MUTED:
|
|
63
|
-
NEW_DTMF:
|
|
64
|
-
NEW_INFO:
|
|
62
|
+
MUTED: $e,
|
|
63
|
+
NEW_DTMF: ge,
|
|
64
|
+
NEW_INFO: Ce,
|
|
65
65
|
NEW_MESSAGE: qe,
|
|
66
|
-
NEW_RTC_SESSION:
|
|
66
|
+
NEW_RTC_SESSION: D,
|
|
67
67
|
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: J,
|
|
68
68
|
PARTICIPANT_ADDED_TO_LIST_MODERATORS: ae,
|
|
69
|
+
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: _e,
|
|
69
70
|
PARTICIPANT_MOVE_REQUEST_TO_STREAM: Ee,
|
|
70
71
|
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: ce,
|
|
71
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST:
|
|
72
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST:
|
|
72
|
+
PARTICIPATION_ACCEPTING_WORD_REQUEST: he,
|
|
73
|
+
PARTICIPATION_CANCELLING_WORD_REQUEST: de,
|
|
73
74
|
PEER_CONNECTION: b,
|
|
74
75
|
PEER_CONNECTION_CONFIRMED: j,
|
|
75
76
|
PEER_CONNECTION_CREATE_ANSWER_FAILED: et,
|
|
@@ -78,55 +79,56 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
78
79
|
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: tt,
|
|
79
80
|
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: st,
|
|
80
81
|
PRESENTATION_END: rt,
|
|
81
|
-
PRESENTATION_ENDED:
|
|
82
|
+
PRESENTATION_ENDED: Ae,
|
|
82
83
|
PRESENTATION_FAILED: U,
|
|
83
84
|
PRESENTATION_START: nt,
|
|
84
85
|
PRESENTATION_STARTED: it,
|
|
85
86
|
PROGRESS: Ye,
|
|
86
87
|
REFER: Ve,
|
|
87
|
-
REGISTERED:
|
|
88
|
-
REGISTRATION_FAILED:
|
|
88
|
+
REGISTERED: f,
|
|
89
|
+
REGISTRATION_FAILED: O,
|
|
89
90
|
REINVITE: Fe,
|
|
90
91
|
REPLACES: Be,
|
|
91
92
|
SDP: Qe,
|
|
92
93
|
SENDING: We,
|
|
93
94
|
SHARE_STATE: p,
|
|
94
|
-
SIP_EVENT:
|
|
95
|
+
SIP_EVENT: G,
|
|
96
|
+
SPECTATOR: ot,
|
|
95
97
|
TERMINATED_INCOMING_CALL: x,
|
|
96
98
|
UNHOLD: Je,
|
|
97
|
-
UNMUTED:
|
|
98
|
-
UNREGISTERED:
|
|
99
|
+
UNMUTED: Ge,
|
|
100
|
+
UNREGISTERED: $,
|
|
99
101
|
UPDATE: ze,
|
|
100
102
|
USE_LICENSE: K,
|
|
101
|
-
WEBCAST_STARTED:
|
|
102
|
-
WEBCAST_STOPPED:
|
|
103
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
103
|
+
WEBCAST_STARTED: le,
|
|
104
|
+
WEBCAST_STOPPED: Te
|
|
105
|
+
}, Symbol.toStringTag, { value: "Module" })), at = [
|
|
104
106
|
B,
|
|
105
107
|
V,
|
|
106
108
|
x,
|
|
107
109
|
Y,
|
|
108
|
-
_e,
|
|
109
110
|
he,
|
|
111
|
+
de,
|
|
110
112
|
Ee,
|
|
111
113
|
ee,
|
|
112
|
-
|
|
114
|
+
Ne,
|
|
113
115
|
ue,
|
|
114
|
-
|
|
115
|
-
de,
|
|
116
|
+
Se,
|
|
116
117
|
le,
|
|
118
|
+
Te,
|
|
117
119
|
ae,
|
|
118
120
|
ce
|
|
119
|
-
],
|
|
121
|
+
], Re = [
|
|
120
122
|
L,
|
|
121
|
-
I,
|
|
122
|
-
T,
|
|
123
|
-
P,
|
|
124
123
|
m,
|
|
125
|
-
|
|
124
|
+
u,
|
|
125
|
+
D,
|
|
126
126
|
f,
|
|
127
|
+
$,
|
|
128
|
+
O,
|
|
127
129
|
qe,
|
|
128
|
-
|
|
129
|
-
],
|
|
130
|
+
G
|
|
131
|
+
], ct = [
|
|
130
132
|
X,
|
|
131
133
|
J,
|
|
132
134
|
z,
|
|
@@ -142,9 +144,10 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
142
144
|
ne,
|
|
143
145
|
re,
|
|
144
146
|
oe,
|
|
145
|
-
w
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
w,
|
|
148
|
+
_e
|
|
149
|
+
], Ie = [
|
|
150
|
+
P,
|
|
148
151
|
L,
|
|
149
152
|
We,
|
|
150
153
|
Fe,
|
|
@@ -155,10 +158,10 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
155
158
|
y,
|
|
156
159
|
b,
|
|
157
160
|
C,
|
|
158
|
-
Ge,
|
|
159
161
|
$e,
|
|
160
|
-
|
|
162
|
+
Ge,
|
|
161
163
|
ge,
|
|
164
|
+
Ce,
|
|
162
165
|
Xe,
|
|
163
166
|
Je,
|
|
164
167
|
ze,
|
|
@@ -172,32 +175,32 @@ const Rt = "Connection Error", Ue = "Request Timeout", It = "SIP Failure Code",
|
|
|
172
175
|
nt,
|
|
173
176
|
it,
|
|
174
177
|
rt,
|
|
175
|
-
|
|
178
|
+
Ae,
|
|
176
179
|
U
|
|
177
|
-
],
|
|
178
|
-
...
|
|
179
|
-
...
|
|
180
|
-
],
|
|
180
|
+
], Et = [...Re, ...at], _t = [
|
|
181
|
+
...Ie,
|
|
182
|
+
...ct
|
|
183
|
+
], zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
181
184
|
__proto__: null,
|
|
182
|
-
SESSION_EVENT_NAMES:
|
|
183
|
-
SESSION_JSSIP_EVENT_NAMES:
|
|
184
|
-
SESSION_SYNTHETICS_EVENT_NAMES:
|
|
185
|
-
UA_EVENT_NAMES:
|
|
186
|
-
UA_JSSIP_EVENT_NAMES:
|
|
187
|
-
UA_SYNTHETICS_EVENT_NAMES:
|
|
188
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
185
|
+
SESSION_EVENT_NAMES: _t,
|
|
186
|
+
SESSION_JSSIP_EVENT_NAMES: Ie,
|
|
187
|
+
SESSION_SYNTHETICS_EVENT_NAMES: ct,
|
|
188
|
+
UA_EVENT_NAMES: Et,
|
|
189
|
+
UA_JSSIP_EVENT_NAMES: Re,
|
|
190
|
+
UA_SYNTHETICS_EVENT_NAMES: at
|
|
191
|
+
}, Symbol.toStringTag, { value: "Module" })), Vt = (r) => {
|
|
189
192
|
const e = [];
|
|
190
193
|
return r && e.push(`X-Vinteo-Remote: ${r}`), e;
|
|
191
|
-
},
|
|
192
|
-
F.enable(
|
|
193
|
-
},
|
|
194
|
-
F.enable(`-${
|
|
194
|
+
}, Yt = "content-type", xt = "x-webrtc-enter-room", M = "application/vinteo.webrtc.sharedesktop", $t = "application/vinteo.webrtc.roomname", Gt = "application/vinteo.webrtc.channels", Xt = "application/vinteo.webrtc.mediastate", Jt = "application/vinteo.webrtc.refusal", Pe = "application/vinteo.webrtc.maincam", zt = "application/vinteo.webrtc.mic", Qt = "application/vinteo.webrtc.uselic", Kt = "X-WEBRTC-USE-LICENSE", Me = "X-WEBRTC-INPUT-CHANNELS", De = "X-WEBRTC-OUTPUT-CHANNELS", jt = "X-WEBRTC-MAINCAM", Zt = "X-WEBRTC-MIC", pe = "X-WEBRTC-SYNC", es = "X-WEBRTC-MAINCAM-RESOLUTION", ts = "X-WEBRTC-MEDIA-STATE", ss = "X-Vinteo-Media-Type", ns = "X-Vinteo-MainCam-State", is = "X-Vinteo-Mic-State", rs = "application/vinteo.webrtc.partstate", os = "X-WEBRTC-PARTSTATE", as = "application/vinteo.webrtc.notify", cs = "X-VINTEO-NOTIFY", A = "x-webrtc-share-state", Es = `${A}: LETMESTARTPRESENTATION`, _s = `${A}: STOPPRESENTATION`, ht = "YOUCANRECEIVECONTENT", dt = "CONTENTEND", lt = "YOUMUSTSTOPSENDCONTENT", hs = `${A}: ${lt}`, ds = `${A}: ${ht}`, ls = `${A}: ${dt}`, Ts = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", us = `${Ts}: LETMESTARTMAINCAM`, me = "sip-connector", ve = F(me), Qs = () => {
|
|
195
|
+
F.enable(me);
|
|
196
|
+
}, Ks = () => {
|
|
197
|
+
F.enable(`-${me}`);
|
|
195
198
|
};
|
|
196
|
-
var
|
|
199
|
+
var I = /* @__PURE__ */ ((r) => (r.PAUSE_MAIN_CAM = "PAUSEMAINCAM", r.RESUME_MAIN_CAM = "RESUMEMAINCAM", r.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", r.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", r.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", r))(I || {}), k = /* @__PURE__ */ ((r) => (r.ADMIN_STOP_MIC = "ADMINSTOPMIC", r.ADMIN_START_MIC = "ADMINSTARTMIC", r))(k || {}), q = /* @__PURE__ */ ((r) => (r.ADMIN_SYNC_FORCED = "1", r.ADMIN_SYNC_NOT_FORCED = "0", r))(q || {}), Ss = /* @__PURE__ */ ((r) => (r.AUDIO = "AUDIO", r.VIDEO = "VIDEO", r.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", r))(Ss || {});
|
|
197
200
|
function we(r) {
|
|
198
201
|
return (e) => `sip:${e}@${r}`;
|
|
199
202
|
}
|
|
200
|
-
const
|
|
203
|
+
const Ns = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, ye = (r) => r.trim().replaceAll(" ", "_"), gs = Ns(1e5, 99999999), H = (r, {
|
|
201
204
|
videoMode: e,
|
|
202
205
|
audioMode: t
|
|
203
206
|
} = {}) => {
|
|
@@ -205,41 +208,41 @@ const ds = (r, e) => () => Math.floor(Math.random() * (e - r)) + r, ye = (r) =>
|
|
|
205
208
|
return;
|
|
206
209
|
const s = t === "recvonly" ? [] : r.getAudioTracks(), n = e === "recvonly" ? [] : r.getVideoTracks(), o = [...s, ...n], a = new MediaStream(o);
|
|
207
210
|
return a.getTracks = () => [...a.getAudioTracks(), ...a.getVideoTracks()], a;
|
|
208
|
-
},
|
|
211
|
+
}, Cs = (r) => r.some((t) => {
|
|
209
212
|
const { kind: s } = t;
|
|
210
213
|
return s === "video";
|
|
211
|
-
}),
|
|
212
|
-
|
|
213
|
-
),
|
|
214
|
-
const t = r === void 0 ? void 0 : Math.max(r,
|
|
215
|
-
if (t !== void 0 &&
|
|
214
|
+
}), As = "Error decline with 603", Rs = (r) => r.message === As, Is = (r, e) => r.find((t) => t.track && e.getTracks().includes(t.track)), Tt = 1, ut = (r) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== r, ms = ut(
|
|
215
|
+
Tt
|
|
216
|
+
), fs = (r, e) => {
|
|
217
|
+
const t = r === void 0 ? void 0 : Math.max(r, Tt);
|
|
218
|
+
if (t !== void 0 && ms(
|
|
216
219
|
t,
|
|
217
220
|
e
|
|
218
221
|
))
|
|
219
222
|
return t;
|
|
220
|
-
},
|
|
221
|
-
if (
|
|
223
|
+
}, Os = ut(), Ps = (r, e) => {
|
|
224
|
+
if (Os(r, e))
|
|
222
225
|
return r;
|
|
223
|
-
},
|
|
226
|
+
}, Ms = async (r, e, t) => {
|
|
224
227
|
const s = r.getParameters();
|
|
225
228
|
(s.encodings === void 0 || s.encodings.length === 0) && (s.encodings = [{}]);
|
|
226
|
-
const [n] = s.encodings, o = n.scaleResolutionDownBy, a =
|
|
229
|
+
const [n] = s.encodings, o = n.scaleResolutionDownBy, a = fs(
|
|
227
230
|
e.scaleResolutionDownBy,
|
|
228
231
|
o
|
|
229
232
|
);
|
|
230
233
|
let c = !1;
|
|
231
234
|
a !== void 0 && (s.encodings[0].scaleResolutionDownBy = a, c = !0);
|
|
232
|
-
const E = n.maxBitrate, _ =
|
|
235
|
+
const E = n.maxBitrate, _ = Ps(e.maxBitrate, E);
|
|
233
236
|
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
|
-
},
|
|
235
|
-
const s =
|
|
237
|
+
}, Ds = async (r, e, t) => {
|
|
238
|
+
const s = Is(r, e);
|
|
236
239
|
if (s)
|
|
237
|
-
return
|
|
238
|
-
},
|
|
240
|
+
return Ms(s, { maxBitrate: t });
|
|
241
|
+
}, ps = 486, vs = 487, W = "local", be = "remote", js = (r = new Error()) => {
|
|
239
242
|
const { originator: e, cause: t } = r;
|
|
240
|
-
return
|
|
241
|
-
}, g = "SipConnector",
|
|
242
|
-
class
|
|
243
|
+
return It(r) ? !0 : typeof t == "string" ? t === Ue || t === Le || e === W && (t === ke || t === He) : !1;
|
|
244
|
+
}, g = "SipConnector", ws = "channels", ys = "WebcastStarted", bs = "WebcastStopped", Us = "accountChanged", Ls = "accountDeleted", Hs = "addedToListModerators", ks = "removedFromListModerators", qs = "ParticipationRequestAccepted", Ws = "ParticipationRequestRejected", Fs = "ParticipantMovedToWebcast", Bs = "ConferenceParticipantTokenIssued";
|
|
245
|
+
class Zs {
|
|
243
246
|
constructor({ JsSIP: e }) {
|
|
244
247
|
i(this, "_isRegisterConfig", !1);
|
|
245
248
|
i(this, "_connectionConfiguration", {});
|
|
@@ -281,7 +284,7 @@ class Js {
|
|
|
281
284
|
}
|
|
282
285
|
return this.register();
|
|
283
286
|
});
|
|
284
|
-
i(this, "declineToIncomingCall", async ({ statusCode: e =
|
|
287
|
+
i(this, "declineToIncomingCall", async ({ statusCode: e = vs } = {}) => new Promise((t, s) => {
|
|
285
288
|
if (!this.isAvailableIncomingCall) {
|
|
286
289
|
s(new Error("no incomingSession"));
|
|
287
290
|
return;
|
|
@@ -289,7 +292,7 @@ class Js {
|
|
|
289
292
|
const n = this.incomingSession, o = this.remoteCallerData;
|
|
290
293
|
this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(V, o), t(n.terminate({ status_code: e }));
|
|
291
294
|
}));
|
|
292
|
-
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode:
|
|
295
|
+
i(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: ps }));
|
|
293
296
|
i(this, "removeIncomingSession", () => {
|
|
294
297
|
delete this.incomingSession;
|
|
295
298
|
});
|
|
@@ -314,7 +317,7 @@ class Js {
|
|
|
314
317
|
registerExpires: E,
|
|
315
318
|
connectionRecoveryMinInterval: _,
|
|
316
319
|
connectionRecoveryMaxInterval: h,
|
|
317
|
-
userAgent:
|
|
320
|
+
userAgent: T,
|
|
318
321
|
displayName: d = "",
|
|
319
322
|
register: l = !1,
|
|
320
323
|
extraHeaders: S = []
|
|
@@ -334,11 +337,11 @@ class Js {
|
|
|
334
337
|
user: e,
|
|
335
338
|
password: t
|
|
336
339
|
}, this.getSipServerUrl = we(s), this.socket = new this.JsSIP.WebSocketInterface(n), this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!l;
|
|
337
|
-
const { socket:
|
|
340
|
+
const { socket: R } = this;
|
|
338
341
|
this.ua = this._createUa({
|
|
339
342
|
user: e,
|
|
340
343
|
password: t,
|
|
341
|
-
socket:
|
|
344
|
+
socket: R,
|
|
342
345
|
displayName: d,
|
|
343
346
|
register: l,
|
|
344
347
|
sdpSemantics: a,
|
|
@@ -346,14 +349,14 @@ class Js {
|
|
|
346
349
|
registerExpires: E,
|
|
347
350
|
connectionRecoveryMinInterval: _,
|
|
348
351
|
connectionRecoveryMaxInterval: h,
|
|
349
|
-
userAgent:
|
|
352
|
+
userAgent: T,
|
|
350
353
|
getSipServerUrl: this.getSipServerUrl
|
|
351
|
-
}), this._uaEvents.eachTriggers((
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
+
}), this._uaEvents.eachTriggers((Nt, gt) => {
|
|
355
|
+
const fe = Re.find((Ct) => Ct === gt);
|
|
356
|
+
fe && this.ua && this.ua.on(fe, Nt);
|
|
354
357
|
});
|
|
355
|
-
const
|
|
356
|
-
return this.ua.registrator().setExtraHeaders(
|
|
358
|
+
const St = [...Vt(o), ...S];
|
|
359
|
+
return this.ua.registrator().setExtraHeaders(St), this.ua;
|
|
357
360
|
});
|
|
358
361
|
i(this, "_createUa", ({
|
|
359
362
|
user: e,
|
|
@@ -367,12 +370,12 @@ class Js {
|
|
|
367
370
|
registerExpires: _ = 60 * 5,
|
|
368
371
|
// 5 minutes in sec
|
|
369
372
|
connectionRecoveryMinInterval: h = 2,
|
|
370
|
-
connectionRecoveryMaxInterval:
|
|
373
|
+
connectionRecoveryMaxInterval: T = 6,
|
|
371
374
|
userAgent: d
|
|
372
375
|
}) => {
|
|
373
376
|
if (a && !t)
|
|
374
377
|
throw new Error("password is required for authorized connection");
|
|
375
|
-
const l = a && e ? e.trim() : `${
|
|
378
|
+
const l = a && e ? e.trim() : `${gs()}`, S = o(l), R = {
|
|
376
379
|
password: t,
|
|
377
380
|
register: a,
|
|
378
381
|
uri: S,
|
|
@@ -383,9 +386,9 @@ class Js {
|
|
|
383
386
|
session_timers: E,
|
|
384
387
|
register_expires: _,
|
|
385
388
|
connection_recovery_min_interval: h,
|
|
386
|
-
connection_recovery_max_interval:
|
|
389
|
+
connection_recovery_max_interval: T
|
|
387
390
|
};
|
|
388
|
-
return new this.JsSIP.UA(
|
|
391
|
+
return new this.JsSIP.UA(R);
|
|
389
392
|
});
|
|
390
393
|
i(this, "_start", async () => new Promise((e, t) => {
|
|
391
394
|
const { ua: s } = this;
|
|
@@ -398,11 +401,11 @@ class Js {
|
|
|
398
401
|
}, o = (E) => {
|
|
399
402
|
c(), t(E);
|
|
400
403
|
}, a = () => {
|
|
401
|
-
this.isRegisterConfig ? (this.on(
|
|
404
|
+
this.isRegisterConfig ? (this.on(f, n), this.on(O, o)) : this.on(m, n), this.on(u, o);
|
|
402
405
|
}, c = () => {
|
|
403
|
-
this.off(
|
|
406
|
+
this.off(f, n), this.off(O, o), this.off(m, n), this.off(u, o);
|
|
404
407
|
};
|
|
405
|
-
a(), this.on(
|
|
408
|
+
a(), this.on(D, this.handleNewRTCSession), s.start();
|
|
406
409
|
}));
|
|
407
410
|
i(this, "_set", async ({ displayName: e, password: t }) => new Promise((s, n) => {
|
|
408
411
|
const { ua: o } = this;
|
|
@@ -421,13 +424,13 @@ class Js {
|
|
|
421
424
|
}));
|
|
422
425
|
i(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
|
|
423
426
|
i(this, "_disconnect", async () => {
|
|
424
|
-
this.off(
|
|
427
|
+
this.off(D, this.handleNewRTCSession);
|
|
425
428
|
const e = new Promise((t) => {
|
|
426
|
-
this.once(
|
|
429
|
+
this.once(u, () => {
|
|
427
430
|
delete this.ua, t();
|
|
428
431
|
});
|
|
429
432
|
});
|
|
430
|
-
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(
|
|
433
|
+
return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(u, void 0)) : this._uaEvents.trigger(u, void 0), e;
|
|
431
434
|
});
|
|
432
435
|
i(this, "_call", async ({
|
|
433
436
|
number: e,
|
|
@@ -440,13 +443,13 @@ class Js {
|
|
|
440
443
|
degradationPreference: E,
|
|
441
444
|
offerToReceiveAudio: _ = !0,
|
|
442
445
|
offerToReceiveVideo: h = !0
|
|
443
|
-
}) => new Promise((
|
|
446
|
+
}) => new Promise((T, d) => {
|
|
444
447
|
const { ua: l } = this;
|
|
445
448
|
if (!l) {
|
|
446
449
|
d(new Error("this.ua is not initialized"));
|
|
447
450
|
return;
|
|
448
451
|
}
|
|
449
|
-
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(
|
|
452
|
+
this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: n }).then(T).catch((S) => {
|
|
450
453
|
d(S);
|
|
451
454
|
}), this.session = l.call(this.getSipServerUrl(e), {
|
|
452
455
|
extraHeaders: s,
|
|
@@ -487,12 +490,12 @@ class Js {
|
|
|
487
490
|
return;
|
|
488
491
|
}
|
|
489
492
|
this._sessionEvents.eachTriggers((d, l) => {
|
|
490
|
-
const S =
|
|
493
|
+
const S = Ie.find((R) => R === l);
|
|
491
494
|
S && h.on(S, d);
|
|
492
495
|
}), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = h.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(E).catch((d) => {
|
|
493
496
|
_(d);
|
|
494
497
|
});
|
|
495
|
-
const
|
|
498
|
+
const T = H(e, {
|
|
496
499
|
videoMode: o,
|
|
497
500
|
audioMode: a
|
|
498
501
|
});
|
|
@@ -501,7 +504,7 @@ class Js {
|
|
|
501
504
|
videoMode: o,
|
|
502
505
|
audioMode: a,
|
|
503
506
|
degradationPreference: c,
|
|
504
|
-
mediaStream:
|
|
507
|
+
mediaStream: T,
|
|
505
508
|
pcConfig: {
|
|
506
509
|
iceServers: n
|
|
507
510
|
}
|
|
@@ -509,13 +512,13 @@ class Js {
|
|
|
509
512
|
}));
|
|
510
513
|
i(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
|
|
511
514
|
const n = () => {
|
|
512
|
-
this.onSession(b, h), this.onSession(y,
|
|
515
|
+
this.onSession(b, h), this.onSession(y, T);
|
|
513
516
|
}, o = () => {
|
|
514
|
-
this.offSession(b, h), this.offSession(y,
|
|
517
|
+
this.offSession(b, h), this.offSession(y, T);
|
|
515
518
|
}, a = () => {
|
|
516
|
-
this.onSession(C, E), this.onSession(
|
|
519
|
+
this.onSession(C, E), this.onSession(P, E);
|
|
517
520
|
}, c = () => {
|
|
518
|
-
this.offSession(C, E), this.offSession(
|
|
521
|
+
this.offSession(C, E), this.offSession(P, E);
|
|
519
522
|
}, E = (d) => {
|
|
520
523
|
o(), c(), s(d);
|
|
521
524
|
};
|
|
@@ -524,7 +527,7 @@ class Js {
|
|
|
524
527
|
_ = d, _.ontrack = (l) => {
|
|
525
528
|
this._sessionEvents.trigger(Z, _), e && e(l);
|
|
526
529
|
};
|
|
527
|
-
},
|
|
530
|
+
}, T = () => {
|
|
528
531
|
_ && this._sessionEvents.trigger(j, _), o(), c(), t(_);
|
|
529
532
|
};
|
|
530
533
|
n(), a();
|
|
@@ -538,7 +541,7 @@ class Js {
|
|
|
538
541
|
s(new Error("No session established"));
|
|
539
542
|
return;
|
|
540
543
|
}
|
|
541
|
-
this.onceSession(
|
|
544
|
+
this.onceSession(ge, ({ originator: o }) => {
|
|
542
545
|
o === W && t();
|
|
543
546
|
}), n.sendDTMF(e, {
|
|
544
547
|
duration: 120,
|
|
@@ -553,22 +556,22 @@ class Js {
|
|
|
553
556
|
});
|
|
554
557
|
i(this, "_handleShareState", (e) => {
|
|
555
558
|
switch (e) {
|
|
556
|
-
case
|
|
559
|
+
case ht: {
|
|
557
560
|
this._sessionEvents.trigger(X, void 0);
|
|
558
561
|
break;
|
|
559
562
|
}
|
|
560
|
-
case
|
|
563
|
+
case dt: {
|
|
561
564
|
this._sessionEvents.trigger(J, void 0);
|
|
562
565
|
break;
|
|
563
566
|
}
|
|
564
|
-
case
|
|
567
|
+
case lt: {
|
|
565
568
|
this._sessionEvents.trigger(z, void 0);
|
|
566
569
|
break;
|
|
567
570
|
}
|
|
568
571
|
}
|
|
569
572
|
});
|
|
570
573
|
i(this, "_maybeTriggerChannels", (e) => {
|
|
571
|
-
const t = e.getHeader(
|
|
574
|
+
const t = e.getHeader(Me), s = e.getHeader(De);
|
|
572
575
|
if (t && s) {
|
|
573
576
|
const n = {
|
|
574
577
|
inputChannels: t,
|
|
@@ -579,55 +582,55 @@ class Js {
|
|
|
579
582
|
});
|
|
580
583
|
i(this, "_handleNotify", (e) => {
|
|
581
584
|
switch (e.cmd) {
|
|
582
|
-
case
|
|
585
|
+
case ws: {
|
|
583
586
|
const t = e;
|
|
584
587
|
this._triggerChannelsNotify(t);
|
|
585
588
|
break;
|
|
586
589
|
}
|
|
587
|
-
case
|
|
590
|
+
case ys: {
|
|
588
591
|
const t = e;
|
|
589
592
|
this._triggerWebcastStartedNotify(t);
|
|
590
593
|
break;
|
|
591
594
|
}
|
|
592
|
-
case
|
|
595
|
+
case bs: {
|
|
593
596
|
const t = e;
|
|
594
597
|
this._triggerWebcastStoppedNotify(t);
|
|
595
598
|
break;
|
|
596
599
|
}
|
|
597
|
-
case
|
|
600
|
+
case Hs: {
|
|
598
601
|
const t = e;
|
|
599
602
|
this._triggerAddedToListModeratorsNotify(t);
|
|
600
603
|
break;
|
|
601
604
|
}
|
|
602
|
-
case
|
|
605
|
+
case ks: {
|
|
603
606
|
const t = e;
|
|
604
607
|
this._triggerRemovedFromListModeratorsNotify(t);
|
|
605
608
|
break;
|
|
606
609
|
}
|
|
607
|
-
case
|
|
610
|
+
case qs: {
|
|
608
611
|
const t = e;
|
|
609
612
|
this._triggerParticipationAcceptingWordRequest(t);
|
|
610
613
|
break;
|
|
611
614
|
}
|
|
612
|
-
case
|
|
615
|
+
case Ws: {
|
|
613
616
|
const t = e;
|
|
614
617
|
this._triggerParticipationCancellingWordRequest(t);
|
|
615
618
|
break;
|
|
616
619
|
}
|
|
617
|
-
case
|
|
620
|
+
case Fs: {
|
|
618
621
|
const t = e;
|
|
619
622
|
this._triggerParticipantMoveRequestToStream(t);
|
|
620
623
|
break;
|
|
621
624
|
}
|
|
622
|
-
case
|
|
625
|
+
case Us: {
|
|
623
626
|
this._triggerAccountChangedNotify();
|
|
624
627
|
break;
|
|
625
628
|
}
|
|
626
|
-
case
|
|
629
|
+
case Ls: {
|
|
627
630
|
this._triggerAccountDeletedNotify();
|
|
628
631
|
break;
|
|
629
632
|
}
|
|
630
|
-
case
|
|
633
|
+
case Bs: {
|
|
631
634
|
const t = e;
|
|
632
635
|
this._triggerConferenceParticipantTokenIssued(t);
|
|
633
636
|
break;
|
|
@@ -658,20 +661,20 @@ class Js {
|
|
|
658
661
|
conference: e,
|
|
659
662
|
type: t
|
|
660
663
|
};
|
|
661
|
-
this._uaEvents.trigger(
|
|
664
|
+
this._uaEvents.trigger(le, s);
|
|
662
665
|
});
|
|
663
666
|
i(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
|
|
664
667
|
const s = {
|
|
665
668
|
conference: e,
|
|
666
669
|
type: t
|
|
667
670
|
};
|
|
668
|
-
this._uaEvents.trigger(
|
|
671
|
+
this._uaEvents.trigger(Te, s);
|
|
669
672
|
});
|
|
670
673
|
i(this, "_triggerAccountChangedNotify", () => {
|
|
671
674
|
this._uaEvents.trigger(ue, void 0);
|
|
672
675
|
});
|
|
673
676
|
i(this, "_triggerAccountDeletedNotify", () => {
|
|
674
|
-
this._uaEvents.trigger(
|
|
677
|
+
this._uaEvents.trigger(Se, void 0);
|
|
675
678
|
});
|
|
676
679
|
i(this, "_triggerConferenceParticipantTokenIssued", ({
|
|
677
680
|
body: { conference: e, participant: t, jwt: s }
|
|
@@ -682,7 +685,7 @@ class Js {
|
|
|
682
685
|
jwt: s
|
|
683
686
|
};
|
|
684
687
|
this._uaEvents.trigger(
|
|
685
|
-
|
|
688
|
+
Ne,
|
|
686
689
|
n
|
|
687
690
|
);
|
|
688
691
|
});
|
|
@@ -699,7 +702,7 @@ class Js {
|
|
|
699
702
|
const t = {
|
|
700
703
|
conference: e
|
|
701
704
|
};
|
|
702
|
-
this._uaEvents.trigger(
|
|
705
|
+
this._uaEvents.trigger(he, t);
|
|
703
706
|
});
|
|
704
707
|
i(this, "_triggerParticipationCancellingWordRequest", ({
|
|
705
708
|
body: { conference: e }
|
|
@@ -707,7 +710,7 @@ class Js {
|
|
|
707
710
|
const t = {
|
|
708
711
|
conference: e
|
|
709
712
|
};
|
|
710
|
-
this._uaEvents.trigger(
|
|
713
|
+
this._uaEvents.trigger(de, t);
|
|
711
714
|
});
|
|
712
715
|
i(this, "_triggerParticipantMoveRequestToStream", ({
|
|
713
716
|
body: { conference: e }
|
|
@@ -718,23 +721,26 @@ class Js {
|
|
|
718
721
|
this._uaEvents.trigger(Ee, t);
|
|
719
722
|
});
|
|
720
723
|
i(this, "_triggerEnterRoom", (e) => {
|
|
721
|
-
const t = e.getHeader(
|
|
724
|
+
const t = e.getHeader(xt);
|
|
722
725
|
this._sessionEvents.trigger(Q, t);
|
|
723
726
|
});
|
|
724
727
|
i(this, "_triggerShareState", (e) => {
|
|
725
|
-
const t = e.getHeader(
|
|
728
|
+
const t = e.getHeader(A);
|
|
726
729
|
this._sessionEvents.trigger(p, t);
|
|
727
730
|
});
|
|
731
|
+
i(this, "_maybeTriggerParticipantMoveRequestToSpectators", (e) => {
|
|
732
|
+
e.getHeader(os) === ot && this._sessionEvents.trigger(_e, void 0);
|
|
733
|
+
});
|
|
728
734
|
i(this, "_triggerMainCamControl", (e) => {
|
|
729
|
-
const t = e.getHeader(
|
|
730
|
-
if (t ===
|
|
735
|
+
const t = e.getHeader(jt), s = e.getHeader(pe), n = s === q.ADMIN_SYNC_FORCED;
|
|
736
|
+
if (t === I.ADMIN_START_MAIN_CAM)
|
|
731
737
|
this._sessionEvents.trigger(ie, { isSyncForced: n });
|
|
732
|
-
else if (t ===
|
|
738
|
+
else if (t === I.ADMIN_STOP_MAIN_CAM)
|
|
733
739
|
this._sessionEvents.trigger(ne, { isSyncForced: n });
|
|
734
|
-
else if ((t ===
|
|
740
|
+
else if ((t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && s)
|
|
735
741
|
this._sessionEvents.trigger(w, { isSyncForced: n });
|
|
736
742
|
else {
|
|
737
|
-
const o = e.getHeader(
|
|
743
|
+
const o = e.getHeader(es);
|
|
738
744
|
this._sessionEvents.trigger(se, {
|
|
739
745
|
mainCam: t,
|
|
740
746
|
resolutionMainCam: o
|
|
@@ -742,25 +748,25 @@ class Js {
|
|
|
742
748
|
}
|
|
743
749
|
});
|
|
744
750
|
i(this, "_triggerMicControl", (e) => {
|
|
745
|
-
const t = e.getHeader(
|
|
751
|
+
const t = e.getHeader(Zt), n = e.getHeader(pe) === q.ADMIN_SYNC_FORCED;
|
|
746
752
|
t === k.ADMIN_START_MIC ? this._sessionEvents.trigger(oe, { isSyncForced: n }) : t === k.ADMIN_STOP_MIC && this._sessionEvents.trigger(re, { isSyncForced: n });
|
|
747
753
|
});
|
|
748
754
|
i(this, "_triggerUseLicense", (e) => {
|
|
749
|
-
const t = e.getHeader(
|
|
755
|
+
const t = e.getHeader(Kt);
|
|
750
756
|
this._sessionEvents.trigger(K, t);
|
|
751
757
|
});
|
|
752
758
|
i(this, "_handleNewInfo", (e) => {
|
|
753
759
|
const { originator: t } = e;
|
|
754
760
|
if (t !== "remote")
|
|
755
761
|
return;
|
|
756
|
-
const { request: s } = e, n = s.getHeader(
|
|
762
|
+
const { request: s } = e, n = s.getHeader(Yt);
|
|
757
763
|
if (n)
|
|
758
764
|
switch (n) {
|
|
759
|
-
case
|
|
765
|
+
case $t: {
|
|
760
766
|
this._triggerEnterRoom(s), this._maybeTriggerChannels(s);
|
|
761
767
|
break;
|
|
762
768
|
}
|
|
763
|
-
case
|
|
769
|
+
case as: {
|
|
764
770
|
this._maybeHandleNotify(s);
|
|
765
771
|
break;
|
|
766
772
|
}
|
|
@@ -768,25 +774,29 @@ class Js {
|
|
|
768
774
|
this._triggerShareState(s);
|
|
769
775
|
break;
|
|
770
776
|
}
|
|
771
|
-
case
|
|
777
|
+
case Pe: {
|
|
772
778
|
this._triggerMainCamControl(s);
|
|
773
779
|
break;
|
|
774
780
|
}
|
|
775
|
-
case
|
|
781
|
+
case zt: {
|
|
776
782
|
this._triggerMicControl(s);
|
|
777
783
|
break;
|
|
778
784
|
}
|
|
779
|
-
case
|
|
785
|
+
case Qt: {
|
|
780
786
|
this._triggerUseLicense(s);
|
|
781
787
|
break;
|
|
782
788
|
}
|
|
789
|
+
case rs: {
|
|
790
|
+
this._maybeTriggerParticipantMoveRequestToSpectators(s);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
783
793
|
}
|
|
784
794
|
});
|
|
785
795
|
i(this, "_handleSipEvent", ({ request: e }) => {
|
|
786
796
|
this._maybeHandleNotify(e);
|
|
787
797
|
});
|
|
788
798
|
i(this, "_maybeHandleNotify", (e) => {
|
|
789
|
-
const t = e.getHeader(
|
|
799
|
+
const t = e.getHeader(cs);
|
|
790
800
|
if (t) {
|
|
791
801
|
const s = JSON.parse(t);
|
|
792
802
|
this._handleNotify(s);
|
|
@@ -796,7 +806,7 @@ class Js {
|
|
|
796
806
|
const { originator: t } = e;
|
|
797
807
|
t === be && this._sessionEvents.trigger(te, e), this._restoreSession();
|
|
798
808
|
});
|
|
799
|
-
this.JsSIP = e, this._sessionEvents = new
|
|
809
|
+
this.JsSIP = e, this._sessionEvents = new Oe(_t), this._uaEvents = new Oe(Et), this._cancelableConnect = new N(
|
|
800
810
|
this._connect,
|
|
801
811
|
{
|
|
802
812
|
moduleName: g,
|
|
@@ -815,16 +825,16 @@ class Js {
|
|
|
815
825
|
}), this._cancelableCall = new N(
|
|
816
826
|
this._call,
|
|
817
827
|
{ 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(
|
|
828
|
+
), this._cancelableAnswer = new N(this._answer, { moduleName: g }), this._cancelableSendDTMF = new N(this._sendDTMF, { moduleName: g }), this.onSession(p, this._handleShareState), this.onSession(Ce, this._handleNewInfo), this.on(G, this._handleSipEvent), this.onSession(C, this._handleEnded), this.onSession(P, this._handleEnded);
|
|
819
829
|
}
|
|
820
830
|
async register() {
|
|
821
831
|
return new Promise((e, t) => {
|
|
822
|
-
this.isRegisterConfig && this.ua ? (this.ua.on(
|
|
832
|
+
this.isRegisterConfig && this.ua ? (this.ua.on(f, e), this.ua.on(O, t), this.ua.register()) : t(new Error("Config is not registered"));
|
|
823
833
|
});
|
|
824
834
|
}
|
|
825
835
|
async unregister() {
|
|
826
836
|
return new Promise((e, t) => {
|
|
827
|
-
this.isRegistered && this.ua ? (this.ua.on(
|
|
837
|
+
this.isRegistered && this.ua ? (this.ua.on($, e), this.ua.unregister()) : t(new Error("ua is not registered"));
|
|
828
838
|
});
|
|
829
839
|
}
|
|
830
840
|
async sendOptions(e, t, s) {
|
|
@@ -867,15 +877,15 @@ class Js {
|
|
|
867
877
|
sdpSemantics: o,
|
|
868
878
|
userAgent: e,
|
|
869
879
|
getSipServerUrl: E
|
|
870
|
-
}),
|
|
880
|
+
}), T = () => {
|
|
871
881
|
const l = new Error("Telephony is not available");
|
|
872
882
|
c(l);
|
|
873
883
|
};
|
|
874
|
-
h.once(
|
|
884
|
+
h.once(u, T);
|
|
875
885
|
const d = () => {
|
|
876
|
-
h.removeAllListeners(), h.once(
|
|
886
|
+
h.removeAllListeners(), h.once(u, a), h.stop();
|
|
877
887
|
};
|
|
878
|
-
h.once(
|
|
888
|
+
h.once(m, d), h.start();
|
|
879
889
|
});
|
|
880
890
|
}
|
|
881
891
|
async replaceMediaStream(e, t) {
|
|
@@ -886,13 +896,13 @@ class Js {
|
|
|
886
896
|
async askPermissionToEnableCam(e = {}) {
|
|
887
897
|
if (!this.session)
|
|
888
898
|
throw new Error("No session established");
|
|
889
|
-
const t = [
|
|
890
|
-
return this.session.sendInfo(
|
|
899
|
+
const t = [us];
|
|
900
|
+
return this.session.sendInfo(Pe, void 0, {
|
|
891
901
|
noTerminateWhenError: !0,
|
|
892
902
|
...e,
|
|
893
903
|
extraHeaders: t
|
|
894
904
|
}).catch((s) => {
|
|
895
|
-
if (
|
|
905
|
+
if (Rs(s))
|
|
896
906
|
throw s;
|
|
897
907
|
});
|
|
898
908
|
}
|
|
@@ -907,7 +917,7 @@ class Js {
|
|
|
907
917
|
}) {
|
|
908
918
|
const c = H(t);
|
|
909
919
|
this._streamPresentationCurrent = c;
|
|
910
|
-
const E = a ? [
|
|
920
|
+
const E = a ? [ds] : [Es], _ = e.sendInfo(M, void 0, {
|
|
911
921
|
extraHeaders: E
|
|
912
922
|
}).then(async () => e.startPresentation(
|
|
913
923
|
c,
|
|
@@ -917,8 +927,8 @@ class Js {
|
|
|
917
927
|
const { connection: h } = this;
|
|
918
928
|
if (!h || s === void 0)
|
|
919
929
|
return;
|
|
920
|
-
const
|
|
921
|
-
await
|
|
930
|
+
const T = h.getSenders();
|
|
931
|
+
await Ds(T, t, s);
|
|
922
932
|
}).then(() => t).catch((h) => {
|
|
923
933
|
throw this._sessionEvents.trigger(U, h), h;
|
|
924
934
|
});
|
|
@@ -946,7 +956,7 @@ class Js {
|
|
|
946
956
|
}
|
|
947
957
|
async sendMustStopPresentation(e) {
|
|
948
958
|
await e.sendInfo(M, void 0, {
|
|
949
|
-
extraHeaders: [
|
|
959
|
+
extraHeaders: [hs]
|
|
950
960
|
});
|
|
951
961
|
}
|
|
952
962
|
async stopPresentation({
|
|
@@ -954,12 +964,12 @@ class Js {
|
|
|
954
964
|
} = {}) {
|
|
955
965
|
const t = this._streamPresentationCurrent;
|
|
956
966
|
let s = this.promisePendingStartPresentation ?? Promise.resolve();
|
|
957
|
-
const n = e ? [
|
|
967
|
+
const n = e ? [ls] : [_s], o = this.establishedSession;
|
|
958
968
|
return o && t && (s = s.then(async () => o.sendInfo(M, void 0, {
|
|
959
969
|
extraHeaders: n
|
|
960
970
|
})).then(async () => o.stopPresentation(t)).catch((a) => {
|
|
961
971
|
throw this._sessionEvents.trigger(U, a), a;
|
|
962
|
-
})), !o && t && this._sessionEvents.trigger(
|
|
972
|
+
})), !o && t && this._sessionEvents.trigger(Ae, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
963
973
|
this._resetPresentation();
|
|
964
974
|
});
|
|
965
975
|
}
|
|
@@ -1023,7 +1033,7 @@ class Js {
|
|
|
1023
1033
|
if (!this.connection)
|
|
1024
1034
|
return;
|
|
1025
1035
|
const t = this.connection.getReceivers().map(({ track: s }) => s);
|
|
1026
|
-
return
|
|
1036
|
+
return Cs(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
|
|
1027
1037
|
}
|
|
1028
1038
|
get connection() {
|
|
1029
1039
|
var t;
|
|
@@ -1042,7 +1052,8 @@ class Js {
|
|
|
1042
1052
|
return this._cancelableConnect.requested || this._cancelableInitUa.requested || this._cancelableCall.requested || this._cancelableAnswer.requested;
|
|
1043
1053
|
}
|
|
1044
1054
|
get establishedSession() {
|
|
1045
|
-
|
|
1055
|
+
var e;
|
|
1056
|
+
return (e = this.session) != null && e.isEstablished() ? this.session : void 0;
|
|
1046
1057
|
}
|
|
1047
1058
|
get isRegistered() {
|
|
1048
1059
|
return !!this.ua && this.ua.isRegistered();
|
|
@@ -1100,21 +1111,21 @@ class Js {
|
|
|
1100
1111
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
1101
1112
|
if (!this.session)
|
|
1102
1113
|
throw new Error("No session established");
|
|
1103
|
-
const s = `${
|
|
1114
|
+
const s = `${Me}: ${e}`, n = `${De}: ${t}`, o = [
|
|
1104
1115
|
s,
|
|
1105
1116
|
n
|
|
1106
1117
|
];
|
|
1107
|
-
return this.session.sendInfo(
|
|
1118
|
+
return this.session.sendInfo(Gt, void 0, { extraHeaders: o });
|
|
1108
1119
|
}
|
|
1109
1120
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
1110
1121
|
if (!this.session)
|
|
1111
1122
|
throw new Error("No session established");
|
|
1112
|
-
const n = `${
|
|
1123
|
+
const n = `${ts}: currentstate`, o = `${ns}: ${Number(e)}`, a = `${is}: ${Number(t)}`, c = [
|
|
1113
1124
|
n,
|
|
1114
1125
|
o,
|
|
1115
1126
|
a
|
|
1116
1127
|
];
|
|
1117
|
-
return this.session.sendInfo(
|
|
1128
|
+
return this.session.sendInfo(Xt, void 0, {
|
|
1118
1129
|
noTerminateWhenError: !0,
|
|
1119
1130
|
...s,
|
|
1120
1131
|
extraHeaders: c
|
|
@@ -1123,8 +1134,8 @@ class Js {
|
|
|
1123
1134
|
async _sendRefusalToTurnOn(e, t = {}) {
|
|
1124
1135
|
if (!this.session)
|
|
1125
1136
|
throw new Error("No session established");
|
|
1126
|
-
const c = [`${
|
|
1127
|
-
return this.session.sendInfo(
|
|
1137
|
+
const c = [`${ss}: ${e === "mic" ? 0 : 1}`];
|
|
1138
|
+
return this.session.sendInfo(Jt, void 0, {
|
|
1128
1139
|
noTerminateWhenError: !0,
|
|
1129
1140
|
...t,
|
|
1130
1141
|
extraHeaders: c
|
|
@@ -1142,22 +1153,22 @@ class Js {
|
|
|
1142
1153
|
}
|
|
1143
1154
|
}
|
|
1144
1155
|
export {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1156
|
+
Ft as B,
|
|
1157
|
+
I as E,
|
|
1158
|
+
pt as N,
|
|
1148
1159
|
Le as R,
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1160
|
+
Zs as S,
|
|
1161
|
+
Et as U,
|
|
1162
|
+
Js as a,
|
|
1163
|
+
Qs as b,
|
|
1164
|
+
Xs as c,
|
|
1165
|
+
Ks as d,
|
|
1166
|
+
zs as e,
|
|
1156
1167
|
k as f,
|
|
1157
1168
|
q as g,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1169
|
+
js as h,
|
|
1170
|
+
Ss as i,
|
|
1171
|
+
_t as j,
|
|
1161
1172
|
ve as l,
|
|
1162
|
-
|
|
1173
|
+
Ms as s
|
|
1163
1174
|
};
|