vicigeeksimple guides
Browse
Telephony

Carriers & SIP · Twilio · choose your SIP driver

Twilio with VICIdial: PJSIP and chan_sip dialplans

Twilio carrier examples with separate PJSIP and chan_sip Account Entry and Dialplan Entry blocks, authentication choices, worked prefix conversion and read-only checks. No provider call is claimed.

Start the guide

01 / 13

Choose one driver, one carrier and one number format

This Twilio guide separates the carrier Account Entry from the Dialplan Entry and shows PJSIP and chan_sip alternatives. PJSIP is the current Asterisk driver. Use chan_sip only when your installed older build actually loads it; upstream Asterisk removed it in version 21.

These are outbound configuration worksheets, not captured working Twilio trunks. No provider login, registration or call was performed for this update. The existing native screenshot identifies VICIdial fields; it does not establish provider acceptance.

Twilio example contract: check these before copyingScroll sideways to compare columns
ItemThis guide usesWhy it matters
AuthenticationCredential List digest; optional additional source-IP ACL; no REGISTER.Use the connection type actually configured on your account.
Dial prefix9 — an isolated NANP routeFor Twilio, confirm this prefix is unused in the target dialplan context.
Fictional input912025550123Remove only the leading 9; the remaining 1 is the country code.
Provider destination+12025550123A formatting illustration only; never dial the fictional example.
Branch choicePJSIP OR SIP (chan_sip)Keep one Twilio branch active; do not paste both definitions for the same route.

02 / 13

1. Check which SIP driver your server actually has

On the Twilio target server, run these read-only CLI checks before changing carrier records. A module name in this list establishes installation/loading only; it does not establish registration, NAT or audio.

Before you use it
Use an authorized shell on the actual Twilio dialer. These commands inspect the running Asterisk instance and make no call.
Read-only driver inventory
sudo asterisk -rx 'core show version'sudo asterisk -rx 'module show like chan_pjsip.so'sudo asterisk -rx 'module show like chan_sip.so'
Reader-run example · not executed for this guide

This example has no recorded result here. Follow its preparation, expected result and stop conditions before using it.

Success looks like
For Twilio, choose PJSIP when chan_pjsip is loaded. Choose the SIP branch only when chan_sip is loaded on your supported installed build.
Stop if
If the Twilio target has neither driver, stop. Do not compile a retired module or move listening ports to make this worksheet fit.
Sources for this section

03 / 13

2. Prepare the Twilio account settings

  1. In Twilio Console, open Elastic SIP Trunking → Trunks and choose the isolated trunk. Copy its Termination SIP URI exactly; a friendly trunk name is insufficient.
  2. Attach your Credential List and/or public-source IP ACL under Termination. This worksheet uses digest credentials; if an ACL is also attached, the call must satisfy both checks.
  3. Choose an allowed Twilio or verified caller ID. Keep the Registration String empty: Elastic SIP Trunking does not use SIP REGISTER.

You should seeYou have the Twilio host, selected authentication path, allowed caller ID and agreed destination format. A dashboard-ready label alone is insufficient.

Sources for this section

04 / 13

3. Put each value in the correct VICIdial field

For Twilio, use Admin → Carriers → Add A New Carrier and select an unused ID. Select the actual dialer under Server IP. PJSIP requires an installed VICIdial build with PJSIP enabled; the SIP protocol corresponds to chan_sip.

Keep Account Entry and Dialplan Entry separate. On the captured Add form there is no Active control; after an approved save, reopen Modify Carrier and check Active before permitting Twilio test traffic. Do not overwrite the original carrier.

Carrier ID
vg_twilioUse a new, unused ID for the isolated Twilio configuration.
Protocol
PJSIP for branch A; SIP for branch B
Account Entry
Driver configuration onlyPaste the selected Twilio account block after substituting its placeholders.
Dialplan Entry
The three matching exten lines onlyUse the Twilio dialplan for the SAME selected driver.
Registration String
Empty for this no-registration trunkTwilio authentication in this example occurs without SIP REGISTER.
Campaign Dial Prefix / Manual Dial Prefix
9Review both values and the Phone Code/Phone Number combination; Omit Phone Code changes the digits Twilio receives.

Locate the two carrier configuration fields

