https://retellai.com/?utm_source=discord&utm_medium=seo logo
Subject: /import-phone-number 500 ErrorBody:I’m us...
# ❓・ai-evy-support
k
@AI Evy Subject: /import-phone-number 500 Error Body: I’m using /import-phone-number with a UK Twilio number and a valid published agent. My payload looks like this: { "phone_number": "+44xxxxxxxxxx", "termination_uri": "sip:test-main.pstn.twilio.com", "inbound_agent_id": "agent_xxxxx", "nickname": "Test Agent" } The API consistently returns {"status":"error","message":"Internal Server Error"}. Could you confirm whether custom Twilio SIP trunks are supported or need whitelisting?
a
### Answer
Thanks for tagging me @kamivermillion. I'll look through relevant sources and get back to you shortly.
message has been deleted
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
any update on this please? @AI Evy
a
Thanks for the follow-up, @kamivermillion. I'll get back to you soon.
### Answer Custom Twilio SIP trunks are supported in Retell AI, and you can import Twilio numbers using the Import Phone Number API. Your payload structure is correct for importing a number. Key requirements include the phone number in E.164 format, a valid termination_uri (which for Twilio should end with .pstn.twilio.com) , and optional authentication credentials if needed [(1) ]() [(2) ]() [(3) ]() . A 500 Internal Server Error can indicate a configuration issue or unsupported scenario. Common causes reported include issues with the SIP trunk configuration or the format of the termination URI [(4) ]() . There’s no documentation stating that custom Twilio SIP trunks need whitelisting, but some SIP trunk providers may require IP whitelisting for security, even though Retell AI does not provide a static IP for its SIP server [(2) ]() [(4) ]() . If you continue to receive a 500 error after confirming your SIP trunk is set up correctly, try the following: - Double-check your termination_uri for typos or unsupported parameters (e.g., avoid extra transport parameters) . - Ensure your Twilio SIP trunk is active and correctly configured for both inbound and outbound. - If your trunk requires authentication, add the sip_trunk_auth_username and sip_trunk_auth_password fields [(1) ]() . - If the issue persists, you may need to consult your SIP trunk provider for possible
IP whitelisting options, but this is not a documented Retell AI requirement. If these steps do not resolve the error, please check out these potentially useful sources: [Import Phone Number]() , [AI in SIP Calling & Telephony Solutions | Retell AI]() , [Error 500 while adding custom phone number (even using retellai API) ]() . Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Import Phone Number](https://docs.retellai.com/api-references/import-phone-number) [[2] AI in SIP Calling & Telephony Solutions | Retell AI](https://www.retellai.com/blog/integrating-ai-with-sip-trunking-and-modern-telephony) [[3] Discord message from @soggydoggy8 on 2025-10-21](https://discord.com/channels/1186424376300679209/1186462578310910112/1429991463978143835) [[4] Error 500 while adding custom phone number (even using retellai API)](https://discord.com/channels/1186424376300679209/1430492921735675954) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.