Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines +58 to +59

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Storage failures block live call redirects 🐞 Bug ☼ Reliability

Both phone-call functions await the new IConversationStorage.Append before calling
TryRedirectCallAsync, without handling persistence errors. If the repository write fails after
audio generation, the exception prevents a live call from reaching its hang-up or transfer redirect.
Agent Prompt
## Issue description
A failed dialog write prevents either phone-call function from redirecting the live call.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/HangupPhoneCallFn.cs[58-67]
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/TransferPhoneCallFn.cs[63-70]
## Recommended Fix
Make dialog persistence best-effort in both functions: catch and log append failures with their exception, then attempt the redirect regardless. Preserve the intended dialog write when storage is available.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

3. Reused audio gets the wrong transcript 🐞 Bug ≡ Correctness

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
## Issue description
A returned audio filename does not always mean the file contains the current hang-up or transfer text.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/HangupPhoneCallFn.cs[47-62]
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/TransferPhoneCallFn.cs[53-67]
- src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs[470-486]
## Recommended Fix
When speech generation reuses an existing file, obtain and store the text associated with that file rather than the latest argument. Alternatively, generate a distinct audio file for each distinct line before appending its text.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

{
CurrentAgentId = message.CurrentAgentId
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Ended calls gain lines they never heard 🐞 Bug ≡ Correctness

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
## Issue description
Hang-up and transfer record audio lines even when Twilio says the call was already over and no audio could be delivered.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/HangupPhoneCallFn.cs[58-67]
- src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/TransferPhoneCallFn.cs[63-75]
## Recommended Fix
Account for the redirect result before recording a line as delivered in both functions. Preserve the required storage lifetime when arranging the redirect and write, and do not persist a spoken-line dialog when the redirect returns false.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

{
CurrentAgentId = message.CurrentAgentId
});
}
}

Expand Down
Loading