Client Nexus
12/25/2025, 7:10 PMAI Evy
12/25/2025, 7:10 PMAI Evy
12/25/2025, 7:11 PMsip:sip.retellai.com
## Step 2: Move Numbers to Elastic SIP Trunking
Purchase numbers or move existing numbers to this trunk in Twilio.
## Step 3: Import Numbers to Retell
Import the number to Retell so it knows how to route calls.
- Supply the termination SIP URI from Step 1
- If you set up auth via credentials, supply the username and password
- You can also import programmatically via the [Import Number API]() [(2) ]()
## Common Issues [(1) ]()
Outbound not working?
- Check your Termination SIP URI for spaces and remove them
- Use a localized termination URI near your region
- Verify username and credentials are correct (username is different from the friendly name in the credential list)
International dialing?
- Search "geo" to find "Voice Geographic Permissions" setting, choose "Elastic Sip Trunking", and select the countries you want to dialAI Evy
12/25/2025, 7:11 PMAI Evy
12/25/2025, 7:11 PMClient Nexus
12/25/2025, 7:12 PMAI Evy
12/25/2025, 7:12 PMAI Evy
12/25/2025, 7:12 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponses = await client.phoneNumber.list() ;
console.log(phoneNumberResponses) ;
This will return all phone numbers in your workspace, including their phone_number, inbound_agent_id, outbound_agent_id, and other configuration details.
**Regarding `telephony_provider_permission_denied`**: This disconnection reason indicates the telephony provider denied permission for the call. [(2) ]() Common causes include:
1. Missing or incorrect termination_uri — For Twilio, this should end with .pstn.twilio.com [(3) ]()
2. SIP trunk authentication issues — Verify your sip_trunk_auth_username and sip_trunk_auth_password are correct
3. Number not properly imported — Ensure the number was imported with the correct termination URI
4. Geographic permissions — For international numbers like Brazil (+55) , check Twilio's Voice Geographic Permissions settings [(4) ]()
To troubleshoot, check your Termination SIP URI for spaces, use a localized termination URI, and verify credentials are correct (username differs from the friendly name) .AI Evy
12/25/2025, 7:12 PMAI Evy
12/25/2025, 7:12 PMClient Nexus
12/27/2025, 5:54 PMAI Evy
12/27/2025, 5:54 PMAI Evy
12/27/2025, 5:54 PMtelephony_provider_permission_denied error means the SIP trunk credentials are not authenticated. [(1) ]()
Here's what to check for your Brazilian Twilio number:
1. Verify Termination SIP URI Configuration [(2) ]()
- Ensure there are no spaces in your Termination SIP URI
- Use a localized termination URI near your region (check [Twilio's localized URIs documentation]() )
2. Verify Username and Password
- The username is not the friendly name shown in the credential list — these are different
- Double-check you entered the correct username and password when importing the number to Retell
3. Check Twilio Geographic Permissions
- In Twilio, search "geo" to find "Voice Geographic Permissions"
- Select "Elastic Sip Trunking" and ensure Brazil is enabled for outbound dialing
4. Re-import the Number if Needed [(3) ]()
- If the configuration is incorrect, delete the imported number and re-import with the correct termination URI and credentials
5. Check Twilio Logs [(4) ]()
- Review logs in your Twilio console to see the specific error on their side — this can help identify if the issue is with credentials, permissions, or the number itself
If you've verified all the above and it still doesn't work, contact Twilio support to check if there are any restrictions on your account or number for international outbound calls.AI Evy
12/27/2025, 5:54 PMAI Evy
12/27/2025, 5:54 PMClient Nexus
12/28/2025, 11:04 AMAI Evy
12/28/2025, 11:04 AMAI Evy
12/28/2025, 11:04 AMbartelli-824dfee7) is different from the username — you need to check the actual username you created when setting up credentials
, [(2) ]()
When creating credentials in Twilio, you specify both a friendly name and a username separately. The video tutorial shows this process: "Give your credentials a friendly name... Then I need to give this a username."
To verify your username:
- In the Twilio credential list, click on the credential entry
- Look for the actual username field (not the friendly name displayed in the list)
- This is the value you need to enter in Retell when importing the number
If you can't find the original username, you may need to create new credentials in Twilio and then re-import the number to Retell with the correct username and password.
[(1) ]()AI Evy
12/28/2025, 11:04 AMAI Evy
12/28/2025, 11:04 AMClient Nexus
12/28/2025, 2:50 PMAI Evy
12/28/2025, 2:50 PMAI Evy
12/28/2025, 2:50 PMsip:sip.retellai.com
## Step 2: Move Numbers to the SIP Trunk
Purchase numbers or move existing numbers to this elastic SIP trunk in Twilio.
## Step 3: Import Numbers to Retell
When importing each number to Retell, you must provide:
- The termination SIP URI from Step 1
- The username (not the friendly name) and password from your credentials
## Step 4: Assign Agents to Numbers [(2) ]()
Ensure each imported number has an outbound_agent_id configured:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.update('+14157774444', {
inbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;AI Evy
12/28/2025, 2:50 PMtelephony_provider_permission_denied [(1) ]() , [(3) ]()
- Check Termination SIP URI for spaces — remove them [(1) ]()
- Verify the actual username (not friendly name) and password are correct
- Check Twilio logs to see the specific error on their side [(3) ]()
- For international numbers (like Brazil) , enable geographic permissions in Twilio: search "geo" → "Voice Geographic Permissions" → select "Elastic Sip Trunking" → enable the country [(1) ]()AI Evy
12/28/2025, 2:50 PMAI Evy
12/28/2025, 2:50 PMClient Nexus
12/28/2025, 3:24 PMAI Evy
12/28/2025, 3:24 PMAI Evy
12/28/2025, 3:24 PMinbound_agent_id is null, the number will not accept inbound calls. [(1) ]()
For **outbound calls**: If outbound_agent_id is null, the number cannot initiate outbound calls without an agent id override in the API request.
So you have two options:
- Assign a default agent to the number
- OR pass override_agent_id when making each outbound call via the API
2. Can you automate agent assignment?
Yes. When importing numbers programmatically, you can include inbound_agent_id and outbound_agent_id in the import request:
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',
inbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
3. About the telephony_provider_permission_denied error
This is a separate issue from agent assignment. Even with an agent assigned, you'll still get this error if your SIP trunk credentials or configuration are incorrect. [(2) ]()
The error means the SIP trunk authentication failed. You need to:
- Verify your termination_uri is correct (for Twilio, ends with .pstn.twilio.com) [(1) ]()
- Verify the sip_trunk_auth_username and sip_trunk_auth_password are the actual credentials (not the friendly name) [(2) ]()
- If configuration is incorrect, delete the imported number and re-import with correct detailsAI Evy
12/28/2025, 3:24 PMAI Evy
12/28/2025, 3:24 PMAI Evy
12/28/2025, 3:55 PMAI Evy
12/28/2025, 3:56 PMtelephony_provider_permission_denied error with Brazilian Twilio number imported via SIP trunk [(1) ]()
Root Cause: SIP trunk credentials are not authenticated
Key Things to Verify:
1. Termination SIP URI — no spaces, use localized URI [(2) ]()
2. SIP credentials — use the actual username (not the friendly name) and correct password
3. Geographic permissions in Twilio — ensure Brazil is enabled for Elastic SIP Trunking
Agent Assignment: If outbound_agent_id is null, the number cannot initiate outbound calls without an override_agent_id in the API request [(3) ]()
If you have a specific question or need help with a particular step, let me know!AI Evy
12/28/2025, 3:56 PMAI Evy
12/28/2025, 3:56 PMClient Nexus
12/28/2025, 3:58 PMAI Evy
12/28/2025, 3:58 PMAI Evy
12/28/2025, 3:58 PMtelephony_provider_permission_denied error:
1. Termination URI Format [(1) ]()
- Ensure your termination_uri has no spaces and uses a localized termination URI near your region
- For Twilio, it should end with .pstn.twilio.com [(2) ]()
- Check [Twilio's localized URIs documentation]() to select one appropriate for your region
2. Credential Username vs Friendly Name [(1) ]() , [(3) ]()
- The username you create is NOT the friendly name — these are different values
- When you create credentials via POST .../CredentialLists/{sid}/Credentials, the username you specify there is what must be passed to Retell, not the credential list's friendly name
3. Geographic Permissions in Twilio [(1) ]()
- Search "geo" in Twilio to find "Voice Geographic Permissions"
- Select "Elastic Sip Trunking" and ensure Brazil is enabled for outbound dialing
4. Verify in Twilio Logs [(4) ]()
- Check the logs in your Twilio console to see the specific error on their side — this can help identify if the issue is with credentials, permissions, or the number itself
5. Re-import if Configuration is Incorrect
- If the configuration is not correct, delete the imported number and re-import with corrected details
One potential issue I see: You mention twilio_sip_password_encrypted (stored plaintext in current code) — ensure the actual password value (not an encrypted/hashed version) isAI Evy
12/28/2025, 3:58 PMAI Evy
12/28/2025, 3:58 PMAI Evy
12/28/2025, 3:58 PMClient Nexus
12/28/2025, 4:09 PMAI Evy
12/28/2025, 4:09 PMAI Evy
12/28/2025, 4:09 PMyourtrunk.pstn.twilio.com
Your "fix" flow updating metadata doesn't prove Twilio accepted auth — you need to verify the actual credentials match in both systems.AI Evy
12/28/2025, 4:09 PMAI Evy
12/28/2025, 4:10 PMClient Nexus
12/28/2025, 5:47 PMAI Evy
12/28/2025, 5:47 PMAI Evy
12/28/2025, 5:47 PMtelephony_provider_permission_denied error, as using the correct regional URI is one of the documented troubleshooting steps.
When you expand to international calls later, you can update the termination URI — note that to change configuration on an imported number, you need to delete and re-import it. [(4) ]()AI Evy
12/28/2025, 5:47 PMAI Evy
12/28/2025, 5:47 PMClient Nexus
12/28/2025, 5:50 PMAI Evy
12/28/2025, 5:50 PMAI Evy
12/28/2025, 5:50 PM.pstn.twilio.com. [(2) ]()
What to do:
1. Go to your Twilio Console → Elastic SIP Trunking → your trunk → Termination [(1) ]()
2. Click "show localized URIs" to see region-specific options
3. Select the localized URI closest to Brazil/South America
4. Use that URI when importing the number to Retell
Important: Using a localized URI is recommended but the documentation does not state it's strictly required. The telephony_provider_permission_denied error is more likely caused by incorrect credentials (username vs friendly name mismatch) or geographic permissions not being enabled for Brazil in Twilio.AI Evy
12/28/2025, 5:50 PMAI Evy
12/28/2025, 5:50 PMAI Evy
12/28/2025, 6:05 PMClient Nexus
12/28/2025, 6:05 PMAI Evy
12/28/2025, 6:06 PM+country code, then number with no space, no special characters. [(1) ]()
For your Brazilian number, the format +557140400866 appears correct — it includes the +55 country code followed by the number.
About the Display Name Change
The phone_number_pretty field is a "pretty printed phone number, provided for your reference." This is just a display format and does not affect functionality — it's cosmetic formatting that Retell applies automatically.
The actual phone number stored and used for calls remains in E.164 format (what you entered) . The parentheses and formatting in the display name shouldn't impact your calls.
Potential Issue to Check
Looking at the pretty format +55(714) 040-0866, it seems to be grouping digits incorrectly. Brazilian numbers typically have a 2-digit area code (like 71 for Bahia) . If your original number is correct in E.164 format, this display quirk shouldn't affect functionality — but double-check that the underlying phone_number value stored is exactly +557140400866 without any extra digits.
Your telephony_provider_permission_denied error is more likely related to the SIP credentials or geographic permissions issue we discussed earlier, not the phone number format itself.AI Evy
12/28/2025, 6:06 PMAI Evy
12/28/2025, 6:06 PMClient Nexus
12/28/2025, 6:13 PMAI Evy
12/28/2025, 6:13 PMAI Evy
12/28/2025, 6:13 PMsip:sip.retellai.com [(1) ]()
- Termination (outbound) has an issue — the SIP trunk authentication for outbound calls is failing [(2) ]()
The telephony_provider_permission_denied error specifically means the SIP trunk authentication failed. [(3) ]()
What to check for outbound-specific issues:
1. Termination credentials — Verify the sip_trunk_auth_username and sip_trunk_auth_password you imported to Retell match exactly what's configured in Twilio under Termination → Authentication → Credential Lists [(2) ]()
2. Username vs Friendly Name — Confirm you're using the actual username (not the friendly name) from the credential [(4) ]()
3. Termination SIP URI — Check for spaces in the URI and remove them; use a localized termination URI near your region [(1) ]()
4. Geographic Permissions in Twilio — For outbound calls to Brazil, ensure Brazil is enabled under Voice Geographic Permissions → Elastic SIP Trunking
Recommended next step:
Since inbound works but outbound doesn't, the issue is isolated to your Termination configuration. Double-check the credential username/password in Twilio's Termination settings and ensure they match what Retell has stored. If incorrectAI Evy
12/28/2025, 6:14 PMAI Evy
12/28/2025, 6:14 PMClient Nexus
12/28/2025, 6:39 PMAI Evy
12/28/2025, 6:39 PMAI Evy
12/28/2025, 6:39 PMAI Evy
12/28/2025, 6:39 PMinbound_agent_id assigned to the phone number, inbound calls will work without a webhook. The webhook is only needed if you want per-call customization.
Same SIP trunk for inbound and outbound?
Yes, it's the same phone number configuration in Retell. When you import a phone number, you provide: [(2) ]()
- termination_uri — used for outbound calls (Retell → Twilio)
- inbound_agent_id — handles inbound calls
- outbound_agent_id — handles outbound calls
The "Edit SIP Trunk Phone Number Settings" in Retell covers both directions in one configuration. You can update these settings via the API: [(3) ]()
javascript
const phoneNumberResponse = await client.phoneNumber.update('+14157774444', {
inbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
inbound_webhook_url: '<https://example.com/inbound-webhook',>
}) ;
Since your inbound calls already work, your origination (Twilio → Retell via sip:sip.retellai.com) is configured correctly. The outbound issue is isolated to termination credentials.AI Evy
12/28/2025, 6:39 PMClient Nexus
12/28/2025, 6:40 PMAI Evy
12/28/2025, 6:40 PMAI Evy
12/28/2025, 6:40 PMsip:sip.retellai.com) [(1) ]()
- Outbound fails with telephony_provider_permission_denied → Termination authentication is failing [(2) ]() , [(3) ]()
The telephony_provider_permission_denied error specifically represents cases where the SIP trunk authentication failed.
What to verify in your termination setup:
1. Termination SIP URI — Check for spaces and use a localized termination URI near your region [(1) ]()
2. Credentials — Ensure sip_trunk_auth_username and sip_trunk_auth_password match exactly what's in Twilio's Termination → Authentication → Credential Lists [(3) ]()
3. Username vs Friendly Name — Use the actual username, not the friendly name
4. Geographic Permissions — Ensure Brazil is enabled under Elastic SIP Trunking in Twilio
If the configuration is incorrect, delete the imported number and re-import with correct details.AI Evy
12/28/2025, 6:40 PMAI Evy
12/28/2025, 6:40 PMClient Nexus
12/28/2025, 6:48 PMAI Evy
12/28/2025, 6:48 PMAI Evy
12/28/2025, 6:48 PM.pstn.twilio.com. [(1) ]()
Example format:
someuri.pstn.twilio.com
Key requirements:
1. No spaces — Check your termination SIP URI and remove any spaces if present [(2) ]()
2. Use a localized termination URI near your region — you can expand and view your localized URIs in the Twilio console
3. The URI should match your trunk's domain name followed by .pstn.twilio.com [(1) ]()
For your setup:
Your current format {trunkDomain}.pstn.twilio.com (e.g., bartelli-824dfee7.pstn.twilio.com) follows the correct pattern. However, check [Twilio's localized URIs documentation]() to select a regional termination URI closer to Brazil for better performance. [(2) ]()
When importing to Retell via API:
javascript
const phoneNumberResponse = await client.phoneNumber.import({
phone_number: '+14157774444',
termination_uri: 'someuri.pstn.twilio.com',
}) ;
[(1) ]()AI Evy
12/28/2025, 6:48 PMAI Evy
12/28/2025, 6:48 PM