fixed endpoint data

This commit is contained in:
2026-04-03 19:44:07 -04:00
parent ebda006010
commit 941dcc16d9
2 changed files with 6 additions and 7 deletions

View File

@@ -47,9 +47,9 @@ public static class RtcEndpoints
});
// Store a new SDP answer for the specified channel call.
app.MapPost("/api/rtc/answer", async (RtcAnswer request, RtcCallService rtcCallService) =>
app.MapPost("/api/rtc/answer", async (RtcOffer request, RtcCallService rtcCallService) =>
{
await rtcCallService.WriteAnswerAsync(request.ChannelId, request.OfferUser, request.AnswerUser, request.Sdp);
await rtcCallService.WriteAnswerAsync(request.ChannelId, request.SessionDescription);
return Results.Ok();
});

View File

@@ -98,9 +98,8 @@ public sealed class RtcCallService
/// </summary>
/// <param name="channelId">The channel the answer belongs to.</param>
/// <param name="offerUser">The original offer owner.</param>
/// <param name="answerUser">The user submitting the answer.</param>
/// <param name="sdp">The SDP answer payload.</param>
public async Task WriteAnswerAsync(string channelId, string offerUser, string answerUser, string sdp)
/// <param name="sessionDescription">The SDP and type answer payload.</param>
public async Task WriteAnswerAsync(string channelId, RtcSessionDescription sessionDescription)
{
var activeCalls = await _db.Select<RtcActiveCall>("rtc_active_calls");
var activeCall = activeCalls.FirstOrDefault(x => x.ChannelId == channelId && x.IsActive);
@@ -110,8 +109,8 @@ public sealed class RtcCallService
activeCall.Answer = new RtcSessionDescription
{
Type = "answer",
Sdp = sdp
Type = sessionDescription.Type,
Sdp = sessionDescription.Sdp
};
activeCall.UpdatedAt = DateTime.UtcNow;