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:
24
src/helpers/CallsHelper.ts
Normal file
24
src/helpers/CallsHelper.ts
Normal 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
|
||||
}
|
||||
|
||||
}
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user