Skip to main content
Connect a Twilio number to Retell with elastic SIP trunking, so your agents can make and receive calls on numbers you own in Twilio. Set up termination (outbound) and origination (inbound), add credentials, then import the number into Retell.

Steps

1

Create elastic SIP trunking

  1. Create the trunk, give it a name, and toggle some general settings
  1. Set up termination (this is for outbound)
  • The termination SIP URI here is important; you’ll use it in later steps. Use a localized termination URI near your region. You can expand and view your localized URIs in the Twilio console.
  • For your elastic SIP trunk to accept our outbound request, you need to whitelist an IP address or create an auth with a username and password.
    • If you opt for the auth route, you need to specify the username and password in the next step when importing the number to Retell.
    • You need to whitelist Retell SIP SBC CIDR block 18.98.16.120/30 like the following:
  1. Set up origination (this is for inbound)
  • Here you will specify Retell’s SIP server address as the origination SIP URI: sip:sip.retellai.com.
2

Move numbers to elastic SIP trunking

You’ve created the elastic SIP trunk. Now purchase numbers or move existing numbers to this trunk.
3

Import numbers to Retell

Now that the number is set up with your elastic SIP trunk, import it to Retell so we know how to route the call.Here you supply the termination SIP URI you set up in Step 1. If you set up auth via credentials, supply the username and password as well.You can also import numbers programmatically via Import Number API.Now that the number is imported, you can make and receive calls with it just like a number purchased from Retell. It shows up in your dashboard, and you can make phone calls from the dashboard directly. You can also use the Create Phone Call API to create calls programmatically. To have Retell stop using this number, delete it from the dashboard or via the Delete Number API.

Common issues

1. After connecting, inbound works but outbound does not?
  • Check your termination SIP URI. If there’s a space in it, remove it. Also use a localized termination URI near your region. See this doc to select one.
  • Check your username and credentials. Make sure you entered the username and credentials shown in this dialog. Note that the username is not the friendly name shown in the credential list; double-check that you didn’t confuse the two.
2. How do I set up dialing to international countries?
  • Search “geo” to find the “Voice Geographic Permissions” setting.
  • Choose “Elastic SIP Trunking” in the selector, and select the countries you would like to dial. See International calling for Retell’s supported destinations and fees.
Still stuck? See Debug outbound call for common SIP failures, or debug SIP calls with PCAP files to inspect the signaling in Wireshark.

Phone number masking

If you have a personal phone number or a trusted business number you’d like to display to the callee, you can import verified phone numbers into Twilio to serve as the caller ID.

Add a caller ID

  1. Go to the Verified Caller IDs page
  2. Click Add a new Caller ID
  3. Enter the desired phone number to verify, select the desired verification method, and then click Verify Number
  1. The number entered will receive an OTP Authentication code for verification. Enter this verification code on the next window.
  1. Once you click Submit, if the correct OTP code was entered, you will receive a Successful notification and the number will be added to your account as a verified caller ID.

Configure SIP header rules to display caller ID

This uses Twilio’s own header manipulation. To set or parse custom SIP headers on the Retell side, see the SIP headers guide.
  1. In the Twilio Console, navigate to Elastic SIP Trunking → Trunks → [your trunk] → Termination
  2. Scroll down to Header Manipulation and open View all SIP header manipulation policies
  1. Click on Create a policy in the top right and give your policy a friendly name
  2. Click on + Add request rule and give the rule a friendly name
  3. Under the Actions section, set the following values:
    • SIP header field: From number
    • Action: Replace with
    • Value: Your caller ID in E.164 format (e.g. +18881230987)
  1. Click Add rule, and then click Save policy
  2. Return to the Termination tab within your trunk, and select the new header manipulation policy from the dropdown
  3. Now, any number imported from this Twilio trunk into your Retell account will use your verified caller ID. Place an outbound test call to validate the changes.
    • Note: You will need at least one number purchased from Twilio in your SIP trunk in order to apply the caller ID.