1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Can request offers from server

This commit is contained in:
Pierre HUBERT 2020-04-11 18:21:06 +02:00
parent 798b67bd7f
commit 1d224dd201
2 changed files with 25 additions and 0 deletions

View File

@ -202,6 +202,29 @@ export class CallsController {
h.success();
}
/**
* Request an offer from the server
*
* @param h Request handler
*/
public static async RequestOffer(h: UserWebSocketRequestsHandler) {
const callID = h.postCallId("callID");
const peerID = h.postCallPeerID(callID, "peerID"); // The ID of the user we stream the audio / video from
if(peerID == 0 || peerID == h.getUserId())
h.error(401, "You can not request an offer for yourself!");
// Proxify the request to the server
await RTCRelayController.SendMessage({
title: "request_offer",
callHash: this.genCallHash(callID, peerID),
peerId: String(h.getUserId()),
data: ""
})
h.success()
}
/**
* Make the client leave the call
*

View File

@ -44,4 +44,6 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
{title: "calls/signal", handler: (h) => CallsController.OnClientSignal(h)},
{title: "calls/mark_ready", handler: (h) => CallsController.MarkUserReady(h)},
{title: "calls/request_offer", handler: (h) => CallsController.RequestOffer(h)},
]