Skip to contentSkip to navigationSkip to topbar
On this page

SIP Domain Resource


A SIP Domain resource describes a custom DNS hostname that can accept SIP traffic for your account. A SIP request to that domain, such as to sip:alice@example.sip.twilio.com, routes to Twilio. Twilio authenticates the request and requests TwiML from the voice_url of the SIP Domain.


SIP Domain Authentication

sip-domain-authentication page anchor

Your SIP Domain must map at least one of these two authentication methods or requests to it will be blocked.


Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
Not PII

The SID of the Account that created the SipDomain resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

api_versionstringOptional

The API version used to process the call.


auth_typestringOptional

The types of authentication you have mapped to your domain. Can be: IP_ACL and CREDENTIAL_LIST. If you have both defined for your domain, both will be returned in a comma delimited string. If auth_type is not defined, the domain will not be able to receive any traffic.


date_updatedstring<date-time-rfc-2822>Optional

The date and time in GMT that the resource was last updated specified in RFC 2822(link takes you to an external page) format.


domain_namestringOptional

The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and "-" and must end with sip.twilio.com.


friendly_namestringOptional

The string that you assigned to describe the resource.


sidSID<SD>Optional

The unique string that that we created to identify the SipDomain resource.

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34

uristringOptional

The URI of the resource, relative to https://api.twilio.com.


voice_fallback_methodenum<http-method>Optional

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

Possible values:
GETPOST

voice_fallback_urlstring<uri>Optional
PII MTL: 30 days

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


voice_methodenum<http-method>Optional

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

Possible values:
GETPOST

voice_status_callback_methodenum<http-method>Optional

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

Possible values:
GETPOST

voice_status_callback_urlstring<uri>Optional

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


voice_urlstring<uri>Optional

The URL we call using the voice_method when the domain receives a call.


subresource_urisobject<uri-map>Optional

A list of mapping resources associated with the SIP Domain resource identified by their relative URIs.


sip_registrationbooleanOptional

Whether to allow SIP Endpoints to register with the domain to receive calls.


emergency_calling_enabledbooleanOptional

Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses.


securebooleanOptional

Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain.


byoc_trunk_sidSID<BY>Optional

The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34

emergency_caller_sidSID<PN>Optional

Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call.

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34

Create a SipDomain resource

create-a-sipdomain-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that will create the resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
DomainNamestringrequired

The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and "-" and must end with sip.twilio.com.


FriendlyNamestringOptional

A descriptive string that you created to describe the resource. It can be up to 64 characters long.


VoiceUrlstring<uri>Optional

The URL we should when the domain receives a call.


VoiceMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

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


VoiceFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceStatusCallbackUrlstring<uri>Optional

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


VoiceStatusCallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

SipRegistrationbooleanOptional

Whether to allow SIP Endpoints to register with the domain to receive calls. Can be true or false. true allows SIP Endpoints to register with the domain to receive calls, false does not.


EmergencyCallingEnabledbooleanOptional

Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses.


SecurebooleanOptional

Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain.


ByocTrunkSidSID<BY>Optional

The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34

EmergencyCallerSidSID<PN>Optional

Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call.

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34
Create a SipDomain resourceLink to code sample: Create a SipDomain resource
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createSipDomain() {
11
const domain = await client.sip.domains.create({ domainName: "domain_name" });
12
13
console.log(domain.accountSid);
14
}
15
16
createSipDomain();

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"api_version": "2010-04-01",
4
"auth_type": "IP_ACL",
5
"date_created": "Mon, 20 Jul 2015 17:27:10 +0000",
6
"date_updated": "Mon, 20 Jul 2015 17:27:10 +0000",
7
"domain_name": "domain_name",
8
"friendly_name": "Scranton Office",
9
"sip_registration": true,
10
"sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
11
"subresource_uris": {
12
"credential_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialListMappings.json",
13
"ip_access_control_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlListMappings.json"
14
},
15
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
16
"voice_fallback_method": "POST",
17
"voice_fallback_url": null,
18
"voice_method": "POST",
19
"voice_status_callback_method": "POST",
20
"voice_status_callback_url": null,
21
"voice_url": "https://dundermifflin.example.com/twilio/app.php",
22
"emergency_calling_enabled": true,
23
"secure": true,
24
"byoc_trunk_sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"emergency_caller_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
26
}

Fetch a SipDomain resource

fetch-a-sipdomain-resource page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the SipDomain resource to fetch.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SD>required

