GenerateEndingAudio
This commit is contained in:
parent
5d8cf0638e
commit
701a8f191b
|
|
@ -44,8 +44,8 @@ public class HangupPhoneCallFn : IFunctionCallback
|
||||||
var processUrl = $"{_twilioSetting.CallbackHost}/twilio/voice/hang-up?agent-id={message.CurrentAgentId}&conversation-id={conversationId}";
|
var processUrl = $"{_twilioSetting.CallbackHost}/twilio/voice/hang-up?agent-id={message.CurrentAgentId}&conversation-id={conversationId}";
|
||||||
|
|
||||||
// Generate initial assistant audio
|
// Generate initial assistant audio
|
||||||
/*string initAudioFile = null;
|
string initAudioFile = null;
|
||||||
if (!string.IsNullOrEmpty(args.ResponseContent))
|
if (!string.IsNullOrEmpty(args.ResponseContent) && _twilioSetting.GenerateEndingAudio)
|
||||||
{
|
{
|
||||||
var completion = CompletionProvider.GetAudioSynthesizer(_services);
|
var completion = CompletionProvider.GetAudioSynthesizer(_services);
|
||||||
var data = await completion.GenerateAudioAsync(args.ResponseContent);
|
var data = await completion.GenerateAudioAsync(args.ResponseContent);
|
||||||
|
|
@ -53,7 +53,7 @@ public class HangupPhoneCallFn : IFunctionCallback
|
||||||
fileStorage.SaveSpeechFile(conversationId, initAudioFile, data);
|
fileStorage.SaveSpeechFile(conversationId, initAudioFile, data);
|
||||||
|
|
||||||
processUrl += $"&init-audio-file={initAudioFile}";
|
processUrl += $"&init-audio-file={initAudioFile}";
|
||||||
}*/
|
}
|
||||||
|
|
||||||
var call = CallResource.Update(
|
var call = CallResource.Update(
|
||||||
url: new Uri(processUrl),
|
url: new Uri(processUrl),
|
||||||
|
|
|
||||||
|
|
@ -145,10 +145,6 @@ public class TwilioService
|
||||||
response.Play(new Uri(uri));
|
response.Play(new Uri(uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
response.Say("Goodbye.");
|
|
||||||
}
|
|
||||||
|
|
||||||
response.Hangup();
|
response.Hangup();
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,5 @@ public class TwilioSetting
|
||||||
public bool TranscribeEnabled { get; set; } = false;
|
public bool TranscribeEnabled { get; set; } = false;
|
||||||
|
|
||||||
public bool GenerateReplyAudio { get; set; } = true;
|
public bool GenerateReplyAudio { get; set; } = true;
|
||||||
|
public bool GenerateEndingAudio { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,12 @@
|
||||||
"reason": {
|
"reason": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The reason why user wants to end the phone call."
|
"description": "The reason why user wants to end the phone call."
|
||||||
|
},
|
||||||
|
"response_content": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "A response statement said to the user to politely and gratefully ending a conversation before hanging up."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [ "reason" ]
|
"required": [ "reason", "response_content" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue