https://retellai.com/?utm_source=discord&utm_medium=seo logo
internal server error when connecting to twilio si...
# ❓・ai-evy-support
s
@AI Evy internal server error when connecting to twilio sip trunk
a
Thanks for tagging me @sahalshamas. I'll look through relevant sources and get back to you shortly.
### Answer When encountering an internal server error connecting to Twilio SIP trunk, check these common configuration issues: [(1) ]() [(2) ]() Termination URI Format The Termination SIP URI should only contain the domain name, not the full SIP URI [(2) ]() . For example, use
rhythm-management-regal.sip.twilio.com
instead of
sip:hello_regal@rhythm-management-regal.sip.twilio.com
. Number Formatting Ensure the phone number is in E.164 format (e.g., +1234567890) without spaces or special characters . Authentication Settings If you set up auth via credentials in your Twilio elastic SIP trunk, you need to supply the username and password when importing the number to Retell [(1) ]() . The username is not the friendly name shown in the credential list - you need to verify the actual username . IP Whitelisting If you opted for IP whitelisting instead of authentication, you need to whitelist all IP addresses in Retell's range since Retell SIP server does not have a static IP . Common Twilio Issues Check your Termination SIP URI for spaces and remove them if present . Also use a localized termination URI near your region . If the configuration looks correct, check the logs in your Twilio telephony provider and consider opening a ticket with them .
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) [[2] Internal server error when adding SIP number](https://discord.com/channels/1186424376300679209/1374741536931057694) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
@AI Evyi need to create an outbound agent in retell ai for australia for my client .what all the settings to be done for connecting twilio to retell ai. can you please give me step by step guide.
a
Thanks for the follow-up, @sahalshamas. I'll get back to you soon.
### Answer Here's a step-by-step guide to connect Twilio to Retell AI for an outbound agent in Australia: Step 1: Create Elastic SIP Trunking in Twilio [(1) ]() Create a new trunk in your Twilio account and give it a name . Toggle the necessary general settings . *Step 2: Setup Termination (for outbound) * The termination SIP URI is important for later steps . You should use a localized termination URI near your region . For Australia, expand and view your localized URIs in the Twilio console . For authentication, you have two options : - Whitelist IP addresses (you need to whitelist all IP addresses in the range since Retell SIP server does not have a static IP) - Create auth with username and password *Step 3: Setup Origination (for inbound) * Specify Retell's SIP server address as the origination SIP URI:
sip:sip.retellai.com
. Step 4: Enable Call Transfer Settings Make sure code transfer is enabled . Also enable the checkbox called "Enable PSTN Transfer" . Step 5: Purchase or Move Numbers to Elastic SIP Trunking Purchase Australian numbers or move existing numbers to this trunk . Step 6: Import Numbers to Retell AI [(2) ]() Supply the termination SIP URI you set up in Step 2 . If you set up auth via credentials, supply the username and password as well . You can import programmatically via the Import Number API :
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) ;
Step 7: Bind Agents to Numbers Bind your outbound agent to the imported number by specifying the
outbound_agent_id
when importing . Step 8: Configure International Dialing [(1) ]() Search "geo" to find the "Voice Geographic Permissions" setting . Choose "Elastic SIP Trunking" in the selector, and select Australia and any other countries you need to dial . Once imported, you can make phone calls from the Dashboard directly or use the Create Phone Call API to create calls programmatically . **
​ 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.
s
my client has added me to workspace . how do i find the geo settings
@AI Evy my client has added me to workspace . how do i find the geo settings
a
Thanks for the follow-up, @sahalshamas. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) ​
### Answer The geo settings you're looking for are in your Twilio account, not in the Retell AI workspace [(1) ]() . To find the Voice Geographic Permissions setting in Twilio : 1. Search for "geo" in your Twilio console 2. Find the "Voice Geographic Permissions" setting 3. Choose "Elastic SIP Trunking" in the selector 4. Select Australia and any other countries you need to dial This is a Twilio configuration that needs to be set up on the Twilio side to enable international dialing for your elastic SIP trunk .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Thanks for the follow-up, @sahalshamas. I'll get back to you soon.
### Answer Based on the thread context, here are all the changes you need to make to connect Twilio to Retell AI for your Australian outbound agent: In Twilio: 1. Create Elastic SIP Trunking [(1) ]() - Create a new trunk with a name - Configure termination settings with a localized termination URI near Australia - Set up authentication (either IP whitelisting or username/password credentials) - Configure origination with Retell's SIP server address:
sip:sip.retellai.com
2. Enable Transfer Settings - Enable code transfer - Enable "PSTN Transfer" checkbox 3. Configure Geographic Permissions - Search "geo" in Twilio console - Find "Voice Geographic Permissions" setting - Select "Elastic SIP Trunking" in the selector - Select Australia and any other countries you need to dial 4. Move/Purchase Numbers - Purchase Australian numbers or move existing numbers to your elastic SIP trunk In Retell AI: 1. Import the Phone Number - Provide the termination SIP URI from your Twilio trunk - If using credential authentication, provide username and password - Specify the
outbound_agent_id
to bind your agent to the number 2. Verify Number Format [(2) ]() - Ensure phone numbers are in E.164 format (e.g., +61xxxxxxxxx for Australia) Common Issues to Avoid: [(1) ]() - Check your Termination SIP URI for spaces and remove them - Use the actual username (not the friendly name) for credentials - Ensure you're using a localized termination URI near your region Once these changes are complete, your Australian outbound agent should be able to make calls through the imported Twilio number .
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) [[2] I’m trying to use a toll-free number (connected from Twilio through a SIP trunk)](https://retell.discourse.group/t/i-m-trying-to-use-a-toll-free-number-connected-from-twilio-through-a-sip-trunk/127) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
@AI Evy i have enabled Secure Trunking ,Secure Trunking,Enable PSTN Transfer in general tab . this is my username tablewaiterr . this my Routing Regional United States (US1) Region Termination SIP URI routing is: Active. this is my origination uri sip:5t4n6j0wnrl.sip.livekit.cloud . what all the changes to be made
a
Thanks for the follow-up, @sahalshamas. I'll get back to you soon.
### Answer ### Changes Needed Based on your configuration, here are the specific changes required: 1. Origination URI Issue Your origination URI
sip:5t4n6j0wnrl.sip.livekit.cloud
is incorrect [(1) ]() . For Retell AI, the origination SIP URI should be
sip:sip.retellai.com
[(2) ]() [(1) ]() . 2. Termination URI for Australia Your current routing shows "United States (US1) Region" [(1) ]() . Since you need to make outbound calls to Australia, you should use a localized termination URI near your region . You can expand and view your localized URIs in the Twilio console . 3. Geographic Permissions You need to configure Voice Geographic Permissions : - Search "geo" in Twilio console - Find "Voice Geographic Permissions" setting - Choose "Elastic SIP Trunking" in the selector - Select Australia and any other countries you need to dial 4. Import to Retell AI Once your Twilio configuration is correct, import the number to Retell AI [(1) ]() [(3) ]() : - Provide your Twilio termination SIP URI (the localized one for your region) [(3) ]() - Supply username:
tablewaiterr
and the corresponding password - Specify the
outbound_agent_id
to bind your agent Critical Fix: Change your origination URI from
sip:5t4n6j0wnrl.sip.livekit.cloud
to
sip:sip.retellai.com
[(2) ]() [(1) ]() . This is essential for Retell AI to receive inbound calls properly.
​ 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.
s
@AI Evy how do i change us1 to australia
a
Thanks for the follow-up, @sahalshamas. I'll get back to you soon.
### Answer To change from US1 to an Australia-based termination URI in your Twilio elastic SIP trunk: In Twilio Console: 1. Navigate to your Elastic SIP Trunking trunk 2. Go to the Termination section 3. Look for the termination SIP URI settings 4. You should use a localized termination URI near your region [(1) ]() 5. Expand and view your localized URIs in the Twilio console to find the Australia-specific endpoint The documentation indicates you should use a localized termination URI that's near your region rather than the default US1 . Twilio provides region-specific termination URIs that you can select for better performance and routing [(2) ]() . Format: Instead of the US1 region URI, you'll select or specify an Australia-based termination URI (typically something like
yourtrunk.pstn.au1.twilio.com
or similar - check your Twilio console for the exact Australia endpoint) . After changing: - Make sure there are no spaces in the termination SIP URI [(1) ]() - When you import the number to Retell AI, use this new Australia-localized termination URI [(3) ]() - Supply your username
tablewaiterr
and password with the updated termination URI This change will route your outbound calls through Twilio's Australia infrastructure for better call quality and lower latency to Australian numbers [(2) ]() . **
​ To learn more, see the sources I considered: [[1] Twilio](https://docs.retellai.com/deploy/twilio) [[2] Hey everyone, I could use some help setting up international calls through Retell + Twilio.](https://discord.com/channels/1186424376300679209/1384845104132522024) [[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.