Create byoc trunk

POST /v1/ByocTrunks

BYOC Trunks allow you to bring your own voice carrier to Twilio, enabling your calls to use our Programmable Voice APIs.

application/x-www-form-urlencoded

Body

  • FriendlyName string

    A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.

  • VoiceUrl string(uri)

    The URL we should call when the BYOC Trunk receives a call.

  • VoiceMethod string(http-method)

    The HTTP method we should use to call voice_url. Can be: GET or POST.

    Values are GET or POST.

  • VoiceFallbackUrl string(uri)

    The URL that we should call when an error occurs while retrieving or executing the TwiML from voice_url.

  • VoiceFallbackMethod string(http-method)

    The HTTP method we should use to call voice_fallback_url. Can be: GET or POST.

    Values are GET or POST.

  • StatusCallbackUrl string(uri)

    The URL that we should call to pass status parameters (such as call ended) to your application.

  • StatusCallbackMethod string(http-method)

    The HTTP method we should use to call status_callback_url. Can be: GET or POST.

    Values are GET or POST.

  • CnamLookupEnabled boolean

    Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

  • ConnectionPolicySid string

    The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^NY[0-9a-fA-F]{32}$.

  • FromDomainSid string

    The SID of the SIP Domain that should be used in the From header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^SD[0-9a-fA-F]{32}$.

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that created the BYOC Trunk resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • sid string | null

      The unique string that that we created to identify the BYOC Trunk resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^BY[0-9a-fA-F]{32}$.

    • friendly_name string | null

      The string that you assigned to describe the resource.

    • voice_url string(uri) | null

      The URL we call using the voice_method when the BYOC Trunk receives a call.

    • voice_method string(http-method) | null

      The HTTP method we use to call voice_url. Can be: GET or POST.

      Values are GET or POST.

    • voice_fallback_url string(uri) | null

      The URL that we call when an error occurs while retrieving or executing the TwiML requested from voice_url.

    • voice_fallback_method string(http-method) | null

      The HTTP method we use to call voice_fallback_url. Can be: GET or POST.

      Values are GET or POST.

    • status_callback_url string(uri) | null

      The URL that we call to pass status parameters (such as call ended) to your application.

    • status_callback_method string(http-method) | null

      The HTTP method we use to call status_callback_url. Either GET or POST.

      Values are GET or POST.

    • cnam_lookup_enabled boolean | null

      Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

    • connection_policy_sid string | null

      The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^NY[0-9a-fA-F]{32}$.

    • from_domain_sid string | null

      The SID of the SIP Domain that should be used in the From header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^SD[0-9a-fA-F]{32}$.

    • date_created string(date-time) | null

      The date and time in GMT that the resource was created specified in RFC 2822 format.

    • date_updated string(date-time) | null

      The date and time in GMT that the resource was last updated specified in RFC 2822 format.

    • url string(uri) | null

      The absolute URL of the resource.

POST /v1/ByocTrunks
curl \
 --request POST 'https://voice.twilio.com/v1/ByocTrunks' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'VoiceUrl=https%3A%2F%2Fbyoc.example.com%2Ftwilio%2Fapp&VoiceMethod=POST&FriendlyName=friendly_name&FromDomainSid=SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&VoiceFallbackUrl=https%3A%2F%2Fbyoc.example.com%2Ftwilio%2Ffallback&CnamLookupEnabled=false&StatusCallbackUrl=https%3A%2F%2Fbyoc.example.com%2Ftwilio%2Fstatus_callback&ConnectionPolicySid=NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&VoiceFallbackMethod=POST&StatusCallbackMethod=POST'
Request example
{"VoiceUrl"=>"https://byoc.example.com/twilio/app", "VoiceMethod"=>"POST", "FriendlyName"=>"friendly_name", "FromDomainSid"=>"SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "VoiceFallbackUrl"=>"https://byoc.example.com/twilio/fallback", "CnamLookupEnabled"=>false, "StatusCallbackUrl"=>"https://byoc.example.com/twilio/status_callback", "ConnectionPolicySid"=>"NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "VoiceFallbackMethod"=>"POST", "StatusCallbackMethod"=>"POST"}
Response examples (201)
{
  "sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "https://voice.twilio.com/v1/ByocTrunks/BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "voice_url": "https://byoc.example.com/twilio/app",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "2020-03-18T23:31:36Z",
  "date_updated": "2020-03-18T23:31:36Z",
  "voice_method": "POST",
  "friendly_name": "friendly_name",
  "from_domain_sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "voice_fallback_url": "https://byoc.example.com/twilio/fallback",
  "cnam_lookup_enabled": false,
  "status_callback_url": "https://byoc.example.com/twilio/status_callback",
  "connection_policy_sid": "NYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "voice_fallback_method": "POST",
  "status_callback_method": "POST"
}