Appearance
VAPI Inbound
Route incoming PSTN calls from SignalWire to VAPI AI assistants.
How It Works
- A caller dials a SignalWire phone number
- SignalWire executes a SWML script with
connectto VAPI's SIP endpoint - VAPI routes the call to the assigned AI assistant
- The assistant handles the conversation
SWML Script
yaml
version: 1.0.0
sections:
main:
- connect:
to: sip:%{call.to}@YOUR_CREDENTIAL_ID.sip.vapi.aiReplace 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.comornslookup 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:
- Go to Phone Numbers
- Select the registered number
- 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.comto get current SignalWire IP addresses - Ensure the
credentialIdin the SWMLconnectURI matches the VAPI trunk - Check the VAPI Dashboard for inbound call logs
