---
title: "How to Orchestrate Multi-Call Conversations with an LLM and Twilio Conversation Memory"
description: "The tutorial builds a C# .NET 9 ASP.NET Core voice service that preserves caller context, preferences, and action history across separate inbound calls. It combines Twilio Conversation Relay and a Twilio Conversation Memory Store with an OpenAI gpt-4o-mini service, using WebSockets to connect the call flow and stream generated text. The setup covers creating the project, installing Twilio, DotNetEnv, and OpenAI packages, configuring credentials and IDs in .env, exposing local webhooks with ngrok, and routing /voice to /ws. The sample assistant is framed as Owlbert's Auto Repair and is instructed to speak naturally, avoid lists and emojis, refer to caller details, and acknowledge uncertainty rather than guess. Testing uses two calls from the same number; the expected result is that the second call recalls first-call details and that Twilio shows a stored conversation summary."
---

# How to Orchestrate Multi-Call Conversations with an LLM and Twilio Conversation Memory

[Twilio](https://yomu.fyi/company/twilio) · Amanda Lange · Sep 15, 2026

**Type:** Tutorial

## Summary

The tutorial builds a C# .NET 9 ASP.NET Core voice service that preserves caller context, preferences, and action history across separate inbound calls. It combines Twilio Conversation Relay and a Twilio Conversation Memory Store with an OpenAI gpt-4o-mini service, using WebSockets to connect the call flow and stream generated text. The setup covers creating the project, installing Twilio, DotNetEnv, and OpenAI packages, configuring credentials and IDs in .env, exposing local webhooks with ngrok, and routing /voice to /ws. The sample assistant is framed as Owlbert's Auto Repair and is instructed to speak naturally, avoid lists and emojis, refer to caller details, and acknowledge uncertainty rather than guess. Testing uses two calls from the same number; the expected result is that the second call recalls first-call details and that Twilio shows a stored conversation summary.

## Context

The tutorial is aimed at .NET developers building phone-based AI agents. Its example uses an auto repair assistant, while noting that the memory pattern can also apply to scenarios such as tech support and travel.

## Approach / What changed

Create a .NET 9 Web API, install the Twilio, DotNetEnv, and OpenAI packages, and configure Twilio and OpenAI credentials plus the Conversation Memory Store ID in a .env file. The application exposes a /voice endpoint that returns TwiML connecting Conversation Relay to a /ws WebSocket endpoint. OpenAiService uses gpt-4o-mini, incorporates prior memory context into the system prompt, and streams response text through the WebSocket. The local webhook is exposed with ngrok for testing.

## Takeaways

- Twilio Conversation Memory persists context between separate calls, allowing a returning caller’s conversation to continue after a hang-up or disconnection.
- The sample OpenAiService adds prior customer context to the system prompt and streams gpt-4o-mini output as text tokens through Conversation Relay.
- Conversation Memory is not intended for sensitive information, and this tutorial requires a Twilio Main API key because other key types cannot access the Conversation Memory features.

## FAQ

### How is memory checked across multiple calls?

The tutorial instructs you to make a first call with details such as a car’s make and model, hang up, and call again from the same phone number. If the feature is working properly, the agent remembers those details without prompting and the Memory Store shows a conversation summary.

### What configuration is needed before the service can run?

The .env file needs an OpenAI API key, Twilio API key and secret, Twilio configuration and memory store IDs, and a voice-capable Twilio phone number. The local /voice webhook must also be exposed publicly with ngrok and configured on the Twilio phone number.

### Is Conversation Memory suitable for sensitive customer data?

The tutorial explicitly warns that Conversation Memory is not intended for sensitive information. It also notes that the feature uses machine learning and may require accepting a warning during Memory Store setup.

**Tags:** [.NET](https://yomu.fyi/topic/dotnet), [OpenAI API](https://yomu.fyi/topic/openai-api), [Twilio Conversation Memory](https://yomu.fyi/topic/twilio-conversation-memory), [WebSockets](https://yomu.fyi/topic/websockets)

- Source: [Twilio](https://www.twilio.com/en-us/blog/developers/tutorials/product/orchestrate-multi-call-conversations-with-llm-twilio-conversation-memory)
- Source URL: https://www.twilio.com/en-us/blog/developers/tutorials/product/orchestrate-multi-call-conversations-with-llm-twilio-conversation-memory
- Ingested by Yomu: 2026-09-17T00:01:28.908Z

[Read original post](https://www.twilio.com/en-us/blog/developers/tutorials/product/orchestrate-multi-call-conversations-with-llm-twilio-conversation-memory)
