Skip to main content
Twilio is the phone network behind your platform. It owns the actual phone numbers your customers buy, and it carries every call between a real caller and their AI agent. This is the longest chapter in the course, and the one with the most exacting configuration. Work through it in order, and don’t skip the settings that look optional, because most of them are what stop calls from failing in ways that are hard to diagnose later.
Have your government ID nearby. Part of this chapter verifies your identity, and you’ll need to photograph it with your phone.

Create your account

1

Sign up

Go to twilio.com and click Start For Free in the top right corner.
Twilio home page with the Start For Free button
Fill in your name, your professional Hostinger email and a password. The requirements are listed under the field and tick off one by one as you type. A CAPTCHA also runs on its own and shows a green Success! once it’s satisfied, with nothing for you to do.Check the box agreeing to Twilio’s legal terms. The Stay updated marketing checkbox below it is optional, so leave it unchecked if you’d rather not get their emails. Click Continue.
Twilio signup form with the password requirements met
2

Verify your email

Twilio sends a code to your mailbox. Go to mail.hostinger.com, open the email and copy the code.
Twilio verification email containing the code
Paste it into the Enter verification code field on Twilio, then click Continue to set up 2FA.
Twilio email verification code field
3

Set up two-factor authentication

Unlike Vercel, this one is mandatory: Twilio requires two-factor authentication on every account.Check that the country in the small dropdown is correct, enter your phone number and click Send code via SMS.
Twilio two-factor authentication setup with a phone number field
A code arrives by text message and an Enter verification code field appears on the same page. Type the code in and click Verify.
Twilio verification code field with the Verify button
4

Save your recovery code

Twilio shows a recovery code. This is what gets you back into your account if you ever lose access to your phone.Click the download button next to it and keep the file somewhere safe, alongside your other one-time credentials. Click Done.
Twilio recovery code page with the download button

Without this code, losing your phone means losing access to the account that owns your customers' phone numbers.

Upgrade to Pay As You Go

1

Choose the right plan

Twilio welcomes you by name and offers two plans, 30 days free trial and Pay as you go.The trial plan can only call a handful of verified numbers and gives you a single pre-assigned number, which would block both your own testing and your customers’ real calls. Pay As You Go has no monthly fee and charges only for what’s used, which fits a business where your customers pay you upfront.Select Pay as you go and click Continue.
Twilio plan selection with the Pay as you go card chosen
2

Enter your account and tax details

For User type, select Individual. This avoids questions about business entities, tax IDs and registration that don’t apply unless you’ve incorporated a company.Enter your legal first and last names, then your address. This is your tax address, so use your real permanent one. The field labels change with the country you pick, showing Province and Postal code for Canada, State and ZIP for the United States, and so on.Click Next.
Twilio account and tax details form with Individual selected
Twilio asks for real legal details because telecom regulators require every carrier to know who is sending calls through their network. It’s the same system that keeps spam and number spoofing in check, and it’s what makes your customers’ calls arrive normally instead of being silently flagged as suspected spam.
3

Set your balance and auto-recharge

For the starting balance, choose $20.Then check Enable auto-recharge and select the Low option in the dropdown, which tops you back up to $20 whenever your balance drops below $10. The exact numbers vary by country and currency, so pick the lowest tier offered.Auto-recharge matters because Twilio stops calls the instant your balance hits zero, even mid-conversation. Keeping it low means less of your money sits in Twilio, and less damage if something unexpected drains it.Click Next.
Twilio starting balance and auto-recharge settings

Low keeps your cash free while still preventing calls from cutting out.

4

Pay and finish

Enter your card number, expiration and security code, then click Upgrade.
Twilio payment details form showing the \$20 starting balance
An order summary appears. Check that auto-recharge says On, triggering below $10 and topping up to $20, then click Finish.
Twilio upgrade summary page
A final page confirms the upgrade and lists some free units Twilio adds on top of your balance. Click Start building.
Twilio upgrade complete page with the Start building button
You’ll land on the Twilio home page.
Twilio home page showing the account as active

Verify your identity

Your account is upgraded, but it still can’t own phone numbers. Twilio requires a compliance profile before any account can buy one, which means your app can’t provision numbers for your customers until this is done.
1

Open Trust Hub

