https://retellai.com/?utm_source=discord&utm_medium=seo logo
Questions for Retell:Topic QuestionImport API ...
# ❓・ai-evy-support
c
@AI Evy Questions for Retell: Topic Question Import API Is our payload complete? Any missing fields? Termination URI Should it include sip: prefix? Credentials Format requirements for username/password? Update API Can we update termination_uri after import? Fix Misconfig Delete+reimport or just update? Phone ID Use phone_number_id or E.164 for API calls?
a
Thanks for tagging me @Client Nexus. I'll look through relevant sources and get back to you shortly.
### Answer Here are answers to your questions: Import API - Required Fields The only required fields are
phone_number
(E.164 format) and
termination_uri
. [(1) ]() Optional fields include:
sip_trunk_auth_username
,
sip_trunk_auth_password
,
inbound_agent_id
,
outbound_agent_id
,
inbound_agent_version
,
outbound_agent_version
,
nickname
,
inbound_webhook_url
,
inbound_allowed_countries
,
outbound_allowed_countries
, and
transport
. Termination URI No
sip:
prefix needed. The documentation shows the format as:
"someuri.pstn.twilio.com"
For Twilio elastic SIP trunks, it always ends with
.pstn.twilio.com
. Credentials Format Username and password are simple strings. Examples from the docs: - `sip_trunk_auth_username`:
"username"
- `sip_trunk_auth_password`:
"123456"
Update API - Termination URI I don't have information in the available sources about whether
termination_uri
can be updated after import. The Update Phone Number API documentation isn't included in my sources. Fix Misconfiguration Without documentation on the Update Phone Number endpoint, I can confirm you can delete using: [(2) ]()
Copy code
javascript
await client.phoneNumber.delete('+14157774444') ;
Then reimport with corrected settings. Phone ID for API Calls Use the E.164 format phone number (e.g.,
"+14157774444"
) as the unique identifier for phone number APIs. [(1) ]() , [(2) ]()
​ To learn more, see the sources I considered: [[1] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) [[2] Delete Phone Number](https://docs.retellai.com/api-references/delete-phone-number) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Retell's Inbound SIP Endpoint: What is the exact origination URL that Twilio should send inbound calls to? (e.g., sip:sip.retellai.com:5060;transport=tcp or TLS variant?) Retell's Outbound IPs: What IP addresses does Retell use for outbound calls? (For Twilio IP ACL configuration) Transport Protocol: Does Retell support/prefer TCP or TLS for SIP transport? Credential Direction: For sip_trunk_auth_username and sip_trunk_auth_password in the import API - are these credentials that: Retell uses to authenticate WITH Twilio (outbound)? Twilio uses to authenticate WITH Retell (inbound)? Both? Webhook for Inbound: When we import a number with inbound_agent_id, does Retell handle all inbound routing, or do we still need inbound_webhook_url?
a
Thanks for the follow-up, @Client Nexus. I'll get back to you soon.
### Answer Here are the answers based on the documentation: *Retell's Inbound SIP Endpoint (Origination URL) * For Twilio, set the origination SIP URI to:
sip:sip.retellai.com
[(1) ]() For different transport protocols, append the transport method: [(2) ]() - TCP:
sip:sip.retellai.com;transport=tcp
- UDP:
sip:sip.retellai.com;transport=udp
- TLS:
sip:sip.retellai.com;transport=tls
*Retell's Outbound IPs (for Twilio IP ACL) * 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) Note: Some non-US traffic might come from IPs not listed above, but will be migrated to the first IP block by 12/03/2025. Transport Protocol Supported transport methods: TCP (Recommended) , UDP, TLS SRTP media encryption is also supported when transport is set to TLS. Credential Direction The
sip_trunk_auth_username
and
sip_trunk_auth_password
are credentials that Retell uses to authenticate WITH Twilio for outbound calls. [(1) ]() From the Twilio setup guide: "For your elastic SIP trunk to accept our outbound request, you need to whitelist IP address or create auth with 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." Webhook for Inbound The
inbound_webhook_url
is optional. When you set
inbound_agent_id
, Retell handles inbound routing automatically. [(3) ]() The webhook is only needed "if set, will send a webhook for inbound calls, where you can override agent id, set dynamic variables and other fields specific to that call." So if you just want standard agent hand
ling,
inbound_agent_id
alone is sufficient. Use
inbound_webhook_url
only if you need per-call customization.
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) [[2] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[3] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Import Timing: Should we import the number to Retell: BEFORE assigning it to the Twilio SIP trunk? AFTER the trunk is fully configured? Does order matter? Termination URI Format Confirmation: When importing to Retell, the termination_uri should be exactly: agency-abc123.pstn.twilio.com (no sip: prefix, as you confirmed earlier) Correct?
a
Thanks for the follow-up, @Client Nexus. I'll get back to you soon.
### Answer Import Timing The order matters. Based on the Twilio setup guide, you should configure the trunk first, then import to Retell: [(1) ]() 1. Create the Elastic SIP Trunk and configure termination/origination settings 2. Move/purchase numbers to the Elastic SIP Trunk in Twilio 3. Import numbers to Retell The documentation states: "You've created the elastic SIP trunk, now you would need to purchase numbers / move existing numbers to this trunk" followed by "Now the number is set up with your elastic SIP trunking, you need to import the number to Retell so that we will know how to route the call." Termination URI Format Correct. No
sip:
prefix needed. The format should be: [(2) ]()
Copy code
someuri.pstn.twilio.com
The documentation confirms: "For Twilio elastic SIP trunks it always ends with '.pstn.twilio.com'." So your example
agency-abc123.pstn.twilio.com
follows the correct format. Also note: you may want to use a localized termination URI near your region for better performance. You can find localized URIs in the Twilio console. [(1) ]()
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) [[2] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Can we import a phone number to Retell that was already purchased in Twilio (not through Retell)? Using the /import-phone-number endpoint with the E.164 number + our SIP trunk credentials? If we already have a SIP trunk configured with credentials, do we just need to call /import-phone-number for each existing number? Payload would be: { "phone_number": "+1234567890", "termination_uri": "our-trunk.pstn.twilio.com", "sip_trunk_auth_username": "our_username", "sip_trunk_auth_password": "our_password" } For existing numbers being imported, is there any cleanup needed if they were never in Retell before? Or is it a clean import with no prerequisites?
a
Thanks for the follow-up, @Client Nexus. I'll get back to you soon.
### Answer Yes, you can import existing Twilio numbers to Retell. [(1) ]() The documentation confirms: "You've created the elastic SIP trunk, now you would need to purchase numbers / move existing numbers to this trunk" followed by importing to Retell. Your payload is correct. The required fields are
phone_number
(E.164 format) and
termination_uri
. The auth credentials are optional but recommended for outbound authentication: [(2) ]()
Copy code
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) ;
Clean import with no prerequisites (on the Retell side) . As long as: 1. The number is assigned to your Elastic SIP Trunk in Twilio 2. Your trunk's origination points to
sip.retellai.com
3. You have the correct termination URI and credentials Just call
/import-phone-number
for each number. Once imported, "you can make and receive calls with this number just like a number you purchased from Retell — it will show up in your dashboard." [(1) ]() You can optionally include
inbound_agent_id
,
outbound_agent_id
,
nickname
, and other fields during import, or update them later. [(2) ]() , [(2) ]()
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.