@observertc/observer-js 0.42.9 → 1.0.1-57a1811.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/.prettierrc +6 -6
- package/README.md +0 -104
- package/lib/ObservedCall.d.ts +38 -41
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +97 -109
- package/lib/ObservedCertificate.d.ts +19 -0
- package/lib/ObservedCertificate.d.ts.map +1 -0
- package/lib/ObservedCertificate.js +38 -0
- package/lib/ObservedClient.d.ts +49 -127
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +201 -750
- package/lib/ObservedCodec.d.ts +22 -0
- package/lib/ObservedCodec.d.ts.map +1 -0
- package/lib/ObservedCodec.js +45 -0
- package/lib/ObservedDataChannel.d.ts +23 -69
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +67 -109
- package/lib/ObservedIceCandidate.d.ts +29 -0
- package/lib/ObservedIceCandidate.d.ts.map +1 -0
- package/lib/ObservedIceCandidate.js +59 -0
- package/lib/ObservedIceCandidatePair.d.ts +44 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/ObservedIceCandidatePair.js +111 -0
- package/lib/ObservedIceTransport.d.ts +32 -0
- package/lib/ObservedIceTransport.d.ts.map +1 -0
- package/lib/ObservedIceTransport.js +65 -0
- package/lib/ObservedInboundRtp.d.ts +92 -0
- package/lib/ObservedInboundRtp.d.ts.map +1 -0
- package/lib/ObservedInboundRtp.js +193 -0
- package/lib/ObservedInboundTrack.d.ts +29 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +57 -0
- package/lib/ObservedMediaPlayout.d.ts +22 -0
- package/lib/ObservedMediaPlayout.d.ts.map +1 -0
- package/lib/ObservedMediaPlayout.js +42 -0
- package/lib/ObservedMediaSource.d.ts +28 -0
- package/lib/ObservedMediaSource.d.ts.map +1 -0
- package/lib/ObservedMediaSource.js +55 -0
- package/lib/ObservedOutboundRtp.d.ts +62 -0
- package/lib/ObservedOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedOutboundRtp.js +144 -0
- package/lib/ObservedOutboundTrack.d.ts +29 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +57 -0
- package/lib/ObservedPeerConnection.d.ts +128 -78
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +624 -357
- package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
- package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
- package/lib/ObservedPeerConnectionTransport.js +34 -0
- package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteInboundRtp.js +60 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteOutboundRtp.js +60 -0
- package/lib/ObservedTURN.d.ts +31 -0
- package/lib/ObservedTURN.d.ts.map +1 -0
- package/lib/ObservedTURN.js +58 -0
- package/lib/ObservedTurnServer.d.ts +25 -0
- package/lib/ObservedTurnServer.d.ts.map +1 -0
- package/lib/ObservedTurnServer.js +59 -0
- package/lib/Observer.d.ts +31 -51
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +75 -229
- package/lib/common/Middleware.d.ts +10 -1
- package/lib/common/Middleware.d.ts.map +1 -1
- package/lib/common/Middleware.js +55 -36
- package/lib/common/logger.d.ts +8 -4
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +44 -68
- package/lib/common/types.d.ts +0 -21
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +13 -1
- package/lib/detectors/Detector.d.ts +5 -0
- package/lib/detectors/Detector.d.ts.map +1 -0
- package/lib/detectors/Detector.js +3 -0
- package/lib/detectors/Detectors.d.ts +11 -0
- package/lib/detectors/Detectors.d.ts.map +1 -0
- package/lib/detectors/Detectors.js +34 -0
- package/lib/index.d.ts +24 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -41
- package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
- package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
- package/lib/monitors/TurnUsageMonitor.js +145 -120
- package/lib/schema/ClientEventTypes.d.ts +33 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +38 -0
- package/lib/schema/ClientMetaTypes.d.ts +34 -0
- package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
- package/lib/schema/ClientMetaTypes.js +16 -0
- package/lib/schema/ClientSample.d.ts +1333 -0
- package/lib/schema/ClientSample.d.ts.map +1 -0
- package/lib/schema/ClientSample.js +4 -0
- package/lib/scores/CalculatedScore.d.ts +6 -0
- package/lib/scores/CalculatedScore.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.js +21 -0
- package/lib/scores/ScoreCalculator.d.ts +4 -0
- package/lib/scores/ScoreCalculator.d.ts.map +1 -0
- package/lib/scores/ScoreCalculator.js +2 -0
- package/lib/utils/CallUpdater.d.ts +5 -0
- package/lib/utils/CallUpdater.d.ts.map +1 -0
- package/lib/utils/CallUpdater.js +2 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts +16 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/OnAllClientCallUpdater.js +58 -0
- package/lib/utils/RemoteTrackResolver.d.ts +7 -0
- package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/RemoteTrackResolver.js +2 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts +14 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/onAnyClientCallUpdater.js +51 -0
- package/package.json +4 -4
- package/src/ObservedCall.ts +116 -166
- package/src/ObservedCertificate.ts +43 -0
- package/src/ObservedClient.ts +213 -1060
- package/src/ObservedCodec.ts +49 -0
- package/src/ObservedDataChannel.ts +68 -181
- package/src/ObservedIceCandidate.ts +64 -0
- package/src/ObservedIceCandidatePair.ts +118 -0
- package/src/ObservedIceTransport.ts +70 -0
- package/src/ObservedInboundRtp.ts +205 -0
- package/src/ObservedInboundTrack.ts +70 -0
- package/src/ObservedMediaPlayout.ts +49 -0
- package/src/ObservedMediaSource.ts +60 -0
- package/src/ObservedOutboundRtp.ts +156 -0
- package/src/ObservedOutboundTrack.ts +69 -0
- package/src/ObservedPeerConnection.ts +827 -405
- package/src/ObservedPeerConnectionTransport.ts +38 -0
- package/src/ObservedRemoteInboundRtp.ts +64 -0
- package/src/ObservedRemoteOutboundRtp.ts +65 -0
- package/src/ObservedTURN.ts +86 -0
- package/src/ObservedTurnServer.ts +72 -0
- package/src/Observer.ts +91 -302
- package/src/common/Middleware.ts +70 -42
- package/src/common/logger.ts +60 -69
- package/src/common/types.ts +0 -42
- package/src/common/utils.ts +12 -0
- package/src/detectors/Detector.ts +6 -0
- package/src/detectors/Detectors.ts +38 -0
- package/src/index.ts +24 -90
- package/src/monitors/TurnUsageMonitor.ts +164 -164
- package/src/schema/ClientEventTypes.ts +36 -0
- package/src/schema/ClientMetaTypes.ts +41 -0
- package/src/schema/ClientSample.ts +1682 -0
- package/src/scores/CalculatedScore.ts +6 -0
- package/src/scores/DefaultCallScoreCalculator.ts +23 -0
- package/src/scores/ScoreCalculator.ts +3 -0
- package/src/utils/CallUpdater.ts +5 -0
- package/src/utils/OnAllClientCallUpdater.ts +68 -0
- package/src/utils/RemoteTrackResolver.ts +12 -0
- package/src/utils/onAnyClientCallUpdater.ts +59 -0
- package/tsconfig.json +3 -3
- package/lib/ObservedICE.d.ts +0 -64
- package/lib/ObservedICE.d.ts.map +0 -1
- package/lib/ObservedICE.js +0 -141
- package/lib/ObservedInboundAudioTrack.d.ts +0 -96
- package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedInboundAudioTrack.js +0 -217
- package/lib/ObservedInboundVideoTrack.d.ts +0 -101
- package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedInboundVideoTrack.js +0 -232
- package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
- package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundAudioTrack.js +0 -186
- package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
- package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundVideoTrack.js +0 -193
- package/lib/ObservedSfu.d.ts +0 -59
- package/lib/ObservedSfu.d.ts.map +0 -1
- package/lib/ObservedSfu.js +0 -157
- package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuInboundRtpPad.js +0 -71
- package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuOutboundRtpPad.js +0 -72
- package/lib/ObservedSfuSctpChannel.d.ts +0 -42
- package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/ObservedSfuSctpChannel.js +0 -57
- package/lib/ObservedSfuTransport.d.ts +0 -58
- package/lib/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/ObservedSfuTransport.js +0 -120
- package/lib/RemoteTrackAssigner.d.ts +0 -14
- package/lib/RemoteTrackAssigner.d.ts.map +0 -1
- package/lib/RemoteTrackAssigner.js +0 -52
- package/lib/ReportsCollector.d.ts +0 -109
- package/lib/ReportsCollector.d.ts.map +0 -1
- package/lib/ReportsCollector.js +0 -207
- package/lib/common/CalculatedScore.d.ts +0 -80
- package/lib/common/CalculatedScore.d.ts.map +0 -1
- package/lib/common/CalculatedScore.js +0 -162
- package/lib/common/CallEventType.d.ts +0 -63
- package/lib/common/CallEventType.d.ts.map +0 -1
- package/lib/common/CallEventType.js +0 -39
- package/lib/common/CallMetaReports.d.ts +0 -42
- package/lib/common/CallMetaReports.d.ts.map +0 -1
- package/lib/common/CallMetaReports.js +0 -36
- package/lib/common/QualityScoreUtils.d.ts +0 -1
- package/lib/common/QualityScoreUtils.d.ts.map +0 -1
- package/lib/common/QualityScoreUtils.js +0 -1
- package/lib/common/TypedEventEmitter.d.ts +0 -22
- package/lib/common/TypedEventEmitter.d.ts.map +0 -1
- package/lib/common/TypedEventEmitter.js +0 -11
- package/lib/common/callEventReports.d.ts +0 -10
- package/lib/common/callEventReports.d.ts.map +0 -1
- package/lib/common/callEventReports.js +0 -112
- package/lib/monitors/CallSummary.d.ts +0 -37
- package/lib/monitors/CallSummary.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
- package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.js +0 -152
- package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
- package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
- package/lib/monitors/ClientIssueMonitor.js +0 -49
- package/lib/monitors/SfuServerMonitor.d.ts +0 -79
- package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
- package/lib/monitors/SfuServerMonitor.js +0 -198
- package/src/ObservedICE.ts +0 -237
- package/src/ObservedInboundAudioTrack.ts +0 -344
- package/src/ObservedInboundVideoTrack.ts +0 -361
- package/src/ObservedOutboundAudioTrack.ts +0 -307
- package/src/ObservedOutboundVideoTrack.ts +0 -319
- package/src/ObservedSfu.ts +0 -231
- package/src/ObservedSfuInboundRtpPad.ts +0 -106
- package/src/ObservedSfuOutboundRtpPad.ts +0 -107
- package/src/ObservedSfuSctpChannel.ts +0 -103
- package/src/ObservedSfuTransport.ts +0 -185
- package/src/RemoteTrackAssigner.ts +0 -68
- package/src/ReportsCollector.ts +0 -336
- package/src/common/CalculatedScore.ts +0 -188
- package/src/common/CallEventType.ts +0 -69
- package/src/common/CallMetaReports.ts +0 -82
- package/src/common/QualityScoreUtils.ts +0 -0
- package/src/common/TypedEventEmitter.ts +0 -32
- package/src/common/callEventReports.ts +0 -178
- package/src/monitors/CallSummary.ts +0 -38
- package/src/monitors/CallSummaryMonitor.ts +0 -192
- package/src/monitors/ClientIssueMonitor.ts +0 -88
- package/src/monitors/SfuServerMonitor.ts +0 -285
- /package/lib/{monitors/CallSummary.js → scores/CalculatedScore.js} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import EventEmitter from 'events';
|
|
2
|
-
|
|
3
|
-
export type EventMap = {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
[key: string]: [...unknown[]]
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function createTypedEventEmitter<Events extends EventMap>() {
|
|
9
|
-
return new EventEmitter() as TypedEventEmitter<Events>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface TypedEventEmitter<Events extends EventMap> {
|
|
13
|
-
addListener<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
14
|
-
on<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
15
|
-
once<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
16
|
-
prependListener<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
17
|
-
prependOnceListener<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
18
|
-
|
|
19
|
-
off<E extends keyof Events>(event: E, listener: (...data: Events[E]) => void): this
|
|
20
|
-
removeAllListeners<E extends keyof Events> (event?: E): this
|
|
21
|
-
removeListener<E extends keyof Events> (event: E, listener: (...data: Events[E]) => void): this
|
|
22
|
-
|
|
23
|
-
emit<E extends keyof Events> (event: E, ...args: Events[E]): boolean
|
|
24
|
-
// The sloppy `eventNames()` return type is to mitigate type incompatibilities - see #5
|
|
25
|
-
eventNames(): (keyof Events | string | symbol)[]
|
|
26
|
-
rawListeners<E extends keyof Events> (event: E): ((...data: Events[E]) => void)[]
|
|
27
|
-
listeners<E extends keyof Events> (event: E): ((...data: Events[E]) => void)[]
|
|
28
|
-
listenerCount<E extends keyof Events> (event: E): number
|
|
29
|
-
|
|
30
|
-
getMaxListeners (): number
|
|
31
|
-
setMaxListeners (maxListeners: number): this
|
|
32
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { CallEventReport } from '@observertc/report-schemas-js';
|
|
2
|
-
import { CallEventType } from './CallEventType';
|
|
3
|
-
|
|
4
|
-
export function createCallStartedEventReport(
|
|
5
|
-
serviceId: string,
|
|
6
|
-
roomId: string,
|
|
7
|
-
callId: string,
|
|
8
|
-
timestamp: number,
|
|
9
|
-
marker?: string
|
|
10
|
-
): CallEventReport {
|
|
11
|
-
return {
|
|
12
|
-
name: CallEventType.CALL_STARTED,
|
|
13
|
-
serviceId,
|
|
14
|
-
roomId,
|
|
15
|
-
callId,
|
|
16
|
-
timestamp,
|
|
17
|
-
marker,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function createCallEndedEventReport(
|
|
22
|
-
serviceId: string,
|
|
23
|
-
roomId: string,
|
|
24
|
-
callId: string,
|
|
25
|
-
timestamp: number,
|
|
26
|
-
marker?: string
|
|
27
|
-
): CallEventReport {
|
|
28
|
-
return {
|
|
29
|
-
name: CallEventType.CALL_ENDED,
|
|
30
|
-
serviceId,
|
|
31
|
-
roomId,
|
|
32
|
-
callId,
|
|
33
|
-
timestamp,
|
|
34
|
-
marker,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function createClientJoinedEventReport(
|
|
39
|
-
serviceId: string,
|
|
40
|
-
mediaUnitId: string,
|
|
41
|
-
roomId: string,
|
|
42
|
-
callId: string,
|
|
43
|
-
clientId: string,
|
|
44
|
-
timestamp: number,
|
|
45
|
-
userId?: string,
|
|
46
|
-
marker?: string
|
|
47
|
-
): CallEventReport {
|
|
48
|
-
return {
|
|
49
|
-
name: CallEventType.CLIENT_JOINED,
|
|
50
|
-
serviceId,
|
|
51
|
-
mediaUnitId,
|
|
52
|
-
roomId,
|
|
53
|
-
callId,
|
|
54
|
-
clientId,
|
|
55
|
-
timestamp,
|
|
56
|
-
userId,
|
|
57
|
-
marker,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function createClientLeftEventReport(
|
|
62
|
-
serviceId: string,
|
|
63
|
-
mediaUnitId: string,
|
|
64
|
-
roomId: string,
|
|
65
|
-
callId: string,
|
|
66
|
-
clientId: string,
|
|
67
|
-
timestamp: number,
|
|
68
|
-
userId?: string,
|
|
69
|
-
marker?: string
|
|
70
|
-
): CallEventReport {
|
|
71
|
-
return {
|
|
72
|
-
name: CallEventType.CLIENT_LEFT,
|
|
73
|
-
serviceId,
|
|
74
|
-
mediaUnitId,
|
|
75
|
-
roomId,
|
|
76
|
-
callId,
|
|
77
|
-
clientId,
|
|
78
|
-
timestamp,
|
|
79
|
-
userId,
|
|
80
|
-
marker,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function createPeerConnectionOpenedEventReport(
|
|
85
|
-
serviceId: string,
|
|
86
|
-
mediaUnitId: string,
|
|
87
|
-
roomId: string,
|
|
88
|
-
callId: string,
|
|
89
|
-
clientId: string,
|
|
90
|
-
peerConnectionId: string,
|
|
91
|
-
timestamp: number,
|
|
92
|
-
marker?: string
|
|
93
|
-
): CallEventReport {
|
|
94
|
-
return {
|
|
95
|
-
name: CallEventType.PEER_CONNECTION_OPENED,
|
|
96
|
-
serviceId,
|
|
97
|
-
mediaUnitId,
|
|
98
|
-
roomId,
|
|
99
|
-
callId,
|
|
100
|
-
clientId,
|
|
101
|
-
peerConnectionId,
|
|
102
|
-
timestamp,
|
|
103
|
-
marker,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function createPeerConnectionClosedEventReport(
|
|
108
|
-
serviceId: string,
|
|
109
|
-
mediaUnitId: string,
|
|
110
|
-
roomId: string,
|
|
111
|
-
callId: string,
|
|
112
|
-
clientId: string,
|
|
113
|
-
peerConnectionId: string,
|
|
114
|
-
timestamp: number,
|
|
115
|
-
marker?: string
|
|
116
|
-
): CallEventReport {
|
|
117
|
-
return {
|
|
118
|
-
name: CallEventType.PEER_CONNECTION_CLOSED,
|
|
119
|
-
serviceId,
|
|
120
|
-
mediaUnitId,
|
|
121
|
-
roomId,
|
|
122
|
-
callId,
|
|
123
|
-
clientId,
|
|
124
|
-
peerConnectionId,
|
|
125
|
-
timestamp,
|
|
126
|
-
marker,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function createMediaTrackAddedEventReport(
|
|
131
|
-
serviceId: string,
|
|
132
|
-
mediaUnitId: string,
|
|
133
|
-
roomId: string,
|
|
134
|
-
callId: string,
|
|
135
|
-
clientId: string,
|
|
136
|
-
peerConnectionId: string,
|
|
137
|
-
mediaTrackId: string,
|
|
138
|
-
timestamp: number,
|
|
139
|
-
marker?: string
|
|
140
|
-
): CallEventReport {
|
|
141
|
-
return {
|
|
142
|
-
name: CallEventType.MEDIA_TRACK_ADDED,
|
|
143
|
-
serviceId,
|
|
144
|
-
mediaUnitId,
|
|
145
|
-
roomId,
|
|
146
|
-
callId,
|
|
147
|
-
clientId,
|
|
148
|
-
peerConnectionId,
|
|
149
|
-
mediaTrackId,
|
|
150
|
-
timestamp,
|
|
151
|
-
marker,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function createMediaTrackRemovedEventReport(
|
|
156
|
-
serviceId: string,
|
|
157
|
-
mediaUnitId: string,
|
|
158
|
-
roomId: string,
|
|
159
|
-
callId: string,
|
|
160
|
-
clientId: string,
|
|
161
|
-
peerConnectionId: string,
|
|
162
|
-
mediaTrackId: string,
|
|
163
|
-
timestamp: number,
|
|
164
|
-
marker?: string
|
|
165
|
-
): CallEventReport {
|
|
166
|
-
return {
|
|
167
|
-
name: CallEventType.MEDIA_TRACK_REMOVED,
|
|
168
|
-
serviceId,
|
|
169
|
-
mediaUnitId,
|
|
170
|
-
roomId,
|
|
171
|
-
callId,
|
|
172
|
-
clientId,
|
|
173
|
-
peerConnectionId,
|
|
174
|
-
mediaTrackId,
|
|
175
|
-
timestamp,
|
|
176
|
-
marker,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface ClientIssue extends Record<string, unknown> {
|
|
2
|
-
severity: 'critical' | 'major' | 'minor';
|
|
3
|
-
timestamp: number;
|
|
4
|
-
description?: string;
|
|
5
|
-
peerConnectionId?: string,
|
|
6
|
-
trackId?: string,
|
|
7
|
-
attachments?: Record<string, unknown>,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ClientSummary extends Record<string, unknown> {
|
|
11
|
-
clientId: string;
|
|
12
|
-
mediaUnitId: string;
|
|
13
|
-
userId?: string;
|
|
14
|
-
joined: number;
|
|
15
|
-
left?: number;
|
|
16
|
-
durationInMs: number;
|
|
17
|
-
totalOutboundAudioBytes: number,
|
|
18
|
-
totalOutboundVideoBytes: number,
|
|
19
|
-
totalInboundAudioBytes: number,
|
|
20
|
-
totalInboundVideoBytes: number,
|
|
21
|
-
totalDataChannelBytesSent: number,
|
|
22
|
-
totalDataChannelBytesReceived: number,
|
|
23
|
-
ewmaRttInMs: number,
|
|
24
|
-
usedTurn: boolean;
|
|
25
|
-
issues: ClientIssue[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface CallSummary extends Record<string, unknown> {
|
|
29
|
-
serviceId: string;
|
|
30
|
-
roomId: string;
|
|
31
|
-
callId: string;
|
|
32
|
-
started: number;
|
|
33
|
-
durationInMs: number;
|
|
34
|
-
maxNumberOfParticipants: number;
|
|
35
|
-
numberOfIssues: number;
|
|
36
|
-
highestSeverity?: ClientIssue['severity'],
|
|
37
|
-
clients: ClientSummary[];
|
|
38
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { CallSummary, ClientSummary } from './CallSummary';
|
|
3
|
-
import { ObservedCall } from '../ObservedCall';
|
|
4
|
-
import { ObservedClient } from '../ObservedClient';
|
|
5
|
-
import { ObservedPeerConnection } from '../ObservedPeerConnection';
|
|
6
|
-
import { ObservedOutboundVideoTrack } from '../ObservedOutboundVideoTrack';
|
|
7
|
-
|
|
8
|
-
export type CallSummaryMonitorEvents = {
|
|
9
|
-
close: [],
|
|
10
|
-
summary: [CallSummary],
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type CallSummaryMonitorConfig = {
|
|
14
|
-
detectUserMediaIssues?: boolean;
|
|
15
|
-
detectMediaTrackQualityLimitationIssues?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export declare interface CallSummaryMonitor {
|
|
19
|
-
on<U extends keyof CallSummaryMonitorEvents>(event: U, listener: (...args: CallSummaryMonitorEvents[U]) => void): this;
|
|
20
|
-
off<U extends keyof CallSummaryMonitorEvents>(event: U, listener: (...args: CallSummaryMonitorEvents[U]) => void): this;
|
|
21
|
-
once<U extends keyof CallSummaryMonitorEvents>(event: U, listener: (...args: CallSummaryMonitorEvents[U]) => void): this;
|
|
22
|
-
emit<U extends keyof CallSummaryMonitorEvents>(event: U, ...args: CallSummaryMonitorEvents[U]): boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class CallSummaryMonitor extends EventEmitter {
|
|
26
|
-
private readonly _summaries = new Map<string, CallSummary>();
|
|
27
|
-
|
|
28
|
-
private _closed = false;
|
|
29
|
-
public constructor(
|
|
30
|
-
public readonly config: CallSummaryMonitorConfig = {},
|
|
31
|
-
) {
|
|
32
|
-
super();
|
|
33
|
-
this.setMaxListeners(Infinity);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public addCall(call: ObservedCall) {
|
|
37
|
-
if (this.closed) return;
|
|
38
|
-
|
|
39
|
-
let callSummary: CallSummary | undefined = this._summaries.get(call.callId);
|
|
40
|
-
|
|
41
|
-
if (!callSummary) {
|
|
42
|
-
callSummary = {
|
|
43
|
-
callId: call.callId,
|
|
44
|
-
roomId: call.roomId,
|
|
45
|
-
serviceId: call.serviceId,
|
|
46
|
-
clients: [],
|
|
47
|
-
durationInMs: 0,
|
|
48
|
-
maxNumberOfParticipants: 0,
|
|
49
|
-
numberOfIssues: 0,
|
|
50
|
-
started: call.created,
|
|
51
|
-
};
|
|
52
|
-
this._summaries.set(call.callId, callSummary);
|
|
53
|
-
}
|
|
54
|
-
const constCallSummary = callSummary;
|
|
55
|
-
const onNewClient = (client: ObservedClient) => {
|
|
56
|
-
constCallSummary.maxNumberOfParticipants = Math.max(constCallSummary.maxNumberOfParticipants, call.clients.size);
|
|
57
|
-
this._addClient(constCallSummary, client);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
call.once('close', () => {
|
|
61
|
-
call.off('newclient', onNewClient);
|
|
62
|
-
});
|
|
63
|
-
call.on('newclient', onNewClient);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private _addClient(callSummary: CallSummary, client: ObservedClient) {
|
|
67
|
-
if (this.closed) return;
|
|
68
|
-
const clientSummary: ClientSummary = {
|
|
69
|
-
clientId: client.clientId,
|
|
70
|
-
mediaUnitId: client.mediaUnitId,
|
|
71
|
-
durationInMs: 0,
|
|
72
|
-
totalInboundAudioBytes: 0,
|
|
73
|
-
totalInboundVideoBytes: 0,
|
|
74
|
-
totalOutboundAudioBytes: 0,
|
|
75
|
-
totalOutboundVideoBytes: 0,
|
|
76
|
-
totalDataChannelBytesSent: 0,
|
|
77
|
-
totalDataChannelBytesReceived: 0,
|
|
78
|
-
ewmaRttInMs: 0,
|
|
79
|
-
joined: client.created,
|
|
80
|
-
userId: client.userId,
|
|
81
|
-
usedTurn: false,
|
|
82
|
-
issues: [],
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
callSummary.clients.push(clientSummary);
|
|
86
|
-
|
|
87
|
-
const updateClient = () => {
|
|
88
|
-
if (client.avgRttInMs) {
|
|
89
|
-
clientSummary.ewmaRttInMs = (clientSummary.ewmaRttInMs * 0.9) + (client.avgRttInMs * 0.1);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const onUsingTurn = (usingTurn: boolean) => {
|
|
94
|
-
clientSummary.usedTurn ||= usingTurn;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const onUserMediaError = (error: string) => {
|
|
98
|
-
if (!this.config.detectUserMediaIssues) return;
|
|
99
|
-
|
|
100
|
-
client.addIssue({
|
|
101
|
-
severity: 'critical',
|
|
102
|
-
timestamp: Date.now(),
|
|
103
|
-
description: error,
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const onNewPeerConnection = (peerConnection: ObservedPeerConnection) => this._addPeerConnection(clientSummary, peerConnection);
|
|
108
|
-
|
|
109
|
-
client.on('update', updateClient);
|
|
110
|
-
client.on('usingturn', onUsingTurn);
|
|
111
|
-
client.on('usermediaerror', onUserMediaError);
|
|
112
|
-
client.on('newpeerconnection', onNewPeerConnection);
|
|
113
|
-
client.once('close', () => {
|
|
114
|
-
const now = Date.now();
|
|
115
|
-
|
|
116
|
-
clientSummary.totalInboundAudioBytes = client.totalReceivedAudioBytes;
|
|
117
|
-
clientSummary.totalInboundVideoBytes = client.totalReceivedVideoBytes;
|
|
118
|
-
clientSummary.totalOutboundAudioBytes = client.totalSentAudioBytes;
|
|
119
|
-
clientSummary.totalOutboundVideoBytes = client.totalSentVideoBytes;
|
|
120
|
-
clientSummary.totalDataChannelBytesSent = client.totalDataChannelBytesSent;
|
|
121
|
-
clientSummary.totalDataChannelBytesReceived = client.totalDataChannelBytesReceived;
|
|
122
|
-
clientSummary.durationInMs = now - client.created;
|
|
123
|
-
clientSummary.left = now;
|
|
124
|
-
// client does not store issues after update emitted
|
|
125
|
-
// clientSummary.issues.push(...client.issues);
|
|
126
|
-
|
|
127
|
-
client.off('update', updateClient);
|
|
128
|
-
client.off('usingturn', onUsingTurn);
|
|
129
|
-
client.off('usermediaerror', onUserMediaError);
|
|
130
|
-
client.off('newpeerconnection', onNewPeerConnection);
|
|
131
|
-
|
|
132
|
-
callSummary.durationInMs += clientSummary.durationInMs;
|
|
133
|
-
callSummary.numberOfIssues += clientSummary.issues.length;
|
|
134
|
-
callSummary.highestSeverity = clientSummary.issues.reduce((highest, issue) => {
|
|
135
|
-
if (issue.severity === 'critical') return 'critical';
|
|
136
|
-
if (issue.severity === 'major' && highest !== 'critical') return 'major';
|
|
137
|
-
if (issue.severity === 'minor' && highest !== 'critical' && highest !== 'major') return 'minor';
|
|
138
|
-
|
|
139
|
-
return highest;
|
|
140
|
-
}, callSummary.highestSeverity);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private _addPeerConnection(clientSummary: ClientSummary, peerConnection: ObservedPeerConnection) {
|
|
145
|
-
const onOutboundVideoTrack = (track: ObservedOutboundVideoTrack) => this._addOutboundVideoTrack(clientSummary, track);
|
|
146
|
-
|
|
147
|
-
peerConnection.on('newoutboundvideotrack', onOutboundVideoTrack);
|
|
148
|
-
peerConnection.once('close', () => {
|
|
149
|
-
peerConnection.off('newoutboundvideotrack', onOutboundVideoTrack);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private _addOutboundVideoTrack(clientSummary: ClientSummary, track: ObservedOutboundVideoTrack) {
|
|
154
|
-
const onQualityLimitationChanged = (reason: string) => {
|
|
155
|
-
if (!this.config.detectMediaTrackQualityLimitationIssues) return;
|
|
156
|
-
|
|
157
|
-
track.peerConnection.client.addIssue({
|
|
158
|
-
severity: 'minor',
|
|
159
|
-
timestamp: Date.now(),
|
|
160
|
-
description: reason,
|
|
161
|
-
peerConnectionId: track.peerConnectionId,
|
|
162
|
-
trackId: track.trackId,
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
track.once('close', () => {
|
|
167
|
-
track.off('qualitylimitationchanged', onQualityLimitationChanged);
|
|
168
|
-
});
|
|
169
|
-
track.on('qualitylimitationchanged', onQualityLimitationChanged);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public takeSummary(callId: string): CallSummary | undefined {
|
|
173
|
-
if (this.closed) return;
|
|
174
|
-
|
|
175
|
-
const summary = this._summaries.get(callId);
|
|
176
|
-
|
|
177
|
-
this._summaries.delete(callId);
|
|
178
|
-
|
|
179
|
-
return summary;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
public get closed() {
|
|
183
|
-
return this._closed;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
public close() {
|
|
187
|
-
if (this._closed) return;
|
|
188
|
-
this._closed = true;
|
|
189
|
-
|
|
190
|
-
this.emit('close');
|
|
191
|
-
}
|
|
192
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { ObservedCall } from '../ObservedCall';
|
|
3
|
-
import { ObservedClient } from '../ObservedClient';
|
|
4
|
-
import { ClientIssue } from './CallSummary';
|
|
5
|
-
|
|
6
|
-
export type ClientIssueMonitorEmittedIssueEvent = ClientIssue & {
|
|
7
|
-
clientId: string,
|
|
8
|
-
callId: string,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type ClientIssueMonitorEvents = {
|
|
12
|
-
close: [],
|
|
13
|
-
issue: [ClientIssueMonitorEmittedIssueEvent],
|
|
14
|
-
major: [ClientIssueMonitorEmittedIssueEvent],
|
|
15
|
-
minor: [ClientIssueMonitorEmittedIssueEvent],
|
|
16
|
-
critical: [ClientIssueMonitorEmittedIssueEvent],
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type ClientIssueMonitorConfig = {
|
|
21
|
-
// empty
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export declare interface ClientIssueMonitor {
|
|
25
|
-
on<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
26
|
-
off<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
27
|
-
once<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
28
|
-
emit<U extends keyof ClientIssueMonitorEvents>(event: U, ...args: ClientIssueMonitorEvents[U]): boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class ClientIssueMonitor extends EventEmitter {
|
|
32
|
-
private _closed = false;
|
|
33
|
-
public constructor(
|
|
34
|
-
public readonly config: ClientIssueMonitorConfig = {},
|
|
35
|
-
) {
|
|
36
|
-
super();
|
|
37
|
-
this.setMaxListeners(Infinity);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public addCall(call: ObservedCall) {
|
|
41
|
-
if (this.closed) return;
|
|
42
|
-
|
|
43
|
-
const onNewClient = (client: ObservedClient) => {
|
|
44
|
-
this._addClient(call, client);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
call.once('close', () => {
|
|
48
|
-
call.off('newclient', onNewClient);
|
|
49
|
-
});
|
|
50
|
-
call.on('newclient', onNewClient);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private _addClient(call: ObservedCall, client: ObservedClient) {
|
|
54
|
-
if (this.closed) return;
|
|
55
|
-
const {
|
|
56
|
-
callId
|
|
57
|
-
} = call;
|
|
58
|
-
const {
|
|
59
|
-
clientId
|
|
60
|
-
} = client;
|
|
61
|
-
const onIssue = (issue: ClientIssue) => {
|
|
62
|
-
const event: ClientIssueMonitorEmittedIssueEvent = {
|
|
63
|
-
...issue,
|
|
64
|
-
clientId,
|
|
65
|
-
callId,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
this.emit(issue.severity, event);
|
|
69
|
-
this.emit('issue', event);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
client.once('close', () => {
|
|
73
|
-
client.off('issue', onIssue);
|
|
74
|
-
});
|
|
75
|
-
client.on('issue', onIssue);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public get closed() {
|
|
79
|
-
return this._closed;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public close() {
|
|
83
|
-
if (this._closed) return;
|
|
84
|
-
this._closed = true;
|
|
85
|
-
|
|
86
|
-
this.emit('close');
|
|
87
|
-
}
|
|
88
|
-
}
|