mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-26 13:38:52 +00:00
Returns calls configuration to client
This commit is contained in:
parent
cb9bd06cdc
commit
b8c19a8875
@ -4,6 +4,7 @@ import { ActiveClient, UserWebSocketController } from "./UserWebSocketController
|
||||
import { EventsHelper } from "../helpers/EventsHelper";
|
||||
import * as ws from 'ws'
|
||||
import { WsMessage } from "../entities/WsMessage";
|
||||
import { conf } from "../helpers/ConfigHelper";
|
||||
|
||||
/**
|
||||
* Legacy calls controller
|
||||
@ -22,6 +23,22 @@ export class CallsController {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get call configuration
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async GetConfig(h: UserWebSocketRequestsHandler) {
|
||||
|
||||
// Check if user is member of at least one call
|
||||
if(h.wsClient.activeCalls.size == 0)
|
||||
h.error(401, "You do not belong to any call for now!")
|
||||
|
||||
h.send({
|
||||
iceServers: conf().rtc_relay.iceServers
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Join a call
|
||||
*
|
||||
|
@ -33,6 +33,8 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
|
||||
|
||||
|
||||
// Calls controller
|
||||
{title: "calls/config", handler: (h) => CallsController.GetConfig(h)},
|
||||
|
||||
{title: "calls/join", handler: (h) => CallsController.JoinCall(h)},
|
||||
|
||||
{title: "calls/leave", handler: (h) => CallsController.LeaveCall(h)},
|
||||
|
Loading…
Reference in New Issue
Block a user