adverse-sapphire•3h ago
connect voice agent and twilio at scale
We are building a single Vapi voice agent that uses a custom LLM URL to dynamically respond to incoming calls. The goal is to identify the caller's phone number and use it to determine which backend LLM instance should handle the conversation. This allows us to support multiple use cases through a single voice agent on the Vapi dashboard.
To scale this setup, we plan to connect multiple Twilio phone numbers (potentially up to 1000) to this single Vapi agent. Each number represents a different use case or client, and the voice agent will route the call dynamically based on the incoming number.
We have a few questions:
Is there a limit to how many Twilio numbers can be connected to a single Vapi voice agent?
If 1000 numbers is not feasible, what is the recommended architecture to support this kind of routing? Is ther a way to connect Twilio call to vapi passing through our own backend?
8 Replies
To support dynamic routing for many Twilio numbers, configure each number (or the assistant) with a server URL that points to your backend. Your backend can then use the incoming caller's number to select the correct LLM instance. Here’s a sample Express.js endpoint to handle this:
Set this endpoint as your assistant or phone number server URL in Vapi to enable scalable, dynamic routing.
Sources:
- Setting server URLs
- Import number from Twilio
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
adverse-sapphireOP•3h ago
but how does the call from Twilio gets connected to the voice agent? We are able to get the dynamic LLM instance working.
@Vapi Support Bot
To connect Twilio calls to your Vapi voice agent, set your Twilio number's webhook to your backend, then have your backend trigger a Vapi call. For example:
Set
Reference: Call Handling with Vapi and Twilio Source: - Call Handling with Vapi and Twilio
/twilio-incoming
as your Twilio number's webhook. This lets you scale and route calls dynamically through your backend.Reference: Call Handling with Vapi and Twilio Source: - Call Handling with Vapi and Twilio
adverse-sapphireOP•3h ago
@Vapi Support Bot Do i need to link all 1000 numbers on the vapi dashboard to get this id? phoneNumberId: YOUR_VAPI_PHONE_NUMBER_ID,
Yes, each Twilio number you want to use with Vapi must be imported and registered in the Vapi dashboard to obtain its unique
Once imported, you can use that
phoneNumberId
.Once imported, you can use that
phoneNumberId
in your backend logic to trigger the Vapi agent for each incoming call:
For large-scale setups, consider automating the import process via the Vapi API to manage many numbers efficiently.
Sources:
- Phone Calling
- Call Handling with Vapi and Twilioadverse-sapphireOP•3h ago
@Vapi Support Bot is there a limit on how many numbers can be imported? we have 1000 of them
There is no documented hard limit on the number of Twilio numbers you can import into Vapi—only free Vapi numbers are limited to 10 per account. For large-scale imports (like 1000 numbers), automate the process using the Vapi API for efficiency. If you encounter any issues at this scale, it's best to reach out to Vapi support for guidance.
Reference: Phone Calling documentation
Source:
- Phone Calling
Message marked as helpful by @VerveAI! 🎉
Message marked as helpful by @VerveAI! 🎉
Message marked as helpful by @VerveAI! 🎉