Skip to content

Commit 866cbd2

Browse files
authored
Update TwilioInboundController.cs
1 parent 8234618 commit 866cbd2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,19 @@ protected Dictionary<string, string> ParseStates(List<string> states)
166166
states.Add(new("init_audio_file", request.InitAudioFile));
167167
}
168168

169-
convService.SetConversationId(conversation.Id, states);
170-
171-
// Load agent profile
172169
var agentService = _services.GetRequiredService<IAgentService>();
173-
var agent = await agentService.LoadAgent(request.AgentId);
174-
170+
// Get agent from storage
171+
var agent = await agentService.GetAgent(request.AgentId);
175172
// Enable lazy routing mode to optimize realtime experience
176173
if (agent.Profiles.Contains("realtime") && agent.Type == AgentType.Routing)
177174
{
178175
states.Add(new(StateConst.ROUTING_MODE, "lazy"));
179176
}
180-
177+
convService.SetConversationId(conversation.Id, states);
181178
convService.SaveStates();
179+
180+
// reload agent rendering with states
181+
agent = await agentService.LoadAgent(request.AgentId);
182182

183183
return (agent, conversation);
184184
}

0 commit comments

Comments
 (0)