Set up SIP trunk
This guide walks you through configuring an Elastic SIP Trunk to work with Agent Studio for both inbound calls (customers call your AI agent) and outbound calls (your AI agent calls customers).
Prerequisites
Before you begin, ensure that you have:
- An active Twilio account
- A phone number that supports SIP Trunking
Understand the setup
Agent Studio supports both inbound and outbound calls through Twilio Elastic SIP Trunk, but each direction requires different configuration in both Twilio and Studio. The table below summarizes the key differences.
| Inbound | Outbound | |
|---|---|---|
| Use case | Customer support hotline, IVR replacement, appointment booking | Outbound campaigns, appointment reminders, follow-up calls |
| Call direction | External caller dials your Twilio number → Twilio routes to Agora → AI Agent answers | Agora initiates call via Twilio → Twilio connects to external number → AI Agent speaks |
| Twilio config | Origination URI (Twilio sends calls to Agora) | Termination URI + IP ACL (Agora sends calls to Twilio) |
| Studio Config | Import number → assign to Inbound agent | Import number → use in Campaign or Outbound agent |
Basic setup
-
Verify your Twilio phone number
To confirm your phone number is ready for SIP trunk configuration:
- Log in to Twilio Console.
- Navigate to Phone Numbers → Manage → Active Numbers.
- Check that the number you want to use is active and supports SIP Trunking.
- If you do not have a number, click Buy a number and select a number from the list.
-
Create or select an Elastic SIP Trunk
To set up a trunk that handles inbound and outbound calls:
-
Go to Elastic SIP Trunking → Manage → Trunks in Twilio Console.
-
Click Create a new SIP Trunk (or select an existing one).
-
Give it a descriptive name. For example, “Agora Studio – Production”

infoYou can use the same trunk for both inbound and outbound calling or create separate trunks for easier management. Agora recommends using separate trunks if you have different security requirements for inbound and outbound.
-
-
Assign the phone number to the Elastic SIP Trunk
To link your phone number with the SIP trunk:
- Go to Phone Numbers → Manage → Active Numbers.
- Select the phone number.
- Under Voice Calling settings, set the number to use your Elastic SIP Trunk.
- Save changes.
-
Check secure trunking setting
To determine which transport protocol to use in Agent Studio:
- Open SIP Trunk → General Settings.
- Locate Secure Trunking.
- Check whether it is enabled or disabled:
- Enabled: Choose TLS when in Agent Studio configuration.
- Disabled: Choose TCP or UDP in Agent Studio configuration.
- Save any changes.

The transport setting in Agent Studio must match Twilio’s Secure Trunking setting. A mismatch causes calls to fail silently.
Outbound calling setup
-
Configure the Termination URI
To set up the domain that Agora will use to reach your Twilio trunk:
-
In your SIP Trunk, go to Termination.
-
Set a custom Termination SIP URI. For example:
yourcompany.pstn.twilio.com. -
This domain is required later in Agent Studio as the SIP Domain.

-
-
Create an IP Access Control List (Whitelist)
Without correct IP whitelisting, Twilio blocks Agora traffic. To allow Agora's traffic through Twilio create an Access Control List (ACL):
-
Go to Elastic SIP Trunking → Manage → IP Access Control Lists.
-
Click + Create new Access Control List.
-
Give your ACL a descriptive name.
-
Add the following Agora SIP outgoing IPs to the ACL:
-
Save the Access Control List.


-
-
Add IP Access Control List
-
In your SIP Trunk, go to Termination → Authentication
-
Under IP Access Control Lists, select the authentication list you just created. If you do not see the list you created, access the list by clicking View all Authentication lists.
-
Click Save.


-
-
Credential Lists (Optional)
You can create username and password authentication if required.
- If you do not specify a credential list, it allows you to leave the username and password blank in Agent Studio.
- If you configure a credential list you must specify the same username and password in Agent Studio.
To set up a credential list:
- Under Authentication, find Credential Lists.
- Use the
+button to create a new list. - Give your list a descriptive name.
- Specify a username and password.
- Click Save.
-
Import the number in Agent Studio
Once your Twilio trunk is configured, import the number into Studio. See Import a phone number for step-by-step instructions. Use your Termination URI as the SIP Domain and match the Transport protocol to your Secure Trunking setting.
Inbound calling setup
-
Configure Origination URI
- In your SIP Trunk, go to Origination
- Click Add new Origination URI
- Enter the Agora SIP Origination URI:
sip:your-agora-sip-domain - The exact Origination URI is provided by Agora when you import your number in Agent Studio. Copy it from the Studio UI after importing.
- Set Priority to
10and Weight to10(default). - Click Add.
-
Configure number routing
- Go to Phone Numbers → Manage → Active numbers
- Select the number you want to use for inbound calling.
- Under Voice Configuration → Configure with, select SIP Trunk
- Choose the trunk you created in Basic setup.
- Click Save configuration.
-
Import the number in Agent Studio
Once Twilio origination and routing is configured, import the number in Agent Studio and associate it with an agent to answer inbound calls. See Handle inbound calls for step-by-step instructions.
Configuration checklist
Before testing inbound and outbound calls, make sure you address each item in the checklist:
| Item | Inbound | Outbound |
|---|---|---|
| Assign phone number to SIP Trunk | ✅ Required | ✅ Required |
| Configure Origination URI | ✅ Required | ❌ Not needed |
| Configure Termination URI | ❌ Not needed | ✅ Required |
| IP Access Control List | ❌ Not needed | ✅ Required |
| Credential List | ❌ Not needed | ⚠️ Optional |
| Secure trunking setting matches transport in Studio | ✅ Required | ✅ Required |
| Import number in Studio | ✅ Required | ✅ Required |
| Assign number in studio | ✅ Assign to an agent | ✅ Assign to a campaign |
Troubleshooting
If you encounter issues with your Twilio SIP trunk setup, use the following table to identify and resolve common problems.
| Symptom | Cause | Solution |
|---|---|---|
| Inbound calls don't reach agent | Origination URI not set or incorrect | Verify the Origination URI in Twilio matches what Studio shows |
| Outbound calls rejected by Twilio | IP ACL missing or incomplete | Add all Agora SIP IPs to the Twilio IP Access Control List |
| Calls connect but no audio | Transport mismatch (TLS vs TCP/UDP) | Match the Secure Trunking setting in Twilio with the Transport setting in Studio |
| One-way audio | Firewall or NAT issue | Ensure Agora SIP IPs are whitelisted on both sides |
| "403 Forbidden" in Twilio logs | Authentication failed | Check Credential List or IP ACL configuration |
| Call drops after ~30 seconds | SIP session timer timeout | Check SIP Trunk timeout settings in Twilio |
Next steps
- Import a phone number: Import your configured Twilio number into Studio
- Set up a campaign: Use your imported number to create an outbound calling campaign
- Handle inbound calls: Associate a number with an agent to answer inbound calls
- Publish your agent: Publish an agent to use with your imported number