Client Nexus
12/17/2025, 4:25 PMAI Evy
12/17/2025, 4:25 PMAI Evy
12/17/2025, 4:25 PMinbound_allowed_countries to specify which countries can call your number using ISO 3166-1 alpha-2 country codes. [(3) ]() For example:
json
["US", "CA", "GB", "BR", "PT", "FR"]
Similarly, for outbound, you can set outbound_allowed_countries to control which countries your agent can dial.
Recommended Setup:
1. Set up a SIP trunk with a provider like Twilio that supports international numbers [(4) ]()
2. Import the number to Retell with the termination URI [(3) ]()
3. Configure geographic permissions in your telephony provider for the countries you need [(2) ]()AI Evy
12/17/2025, 4:25 PMAI Evy
12/17/2025, 4:25 PMClient Nexus
12/17/2025, 4:27 PMAI Evy
12/17/2025, 4:27 PMAI Evy
12/17/2025, 4:27 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
[(2) ]()
The Create Phone Number endpoint accepts parameters like area_code, inbound_agent_id, outbound_agent_id, and country settings.
[(1) ]()
For Twilio SIP Trunk Numbers:
If you need international numbers via Twilio, you'd:
1. Purchase the number via Twilio's API
2. Configure your SIP trunk in Twilio
3. Use Retell's Import Phone Number API to register it with Retell (not in the provided sources, but referenced in the thread)
Workflow Automation Platforms:
Retell AI partners with Make.com and n8n for building automated workflows without extensive coding. These integrations help connect Retell AI with CRMs and other business tools.
[(3) ]()
Check out these potentially useful sources for the Import Phone Number API: [Import Phone Number]()
Would you like a general answer on structuring this automation flow?AI Evy
12/17/2025, 4:27 PMAI Evy
12/17/2025, 4:27 PMClient Nexus
12/17/2025, 4:31 PMAI Evy
12/17/2025, 4:31 PMAI Evy
12/17/2025, 4:31 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.import({
phone_number: '+14157774444',
termination_uri: 'someuri.pstn.twilio.com',
}) ;
console.log(phoneNumberResponse.inbound_agent_id) ;AI Evy
12/17/2025, 4:31 PMphone_number - E.164 format (required)
- termination_uri - Your Twilio SIP trunk termination URI (required)
- sip_trunk_auth_username / sip_trunk_auth_password - If using credential auth
- inbound_agent_id / outbound_agent_id - Bind agents automatically
- inbound_allowed_countries / outbound_allowed_countries - Set geographic permissions
What Retell cannot automate:
- Purchasing numbers from Twilio
- Setting up the Twilio Elastic SIP Trunk configuration (termination/origination URIs, credentials, geographic permissions) [(1) ]()
So your app handles Twilio setup, then calls Retell's Import API to register the number—this can all happen programmatically without manual dashboard work. , [(2) ]()AI Evy
12/17/2025, 4:31 PMAI Evy
12/17/2025, 4:31 PMClient Nexus
12/17/2025, 5:06 PMAI Evy
12/17/2025, 5:06 PMAI Evy
12/17/2025, 5:06 PMsip:sip.retellai.com [(1) ]()
Transport options:
- TCP (Recommended) : sip:sip.retellai.com;transport=tcp
- UDP: sip:sip.retellai.com;transport=udp
- TLS: sip:sip.retellai.com;transport=tls
*2. IP Whitelist (if needed) *
IP block for traffic: 18.98.16.120/30 (All regions) , 143.223.88.0/21 (United States only) , 161.115.160.0/19 (United States only)
3. Authentication Credentials
Retell does not provide credentials to you—**you create them in Twilio**. When importing the number to Retell, you supply your Twilio credentials: [(2) ]()
- sip_trunk_auth_username
- sip_trunk_auth_password
4. Twilio SIP Domain/Trunk Setup
Yes, you need to create an Elastic SIP Trunk in Twilio with: [(3) ]() , [(4) ]()
- Termination (for outbound) : Create your termination URI and credentials in Twilio—you'll provide this URI to Retell when importing
- Origination (for inbound) : Set Retell's SIP URI (sip.retellai.com) as the origination URI
- **Numbers**: Add your purchased numbers to the trunk
5. Import to Retell
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.import({
phone_number: '+14157774444',
termination_uri: 'someuri.pstn.twilio.com',
}) ;
console.log(phoneNumberResponse.inbound_agent_id) ;
[(2) ]()
For Twilio, the termination URI typically ends with .pstn.twilio.com.AI Evy
12/17/2025, 5:06 PMAI Evy
12/17/2025, 5:06 PMClient Nexus
12/17/2025, 5:06 PMAI Evy
12/17/2025, 5:06 PMAI Evy
12/17/2025, 5:07 PMPOST /import-phone-number [(1) ]()
Required Parameters:
- phone_number (string, required) - E.164 format (+country code, then number with no space, no special characters)
- termination_uri (string, required) - Your elastic SIP trunk termination URI. For Twilio, it always ends with .pstn.twilio.com
Optional Parameters:
- sip_trunk_auth_username - Username for SIP trunk authentication
- sip_trunk_auth_password - Password for SIP trunk authentication
- inbound_agent_id - Agent ID for inbound calls
- outbound_agent_id - Agent ID for outbound calls
- inbound_agent_version / outbound_agent_version - Specific agent versions
- inbound_allowed_countries / outbound_allowed_countries - ISO 3166-1 alpha-2 country codes
- inbound_webhook_url - Webhook for inbound call overrides
- nickname - For your reference
- transport - "TLS", "TCP", or "UDP" (default: "TCP")
Code Example:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.import({
phone_number: '+14157774444',
termination_uri: 'someuri.pstn.twilio.com',
}) ;
console.log(phoneNumberResponse.inbound_agent_id) ;
Authorization:
Header format: Bearer YOUR_API_KEY
Workspace ID:
The workspace ID is found in your workspace settings page. [(2) ]() The API key itself is tied to a specific workspace, so when you use an API key, the number is imported to that workspace. [(1) ]() For per-agency workspaces, each agency would need their own workspace with their own API key.AI Evy
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:07 PMClient Nexus
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:07 PMrecording_url - Standard recording
- recording_multi_channel_url - Multi-channel recording (each party's audio in separate channels)
- scrubbed_recording_url - Recording with PII removed
- scrubbed_recording_multi_channel_url - Multi-channel with PII removed
You do not need Twilio to handle recordings. The documentation states that once a number is imported, "you can make and receive calls with this number just like a number you purchased from Retell." [(1) ]()
Additional recording controls available:
You can configure data_storage_setting to control what gets stored, and opt_in_signed_url for secure URL access. [(2) ]()AI Evy
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:07 PMClient Nexus
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:07 PMAI Evy
12/17/2025, 5:08 PMcall_started | Triggered when a new call begins | Basic call information |
| call_ended | Triggered when a call completes, transfers, or encounters an error | All fields from the call object except call_analysis |
| call_analyzed | Triggered when call analysis is complete | Full call data including call_analysis object |
Sample webhook payload structure:
json
{
"event": "call_ended",
"call": {
"call_type": "phone_call",
"from_number": "+12137771234",
"to_number": "+12137771235",
"direction": "inbound",
"call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
"agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
"call_status": "registered",
"metadata": {},
"retell_llm_dynamic_variables": {
"customer_name": "John Doe"
},
"start_timestamp": 1714608475945,
"end_timestamp": 1714608491736,
"disconnection_reason": "user_hangup",
"transcript": "...",
"transcript_object": [ [Object], [Object], [Object], [Object] ],
"transcript_with_tool_calls": [ [Object], [Object], [Object], [Object] ],
"opt_out_sensitive_data_storage": false
}
}AI Evy
12/17/2025, 5:08 PMcall_analyzed event includes additional fields like call_analysis with user sentiment and custom analyzed data. [(2) ]()
One note for dial-to-SIP: If using dial-to-SIP, the from_number field may show "user" instead of the actual caller number—this is a limitation where Retell doesn't control the format from the SIP provider. You can work around this by adding the from number as a variable when registering the call. [(4) ]()AI Evy
12/17/2025, 5:08 PMAI Evy
12/17/2025, 5:08 PMClient Nexus
12/17/2025, 5:47 PMAI Evy
12/17/2025, 5:47 PMAI Evy
12/17/2025, 5:48 PM.pstn.twilio.com. [(2) ]()
You might want to use a localized termination URI that's near your region—you can expand and view your localized URIs in the Twilio console. [(1) ]()
Example format from the API:
javascript
termination_uri: 'someuri.pstn.twilio.com'
[(2) ]()
3. Special configuration in Retell for inbound calls on imported numbers?
No special Retell configuration is needed beyond the import itself. The key setup happens in Twilio—you must configure origination in your SIP trunk to point to Retell's SIP server. [(1) ]()
4. Correct origination URI for Twilio SIP trunks:
Yes, for TCP transport, use: sip:sip.retellai.com;transport=tcp [(3) ]()
The base Retell SIP server address is sip:sip.retellai.com. [(1) ]()
Transport options: [(3) ]()
- TCP (Recommended) : sip:sip.retellai.com;transport=tcp
- UDP: sip:sip.retellai.com;transport=udp
- TLS: sip:sip.retellai.com;transport=tlsAI Evy
12/17/2025, 5:48 PMAI Evy
12/17/2025, 5:48 PMClient Nexus
12/17/2025, 7:40 PMAI Evy
12/17/2025, 7:40 PMAI Evy
12/17/2025, 7:40 PMAI Evy
12/17/2025, 7:40 PMAI Evy
12/17/2025, 7:40 PM