sip-connector 20.2.1 → 20.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -1
- package/dist/@SipConnector-C-73R76v.cjs +1 -0
- package/dist/{@SipConnector-OO78fz6E.js → @SipConnector-D4SHRHKj.js} +1925 -767
- package/dist/CallManager/CallStateMachine.d.ts +83 -0
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +53 -4
- package/dist/IncomingCallManager/IncomingCallStateMachine.d.ts +114 -0
- package/dist/PresentationManager/PresentationStateMachine.d.ts +101 -0
- package/dist/SipConnector/@SipConnector.d.ts +4 -1
- package/dist/SipConnector/events.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +206 -188
- package/dist/session/createSession.d.ts +26 -0
- package/dist/session/index.d.ts +5 -0
- package/dist/session/selectors.d.ts +10 -0
- package/dist/session/types.d.ts +20 -0
- package/dist/tools/BaseStateMachine.d.ts +18 -0
- package/package.json +1 -1
- package/dist/@SipConnector-BTqBRDjY.cjs +0 -1
- package/dist/CallManager/@CallManager.d.ts +0 -60
- package/dist/ConnectionManager/@ConnectionManager.d.ts +0 -57
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +0 -29
- package/dist/PresentationManager/@PresentationManager.d.ts +0 -49
package/dist/index.js
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
import { E as p, l as r, p as
|
|
2
|
-
import {
|
|
1
|
+
import { E as p, a as w, b as H, l as r, p as j, s as K, c as X, d as Y, h as G } from "./@SipConnector-D4SHRHKj.js";
|
|
2
|
+
import { n as He, o as je, j as Ke, e as Xe, S as Ye, k as Ge, f as qe, g as ze, m as Je, i as Qe } from "./@SipConnector-D4SHRHKj.js";
|
|
3
3
|
import "events-constructor";
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { debounce as
|
|
7
|
-
import { UAParser as
|
|
8
|
-
import { sequentPromises as
|
|
9
|
-
import { isPromiseIsNotActualError as
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
4
|
+
import { isCanceledError as L } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as q } from "repeated-calls";
|
|
6
|
+
import { debounce as z } from "ts-debounce";
|
|
7
|
+
import { UAParser as J } from "ua-parser-js";
|
|
8
|
+
import { sequentPromises as Q } from "sequent-promises";
|
|
9
|
+
import { isPromiseIsNotActualError as en } from "stack-promises";
|
|
10
|
+
const Z = (e) => e instanceof Object && ("originator" in e || "cause" in e), ke = (e) => {
|
|
11
|
+
if (L(e))
|
|
12
12
|
return !0;
|
|
13
|
-
if (!
|
|
13
|
+
if (!Z(e))
|
|
14
14
|
return !1;
|
|
15
|
-
const { originator:
|
|
16
|
-
return typeof t == "string" ? t === p.REQUEST_TIMEOUT || t === p.REJECTED ||
|
|
17
|
-
},
|
|
18
|
-
|
|
15
|
+
const { originator: n, cause: t } = e;
|
|
16
|
+
return typeof t == "string" ? t === p.REQUEST_TIMEOUT || t === p.REJECTED || n === "local" && (t === p.CANCELED || t === p.BYE) : !1;
|
|
17
|
+
}, ee = (e) => e.connection.value, V = (e) => e.call.value, ne = (e) => e.incoming.value, te = (e) => {
|
|
18
|
+
if (e.incoming.value !== H.IDLE)
|
|
19
|
+
return e.incoming.context.remoteCallerData;
|
|
20
|
+
}, oe = (e) => e.presentation.value, re = (e) => {
|
|
21
|
+
const n = V(e);
|
|
22
|
+
return n === w.IN_CALL || n === w.ACCEPTED;
|
|
23
|
+
}, xe = {
|
|
24
|
+
selectConnectionStatus: ee,
|
|
25
|
+
selectCallStatus: V,
|
|
26
|
+
selectIncomingStatus: ne,
|
|
27
|
+
selectIncomingRemoteCaller: te,
|
|
28
|
+
selectPresentationStatus: oe,
|
|
29
|
+
selectIsInCall: re
|
|
30
|
+
}, se = () => globalThis.process?.versions?.electron !== void 0, B = () => {
|
|
31
|
+
const e = new J(), { name: n } = e.getBrowser(), t = se();
|
|
19
32
|
return {
|
|
20
|
-
isChrome:
|
|
33
|
+
isChrome: n === "Chrome" || t
|
|
21
34
|
};
|
|
22
|
-
}, N = (
|
|
23
|
-
const { url:
|
|
24
|
-
let o =
|
|
25
|
-
return (t === p.BAD_MEDIA_DESCRIPTION || t === p.NOT_FOUND) && (o = `${
|
|
35
|
+
}, N = (e) => {
|
|
36
|
+
const { url: n, cause: t } = e;
|
|
37
|
+
let o = n;
|
|
38
|
+
return (t === p.BAD_MEDIA_DESCRIPTION || t === p.NOT_FOUND) && (o = `${e.message.to.uri.user}@${e.message.to.uri.host}`), o;
|
|
26
39
|
};
|
|
27
|
-
var
|
|
28
|
-
const
|
|
29
|
-
const { cause:
|
|
40
|
+
var $ = /* @__PURE__ */ ((e) => (e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e))($ || {});
|
|
41
|
+
const ae = new Error("Unknown error"), ce = (e = ae) => {
|
|
42
|
+
const { cause: n, socket: t } = e;
|
|
30
43
|
let o = "CONNECT_SERVER_FAILED";
|
|
31
|
-
switch (
|
|
44
|
+
switch (n) {
|
|
32
45
|
case "Forbidden": {
|
|
33
46
|
o = "WRONG_USER_OR_PASSWORD";
|
|
34
47
|
break;
|
|
@@ -42,129 +55,129 @@ const Q = new Error("Unknown error"), Z = (n = Q) => {
|
|
|
42
55
|
break;
|
|
43
56
|
}
|
|
44
57
|
default:
|
|
45
|
-
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : N(
|
|
58
|
+
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : N(e) !== void 0 && N(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
46
59
|
}
|
|
47
60
|
return o;
|
|
48
|
-
},
|
|
49
|
-
let
|
|
61
|
+
}, ie = (e) => {
|
|
62
|
+
let n = "";
|
|
50
63
|
try {
|
|
51
|
-
|
|
64
|
+
n = JSON.stringify(e);
|
|
52
65
|
} catch (t) {
|
|
53
66
|
r("failed to stringify message", t);
|
|
54
67
|
}
|
|
55
|
-
return
|
|
56
|
-
},
|
|
57
|
-
const { code:
|
|
58
|
-
return typeof o == "object" && o !== null ? s.message =
|
|
59
|
-
},
|
|
68
|
+
return n;
|
|
69
|
+
}, ue = new Error("Unknown error"), le = (e = ue) => {
|
|
70
|
+
const { code: n, cause: t, message: o } = e, a = N(e), s = { code: "", cause: "", message: "" };
|
|
71
|
+
return typeof o == "object" && o !== null ? s.message = ie(o) : o && (s.message = String(o)), a !== void 0 && a !== "" && (s.link = a), n !== void 0 && n !== "" && (s.code = n), t !== void 0 && t !== "" && (s.cause = t), s;
|
|
72
|
+
}, de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
60
73
|
__proto__: null,
|
|
61
|
-
EErrorTypes:
|
|
74
|
+
EErrorTypes: $,
|
|
62
75
|
getLinkError: N,
|
|
63
|
-
getTypeFromError:
|
|
64
|
-
getValuesFromError:
|
|
65
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
66
|
-
sessionId:
|
|
67
|
-
remoteAddress:
|
|
76
|
+
getTypeFromError: ce,
|
|
77
|
+
getValuesFromError: le
|
|
78
|
+
}, Symbol.toStringTag, { value: "Module" })), Ce = ({
|
|
79
|
+
sessionId: e,
|
|
80
|
+
remoteAddress: n,
|
|
68
81
|
isMutedAudio: t,
|
|
69
82
|
isMutedVideo: o,
|
|
70
83
|
isRegistered: a,
|
|
71
84
|
isPresentationCall: s
|
|
72
85
|
}) => {
|
|
73
86
|
const c = [], u = t ? "0" : "1", d = o ? "0" : "1";
|
|
74
|
-
return c.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${d}`), (a === !1 || a === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"),
|
|
75
|
-
},
|
|
76
|
-
let
|
|
77
|
-
return
|
|
78
|
-
},
|
|
79
|
-
appName:
|
|
80
|
-
appVersion:
|
|
87
|
+
return c.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${d}`), (a === !1 || a === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Session: ${e}`), s === !0 && c.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Remote: ${n}`), c;
|
|
88
|
+
}, Se = "[@*!|]", fe = "_", me = (e) => {
|
|
89
|
+
let n = e;
|
|
90
|
+
return n = n.replaceAll(new RegExp(Se, "g"), fe), n;
|
|
91
|
+
}, pe = ({
|
|
92
|
+
appName: e,
|
|
93
|
+
appVersion: n,
|
|
81
94
|
browserName: t,
|
|
82
95
|
browserVersion: o
|
|
83
96
|
}) => {
|
|
84
|
-
const s = `${
|
|
97
|
+
const s = `${me(e)} ${n}`;
|
|
85
98
|
return `ChromeNew - ${t === void 0 ? s : `${t} ${o}, ${s}`}`;
|
|
86
|
-
},
|
|
87
|
-
isUnifiedSdpSemantic:
|
|
88
|
-
appVersion:
|
|
99
|
+
}, he = ({
|
|
100
|
+
isUnifiedSdpSemantic: e,
|
|
101
|
+
appVersion: n,
|
|
89
102
|
browserName: t,
|
|
90
103
|
browserVersion: o,
|
|
91
104
|
appName: a
|
|
92
|
-
}) =>
|
|
93
|
-
accumulatedKeys:
|
|
94
|
-
sendKey:
|
|
105
|
+
}) => e ? pe({ appVersion: n, browserName: t, browserVersion: o, appName: a }) : "Chrome", W = "purgatory", A = (e) => e === W, Ee = (e) => (n) => [...n].map((o) => async () => e(o)), ge = async ({
|
|
106
|
+
accumulatedKeys: e,
|
|
107
|
+
sendKey: n,
|
|
95
108
|
canRunTask: t
|
|
96
109
|
}) => {
|
|
97
|
-
const a =
|
|
98
|
-
return
|
|
99
|
-
},
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
110
|
+
const a = Ee(n)(e);
|
|
111
|
+
return Q(a, t);
|
|
112
|
+
}, Re = (e) => (t) => (r("onStartMainCam"), e.on("api:admin-start-main-cam", t)), be = (e) => (t) => (r("onStartMic"), e.on("api:admin-start-mic", t)), ve = (e) => (t) => (r("onStopMainCam"), e.on("api:admin-stop-main-cam", t)), Te = (e) => (t) => (r("onStopMic"), e.on("api:admin-stop-mic", t)), _e = ({ sipConnector: e }) => {
|
|
113
|
+
const n = (l, C) => ({ isSyncForced: S }) => {
|
|
114
|
+
if (S === !0) {
|
|
102
115
|
l();
|
|
103
116
|
return;
|
|
104
117
|
}
|
|
105
|
-
|
|
106
|
-
}, t =
|
|
118
|
+
C();
|
|
119
|
+
}, t = Re(e), o = ve(e), a = be(e), s = Te(e);
|
|
107
120
|
let c, u, d, E;
|
|
108
|
-
const
|
|
121
|
+
const v = ({
|
|
109
122
|
onStartMainCamForced: l,
|
|
110
|
-
onStartMainCamNotForced:
|
|
111
|
-
onStopMainCamForced:
|
|
123
|
+
onStartMainCamNotForced: C,
|
|
124
|
+
onStopMainCamForced: S,
|
|
112
125
|
onStopMainCamNotForced: R,
|
|
113
126
|
onStartMicForced: b,
|
|
114
|
-
onStartMicNotForced:
|
|
127
|
+
onStartMicNotForced: O,
|
|
115
128
|
onStopMicForced: P,
|
|
116
129
|
onStopMicNotForced: M
|
|
117
130
|
}) => {
|
|
118
|
-
const
|
|
131
|
+
const f = n(
|
|
119
132
|
l,
|
|
120
|
-
|
|
133
|
+
C
|
|
121
134
|
);
|
|
122
|
-
c = t(
|
|
123
|
-
const m =
|
|
124
|
-
|
|
135
|
+
c = t(f);
|
|
136
|
+
const m = n(
|
|
137
|
+
S,
|
|
125
138
|
R
|
|
126
139
|
);
|
|
127
140
|
u = o(m);
|
|
128
|
-
const
|
|
129
|
-
d = a(
|
|
130
|
-
const h =
|
|
141
|
+
const y = n(b, O);
|
|
142
|
+
d = a(y);
|
|
143
|
+
const h = n(P, M);
|
|
131
144
|
E = s(h);
|
|
132
|
-
},
|
|
145
|
+
}, T = () => {
|
|
133
146
|
c?.(), u?.(), d?.(), E?.();
|
|
134
147
|
};
|
|
135
148
|
return {
|
|
136
149
|
start: (l) => {
|
|
137
|
-
|
|
150
|
+
v(l);
|
|
138
151
|
},
|
|
139
152
|
stop: () => {
|
|
140
|
-
|
|
153
|
+
T();
|
|
141
154
|
}
|
|
142
155
|
};
|
|
143
|
-
},
|
|
156
|
+
}, Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
144
157
|
__proto__: null,
|
|
145
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
146
|
-
createSyncMediaState:
|
|
147
|
-
createUaParser:
|
|
148
|
-
error:
|
|
149
|
-
getExtraHeaders:
|
|
150
|
-
getUserAgent:
|
|
151
|
-
hasPurgatory:
|
|
152
|
-
prepareMediaStream:
|
|
153
|
-
sendDtmfAccumulated:
|
|
154
|
-
sendOffer:
|
|
155
|
-
setEncodingsToSender:
|
|
156
|
-
setParametersToSender:
|
|
157
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
158
|
-
if (!
|
|
159
|
-
throw
|
|
158
|
+
PURGATORY_CONFERENCE_NUMBER: W,
|
|
159
|
+
createSyncMediaState: _e,
|
|
160
|
+
createUaParser: B,
|
|
161
|
+
error: de,
|
|
162
|
+
getExtraHeaders: Ce,
|
|
163
|
+
getUserAgent: he,
|
|
164
|
+
hasPurgatory: A,
|
|
165
|
+
prepareMediaStream: j,
|
|
166
|
+
sendDtmfAccumulated: ge,
|
|
167
|
+
sendOffer: K,
|
|
168
|
+
setEncodingsToSender: X,
|
|
169
|
+
setParametersToSender: Y
|
|
170
|
+
}, Symbol.toStringTag, { value: "Module" })), Ve = () => B().isChrome, Oe = (e) => {
|
|
171
|
+
if (!L(e) && !q(e) && !G(e))
|
|
172
|
+
throw e;
|
|
160
173
|
return { configuration: void 0, isSuccessful: !1 };
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
throw
|
|
167
|
-
},
|
|
174
|
+
}, Pe = ({ kind: e, readyState: n }) => e === "video" && n === "live", U = (e, n, { onEnterPurgatory: t, onEnterConference: o }) => {
|
|
175
|
+
A(e) ? t && t() : o && o({ isSuccessProgressCall: n });
|
|
176
|
+
}, k = (e, n) => {
|
|
177
|
+
e(), n && n();
|
|
178
|
+
}, x = (e, n, t) => {
|
|
179
|
+
throw e && e(), n(), t;
|
|
180
|
+
}, Me = /* @__PURE__ */ new Set([
|
|
168
181
|
"on",
|
|
169
182
|
"once",
|
|
170
183
|
"onceRace",
|
|
@@ -183,7 +196,7 @@ const Q = new Error("Unknown error"), Z = (n = Q) => {
|
|
|
183
196
|
"isConfigured",
|
|
184
197
|
"isRegistered"
|
|
185
198
|
]);
|
|
186
|
-
class
|
|
199
|
+
class Be {
|
|
187
200
|
// @ts-expect-error: proxy method
|
|
188
201
|
on;
|
|
189
202
|
// @ts-expect-error: proxy method
|
|
@@ -219,10 +232,10 @@ class Fe {
|
|
|
219
232
|
// @ts-expect-error: proxy method
|
|
220
233
|
isRegistered;
|
|
221
234
|
sipConnector;
|
|
222
|
-
constructor(
|
|
223
|
-
return this.sipConnector =
|
|
235
|
+
constructor(n) {
|
|
236
|
+
return this.sipConnector = n, new Proxy(this, {
|
|
224
237
|
get: (t, o, a) => {
|
|
225
|
-
if (typeof o == "string" &&
|
|
238
|
+
if (typeof o == "string" && Me.has(o) && o in this.sipConnector) {
|
|
226
239
|
const c = Reflect.get(this.sipConnector, o, this.sipConnector);
|
|
227
240
|
return typeof c == "function" ? c.bind(this.sipConnector) : c;
|
|
228
241
|
}
|
|
@@ -231,8 +244,8 @@ class Fe {
|
|
|
231
244
|
}
|
|
232
245
|
});
|
|
233
246
|
}
|
|
234
|
-
connectToServer = async (
|
|
235
|
-
callToServer = async (
|
|
247
|
+
connectToServer = async (n, t) => this.sipConnector.connect(n, t).then((o) => (r("connectToServer then"), { configuration: o, isSuccessful: !0 })).catch(async (o) => (r("connectToServer catch: error", o), Oe(o)));
|
|
248
|
+
callToServer = async (n) => {
|
|
236
249
|
const {
|
|
237
250
|
conference: t,
|
|
238
251
|
mediaStream: o,
|
|
@@ -242,48 +255,48 @@ class Fe {
|
|
|
242
255
|
degradationPreference: u,
|
|
243
256
|
sendEncodings: d,
|
|
244
257
|
offerToReceiveAudio: E,
|
|
245
|
-
offerToReceiveVideo:
|
|
246
|
-
directionVideo:
|
|
247
|
-
directionAudio:
|
|
258
|
+
offerToReceiveVideo: v,
|
|
259
|
+
directionVideo: T,
|
|
260
|
+
directionAudio: _,
|
|
248
261
|
onBeforeProgressCall: g,
|
|
249
262
|
onSuccessProgressCall: l,
|
|
250
|
-
onEnterPurgatory:
|
|
251
|
-
onEnterConference:
|
|
263
|
+
onEnterPurgatory: C,
|
|
264
|
+
onEnterConference: S,
|
|
252
265
|
onFailProgressCall: R,
|
|
253
266
|
onFinishProgressCall: b,
|
|
254
|
-
onEndedCall:
|
|
267
|
+
onEndedCall: O,
|
|
255
268
|
onAddedTransceiver: P
|
|
256
|
-
} =
|
|
257
|
-
r("callToServer",
|
|
269
|
+
} = n;
|
|
270
|
+
r("callToServer", n);
|
|
258
271
|
const M = async () => (r("startCall"), this.sipConnector.call({
|
|
259
272
|
mediaStream: o,
|
|
260
273
|
extraHeaders: a,
|
|
261
274
|
iceServers: s,
|
|
262
275
|
contentHint: c,
|
|
263
276
|
offerToReceiveAudio: E,
|
|
264
|
-
offerToReceiveVideo:
|
|
265
|
-
directionVideo:
|
|
266
|
-
directionAudio:
|
|
277
|
+
offerToReceiveVideo: v,
|
|
278
|
+
directionVideo: T,
|
|
279
|
+
directionAudio: _,
|
|
267
280
|
degradationPreference: u,
|
|
268
281
|
onAddedTransceiver: P,
|
|
269
282
|
sendEncodings: d,
|
|
270
283
|
number: t
|
|
271
284
|
}));
|
|
272
|
-
let
|
|
273
|
-
const h = (r("subscribeEnterConference: onEnterConference",
|
|
274
|
-
r("enterRoom", { _room: i, isSuccessProgressCall:
|
|
275
|
-
onEnterPurgatory:
|
|
276
|
-
onEnterConference:
|
|
285
|
+
let f = !1, m;
|
|
286
|
+
const h = (r("subscribeEnterConference: onEnterConference", S), this.sipConnector.on("api:enterRoom", ({ room: i }) => {
|
|
287
|
+
r("enterRoom", { _room: i, isSuccessProgressCall: f }), m = i, (C ?? S) && U(m, f, {
|
|
288
|
+
onEnterPurgatory: C,
|
|
289
|
+
onEnterConference: S
|
|
277
290
|
});
|
|
278
|
-
})),
|
|
279
|
-
|
|
280
|
-
}), i),
|
|
291
|
+
})), D = (i) => (r("onSuccess"), f = !0, l && l({ isPurgatory: A(m) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
292
|
+
k(h, O);
|
|
293
|
+
}), i), F = (i) => (r("onFail"), x(R, h, i)), I = () => {
|
|
281
294
|
r("onFinish"), b && b();
|
|
282
295
|
};
|
|
283
|
-
return r("onBeforeProgressCall"), g && g(t), M().then(
|
|
296
|
+
return r("onBeforeProgressCall"), g && g(t), M().then(D).catch((i) => F(i)).finally(I);
|
|
284
297
|
};
|
|
285
|
-
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (r("disconnectFromServer: then"), { isSuccessful: !0 })).catch((
|
|
286
|
-
answerToIncomingCall = async (
|
|
298
|
+
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (r("disconnectFromServer: then"), { isSuccessful: !0 })).catch((n) => (r("disconnectFromServer: catch", n), { isSuccessful: !1 }));
|
|
299
|
+
answerToIncomingCall = async (n) => {
|
|
287
300
|
const {
|
|
288
301
|
mediaStream: t,
|
|
289
302
|
extraHeaders: o,
|
|
@@ -293,18 +306,18 @@ class Fe {
|
|
|
293
306
|
sendEncodings: u,
|
|
294
307
|
offerToReceiveAudio: d,
|
|
295
308
|
offerToReceiveVideo: E,
|
|
296
|
-
directionVideo:
|
|
297
|
-
directionAudio:
|
|
298
|
-
onBeforeProgressCall:
|
|
309
|
+
directionVideo: v,
|
|
310
|
+
directionAudio: T,
|
|
311
|
+
onBeforeProgressCall: _,
|
|
299
312
|
onSuccessProgressCall: g,
|
|
300
313
|
onEnterPurgatory: l,
|
|
301
|
-
onEnterConference:
|
|
302
|
-
onFailProgressCall:
|
|
314
|
+
onEnterConference: C,
|
|
315
|
+
onFailProgressCall: S,
|
|
303
316
|
onFinishProgressCall: R,
|
|
304
317
|
onEndedCall: b,
|
|
305
|
-
onAddedTransceiver:
|
|
306
|
-
} =
|
|
307
|
-
r("answerToIncomingCall",
|
|
318
|
+
onAddedTransceiver: O
|
|
319
|
+
} = n;
|
|
320
|
+
r("answerToIncomingCall", n);
|
|
308
321
|
const P = async () => this.sipConnector.answerToIncomingCall({
|
|
309
322
|
mediaStream: t,
|
|
310
323
|
extraHeaders: o,
|
|
@@ -312,40 +325,40 @@ class Fe {
|
|
|
312
325
|
contentHint: s,
|
|
313
326
|
offerToReceiveAudio: d,
|
|
314
327
|
offerToReceiveVideo: E,
|
|
315
|
-
directionVideo:
|
|
316
|
-
directionAudio:
|
|
328
|
+
directionVideo: v,
|
|
329
|
+
directionAudio: T,
|
|
317
330
|
degradationPreference: c,
|
|
318
|
-
onAddedTransceiver:
|
|
331
|
+
onAddedTransceiver: O,
|
|
319
332
|
sendEncodings: u
|
|
320
333
|
}), M = () => {
|
|
321
334
|
const { remoteCallerData: i } = this.sipConnector;
|
|
322
335
|
return i.incomingNumber;
|
|
323
336
|
};
|
|
324
|
-
let
|
|
325
|
-
const h = (r("subscribeEnterConference: onEnterConference",
|
|
326
|
-
r("enterRoom", { room: i.room, isSuccessProgressCall:
|
|
337
|
+
let f = !1, m;
|
|
338
|
+
const h = (r("subscribeEnterConference: onEnterConference", C), this.sipConnector.on("api:enterRoom", (i) => {
|
|
339
|
+
r("enterRoom", { room: i.room, isSuccessProgressCall: f }), m = i.room, (l ?? C) && U(m, f, {
|
|
327
340
|
onEnterPurgatory: l,
|
|
328
|
-
onEnterConference:
|
|
341
|
+
onEnterConference: C
|
|
329
342
|
});
|
|
330
|
-
})),
|
|
331
|
-
|
|
332
|
-
}), i),
|
|
343
|
+
})), D = (i) => (r("onSuccess"), f = !0, g && g({ isPurgatory: A(m) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
344
|
+
k(h, b);
|
|
345
|
+
}), i), F = (i) => (r("onFail"), x(S, h, i)), I = () => {
|
|
333
346
|
r("onFinish"), R && R();
|
|
334
347
|
};
|
|
335
|
-
if (r("onBeforeProgressCall"),
|
|
348
|
+
if (r("onBeforeProgressCall"), _) {
|
|
336
349
|
const i = M();
|
|
337
|
-
|
|
350
|
+
_(i);
|
|
338
351
|
}
|
|
339
|
-
return P().then(
|
|
352
|
+
return P().then(D).catch((i) => F(i)).finally(I);
|
|
340
353
|
};
|
|
341
354
|
updatePresentation = async ({
|
|
342
|
-
mediaStream:
|
|
355
|
+
mediaStream: n,
|
|
343
356
|
isP2P: t,
|
|
344
357
|
contentHint: o,
|
|
345
358
|
degradationPreference: a,
|
|
346
359
|
sendEncodings: s,
|
|
347
360
|
onAddedTransceiver: c
|
|
348
|
-
}) => (r("updatePresentation"), this.sipConnector.updatePresentation(
|
|
361
|
+
}) => (r("updatePresentation"), this.sipConnector.updatePresentation(n, {
|
|
349
362
|
isP2P: t,
|
|
350
363
|
contentHint: o,
|
|
351
364
|
degradationPreference: a,
|
|
@@ -353,14 +366,14 @@ class Fe {
|
|
|
353
366
|
sendEncodings: s
|
|
354
367
|
}));
|
|
355
368
|
startPresentation = async ({
|
|
356
|
-
mediaStream:
|
|
369
|
+
mediaStream: n,
|
|
357
370
|
isP2P: t,
|
|
358
371
|
contentHint: o,
|
|
359
372
|
degradationPreference: a,
|
|
360
373
|
sendEncodings: s,
|
|
361
374
|
callLimit: c,
|
|
362
375
|
onAddedTransceiver: u
|
|
363
|
-
}) => (r("startPresentation"), this.sipConnector.startPresentation(
|
|
376
|
+
}) => (r("startPresentation"), this.sipConnector.startPresentation(n, {
|
|
364
377
|
isP2P: t,
|
|
365
378
|
contentHint: o,
|
|
366
379
|
callLimit: c,
|
|
@@ -368,28 +381,28 @@ class Fe {
|
|
|
368
381
|
onAddedTransceiver: u,
|
|
369
382
|
sendEncodings: s
|
|
370
383
|
}));
|
|
371
|
-
stopShareSipConnector = async ({ isP2P:
|
|
372
|
-
isP2P:
|
|
384
|
+
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (r("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
385
|
+
isP2P: n
|
|
373
386
|
}).catch((t) => {
|
|
374
387
|
r(t);
|
|
375
388
|
}));
|
|
376
389
|
sendRefusalToTurnOnMic = async () => {
|
|
377
|
-
r("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((
|
|
378
|
-
r("sendRefusalToTurnOnMic: error",
|
|
390
|
+
r("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((n) => {
|
|
391
|
+
r("sendRefusalToTurnOnMic: error", n);
|
|
379
392
|
});
|
|
380
393
|
};
|
|
381
394
|
sendRefusalToTurnOnCam = async () => {
|
|
382
|
-
r("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((
|
|
383
|
-
r("sendRefusalToTurnOnCam: error",
|
|
395
|
+
r("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((n) => {
|
|
396
|
+
r("sendRefusalToTurnOnCam: error", n);
|
|
384
397
|
});
|
|
385
398
|
};
|
|
386
399
|
sendMediaState = async ({
|
|
387
|
-
isEnabledCam:
|
|
400
|
+
isEnabledCam: n,
|
|
388
401
|
isEnabledMic: t
|
|
389
402
|
}) => {
|
|
390
|
-
r("sendMediaState"), await this.sipConnector.sendMediaState({ cam:
|
|
403
|
+
r("sendMediaState"), await this.sipConnector.sendMediaState({ cam: n, mic: t });
|
|
391
404
|
};
|
|
392
|
-
replaceMediaStream = async (
|
|
405
|
+
replaceMediaStream = async (n, {
|
|
393
406
|
deleteExisting: t,
|
|
394
407
|
addMissing: o,
|
|
395
408
|
forceRenegotiation: a,
|
|
@@ -397,7 +410,7 @@ class Fe {
|
|
|
397
410
|
degradationPreference: c,
|
|
398
411
|
sendEncodings: u,
|
|
399
412
|
onAddedTransceiver: d
|
|
400
|
-
}) => (r("replaceMediaStream"), this.sipConnector.replaceMediaStream(
|
|
413
|
+
}) => (r("replaceMediaStream"), this.sipConnector.replaceMediaStream(n, {
|
|
401
414
|
deleteExisting: t,
|
|
402
415
|
addMissing: o,
|
|
403
416
|
forceRenegotiation: a,
|
|
@@ -410,42 +423,47 @@ class Fe {
|
|
|
410
423
|
r("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
|
|
411
424
|
};
|
|
412
425
|
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
413
|
-
onReadyRemoteStreams:
|
|
414
|
-
}) =>
|
|
426
|
+
onReadyRemoteStreams: n
|
|
427
|
+
}) => z(() => {
|
|
415
428
|
const t = this.sipConnector.getRemoteStreams();
|
|
416
|
-
r("remoteStreams", t),
|
|
429
|
+
r("remoteStreams", t), n(t);
|
|
417
430
|
}, 200);
|
|
418
431
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
419
432
|
resolveHandleReadyRemoteStreams = ({
|
|
420
|
-
onReadyRemoteStreams:
|
|
433
|
+
onReadyRemoteStreams: n
|
|
421
434
|
}) => ({ track: t }) => {
|
|
422
|
-
|
|
435
|
+
Pe(t) && n();
|
|
423
436
|
};
|
|
424
437
|
getRemoteStreams = () => (r("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
425
|
-
onUseLicense = (
|
|
426
|
-
onMustStopPresentation = (
|
|
427
|
-
onMoveToSpectators = (
|
|
428
|
-
onMoveToParticipants = (
|
|
429
|
-
onStats = (
|
|
430
|
-
offStats = (
|
|
431
|
-
r("offStats"), this.sipConnector.off("stats:collected",
|
|
438
|
+
onUseLicense = (n) => (r("onUseLicense"), this.sipConnector.on("api:useLicense", n));
|
|
439
|
+
onMustStopPresentation = (n) => (r("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", n));
|
|
440
|
+
onMoveToSpectators = (n) => (r("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", n));
|
|
441
|
+
onMoveToParticipants = (n) => (r("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", n));
|
|
442
|
+
onStats = (n) => (r("onStats"), this.sipConnector.on("stats:collected", n));
|
|
443
|
+
offStats = (n) => {
|
|
444
|
+
r("offStats"), this.sipConnector.off("stats:collected", n);
|
|
432
445
|
};
|
|
433
446
|
}
|
|
434
|
-
var
|
|
447
|
+
var Ne = /* @__PURE__ */ ((e) => (e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e))(Ne || {});
|
|
435
448
|
export {
|
|
436
449
|
p as ECallCause,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
Be as
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
450
|
+
w as ECallStatus,
|
|
451
|
+
He as EConnectionStatus,
|
|
452
|
+
H as EIncomingStatus,
|
|
453
|
+
Ne as EMimeTypesVideoCodecs,
|
|
454
|
+
je as EPresentationStatus,
|
|
455
|
+
Ke as EStatsTypes,
|
|
456
|
+
Xe as EUseLicense,
|
|
457
|
+
Ye as SipConnector,
|
|
458
|
+
Be as SipConnectorFacade,
|
|
459
|
+
Ge as StatsPeerConnection,
|
|
460
|
+
qe as disableDebug,
|
|
461
|
+
ze as enableDebug,
|
|
462
|
+
Je as getCodecFromSender,
|
|
463
|
+
Ve as hasAvailableStats,
|
|
464
|
+
ke as hasCanceledCallError,
|
|
465
|
+
Qe as hasCanceledStartPresentationError,
|
|
466
|
+
en as hasConnectionPromiseIsNotActualError,
|
|
467
|
+
xe as sessionSelectors,
|
|
468
|
+
Le as tools
|
|
451
469
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CallManager } from '../CallManager';
|
|
2
|
+
import { ConnectionManager } from '../ConnectionManager';
|
|
3
|
+
import { IncomingCallManager } from '../IncomingCallManager';
|
|
4
|
+
import { PresentationManager } from '../PresentationManager';
|
|
5
|
+
import { TSessionActors, TSessionSnapshot } from './types';
|
|
6
|
+
type TEqualityFunction<T> = (previous: T, next: T) => boolean;
|
|
7
|
+
type TSelector<T> = (snapshot: TSessionSnapshot) => T;
|
|
8
|
+
type TSubscribeOverload = {
|
|
9
|
+
(listener: (snapshot: TSessionSnapshot) => void): () => void;
|
|
10
|
+
<T>(selector: TSelector<T>, listener: (value: T) => void, equals?: TEqualityFunction<T>): () => void;
|
|
11
|
+
};
|
|
12
|
+
export interface ISession {
|
|
13
|
+
getSnapshot: () => TSessionSnapshot;
|
|
14
|
+
subscribe: TSubscribeOverload;
|
|
15
|
+
stop: () => void;
|
|
16
|
+
actors: TSessionActors;
|
|
17
|
+
actor: TSessionActors;
|
|
18
|
+
}
|
|
19
|
+
type TSessionDeps = {
|
|
20
|
+
connectionManager: Pick<ConnectionManager, 'connectionActor'>;
|
|
21
|
+
callManager: Pick<CallManager, 'callActor'>;
|
|
22
|
+
incomingCallManager: Pick<IncomingCallManager, 'incomingActor'>;
|
|
23
|
+
presentationManager: Pick<PresentationManager, 'presentationActor'>;
|
|
24
|
+
};
|
|
25
|
+
export declare const createSession: (deps: TSessionDeps) => ISession;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createSession } from './createSession';
|
|
2
|
+
export { sessionSelectors } from './selectors';
|
|
3
|
+
export { ECallStatus, EConnectionStatus, EIncomingStatus, EPresentationStatus } from './types';
|
|
4
|
+
export type { ISession } from './createSession';
|
|
5
|
+
export type { TSessionActors, TSessionSnapshot } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EIncomingStatus, ECallStatus, EConnectionStatus, EPresentationStatus, TSessionSnapshot } from './types';
|
|
2
|
+
import { TRemoteCallerData } from '../IncomingCallManager';
|
|
3
|
+
export declare const sessionSelectors: {
|
|
4
|
+
selectConnectionStatus: (snapshot: TSessionSnapshot) => EConnectionStatus;
|
|
5
|
+
selectCallStatus: (snapshot: TSessionSnapshot) => ECallStatus;
|
|
6
|
+
selectIncomingStatus: (snapshot: TSessionSnapshot) => EIncomingStatus;
|
|
7
|
+
selectIncomingRemoteCaller: (snapshot: TSessionSnapshot) => TRemoteCallerData | undefined;
|
|
8
|
+
selectPresentationStatus: (snapshot: TSessionSnapshot) => EPresentationStatus;
|
|
9
|
+
selectIsInCall: (snapshot: TSessionSnapshot) => boolean;
|
|
10
|
+
};
|