Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Emergency Calling for SIP Trunking API


This page covers how to use Twilio's REST API to configure a SIP Trunk Phone Number's emergency Address. Before proceeding, you must read the SIP Trunking Emergency Calling doc.

Don't want to use the REST API? You can also use the Console to configure emergency calling Addresses. See the SIP Trunking Emergency Calling doc for more information.


Emergency Addresses

emergency-addresses page anchor

Before you can configure a Twilio Phone Number for emergency calling, you need to create an emergency Address. An emergency Address is an Address resource with the emergency_enabled property set to true.

You can use the same emergency Address for multiple Phone Numbers if appropriate.

Create a new emergency Address

create-a-new-emergency-address page anchor

To create a new emergency Address resource via REST API, create a new Address resource with the emergency_enabled parameter set to true. An example request is shown below.

Create a new emergency Address

create-a-new-emergency-address-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = require('twilio')(accountSid, authToken);
_19
_19
client.addresses
_19
.create({
_19
friendlyName: 'Twilio',
_19
emergencyEnabled: true,
_19
customerName: 'Twilio',
_19
street: '645 Harrison St.',
_19
city: 'San Francisco',
_19
region: 'CA',
_19
postalCode: '94105',
_19
isoCountry: 'US'
_19
})
_19
.then(address => console.log(address.sid));

Output

_18
{
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"city": "San Francisco",
_18
"customer_name": "Twilio",
_18
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"emergency_enabled": true,
_18
"friendly_name": "Twilio",
_18
"iso_country": "US",
_18
"postal_code": "94105",
_18
"region": "CA",
_18
"sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"street": "645 Harrison St.",
_18
"street_secondary": null,
_18
"validated": false,
_18
"verified": false,
_18
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Addresses/ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_18
}

The response to this request contains a sid property. This is the Address's SID, which you need when configuring your Phone Numbers.

Use an existing Address resource as an emergency Address

use-an-existing-address-resource-as-an-emergency-address page anchor

If you already have an Address resource you wish to use as an emergency Address, update the Address resource so that the emergency_enabled property is true as shown in the example below.

Use an existing Address resource as an emergency Address

use-an-existing-address-resource-as-an-emergency-address-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.addresses('ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({emergencyEnabled: true})
_10
.then(address => console.log(address.customerName));

Output

_18
{
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"city": "SF",
_18
"customer_name": "name",
_18
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"emergency_enabled": true,
_18
"friendly_name": null,
_18
"iso_country": "US",
_18
"postal_code": "94019",
_18
"region": "CA",
_18
"sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"street": "4th",
_18
"street_secondary": null,
_18
"validated": false,
_18
"verified": false,
_18
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Addresses/ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_18
}


Associate an emergency Address with a Phone Number

associate-an-emergency-address-with-a-phone-number page anchor

Once you've created an emergency Address, you need to update the IncomingPhoneNumber resource's emergency_address_sid property with the emergency Address SID, as shown in the code sample below.

This request requires the SID of the Phone Number. You can find the SIDs of your SIP Trunk's Phone Numbers using the PhoneNumber Subresource.

Associate an emergency Address with a Phone Number

associate-an-emergency-address-with-a-phone-number-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({emergencyAddressSid: 'ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'})
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Inactive",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": true,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}


Check a Phone Number's emergency Address status

check-a-phone-numbers-emergency-address-status page anchor

You can check on the status of a Phone Number's emergency Address registration by fetching the IncomingPhoneNumber resource and checking the value of the emergency_address_status property. An example of this request is shown below.

Check the emergency Address registration status of a Phone Number

check-the-emergency-address-registration-status-of-a-phone-number page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Active",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": false,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}


Remove an emergency Address from a Phone Number

remove-an-emergency-address-from-a-phone-number page anchor

To remove an emergency Address from a Phone Number, you need to remove the emergency_address_sid from the IncomingPhoneNumber resource as shown in the example below.

Remove an emergency_address_sid from a Phone Number

remove-an-emergency_address_sid-from-a-phone-number page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.incomingPhoneNumbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({emergencyAddressSid: ''})
_10
.then(incoming_phone_number => console.log(incoming_phone_number.friendlyName));

Output

_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"address_requirements": "none",
_41
"address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"beta": false,
_41
"capabilities": {
_41
"voice": true,
_41
"sms": false,
_41
"mms": true,
_41
"fax": false
_41
},
_41
"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_41
"emergency_status": "Inactive",
_41
"emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"emergency_address_status": "registered",
_41
"friendly_name": "(808) 925-5327",
_41
"identity_sid": "RIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"origin": "origin",
_41
"phone_number": "+18089255327",
_41
"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"sms_application_sid": "",
_41
"sms_fallback_method": "POST",
_41
"sms_fallback_url": "",
_41
"sms_method": "POST",
_41
"sms_url": "",
_41
"status_callback": "",
_41
"status_callback_method": "POST",
_41
"trunk_sid": null,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_41
"voice_application_sid": "",
_41
"voice_caller_id_lookup": true,
_41
"voice_fallback_method": "POST",
_41
"voice_fallback_url": null,
_41
"voice_method": "POST",
_41
"voice_url": null,
_41
"voice_receive_mode": "voice",
_41
"status": "in-use",
_41
"bundle_sid": "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_41
}

After this request, you should check the emergency Address registration status of the Phone Number to ensure the de-registration of that emergency Address.


Change an emergency Address for a Phone Number

change-an-emergency-address-for-a-phone-number page anchor

To change a Phone Number's emergency Address, you need to follow the steps listed below.

  1. Remove the emergency_address_sid from the IncomingPhoneNumber resource .
  2. Check the emergency Address registration status of the Phone Number . Wait until the emergency_address_status is unregistered before proceeding.
  3. Update the IncomingPhoneNumber resource's emergency_address_sid with the new emergency Address SID.
  4. Check the emergency Address registration status of the Phone Number . Once the emergency_address_status is registered , the Phone Number has been successfully updated.

Delete an emergency Address

delete-an-emergency-address page anchor

If you wish to delete an emergency Address, you must first make sure that it is no longer associated with any IncomingPhoneNumber resources (or any other Twilio resource).

You can then delete the Address resource, as shown in the sample request below.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.addresses('ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: