Twilio Setup to Connect to Retellai

I’m trying to setup Twilio Elastic SIP Trunk, to connect to Retellai, but it isn’t quite working. When I do the call in test it rings and then hangs up. This is better than before, as I had another IP entered that I do not even know where I got from. When I was using that number, it would not even ring, so I’m making progress! Right now I am using my IP changed to CiDR format.

My question is, is this the right IP address to use or should be something else? We’re not using a PBX or any other system, so this is the only number we have locally.

Any help would be appreciated. I know the issue is on Twilio’s side and I would ask twilio, but it seems they do not have any support. But since this is a common setup between retaillai and twilio, I’m hoping someone will have some details here.

You should not be using your local IP address. For Twilio Elastic SIP Trunking with Retell AI, you need to whitelist Retell’s IP addresses, not your own(1).

Since Retell’s SIP server does not have a static IP, you need to whitelist the following CIDR blocks in your Twilio IP Access Control List(2)(1):

  • 18.98.16.120/30 (All regions)(1)
  • 143.223.88.0/21 (certain United States traffic)(1)
  • 161.115.160.0/19 (certain United States traffic)(1)

Setup Steps:

  1. In your Twilio Elastic SIP Trunk termination settings, create an IP Access Control List(2)
  2. Add the CIDR blocks listed above(1)
  3. Set the origination SIP URI to: sip:sip.retellai.com(2)
  4. For the termination SIP URI, use a localized termination URI near your region and ensure there are no spaces(2)

Alternative Authentication:

Instead of IP whitelisting, you can use credential-based authentication with a username and password(2). If you’re already using a credential list, adding the CIDR notation won’t break anything(3).

Common Issues:

If inbound works but outbound doesn’t, check your termination SIP URI for spaces and verify you’re using the correct username (not the friendly name)(2).

Hello @sales

Can you share a call id you made from this number?

I cannot directly share a call ID since I’m an AI assistant and don’t have access to your specific account data or call history.

To find call IDs from calls made with a specific number in Retell AI, you would need to access your dashboard or use the Retell AI API to retrieve call records(1)(2). Each call generates a unique call_id that follows a format like “Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6”(1)(2).

If you’re experiencing billing questions or need to review specific calls, you can share the call IDs with Retell AI support for investigation(3).

Would you like help understanding how to retrieve call IDs from your Retell AI account, or do you have a specific question about call management?

Hi @Omar_Ashraf

I’m just setting up the virtual line right now, so I do not have a caller ID, unless I misunderstood question.

I don’t have information in the available sources about a specific “virtual line” setup or caller ID requirements during initial Twilio Elastic SIP Trunk configuration with Retell AI.

However, based on the standard setup process, you don’t need a caller ID to initially configure the SIP trunk(1). The basic setup requires:

  1. Creating the Elastic SIP Trunk in Twilio(1)
  2. Setting up termination (for outbound) with the termination SIP URI(1)
  3. Setting up origination (for inbound) with Retell’s SIP server address: sip:sip.retellai.com(1)
  4. Whitelisting Retell’s IP addresses or setting up credential authentication(1)
  5. Moving/purchasing numbers to your Elastic SIP Trunk(1)
  6. Importing those numbers into Retell AI(1)

Caller ID (Phone Number Masking) is optional and only needed if you want to display a specific verified number to callees(1). If you want to set this up later, you would need to verify a caller ID in Twilio and configure SIP Header Rules(1).

For now, focus on completing the basic SIP trunk setup and importing at least one number from Twilio into Retell AI before worrying about caller ID masking.

Can you give me more details about item #4, the termination SIP URI? The instructions are not quite clear to me.

The termination SIP URI is what Twilio uses to route outbound calls from Retell AI(1). This is different from the origination URI (which handles inbound calls)(1).

Where to Find Your Termination SIP URI in Twilio:

In your Twilio Elastic SIP Trunk, go to the Termination tab(2). There you’ll create a termination SIP URI(2). The URI typically ends with .pstn.twilio.com(3).

Important Details:

  1. Remove any spaces - Check your termination SIP URI carefully and remove any spaces(1)
  2. Use a localized URI - Select a termination URI that’s geographically near your region for better performance(1). Twilio provides different regional endpoints in their localized URIs documentation(1)
  3. Format example - When you import your number into Retell AI, you’ll provide this termination URI(1)(4)

When You Import to Retell AI:

After setting up your Twilio SIP trunk, you need to import your phone number into Retell AI and supply this termination SIP URI during the import process(1). If you configured authentication with credentials, you’ll also need to provide the username and password(1).

You can import via the dashboard or programmatically using the Import Number API(1).

Common Issue:

Make sure you’re using the actual username from your credentials, not the “friendly name” that shows in the credential list - these are different(1).

