Skip to content

Latest commit

 

History

History

caller-id-forwarding

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Caller ID with Call Forwarding

This Function in forward-call.js will complete 3 steps:

  1. Look up the incoming call number using the Twilio Lookup API
  2. Send an SMS to the forwarding number with Caller ID information
  3. Forward the incoming call to a number that is set in the environment variables.

Note: caller-name lookup is currently only available in the US.

Environment variables

This Function expects one environment variable to be set.

Variable Meaning
MY_PHONE_NUMBER The number you want to forward incoming messages to in E.164 format

Parameters

This Function expects the incoming request to be a voice webhook. The parameter used is From.

Create a new project with the template

  1. Install the Twilio CLI
  2. Install the serverless toolkit
twilio plugins:install @twilio-labs/plugin-serverless
  1. Initiate a new project
twilio serverless:init caller-id-forwarding --template=caller-id-forwarding
cd caller-id-forwarding
  1. Add your environment variables to .env:

Make sure variables are populated in your .env file. See Environment variables.

  1. Deploy

Deploy your functions and assets with the following commands. Note: you must run the command from inside your project folder. More details in the docs.

With the Twilio CLI:

twilio serverless:deploy
  1. Connect your Twilio phone number to your callback URL:

Replace the phone number with your Twilio Number and the voice-url with your deployed URL. You can also do this in the console settings page for the phone number.

twilio api:core:phone-numbers:update +11111111111 --voice-url https://YOUR_URL_HERE/twil.io/forward-call