Skip to content

VAPI Outbound

Use VAPI AI assistants to initiate outbound PSTN calls via SignalWire's telephony infrastructure.

How It Works

  1. VAPI's assistant initiates an outbound call via the BYO SIP trunk
  2. SignalWire receives the SIP call at the assigned SIP Address
  3. The SWML script bridges to the destination PSTN number
  4. The callee receives a call from your SignalWire number

SWML Script

yaml
version: 1.0.0
sections:
  main:
    - connect:
        answer_on_bridge: true
        from: "+1XXXXXXXXXX"
        to: "%{call.to.replace(/^sip:/i, '').replace(/@.*/, '')}"

Replace +1XXXXXXXXXX with your SignalWire outbound caller ID number.

Setup Steps

1. Create the SWML Script

Create a SWML script in your SignalWire Dashboard using the configuration above.

2. Add a SIP Address

In SignalWire:

  1. Go to SIP → SIP Addresses
  2. Create a new SIP Address
  3. Assign the SWML script to it
  4. Note the unique SIP domain

3. Get Auth Credentials

Contact SignalWire Support to request the app password for the SIP Address. You will use this as the VAPI trunk auth password.

4. Create BYO SIP Trunk in VAPI

Use the VAPI API to create an outbound SIP trunk:

json
{
  "provider": "byo-sip-trunk",
  "name": "SignalWire Outbound",
  "sipUri": "YOUR_SIGNALWIRE_SIP_DOMAIN",
  "username": "+1XXXXXXXXXX",
  "password": "YOUR_APP_PASSWORD_FROM_SUPPORT",
  "outboundEnabled": true
}

Save the returned credentialId.

5. Register Phone Number with VAPI

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

6. Assign AI Assistant

In the VAPI Dashboard, assign the AI assistant to the registered outbound number.

7. Initiate Calls

Trigger outbound calls via the VAPI API, specifying the phone number and destination. VAPI routes the call through the SignalWire SIP trunk to reach the PSTN.

Troubleshooting

  • Auth failures: Verify the username (phone number in E.164) and password with SignalWire Support
  • Calls not connecting: Check that outboundEnabled: true is set on the VAPI trunk
  • Destination number not dialing: Confirm the SWML to expression correctly strips the SIP URI
  • Check VAPI outbound call logs for SIP error codes

SignalWire Developer Documentation