diff --git a/RelayServer/Endpoints/RtcEndpoints.cs b/RelayServer/Endpoints/RtcEndpoints.cs
index ac9ebcd..aa21efe 100644
--- a/RelayServer/Endpoints/RtcEndpoints.cs
+++ b/RelayServer/Endpoints/RtcEndpoints.cs
@@ -15,7 +15,7 @@ public static class RtcEndpoints
// Store or update the current SDP offer for a channel call.
app.MapPost("/api/rtc/offer", async (RtcOffer request, RtcCallService rtcCallService) =>
{
- await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.Sdp);
+ await rtcCallService.WriteOfferAsync(request.ChannelId, request.Username, request.SessionDescription);
return Results.Ok();
});
@@ -29,7 +29,7 @@ public static class RtcEndpoints
app.MapGet("/api/rtc/active/{channelId}", async (string channelId, RtcCallService rtcCallService) =>
{
var call = await rtcCallService.GetActiveCallAsync(channelId);
- return call is null ? Results.NotFound() : Results.Ok(call);
+ return call is null ? Results.NotFound() : Results.Ok(call); //TODO: needs to return a true or false value if the channelId is active
});
// Return the latest stored SDP offer for the specified channel.
diff --git a/RelayServer/Models/Rtc/RtcOffer.cs b/RelayServer/Models/Rtc/RtcOffer.cs
index 13f5c51..c11de01 100644
--- a/RelayServer/Models/Rtc/RtcOffer.cs
+++ b/RelayServer/Models/Rtc/RtcOffer.cs
@@ -6,7 +6,9 @@ public class RtcOffer : Record
{
public required string ChannelId { get; set; }
public required string Username { get; set; }
- public required string Sdp { get; set; }
+ public required RtcSessionDescription SessionDescription { get; set; }
+ // public required string Type { get; set; }
+ // public required string Sdp { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
\ No newline at end of file
diff --git a/RelayServer/Services/Rtc/RtcCallService.cs b/RelayServer/Services/Rtc/RtcCallService.cs
index c90429b..2585ce3 100644
--- a/RelayServer/Services/Rtc/RtcCallService.cs
+++ b/RelayServer/Services/Rtc/RtcCallService.cs
@@ -41,8 +41,9 @@ public sealed class RtcCallService
///
/// The channel the offer belongs to.
/// The user creating the offer.
+ /// The RtcSession Type.
/// The SDP offer payload.
- public async Task WriteOfferAsync(string channelId, string username, string sdp)
+ public async Task WriteOfferAsync(string channelId, string username, RtcSessionDescription sessionDescription)
{
var activeCalls = await _db.Select("rtc_active_calls");
var activeCall = activeCalls.FirstOrDefault(x => x.ChannelId == channelId && x.IsActive);
@@ -55,8 +56,8 @@ public sealed class RtcCallService
OfferUser = username,
Offer = new RtcSessionDescription
{
- Type = "offer",
- Sdp = sdp
+ Type = sessionDescription.Type,
+ Sdp = sessionDescription.Sdp
},
Answer = null,
CreatedAt = DateTime.UtcNow,
@@ -70,8 +71,8 @@ public sealed class RtcCallService
activeCall.OfferUser = username;
activeCall.Offer = new RtcSessionDescription
{
- Type = "offer",
- Sdp = sdp
+ Type = sessionDescription.Type,
+ Sdp = sessionDescription.Sdp
};
activeCall.UpdatedAt = DateTime.UtcNow;