Awaken Conversations User Guide |
|||||
|
|||||
C#
|
var form = Request.Form;
if (form.Keys.Count > 0)
{
// The requestId is returned by the transcription upload request and if stored can used to join
// the upload request to this callback response
if (form.TryGetValue("requestid", out StringValues requestId))
{
Console.WriteLine($@"Request Id: {requestId[0]}");
}
// This contains the key the JSON is stored in. It will be: {call_id}.json
var jsonFormKey = form.Keys.FirstOrDefault(key => key.EndsWith(".json"));
if (jsonFormKey != null)
{
Console.WriteLine($@"JSON Form Key: {jsonFormKey}");
}
// This contains the key the text transcription is stored in. It will be: {call_id}.txt
var transcriptionTextKey = form.Keys.FirstOrDefault(key => key.EndsWith(".txt"));
if (transcriptionTextKey != null)
{
Console.WriteLine($@"Txt Form Key: {transcriptionTextKey}");
}
}
if (form.Files.Count > 0)
{
// This file is a byte stream of audio and will have a filename of: {call_id}.mp3
var file = form.Files[0];
if (file.ContentType == "audio/mpeg")
{
Console.WriteLine($@"Audio Filename: {file.FileName}");
}
}
return Ok();
|