I am trying to implement a feature in our custom agent desktop where a supervisor can remotely start or stop a call recording on an active conversation. We are using the Genesys Cloud Platform SDK for .NET.
The goal is to hit the Recording API to manage the recording state. I found the endpoint /api/v2/recordings/conversations/{conversationId}/{segmentId}. The documentation suggests using PATCH to update the recording status.
Here is the code snippet I am using to make the request:
var configuration = new Configuration();
var recordingApi = new RecordingApi(configuration);
var conversationId = "12345678-1234-1234-1234-123456789012";
var segmentId = "87654321-4321-4321-4321-210987654321";
var updateBody = new RecordingUpdate {
Status = "recording"
};
try {
var result = await recordingApi.PostRecordingsConversationAsync(conversationId, segmentId, updateBody);
Console.WriteLine("Recording updated successfully");
} catch (ApiException ex) {
Console.WriteLine($"Error: {ex.ErrorCode} - {ex.Message}");
}
When I run this, I get a 400 Bad Request error. The error message says “Invalid recording state transition”. I have verified the conversation ID and segment ID are correct by fetching the conversation details first. The status of the conversation is active.
I tried changing the status to stopped as well, but it gives the same error. Is there a specific pre-requisite for the recording state before I can toggle it? Or am I using the wrong method? The docs are a bit sparse on the exact state machine for recordings.
Also, I noticed the method name is PostRecordingsConversationAsync but the endpoint uses PATCH. Is the SDK mapping this correctly? I am using version 17.0.0 of the SDK.