Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

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 nameTypeRequiredPIIDescriptionChild properties
endinteger

Optional

Not PII

firstPageUristring<uri>

Optional


nextPageUristring<uri>

Optional


pageinteger

Optional


pageSizeinteger

Optional


previousPageUristring<uri>

Optional


startinteger

Optional


uristring<uri>

Optional


domainsarray[object]

Optional


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 nameTypeRequiredPIIDescriptionChild properties
domainNamestring
required

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.


friendlyNamestring

Optional

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

sipRegistrationboolean

Optional

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.


emergencyCallingEnabledboolean

Optional

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


secureboolean

Optional

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();

Response

Note about this response
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();

Response

Note about this response
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
pageSizeinteger<int64>

Optional

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

Minimum: 1Maximum: 1000

pageinteger

Optional

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

Minimum: 0

pageTokenstring

Optional

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.end));
14
}
15
16
listSipDomain();

Response

Note about this response
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 nameTypeRequiredPIIDescriptionChild properties
friendlyNamestring

Optional

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.


sipRegistrationboolean

Optional

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.


domainNamestring

Optional

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.


emergencyCallingEnabledboolean

Optional

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


secureboolean

Optional

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();

Response

Note about this response
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();