1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-19 16:15:16 +00:00

Check if a conversation can be the source for a call

This commit is contained in:
2020-04-10 11:05:30 +02:00
parent d1235f4f8c
commit 0a778811af
5 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,24 @@
/**
* Calls helper
*
* @author Pierre Hubert
*/
import { Conversation } from "../entities/Conversation";
import { conf } from "./ConfigHelper";
import { RTCRelayController } from "../controllers/RTCRelayController";
export class CallsHelper {
/**
* Check out whether a given conversation can have a call or not
*
* @param conv Target conversation
*/
public static CanHaveCall(conv: Conversation) : boolean {
return (conf().rtc_relay && RTCRelayController.IsConnected
&& conv.members.size > 1
&& conf().rtc_relay.maxUsersPerCalls >= conv.members.size) === true
}
}

View File

@ -18,7 +18,10 @@ export interface DatabaseConfiguration {
export interface RTCRelayConfiguration {
ip ?: string,
token: string,
iceServers: string[]
iceServers: string[],
maxUsersPerCalls: number,
allowVideo: boolean,
}
export interface Configuration {