Repository navigation
fix(twilio): save the hang-up and transfer lines the caller hears the dialogs #1523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,14 @@ public async Task<bool> Execute(RoleDialogModel message) | |
| if (!string.IsNullOrEmpty(initAudioFile)) | ||
| { | ||
| processUrl += $"&init-audio-file={initAudioFile}"; | ||
|
|
||
| // The caller hears this as audio, so keep it in the dialogs too. Save it before the redirect, | ||
| // which closes the stream and disposes this scope. | ||
| var storage = _services.GetRequiredService<IConversationStorage>(); | ||
| await storage.Append(conversationId, new RoleDialogModel(AgentRole.Assistant, args.ResponseContent) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Reused audio gets the wrong transcript Both functions append the current text whenever SaveSpeechAsync returns a filename, although that filename can refer to an existing recording of different text. On a repeated hang-up or transfer in a realtime conversation without a synthesis model, the fixed-name audio file is reused while the new dialog records the latest argument instead. Agent Prompt
|
||
| { | ||
| CurrentAgentId = message.CurrentAgentId | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,14 @@ public async Task<bool> Execute(RoleDialogModel message) | |
| if (!string.IsNullOrEmpty(initAudioFile)) | ||
| { | ||
| processUrl += $"&init-audio-file={initAudioFile}"; | ||
|
|
||
| // The caller hears this as audio, so keep it in the dialogs too. Save it before the redirect, | ||
| // which closes the stream and disposes this scope. | ||
| var storage = _services.GetRequiredService<IConversationStorage>(); | ||
| await storage.Append(conversationId, new RoleDialogModel(AgentRole.Assistant, args.TransitionMessage) | ||
|
Comment on lines
+63
to
+64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Ended calls gain lines they never heard The new assistant dialog is appended before TryRedirectCallAsync determines whether the call can be redirected. When Twilio reports that a call has already ended, the service returns false without delivering the audio, but both functions have already stored the line as spoken. Agent Prompt
|
||
| { | ||
| CurrentAgentId = message.CurrentAgentId | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Storage failures block live call redirects
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsDismiss ↗ | View ↗