mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Can request offers from server
This commit is contained in:
parent
798b67bd7f
commit
1d224dd201
@ -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
|
||||
*
|
||||
|
@ -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)},
|
||||
]
|
Loading…
Reference in New Issue
Block a user