sip-connector 14.1.0-alpha.0 → 14.1.0-alpha.10
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-Bkm1XX-8.cjs +1 -0
- package/dist/{SipConnector-CK3GgjXE.js → @SipConnector-D4tn0Ep5.js} +456 -680
- package/dist/{src/ApiManager → ApiManager}/@ApiManager.d.ts +2 -2
- package/dist/{src/ApiManager → ApiManager}/constants.d.ts +1 -1
- package/dist/ApiManager/index.d.ts +3 -0
- package/dist/{src/CallManager → CallManager}/causes.d.ts +2 -1
- package/dist/{src/CallManager → CallManager}/index.d.ts +2 -0
- package/dist/{src/CallManager → CallManager}/types.d.ts +1 -1
- package/dist/{src/ConnectionManager → ConnectionManager}/@ConnectionManager.d.ts +2 -1
- package/dist/{src/ConnectionManager → ConnectionManager}/ConnectionFlow.d.ts +2 -1
- package/dist/{src/IncomingCallManager → IncomingCallManager}/@IncomingCallManager.d.ts +3 -2
- package/dist/{src/PresentationManager → PresentationManager}/@PresentationManager.d.ts +2 -2
- package/dist/{src/PresentationManager → PresentationManager}/index.d.ts +1 -0
- package/dist/{src/SipConnector.d.ts → SipConnector/@SipConnector.d.ts} +19 -30
- package/dist/SipConnector/eventNames.d.ts +4 -0
- package/dist/SipConnector/index.d.ts +2 -0
- package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +10 -28
- package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +1 -1
- package/dist/{src → __fixtures__}/eventNames.d.ts +1 -1
- package/dist/doMock.cjs +1 -1
- package/dist/{src/doMock.d.ts → doMock.d.ts} +1 -1
- package/dist/doMock.js +212 -130
- package/dist/index.cjs +1 -1
- package/dist/{src/index.d.ts → index.d.ts} +9 -8
- package/dist/index.js +512 -546
- package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getLinkError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/prepareMediaStream.d.ts +1 -1
- package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/index.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +1 -1
- package/package.json +12 -21
- package/dist/SipConnector-CwI8aFEA.cjs +0 -1
- package/dist/src/ApiManager/index.d.ts +0 -2
- package/dist/src/causes.d.ts +0 -23
- package/dist/src/headers.d.ts +0 -37
- package/dist/src/types.d.ts +0 -69
- /package/dist/{src/ApiManager → ApiManager}/eventNames.d.ts +0 -0
- /package/dist/{src/ApiManager → ApiManager}/types.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/@CallManager.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/AbstractCallStrategy.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/MCUCallStrategy.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/RemoteStreamsManager.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/eventNames.d.ts +0 -0
- /package/dist/{src/CallManager → CallManager}/hasCanceledCallError.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/ConfigurationManager.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/ConnectionStateMachine.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/RegistrationManager.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/SipOperations.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/UAFactory.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/eventNames.d.ts +0 -0
- /package/dist/{src → ConnectionManager}/getExtraHeadersRemoteAddress.d.ts +0 -0
- /package/dist/{src/ConnectionManager → ConnectionManager}/index.d.ts +0 -0
- /package/dist/{src/IncomingCallManager → IncomingCallManager}/eventNames.d.ts +0 -0
- /package/dist/{src/IncomingCallManager → IncomingCallManager}/index.d.ts +0 -0
- /package/dist/{src/PresentationManager → PresentationManager}/constants.d.ts +0 -0
- /package/dist/{src/PresentationManager → PresentationManager}/eventNames.d.ts +0 -0
- /package/dist/{src/PresentationManager → PresentationManager}/types.d.ts +0 -0
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{src → __fixtures__}/constants.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
- /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{src/tools → tools}/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{src/tools → tools}/sendDtmfFAccumulated.d.ts +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
|
@@ -1,206 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import O from "events-constructor";
|
|
2
2
|
import "@krivega/cancelable-promise";
|
|
3
|
-
import
|
|
4
|
-
import { hasCanceledError as
|
|
5
|
-
import { setup as
|
|
6
|
-
const Nt = "Connection Error", At = "Request Timeout", _t = "SIP Failure Code", ut = "Internal Error", It = "Busy", Rt = "Rejected", Mt = "Redirected", Ot = "Unavailable", pt = "Not Found", Pt = "Address Incomplete", mt = "Incompatible SDP", ft = "Missing SDP", Dt = "Authentication Error", vt = "Terminated", yt = "WebRTC Error", Ut = "Canceled", bt = "No Answer", wt = "Expires", Lt = "No ACK", Ft = "Dialog Error", $t = "User Denied Media Access", Wt = "Bad Media Description", kt = "RTP Timeout", yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
|
-
__proto__: null,
|
|
8
|
-
ADDRESS_INCOMPLETE: Pt,
|
|
9
|
-
AUTHENTICATION_ERROR: Dt,
|
|
10
|
-
BAD_MEDIA_DESCRIPTION: Wt,
|
|
11
|
-
BUSY: It,
|
|
12
|
-
BYE: vt,
|
|
13
|
-
CANCELED: Ut,
|
|
14
|
-
CONNECTION_ERROR: Nt,
|
|
15
|
-
DIALOG_ERROR: Ft,
|
|
16
|
-
EXPIRES: wt,
|
|
17
|
-
INCOMPATIBLE_SDP: mt,
|
|
18
|
-
INTERNAL_ERROR: ut,
|
|
19
|
-
MISSING_SDP: ft,
|
|
20
|
-
NOT_FOUND: pt,
|
|
21
|
-
NO_ACK: Lt,
|
|
22
|
-
NO_ANSWER: bt,
|
|
23
|
-
REDIRECTED: Mt,
|
|
24
|
-
REJECTED: Rt,
|
|
25
|
-
REQUEST_TIMEOUT: At,
|
|
26
|
-
RTP_TIMEOUT: kt,
|
|
27
|
-
SIP_FAILURE_CODE: _t,
|
|
28
|
-
UNAVAILABLE: Ot,
|
|
29
|
-
USER_DENIED_MEDIA_ACCESS: $t,
|
|
30
|
-
WEBRTC_ERROR: yt
|
|
31
|
-
}, Symbol.toStringTag, { value: "Module" })), H = "incomingCall", B = "declinedIncomingCall", Y = "failedIncomingCall", q = "terminatedIncomingCall", k = "connecting", x = "connected", Q = "disconnected", z = "newRTCSession", J = "registered", X = "unregistered", j = "registrationFailed", K = "newMessage", Z = "sipEvent", ee = "availableSecondRemoteStream", te = "notAvailableSecondRemoteStream", ne = "mustStopPresentation", se = "shareState", ie = "enterRoom", re = "useLicense", ae = "peerconnection:confirmed", oe = "peerconnection:ontrack", ce = "channels", Te = "channels:notify", Ee = "ended:fromserver", ge = "main-cam-control", Se = "admin-stop-main-cam", de = "admin-start-main-cam", he = "admin-stop-mic", le = "admin-start-mic", Ce = "admin-force-sync-media-state", Ne = "participant:added-to-list-moderators", Ae = "participant:removed-from-list-moderators", _e = "participant:move-request-to-stream", ue = "participant:move-request-to-spectators", Ie = "participant:move-request-to-participants", Re = "participation:accepting-word-request", Me = "participation:cancelling-word-request", Oe = "webcast:started", pe = "webcast:stopped", Pe = "account:changed", me = "account:deleted", fe = "conference:participant-token-issued", De = "ended", ve = "sending", ye = "reinvite", Ue = "replaces", be = "refer", we = "progress", Le = "accepted", Fe = "confirmed", $e = "peerconnection", We = "failed", ke = "muted", Ve = "unmuted", Ge = "newDTMF", He = "newInfo", Be = "hold", Ye = "unhold", qe = "update", xe = "sdp", Qe = "icecandidate", ze = "getusermediafailed", Je = "peerconnection:createofferfailed", Xe = "peerconnection:createanswerfailed", je = "peerconnection:setlocaldescriptionfailed", Ke = "peerconnection:setremotedescriptionfailed", Ze = "presentation:start", et = "presentation:started", tt = "presentation:end", nt = "presentation:ended", st = "presentation:failed", Vt = "SPECTATOR", Gt = "PARTICIPANT", Ht = 1e6;
|
|
32
|
-
var it = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(it || {});
|
|
33
|
-
const Un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
34
|
-
__proto__: null,
|
|
35
|
-
ACCEPTED: Le,
|
|
36
|
-
ACCOUNT_CHANGED: Pe,
|
|
37
|
-
ACCOUNT_DELETED: me,
|
|
38
|
-
ADMIN_FORCE_SYNC_MEDIA_STATE: Ce,
|
|
39
|
-
ADMIN_START_MAIN_CAM: de,
|
|
40
|
-
ADMIN_START_MIC: le,
|
|
41
|
-
ADMIN_STOP_MAIN_CAM: Se,
|
|
42
|
-
ADMIN_STOP_MIC: he,
|
|
43
|
-
AVAILABLE_SECOND_REMOTE_STREAM_EVENT: ee,
|
|
44
|
-
CHANNELS: ce,
|
|
45
|
-
CHANNELS_NOTIFY: Te,
|
|
46
|
-
CONFERENCE_PARTICIPANT_TOKEN_ISSUED: fe,
|
|
47
|
-
CONFIRMED: Fe,
|
|
48
|
-
CONNECTED: x,
|
|
49
|
-
CONNECTING: k,
|
|
50
|
-
DECLINED_INCOMING_CALL: B,
|
|
51
|
-
DISCONNECTED: Q,
|
|
52
|
-
ENDED: De,
|
|
53
|
-
ENDED_FROM_SERVER: Ee,
|
|
54
|
-
ENTER_ROOM: ie,
|
|
55
|
-
FAILED: We,
|
|
56
|
-
FAILED_INCOMING_CALL: Y,
|
|
57
|
-
GET_USER_MEDIA_FAILED: ze,
|
|
58
|
-
HOLD: Be,
|
|
59
|
-
ICE_CANDIDATE: Qe,
|
|
60
|
-
INCOMING_CALL: H,
|
|
61
|
-
MAIN_CAM_CONTROL: ge,
|
|
62
|
-
MUST_STOP_PRESENTATION_EVENT: ne,
|
|
63
|
-
MUTED: ke,
|
|
64
|
-
NEW_DTMF: Ge,
|
|
65
|
-
NEW_INFO: He,
|
|
66
|
-
NEW_MESSAGE: K,
|
|
67
|
-
NEW_RTC_SESSION: z,
|
|
68
|
-
NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: te,
|
|
69
|
-
ONE_MEGABIT_IN_BITS: Ht,
|
|
70
|
-
Originator: it,
|
|
71
|
-
PARTICIPANT: Gt,
|
|
72
|
-
PARTICIPANT_ADDED_TO_LIST_MODERATORS: Ne,
|
|
73
|
-
PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS: Ie,
|
|
74
|
-
PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS: ue,
|
|
75
|
-
PARTICIPANT_MOVE_REQUEST_TO_STREAM: _e,
|
|
76
|
-
PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: Ae,
|
|
77
|
-
PARTICIPATION_ACCEPTING_WORD_REQUEST: Re,
|
|
78
|
-
PARTICIPATION_CANCELLING_WORD_REQUEST: Me,
|
|
79
|
-
PEER_CONNECTION: $e,
|
|
80
|
-
PEER_CONNECTION_CONFIRMED: ae,
|
|
81
|
-
PEER_CONNECTION_CREATE_ANSWER_FAILED: Xe,
|
|
82
|
-
PEER_CONNECTION_CREATE_OFFER_FAILED: Je,
|
|
83
|
-
PEER_CONNECTION_ONTRACK: oe,
|
|
84
|
-
PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: je,
|
|
85
|
-
PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: Ke,
|
|
86
|
-
PRESENTATION_END: tt,
|
|
87
|
-
PRESENTATION_ENDED: nt,
|
|
88
|
-
PRESENTATION_FAILED: st,
|
|
89
|
-
PRESENTATION_START: Ze,
|
|
90
|
-
PRESENTATION_STARTED: et,
|
|
91
|
-
PROGRESS: we,
|
|
92
|
-
REFER: be,
|
|
93
|
-
REGISTERED: J,
|
|
94
|
-
REGISTRATION_FAILED: j,
|
|
95
|
-
REINVITE: ye,
|
|
96
|
-
REPLACES: Ue,
|
|
97
|
-
SDP: xe,
|
|
98
|
-
SENDING: ve,
|
|
99
|
-
SHARE_STATE: se,
|
|
100
|
-
SIP_EVENT: Z,
|
|
101
|
-
SPECTATOR: Vt,
|
|
102
|
-
TERMINATED_INCOMING_CALL: q,
|
|
103
|
-
UNHOLD: Ye,
|
|
104
|
-
UNMUTED: Ve,
|
|
105
|
-
UNREGISTERED: X,
|
|
106
|
-
UPDATE: qe,
|
|
107
|
-
USE_LICENSE: re,
|
|
108
|
-
WEBCAST_STARTED: Oe,
|
|
109
|
-
WEBCAST_STOPPED: pe
|
|
110
|
-
}, Symbol.toStringTag, { value: "Module" })), rt = [
|
|
111
|
-
H,
|
|
112
|
-
B,
|
|
113
|
-
q,
|
|
114
|
-
Y,
|
|
115
|
-
Re,
|
|
116
|
-
Me,
|
|
117
|
-
_e,
|
|
118
|
-
Te,
|
|
119
|
-
fe,
|
|
120
|
-
Pe,
|
|
121
|
-
me,
|
|
122
|
-
Oe,
|
|
123
|
-
pe,
|
|
124
|
-
Ne,
|
|
125
|
-
Ae
|
|
126
|
-
], at = [
|
|
127
|
-
k,
|
|
128
|
-
x,
|
|
129
|
-
Q,
|
|
130
|
-
z,
|
|
131
|
-
J,
|
|
132
|
-
X,
|
|
133
|
-
j,
|
|
134
|
-
K,
|
|
135
|
-
Z
|
|
136
|
-
], ot = [
|
|
137
|
-
ee,
|
|
138
|
-
te,
|
|
139
|
-
ne,
|
|
140
|
-
se,
|
|
141
|
-
ie,
|
|
142
|
-
re,
|
|
143
|
-
ae,
|
|
144
|
-
oe,
|
|
145
|
-
ce,
|
|
146
|
-
Ee,
|
|
147
|
-
ge,
|
|
148
|
-
de,
|
|
149
|
-
Se,
|
|
150
|
-
he,
|
|
151
|
-
le,
|
|
152
|
-
Ce,
|
|
153
|
-
ue,
|
|
154
|
-
Ie
|
|
155
|
-
], ct = [
|
|
156
|
-
De,
|
|
157
|
-
k,
|
|
158
|
-
ve,
|
|
159
|
-
ye,
|
|
160
|
-
Ue,
|
|
161
|
-
be,
|
|
162
|
-
we,
|
|
163
|
-
Le,
|
|
164
|
-
Fe,
|
|
165
|
-
$e,
|
|
166
|
-
We,
|
|
167
|
-
ke,
|
|
168
|
-
Ve,
|
|
169
|
-
Ge,
|
|
170
|
-
He,
|
|
171
|
-
Be,
|
|
172
|
-
Ye,
|
|
173
|
-
qe,
|
|
174
|
-
xe,
|
|
175
|
-
Qe,
|
|
176
|
-
ze,
|
|
177
|
-
Je,
|
|
178
|
-
Xe,
|
|
179
|
-
je,
|
|
180
|
-
Ke,
|
|
181
|
-
Ze,
|
|
182
|
-
et,
|
|
183
|
-
tt,
|
|
184
|
-
nt,
|
|
185
|
-
st
|
|
186
|
-
], Bt = [...at, ...rt], Yt = [
|
|
187
|
-
...ct,
|
|
188
|
-
...ot
|
|
189
|
-
], bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
190
|
-
__proto__: null,
|
|
191
|
-
SESSION_EVENT_NAMES: Yt,
|
|
192
|
-
SESSION_JSSIP_EVENT_NAMES: ct,
|
|
193
|
-
SESSION_SYNTHETICS_EVENT_NAMES: ot,
|
|
194
|
-
UA_EVENT_NAMES: Bt,
|
|
195
|
-
UA_JSSIP_EVENT_NAMES: at,
|
|
196
|
-
UA_SYNTHETICS_EVENT_NAMES: rt
|
|
197
|
-
}, Symbol.toStringTag, { value: "Module" })), V = "sip-connector", P = W(V), wn = () => {
|
|
198
|
-
W.enable(V);
|
|
199
|
-
}, Ln = () => {
|
|
200
|
-
W.enable(`-${V}`);
|
|
201
|
-
};
|
|
3
|
+
import k from "debug";
|
|
4
|
+
import { hasCanceledError as K, repeatedCallsAsync as V } from "repeated-calls";
|
|
5
|
+
import { setup as j, createActor as Z } from "xstate";
|
|
202
6
|
var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n))(N || {}), U = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(U || {});
|
|
203
|
-
const
|
|
7
|
+
const H = [
|
|
204
8
|
"peerconnection",
|
|
205
9
|
"connecting",
|
|
206
10
|
"sending",
|
|
@@ -227,21 +31,21 @@ const Tt = [
|
|
|
227
31
|
"peerconnection:createanswerfailed",
|
|
228
32
|
"peerconnection:setlocaldescriptionfailed",
|
|
229
33
|
"peerconnection:setremotedescriptionfailed"
|
|
230
|
-
],
|
|
34
|
+
], ee = [
|
|
231
35
|
"peerconnection:confirmed",
|
|
232
36
|
"peerconnection:ontrack",
|
|
233
37
|
"ended:fromserver"
|
|
234
|
-
],
|
|
235
|
-
...
|
|
236
|
-
...
|
|
38
|
+
], G = [
|
|
39
|
+
...H,
|
|
40
|
+
...ee
|
|
237
41
|
];
|
|
238
|
-
function
|
|
42
|
+
function te(n) {
|
|
239
43
|
return (e) => `sip:${e}@${n}`;
|
|
240
44
|
}
|
|
241
|
-
const
|
|
45
|
+
const ne = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, B = (n) => n.trim().replaceAll(" ", "_"), se = ne(1e5, 99999999), ie = (n) => n.some((t) => {
|
|
242
46
|
const { kind: s } = t;
|
|
243
47
|
return s === "video";
|
|
244
|
-
}),
|
|
48
|
+
}), re = (n, e) => {
|
|
245
49
|
n.getVideoTracks().forEach((s) => {
|
|
246
50
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
247
51
|
});
|
|
@@ -253,9 +57,9 @@ const zt = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Et = (n) =>
|
|
|
253
57
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
254
58
|
return;
|
|
255
59
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
256
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
60
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && re(o, s), o;
|
|
257
61
|
};
|
|
258
|
-
class
|
|
62
|
+
class ae {
|
|
259
63
|
isPendingCall = !1;
|
|
260
64
|
isPendingAnswer = !1;
|
|
261
65
|
rtcSession;
|
|
@@ -266,8 +70,8 @@ class Kt {
|
|
|
266
70
|
this.events = e;
|
|
267
71
|
}
|
|
268
72
|
}
|
|
269
|
-
var
|
|
270
|
-
class
|
|
73
|
+
var x = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(x || {});
|
|
74
|
+
class oe {
|
|
271
75
|
remoteStreams = {};
|
|
272
76
|
reset() {
|
|
273
77
|
this.remoteStreams = {};
|
|
@@ -296,8 +100,8 @@ class Zt {
|
|
|
296
100
|
return e.map((t) => this.generateAudioStream(t));
|
|
297
101
|
}
|
|
298
102
|
}
|
|
299
|
-
class
|
|
300
|
-
remoteStreamsManager = new
|
|
103
|
+
class ce extends ae {
|
|
104
|
+
remoteStreamsManager = new oe();
|
|
301
105
|
disposers = /* @__PURE__ */ new Set();
|
|
302
106
|
constructor(e) {
|
|
303
107
|
super(e), e.on(N.FAILED, this.handleEnded), e.on(N.ENDED, this.handleEnded);
|
|
@@ -321,34 +125,35 @@ class en extends Kt {
|
|
|
321
125
|
ontrack: a,
|
|
322
126
|
iceServers: o,
|
|
323
127
|
directionVideo: c,
|
|
324
|
-
directionAudio:
|
|
325
|
-
contentHint:
|
|
326
|
-
offerToReceiveAudio:
|
|
327
|
-
offerToReceiveVideo:
|
|
328
|
-
sendEncodings:
|
|
128
|
+
directionAudio: g,
|
|
129
|
+
contentHint: d,
|
|
130
|
+
offerToReceiveAudio: S = !0,
|
|
131
|
+
offerToReceiveVideo: l = !0,
|
|
132
|
+
sendEncodings: E,
|
|
329
133
|
onAddedTransceiver: I
|
|
330
|
-
}) => (this.isPendingCall = !0, new Promise((C,
|
|
134
|
+
}) => (this.isPendingCall = !0, new Promise((C, p) => {
|
|
331
135
|
this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((b) => {
|
|
332
|
-
|
|
136
|
+
p(b);
|
|
333
137
|
}), this.rtcSession = e.call(t(s), {
|
|
334
138
|
extraHeaders: r,
|
|
335
139
|
mediaStream: v(i, {
|
|
336
140
|
directionVideo: c,
|
|
337
|
-
directionAudio:
|
|
338
|
-
contentHint:
|
|
141
|
+
directionAudio: g,
|
|
142
|
+
contentHint: d
|
|
339
143
|
}),
|
|
144
|
+
eventHandlers: this.events.triggers,
|
|
340
145
|
directionVideo: c,
|
|
341
|
-
directionAudio:
|
|
146
|
+
directionAudio: g,
|
|
342
147
|
pcConfig: {
|
|
343
148
|
iceServers: o
|
|
344
149
|
},
|
|
345
150
|
rtcOfferConstraints: {
|
|
346
|
-
offerToReceiveAudio:
|
|
347
|
-
offerToReceiveVideo:
|
|
151
|
+
offerToReceiveAudio: S,
|
|
152
|
+
offerToReceiveVideo: l
|
|
348
153
|
},
|
|
349
|
-
sendEncodings:
|
|
154
|
+
sendEncodings: E,
|
|
350
155
|
onAddedTransceiver: I
|
|
351
|
-
})
|
|
156
|
+
});
|
|
352
157
|
}).finally(() => {
|
|
353
158
|
this.isPendingCall = !1;
|
|
354
159
|
}));
|
|
@@ -356,7 +161,7 @@ class en extends Kt {
|
|
|
356
161
|
const { rtcSession: e } = this;
|
|
357
162
|
if (e && !e.isEnded())
|
|
358
163
|
return e.terminateAsync({
|
|
359
|
-
cause:
|
|
164
|
+
cause: x.CANCELED
|
|
360
165
|
}).finally(() => {
|
|
361
166
|
this.reset();
|
|
362
167
|
});
|
|
@@ -370,35 +175,35 @@ class en extends Kt {
|
|
|
370
175
|
directionVideo: a,
|
|
371
176
|
directionAudio: o,
|
|
372
177
|
offerToReceiveAudio: c,
|
|
373
|
-
offerToReceiveVideo:
|
|
374
|
-
contentHint:
|
|
375
|
-
sendEncodings:
|
|
376
|
-
onAddedTransceiver:
|
|
377
|
-
}) => (this.isPendingAnswer = !0, new Promise((
|
|
178
|
+
offerToReceiveVideo: g,
|
|
179
|
+
contentHint: d,
|
|
180
|
+
sendEncodings: S,
|
|
181
|
+
onAddedTransceiver: l
|
|
182
|
+
}) => (this.isPendingAnswer = !0, new Promise((E, I) => {
|
|
378
183
|
try {
|
|
379
184
|
const C = e();
|
|
380
|
-
this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(
|
|
185
|
+
this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(E).catch((b) => {
|
|
381
186
|
I(b);
|
|
382
187
|
});
|
|
383
|
-
const
|
|
188
|
+
const p = v(t, {
|
|
384
189
|
directionVideo: a,
|
|
385
190
|
directionAudio: o,
|
|
386
|
-
contentHint:
|
|
191
|
+
contentHint: d
|
|
387
192
|
});
|
|
388
193
|
C.answer({
|
|
389
194
|
extraHeaders: i,
|
|
390
195
|
directionVideo: a,
|
|
391
196
|
directionAudio: o,
|
|
392
|
-
mediaStream:
|
|
197
|
+
mediaStream: p,
|
|
393
198
|
pcConfig: {
|
|
394
199
|
iceServers: r
|
|
395
200
|
},
|
|
396
201
|
rtcOfferConstraints: {
|
|
397
202
|
offerToReceiveAudio: c,
|
|
398
|
-
offerToReceiveVideo:
|
|
203
|
+
offerToReceiveVideo: g
|
|
399
204
|
},
|
|
400
|
-
sendEncodings:
|
|
401
|
-
onAddedTransceiver:
|
|
205
|
+
sendEncodings: S,
|
|
206
|
+
onAddedTransceiver: l
|
|
402
207
|
});
|
|
403
208
|
} catch (C) {
|
|
404
209
|
I(C);
|
|
@@ -416,7 +221,7 @@ class en extends Kt {
|
|
|
416
221
|
if (!this.connection)
|
|
417
222
|
return;
|
|
418
223
|
const t = this.connection.getReceivers().map(({ track: s }) => s);
|
|
419
|
-
return
|
|
224
|
+
return ie(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
|
|
420
225
|
}
|
|
421
226
|
async replaceMediaStream(e, t) {
|
|
422
227
|
if (!this.rtcSession)
|
|
@@ -430,33 +235,33 @@ class en extends Kt {
|
|
|
430
235
|
ontrack: e
|
|
431
236
|
}) => new Promise((t, s) => {
|
|
432
237
|
const i = () => {
|
|
433
|
-
this.events.on(N.PEER_CONNECTION,
|
|
238
|
+
this.events.on(N.PEER_CONNECTION, d), this.events.on(N.CONFIRMED, S);
|
|
434
239
|
}, r = () => {
|
|
435
|
-
this.events.off(N.PEER_CONNECTION,
|
|
240
|
+
this.events.off(N.PEER_CONNECTION, d), this.events.off(N.CONFIRMED, S);
|
|
436
241
|
}, a = () => {
|
|
437
242
|
this.events.on(N.FAILED, c), this.events.on(N.ENDED, c);
|
|
438
243
|
}, o = () => {
|
|
439
244
|
this.events.off(N.FAILED, c), this.events.off(N.ENDED, c);
|
|
440
|
-
}, c = (
|
|
441
|
-
r(), o(), s(
|
|
245
|
+
}, c = (l) => {
|
|
246
|
+
r(), o(), s(l);
|
|
442
247
|
};
|
|
443
|
-
let
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
this.events.trigger(N.PEER_CONNECTION_ONTRACK,
|
|
248
|
+
let g;
|
|
249
|
+
const d = ({ peerconnection: l }) => {
|
|
250
|
+
g = l;
|
|
251
|
+
const E = (I) => {
|
|
252
|
+
this.events.trigger(N.PEER_CONNECTION_ONTRACK, l), e && e(I);
|
|
448
253
|
};
|
|
449
|
-
|
|
450
|
-
|
|
254
|
+
l.addEventListener("track", E), this.disposers.add(() => {
|
|
255
|
+
l.removeEventListener("track", E);
|
|
451
256
|
});
|
|
452
|
-
},
|
|
453
|
-
|
|
257
|
+
}, S = () => {
|
|
258
|
+
g !== void 0 && this.events.trigger(N.PEER_CONNECTION_CONFIRMED, g), r(), o(), t(g);
|
|
454
259
|
};
|
|
455
260
|
i(), a();
|
|
456
261
|
});
|
|
457
262
|
subscribeToSessionEvents(e) {
|
|
458
263
|
this.events.eachTriggers((t, s) => {
|
|
459
|
-
const i =
|
|
264
|
+
const i = H.find((r) => r === s);
|
|
460
265
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
461
266
|
e.off(i, t);
|
|
462
267
|
}));
|
|
@@ -475,11 +280,11 @@ class en extends Kt {
|
|
|
475
280
|
delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
|
|
476
281
|
};
|
|
477
282
|
}
|
|
478
|
-
class
|
|
283
|
+
class ge {
|
|
479
284
|
events;
|
|
480
285
|
strategy;
|
|
481
286
|
constructor(e) {
|
|
482
|
-
this.events = new
|
|
287
|
+
this.events = new O(G), this.strategy = e ?? new ce(this.events);
|
|
483
288
|
}
|
|
484
289
|
get requested() {
|
|
485
290
|
return this.strategy.requested;
|
|
@@ -523,179 +328,13 @@ class tn {
|
|
|
523
328
|
getRemoteStreams = () => this.strategy.getRemoteStreams();
|
|
524
329
|
replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
|
|
525
330
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
], sn = 1, Fn = (n) => ht(n);
|
|
534
|
-
class rn {
|
|
535
|
-
promisePendingStartPresentation;
|
|
536
|
-
promisePendingStopPresentation;
|
|
537
|
-
streamPresentationCurrent;
|
|
538
|
-
events;
|
|
539
|
-
cancelableSendPresentationWithRepeatedCalls;
|
|
540
|
-
callManager;
|
|
541
|
-
constructor({ callManager: e }) {
|
|
542
|
-
this.callManager = e, this.events = new D(nn), this.subscribe();
|
|
543
|
-
}
|
|
544
|
-
get isPendingPresentation() {
|
|
545
|
-
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
546
|
-
}
|
|
547
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
548
|
-
async startPresentation(e, t, {
|
|
549
|
-
isNeedReinvite: s,
|
|
550
|
-
maxBitrate: i,
|
|
551
|
-
contentHint: r,
|
|
552
|
-
sendEncodings: a,
|
|
553
|
-
onAddedTransceiver: o
|
|
554
|
-
} = {}, c) {
|
|
555
|
-
const T = this.getRtcSessionProtected();
|
|
556
|
-
if (this.streamPresentationCurrent)
|
|
557
|
-
throw new Error("Presentation is already started");
|
|
558
|
-
return this.sendPresentationWithDuplicatedCalls(e, {
|
|
559
|
-
rtcSession: T,
|
|
560
|
-
stream: t,
|
|
561
|
-
presentationOptions: {
|
|
562
|
-
isNeedReinvite: s,
|
|
563
|
-
maxBitrate: i,
|
|
564
|
-
contentHint: r,
|
|
565
|
-
sendEncodings: a,
|
|
566
|
-
onAddedTransceiver: o
|
|
567
|
-
},
|
|
568
|
-
options: c
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
async stopPresentation(e) {
|
|
572
|
-
this.cancelSendPresentationWithRepeatedCalls();
|
|
573
|
-
const t = this.streamPresentationCurrent;
|
|
574
|
-
let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
|
|
575
|
-
const i = this.callManager.getEstablishedRTCSession();
|
|
576
|
-
return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
|
|
577
|
-
throw this.events.trigger(R.FAILED_PRESENTATION, r), r;
|
|
578
|
-
}) : t && this.events.trigger(R.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
579
|
-
this.resetPresentation();
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
async updatePresentation(e, t, {
|
|
583
|
-
// maxBitrate,
|
|
584
|
-
contentHint: s,
|
|
585
|
-
sendEncodings: i,
|
|
586
|
-
onAddedTransceiver: r
|
|
587
|
-
} = {}) {
|
|
588
|
-
const a = this.getRtcSessionProtected();
|
|
589
|
-
if (!this.streamPresentationCurrent)
|
|
590
|
-
throw new Error("Presentation has not started yet");
|
|
591
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, a, t, {
|
|
592
|
-
// maxBitrate,
|
|
593
|
-
contentHint: s,
|
|
594
|
-
isNeedReinvite: !1,
|
|
595
|
-
sendEncodings: i,
|
|
596
|
-
onAddedTransceiver: r
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
cancelSendPresentationWithRepeatedCalls() {
|
|
600
|
-
this.cancelableSendPresentationWithRepeatedCalls?.cancel();
|
|
601
|
-
}
|
|
602
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
603
|
-
on(e, t) {
|
|
604
|
-
return this.events.on(e, t);
|
|
605
|
-
}
|
|
606
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
607
|
-
once(e, t) {
|
|
608
|
-
return this.events.once(e, t);
|
|
609
|
-
}
|
|
610
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
611
|
-
onceRace(e, t) {
|
|
612
|
-
return this.events.onceRace(e, t);
|
|
613
|
-
}
|
|
614
|
-
async wait(e) {
|
|
615
|
-
return this.events.wait(e);
|
|
616
|
-
}
|
|
617
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
618
|
-
off(e, t) {
|
|
619
|
-
this.events.off(e, t);
|
|
620
|
-
}
|
|
621
|
-
subscribe() {
|
|
622
|
-
this.callManager.on("presentation:start", (e) => {
|
|
623
|
-
this.events.trigger(R.START_PRESENTATION, e);
|
|
624
|
-
}), this.callManager.on("presentation:started", (e) => {
|
|
625
|
-
this.events.trigger(R.STARTED_PRESENTATION, e);
|
|
626
|
-
}), this.callManager.on("presentation:end", (e) => {
|
|
627
|
-
this.events.trigger(R.END_PRESENTATION, e);
|
|
628
|
-
}), this.callManager.on("presentation:ended", (e) => {
|
|
629
|
-
this.events.trigger(R.ENDED_PRESENTATION, e);
|
|
630
|
-
}), this.callManager.on("presentation:failed", (e) => {
|
|
631
|
-
this.events.trigger(R.FAILED_PRESENTATION, e);
|
|
632
|
-
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
633
|
-
}
|
|
634
|
-
async sendPresentationWithDuplicatedCalls(e, {
|
|
635
|
-
rtcSession: t,
|
|
636
|
-
stream: s,
|
|
637
|
-
presentationOptions: i,
|
|
638
|
-
options: r = {
|
|
639
|
-
callLimit: sn
|
|
640
|
-
}
|
|
641
|
-
}) {
|
|
642
|
-
const a = async () => this.sendPresentation(
|
|
643
|
-
e,
|
|
644
|
-
t,
|
|
645
|
-
s,
|
|
646
|
-
i
|
|
647
|
-
), o = () => !!this.streamPresentationCurrent;
|
|
648
|
-
return this.cancelableSendPresentationWithRepeatedCalls = G({
|
|
649
|
-
targetFunction: a,
|
|
650
|
-
isComplete: o,
|
|
651
|
-
isRejectAsValid: !0,
|
|
652
|
-
...r
|
|
653
|
-
}), this.cancelableSendPresentationWithRepeatedCalls.then((c) => c);
|
|
654
|
-
}
|
|
655
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
656
|
-
async sendPresentation(e, t, s, {
|
|
657
|
-
// maxBitrate = ONE_MEGABIT_IN_BITS,
|
|
658
|
-
isNeedReinvite: i = !0,
|
|
659
|
-
contentHint: r = "detail",
|
|
660
|
-
sendEncodings: a,
|
|
661
|
-
onAddedTransceiver: o
|
|
662
|
-
}) {
|
|
663
|
-
const c = v(s, { contentHint: r });
|
|
664
|
-
if (c === void 0)
|
|
665
|
-
throw new Error("No streamPresentationTarget");
|
|
666
|
-
this.streamPresentationCurrent = c;
|
|
667
|
-
const T = e().then(async () => t.startPresentation(c, i, {
|
|
668
|
-
sendEncodings: a,
|
|
669
|
-
onAddedTransceiver: o
|
|
670
|
-
})).then(() => s).catch((S) => {
|
|
671
|
-
throw this.removeStreamPresentationCurrent(), this.events.trigger(R.FAILED_PRESENTATION, S), S;
|
|
672
|
-
});
|
|
673
|
-
return this.promisePendingStartPresentation = T, T.finally(() => {
|
|
674
|
-
this.promisePendingStartPresentation = void 0;
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
getRtcSessionProtected = () => {
|
|
678
|
-
const e = this.callManager.getEstablishedRTCSession();
|
|
679
|
-
if (!e)
|
|
680
|
-
throw new Error("No rtcSession established");
|
|
681
|
-
return e;
|
|
682
|
-
};
|
|
683
|
-
handleEnded = () => {
|
|
684
|
-
this.reset();
|
|
685
|
-
};
|
|
686
|
-
reset() {
|
|
687
|
-
this.cancelSendPresentationWithRepeatedCalls(), this.resetPresentation();
|
|
688
|
-
}
|
|
689
|
-
resetPresentation() {
|
|
690
|
-
this.removeStreamPresentationCurrent(), this.promisePendingStartPresentation = void 0, this.promisePendingStopPresentation = void 0;
|
|
691
|
-
}
|
|
692
|
-
removeStreamPresentationCurrent() {
|
|
693
|
-
delete this.streamPresentationCurrent;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
const an = "Error decline with 603", on = 1006, cn = (n) => typeof n == "object" && n !== null && "code" in n && n.code === on, Tn = (n) => n.message === an;
|
|
697
|
-
var g = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE_NAME = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(g || {}), y = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(y || {}), w = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(w || {}), M = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(M || {}), u = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(u || {}), m = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(m || {}), L = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(F || {}), E = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(E || {});
|
|
698
|
-
const En = [
|
|
331
|
+
const W = "sip-connector", P = k(W), He = () => {
|
|
332
|
+
k.enable(W);
|
|
333
|
+
}, Ge = () => {
|
|
334
|
+
k.enable(`-${W}`);
|
|
335
|
+
}, Te = "Error decline with 603", he = 1006, de = (n) => typeof n == "object" && n !== null && "code" in n && n.code === he, le = (n) => n.message === Te;
|
|
336
|
+
var h = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(h || {}), y = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(y || {}), w = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(w || {}), M = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(M || {}), _ = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(_ || {}), f = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(f || {}), L = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(F || {}), Ee = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Ee || {}), T = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(T || {});
|
|
337
|
+
const q = [
|
|
699
338
|
"participation:accepting-word-request",
|
|
700
339
|
"participation:cancelling-word-request",
|
|
701
340
|
"participant:move-request-to-stream",
|
|
@@ -724,8 +363,8 @@ const En = [
|
|
|
724
363
|
"mustStopPresentation",
|
|
725
364
|
"newDTMF"
|
|
726
365
|
];
|
|
727
|
-
var
|
|
728
|
-
class
|
|
366
|
+
var A = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(A || {});
|
|
367
|
+
class Se {
|
|
729
368
|
events;
|
|
730
369
|
connectionManager;
|
|
731
370
|
callManager;
|
|
@@ -733,13 +372,13 @@ class gn {
|
|
|
733
372
|
connectionManager: e,
|
|
734
373
|
callManager: t
|
|
735
374
|
}) {
|
|
736
|
-
this.connectionManager = e, this.callManager = t, this.events = new
|
|
375
|
+
this.connectionManager = e, this.callManager = t, this.events = new O(q), this.subscribe();
|
|
737
376
|
}
|
|
738
377
|
async waitChannels() {
|
|
739
|
-
return this.wait(
|
|
378
|
+
return this.wait(T.CHANNELS);
|
|
740
379
|
}
|
|
741
380
|
async waitSyncMediaState() {
|
|
742
|
-
return this.wait(
|
|
381
|
+
return this.wait(T.ADMIN_FORCE_SYNC_MEDIA_STATE);
|
|
743
382
|
}
|
|
744
383
|
async sendDTMF(e) {
|
|
745
384
|
return new Promise((t, s) => {
|
|
@@ -760,22 +399,22 @@ class gn {
|
|
|
760
399
|
const s = this.callManager.getEstablishedRTCSession();
|
|
761
400
|
if (!s)
|
|
762
401
|
throw new Error("No rtcSession established");
|
|
763
|
-
const i = `${
|
|
402
|
+
const i = `${h.INPUT_CHANNELS}: ${e}`, r = `${h.OUTPUT_CHANNELS}: ${t}`, a = [
|
|
764
403
|
i,
|
|
765
404
|
r
|
|
766
405
|
];
|
|
767
|
-
return s.sendInfo(
|
|
406
|
+
return s.sendInfo(_.CHANNELS, void 0, { extraHeaders: a });
|
|
768
407
|
}
|
|
769
408
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
770
409
|
const i = this.callManager.getEstablishedRTCSession();
|
|
771
410
|
if (!i)
|
|
772
411
|
throw new Error("No rtcSession established");
|
|
773
|
-
const r = `${
|
|
412
|
+
const r = `${h.MEDIA_STATE}: currentstate`, a = `${h.MAIN_CAM_STATE}: ${Number(e)}`, o = `${h.MIC_STATE}: ${Number(t)}`, c = [
|
|
774
413
|
r,
|
|
775
414
|
a,
|
|
776
415
|
o
|
|
777
416
|
];
|
|
778
|
-
return i.sendInfo(
|
|
417
|
+
return i.sendInfo(_.MEDIA_STATE, void 0, {
|
|
779
418
|
noTerminateWhenError: !0,
|
|
780
419
|
...s,
|
|
781
420
|
extraHeaders: c
|
|
@@ -785,8 +424,8 @@ class gn {
|
|
|
785
424
|
const s = this.callManager.getEstablishedRTCSession();
|
|
786
425
|
if (!s)
|
|
787
426
|
throw new Error("No rtcSession established");
|
|
788
|
-
const a = e === "mic" ? 0 : 1, c = [`${
|
|
789
|
-
return s.sendInfo(
|
|
427
|
+
const a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
|
|
428
|
+
return s.sendInfo(_.REFUSAL, void 0, {
|
|
790
429
|
noTerminateWhenError: !0,
|
|
791
430
|
...t,
|
|
792
431
|
extraHeaders: c
|
|
@@ -806,53 +445,53 @@ class gn {
|
|
|
806
445
|
const e = this.callManager.getEstablishedRTCSession();
|
|
807
446
|
if (!e)
|
|
808
447
|
throw new Error("No rtcSession established");
|
|
809
|
-
await e.sendInfo(
|
|
810
|
-
extraHeaders: [
|
|
448
|
+
await e.sendInfo(_.SHARE_STATE, void 0, {
|
|
449
|
+
extraHeaders: [h.MUST_STOP_PRESENTATION_P2P]
|
|
811
450
|
});
|
|
812
451
|
}
|
|
813
452
|
async sendStoppedPresentationP2P() {
|
|
814
453
|
const e = this.callManager.getEstablishedRTCSession();
|
|
815
454
|
if (!e)
|
|
816
455
|
throw new Error("No rtcSession established");
|
|
817
|
-
await e.sendInfo(
|
|
818
|
-
extraHeaders: [
|
|
456
|
+
await e.sendInfo(_.SHARE_STATE, void 0, {
|
|
457
|
+
extraHeaders: [h.STOP_PRESENTATION_P2P]
|
|
819
458
|
});
|
|
820
459
|
}
|
|
821
460
|
async sendStoppedPresentation() {
|
|
822
461
|
const e = this.callManager.getEstablishedRTCSession();
|
|
823
462
|
if (!e)
|
|
824
463
|
throw new Error("No rtcSession established");
|
|
825
|
-
await e.sendInfo(
|
|
826
|
-
extraHeaders: [
|
|
464
|
+
await e.sendInfo(_.SHARE_STATE, void 0, {
|
|
465
|
+
extraHeaders: [h.STOP_PRESENTATION]
|
|
827
466
|
});
|
|
828
467
|
}
|
|
829
468
|
async askPermissionToStartPresentationP2P() {
|
|
830
469
|
const e = this.callManager.getEstablishedRTCSession();
|
|
831
470
|
if (!e)
|
|
832
471
|
throw new Error("No rtcSession established");
|
|
833
|
-
await e.sendInfo(
|
|
834
|
-
extraHeaders: [
|
|
472
|
+
await e.sendInfo(_.SHARE_STATE, void 0, {
|
|
473
|
+
extraHeaders: [h.START_PRESENTATION_P2P]
|
|
835
474
|
});
|
|
836
475
|
}
|
|
837
476
|
async askPermissionToStartPresentation() {
|
|
838
477
|
const e = this.callManager.getEstablishedRTCSession();
|
|
839
478
|
if (!e)
|
|
840
479
|
throw new Error("No rtcSession established");
|
|
841
|
-
await e.sendInfo(
|
|
842
|
-
extraHeaders: [
|
|
480
|
+
await e.sendInfo(_.SHARE_STATE, void 0, {
|
|
481
|
+
extraHeaders: [h.START_PRESENTATION]
|
|
843
482
|
});
|
|
844
483
|
}
|
|
845
484
|
async askPermissionToEnableCam(e = {}) {
|
|
846
485
|
const t = this.callManager.getEstablishedRTCSession();
|
|
847
486
|
if (!t)
|
|
848
487
|
throw new Error("No rtcSession established");
|
|
849
|
-
const s = [
|
|
850
|
-
return t.sendInfo(
|
|
488
|
+
const s = [h.ENABLE_MAIN_CAM];
|
|
489
|
+
return t.sendInfo(_.MAIN_CAM, void 0, {
|
|
851
490
|
noTerminateWhenError: !0,
|
|
852
491
|
...e,
|
|
853
492
|
extraHeaders: s
|
|
854
493
|
}).catch((i) => {
|
|
855
|
-
if (
|
|
494
|
+
if (le(i))
|
|
856
495
|
throw i;
|
|
857
496
|
});
|
|
858
497
|
}
|
|
@@ -885,7 +524,7 @@ class gn {
|
|
|
885
524
|
};
|
|
886
525
|
maybeHandleNotify = (e) => {
|
|
887
526
|
try {
|
|
888
|
-
const t = e.getHeader(
|
|
527
|
+
const t = e.getHeader(h.NOTIFY);
|
|
889
528
|
if (t) {
|
|
890
529
|
const s = JSON.parse(t);
|
|
891
530
|
this.handleNotify(s);
|
|
@@ -896,55 +535,55 @@ class gn {
|
|
|
896
535
|
};
|
|
897
536
|
handleNotify = (e) => {
|
|
898
537
|
switch (e.cmd) {
|
|
899
|
-
case
|
|
538
|
+
case A.CHANNELS: {
|
|
900
539
|
const t = e;
|
|
901
540
|
this.triggerChannelsNotify(t);
|
|
902
541
|
break;
|
|
903
542
|
}
|
|
904
|
-
case
|
|
543
|
+
case A.WEBCAST_STARTED: {
|
|
905
544
|
const t = e;
|
|
906
545
|
this.triggerWebcastStartedNotify(t);
|
|
907
546
|
break;
|
|
908
547
|
}
|
|
909
|
-
case
|
|
548
|
+
case A.WEBCAST_STOPPED: {
|
|
910
549
|
const t = e;
|
|
911
550
|
this.triggerWebcastStoppedNotify(t);
|
|
912
551
|
break;
|
|
913
552
|
}
|
|
914
|
-
case
|
|
553
|
+
case A.ADDED_TO_LIST_MODERATORS: {
|
|
915
554
|
const t = e;
|
|
916
555
|
this.triggerAddedToListModeratorsNotify(t);
|
|
917
556
|
break;
|
|
918
557
|
}
|
|
919
|
-
case
|
|
558
|
+
case A.REMOVED_FROM_LIST_MODERATORS: {
|
|
920
559
|
const t = e;
|
|
921
560
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
922
561
|
break;
|
|
923
562
|
}
|
|
924
|
-
case
|
|
563
|
+
case A.ACCEPTING_WORD_REQUEST: {
|
|
925
564
|
const t = e;
|
|
926
565
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
927
566
|
break;
|
|
928
567
|
}
|
|
929
|
-
case
|
|
568
|
+
case A.CANCELLING_WORD_REQUEST: {
|
|
930
569
|
const t = e;
|
|
931
570
|
this.triggerParticipationCancellingWordRequest(t);
|
|
932
571
|
break;
|
|
933
572
|
}
|
|
934
|
-
case
|
|
573
|
+
case A.MOVE_REQUEST_TO_STREAM: {
|
|
935
574
|
const t = e;
|
|
936
575
|
this.triggerParticipantMoveRequestToStream(t);
|
|
937
576
|
break;
|
|
938
577
|
}
|
|
939
|
-
case
|
|
578
|
+
case A.ACCOUNT_CHANGED: {
|
|
940
579
|
this.triggerAccountChangedNotify();
|
|
941
580
|
break;
|
|
942
581
|
}
|
|
943
|
-
case
|
|
582
|
+
case A.ACCOUNT_DELETED: {
|
|
944
583
|
this.triggerAccountDeletedNotify();
|
|
945
584
|
break;
|
|
946
585
|
}
|
|
947
|
-
case
|
|
586
|
+
case A.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
948
587
|
const t = e;
|
|
949
588
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
950
589
|
break;
|
|
@@ -957,7 +596,7 @@ class gn {
|
|
|
957
596
|
const { originator: t } = e;
|
|
958
597
|
if (t !== U.REMOTE)
|
|
959
598
|
return;
|
|
960
|
-
const { request: s } = e, i = s.getHeader(
|
|
599
|
+
const { request: s } = e, i = s.getHeader(h.CONTENT_TYPE);
|
|
961
600
|
if (i !== void 0)
|
|
962
601
|
switch (i) {
|
|
963
602
|
case M.ENTER_ROOM: {
|
|
@@ -995,7 +634,7 @@ class gn {
|
|
|
995
634
|
inputChannels: t,
|
|
996
635
|
outputChannels: s
|
|
997
636
|
};
|
|
998
|
-
this.events.trigger(
|
|
637
|
+
this.events.trigger(T.CHANNELS_NOTIFY, i);
|
|
999
638
|
};
|
|
1000
639
|
triggerWebcastStartedNotify = ({
|
|
1001
640
|
body: { conference: e, type: t }
|
|
@@ -1004,7 +643,7 @@ class gn {
|
|
|
1004
643
|
conference: e,
|
|
1005
644
|
type: t
|
|
1006
645
|
};
|
|
1007
|
-
this.events.trigger(
|
|
646
|
+
this.events.trigger(T.WEBCAST_STARTED, s);
|
|
1008
647
|
};
|
|
1009
648
|
triggerWebcastStoppedNotify = ({
|
|
1010
649
|
body: { conference: e, type: t }
|
|
@@ -1013,7 +652,7 @@ class gn {
|
|
|
1013
652
|
conference: e,
|
|
1014
653
|
type: t
|
|
1015
654
|
};
|
|
1016
|
-
this.events.trigger(
|
|
655
|
+
this.events.trigger(T.WEBCAST_STOPPED, s);
|
|
1017
656
|
};
|
|
1018
657
|
triggerAddedToListModeratorsNotify = ({
|
|
1019
658
|
conference: e
|
|
@@ -1022,7 +661,7 @@ class gn {
|
|
|
1022
661
|
conference: e
|
|
1023
662
|
};
|
|
1024
663
|
this.events.trigger(
|
|
1025
|
-
|
|
664
|
+
T.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
|
|
1026
665
|
t
|
|
1027
666
|
);
|
|
1028
667
|
};
|
|
@@ -1033,7 +672,7 @@ class gn {
|
|
|
1033
672
|
conference: e
|
|
1034
673
|
};
|
|
1035
674
|
this.events.trigger(
|
|
1036
|
-
|
|
675
|
+
T.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
|
|
1037
676
|
t
|
|
1038
677
|
);
|
|
1039
678
|
};
|
|
@@ -1043,7 +682,7 @@ class gn {
|
|
|
1043
682
|
const t = {
|
|
1044
683
|
conference: e
|
|
1045
684
|
};
|
|
1046
|
-
this.events.trigger(
|
|
685
|
+
this.events.trigger(T.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
|
|
1047
686
|
};
|
|
1048
687
|
triggerParticipationCancellingWordRequest = ({
|
|
1049
688
|
body: { conference: e }
|
|
@@ -1051,7 +690,7 @@ class gn {
|
|
|
1051
690
|
const t = {
|
|
1052
691
|
conference: e
|
|
1053
692
|
};
|
|
1054
|
-
this.events.trigger(
|
|
693
|
+
this.events.trigger(T.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
|
|
1055
694
|
};
|
|
1056
695
|
triggerParticipantMoveRequestToStream = ({
|
|
1057
696
|
body: { conference: e }
|
|
@@ -1059,13 +698,13 @@ class gn {
|
|
|
1059
698
|
const t = {
|
|
1060
699
|
conference: e
|
|
1061
700
|
};
|
|
1062
|
-
this.events.trigger(
|
|
701
|
+
this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
|
|
1063
702
|
};
|
|
1064
703
|
triggerAccountChangedNotify = () => {
|
|
1065
|
-
this.events.trigger(
|
|
704
|
+
this.events.trigger(T.ACCOUNT_CHANGED, void 0);
|
|
1066
705
|
};
|
|
1067
706
|
triggerAccountDeletedNotify = () => {
|
|
1068
|
-
this.events.trigger(
|
|
707
|
+
this.events.trigger(T.ACCOUNT_DELETED, void 0);
|
|
1069
708
|
};
|
|
1070
709
|
triggerConferenceParticipantTokenIssued = ({
|
|
1071
710
|
body: { conference: e, participant: t, jwt: s }
|
|
@@ -1076,73 +715,243 @@ class gn {
|
|
|
1076
715
|
jwt: s
|
|
1077
716
|
};
|
|
1078
717
|
this.events.trigger(
|
|
1079
|
-
|
|
718
|
+
T.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
|
|
1080
719
|
i
|
|
1081
720
|
);
|
|
1082
721
|
};
|
|
1083
722
|
maybeTriggerChannels = (e) => {
|
|
1084
|
-
const t = e.getHeader(
|
|
723
|
+
const t = e.getHeader(h.INPUT_CHANNELS), s = e.getHeader(h.OUTPUT_CHANNELS);
|
|
1085
724
|
if (t && s) {
|
|
1086
725
|
const i = {
|
|
1087
726
|
inputChannels: t,
|
|
1088
727
|
outputChannels: s
|
|
1089
728
|
};
|
|
1090
|
-
this.events.trigger(
|
|
729
|
+
this.events.trigger(T.CHANNELS, i);
|
|
1091
730
|
}
|
|
1092
731
|
};
|
|
1093
732
|
triggerEnterRoom = (e) => {
|
|
1094
|
-
const t = e.getHeader(
|
|
1095
|
-
this.events.trigger(
|
|
733
|
+
const t = e.getHeader(h.CONTENT_ENTER_ROOM), s = e.getHeader(h.PARTICIPANT_NAME);
|
|
734
|
+
this.events.trigger(T.ENTER_ROOM, { room: t, participantName: s });
|
|
1096
735
|
};
|
|
1097
736
|
triggerShareState = (e) => {
|
|
1098
|
-
const t = e.getHeader(
|
|
737
|
+
const t = e.getHeader(h.CONTENT_SHARE_STATE);
|
|
1099
738
|
if (t !== void 0)
|
|
1100
739
|
switch (t) {
|
|
1101
740
|
case y.AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
1102
|
-
this.events.trigger(
|
|
741
|
+
this.events.trigger(T.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
|
|
1103
742
|
break;
|
|
1104
743
|
}
|
|
1105
744
|
case y.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
1106
|
-
this.events.trigger(
|
|
745
|
+
this.events.trigger(T.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
|
|
1107
746
|
break;
|
|
1108
747
|
}
|
|
1109
748
|
case y.MUST_STOP_PRESENTATION: {
|
|
1110
|
-
this.events.trigger(
|
|
749
|
+
this.events.trigger(T.MUST_STOP_PRESENTATION, void 0);
|
|
1111
750
|
break;
|
|
1112
751
|
}
|
|
1113
752
|
}
|
|
1114
753
|
};
|
|
1115
754
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
1116
|
-
const t = e.getHeader(
|
|
1117
|
-
t === w.SPECTATOR && this.events.trigger(
|
|
755
|
+
const t = e.getHeader(h.CONTENT_PARTICIPANT_STATE);
|
|
756
|
+
t === w.SPECTATOR && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === w.PARTICIPANT && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0);
|
|
1118
757
|
};
|
|
1119
758
|
triggerMainCamControl = (e) => {
|
|
1120
|
-
const t = e.getHeader(
|
|
1121
|
-
if (t ===
|
|
1122
|
-
this.events.trigger(
|
|
759
|
+
const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), i = s === F.ADMIN_SYNC_FORCED;
|
|
760
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
761
|
+
this.events.trigger(T.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
1123
762
|
return;
|
|
1124
763
|
}
|
|
1125
|
-
if (t ===
|
|
1126
|
-
this.events.trigger(
|
|
764
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
765
|
+
this.events.trigger(T.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
1127
766
|
return;
|
|
1128
767
|
}
|
|
1129
|
-
(t ===
|
|
1130
|
-
const r = e.getHeader(
|
|
1131
|
-
this.events.trigger(
|
|
768
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(T.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
769
|
+
const r = e.getHeader(h.MAIN_CAM_RESOLUTION);
|
|
770
|
+
this.events.trigger(T.MAIN_CAM_CONTROL, {
|
|
1132
771
|
mainCam: t,
|
|
1133
772
|
resolutionMainCam: r
|
|
1134
773
|
});
|
|
1135
774
|
};
|
|
1136
775
|
triggerMicControl = (e) => {
|
|
1137
|
-
const t = e.getHeader(
|
|
1138
|
-
t === L.ADMIN_START_MIC ? this.events.trigger(
|
|
776
|
+
const t = e.getHeader(h.MIC), i = e.getHeader(h.MEDIA_SYNC) === F.ADMIN_SYNC_FORCED;
|
|
777
|
+
t === L.ADMIN_START_MIC ? this.events.trigger(T.ADMIN_START_MIC, { isSyncForced: i }) : t === L.ADMIN_STOP_MIC && this.events.trigger(T.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
1139
778
|
};
|
|
1140
779
|
triggerUseLicense = (e) => {
|
|
1141
|
-
const t = e.getHeader(
|
|
1142
|
-
this.events.trigger(
|
|
780
|
+
const t = e.getHeader(h.CONTENT_USE_LICENSE);
|
|
781
|
+
this.events.trigger(T.USE_LICENSE, t);
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
var R = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(R || {});
|
|
785
|
+
const Y = [
|
|
786
|
+
"presentation:start",
|
|
787
|
+
"presentation:started",
|
|
788
|
+
"presentation:end",
|
|
789
|
+
"presentation:ended",
|
|
790
|
+
"presentation:failed"
|
|
791
|
+
], Ce = 1, Be = (n) => K(n);
|
|
792
|
+
class Ne {
|
|
793
|
+
events;
|
|
794
|
+
promisePendingStartPresentation;
|
|
795
|
+
promisePendingStopPresentation;
|
|
796
|
+
streamPresentationCurrent;
|
|
797
|
+
cancelableSendPresentationWithRepeatedCalls;
|
|
798
|
+
callManager;
|
|
799
|
+
constructor({ callManager: e }) {
|
|
800
|
+
this.callManager = e, this.events = new O(Y), this.subscribe();
|
|
801
|
+
}
|
|
802
|
+
get isPendingPresentation() {
|
|
803
|
+
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
804
|
+
}
|
|
805
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
806
|
+
async startPresentation(e, t, {
|
|
807
|
+
isNeedReinvite: s,
|
|
808
|
+
maxBitrate: i,
|
|
809
|
+
contentHint: r,
|
|
810
|
+
sendEncodings: a,
|
|
811
|
+
onAddedTransceiver: o
|
|
812
|
+
} = {}, c) {
|
|
813
|
+
const g = this.getRtcSessionProtected();
|
|
814
|
+
if (this.streamPresentationCurrent)
|
|
815
|
+
throw new Error("Presentation is already started");
|
|
816
|
+
return this.sendPresentationWithDuplicatedCalls(e, {
|
|
817
|
+
rtcSession: g,
|
|
818
|
+
stream: t,
|
|
819
|
+
presentationOptions: {
|
|
820
|
+
isNeedReinvite: s,
|
|
821
|
+
maxBitrate: i,
|
|
822
|
+
contentHint: r,
|
|
823
|
+
sendEncodings: a,
|
|
824
|
+
onAddedTransceiver: o
|
|
825
|
+
},
|
|
826
|
+
options: c
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
async stopPresentation(e) {
|
|
830
|
+
this.cancelSendPresentationWithRepeatedCalls();
|
|
831
|
+
const t = this.streamPresentationCurrent;
|
|
832
|
+
let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
|
|
833
|
+
const i = this.callManager.getEstablishedRTCSession();
|
|
834
|
+
return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
|
|
835
|
+
throw this.events.trigger(R.FAILED_PRESENTATION, r), r;
|
|
836
|
+
}) : t && this.events.trigger(R.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
837
|
+
this.resetPresentation();
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
async updatePresentation(e, t, {
|
|
841
|
+
// maxBitrate,
|
|
842
|
+
contentHint: s,
|
|
843
|
+
sendEncodings: i,
|
|
844
|
+
onAddedTransceiver: r
|
|
845
|
+
} = {}) {
|
|
846
|
+
const a = this.getRtcSessionProtected();
|
|
847
|
+
if (!this.streamPresentationCurrent)
|
|
848
|
+
throw new Error("Presentation has not started yet");
|
|
849
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, a, t, {
|
|
850
|
+
// maxBitrate,
|
|
851
|
+
contentHint: s,
|
|
852
|
+
isNeedReinvite: !1,
|
|
853
|
+
sendEncodings: i,
|
|
854
|
+
onAddedTransceiver: r
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
cancelSendPresentationWithRepeatedCalls() {
|
|
858
|
+
this.cancelableSendPresentationWithRepeatedCalls?.cancel();
|
|
859
|
+
}
|
|
860
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
861
|
+
on(e, t) {
|
|
862
|
+
return this.events.on(e, t);
|
|
863
|
+
}
|
|
864
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
865
|
+
once(e, t) {
|
|
866
|
+
return this.events.once(e, t);
|
|
867
|
+
}
|
|
868
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
869
|
+
onceRace(e, t) {
|
|
870
|
+
return this.events.onceRace(e, t);
|
|
871
|
+
}
|
|
872
|
+
async wait(e) {
|
|
873
|
+
return this.events.wait(e);
|
|
874
|
+
}
|
|
875
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
876
|
+
off(e, t) {
|
|
877
|
+
this.events.off(e, t);
|
|
878
|
+
}
|
|
879
|
+
subscribe() {
|
|
880
|
+
this.callManager.on("presentation:start", (e) => {
|
|
881
|
+
this.events.trigger(R.START_PRESENTATION, e);
|
|
882
|
+
}), this.callManager.on("presentation:started", (e) => {
|
|
883
|
+
this.events.trigger(R.STARTED_PRESENTATION, e);
|
|
884
|
+
}), this.callManager.on("presentation:end", (e) => {
|
|
885
|
+
this.events.trigger(R.END_PRESENTATION, e);
|
|
886
|
+
}), this.callManager.on("presentation:ended", (e) => {
|
|
887
|
+
this.events.trigger(R.ENDED_PRESENTATION, e);
|
|
888
|
+
}), this.callManager.on("presentation:failed", (e) => {
|
|
889
|
+
this.events.trigger(R.FAILED_PRESENTATION, e);
|
|
890
|
+
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
891
|
+
}
|
|
892
|
+
async sendPresentationWithDuplicatedCalls(e, {
|
|
893
|
+
rtcSession: t,
|
|
894
|
+
stream: s,
|
|
895
|
+
presentationOptions: i,
|
|
896
|
+
options: r = {
|
|
897
|
+
callLimit: Ce
|
|
898
|
+
}
|
|
899
|
+
}) {
|
|
900
|
+
const a = async () => this.sendPresentation(
|
|
901
|
+
e,
|
|
902
|
+
t,
|
|
903
|
+
s,
|
|
904
|
+
i
|
|
905
|
+
), o = () => !!this.streamPresentationCurrent;
|
|
906
|
+
return this.cancelableSendPresentationWithRepeatedCalls = V({
|
|
907
|
+
targetFunction: a,
|
|
908
|
+
isComplete: o,
|
|
909
|
+
isRejectAsValid: !0,
|
|
910
|
+
...r
|
|
911
|
+
}), this.cancelableSendPresentationWithRepeatedCalls.then((c) => c);
|
|
912
|
+
}
|
|
913
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
914
|
+
async sendPresentation(e, t, s, {
|
|
915
|
+
// maxBitrate = ONE_MEGABIT_IN_BITS,
|
|
916
|
+
isNeedReinvite: i = !0,
|
|
917
|
+
contentHint: r = "detail",
|
|
918
|
+
sendEncodings: a,
|
|
919
|
+
onAddedTransceiver: o
|
|
920
|
+
}) {
|
|
921
|
+
const c = v(s, { contentHint: r });
|
|
922
|
+
if (c === void 0)
|
|
923
|
+
throw new Error("No streamPresentationTarget");
|
|
924
|
+
this.streamPresentationCurrent = c;
|
|
925
|
+
const g = e().then(async () => t.startPresentation(c, i, {
|
|
926
|
+
sendEncodings: a,
|
|
927
|
+
onAddedTransceiver: o
|
|
928
|
+
})).then(() => s).catch((d) => {
|
|
929
|
+
throw this.removeStreamPresentationCurrent(), this.events.trigger(R.FAILED_PRESENTATION, d), d;
|
|
930
|
+
});
|
|
931
|
+
return this.promisePendingStartPresentation = g, g.finally(() => {
|
|
932
|
+
this.promisePendingStartPresentation = void 0;
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
getRtcSessionProtected = () => {
|
|
936
|
+
const e = this.callManager.getEstablishedRTCSession();
|
|
937
|
+
if (!e)
|
|
938
|
+
throw new Error("No rtcSession established");
|
|
939
|
+
return e;
|
|
1143
940
|
};
|
|
941
|
+
handleEnded = () => {
|
|
942
|
+
this.reset();
|
|
943
|
+
};
|
|
944
|
+
reset() {
|
|
945
|
+
this.cancelSendPresentationWithRepeatedCalls(), this.resetPresentation();
|
|
946
|
+
}
|
|
947
|
+
resetPresentation() {
|
|
948
|
+
this.removeStreamPresentationCurrent(), this.promisePendingStartPresentation = void 0, this.promisePendingStopPresentation = void 0;
|
|
949
|
+
}
|
|
950
|
+
removeStreamPresentationCurrent() {
|
|
951
|
+
delete this.streamPresentationCurrent;
|
|
952
|
+
}
|
|
1144
953
|
}
|
|
1145
|
-
class
|
|
954
|
+
class ue {
|
|
1146
955
|
data = {};
|
|
1147
956
|
getUa;
|
|
1148
957
|
constructor(e) {
|
|
@@ -1215,8 +1024,8 @@ class Sn {
|
|
|
1215
1024
|
return this.data.register === !0;
|
|
1216
1025
|
}
|
|
1217
1026
|
}
|
|
1218
|
-
var
|
|
1219
|
-
const
|
|
1027
|
+
var u = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n))(u || {});
|
|
1028
|
+
const z = [
|
|
1220
1029
|
"connecting",
|
|
1221
1030
|
"connected",
|
|
1222
1031
|
"disconnected",
|
|
@@ -1226,8 +1035,8 @@ const St = [
|
|
|
1226
1035
|
"registrationFailed",
|
|
1227
1036
|
"newMessage",
|
|
1228
1037
|
"sipEvent"
|
|
1229
|
-
],
|
|
1230
|
-
class
|
|
1038
|
+
], Q = [...z], Ae = 3;
|
|
1039
|
+
class _e {
|
|
1231
1040
|
cancelableConnectWithRepeatedCalls;
|
|
1232
1041
|
JsSIP;
|
|
1233
1042
|
events;
|
|
@@ -1253,29 +1062,29 @@ class ln {
|
|
|
1253
1062
|
}
|
|
1254
1063
|
let r = !1;
|
|
1255
1064
|
const a = this.getConnectionConfiguration();
|
|
1256
|
-
e !== void 0 && e !== a.displayName && (r = i.set("display_name",
|
|
1065
|
+
e !== void 0 && e !== a.displayName && (r = i.set("display_name", B(e)), this.updateConnectionConfiguration("displayName", e));
|
|
1257
1066
|
const o = r;
|
|
1258
1067
|
o ? t(o) : s(new Error("nothing changed"));
|
|
1259
1068
|
});
|
|
1260
1069
|
disconnect = async () => {
|
|
1261
1070
|
const e = new Promise((s) => {
|
|
1262
|
-
this.events.once(
|
|
1071
|
+
this.events.once(u.DISCONNECTED, () => {
|
|
1263
1072
|
s();
|
|
1264
1073
|
});
|
|
1265
1074
|
}), t = this.getUa();
|
|
1266
|
-
return t ? t.stop() : this.events.trigger(
|
|
1075
|
+
return t ? t.stop() : this.events.trigger(u.DISCONNECTED, void 0), e.finally(() => {
|
|
1267
1076
|
this.setUa(void 0), this.stateMachine.reset();
|
|
1268
1077
|
});
|
|
1269
1078
|
};
|
|
1270
1079
|
cancelRequests() {
|
|
1271
1080
|
this.cancelConnectWithRepeatedCalls();
|
|
1272
1081
|
}
|
|
1273
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1082
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = Ae } = {}) => {
|
|
1274
1083
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
1275
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e),
|
|
1276
|
-
return c ||
|
|
1084
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = r != null && !de(r);
|
|
1085
|
+
return c || g;
|
|
1277
1086
|
};
|
|
1278
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
1087
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = V({
|
|
1279
1088
|
targetFunction: s,
|
|
1280
1089
|
isComplete: i,
|
|
1281
1090
|
callLimit: t,
|
|
@@ -1301,38 +1110,38 @@ class ln {
|
|
|
1301
1110
|
sessionTimers: a,
|
|
1302
1111
|
registerExpires: o,
|
|
1303
1112
|
connectionRecoveryMinInterval: c,
|
|
1304
|
-
connectionRecoveryMaxInterval:
|
|
1305
|
-
userAgent:
|
|
1306
|
-
displayName:
|
|
1307
|
-
register:
|
|
1308
|
-
extraHeaders:
|
|
1113
|
+
connectionRecoveryMaxInterval: g,
|
|
1114
|
+
userAgent: d,
|
|
1115
|
+
displayName: S = "",
|
|
1116
|
+
register: l = !1,
|
|
1117
|
+
extraHeaders: E = []
|
|
1309
1118
|
}) => {
|
|
1310
1119
|
this.stateMachine.startInitUa(), this.setConnectionConfiguration({
|
|
1311
1120
|
sipServerUrl: s,
|
|
1312
|
-
displayName:
|
|
1313
|
-
register:
|
|
1121
|
+
displayName: S,
|
|
1122
|
+
register: l,
|
|
1314
1123
|
user: e,
|
|
1315
1124
|
password: t
|
|
1316
1125
|
}), this.getUa() && await this.disconnect();
|
|
1317
|
-
const { ua: C, helpers:
|
|
1126
|
+
const { ua: C, helpers: p } = this.uaFactory.createUAWithConfiguration(
|
|
1318
1127
|
{
|
|
1319
1128
|
user: e,
|
|
1320
1129
|
password: t,
|
|
1321
1130
|
sipServerUrl: s,
|
|
1322
1131
|
sipWebSocketServerURL: i,
|
|
1323
|
-
displayName:
|
|
1324
|
-
register:
|
|
1132
|
+
displayName: S,
|
|
1133
|
+
register: l,
|
|
1325
1134
|
sessionTimers: a,
|
|
1326
1135
|
registerExpires: o,
|
|
1327
1136
|
connectionRecoveryMinInterval: c,
|
|
1328
|
-
connectionRecoveryMaxInterval:
|
|
1329
|
-
userAgent:
|
|
1137
|
+
connectionRecoveryMaxInterval: g,
|
|
1138
|
+
userAgent: d,
|
|
1330
1139
|
remoteAddress: r,
|
|
1331
|
-
extraHeaders:
|
|
1140
|
+
extraHeaders: E
|
|
1332
1141
|
},
|
|
1333
1142
|
this.events
|
|
1334
1143
|
);
|
|
1335
|
-
return this.setUa(C), this.setSipServerUrl(
|
|
1144
|
+
return this.setUa(C), this.setSipServerUrl(p.getSipServerUrl), this.setSocket(p.socket), C;
|
|
1336
1145
|
};
|
|
1337
1146
|
start = async () => new Promise((e, t) => {
|
|
1338
1147
|
const s = this.getUa();
|
|
@@ -1341,15 +1150,15 @@ class ln {
|
|
|
1341
1150
|
return;
|
|
1342
1151
|
}
|
|
1343
1152
|
let i;
|
|
1344
|
-
i = ((c,
|
|
1153
|
+
i = ((c, g) => {
|
|
1345
1154
|
if (this.getConnectionConfiguration().register === !0)
|
|
1346
|
-
return this.registrationManager.subscribeToStartEvents(c,
|
|
1347
|
-
const
|
|
1348
|
-
return this.events.on(
|
|
1349
|
-
this.events.on(
|
|
1155
|
+
return this.registrationManager.subscribeToStartEvents(c, g);
|
|
1156
|
+
const S = u.CONNECTED, l = [u.DISCONNECTED];
|
|
1157
|
+
return this.events.on(S, c), l.forEach((E) => {
|
|
1158
|
+
this.events.on(E, g);
|
|
1350
1159
|
}), () => {
|
|
1351
|
-
this.events.off(
|
|
1352
|
-
this.events.off(
|
|
1160
|
+
this.events.off(S, c), l.forEach((E) => {
|
|
1161
|
+
this.events.off(E, g);
|
|
1353
1162
|
});
|
|
1354
1163
|
};
|
|
1355
1164
|
})(() => {
|
|
@@ -1362,8 +1171,8 @@ class ln {
|
|
|
1362
1171
|
this.cancelableConnectWithRepeatedCalls?.cancel();
|
|
1363
1172
|
}
|
|
1364
1173
|
}
|
|
1365
|
-
var
|
|
1366
|
-
const
|
|
1174
|
+
var X = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(X || {});
|
|
1175
|
+
const Ie = j({
|
|
1367
1176
|
types: {
|
|
1368
1177
|
context: {},
|
|
1369
1178
|
events: {}
|
|
@@ -1677,14 +1486,14 @@ const Cn = lt({
|
|
|
1677
1486
|
}
|
|
1678
1487
|
}
|
|
1679
1488
|
});
|
|
1680
|
-
class
|
|
1489
|
+
class Re {
|
|
1681
1490
|
actor;
|
|
1682
1491
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1683
1492
|
events;
|
|
1684
1493
|
unsubscribeFromEvents;
|
|
1685
1494
|
actorSubscription;
|
|
1686
1495
|
constructor(e) {
|
|
1687
|
-
this.events = e, this.actor =
|
|
1496
|
+
this.events = e, this.actor = Z(Ie), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1688
1497
|
const s = t.value;
|
|
1689
1498
|
this.stateChangeListeners.forEach((i) => {
|
|
1690
1499
|
i(s);
|
|
@@ -1770,7 +1579,7 @@ class Nn {
|
|
|
1770
1579
|
return this.actor.getSnapshot().can({ type: e });
|
|
1771
1580
|
}
|
|
1772
1581
|
getValidEvents() {
|
|
1773
|
-
return Object.values(
|
|
1582
|
+
return Object.values(X).filter((e) => this.canTransition(e));
|
|
1774
1583
|
}
|
|
1775
1584
|
hasState(e) {
|
|
1776
1585
|
return this.actor.getSnapshot().matches(e);
|
|
@@ -1839,7 +1648,7 @@ class Nn {
|
|
|
1839
1648
|
};
|
|
1840
1649
|
}
|
|
1841
1650
|
}
|
|
1842
|
-
class
|
|
1651
|
+
class Me {
|
|
1843
1652
|
events;
|
|
1844
1653
|
getUaProtected;
|
|
1845
1654
|
constructor(e) {
|
|
@@ -1848,13 +1657,13 @@ class An {
|
|
|
1848
1657
|
async register() {
|
|
1849
1658
|
const e = this.getUaProtected();
|
|
1850
1659
|
return new Promise((t, s) => {
|
|
1851
|
-
e.on(
|
|
1660
|
+
e.on(u.REGISTERED, t), e.on(u.REGISTRATION_FAILED, s), e.register();
|
|
1852
1661
|
});
|
|
1853
1662
|
}
|
|
1854
1663
|
async unregister() {
|
|
1855
1664
|
const e = this.getUaProtected();
|
|
1856
1665
|
return new Promise((t) => {
|
|
1857
|
-
e.on(
|
|
1666
|
+
e.on(u.UNREGISTERED, t), e.unregister();
|
|
1858
1667
|
});
|
|
1859
1668
|
}
|
|
1860
1669
|
async tryRegister() {
|
|
@@ -1866,7 +1675,7 @@ class An {
|
|
|
1866
1675
|
return this.register();
|
|
1867
1676
|
}
|
|
1868
1677
|
subscribeToStartEvents(e, t) {
|
|
1869
|
-
const s =
|
|
1678
|
+
const s = u.REGISTERED, i = [u.REGISTRATION_FAILED, u.DISCONNECTED];
|
|
1870
1679
|
return this.events.on(s, e), i.forEach((r) => {
|
|
1871
1680
|
this.events.on(r, t);
|
|
1872
1681
|
}), () => {
|
|
@@ -1876,7 +1685,7 @@ class An {
|
|
|
1876
1685
|
};
|
|
1877
1686
|
}
|
|
1878
1687
|
}
|
|
1879
|
-
class
|
|
1688
|
+
class pe {
|
|
1880
1689
|
uaFactory;
|
|
1881
1690
|
getUaProtected;
|
|
1882
1691
|
constructor(e) {
|
|
@@ -1922,30 +1731,30 @@ class _n {
|
|
|
1922
1731
|
extraHeaders: a
|
|
1923
1732
|
}) {
|
|
1924
1733
|
return new Promise((o, c) => {
|
|
1925
|
-
const { configuration:
|
|
1734
|
+
const { configuration: g } = this.uaFactory.createConfiguration({
|
|
1926
1735
|
sipWebSocketServerURL: i,
|
|
1927
1736
|
displayName: t,
|
|
1928
1737
|
userAgent: e,
|
|
1929
1738
|
sipServerUrl: s
|
|
1930
|
-
}),
|
|
1931
|
-
const
|
|
1932
|
-
c(
|
|
1739
|
+
}), d = this.uaFactory.createUA({ ...g, remoteAddress: r, extraHeaders: a }), S = () => {
|
|
1740
|
+
const E = new Error("Telephony is not available");
|
|
1741
|
+
c(E);
|
|
1933
1742
|
};
|
|
1934
|
-
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1743
|
+
d.once(u.DISCONNECTED, S);
|
|
1744
|
+
const l = () => {
|
|
1745
|
+
d.removeAllListeners(), d.once(u.DISCONNECTED, () => {
|
|
1937
1746
|
o();
|
|
1938
|
-
}),
|
|
1747
|
+
}), d.stop();
|
|
1939
1748
|
};
|
|
1940
|
-
|
|
1749
|
+
d.once(u.CONNECTED, l), d.start();
|
|
1941
1750
|
});
|
|
1942
1751
|
}
|
|
1943
1752
|
}
|
|
1944
|
-
const
|
|
1753
|
+
const me = (n) => {
|
|
1945
1754
|
const e = [];
|
|
1946
1755
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1947
1756
|
};
|
|
1948
|
-
class
|
|
1757
|
+
class m {
|
|
1949
1758
|
JsSIP;
|
|
1950
1759
|
constructor(e) {
|
|
1951
1760
|
this.JsSIP = e;
|
|
@@ -1970,10 +1779,10 @@ class p {
|
|
|
1970
1779
|
throw new Error("user is required for authorized connection");
|
|
1971
1780
|
}
|
|
1972
1781
|
static resolveAuthorizationUser(e, t) {
|
|
1973
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
1782
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${se()}`;
|
|
1974
1783
|
}
|
|
1975
1784
|
static buildExtraHeaders(e, t) {
|
|
1976
|
-
const s = e !== void 0 && e !== "" ?
|
|
1785
|
+
const s = e !== void 0 && e !== "" ? me(e) : [];
|
|
1977
1786
|
return t === void 0 ? s : [...s, ...t];
|
|
1978
1787
|
}
|
|
1979
1788
|
createConfiguration({
|
|
@@ -1986,40 +1795,40 @@ class p {
|
|
|
1986
1795
|
sessionTimers: o = !1,
|
|
1987
1796
|
registerExpires: c = 300,
|
|
1988
1797
|
// 5 minutes in sec
|
|
1989
|
-
connectionRecoveryMinInterval:
|
|
1990
|
-
connectionRecoveryMaxInterval:
|
|
1991
|
-
userAgent:
|
|
1798
|
+
connectionRecoveryMinInterval: g = 2,
|
|
1799
|
+
connectionRecoveryMaxInterval: d = 6,
|
|
1800
|
+
userAgent: S
|
|
1992
1801
|
}) {
|
|
1993
|
-
|
|
1802
|
+
m.validateConfiguration({
|
|
1994
1803
|
register: a,
|
|
1995
1804
|
password: t,
|
|
1996
1805
|
user: e,
|
|
1997
1806
|
sipServerUrl: r,
|
|
1998
1807
|
sipWebSocketServerURL: s
|
|
1999
1808
|
});
|
|
2000
|
-
const
|
|
1809
|
+
const l = m.resolveAuthorizationUser(a, e), E = te(r), I = E(l), C = new this.JsSIP.WebSocketInterface(s);
|
|
2001
1810
|
return {
|
|
2002
1811
|
configuration: {
|
|
2003
1812
|
password: t,
|
|
2004
1813
|
register: a,
|
|
2005
1814
|
uri: I,
|
|
2006
|
-
display_name:
|
|
2007
|
-
user_agent:
|
|
1815
|
+
display_name: B(i),
|
|
1816
|
+
user_agent: S,
|
|
2008
1817
|
sdpSemantics: "unified-plan",
|
|
2009
1818
|
sockets: [C],
|
|
2010
1819
|
session_timers: o,
|
|
2011
1820
|
register_expires: c,
|
|
2012
|
-
connection_recovery_min_interval:
|
|
2013
|
-
connection_recovery_max_interval:
|
|
1821
|
+
connection_recovery_min_interval: g,
|
|
1822
|
+
connection_recovery_max_interval: d
|
|
2014
1823
|
},
|
|
2015
1824
|
helpers: {
|
|
2016
1825
|
socket: C,
|
|
2017
|
-
getSipServerUrl:
|
|
1826
|
+
getSipServerUrl: E
|
|
2018
1827
|
}
|
|
2019
1828
|
};
|
|
2020
1829
|
}
|
|
2021
1830
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
2022
|
-
const i = new this.JsSIP.UA(s), r =
|
|
1831
|
+
const i = new this.JsSIP.UA(s), r = m.buildExtraHeaders(e, t);
|
|
2023
1832
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
2024
1833
|
}
|
|
2025
1834
|
/**
|
|
@@ -2032,12 +1841,12 @@ class p {
|
|
|
2032
1841
|
extraHeaders: e.extraHeaders
|
|
2033
1842
|
});
|
|
2034
1843
|
return t.eachTriggers((a, o) => {
|
|
2035
|
-
const c =
|
|
1844
|
+
const c = z.find((g) => g === o);
|
|
2036
1845
|
c && r.on(c, a);
|
|
2037
1846
|
}), { ua: r, helpers: i };
|
|
2038
1847
|
}
|
|
2039
1848
|
}
|
|
2040
|
-
class
|
|
1849
|
+
class Pe {
|
|
2041
1850
|
events;
|
|
2042
1851
|
ua;
|
|
2043
1852
|
socket;
|
|
@@ -2049,15 +1858,15 @@ class In {
|
|
|
2049
1858
|
configurationManager;
|
|
2050
1859
|
JsSIP;
|
|
2051
1860
|
constructor({ JsSIP: e }) {
|
|
2052
|
-
this.JsSIP = e, this.events = new
|
|
1861
|
+
this.JsSIP = e, this.events = new O(Q), this.uaFactory = new m(e), this.registrationManager = new Me({
|
|
2053
1862
|
events: this.events,
|
|
2054
1863
|
getUaProtected: this.getUaProtected
|
|
2055
|
-
}), this.stateMachine = new
|
|
1864
|
+
}), this.stateMachine = new Re(this.events), this.configurationManager = new ue({
|
|
2056
1865
|
getUa: this.getUa
|
|
2057
|
-
}), this.sipOperations = new
|
|
1866
|
+
}), this.sipOperations = new pe({
|
|
2058
1867
|
uaFactory: this.uaFactory,
|
|
2059
1868
|
getUaProtected: this.getUaProtected
|
|
2060
|
-
}), this.connectionFlow = new
|
|
1869
|
+
}), this.connectionFlow = new _e({
|
|
2061
1870
|
JsSIP: this.JsSIP,
|
|
2062
1871
|
events: this.events,
|
|
2063
1872
|
uaFactory: this.uaFactory,
|
|
@@ -2095,7 +1904,7 @@ class In {
|
|
|
2095
1904
|
return this.stateMachine.state;
|
|
2096
1905
|
}
|
|
2097
1906
|
get isRegistered() {
|
|
2098
|
-
return
|
|
1907
|
+
return m.isRegisteredUA(this.ua);
|
|
2099
1908
|
}
|
|
2100
1909
|
get isRegisterConfig() {
|
|
2101
1910
|
return this.configurationManager.isRegister();
|
|
@@ -2148,19 +1957,19 @@ class In {
|
|
|
2148
1957
|
};
|
|
2149
1958
|
getUa = () => this.ua;
|
|
2150
1959
|
}
|
|
2151
|
-
var
|
|
2152
|
-
const
|
|
1960
|
+
var D = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(D || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
|
|
1961
|
+
const J = [
|
|
2153
1962
|
"incomingCall",
|
|
2154
1963
|
"declinedIncomingCall",
|
|
2155
1964
|
"terminatedIncomingCall",
|
|
2156
1965
|
"failedIncomingCall"
|
|
2157
|
-
],
|
|
2158
|
-
class
|
|
1966
|
+
], Oe = 486, fe = 487;
|
|
1967
|
+
class De {
|
|
1968
|
+
events;
|
|
2159
1969
|
incomingRTCSession;
|
|
2160
1970
|
connectionManager;
|
|
2161
|
-
events;
|
|
2162
1971
|
constructor(e) {
|
|
2163
|
-
this.connectionManager = e, this.events = new
|
|
1972
|
+
this.connectionManager = e, this.events = new O(J), this.start();
|
|
2164
1973
|
}
|
|
2165
1974
|
get remoteCallerData() {
|
|
2166
1975
|
return {
|
|
@@ -2190,19 +1999,19 @@ class pn {
|
|
|
2190
1999
|
return this.removeIncomingSession(), e;
|
|
2191
2000
|
};
|
|
2192
2001
|
async declineToIncomingCall({
|
|
2193
|
-
statusCode: e =
|
|
2002
|
+
statusCode: e = fe
|
|
2194
2003
|
} = {}) {
|
|
2195
2004
|
return new Promise((t, s) => {
|
|
2196
2005
|
try {
|
|
2197
2006
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
2198
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
2007
|
+
this.removeIncomingSession(), this.events.trigger(D.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
2199
2008
|
} catch (i) {
|
|
2200
2009
|
s(i);
|
|
2201
2010
|
}
|
|
2202
2011
|
});
|
|
2203
2012
|
}
|
|
2204
2013
|
async busyIncomingCall() {
|
|
2205
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2014
|
+
return this.declineToIncomingCall({ statusCode: Oe });
|
|
2206
2015
|
}
|
|
2207
2016
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2208
2017
|
on(e, t) {
|
|
@@ -2239,26 +2048,34 @@ class pn {
|
|
|
2239
2048
|
this.incomingRTCSession = e;
|
|
2240
2049
|
const t = this.remoteCallerData;
|
|
2241
2050
|
e.on("failed", (s) => {
|
|
2242
|
-
this.removeIncomingSession(), s.originator === $.LOCAL ? this.events.trigger(
|
|
2243
|
-
}), this.events.trigger(
|
|
2051
|
+
this.removeIncomingSession(), s.originator === $.LOCAL ? this.events.trigger(D.TERMINATED_INCOMING_CALL, t) : this.events.trigger(D.FAILED_INCOMING_CALL, t);
|
|
2052
|
+
}), this.events.trigger(D.INCOMING_CALL, t);
|
|
2244
2053
|
}
|
|
2245
2054
|
removeIncomingSession() {
|
|
2246
2055
|
delete this.incomingRTCSession;
|
|
2247
2056
|
}
|
|
2248
2057
|
}
|
|
2249
|
-
|
|
2058
|
+
const ve = Q.map((n) => `connection:${n}`), ye = G.map((n) => `call:${n}`), Ue = q.map((n) => `api:${n}`), be = J.map((n) => `incoming-call:${n}`), we = Y.map((n) => `presentation:${n}`), Le = [
|
|
2059
|
+
...ve,
|
|
2060
|
+
...ye,
|
|
2061
|
+
...Ue,
|
|
2062
|
+
...be,
|
|
2063
|
+
...we
|
|
2064
|
+
];
|
|
2065
|
+
class xe {
|
|
2066
|
+
events;
|
|
2250
2067
|
connectionManager;
|
|
2251
2068
|
callManager;
|
|
2252
2069
|
apiManager;
|
|
2253
2070
|
incomingCallManager;
|
|
2254
2071
|
presentationManager;
|
|
2255
2072
|
constructor({ JsSIP: e }) {
|
|
2256
|
-
this.connectionManager = new
|
|
2073
|
+
this.events = new O(Le), this.connectionManager = new Pe({ JsSIP: e }), this.callManager = new ge(), this.apiManager = new Se({
|
|
2257
2074
|
connectionManager: this.connectionManager,
|
|
2258
2075
|
callManager: this.callManager
|
|
2259
|
-
}), this.incomingCallManager = new
|
|
2076
|
+
}), this.incomingCallManager = new De(this.connectionManager), this.presentationManager = new Ne({
|
|
2260
2077
|
callManager: this.callManager
|
|
2261
|
-
});
|
|
2078
|
+
}), this.subscribe();
|
|
2262
2079
|
}
|
|
2263
2080
|
get requestedConnection() {
|
|
2264
2081
|
return this.connectionManager.requested;
|
|
@@ -2299,34 +2116,34 @@ class $n {
|
|
|
2299
2116
|
get isAvailableIncomingCall() {
|
|
2300
2117
|
return this.incomingCallManager.isAvailableIncomingCall;
|
|
2301
2118
|
}
|
|
2302
|
-
connect = async (...e) => this.connectionManager.connect(...e);
|
|
2303
|
-
set = async (...e) => this.connectionManager.set(...e);
|
|
2304
|
-
disconnect = async () => this.connectionManager.disconnect();
|
|
2305
|
-
register = async () => this.connectionManager.register();
|
|
2306
|
-
unregister = async () => this.connectionManager.unregister();
|
|
2307
|
-
tryRegister = async () => this.connectionManager.tryRegister();
|
|
2308
|
-
sendOptions = async (e, t, s) => this.connectionManager.sendOptions(e, t, s);
|
|
2309
|
-
ping = async (e, t) => this.connectionManager.ping(e, t);
|
|
2310
|
-
checkTelephony = async (e) => this.connectionManager.checkTelephony(e);
|
|
2311
2119
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2312
|
-
|
|
2313
|
-
return this.
|
|
2120
|
+
on(e, t) {
|
|
2121
|
+
return this.events.on(e, t);
|
|
2314
2122
|
}
|
|
2315
2123
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2316
|
-
|
|
2317
|
-
return this.
|
|
2124
|
+
once(e, t) {
|
|
2125
|
+
return this.events.once(e, t);
|
|
2318
2126
|
}
|
|
2319
2127
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2320
|
-
|
|
2321
|
-
return this.
|
|
2128
|
+
onceRace(e, t) {
|
|
2129
|
+
return this.events.onceRace(e, t);
|
|
2322
2130
|
}
|
|
2323
|
-
async
|
|
2324
|
-
return this.
|
|
2131
|
+
async wait(e) {
|
|
2132
|
+
return this.events.wait(e);
|
|
2325
2133
|
}
|
|
2326
2134
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2327
|
-
|
|
2328
|
-
this.
|
|
2135
|
+
off(e, t) {
|
|
2136
|
+
this.events.off(e, t);
|
|
2329
2137
|
}
|
|
2138
|
+
connect = async (...e) => this.connectionManager.connect(...e);
|
|
2139
|
+
set = async (...e) => this.connectionManager.set(...e);
|
|
2140
|
+
disconnect = async () => this.connectionManager.disconnect();
|
|
2141
|
+
register = async () => this.connectionManager.register();
|
|
2142
|
+
unregister = async () => this.connectionManager.unregister();
|
|
2143
|
+
tryRegister = async () => this.connectionManager.tryRegister();
|
|
2144
|
+
sendOptions = async (e, t, s) => this.connectionManager.sendOptions(e, t, s);
|
|
2145
|
+
ping = async (e, t) => this.connectionManager.ping(e, t);
|
|
2146
|
+
checkTelephony = async (e) => this.connectionManager.checkTelephony(e);
|
|
2330
2147
|
isConfigured = () => this.connectionManager.isConfigured();
|
|
2331
2148
|
getConnectionConfiguration = () => this.connectionManager.getConnectionConfiguration();
|
|
2332
2149
|
getSipServerUrl = (e) => this.connectionManager.getSipServerUrl(e);
|
|
@@ -2345,44 +2162,6 @@ class $n {
|
|
|
2345
2162
|
getCallConfiguration = () => this.callManager.getCallConfiguration();
|
|
2346
2163
|
getRemoteStreams = () => this.callManager.getRemoteStreams();
|
|
2347
2164
|
replaceMediaStream = async (...e) => this.callManager.replaceMediaStream(...e);
|
|
2348
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2349
|
-
onCall(e, t) {
|
|
2350
|
-
return this.callManager.on(e, t);
|
|
2351
|
-
}
|
|
2352
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2353
|
-
onceCall(e, t) {
|
|
2354
|
-
return this.callManager.once(e, t);
|
|
2355
|
-
}
|
|
2356
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2357
|
-
onceRaceCall(e, t) {
|
|
2358
|
-
return this.callManager.onceRace(e, t);
|
|
2359
|
-
}
|
|
2360
|
-
async waitCall(e) {
|
|
2361
|
-
return this.callManager.wait(e);
|
|
2362
|
-
}
|
|
2363
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2364
|
-
offIncomingCall(e, t) {
|
|
2365
|
-
this.incomingCallManager.off(e, t);
|
|
2366
|
-
}
|
|
2367
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2368
|
-
onIncomingCall(e, t) {
|
|
2369
|
-
return this.incomingCallManager.on(e, t);
|
|
2370
|
-
}
|
|
2371
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2372
|
-
onceIncomingCall(e, t) {
|
|
2373
|
-
return this.incomingCallManager.once(e, t);
|
|
2374
|
-
}
|
|
2375
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2376
|
-
onceRaceIncomingCall(e, t) {
|
|
2377
|
-
return this.incomingCallManager.onceRace(e, t);
|
|
2378
|
-
}
|
|
2379
|
-
async waitIncomingCall(e) {
|
|
2380
|
-
return this.incomingCallManager.wait(e);
|
|
2381
|
-
}
|
|
2382
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2383
|
-
offCall(e, t) {
|
|
2384
|
-
this.callManager.off(e, t);
|
|
2385
|
-
}
|
|
2386
2165
|
async startPresentation(e, t = {}) {
|
|
2387
2166
|
const { isP2P: s, callLimit: i, ...r } = t;
|
|
2388
2167
|
return this.presentationManager.startPresentation(
|
|
@@ -2452,41 +2231,38 @@ class $n {
|
|
|
2452
2231
|
async askPermissionToEnableCam(...e) {
|
|
2453
2232
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
2454
2233
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
this.
|
|
2234
|
+
subscribe() {
|
|
2235
|
+
this.connectionManager.events.eachTriggers((e, t) => {
|
|
2236
|
+
this.connectionManager.on(t, (s) => {
|
|
2237
|
+
this.events.trigger(`connection:${t}`, s);
|
|
2238
|
+
});
|
|
2239
|
+
}), this.callManager.events.eachTriggers((e, t) => {
|
|
2240
|
+
this.callManager.on(t, (s) => {
|
|
2241
|
+
this.events.trigger(`call:${t}`, s);
|
|
2242
|
+
});
|
|
2243
|
+
}), this.apiManager.events.eachTriggers((e, t) => {
|
|
2244
|
+
this.apiManager.on(t, (s) => {
|
|
2245
|
+
this.events.trigger(`api:${t}`, s);
|
|
2246
|
+
});
|
|
2247
|
+
}), this.incomingCallManager.events.eachTriggers((e, t) => {
|
|
2248
|
+
this.incomingCallManager.on(t, (s) => {
|
|
2249
|
+
this.events.trigger(`incoming-call:${t}`, s);
|
|
2250
|
+
});
|
|
2251
|
+
}), this.presentationManager.events.eachTriggers((e, t) => {
|
|
2252
|
+
this.presentationManager.on(t, (s) => {
|
|
2253
|
+
this.events.trigger(`presentation:${t}`, s);
|
|
2254
|
+
});
|
|
2255
|
+
});
|
|
2473
2256
|
}
|
|
2474
2257
|
}
|
|
2475
2258
|
export {
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
wn as b,
|
|
2485
|
-
yn as c,
|
|
2486
|
-
Ln as d,
|
|
2487
|
-
bn as e,
|
|
2488
|
-
Yt as f,
|
|
2489
|
-
U as g,
|
|
2490
|
-
Fn as h,
|
|
2259
|
+
x as E,
|
|
2260
|
+
U as O,
|
|
2261
|
+
xe as S,
|
|
2262
|
+
f as a,
|
|
2263
|
+
Ee as b,
|
|
2264
|
+
Ge as d,
|
|
2265
|
+
He as e,
|
|
2266
|
+
Be as h,
|
|
2491
2267
|
P as l
|
|
2492
2268
|
};
|