Fixed all underlying issues with the "Answer" call.

This commit is contained in:
2026-04-06 16:08:37 -04:00
parent aa7f6597c4
commit 7d8755ca71
6 changed files with 134 additions and 38 deletions

View File

@@ -124,13 +124,14 @@ public sealed class RtcCallService
/// <returns>
/// A list of answers for the channel ordered from oldest to newest.
/// </returns>
public async Task<List<RtcAnswer>> GetAnswersAsync(string channelId)
public async Task<List<RtcSessionDescription>> GetAnswersAsync(string channelId)
{
var answers = await _db.Select<RtcAnswer>("rtc_answers");
return answers
.Where(x => x.ChannelId == channelId)
.OrderBy(x => x.CreatedAt)
.ToList();
var activeCall = await GetActiveCallAsync(channelId);
if (activeCall?.Answer is null)
return [];
return [activeCall.Answer];
}
/// <summary>
@@ -140,13 +141,10 @@ public sealed class RtcCallService
/// <returns>
/// The newest answer for the channel, or null if no answer exists.
/// </returns>
public async Task<RtcAnswer?> GetLatestAnswerAsync(string channelId)
public async Task<RtcSessionDescription?> GetLatestAnswerAsync(string channelId)
{
var answers = await _db.Select<RtcAnswer>("rtc_answers");
return answers
.Where(x => x.ChannelId == channelId)
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault();
var activeCall = await GetActiveCallAsync(channelId);
return activeCall?.Answer;
}
/// <summary>