Click the Products & Services icon in the far left icon bar, the second one under the home icon. In the panel that opens, click Trust Hub to expand it, then click Profiles.
Twilio Products and Services panel with Trust Hub expanded
2

Choose Individual Profile

Two profile types are offered. You want Individual Profile, which is meant for sole proprietors, and that’s what you are unless you’ve registered a company. The Business Profile asks for company documentation you won’t have yet, such as a registration number and tax ID.If you do have a registered company, you can choose the Business Profile instead. Everything in this course works either way.Click Get Started on the profile you’ve chosen.
Twilio compliance profile types with Individual Profile selected
3

Consent to verification

A page explains that Twilio verifies your identity against government databases. Click Next.
Twilio compliance profile get started page
The next page asks for your consent to be verified by Persona, Twilio’s verification partner, including the selfie you’ll take later. Twilio keeps that data for no more than three years and uses it only for verification. This is a standard part of telecom compliance, so click Next.
Twilio Persona verification consent page
4

Fill in your details

For Compliance profile friendly name, use anything you like. It’s only a label to find this profile later and has no effect on the type of profile being created.Enter your first and last name exactly as they appear on your government ID, since Twilio matches them against it. Your email and phone should already be filled in.For Business title and Job position, enter your real role. If you’re working alone, Founder or Owner as the title and CEO as the position are accurate. Don’t inflate them, this is a regulatory declaration tied to your ID.Click Next.
Twilio compliance profile personal details form
5

Enter your home address

Twilio asks where your home address is located. Choose your country in the Address country dropdown and click Next.
Twilio address country selection with a Next button
Fill in your home address on the next page. PO boxes aren’t accepted, so use a real street address. Click Next.
Twilio home address form with Back and Next buttons
6

Choose your ID

Twilio asks which country issued your government ID. Select it and click Next.
Twilio page asking which country issued your government ID
You’ll then see the documents Twilio accepts from that country. Click the one you actually have, such as a driver’s license or a passport.
Twilio list of accepted government ID types

The accepted documents change depending on the country you chose.

7

Move to your phone

Twilio now wants a photo of that document. Since you’re on a computer, click Continue on another device.
Twilio photo capture page with the Continue on another device option

Continue on another device is what moves this to your phone.

A QR code appears. Scan it with your phone’s camera, or click Send Email to get a secure link instead. Nothing needs installing on your phone.Then follow the instructions on your phone to photograph your ID and take a selfie. They adapt to the document you chose.
Twilio QR code to continue verification on a phone, with a Send Email option

Have your phone and your ID ready before starting this part.

8

Confirm approval

Once you finish on your phone, return to your computer. The page moves on by itself and should show that your primary compliance profile has been approved.Approval is usually immediate. If yours comes back pending, a person is reviewing it, and you can carry on with the rest of this chapter while you wait. You only need the approved profile once you start buying phone numbers.Click Next.
Twilio page confirming the compliance profile was approved

Create your SIP trunk

A SIP trunk is the connection between Twilio’s phone network and Retell’s AI. Without it, a call would reach your customer’s number and find nothing on the other end.
1

Open Elastic SIP Trunking

In the same Products & Services panel you used for Trust Hub, scroll down to Elastic SIP Trunking, click it to expand, then click Trunks.
Products and Services panel with Elastic SIP Trunking expanded showing Trunks
Click Create new SIP trunk.
Twilio Elastic SIP Trunking page with the create button
Give it a clear name, such as SIP-trunk-yourdomain, and click Create.
Twilio new SIP trunk naming dialog
2

Configure the general settings

You’ll land on the trunk’s General page. Four settings need changing, and each one prevents a specific failure:
  • Enable Call Transfer (SIP REFER), which lets an agent hand a caller over to a human
  • Set Caller ID for Transfer Target to Set caller ID as Transferee
  • Check Enable PSTN Transfer, so transfers can reach ordinary phone numbers rather than only internet ones
  • Enable Symmetric RTP, which keeps audio flowing when a network sits behind a firewall
Symmetric RTP is the one to be careful about. Without it you get calls that connect normally but have no sound, which is far harder to diagnose than a call that simply fails.
Click Save, then copy the Trunk SID shown just under the friendly name using the copy icon beside it.In Vercel, open your project’s Environment Variables, find TWILIO_TRUNK_SID, click the three dots, click Edit, paste it and click Save.Once that’s saved, come back to Twilio and click the Termination tab at the top of the trunk page, which is where the next section continues.
Twilio SIP trunk general settings with the four required options configured and the Termination tab marked as the next step