Open to enlarge
Actual unsaved VICIdial Add Carrier form showing Account Entry and Dialplan Entry, with a fictional PJSIP example.
Native VICIdial form captured November 4, 2026, Admin 2.14-969a build 261102-0125.
Capture detailsIt contains an unsaved fictional IP-auth worksheet and an unselected Server IP. Use it to locate the fields only: its values are not a Twilio, Telnyx or Vonage configuration. No carrier, registration or call was created. The complete original capture remains available through Enlarge.

You should seeThe Twilio record names the right server and one driver; the campaign remains inactive while the generated route is reviewed.

Native carrier setup and saved-value checks

05 / 13

4A. PJSIP: Account Entry

For Twilio, replace <EXISTING_PJSIP_UDP_TRANSPORT> with the transport name from pjsip show transports; it is not a new transport definition. This narrow worksheet uses UDP and ulaw, not a TLS/SRTP setup. Match your actual network, codec and security requirements before activation.

The context vg-twilio-inbound-disabled is intentionally left undefined for this outbound-only exercise. Check it is absent and do not create an outbound-capable context under that name. It rejects incoming calls instead of silently routing them into an outbound dialplan.

This single-caller-ID worksheet fixes from_user in PJSIP and fromuser in chan_sip to one permitted number. For Twilio campaigns using changing list/lead caller IDs, review the effective From and identity-header behavior separately; the fixed example must not be assumed to preserve dynamic caller-ID selection.

Before you use it
Review this Twilio configuration worksheet, replace every angle-bracket placeholder and select only one channel-driver branch. It has not been loaded into Asterisk.
Twilio PJSIP Account Entry — branch A
[vg_twilio]type=aorcontact=sip:<TWILIO_TRUNK_NAME>.pstn.twilio.comqualify_frequency=60 [vg_twilio]type=endpointtransport=<EXISTING_PJSIP_UDP_TRANSPORT>aors=vg_twiliocontext=vg-twilio-inbound-disableddisallow=allallow=ulawdtmf_mode=rfc4733direct_media=nofrom_domain=<TWILIO_TRUNK_NAME>.pstn.twilio.comfrom_user=<APPROVED_TWILIO_CALLER_ID_E164>outbound_auth=vg_twilio_auth [vg_twilio_auth]type=authauth_type=userpassusername=<TWILIO_CREDENTIAL_LIST_USER>password=<TWILIO_CREDENTIAL_LIST_SECRET> 
Not executed · worksheet or reference text

This sample is a template or reading aid, not a terminal command. There is no output to show.

Success looks like
The Twilio field contents match the chosen driver, actual trunk host and agreed number format. This is a configuration check, not a completed call.
Stop if
Stop the Twilio setup if any placeholder remains, the transport does not exist, or the provider/account contract differs. Do not activate the campaign.
Sources for this section

06 / 13

4A. PJSIP: Dialplan Entry

Use this Twilio dialplan only with the PJSIP endpoint named vg_twilio. The number is before @ in the PJSIP dial string. Keep the VICIdial call_log AGI and campaign timeout; do not paste a raw Asterisk-only test route over the managed campaign route.

Before you use it
Review this Twilio configuration worksheet, replace every angle-bracket placeholder and select only one channel-driver branch. It has not been loaded into Asterisk.
Twilio PJSIP Dialplan Entry
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)exten => _91NXXNXXXXXX,n,Dial(PJSIP/+${EXTEN:1}@vg_twilio,${CAMPDTO},To)exten => _91NXXNXXXXXX,n,Hangup()
Not executed · worksheet or reference text

This sample is a template or reading aid, not a terminal command. There is no output to show.

Success looks like
The Twilio field contents match the chosen driver, actual trunk host and agreed number format. This is a configuration check, not a completed call.
Stop if
Stop the Twilio setup if any placeholder remains, the transport does not exist, or the provider/account contract differs. Do not activate the campaign.

You should seeFictional 912025550123 matches _91NXXNXXXXXX; the PJSIP Request-URI user becomes +12025550123. This arithmetic check does not send an INVITE.

07 / 13

4B. chan_sip: Account Entry

Choose this Twilio alternative only if the driver check found chan_sip. VICIdial Protocol is SIP, and the equivalent configuration belongs to the chan_sip generator, not pjsip.conf. Never paste type=endpoint, aors or outbound_auth into this branch.

