Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/meteor/server/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
MatrixBridgedUserRaw,
MediaCallsRaw,
MediaCallChannelsRaw,
MediaCallChannelLogsRaw,
MediaCallNegotiationsRaw,
MessageReadsRaw,
MessagesRaw,
Expand Down Expand Up @@ -139,6 +140,7 @@ registerModel('IMatrixBridgedRoomModel', new MatrixBridgedRoomRaw(db));
registerModel('IMatrixBridgedUserModel', new MatrixBridgedUserRaw(db));
registerModel('IMediaCallsModel', new MediaCallsRaw(db));
registerModel('IMediaCallChannelsModel', new MediaCallChannelsRaw(db));
registerModel('IMediaCallChannelLogsModel', new MediaCallChannelLogsRaw(db));
registerModel('IMediaCallNegotiationsModel', new MediaCallNegotiationsRaw(db));
registerModel('IMessageReadsModel', new MessageReadsRaw(db));
registerModel('IMessagesModel', new MessagesRaw(db, trashCollection));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
ClientMediaSignalLocalState,
ServerMediaSignal,
} from '@rocket.chat/media-signaling';
import { MediaCallChannels, MediaCallNegotiations, MediaCalls } from '@rocket.chat/models';
import { MediaCallChannelLogs, MediaCallChannels, MediaCallNegotiations, MediaCalls } from '@rocket.chat/models';

import type { IMediaCallAgent } from '../../definition/IMediaCallAgent';
import { logger } from '../../logger';
Expand Down Expand Up @@ -82,6 +82,14 @@ export class UserActorSignalProcessor {
public async processSignal(signal: ClientMediaSignal): Promise<void> {
logger.debug({ msg: 'UserActorSignalProcessor.processSignal', signal: stripSensitiveDataFromSignal(signal) });

void MediaCallChannelLogs.insertOne({
callId: this.callId,
channelId: this.channel._id,
direction: 'recv',
ts: new Date(),
content: signal,
}).catch(() => null);

Comment thread
pierre-lehnen-rc marked this conversation as resolved.
// The code will only reach this point if one of the following conditions are true:
// 1. the signal came from the exact user session where the caller initiated the call
// 2. the signal came from the exact user session where the callee accepted the call
Expand Down Expand Up @@ -245,6 +253,14 @@ export class UserActorSignalProcessor {
}

protected async sendSignal(signal: ServerMediaSignal): Promise<void> {
void MediaCallChannelLogs.insertOne({
callId: this.callId,
channelId: this.channel._id,
direction: 'send',
ts: new Date(),
content: signal,
}).catch(() => null);

Comment thread
pierre-lehnen-rc marked this conversation as resolved.
getMediaCallServer().sendSignal(this.actorId, signal);
}

Expand Down
13 changes: 13 additions & 0 deletions packages/core-typings/src/mediaCalls/IMediaCallChannelLog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { IRocketChatRecord } from '../IRocketChatRecord';

export interface IMediaCallChannelLog extends IRocketChatRecord {
callId: string;

channelId: string;

direction: 'send' | 'recv';

ts: Date;

content: Record<string, any>;
}
1 change: 1 addition & 0 deletions packages/core-typings/src/mediaCalls/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './IMediaCall';
export * from './IMediaCallChannel';
export * from './IMediaCallChannelLog';
export * from './IMediaCallNegotiation';
1 change: 1 addition & 0 deletions packages/model-typings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export * from './models/IMigrationsModel';
export * from './models/IModerationReportsModel';
export * from './models/IMediaCallsModel';
export * from './models/IMediaCallChannelsModel';
export * from './models/IMediaCallChannelLogsModel';
export * from './models/IMediaCallNegotiationsModel';
export * from './updater';
export * from './models/IWorkspaceCredentialsModel';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { IMediaCallChannelLog } from '@rocket.chat/core-typings';

import type { IBaseModel } from './IBaseModel';

export type IMediaCallChannelLogsModel = IBaseModel<IMediaCallChannelLog>;
2 changes: 2 additions & 0 deletions packages/models/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import type {
IFreeSwitchChannelEventDeltaModel,
IMediaCallsModel,
IMediaCallChannelsModel,
IMediaCallChannelLogsModel,
IMediaCallNegotiationsModel,
} from '@rocket.chat/model-typings';
import type { Collection, Db } from 'mongodb';
Expand Down Expand Up @@ -185,6 +186,7 @@ export const LoginServiceConfiguration = proxify<ILoginServiceConfigurationModel
export const Messages = proxify<IMessagesModel>('IMessagesModel');
export const MediaCalls = proxify<IMediaCallsModel>('IMediaCallsModel');
export const MediaCallChannels = proxify<IMediaCallChannelsModel>('IMediaCallChannelsModel');
export const MediaCallChannelLogs = proxify<IMediaCallChannelLogsModel>('IMediaCallChannelLogsModel');
export const MediaCallNegotiations = proxify<IMediaCallNegotiationsModel>('IMediaCallNegotiationsModel');
export const NotificationQueue = proxify<INotificationQueueModel>('INotificationQueueModel');
export const Nps = proxify<INpsModel>('INpsModel');
Expand Down
1 change: 1 addition & 0 deletions packages/models/src/modelClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export * from './models/Migrations';
export * from './models/ModerationReports';
export * from './models/MediaCalls';
export * from './models/MediaCallChannels';
export * from './models/MediaCallChannelLogs';
export * from './models/MediaCallNegotiations';
export * from './models/WorkspaceCredentials';
export * from './models/Trash';
22 changes: 22 additions & 0 deletions packages/models/src/models/MediaCallChannelLogs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { IMediaCallChannelLog, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IMediaCallChannelLogsModel } from '@rocket.chat/model-typings';
import type { IndexDescription, Collection, Db } from 'mongodb';

import { BaseRaw } from './BaseRaw';

export class MediaCallChannelLogsRaw extends BaseRaw<IMediaCallChannelLog> implements IMediaCallChannelLogsModel {
constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<IMediaCallChannelLog>>) {
super(db, 'media_call_channel_logs', trash);
}

protected modelIndexes(): IndexDescription[] {
return [
{
key: { callId: 1, channelId: 1 },
unique: false,
},
// Allow 3 days of events to be saved
{ key: { ts: 1 }, expireAfterSeconds: 3 * 24 * 60 * 60 },
];
}
Comment thread
pierre-lehnen-rc marked this conversation as resolved.
}
Loading