All four settings matter, and the Termination tab at the top is where you go once you've saved.

Configure termination and origination

These two pages control the two directions of a call: termination is calls going out through Twilio, origination is calls coming in and being handed to Retell.
1

Set your termination URI

In the Termination SIP URI field, type a unique subdomain using lowercase letters and numbers, ideally based on your domain, for example implai-trunk. You only type that part: the .pstn.twilio.com ending is fixed and already shown to the right of the field.This subdomain has to be unique across all of Twilio, so if it says the name is taken, add a few characters until it’s accepted.In Vercel, find TWILIO_SIP_TRUNK_URI and enter the full address this time, meaning your subdomain plus the .pstn.twilio.com ending, then come back to Twilio.
2

Restrict who can use your trunk

Still on the Termination page, scroll down to the Authentication section and click the + next to IP Access Control Lists.This is what stops anyone else from placing calls through your trunk at your expense. Only Retell’s servers should be allowed.
Twilio termination page with the SIP URI accepted and the plus button beside IP Access Control Lists

The URI shows as available at the top, and the + you need is in the Authentication section below.

A dialog opens. Give the list a name such as default ACL, then enter Retell’s address in two parts, since the form splits it:Click Create ACL.
Twilio new access control list dialog with the CIDR address and prefix

The address and its prefix go in separate fields.

Your list now appears under IP Access Control Lists. Leave Credential Lists empty, since you’re authenticating by address instead. Click Save, then open the Origination tab.
Twilio termination page with the access control list attached
3

Point incoming calls at Retell

On the Origination tab, click the + button to add an origination URL.
Twilio origination page with the button to add an origination URL
Fill the dialog that opens with these values:
Make sure Enabled is turned on. If it isn’t, Twilio simply won’t pass incoming calls to Retell, and your customers’ agents will never answer.
Click Add, then click Save back on the Origination page.
Twilio add origination URL dialog with the Retell address and enabled toggle

Create the out-of-minutes message

When a customer runs out of minutes, callers need to hear something rather than silence. This is that message.
1

Open TwiML Bins

In the far left icon bar, click the Develop icon, the one that looks like </>. In the panel that opens, click TwiML bins.
Twilio Develop panel with the TwiML bins option
Click Create new TwiML Bin.
Twilio TwiML Bins page with the create button
2

Add the message

Name it something recognisable such as Out-of-minutes-message.In the body, put your cursor at the end of the first line, press Enter, and paste this on the second line:
Twilio confirms underneath with Valid Voice TwiML. Click Create.
Twilio TwiML Bin editor with the message pasted and validated
3

Save its address

A URL appears at the top of the page. Copy it with the icon beside it, then in Vercel find TWILIO_OUT_OF_MINUTES_TWIML_URL, paste it and save.Once that’s done, look at the very bottom of the Twilio page for a small tab with an upward arrow. That’s where the last section picks up.
TwiML Bin page showing its URL with the copy icon and the panel tab at the bottom of the page

The tab at the bottom of the page is where your account credentials live.

Connect it to your app

1

Open your credentials

Click that tab to expand the Workbench panel. Its API credentials section holds the last two values your app needs, each with a copy icon beside it:
  • Account SID goes into TWILIO_ACCOUNT_SID in Vercel
  • Auth Token goes into TWILIO_AUTH_TOKEN
Twilio Workbench panel showing the Account SID and Auth Token with their matching environment variables

The Auth Token stays hidden until you reveal it, and it should stay that way.

2

Copy both into Vercel

Copy the Account SID, paste it into TWILIO_ACCOUNT_SID in Vercel and save. Then copy the Auth Token, paste it into TWILIO_AUTH_TOKEN and save.
The Auth Token can place calls and buy numbers on your account. Keep it in Vercel and nowhere else.
Back in Twilio, close the panel using the arrow at its top right.

What’s next

Your phone system is fully configured: calls can come in, reach your customers’ agents, transfer to humans, and fall back to a message when minutes run out. One provider left, Stripe, which is how you actually get paid.