Skip to content

VAPI Inbound

Route incoming PSTN calls from SignalWire to VAPI AI assistants.

How It Works

  1. A caller dials a SignalWire phone number
  2. SignalWire executes a SWML script with connect to VAPI's SIP endpoint
  3. VAPI routes the call to the assigned AI assistant
  4. The assistant handles the conversation

SWML Script

yaml
version: 1.0.0
sections:
  main:
    - connect:
        to: sip:%{call.to}@YOUR_CREDENTIAL_ID.sip.vapi.ai

Replace YOUR_CREDENTIAL_ID with the credential ID from VAPI's BYO SIP trunk configuration.

Setup Steps

1. Create a BYO SIP Trunk in VAPI

Use the VAPI API to register SignalWire as a BYO (Bring Your Own) SIP trunk:

json
{
  "provider": "byo-sip-trunk",
  "name": "SignalWire",
  "sipUri": "sip.signalwire.com",
  "inboundEnabled": true
}

Include all 15 SignalWire IP addresses in the trunk configuration to ensure reliable routing.

Note: SignalWire IPs can change. Monitor with dig sip.signalwire.com or nslookup sip.signalwire.com.

The response returns a credentialId — save it for use in the SWML script.

2. Register Phone Number with VAPI

Associate your SignalWire phone number with VAPI using the credential ID:

json
{
  "provider": "byo-phone-number",
  "number": "+1XXXXXXXXXX",
  "credentialId": "YOUR_CREDENTIAL_ID"
}

3. Assign AI Assistant in VAPI Dashboard

In the VAPI Dashboard:

  1. Go to Phone Numbers
  2. Select the registered number
  3. Assign the AI assistant that should handle inbound calls

4. Create the SWML Script

In your SignalWire Dashboard, create a SWML script using the configuration above, substituting your credentialId.

5. Assign Script to Phone Number

In SignalWire, assign the SWML script to the phone number.

Testing

Call the SignalWire number from any phone. The call routes through to VAPI and the assigned AI assistant picks up.

Troubleshooting

  • If calls don't reach VAPI, verify all 15 SignalWire IPs are registered in the VAPI trunk
  • Use dig sip.signalwire.com to get current SignalWire IP addresses
  • Ensure the credentialId in the SWML connect URI matches the VAPI trunk
  • Check the VAPI Dashboard for inbound call logs

SignalWire Developer Documentation