How to connect Twilio to VICIdial
Connect a Twilio Elastic SIP Trunk to VICIdial: grab the SIP domain, whitelist your server IP, then add a SIP carrier and dialplan.
To connect Twilio to VICIdial you create a Twilio Elastic SIP Trunk, point its origination at your VICIdial server's public IP, then add a matching SIP (Session Initiation Protocol) carrier entry in VICIdial admin with a dialplan that strips the country code Twilio expects. Twilio is a credential-or-IP trunk, so a static-IP box makes the setup short.
Get the trunk from Twilio
In the Twilio console, open Elastic SIP Trunking and create a trunk. Twilio gives you a Termination SIP URI (the host you dial out to) and an Origination URI list (where Twilio sends inbound calls). For authentication Twilio supports two models: a Credential List (username/secret) or an IP Access Control List that whitelists your server. With a DID (direct inward dialing) purchased on Twilio, assign it to the trunk so inbound calls flow back.
- Copy the Termination SIP URI (the *.pstn.twilio.com host) from your trunk page.
- Add your VICIdial server's public IP to the trunk's IP Access Control List so Twilio trusts it.
- Set Origination to sip:<your-server-ip>:5060 so inbound calls reach your box.
Add the carrier in VICIdial
Go to Admin then Carriers then Add New Carrier. Because Twilio can authenticate your box by IP, you can skip the register line entirely and pin the peer by host. If you prefer credentials, fill the Registration string with your Twilio Credential List username and secret instead.
Account Entry (the peer block):
- [twilio] / disallow=all / allow=ulaw / type=friend / context=trunkinbound
- host=<your Termination SIP URI host> with dtmfmode=rfc2833
Set Protocol to SIP. The Dialplan Entry is the outbound pattern. Twilio expects E.164, so dial the full +1 number. With campaign Dial prefix 9 and a US number you strip the 9 and prepend +1:
- exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
- exten => _91NXXNXXXXXX,2,Dial(SIP/twilio/+${EXTEN:1},,tTor)
Set Server IP to the Asterisk box this trunk runs on (or 0.0.0.0 for all), set Active to Y, and save. The conf files regenerate within about a minute.
Route inbound DIDs
Outbound is only half the job. The context=trunkinbound line on the Account Entry is what lets Twilio's inbound calls reach agents: Twilio delivers a call for one of your numbers to the Origination URI you set (your server IP on 5060), trunkinbound passes it into VICIdial's DID (direct inward dialing) handling, and your DID entry routes it to an Ingroup, a call menu, or an IVR. Keep the disallow=all then allow=ulaw pinning so the Codec stays plain G.711 in both directions and Twilio never transcodes mid-call.
The call path
flowchart LR
A[Twilio Elastic SIP Trunk] -->|IP ACL| B[VICIdial Carrier Entry]
B --> C[Dialplan _91NXXNXXXXXX]
C -->|outbound| D[PSTN]
A -->|inbound DID| E[trunkinbound context]
E --> F[Ingroup Agents]Verify it
On the Asterisk CLI run sip show peers. If you used IP auth the peer shows reachable; if you registered it shows Registered. Then place one test call from the Campaign Detail screen and confirm two-way audio and that your caller ID arrives. For inbound, map the DID (direct inward dialing) to an Ingroup under Admin then Inbound then DIDs.
If the peer is unreachable, the usual cause is a missing IP entry on the Twilio side or the wrong host in the Account Entry. The full mechanism is covered in our VICIdial carrier integration guide, and if you are deciding between credentials and IP, read register vs IP authentication.
A VICIfast box ships with a static public IP, which is exactly what IP authentication wants, and provisions in under 40 seconds. See pricing and bring your Twilio trunk.
About VICIfast LLC
VICIfast LLC operates a managed VICIdial hosting + BYOI service for outbound and inbound call centers. We run the dialers, the carriers, the recordings pipeline, and the compliance plumbing so operators don’t have to.
Citing this article
VICIfast Engineering. “How to connect Twilio to VICIdial”. VICIfast LLC, June 24, 2026. Retrieved from https://vicifast.com/blog/connect-twilio-to-vicidial
Have questions?
Related posts
You might be interested in
VICIfast newsletter
Liked this? Get the next one in your inbox.
We ship the kind of stuff you just read — concrete, numbers-first, no drip. One email when a new post goes live. Unsubscribe in one click.
Comments
No comments yet — be the first.