Twilio Voice
Answer and place calls with an existing Twilio number and a connic voice agent.
On this page
| Modes | Sync (incoming calls) and outbound (outgoing calls) |
| YAML type | twilio |
| Credentials | A Connection of type Twilio |
| Bridge | Not supported |
| Custom domain | Not supported |
| Linked agents | Exactly one agent, deployed with voice_config |
| While paused | connic rejects incoming calls. Twilio then follows the number's Primary handler fails setting; without one, the caller hears Twilio's application error message. |
Set up
Add
voice_configand a supported realtime model to an LLM agent, save the model provider's credentials in the project if the model requires them, and deploy the agent to the environment. See connic voice.In Twilio, pick an existing voice-capable number and check which region handles its incoming calls. If the number belongs to a SIP trunk, remove it from the trunk.
Open the agent. In Connector Flow, click Add inbound connector, then Create New Connector, and select Twilio Voice. Under Connection, pick a Twilio Connection or create one with the region, Account SID, and that region's Auth Token.
Choose the Phone number. Numbers the connector can't use, such as a number on a SIP trunk or one another connic connector uses, are listed but disabled, with the reason. Optionally add Transfer numbers and a Fallback number, and click Create. connic links the agent and points the number's incoming-call webhook at connic; see Provider setup for what it replaces.
Call the number and open the run to check the conversation and the tools the agent used.
In code
Declare the connector in connectors/*.yaml. The deploy looks phone_number up among the voice-capable numbers of the Connection's account, and activation links the agent, which needs voice_config in that deployment. Quote every phone number; unquoted, YAML reads it as an integer and the deploy fails.
type: twilio
connection: support-twilio
config:
phone_number: "+4930123456"
transfer_numbers:
- "+4930123456789"
allowed_callers:
- "+4915112345678"
fallback_number: "+4930987654321"
max_wait_seconds: 60
hold_audio_path: assets/hold.mp3
agents:
- support-voiceConfiguration
The fields of a Twilio Voice connector, the same in connectors/*.yaml, the REST API, and connic MCP. The descriptions name the matching setting in the dashboard. Connectors in code describes the fields every connector shares, such as agents and environments. A Twilio Voice connector needs its voice agent from the start: the dashboard links the agent you create it from, or asks for one under Voice agent, and a create request through the REST API or connic MCP must name an agent deployed with voice_config in agent_name.
| Field | Type | Status | Description |
|---|---|---|---|
| type | string | Required | twilio. |
| connection | string | Required | Name or ID of a Twilio Connection, which holds the region, Account SID, and Auth Token. Dashboard: Connection. |
| mode | string | Optional | sync answers calls to the number; outbound places a call for every run of the agent. It can't change after the connector is created. Dashboard: Mode.Default: sync |
| config | object | Required | Twilio Voice settings. |
| phone_number | string | Required | The number that receives the calls or places them, quoted in E.164 format such as "+4930123456", or the number's Twilio SID starting with PN. It must be a voice-capable number of the Connection's account. Dashboard: Phone number. |
| transfer_numbers | string[] | Optional | Numbers that agent tools may transfer callers to with TransferCall, in E.164 format. A list, or one string with the numbers separated by line breaks or commas. At most 20; duplicates are dropped. Dashboard: Transfer numbers. |
| allowed_callers | string[] | Optional | Sync mode. Only these numbers can call the agent, in E.164 format, as a list or one string with line breaks or commas. At most 100. Twilio turns away calls from other and hidden numbers before they are answered; see Allowed callers. Dashboard: Allowed callers. |
| to | string | Optional | Outbound mode. The number to call, in E.164 format, when a run's input has no to. Dashboard: Default number to call. |
| ring_seconds | integer | Optional | Outbound mode. How long the phone rings, from 5 to 120 seconds, before the run fails because nobody answered. Dashboard: Ring time (seconds).Default: 30 |
| fallback_number | string | Optional | Sync mode. Number in E.164 format that receives accepted calls the agent can't finish and calls that waited the maximum wait. Dashboard: Fallback number. |
| max_wait_seconds | integer | Optional | Sync mode. How long callers wait for the agent when it is already in as many calls as its concurrency limit allows, from 0 to 900. 0 sends such calls to the fallback number right away. Dashboard: Maximum wait (seconds).Default: 30 |
| hold_audio_path | string | Optional | Sync mode. Path of an MP3 or WAV file in your project folder, such as assets/hold.mp3, up to 10 minutes long, that waiting callers hear on repeat. It deploys with the project. Without one, they hear the ringing tone. Dashboard: Hold audio. |
Connection
A Twilio Connection holds the account credentials and can serve any number of Twilio Voice and Twilio Messaging connectors in the same account and region. connic uses the Account SID and Auth Token to check the account, list numbers, and set webhooks. The Auth Token also verifies the signature of every request Twilio sends.
| Setting | Description |
|---|---|
| Region | US1 (United States), IE1 (Ireland), or AU1 (Australia). Defaults to US1. Match the region that handles the number's incoming calls in Twilio. In connic, the region only selects the Twilio API; which region handles a call is set on the number in Twilio. Twilio Messaging connectors on the same Connection work in US1 with every channel and in IE1 with SMS text only, but not in AU1. |
| Account SID | The Twilio account ID, starting with AC. The account must be active. |
| Auth Token | The Auth Token of the selected region, not an API key SID or secret. Twilio credentials are regional; see Manage Regional API Credentials. |
Generated values
connic creates this value when the connector is created and keeps it across updates and deploys. Leave it out of YAML files; connic lint rejects it.
| Value | Modes | Description |
|---|---|---|
| Incoming-call webhook | Sync | The URL connic sets as the number's incoming-call webhook. You don't need to enter it in Twilio. |
Agent input
Each call starts a run with the call details:
{
"call_id": "CA00000000000000000000000000000001",
"from": "+4915112345678",
"to": "+4930123456",
"provider": "twilio",
"caller_name": "Alex Example",
"forwarded_from": "+4940123456789",
"raw": {
"AccountSid": "AC00000000000000000000000000000000",
"CallSid": "CA00000000000000000000000000000001",
"From": "+4915112345678",
"To": "+4930123456",
"Direction": "inbound",
"CallerName": "Alex Example",
"ForwardedFrom": "+4940123456789"
}
}call_idis the Twilio CallSid.caller_namecomes from Twilio'sCallerName, which needs caller ID lookup on the number in Twilio.forwarded_fromcomes from Twilio'sForwardedFrom, which Twilio sends only when the caller's carrier passes the forwarding number.rawholds every parameter of Twilio's incoming-call request, such as the location fields andStirVerstatwhere Twilio provides them.
Calls
In sync mode, Twilio Voice answers calls to the number. connic streams the audio between Twilio and the agent in both directions, and the caller hears a ringing tone until the agent is ready to speak. The run details show the transcript and the tools the agent used, and the trace timings show where a response was delayed or a tool failed. Keypad input and hang-up follow the agent's voice settings.
Outgoing calls
In outbound mode, every run of the linked agent is a call. In the agent's Connector Flow, click Add outbound connector, select Twilio Voice, and choose Outgoing calls as the mode. Start the runs any way you like, for example from a webhook connector, or from another agent with trigger_agent.
When a run starts, connic calls the number in the input's to field from the connector's number, or the connector's default number when the input has none. With a greeting, the agent speaks first once someone answers; without one, it waits for them to speak. It knows about the call what the run input tells it. The agent gets through phone menus with press_keys and can wait on hold until a person answers. Runs beyond the agent's max_concurrent_runs wait before connic dials, so nobody who answers has to wait for the agent. The agent can transfer the call to a transfer number, like an incoming call.
The run fails when nobody answers within the ring time, the line is busy, or the call can't be connected, and its error says which. If a mailbox answers, the agent hears its greeting like a person, so tell the agent in its system prompt what to do then, for example leave a short message after the tone and hang up.
type: twilio
mode: outbound
connection: support-twilio
config:
phone_number: "+4930123456"
ring_seconds: 40
agents:
- reminder-calls{
"to": "+4915112345678",
"customer": "Alex Example",
"reason": "Confirm tomorrow's appointment at 10:00"
}Allowed callers
With allowed callers, connic turns away calls from all other numbers and from hidden numbers before Twilio answers them, so they start no run. The connector logs show each rejected call and its number. Caller numbers can be faked, so don't rely on this list alone to protect sensitive data.
Waiting callers
Every call is a run, so the agent takes as many calls at once as its max_concurrent_runs allows. Further callers wait in line and reach the agent in the order they called. While they wait, they hear the ringing tone or the connector's hold audio. A caller still waiting after the maximum wait goes to the fallback number; without one, the call ends and its run fails.
If the hold audio file is missing or can't be played, waiting callers hear the ringing tone and the connector logs show why. A changed file plays once it's deployed.
Transfers and fallback
When an agent tool raises TransferCall with one of the connector's transfer numbers, Twilio dials that number. If nobody answers there, the call ends. If an accepted incoming call can't continue, for example because the run fails or the caller waited the maximum wait, Twilio dials the fallback number instead. Without a fallback number, the call ends. The fallback number applies only in sync mode and not to transfers.
Calls connic doesn't accept, for example while the connector is paused or the environment has no active deployment, go to the number's Primary handler fails setting in Twilio, which connic leaves unchanged. Point it at TwiML that dials a staff number to forward those calls too.
Provider setup
When you create the connector in sync mode, connic sets the number's incoming-call webhook to the connector's webhook URL with HTTP POST and removes a TwiML App from the number. It leaves the number's Primary handler fails setting and its messaging settings unchanged. In outbound mode, connic changes nothing on the number; Twilio must allow calls from the account to the numbers you call.
- Edit the Connection to change the credentials or region. Edit the connector to choose another Connection or number.
- When you switch numbers, connic sets the webhook on the new number and clears it on the previous number if it still points to this connector.
- Deleting the connector clears the number's webhook only if it still points to connic.
Limits and errors
| Limit | Value |
|---|---|
| Linked agents | Exactly one, with voice_config in the environment's active deployment |
| Transfer numbers | 20 per connector |
| Allowed callers | 100 per connector |
| Maximum wait | 0 to 900 seconds; 30 by default |
| Ring time | 5 to 120 seconds; 30 by default |
| Hold audio | MP3 or WAV, up to 10 minutes |
| Incoming calls | 1,000 per minute per connector. Twilio gets 429 for more. |
| Call length | The agent's timeout, capped by the plan's run timeout; 60 minutes on Pro |
| Active connectors | At the plan's active connector limit, creating the connector fails with 403 instead of creating it paused, because it would change the number in Twilio. A deploy that would create the connector or bring it back at the limit fails. |
| Error or symptom | What to do |
|---|---|
| Remove this number from its Twilio SIP trunk before connecting it | Remove the number from the trunk in Twilio, then create the connector again. |
| This number is connected to another connic connector | Delete that connector first, or choose another number. |
| The selected Twilio number does not support voice | Choose a voice-capable number. |
| Twilio request failed | Check that the Auth Token belongs to the Connection's region and that the account is active. |
| Twilio did not remove the number's TwiML Application | Remove the TwiML App from the number in Twilio, then retry. |
| Deploy this agent with voice_config before linking a voice connector | Add voice_config to the agent and deploy it to the connector's environment. |
| Calls don't reach the agent | Check that the connector is active and linked to exactly one agent with voice_config in the active deployment. Read the run error and the call's error details in Twilio. |