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.
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.
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.
_25// Download the helper library from https://www.twilio.com/docs/node/install
_25const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_25// Find your Account SID and Auth Token at twilio.com/console
_25// and set the environment variables. See http://twil.io/secure
_25const accountSid = process.env.TWILIO_ACCOUNT_SID;
_25const authToken = process.env.TWILIO_AUTH_TOKEN;
_25const client = twilio(accountSid, authToken);
_25async function createAddress() {
_25 const address = await client.addresses.create({
_25 city: "San Francisco",
_25 customerName: "Twilio",
_25 emergencyEnabled: true,
_25 friendlyName: "Twilio",
_25 street: "645 Harrison St.",
_25 console.log(address.accountSid);
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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 "postal_code": "94105",
_18 "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "street": "645 Harrison St.",
_18 "street_secondary": null,
_18 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
The response to this request contains a sid
property. This is the Address's SID, which you need when configuring your Phone Numbers.
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.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function updateAddress() {
_18 const address = await client
_18 .addresses("ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .update({ emergencyEnabled: true });
_18 console.log(address.accountSid);
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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 "postal_code": "94019",
_18 "sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "street_secondary": null,
_18 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
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.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function updateIncomingPhoneNumber() {
_18 const incomingPhoneNumber = await client
_18 .incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .update({ emergencyAddressSid: "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" });
_18 console.log(incomingPhoneNumber.accountSid);
_18updateIncomingPhoneNumber();
_44 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "address_requirements": "none",
_44 "address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "api_version": "2010-04-01",
_44 "date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "emergency_status": "Inactive",
_44 "emergency_address_sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_44 "emergency_address_status": "registered",
_44 "friendly_name": "(808) 925-5327",
_44 "identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "phone_number": "+18089255327",
_44 "sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "sms_application_sid": "",
_44 "sms_fallback_method": "POST",
_44 "sms_fallback_url": "",
_44 "sms_method": "POST",
_44 "status_callback": "",
_44 "status_callback_method": "POST",
_44 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44 "voice_application_sid": "",
_44 "voice_caller_id_lookup": true,
_44 "voice_fallback_method": "POST",
_44 "voice_fallback_url": null,
_44 "voice_method": "POST",
_44 "voice_receive_mode": "voice",
_44 "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "subresource_uris": {
_44 "assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
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.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function fetchIncomingPhoneNumber() {
_18 const incomingPhoneNumber = await client
_18 .incomingPhoneNumbers("PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18 console.log(incomingPhoneNumber.accountSid);
_18fetchIncomingPhoneNumber();
_44 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "address_requirements": "none",
_44 "address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "api_version": "2010-04-01",
_44 "date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "emergency_status": "Active",
_44 "emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "emergency_address_status": "registered",
_44 "friendly_name": "(808) 925-5327",
_44 "identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "phone_number": "+18089255327",
_44 "sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_44 "sms_application_sid": "",
_44 "sms_fallback_method": "POST",
_44 "sms_fallback_url": "",
_44 "sms_method": "POST",
_44 "status_callback": "",
_44 "status_callback_method": "POST",
_44 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44 "voice_application_sid": "",
_44 "voice_caller_id_lookup": false,
_44 "voice_fallback_method": "POST",
_44 "voice_fallback_url": null,
_44 "voice_method": "POST",
_44 "voice_receive_mode": "voice",
_44 "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "subresource_uris": {
_44 "assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
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.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function updateIncomingPhoneNumber() {
_18 const incomingPhoneNumber = await client
_18 .incomingPhoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .update({ emergencyAddressSid: "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });
_18 console.log(incomingPhoneNumber.accountSid);
_18updateIncomingPhoneNumber();
_44 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "address_requirements": "none",
_44 "address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "api_version": "2010-04-01",
_44 "date_created": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",
_44 "emergency_status": "Inactive",
_44 "emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "emergency_address_status": "registered",
_44 "friendly_name": "(808) 925-5327",
_44 "identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "phone_number": "+18089255327",
_44 "sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "sms_application_sid": "",
_44 "sms_fallback_method": "POST",
_44 "sms_fallback_url": "",
_44 "sms_method": "POST",
_44 "status_callback": "",
_44 "status_callback_method": "POST",
_44 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_44 "voice_application_sid": "",
_44 "voice_caller_id_lookup": true,
_44 "voice_fallback_method": "POST",
_44 "voice_fallback_url": null,
_44 "voice_method": "POST",
_44 "voice_receive_mode": "voice",
_44 "bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_44 "subresource_uris": {
_44 "assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"
After this request, you should check the emergency Address registration status of the Phone Number to ensure the de-registration of that emergency Address.
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.
_14// Download the helper library from https://www.twilio.com/docs/node/install
_14const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_14// Find your Account SID and Auth Token at twilio.com/console
_14// and set the environment variables. See http://twil.io/secure
_14const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14const authToken = process.env.TWILIO_AUTH_TOKEN;
_14const client = twilio(accountSid, authToken);
_14async function deleteAddress() {
_14 await client.addresses("ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").remove();