The Twilio-provided string that uniquely identifies the SipDomain resource to fetch.

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchSipDomain() {
11
const domain = await client.sip
12
.domains("SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.fetch();
14
15
console.log(domain.accountSid);
16
}
17
18
fetchSipDomain();

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"api_version": "2010-04-01",
4
"auth_type": "IP_ACL",
5
"date_created": "Mon, 20 Jul 2015 17:27:10 +0000",
6
"date_updated": "Mon, 20 Jul 2015 17:27:10 +0000",
7
"domain_name": "dunder-mifflin-scranton.sip.twilio.com",
8
"friendly_name": "Scranton Office",
9
"sip_registration": true,
10
"sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
11
"subresource_uris": {
12
"credential_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialListMappings.json",
13
"ip_access_control_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlListMappings.json"
14
},
15
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
16
"voice_fallback_method": "POST",
17
"voice_fallback_url": null,
18
"voice_method": "POST",
19
"voice_status_callback_method": "POST",
20
"voice_status_callback_url": null,
21
"voice_url": "https://dundermifflin.example.com/twilio/app.php",
22
"emergency_calling_enabled": true,
23
"secure": true,
24
"byoc_trunk_sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"emergency_caller_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
26
}

Read multiple SipDomain resources

read-multiple-sipdomain-resources page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the SipDomain resources to read.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listSipDomain() {
11
const domains = await client.sip.domains.list({ limit: 20 });
12
13
domains.forEach((d) => console.log(d.accountSid));
14
}
15
16
listSipDomain();

Output

1
{
2
"domains": [
3
{
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"api_version": "2010-04-01",
6
"auth_type": "IP_ACL",
7
"date_created": "Mon, 20 Jul 2015 17:27:10 +0000",
8
"date_updated": "Mon, 20 Jul 2015 17:27:10 +0000",
9
"domain_name": "dunder-mifflin-scranton.sip.twilio.com",
10
"friendly_name": "Scranton Office",
11
"sip_registration": true,
12
"sid": "SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
13
"subresource_uris": {
14
"credential_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialListMappings.json",
15
"ip_access_control_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlListMappings.json"
16
},
17
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
18
"voice_fallback_method": "POST",
19
"voice_fallback_url": null,
20
"voice_method": "POST",
21
"voice_status_callback_method": "POST",
22
"voice_status_callback_url": null,
23
"voice_url": "https://dundermifflin.example.com/twilio/app.php",
24
"emergency_calling_enabled": true,
25
"secure": true,
26
"byoc_trunk_sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
27
"emergency_caller_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
28
}
29
],
30
"start": 0,
31
"end": 0,
32
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains.json?PageSize=50&Page=0",
33
"next_page_uri": null,
34
"page": 0,
35
"page_size": 50,
36
"previous_page_uri": null,
37
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains.json?PageSize=50&Page=0"
38
}

Update a SipDomain resource

update-a-sipdomain-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the SipDomain resource to update.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SD>required

The Twilio-provided string that uniquely identifies the SipDomain resource to update.

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestringOptional

A descriptive string that you created to describe the resource. It can be up to 64 characters long.


VoiceFallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

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


VoiceMethodenum<http-method>Optional

The HTTP method we should use to call voice_url

Possible values:
GETPOST

VoiceStatusCallbackMethodenum<http-method>Optional

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

Possible values:
GETPOST

VoiceStatusCallbackUrlstring<uri>Optional

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


VoiceUrlstring<uri>Optional

The URL we should call when the domain receives a call.


SipRegistrationbooleanOptional

Whether to allow SIP Endpoints to register with the domain to receive calls. Can be true or false. true allows SIP Endpoints to register with the domain to receive calls, false does not.


DomainNamestringOptional

The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and "-" and must end with sip.twilio.com.


EmergencyCallingEnabledbooleanOptional

Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses.


SecurebooleanOptional

Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain.


ByocTrunkSidSID<BY>Optional

The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34

EmergencyCallerSidSID<PN>Optional

Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call.

Pattern: ^PN[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateSipDomain() {
11
const domain = await client.sip
12
.domains("SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.update({ friendlyName: "friendly_name" });
14
15
console.log(domain.accountSid);
16
}
17
18
updateSipDomain();

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"api_version": "2010-04-01",
4
"auth_type": "IP_ACL",
5
"date_created": "Mon, 20 Jul 2015 17:27:10 +0000",
6
"date_updated": "Mon, 20 Jul 2015 17:27:10 +0000",
7
"domain_name": "dunder-mifflin-scranton.sip.twilio.com",
8
"friendly_name": "friendly_name",
9
"sip_registration": true,
10
"sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
11
"subresource_uris": {
12
"credential_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialListMappings.json",
13
"ip_access_control_list_mappings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlListMappings.json"
14
},
15
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
16
"voice_fallback_method": "POST",
17
"voice_fallback_url": null,
18
"voice_method": "POST",
19
"voice_status_callback_method": "POST",
20
"voice_status_callback_url": null,
21
"voice_url": "https://dundermifflin.example.com/twilio/app.php",
22
"emergency_calling_enabled": true,
23
"secure": true,
24
"byoc_trunk_sid": "BYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"emergency_caller_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
26
}

Delete a SipDomain resource

delete-a-sipdomain-resource page anchor
DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the SipDomain resources to delete.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SD>required

The Twilio-provided string that uniquely identifies the SipDomain resource to delete.

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteSipDomain() {
11
await client.sip.domains("SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").remove();
12
}
13
14
deleteSipDomain();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.