diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs index 07c4ad87..31d3db52 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs +++ b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs @@ -68,6 +68,9 @@ public class TwilioInboundController : TwilioController await hook.OnSessionCreated(request); }, request.AgentId); + var conv = _services.GetRequiredService(); + conv.SaveStates(); + if (twilio.MachineDetected(request)) { response = new VoiceResponse(); @@ -204,7 +207,7 @@ public class TwilioInboundController : TwilioController storage.Append(conversation.Id, new RoleDialogModel(AgentRole.User, request.Intent) { - CurrentAgentId = conversation.Id, + CurrentAgentId = agent.Id, CreatedAt = DateTime.UtcNow }); }