> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voicerix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio

> Connect Twilio to Voicerix for outbound and inbound voice calls.

## Overview

Twilio is a cloud communications platform with global reach. Voicerix uses Twilio's programmable voice and WebSocket streaming to power your voice agents.

## Prerequisites

* A [Twilio account](https://www.twilio.com/try-twilio)
* **Account SID** and **Auth Token** from your Twilio Console
* At least one Twilio phone number

## Configuration

### Step 1: Get Twilio Credentials

1. Log in to your [Twilio Console](https://console.twilio.com/)
2. Find your **Account SID** and **Auth Token** on the dashboard
3. Navigate to **Phone Numbers** → **Manage** → **Active Numbers** and note your number(s)

### Step 2: Add Configuration in Voicerix

1. In Voicerix, go to **Integrations** and click **Add configuration**
2. Select **Twilio** as your provider
3. Enter your **Account SID** and **Auth Token**
4. Click **Save Configuration**
5. Open the saved configuration and add at least one **phone number** in E.164 format (e.g. `+1234567890`)

### Step 3: Test

1. Go to **Agents**, open a workflow, and click **Test Call**
2. Check the call logs to confirm a successful connection

***

## Inbound Calling Setup

Inbound routing is number-level in Twilio — each number has its own `VoiceUrl`. When you save an inbound workflow on a phone number in Voicerix, **Voicerix automatically pushes the webhook URL to that number's `VoiceUrl` in your Twilio account**.

### Step 1: Assign an Inbound Workflow

1. In Voicerix, go to **Integrations** and open your Twilio configuration
2. In the **Phone numbers** section, edit the number that should receive inbound calls
3. Set its **Inbound workflow** to the agent that should answer
4. Save

### Step 2: Verify in Twilio Console

1. Go to **Phone Numbers** → **Manage** → **Active Numbers** in Twilio Console
2. Click the number you assigned an inbound workflow to
3. Under **Voice Configuration**, confirm:
   * **Webhook** is set to: `https://client.voicerix.ai/api/v1/telephony/inbound/run`
   * **HTTP Method** is `POST`

<Note>
  Voicerix pushes this URL automatically when you save the inbound workflow. If the field is empty or shows a different URL, the auto-push failed — usually because the credentials are incorrect or the number isn't owned by this Twilio account. Paste the URL manually, set the method to `POST`, and save.
</Note>

### Step 3: Test Inbound

1. Call your Twilio number from another phone
2. Verify your voice agent answers and responds
3. Check call logs in both Voicerix and Twilio Console

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Invalid phone number error">
    Ensure phone numbers include the country code in E.164 format: `+1234567890`
  </Accordion>

  <Accordion title="Authentication failed">
    * Verify Account SID and Auth Token are correct
    * Check for extra spaces in credentials
    * Ensure credentials haven't been regenerated in Twilio Console
  </Accordion>

  <Accordion title="Webhook signature validation failing">
    * Confirm your Auth Token matches exactly
    * Verify the webhook URL matches what Twilio sends
    * Check if you're behind a proxy that modifies requests
  </Accordion>

  <Accordion title="No audio on calls">
    * Verify the WebSocket connection is established
    * Check firewall rules for WebSocket traffic
    * Ensure the audio pipeline is configured correctly
  </Accordion>

  <Accordion title="Inbound calls go to voicemail">
    * Verify the Twilio number's webhook is set to `https://client.voicerix.ai/api/v1/telephony/inbound/run`
    * Ensure the webhook URL is publicly accessible
    * Confirm the called number is in your Voicerix telephony configuration with an **Inbound workflow** assigned
    * Verify Voicerix is running and responding
  </Accordion>

  <Accordion title="Voice agent doesn't respond to inbound calls">
    * Confirm the phone number has an **Inbound workflow** assigned in Integrations
    * Check webhook signature validation (Auth Token in Voicerix matches Twilio Console)
    * Verify WebSocket connection establishes successfully
    * Review call logs for error messages
  </Accordion>
</AccordionGroup>

## Best Practices

* Test your configuration with a single call before running campaigns
* Monitor Twilio Console for usage and billing
