SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Can I Customize the SIP "From" Domain for Outbound API Calls?

Question

How can I override the SIP From domain for outbound SIP calls via the Twilio API?

 

Product

Programmable Voice (SIP Interface, Voice API)

 

Answer

Twilio’s Programmable Voice API does not support customizing the domain portion of the SIP From header for outbound calls. When initiating a call via the REST API, Twilio requires the From parameter to be a valid E.164 phone number or a Client Identity not a SIP URI.

Technical Constraints:

  • The From Parameter: Must only contain the username or number (e.g., +123456789). Including an @ symbol or domain (e.g., sip:+1234@mydomain.sip.twilio.com) will trigger Error 21212: "The caller address is not a user name".
  • Automatic Domain Assignment: Twilio automatically appends its own infrastructure domain (e.g., @sip.us1.twilio.com or @sip.de1.twilio.com) to the From header in outbound SIP INVITEs.
  • SIP Domain Use Case: Custom SIP Domains created in the Twilio Console are used for inbound call routing and SIP Registration; they cannot be used to "brand" the domain of outbound API calls.

Workaround: Using Custom Headers, If you need to pass your custom domain or identity to the receiving system for logging or routing purposes, you can include it as a custom SIP header within the To URI:

To=sip:destination@host?X-Source-Domain=mydomain.sip.twilio.com

For more details, see Pass Headers in your SIP URI 

 

Additional Information

  • Error 21212: This error prevents malformed SIP URIs from being passed into the From field.
  • Interoperability: If your receiving SIP endpoint requires a specific domain for security (ACLs), you must configure the endpoint to trust/accept Twilio’s regional SIP domains rather than a custom one.
Have more questions? Submit a request
Powered by Zendesk