@@ -66,7 +66,12 @@ This guide walks you through setting up both outbound and inbound SIP trunking b
6666
67672 . ** Create a SIP Trunk Credential**
6868
69- Use the following API call to create a SIP trunk credential, replacing the gateway IP with your Twilio Termination SIP URI:
69+ Use the following API call to create a SIP trunk credential. Configure the
70+ Twilio termination hostname as an outbound-only gateway. Configure Twilio's
71+ published signaling networks as separate inbound-only gateways.
72+
73+ The example below uses a Dublin termination hostname with Twilio's Ireland
74+ and Frankfurt signaling networks:
7075
7176 ``` bash
7277 curl -X POST https://api.vapi.ai/credential \
@@ -77,13 +82,48 @@ This guide walks you through setting up both outbound and inbound SIP trunking b
7782 "name": "Twilio Trunk",
7883 "gateways": [
7984 {
80- "ip": "YOUR_TWILIO_GATEWAY_ID",
81- "inboundEnabled": false
85+ "ip": "YOUR_TRUNK_NAME.pstn.dublin.twilio.com",
86+ "port": 5060,
87+ "inboundEnabled": false,
88+ "outboundEnabled": true
89+ },
90+ {
91+ "ip": "54.171.127.192",
92+ "netmask": 30,
93+ "port": 5060,
94+ "inboundEnabled": true,
95+ "outboundEnabled": false
96+ },
97+ {
98+ "ip": "35.156.191.128",
99+ "netmask": 30,
100+ "port": 5060,
101+ "inboundEnabled": true,
102+ "outboundEnabled": false
82103 }
83104 ],
84105 "outboundLeadingPlusEnabled": true
85106 }'
86107 ```
108+
109+ <Warning >
110+ Replace the example hostname and networks with the values for your Twilio
111+ trunk's selected edges. Add every primary and failover signaling network
112+ that can originate calls. Use Twilio's current [ Elastic SIP Trunking IP
113+ address list] ( https://www.twilio.com/docs/sip-trunking/ip-addresses ) as the
114+ source of truth.
115+ </Warning >
116+
117+ A termination hostname can be used for outbound routing because Vapi
118+ resolves it when placing a call. It cannot identify inbound traffic: Vapi
119+ must match the source of an incoming SIP request against a numeric IPv4
120+ network. The ` netmask ` value represents the CIDR prefix, so a ` /30 ` network
121+ is configured as ` "netmask": 30 ` .
122+
123+ If you are adding inbound gateways to an existing credential, send a
124+ ` PATCH /credential/YOUR_CREDENTIAL_ID ` request with the complete ` gateways `
125+ array, including the existing outbound gateway and the new inbound
126+ networks.
87127
88128 Note the ` id ` (credentialId) from the response for the next step.
89129
@@ -158,3 +198,10 @@ This guide walks you through setting up both outbound and inbound SIP trunking b
158198 - In the assistant settings, link it to the phone number you created
159199
160200 Now when someone calls your Twilio number, the call will be routed to your Vapi assistant.
201+
202+ <Note >
203+ If inbound calls do not reach Vapi, verify that the credential includes the
204+ numeric Twilio signaling networks for every origination edge you configured.
205+ Adding only the Twilio termination hostname enables outbound routing but does
206+ not allowlist inbound SIP traffic.
207+ </Note >
0 commit comments