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/conversations/calls/{conversationId}/recordingstate. The documentation suggests using PUT 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 updateBody = new RecordingState {
Status = "recording"
};
try {
var result = await recordingApi.PutConversationsCallsConversationIdRecordingstateAsync(conversationId, 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 is 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 PutConversationsCallsConversationIdRecordingstateAsync but the endpoint uses PUT. Is the SDK mapping this correctly? I am using version 17.0.0 of the SDK.