Configuring Phone Numbers to Receive Voice Calls

All newly purchased Twilio numbers will automatically answer incoming voice calls with a default sample recording. Read on for instructions on changing this behavior.

For Twilio Programmable SMS number configuration, please see Configuring Phone Numbers to Receive and Respond to SMS and MMS Messages.

Configure a Phone Number to Block Incoming Calls

There are a number of options for blocking or ignoring incoming calls. For full details, please see our article How Can I Stop Receiving or Block Phone Calls?

Configure a Phone Number to Receive Calls

Twilio Phone numbers require instructions for handling incoming voice calls. To get these instructions, Twilio checks the configuration of each phone number when an inbound communication arrives. Here are the different options, and how to configure your phone number for each of them:

  • Webhook: Webhooks are applications at external URLs that respond Twilio's HTTP requests with coded instructions. This option is recommended for Twilio users who want a completely customizable Twilio application. For more information, please see our Webhooks Glossary page.
  • TwiML Bin: TwiML Bins allow you to write TwiML that Twilio will host for you - so you can quickly prototype a solution without spinning up a web server. This option is recommended for Twilio users who want to get a prototype up and running quickly, or those without their own web hosting. For more information, please see this TwiML Bins blog post.
  • Function (Beta): Functions are Twilio-hosted Node.js webhooks for responding to Twilio's HTTP requests with coded instructions. This option is recommended for Twilio users who don't have their own web hosting, and want a versatile solution that can be as simple or complex as needed. For more information, please see the Twilio Functions landing page.
  • Studio Flow (Beta): Twilio Studio is a flowchart-style visual interface to design, deploy, and scale customer communications. This option is recommended for Twilio users who aren't familiar with code, don't have their own web hosting, or just want to get up and running as quickly as possible. For more information, please see the Twilio Studio landing page.
  • Proxy Service (Beta): Twilio Proxy lets you build a masked communications experience for your users, without exposing their personal information. For more information, please see the Twilio Proxy landing page.
  • TwiML App: TwiML Applications are a reusable set of URLs and other configuration data for responding to Twilio. They allows you to update the app only, and have these changes automatically roll out to each configured phone number. For more information, please see our Applications REST API Resource page.
  • Elastic SIP Trunk: Twilio Elastic SIP Trunking connects your IP-based communications infrastructure to PSTN for making and receiving voice calls. For more information, please see our Elastic SIP Trunking documentation.

How do you respond? Your Twilio response will vary depending on your use case and business needs. For more information on how Twilio Programmable Voice works, please see our tutorial Respond to Incoming Phone Calls.

Respond with a Webhook

Update via Console

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_1_webhook.png 
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: Webhooks, TwiML Bins, Functions, Studio, or Proxy
    • A CALL COMES IN: Webhook
    • INPUT FIELD: Enter the URL for your Twilio response code.
  5. When finished, click Save.

Update via an API request

The Webhook can also be updated by submitting an HTTP POST with the VoiceUrl parameter to the IncomingPhoneNumber REST API Resource. Here's an example cURL script for updating my webhook:

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json \
--data-urlencode "VoiceUrl=http://www.mysite.com/twilio" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'

This example will update the webhook on phone number PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX to point incoming requests to www.mysite.com/twilio. To make this script work for you, make the following updates, and then paste it into a terminal window:

For additional help, please see IncomingPhoneNumbers in API Explorer, or our IncomingPhoneNumber REST API resource documentation.

Respond with a TwiML Bin

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_2_TwiMLBin.png 
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: Webhooks, TwiML Bins, Functions, Studio, or Proxy
    • A CALL COMES IN: TwiML
    • DROP-DOWN MENU: Select the previously saved TwiML Bin.
      NOTE: A new TwiML Bin may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save. 

Respond with a Function

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_3_function.png
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: Webhooks, TwiML Bins, Functions, Studio, or Proxy
    • A CALL COMES IN: Function
    • DROP-DOWN MENU: Select the previously saved function.
      NOTE: A new Function may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save.

Respond with a Studio Flow (Beta)

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_4_studio.png
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: Webhooks, TwiML Bins, Functions, Studio, or Proxy
    • A CALL COMES IN: Studio Flow
    • DROP-DOWN MENU: Select the previously saved flow.
      NOTE: A new flow may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save.

Respond with a Proxy Service (Beta)

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_5_proxy.png
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: Webhooks, TwiML Bins, Functions, Studio, or Proxy
    • A CALL COMES IN: Proxy Service
    • DROP-DOWN MENU: Select the previously saved proxy.
      NOTE: A new proxy may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save.

Respond with a TwiML App

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_6_TwiMLApp.png
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: TwiML App
    • TWIML APP: Select the previously saved TwiML App.
      NOTE: A new app may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save.

Respond with an Elastic SIP Trunk

  1. Login to your account at www.twilio.com/console.
  2. Click Phone Numbers Icon_Numbers.png from the left-side navigation bar.
    NOTE: If Phone Numbers is not visible, you may first need to click All Products & Services.
  3. Click the desired phone number to modify.
  4. Scroll to the Voice & Fax section, and then modify the phone number’s routing:
    Voice_7_trunk.png
    • ACCEPT INCOMING: Voice Calls
    • CONFIGURE WITH: SIP Trunk
    • SIP TRUNK: Select the previously saved trunk.
      NOTE: A new trunk may not be immediately visible; try refreshing the page if you don't see it at first.
  5. When finished, click Save.

 

Have more questions? Submit a request
Powered by Zendesk