I have imported a phone number to retellai already. Is there a way to edit the details?

Yes, you can edit the details of an imported phone number in Retell AI. The documentation references an Update Phone Number API endpoint that allows you to modify various settings for your imported numbers(1).

You can update several details including:

  • inbound_agent_id and outbound_agent_id to change which agents handle calls(1)
  • inbound_agent_version and outbound_agent_version to specify agent versions(1)
  • nickname for your reference(1)
  • inbound_webhook_url to override agent settings for specific calls(1)
  • allowed_inbound_country_list and allowed_outbound_country_list to control call routing by country(1)
  • SIP trunk authentication details like username and password(1)
  • transport protocol (TLS, TCP, or UDP) for outbound calls(1)

The phone number must be in E.164 format (country code with + prefix, no spaces or special characters) when making updates(1).

Where do I edit the phone number details?


You can edit phone number details using the Update Phone Number API endpoint(1).

The endpoint is PATCH /update-phone-number/{phone_number} where {phone_number} is the E.164 format of the number (e.g., “+14157774444”)(1).

You can update the following details(1):

  • inbound_agent_id - Agent for inbound calls(1)
  • outbound_agent_id - Agent for outbound calls(1)
  • inbound_agent_version - Version of the inbound agent(1)
  • outbound_agent_version - Version of the outbound agent(1)
  • nickname - Your internal reference name(1)
  • inbound_webhook_url - Webhook for inbound calls(1)
  • allowed_inbound_country_list - ISO 3166-1 alpha-2 country codes for allowed inbound calls(1)
  • allowed_outbound_country_list - ISO 3166-1 alpha-2 country codes for allowed outbound calls(1)
  • SIP trunk configuration (termination_uri, auth_username, auth_password, transport)(1)

Here’s an example using the JavaScript SDK:

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',
 nickname: 'Frontdesk Number',
 outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
});
console.log(phoneNumberResponse.inbound_agent_id);

(1)

Note: If you need to update the phone number used for account verification/MFA, you cannot do this from the dashboard(2). You’ll need to contact Retell AI support at support@retellai.com(2).

I use the no code setup. Is there a location on dashboard to update the details?

Yes, Retell AI’s no-code platform includes a dashboard where you can update your agent details(1). The dashboard allows you to create, modify, and manage your AI voice agents using visual interfaces and drag-and-drop components without requiring coding expertise(1).

For accessing specific settings like API Keys, you can find them in the left sidebar menu under Settings → API Keys(2). The Analytics dashboard is accessible through the Analytics tab, where you can customize charts, apply global filters, and manage your data visualizations(3).

If you’re looking to update agent configurations, the Agent Builder provides a user-friendly interface where you can quickly create and test agents using prompts and drag-and-drop functionality(4).

I need an area in the console to update the phone number details.

You can update phone number details from the dashboard.(1) After a number is purchased, you can change its nickname to make it easier to find and identify.(1)

You can also update phone numbers programmatically using the Update Phone Number API.(2) The API allows you to modify:

  • inbound_agent_id - agent for receiving inbound calls(2)
  • outbound_agent_id - agent for making outbound calls(2)
  • inbound_agent_version and outbound_agent_version(2)
  • nickname - for your reference(2)
  • inbound_webhook_url - for overriding agent settings on inbound calls(2)
  • allowed_inbound_country_list and allowed_outbound_country_list - ISO 3166-1 alpha-2 country codes(2)
  • SIP trunk configuration including termination_uri, auth_username, auth_password, and transport(2)

I do not see it. Can you let me know where in the dashboard to make changes to the SIP trunking details.

I don’t have specific documentation about where to modify existing SIP trunking details in the Retell AI dashboard.

Based on the available sources, when you import a number using SIP trunking, you can view and manage the numbers you import.(1) However, if you need to change the configuration of an imported number, you would need to delete and re-import the number.(1)

To access your phone numbers, go to the phone numbers tab and click on the plus + sign on the top and select Connect with sip trunking.(2)

You can also import numbers programmatically via the Import Number API.(3)

If you’re looking for a specific settings page to edit SIP trunk configurations directly, that functionality may not be available in the current dashboard interface.

How do I delete an imported number?

To delete an imported phone number in Retell AI, you can use the Delete Phone Number API endpoint(1).

Using JavaScript:

import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
});
await client.phoneNumber.delete('+14157774444');

(1)

Using Python:

client.phone_number.delete(phone_number)

(2)

The endpoint is DELETE /delete-phone-number/{phone_number}, where {phone_number} is the E.164 format of the number (country code followed by the number with no spaces or special characters, e.g., “+14157774444”)(1).

You can also delete numbers through the dashboard(3).

Note: There have been reports of this endpoint timing out for imported phone numbers(4). If you encounter issues, you may need to contact support through Discord or the support channels(3)(5).