diff --git a/RelayServer/Endpoints/RtcEndpoints.cs b/RelayServer/Endpoints/RtcEndpoints.cs index 7ec7347..d567e42 100644 --- a/RelayServer/Endpoints/RtcEndpoints.cs +++ b/RelayServer/Endpoints/RtcEndpoints.cs @@ -24,6 +24,12 @@ public static class RtcEndpoints await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.Sdp); return Results.Ok(); }); + // List all offers. + app.MapGet("/api/rtc/offers", async (RtcCallService rtcCallService) => + { + return Results.Ok(await rtcCallService.GetOffersAsync()); + + }); // Return whether the specified channel currently has an active call. app.MapGet("/api/rtc/active/{channelId}", async (string channelId, RtcCallService rtcCallService) => @@ -32,7 +38,7 @@ public static class RtcEndpoints }); // Return the latest stored SDP offer for the specified channel. - app.MapGet("/api/rtc/offer/{channelId}", async (string channelId, RtcCallService rtcCallService) => + app.MapGet("/api/rtc/offers/{channelId}", async (string channelId, RtcCallService rtcCallService) => { var offer = await rtcCallService.GetOfferAsync(channelId); return offer is null ? Results.NotFound() : Results.Ok(offer); diff --git a/RelayServer/Services/Rtc/RtcCallService.cs b/RelayServer/Services/Rtc/RtcCallService.cs index 56fa854..dec82ac 100644 --- a/RelayServer/Services/Rtc/RtcCallService.cs +++ b/RelayServer/Services/Rtc/RtcCallService.cs @@ -279,4 +279,10 @@ public sealed class RtcCallService await _db.Merge(activeCall); } } + + public async Task GetOffersAsync() + { + var offers = await _db.Select("rtc_offers"); + return offers; + } } \ No newline at end of file