Provider Comparison

🏒 Twilio

Traditional Leader
  • Mature, feature-rich platform
  • Global presence and reliability
  • Extensive documentation and community
  • Higher pricing on calls
  • Media Streams for real-time audio
  • SMS/MMS messaging support

⚑ Telnyx

Modern Alternative
  • Competitive pricing (often 50%+ savings)
  • Call Control API for advanced features
  • Developer-friendly modern APIs
  • SMS/MMS messaging support
  • Global carrier-grade network
  • WebRTC and SIP support

Provider Selection Logic

The system automatically determines which provider to use based on this priority:
1

Assistant-Level Credentials

Check if the assistant has telnyx_config or twilio_config configuredPriority: Telnyx > Twilio if both are present
2

Organization-Level Credentials

Fallback to organization-level telephony credentialsPriority: Telnyx > Twilio if both are present
3

Environment Variables

Use system-wide environment variables as last resortPriority: Telnyx > Twilio if both are present

Twilio Setup

1. Account Setup

  • Sign up at Twilio Console
  • Purchase a phone number
  • Enable Media Streams on your account

2. Webhook Configuration

Set your Twilio webhook URL to:
https://yourdomain.com/twiml

3. Credentials

Environment Variables (Global):
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_twilio_auth_token
Per-Assistant (API):
{
  "twilio_config": {
    "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "auth_token": "your_twilio_auth_token"
  }
}

4. Features

  • βœ… Inbound/Outbound calls
  • βœ… Call recording
  • βœ… Call transfer
  • βœ… Real-time audio streaming
  • βœ… SMS capabilities
  • βœ… Global phone numbers

Telnyx Setup

1. Account Setup

  • Sign up at Telnyx Portal
  • Purchase a phone number
  • Create a Call Control Application

2. Call Control Application

  1. Go to Call Control > Applications
  2. Create a new application
  3. Set webhook URL to:
    https://yourdomain.com/telnyx-webhook
    
  4. Enable Answering Machine Detection (optional)
  5. Save and note the Connection ID

3. Credentials

Environment Variables (Global):
TELNYX_API_KEY=KEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TELNYX_CONNECTION_ID=1234567890
Per-Assistant (API):
{
  "telnyx_config": {
    "api_key": "KEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "connection_id": "1234567890"
  }
}

4. Features

  • βœ… Inbound/Outbound calls
  • βœ… Call recording
  • βœ… Call transfer
  • βœ… WebRTC support
  • βœ… SMS capabilities
  • βœ… Competitive pricing
  • ⚠️ WebSocket audio streaming (planned)

Mixed Environment Examples

Use Case 1: Cost Optimization

// High-volume sales assistant - use Telnyx for cost savings
{
  "name": "Sales Dialer Bot",
  "telnyx_config": {
    "api_key": "KEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "connection_id": "1234567890"
  }
}

// Premium support assistant - use Twilio for reliability
{
  "name": "VIP Support Bot", 
  "twilio_config": {
    "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "auth_token": "your_twilio_auth_token"
  }
}

Use Case 2: Geographic Optimization

// US/Canada assistant - use Telnyx for better rates
{
  "name": "North America Bot",
  "telnyx_config": {
    "api_key": "KEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "connection_id": "1234567890"
  }
}

// International assistant - use Twilio for global coverage
{
  "name": "Global Support Bot",
  "twilio_config": {
    "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
    "auth_token": "your_twilio_auth_token"
  }
}

Provider Migration

Gradual Migration

You can migrate assistants from one provider to another without downtime:
{
  "name": "Customer Service Bot",
  "twilio_config": {
    "account_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "auth_token": "your_twilio_auth_token"
  }
}

Bulk Migration

Use the API to migrate multiple assistants:
import requests

# List all assistants
assistants = requests.get("/api/v1/assistants").json()

# Migrate each one
for assistant in assistants:
    requests.put(f"/api/v1/assistants/{assistant['id']}", json={
        "telnyx_config": {
            "api_key": "KEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "connection_id": "1234567890"
        },
        "twilio_config": {
            "account_sid": None,
            "auth_token": None
        }
    })

Troubleshooting

Check:
  • Webhook URLs are correct and accessible
  • Credentials are valid and have proper permissions
  • Phone number is assigned to correct assistant
  • Provider account has sufficient balance
Twilio: Ensure Media Streams are enabledTelnyx: Check Call Control Application settingsBoth: Verify network connectivity and bandwidth
Check priority order:
  1. Assistant-level config
  2. Organization-level config
  3. Environment variables
Debug: Check assistant object in API response to see detected provider

Best Practices

  • Start with one provider and add the second for specific use cases
  • Test thoroughly when switching providers for existing assistants
  • Monitor costs and usage patterns to optimize provider selection
  • Keep credentials secure and rotate them regularly
  • Use environment variables for global defaults, per-assistant config for exceptions

What’s Next?