Before you use it
Review this Twilio configuration worksheet, replace every angle-bracket placeholder and select only one channel-driver branch. It has not been loaded into Asterisk.
Twilio chan_sip Account Entry — branch B
[vg_twilio]type=peerhost=<TWILIO_TRUNK_NAME>.pstn.twilio.comtransport=udpcontext=vg-twilio-inbound-disableddisallow=allallow=ulawdtmfmode=rfc2833directmedia=noqualify=yesqualifyfreq=60fromdomain=<TWILIO_TRUNK_NAME>.pstn.twilio.comfromuser=<APPROVED_TWILIO_CALLER_ID_E164>defaultuser=<TWILIO_CREDENTIAL_LIST_USER>secret=<TWILIO_CREDENTIAL_LIST_SECRET> 
Not executed · worksheet or reference text

This sample is a template or reading aid, not a terminal command. There is no output to show.

Success looks like
The Twilio field contents match the chosen driver, actual trunk host and agreed number format. This is a configuration check, not a completed call.
Stop if
Stop the Twilio setup if any placeholder remains, the transport does not exist, or the provider/account contract differs. Do not activate the campaign.
Sources for this section

08 / 13

4B. chan_sip: Dialplan Entry

The Twilio chan_sip dial string puts the peer name immediately after SIP/ and the destination after the next slash. PJSIP/+${EXTEN:1}@vg_twilio and SIP/vg_twilio/+${EXTEN:1} are alternatives, not interchangeable spellings.

Before you use it
Review this Twilio configuration worksheet, replace every angle-bracket placeholder and select only one channel-driver branch. It has not been loaded into Asterisk.
Twilio chan_sip Dialplan Entry
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)exten => _91NXXNXXXXXX,n,Dial(SIP/vg_twilio/+${EXTEN:1},${CAMPDTO},To)exten => _91NXXNXXXXXX,n,Hangup()
Not executed · worksheet or reference text

This sample is a template or reading aid, not a terminal command. There is no output to show.

Success looks like
The Twilio field contents match the chosen driver, actual trunk host and agreed number format. This is a configuration check, not a completed call.
Stop if
Stop the Twilio setup if any placeholder remains, the transport does not exist, or the provider/account contract differs. Do not activate the campaign.

You should seeFor the same fictional 912025550123, the chan_sip destination is +12025550123. Only the channel syntax changes between the two Twilio branches.

09 / 13

5. Check saved values, then the loaded route

After an approved save and normal managed generation, reopen the Twilio carrier and compare its saved fields. On the selected server inspect the chosen driver only; a missing sip command on a PJSIP-only build is not a provider outage.

Use the actual campaign dialplan context shown by your installed VICIdial configuration. The illustrative 912025550123 is used for a read-only lookup, never a dial attempt. A loaded route may still have unresolved placeholders; inspect the full Dial line.

Before you use it
Review this Twilio configuration worksheet, replace every angle-bracket placeholder and select only one channel-driver branch. It has not been loaded into Asterisk.
Read-only Twilio endpoint and dialplan checks
# Run only the branch selected for Twilio.# PJSIP branch:sudo asterisk -rx 'pjsip show endpoint vg_twilio'sudo asterisk -rx 'pjsip show aor vg_twilio'# chan_sip branch instead:sudo asterisk -rx 'sip show peer vg_twilio'# Both branches: replace the context with the actual generated campaign context.sudo asterisk -rx 'dialplan show 912025550123@<ACTUAL_CAMPAIGN_CONTEXT>'sudo asterisk -rx 'dialplan show vg-twilio-inbound-disabled'
Reader-run example · not executed for this guide

This example has no recorded result here. Follow its preparation, expected result and stop conditions before using it.

Success looks like
The selected Twilio object has the expected host, transport and caller ID. The campaign lookup has exactly the chosen prefix and channel syntax. The vg-twilio-inbound-disabled lookup reports that no such context exists.
Stop if
For Twilio, stop on duplicate extensions, unknown context, missing endpoint, stale saved values or any angle-bracket placeholder. An OPTIONS result cannot establish a PSTN call.

You should seeThe Twilio configuration is loaded as intended. Only a later, separately approved call can establish signaling and media.

10 / 13

Incoming calls need their own routing

