> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> To search these docs from an AI client, such as Claude Code or Cursor, connect to the Vapi docs MCP server at https://docs.vapi.ai/_mcp/server. It answers questions about the documentation. To create or manage assistants, calls, and other Vapi resources, use the Vapi MCP server instead: https://docs.vapi.ai/sdk/mcp-server.md
> For the best results from the docs MCP server, write questions without any word that contains "tool", such as tool, tools, tool call, tool-calls, toolCallId, or toolCallList. Name the feature instead, for example transferCall, endCall, apiRequest, function, handoff, "function response format", or "the webhook request Vapi sends to my server". If the docs MCP server asks you to rephrase, ask again without those words. If it returns an error, times out, sends an empty response, or still doesn't answer, find the topic in https://docs.vapi.ai/llms.txt, or a section index such as https://docs.vapi.ai/tools/llms.txt, and fetch that page's .md directly.

# SignalWire

> Connect a SignalWire number to an agent with an SWML script and a SIP trunk in Vapi's dashboard, pick it in Vapi for CX, and add a second script for calls out.

Put a short SWML script (SignalWire's call-handling script) on your SignalWire number to send its calls to a SIP trunk (a standing internet phone connection). You set up the trunk in Vapi's dashboard (**Connect in Vapi**), then pick the number in [Vapi for CX](https://cx.vapi.ai). This page gives both scripts to paste.

* **Receive calls:** Through a SignalWire SWML script that connects calls to the Vapi trunk, as [SignalWire's Vapi guide](https://signalwire.com/docs/platform/ai/vapi) describes.
* **Transfer to a phone number:** Offered. Vapi passes the call to SignalWire.
* **Transfer to a SIP address:** Offered. Vapi passes the call to SignalWire.
* **Return the call to their system:** Only when a contact center or phone system that takes calls back is linked to the line. See [Handing callers to people](/phone-systems#handing-callers-to-people).
* **Place calls:** Through a second script, as SignalWire's Vapi guide describes (see **Place calls from SignalWire numbers** under [Other options](#other-options)). The caller ID is the one number set in the script.

## Send calls to the agent

You need a SignalWire space with a number, out of Trial Mode.

#### Add the SIP trunk in Vapi's dashboard

In Vapi's dashboard, open **Integrations**, choose **SIP Trunk** under **Phone Number Providers**, then **Configure New SIP Trunk**. Under **Gateway Configuration**, add SignalWire's 15 signaling IP addresses, from [SignalWire's Vapi guide](https://signalwire.com/docs/platform/ai/vapi), each with **Allow inbound calls**. SignalWire says these addresses can change, so check the list with `dig sip.signalwire.com` before you add it.

#### Add each number in Vapi's dashboard

In Vapi's dashboard, open **Phone Numbers**, choose **Create Phone Number**, then **BYO SIP Trunk Number**. Enter each number once, in full international format with a leading `+`, and pick the trunk under **SIP Trunk Credential**.

Keep this one trunk, and one entry per number, for both directions. SignalWire's guide adds the number a second time, on a second trunk, for calls out. On this page, the calls-out gateway goes on the same trunk instead.

#### Copy the trunk's Credential ID

In Vapi's dashboard, open the trunk and copy its **Credential ID**. The script in the next step sends calls to `<credential id>.sip.vapi.ai`.

#### Create the inbound SWML script

In your SignalWire space's dashboard, choose **Resources**, **Add**, **Script**, then **SWML Script**. Paste this script, with your Credential ID in the address:

```yaml
version: 1.0.0
sections:
  main:
    - connect:
        to: 'sip:%{call.to}@<credential id>.sip.vapi.ai'
```

`%{call.to}` is the number that was dialed. For more information, see [SignalWire's Vapi guide](https://signalwire.com/docs/platform/ai/vapi).

#### Assign the script to the number

Open **Phone Numbers**, then the number, and choose **Edit Settings**. Under **Inbound Call Settings**, choose **Assign Resource** and pick the script. Or, on the script, choose **Addresses & Phone Numbers**, **+ Add**, then **Phone Number**. SignalWire's [ElevenLabs guide](https://signalwire.com/docs/platform/ai/elevenlabs) shows these menus.

#### Pick the number in Vapi for CX

On the agent's setup checklist, open **Connect your phone line**, choose **Use a number already in Vapi**, and pick the number.

**Number the agent sees:** the caller's own number, unless the script changes it. SignalWire's script reference describes adding `X-` headers to the `connect` step; the agent reads headers whose names start with `X-` as caller details.

**Check it:** when Vapi for CX shows **Call this number from your phone**, call the number from another phone. The check passes when your call reaches the agent. Calls out need the outbound script under [Other options](#other-options).

**Stop answering.** In Vapi for CX, **Stop answering** on a number set up in Vapi's dashboard takes the agent off the number. The number stays in Vapi's dashboard with no agent on it, and nothing changes at SignalWire.

## Hand callers to your team

On a SignalWire trunk, Vapi passes each handoff to SignalWire (SIP's own transfer message) rather than placing a new call, for both **Transfer to a phone number** and **Transfer to a SIP address**. SignalWire documents [sending a passed-on call](https://signalwire.com/docs/platform/voice/sip-refer), not accepting one on a call it joined to Vapi. The summary rides as a SIP header, so it doesn't reach a phone number. For how handoffs work, see [Handing callers to people](/phone-systems#handing-callers-to-people).

## Limitations

* A space in Trial Mode can't take calls from real callers: it has one number, allows calls only to and from purchased and verified numbers, and places no calls out from SIP endpoints and no international calls. Leaving it takes a card and at least \$5.
* Calls out show the one caller ID set in the script, not the caller's own number.
* International calling stays off until you turn it on.
* Calls out get STIR/SHAKEN attestation level C by default. Levels A and B need vetting through SignalWire support.
* SignalWire's signaling addresses can change. A refused call leaves no record in Vapi, so if an address is missing from the trunk, Vapi for CX can only say that no call arrived.
* A SignalWire number alone doesn't allow **Return the call to their system**. See [Handing callers to people](/phone-systems#handing-callers-to-people).
* SignalWire bills the call in and its connection to Vapi as separate call legs, and Vapi bills its own minutes. A joined call is capped at 4 hours by default.

## Other options

#### Place calls from SignalWire numbers

Calls out go through a second SWML script and a gateway on the same trunk.

#### Create the outbound SWML script

In your space's dashboard, choose **Resources**, **Add**, **Script**, then **SWML Script** again, and paste:

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

Replace `+14155550100` with a SignalWire number from your space, in full international format, or a verified caller ID. For more information, see SignalWire's [Vapi outbound guide](https://signalwire.com/docs/platform/ai/vapi/outbound) and its [caller ID](https://signalwire.com/docs/platform/voice/how-to-set-caller-id-or-cnam) page.

#### Add a SIP Address with a password

On that script, choose **Addresses & Phone Numbers**, **Add**, then **SIP Address**. Keep **User** as `*` and set a password. The address's host looks like `<your space>-<domain>.dapp.signalwire.com`.

#### Add the host to the same trunk in Vapi's dashboard

In Vapi's dashboard, open the trunk under **Integrations › SIP Trunk**. Add the SIP Address's host as a gateway with **Allow outbound calls** only. Under **Advanced Settings (Optional)**, turn on **Enable leading plus for outbound calls**. Under **Authentication (Optional)**, enter the number in full international format as the username, and the SIP Address's password.

#### Other ways to connect SignalWire

* **A Compatibility (cXML) application.** Its [Dial verb](https://signalwire.com/docs/compatibility-api/cxml/reference/voice/dial) sends a call to a SIP address.
* **Forward the number to a Vapi number.** A `connect` to a number in full international format. It goes over the phone network, bills a second SignalWire leg, and carries no caller details.