@vkontakte/calls-sdk 2.8.12-dev.c0dd153e.0 → 2.8.12-dev.c8b26761.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/CallsSDK.d.ts +23 -6
- package/abstract/BaseApi.d.ts +2 -1
- package/abstract/BaseSignaling.d.ts +5 -4
- package/calls-sdk.cjs.js +9 -9
- package/calls-sdk.esm.js +3643 -2858
- package/classes/CallRegistry.d.ts +5 -1
- package/classes/ExternalIdCache.d.ts +1 -0
- package/classes/StatsLogger.d.ts +17 -2
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +54 -48
- package/classes/conversation/Conversation.testUtils.d.ts +148 -0
- package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
- package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +5 -5
- package/classes/conversation/index.d.ts +1 -0
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +42 -0
- package/classes/stat/ConversationStats.d.ts +5 -4
- package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
- package/classes/stat/StatPings.d.ts +1 -2
- package/classes/stat/StatSignalingCommands.d.ts +1 -2
- package/classes/transport/BaseTransport.d.ts +7 -1
- package/classes/transport/DirectTransport.d.ts +2 -1
- package/classes/transport/ServerTransport.d.ts +2 -1
- package/classes/transport/Transport.d.ts +6 -1
- package/default/Api.d.ts +2 -3
- package/default/Signaling.d.ts +9 -12
- package/default/SignalingTransport.d.ts +7 -1
- package/enums/ClientHangupReason.d.ts +7 -0
- package/enums/HangupType.d.ts +0 -1
- package/enums/Stat.d.ts +5 -1
- package/package.json +1 -1
- package/static/AuthData.d.ts +10 -0
- package/static/Debug.d.ts +1 -0
- package/static/External.d.ts +1 -1
- package/static/Params.d.ts +1 -1
- package/static/WebRTCUtils.d.ts +4 -0
- package/types/Conversation.d.ts +12 -2
- package/types/FastHangup.d.ts +68 -0
- package/types/SignalingMessage.d.ts +4 -1
- package/utils/IceServers.d.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Conversation from './
|
|
1
|
+
import type Conversation from './conversation';
|
|
2
2
|
import MediaSettings from '../types/MediaSettings';
|
|
3
3
|
export interface HoldableConversation extends Conversation {
|
|
4
4
|
id: string;
|
|
@@ -6,8 +6,11 @@ export interface HoldableConversation extends Conversation {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CallRegistry {
|
|
8
8
|
private _conversations;
|
|
9
|
+
private _reserved;
|
|
9
10
|
private _activeId;
|
|
10
11
|
private _mutex;
|
|
12
|
+
private _pendingRemovals;
|
|
13
|
+
reserve(id: string): void;
|
|
11
14
|
add(conversation: HoldableConversation): void;
|
|
12
15
|
remove(id: string | null): void;
|
|
13
16
|
get(id: string): HoldableConversation | undefined;
|
|
@@ -21,6 +24,7 @@ export declare class CallRegistry {
|
|
|
21
24
|
setHold(id: string): Promise<void>;
|
|
22
25
|
switchCall(id: string): Promise<void>;
|
|
23
26
|
clear(): void;
|
|
27
|
+
private _flushPendingRemovals;
|
|
24
28
|
}
|
|
25
29
|
declare const callRegistry: CallRegistry;
|
|
26
30
|
export { callRegistry };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
2
|
import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
|
+
private static _normalizeType;
|
|
4
5
|
private _okIdToExternalId;
|
|
5
6
|
private _externalIdToOkId;
|
|
6
7
|
private _decorativeIdToInitialId;
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import BaseApi from '../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
+
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
6
|
+
export type LogClientStatsOptions = {
|
|
7
|
+
immediately?: boolean;
|
|
8
|
+
occurredAt?: number;
|
|
9
|
+
conversationId?: string | null;
|
|
10
|
+
deferUntilServerTime?: boolean;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* Класс отвечает за отправку различной информации в сервис статистики (события, статистика и подобное)
|
|
6
14
|
*/
|
|
@@ -8,19 +16,26 @@ export default class StatsLogger extends BaseLogger {
|
|
|
8
16
|
private readonly _externalLogger;
|
|
9
17
|
private readonly _api;
|
|
10
18
|
private readonly _conversationIdProvider;
|
|
19
|
+
private readonly _topologyProvider;
|
|
11
20
|
private readonly _batchInterval;
|
|
12
21
|
private _batchedClientStats;
|
|
13
22
|
private _batchTimeout;
|
|
14
23
|
private _serverTimeDelta;
|
|
15
|
-
|
|
24
|
+
private _waitingForServerTime;
|
|
25
|
+
private _deferredClientStats;
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
16
27
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
17
|
-
logClientStats(data:
|
|
28
|
+
logClientStats(data: ClientStatsPayload, immediatelyOrOptions?: boolean | LogClientStatsOptions): void;
|
|
18
29
|
destroy(): void;
|
|
30
|
+
private _logClientStats;
|
|
19
31
|
private _getConversationId;
|
|
32
|
+
private _getCallTopology;
|
|
20
33
|
private _sendBatch;
|
|
21
34
|
private _startTimeout;
|
|
22
35
|
private _stopTimeout;
|
|
23
36
|
private _sendClientStats;
|
|
24
37
|
private _calculateServerTimeDelta;
|
|
38
|
+
private _flushDeferredClientStats;
|
|
25
39
|
private _now;
|
|
26
40
|
}
|
|
41
|
+
export {};
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
2
2
|
import type { RGBTuple } from '@vkontakte/calls-vmoji';
|
|
3
|
-
import BaseApi from '
|
|
4
|
-
import BaseLogger from '
|
|
5
|
-
import { AddParticipantParams } from '
|
|
6
|
-
import ConversationFeature from '
|
|
7
|
-
import ConversationOption from '
|
|
8
|
-
import MediaOption from '
|
|
9
|
-
import UpdateDisplayLayoutErrorReason from '
|
|
10
|
-
import UserRole from '
|
|
11
|
-
import UserType from '
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
3
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
4
|
+
import BaseLogger from '../../abstract/BaseLogger';
|
|
5
|
+
import { AddParticipantParams } from '../../abstract/BaseSignaling';
|
|
6
|
+
import ConversationFeature from '../../enums/ConversationFeature';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import MediaOption from '../../enums/MediaOption';
|
|
9
|
+
import UpdateDisplayLayoutErrorReason from '../../enums/UpdateDisplayLayoutErrorReason';
|
|
10
|
+
import UserRole from '../../enums/UserRole';
|
|
11
|
+
import UserType from '../../enums/UserType';
|
|
12
|
+
import { DebugMessageType } from '../../static/Debug';
|
|
13
|
+
import { JSONObject } from '../../static/Json';
|
|
14
|
+
import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
|
|
15
|
+
import { AudienceModeHandsResponse } from '../../types/AudienceMode';
|
|
16
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
|
|
17
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
|
|
18
|
+
import type { FastHangupHandler, HangupParams } from '../../types/FastHangup';
|
|
19
|
+
import MediaModifiers from '../../types/MediaModifiers';
|
|
20
|
+
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
|
+
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
22
|
+
import MuteStates from '../../types/MuteStates';
|
|
23
|
+
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
24
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
25
|
+
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
26
|
+
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
27
|
+
import { ParticipantStreamDescription } from '../../types/ParticipantStreamDescription';
|
|
28
|
+
import { ScreenCaptureSettings } from '../../types/ScreenCaptureSettings';
|
|
29
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
30
|
+
import { WaitingHallResponse } from '../../types/WaitingHall';
|
|
31
|
+
import EventEmitter from '../EventEmitter';
|
|
31
32
|
export default class Conversation extends EventEmitter {
|
|
32
33
|
private readonly _api;
|
|
33
34
|
private readonly _signaling;
|
|
@@ -42,7 +43,6 @@ export default class Conversation extends EventEmitter {
|
|
|
42
43
|
private _waitingHallHoldPending;
|
|
43
44
|
private _participantState;
|
|
44
45
|
private _participants;
|
|
45
|
-
private _pendingParticipants;
|
|
46
46
|
private _directTransportIsMaster?;
|
|
47
47
|
private _transport;
|
|
48
48
|
private _debugInfo;
|
|
@@ -57,9 +57,13 @@ export default class Conversation extends EventEmitter {
|
|
|
57
57
|
private _serverSettings;
|
|
58
58
|
private _serverTimeOffset;
|
|
59
59
|
private _delayedHangup;
|
|
60
|
+
private _onFastHangup?;
|
|
61
|
+
private _hangupEmitted;
|
|
62
|
+
private _hangupPromise;
|
|
60
63
|
private _abortController;
|
|
61
64
|
private _registeredPeerReceived;
|
|
62
65
|
private _calleeUnavailableTimer;
|
|
66
|
+
private _reservedId;
|
|
63
67
|
private readonly _onUnload;
|
|
64
68
|
private readonly _audioOutput;
|
|
65
69
|
private readonly _stats;
|
|
@@ -75,29 +79,25 @@ export default class Conversation extends EventEmitter {
|
|
|
75
79
|
private readonly _statFirstMediaReceived;
|
|
76
80
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
77
81
|
static current(): Conversation | null;
|
|
78
|
-
static hangupAfterInit(): void;
|
|
82
|
+
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
79
83
|
static id(): string | null;
|
|
80
84
|
get id(): string;
|
|
81
85
|
get externalId(): ExternalParticipantId | undefined;
|
|
82
86
|
get mediaSettings(): MediaSettings | undefined;
|
|
83
87
|
get isCallHeld(): boolean;
|
|
84
88
|
static debugSessionId(): string | null;
|
|
89
|
+
static debugMessage(type: DebugMessageType, ...args: any[]): boolean;
|
|
90
|
+
static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
|
|
85
91
|
static getSyncedTime(): number;
|
|
86
92
|
get debugSessionId(): string | null;
|
|
93
|
+
getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
|
|
94
|
+
private _buildInternalParams;
|
|
87
95
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
88
|
-
onJoin(joinArgs:
|
|
89
|
-
conversationId?: string;
|
|
90
|
-
mediaOptions: MediaOption[];
|
|
91
|
-
chatId?: string;
|
|
92
|
-
joinLink?: string;
|
|
93
|
-
observedIds?: ExternalUserId[];
|
|
94
|
-
payload?: string;
|
|
95
|
-
onFastJoin?: FastJoinHandler;
|
|
96
|
-
}): Promise<ConversationData>;
|
|
96
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
97
97
|
private _onJoinPart2;
|
|
98
98
|
private _extractExternalRooms;
|
|
99
99
|
private _extractExternalRoomsData;
|
|
100
|
-
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string): Promise<void>;
|
|
100
|
+
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string, userId?: number): Promise<void>;
|
|
101
101
|
private _isInWaitingHall;
|
|
102
102
|
private _isWaitForAdmin;
|
|
103
103
|
private _isRestricted;
|
|
@@ -106,10 +106,9 @@ export default class Conversation extends EventEmitter {
|
|
|
106
106
|
private _acceptConcurrent;
|
|
107
107
|
private _getMainRoomParticipants;
|
|
108
108
|
private _decodeExternalConversationParams;
|
|
109
|
-
private _logCallStartEvent;
|
|
110
109
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
111
|
-
decline(): Promise<void>;
|
|
112
|
-
hangup(): Promise<void>;
|
|
110
|
+
decline(params?: HangupParams): Promise<void>;
|
|
111
|
+
hangup(params?: HangupParams): Promise<void>;
|
|
113
112
|
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<void>;
|
|
114
113
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
115
114
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
@@ -117,8 +116,12 @@ export default class Conversation extends EventEmitter {
|
|
|
117
116
|
updateStatisticsInterval(): void;
|
|
118
117
|
private _openTransport;
|
|
119
118
|
private _allocateParticipantTransport;
|
|
119
|
+
private _cleanupRegistry;
|
|
120
|
+
private _emitHangupOnce;
|
|
120
121
|
private _close;
|
|
121
|
-
|
|
122
|
+
private _sendHangup;
|
|
123
|
+
destroy(): void;
|
|
124
|
+
private _destroy;
|
|
122
125
|
private _getConversationParams;
|
|
123
126
|
private _setConversationParams;
|
|
124
127
|
private _buildSignalingEndpoint;
|
|
@@ -160,6 +163,7 @@ export default class Conversation extends EventEmitter {
|
|
|
160
163
|
private _getExistedParticipantByIdOrCreate;
|
|
161
164
|
private _getExternalIdByParticipantId;
|
|
162
165
|
private _getExternalIdsByOkIdsFromCache;
|
|
166
|
+
private _getOrCacheExternalIdByCompositeId;
|
|
163
167
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
164
168
|
private _warnParticipantNotInConversation;
|
|
165
169
|
private _denormalizeMarkers;
|
|
@@ -196,10 +200,13 @@ export default class Conversation extends EventEmitter {
|
|
|
196
200
|
private _cleanupParticipants;
|
|
197
201
|
private _cleanupParticipantAgnosticStreams;
|
|
198
202
|
private _cleanupTransport;
|
|
203
|
+
private _finishLifecycle;
|
|
204
|
+
private _getFirstMediaSentCallback;
|
|
205
|
+
private _stopFirstMediaSentProbe;
|
|
199
206
|
private _cleanupTransportForHold;
|
|
200
207
|
private _cleanupSpeakerDetector;
|
|
201
208
|
private _cleanupSpecListener;
|
|
202
|
-
private
|
|
209
|
+
private _disposeSignaling;
|
|
203
210
|
private _onAddParticipant;
|
|
204
211
|
private _onRemoveParticipant;
|
|
205
212
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
@@ -232,7 +239,7 @@ export default class Conversation extends EventEmitter {
|
|
|
232
239
|
private _getWaitingForPromotionStatus;
|
|
233
240
|
putHandsDown(): Promise<void>;
|
|
234
241
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
235
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
242
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void | SignalingMessage>;
|
|
236
243
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
237
244
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
238
245
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -361,7 +368,7 @@ export default class Conversation extends EventEmitter {
|
|
|
361
368
|
private _onRecordInfo;
|
|
362
369
|
private _onStopRecordInfo;
|
|
363
370
|
private _changePinnedParticipantForRoom;
|
|
364
|
-
_changeRecordInfoForRoom():
|
|
371
|
+
_changeRecordInfoForRoom(): void;
|
|
365
372
|
private _changeAsrInfoForRoom;
|
|
366
373
|
private _changeUrlSharingInfoForRoom;
|
|
367
374
|
private _onParticipantAnimojiChanged;
|
|
@@ -436,7 +443,6 @@ export default class Conversation extends EventEmitter {
|
|
|
436
443
|
private _setMuteStatesForRoomId;
|
|
437
444
|
private _forceOpenTransportForAloneInCall;
|
|
438
445
|
private _registerParticipant;
|
|
439
|
-
private _getParticipants;
|
|
440
446
|
private _getParticipant;
|
|
441
447
|
}
|
|
442
448
|
declare function _resetPendingInstance(): void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FetchMock } from 'vitest-fetch-mock';
|
|
2
|
+
import { Mock } from 'vitest';
|
|
3
|
+
import { Client, Server } from 'mock-socket';
|
|
4
|
+
import { ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
5
|
+
import Api from '../../default/Api';
|
|
6
|
+
import CallDirection from '../../enums/CallDirection';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import TransportState from '../../enums/TransportState';
|
|
9
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
10
|
+
import { ParticipantStatus } from '../../static/External';
|
|
11
|
+
import { ExternalParticipantId } from '../../types/ExternalId';
|
|
12
|
+
import { ParticipantListMarkers } from '../../types/Participant';
|
|
13
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
14
|
+
import Conversation from './Conversation';
|
|
15
|
+
declare function createParams(): {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
apiEnv: string;
|
|
18
|
+
onLocalStream: Mock<import("@vitest/spy").Procedure>;
|
|
19
|
+
onLocalStatus: Mock<import("@vitest/spy").Procedure>;
|
|
20
|
+
onConversation: Mock<import("@vitest/spy").Procedure>;
|
|
21
|
+
onLocalSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
22
|
+
onRemoteSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
23
|
+
onRemoteSharedUrl: Mock<import("@vitest/spy").Procedure>;
|
|
24
|
+
onCallState: Mock<import("@vitest/spy").Procedure>;
|
|
25
|
+
onOptionsChanged: Mock<import("@vitest/spy").Procedure>;
|
|
26
|
+
onPinnedParticipant: Mock<import("@vitest/spy").Procedure>;
|
|
27
|
+
onRemoteMediaSettings: Mock<import("@vitest/spy").Procedure>;
|
|
28
|
+
onRemoteParticipantState: Mock<import("@vitest/spy").Procedure>;
|
|
29
|
+
onLocalPin: Mock<import("@vitest/spy").Procedure>;
|
|
30
|
+
onDebugMessage: Mock<import("@vitest/spy").Procedure>;
|
|
31
|
+
onHangup: Mock<import("@vitest/spy").Procedure>;
|
|
32
|
+
onRemoteRemoved: Mock<import("@vitest/spy").Procedure>;
|
|
33
|
+
onConversationParticipantListChunk: Mock<import("@vitest/spy").Procedure>;
|
|
34
|
+
onRoomParticipantsUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
35
|
+
onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
36
|
+
onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
|
|
37
|
+
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
40
|
+
export type ConversationTestTools = {
|
|
41
|
+
readonly endpointURL: string;
|
|
42
|
+
readonly fetchMocker: FetchMock;
|
|
43
|
+
readonly params: ConversationTestParams;
|
|
44
|
+
readonly server: Server;
|
|
45
|
+
readonly wsBaseURL: string;
|
|
46
|
+
createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
47
|
+
createConversation(options?: {
|
|
48
|
+
api?: Api;
|
|
49
|
+
}): Conversation;
|
|
50
|
+
createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
51
|
+
createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
52
|
+
createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
53
|
+
createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
54
|
+
createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
55
|
+
createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
56
|
+
createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
57
|
+
createWaitingHallConversationData(): ReturnType<typeof createWaitingHallConversationData>;
|
|
58
|
+
emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
59
|
+
enableParticipantListChunk(): void;
|
|
60
|
+
expectRemoteStatus(status: ParticipantStatus, participantId?: string): Promise<void>;
|
|
61
|
+
expectRemoteStatusCall(status: ParticipantStatus, participantId?: string): void;
|
|
62
|
+
forgetConversation(conversation: Conversation): void;
|
|
63
|
+
getActiveSocket(wsServer: Server): Client;
|
|
64
|
+
hasRemoteStatusCall(status: ParticipantStatus, participantId?: string): boolean;
|
|
65
|
+
isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
66
|
+
parseUrlSearch(search: string): Record<string, string>;
|
|
67
|
+
resetRemoteStatusCallbacks(): void;
|
|
68
|
+
respondOnGetParticipantListChunkWith(data: Partial<SignalingMessage.ParticipantListChunk>): void;
|
|
69
|
+
sendAcceptedCall(participant: SignalingMessage.Participant): void;
|
|
70
|
+
sendHungup(participant: SignalingMessage.Participant): void;
|
|
71
|
+
sendSessionState(participant: SignalingMessage.Participant | number, connected: boolean, data?: Partial<SignalingMessage.SessionState>): void;
|
|
72
|
+
setApiAuth(data?: {
|
|
73
|
+
sessionKey?: string;
|
|
74
|
+
sessionSecretKey?: string;
|
|
75
|
+
}): void;
|
|
76
|
+
setTransportState(conversation: Conversation, state: TransportState): void;
|
|
77
|
+
socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
78
|
+
socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
79
|
+
startConversation(message?: SignalingMessage.Connection): Promise<Conversation>;
|
|
80
|
+
startConversationWithParticipants(participants: SignalingMessage.Participant[], peerId?: SignalingMessage.PeerId): Promise<Conversation>;
|
|
81
|
+
startConversationWithRemoteParticipant(remoteParticipantData?: Partial<SignalingMessage.Participant>): Promise<{
|
|
82
|
+
conversation: Conversation;
|
|
83
|
+
meParticipant: SignalingMessage.Participant;
|
|
84
|
+
remoteParticipant: SignalingMessage.Participant;
|
|
85
|
+
}>;
|
|
86
|
+
stubApiRequest(endpoint: string, method: string, data: object): void;
|
|
87
|
+
waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
88
|
+
flushSdkCallbacks(): Promise<null>;
|
|
89
|
+
};
|
|
90
|
+
export declare function defineConversationTests(name: string, defineTests: (tools: ConversationTestTools) => void): void;
|
|
91
|
+
export declare function createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
92
|
+
export declare function enableParticipantListChunk(): void;
|
|
93
|
+
export declare function setApiAuth(data?: {
|
|
94
|
+
sessionKey?: string;
|
|
95
|
+
sessionSecretKey?: string;
|
|
96
|
+
}): void;
|
|
97
|
+
export declare function setTransportState(conversation: Conversation, state: TransportState): void;
|
|
98
|
+
export declare function socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
99
|
+
export declare function socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
100
|
+
export declare function createWaitingHallConversationData(): {
|
|
101
|
+
acceptTime: null;
|
|
102
|
+
asrInfo: null;
|
|
103
|
+
asrInfoByRoom: Map<any, any>;
|
|
104
|
+
audienceMode: boolean;
|
|
105
|
+
chatId: null;
|
|
106
|
+
compositeUserId: string;
|
|
107
|
+
concurrent: boolean;
|
|
108
|
+
direction: CallDirection;
|
|
109
|
+
externalId: ExternalParticipantId;
|
|
110
|
+
features: never[];
|
|
111
|
+
featuresPerRole: null;
|
|
112
|
+
id: string;
|
|
113
|
+
mediaModifiers: {
|
|
114
|
+
denoise: boolean;
|
|
115
|
+
denoiseAnn: boolean;
|
|
116
|
+
};
|
|
117
|
+
muteStates: Map<any, any>;
|
|
118
|
+
muteStatesPersonal: {};
|
|
119
|
+
needRate: boolean;
|
|
120
|
+
networkRating: number;
|
|
121
|
+
observer: boolean;
|
|
122
|
+
options: ConversationOption[];
|
|
123
|
+
participantsLimit: number;
|
|
124
|
+
pinnedParticipantIdByRoom: Map<any, any>;
|
|
125
|
+
recordsInfoByRoom: Map<any, any>;
|
|
126
|
+
restricted: boolean;
|
|
127
|
+
roles: never[];
|
|
128
|
+
roomId: number | null;
|
|
129
|
+
topology: TransportTopology;
|
|
130
|
+
urlSharingInfoByRoom: Map<any, any>;
|
|
131
|
+
userId: number;
|
|
132
|
+
waitForAdmin: boolean;
|
|
133
|
+
waitingHall: boolean;
|
|
134
|
+
};
|
|
135
|
+
export declare function createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
136
|
+
export declare function emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
137
|
+
export declare function getActiveSocket(wsServer: Server): Client;
|
|
138
|
+
export declare function isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
139
|
+
export declare function parseUrlSearch(search: string): Record<string, string>;
|
|
140
|
+
export declare function flushSdkCallbacks(): Promise<null>;
|
|
141
|
+
export declare function waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
142
|
+
export declare function createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
143
|
+
export declare function createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
144
|
+
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
145
|
+
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
146
|
+
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
147
|
+
export declare function createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
148
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ConversationResponse from '
|
|
1
|
+
import ConversationResponse from '../../types/ConversationResponse';
|
|
2
2
|
export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
|
|
3
3
|
export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import BaseApi from '
|
|
2
|
-
import type { DebugLogger } from '
|
|
3
|
-
import { DisplayLayoutRequest, ParticipantLayout } from '
|
|
4
|
-
import { Participant, ParticipantId } from '
|
|
1
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
2
|
+
import type { DebugLogger } from '../../static/Debug';
|
|
3
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
4
|
+
import { Participant, ParticipantId } from '../../types/Participant';
|
|
5
5
|
type DisplayLayoutRequesterParams = {
|
|
6
6
|
api: BaseApi;
|
|
7
7
|
debug: DebugLogger;
|
|
8
|
-
getParticipants: () =>
|
|
8
|
+
getParticipants: () => Record<ParticipantId, Participant>;
|
|
9
9
|
isMe: (participantId: ParticipantId) => boolean;
|
|
10
10
|
updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
|
|
11
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Conversation';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type SemanticCallFinishReason = 'hangup' | 'canceled' | 'rejected' | 'busy' | 'missed' | 'timeout' | 'another_device' | 'removed' | 'banned' | 'initially_closed' | 'call_timeout' | 'socket_closed' | 'killed' | 'killed_without_delete' | 'obsolete_client' | 'unavailable';
|
|
2
|
+
export type ClassifiedCallFinish = {
|
|
3
|
+
reason: SemanticCallFinishReason;
|
|
4
|
+
string_value?: string;
|
|
5
|
+
} | {
|
|
6
|
+
reason: 'error';
|
|
7
|
+
string_value: string;
|
|
8
|
+
} | {
|
|
9
|
+
reason: 'failed';
|
|
10
|
+
};
|
|
11
|
+
export declare function classifyCallFinish(error: unknown): ClassifiedCallFinish;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import StatsLogger from '../StatsLogger';
|
|
2
|
+
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
3
|
+
export interface CallLifecycleInitializationParams {
|
|
4
|
+
source: CallLifecycleSource;
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CallLifecycleClock {
|
|
8
|
+
wallNow(): number;
|
|
9
|
+
monotonicNow(): number;
|
|
10
|
+
}
|
|
11
|
+
export declare class CallLifecycleStats {
|
|
12
|
+
private readonly _logger;
|
|
13
|
+
private readonly _clock;
|
|
14
|
+
private _conversationId;
|
|
15
|
+
private _callStartLabel;
|
|
16
|
+
private _lifecycleStartedAtMonotonic;
|
|
17
|
+
private _pendingEvents;
|
|
18
|
+
private _callStarted;
|
|
19
|
+
private _accepted;
|
|
20
|
+
private _firstMediaSent;
|
|
21
|
+
private _finished;
|
|
22
|
+
private _destroyed;
|
|
23
|
+
constructor(logger: StatsLogger, clock?: CallLifecycleClock);
|
|
24
|
+
get firstMediaSentReported(): boolean;
|
|
25
|
+
get terminated(): boolean;
|
|
26
|
+
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
27
|
+
bindConversationId(conversationId: string): void;
|
|
28
|
+
markCallStarted(): void;
|
|
29
|
+
markOutgoingAccepted(): void;
|
|
30
|
+
markIncomingAccepted(concurrent: boolean): void;
|
|
31
|
+
markFirstMediaSent(): void;
|
|
32
|
+
markFinished(reason: unknown): void;
|
|
33
|
+
markTerminated(): void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
private _canRecord;
|
|
36
|
+
private _durationSince;
|
|
37
|
+
private _finish;
|
|
38
|
+
private _ensureConversationId;
|
|
39
|
+
private _record;
|
|
40
|
+
private _flushPendingEvents;
|
|
41
|
+
private _logEvent;
|
|
42
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import BaseApi from '../../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
3
4
|
import HangupReason from '../HangupReason';
|
|
4
5
|
import StatsLogger from '../StatsLogger';
|
|
5
|
-
import
|
|
6
|
+
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
6
7
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
7
8
|
import { StatAggregator } from './StatAggregator';
|
|
8
9
|
import { StatPings } from './StatPings';
|
|
9
10
|
import { StatSignalingCommands } from './StatSignalingCommands';
|
|
10
11
|
export declare class ConversationStats {
|
|
11
12
|
readonly logger: StatsLogger;
|
|
13
|
+
readonly lifecycle: CallLifecycleStats;
|
|
12
14
|
readonly statAggregator: StatAggregator;
|
|
13
15
|
readonly codecStatsAggregator: CodecStatsAggregator;
|
|
14
16
|
readonly pings: StatPings;
|
|
15
17
|
readonly signalingCommands: StatSignalingCommands;
|
|
16
18
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
17
|
-
logHangup(reason: HangupReason
|
|
18
|
-
flushCallMetrics(
|
|
19
|
+
logHangup(reason: HangupReason): void;
|
|
20
|
+
flushCallMetrics(): void;
|
|
19
21
|
destroy(): void;
|
|
20
|
-
private static correctHangupReason;
|
|
21
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FirstMediaSentProbe {
|
|
2
|
+
private readonly _peerConnection;
|
|
3
|
+
private readonly _onFirstMediaSent;
|
|
4
|
+
private readonly _pollIntervalMs;
|
|
5
|
+
private _timer;
|
|
6
|
+
private _state;
|
|
7
|
+
constructor(peerConnection: RTCPeerConnection, onFirstMediaSent: () => void, pollIntervalMs?: number);
|
|
8
|
+
start(): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
private _getStatsReports;
|
|
11
|
+
private _poll;
|
|
12
|
+
private _scheduleNextPoll;
|
|
13
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatPings {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByTransport;
|
|
@@ -12,6 +11,6 @@ export declare class StatPings {
|
|
|
12
11
|
*/
|
|
13
12
|
mark(transport: SignalingTransportType): void;
|
|
14
13
|
/** Отправляем данные в стату */
|
|
15
|
-
logMetrics(
|
|
14
|
+
logMetrics(): void;
|
|
16
15
|
destroy(): void;
|
|
17
16
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatSignalingCommands {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByCommand;
|
|
7
6
|
constructor(logger: StatsLogger);
|
|
8
7
|
mark(command: string, time: number, transport: SignalingTransportType): void;
|
|
9
8
|
/** Отправляем данные в стату */
|
|
10
|
-
logMetrics(
|
|
9
|
+
logMetrics(): void;
|
|
11
10
|
destroy(): void;
|
|
12
11
|
}
|
|
@@ -7,7 +7,13 @@ export default abstract class BaseTransport extends EventEmitter {
|
|
|
7
7
|
protected readonly _mediaSource: MediaSource;
|
|
8
8
|
protected _state: TransportState;
|
|
9
9
|
protected _pc: RTCPeerConnection | null;
|
|
10
|
-
|
|
10
|
+
private readonly _onFirstMediaSent;
|
|
11
|
+
private _firstMediaSentProbe;
|
|
12
|
+
private _firstMediaSentProbeStopped;
|
|
13
|
+
protected constructor(signaling: BaseSignaling, mediaSource: MediaSource, onFirstMediaSent?: (() => void) | null);
|
|
11
14
|
getState(): TransportState;
|
|
15
|
+
stopFirstMediaSentProbe(): void;
|
|
12
16
|
abstract close(error?: Error): void;
|
|
17
|
+
protected _startFirstMediaSentProbe(): void;
|
|
18
|
+
protected _disposeFirstMediaSentProbe(): void;
|
|
13
19
|
}
|
|
@@ -43,7 +43,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
43
43
|
private readonly _logger;
|
|
44
44
|
private readonly _statAggregator;
|
|
45
45
|
private readonly _codecStatsAggregator;
|
|
46
|
-
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
46
|
+
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
47
47
|
get participantId(): ParticipantId;
|
|
48
48
|
updateStatisticsInterval(): void;
|
|
49
49
|
private _isDeadConnection;
|
|
@@ -57,6 +57,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
57
57
|
private _disposePeerConnection;
|
|
58
58
|
setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
|
|
59
59
|
close(error?: Error): void;
|
|
60
|
+
private _finishClose;
|
|
60
61
|
private _setState;
|
|
61
62
|
private _onSignalingNotification;
|
|
62
63
|
private _handleTransmittedData;
|
|
@@ -43,11 +43,12 @@ export default class ServerTransport extends BaseTransport {
|
|
|
43
43
|
private _producerSessionId;
|
|
44
44
|
private _newAudioShareTrack;
|
|
45
45
|
private _simulcastInfo;
|
|
46
|
+
private _isSimulcastNegotiated;
|
|
46
47
|
private readonly _debug;
|
|
47
48
|
private readonly _logger;
|
|
48
49
|
private readonly _statAggregator;
|
|
49
50
|
private readonly _codecStatsAggregator;
|
|
50
|
-
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
51
|
+
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
51
52
|
updateStatisticsInterval(): void;
|
|
52
53
|
open(observer?: boolean): void;
|
|
53
54
|
close(error?: Error): void;
|