The Twilio blocks above deliberately reject inbound calls. Do not remove that boundary until you have the current provider signaling ranges, restricted inbound matching, reviewed trunkinbound context and a specific DID route. Incoming provider IPs are not necessarily the IP your outbound hostname currently resolves to.

  1. For Twilio, save a reviewed Origination URI for the actual public PBX address, listening port and transport, then associate the intended owned number with this trunk.
  2. After the Twilio inbound source matching and network rules have been reviewed, configure a real inbound context and the exact delivered DID in VICIdial. Verify the intended in-group or destination independently.

You should seeAn outgoing Twilio call pass does not establish incoming delivery. An inbound setting screenshot does not establish agent audio.

Route one inbound DID to the intended agent destination

11 / 13

6. Test one approved destination and record the result

Keep Twilio traffic isolated. Have a bounded test window, owned/consenting destination and recorded caller ID before enabling the new carrier and campaign. Do not dial the fictional 555 example or run a bulk campaign as a test.

  1. Place one approved Twilio call through the actual VICIdial agent workflow so the campaign prefix, caller ID and call logging are included.
  2. Record the constructed digits, sent Request-URI user, selected Twilio peer/endpoint, final SIP result and provider call identifier privately.
  3. Check ringing/answer, two-way audio, DTMF, hangup from each side and the VICIdial report row separately. Mark each Twilio observation pass, fail or not tested.
  4. For Twilio, pause/log out the test agent and disable the test route when the approved window ends; preserve the exact observed outcome rather than inferring it from a saved form.

12 / 13

If it fails, follow the first broken boundary

Twilio failure → next concrete checkScroll sideways to compare columns
ObservationCheck nextDo not infer
No matching routeCompare prefix 9, Phone Code, Omit Phone Code and the exact dialplan context.Do not loosen the pattern to _X. to make it match.
Endpoint/peer missingInspect the selected Twilio Protocol, server and generated driver configuration.A saved web form is not loaded Asterisk state.
401/407 repeatsFor Twilio, check the selected authentication mode and SIP auth user; the first digest challenge can be normal.Do not publish authorization headers or retry endlessly.
403 / provider rejectionInspect this Twilio account’s source-IP/ACL, destination permission and effective caller ID.Do not rotate passwords before reading the actual rejection.
Answered but one-way audioCompare Twilio SDP, NAT path, actual media ranges and codecs in an authorized bounded capture.A 200 OK or OPTIONS response is not an audio-quality pass.

13 / 13

Rollback and continue

For Twilio, pause test traffic, restore the previous campaign Dial Prefix and Manual Dial Prefix, and disable only the new carrier in its Modify screen. Restore the recorded fields and use the installation’s normal configuration generation procedure.

Confirm the previous route is loaded again. Leave unrelated Twilio trunks and other providers unchanged. Rotate only an exposed secret, and record which provider and PBX settings were restored.

Twilio: both driver examples

Telnyx: IP-authenticated driver examples

Vonage: current trunk and driver boundaries

Check the actual PJSIP implementation first

Checks and sources

What was checked

  • Twilio primary documentation and Asterisk/VICIdial syntax were source-reviewed on November 8, 2026. The NANP prefix transformation was checked offline; no provider authentication, registration or call was performed.
  • The PJSIP and chan_sip Twilio Account Entry and Dialplan Entry blocks are configuration worksheets. Native field media is a historical unsaved reference, not this provider’s console or a saved working trunk.
  • For Twilio, registration state, outbound signaling, incoming routing, two-way audio, DTMF, hangup and report evidence remain separate acceptance checks.

Primary references

Sources

  1. Twilio Elastic SIP Trunking setupTwilio · accessed November 8, 2026
  2. Twilio Asterisk interconnection guide (2018 PJSIP reference)Twilio · accessed November 8, 2026
  3. Sending SIP to Twilio: termination hostnameTwilio · accessed November 8, 2026
  4. Twilio network rangesTwilio · accessed November 8, 2026
  5. Twilio trunk verificationTwilio · accessed November 8, 2026
  6. Asterisk: chan_sip lifecycle and PJSIPAsterisk · accessed November 8, 2026
  7. Asterisk PJSIP outbound trunk configurationAsterisk · accessed November 8, 2026
  8. VICIdial PJSIP carrier fields and dial stringVICIdial · accessed November 8, 2026