IVRs (interactive voice response) are automated phone systems that can facilitate communication between callers and businesses. In this tutorial you will learn how to screen and send callers to voicemail if an agent is busy.
-
This sample application stores data in a MongoDB database using Mongoose. You can download and run MongoDB yourself (OS X, Linux, Windows).
On OS X, maybe the easiest way to get MongoDB running locally is to install via Homebrew:
brew tap mongodb/brew brew install mongodb-community
You should then be able to run a local server with:
brew services start mongodb-community
-
Clone this repository and
cd
into its directory:git clone git@github.com:TwilioDevEd/ivr-recording-node.git cd ivr-recording-node
-
Copy the sample configuration file and edit it to match your configuration.
$ cp .env.example .env
-
The file
seed/agents.js
contains the agents phone numbers. Replace any of these phone numbers with yours. Then seed the initial data into the database by running the following:mongo localhost/call-screening seed/agents.js
When the application asks you to select an agent, choose the one you just modified and it will then call your phone.
-
Install dependencies:
npm install
-
Make sure the tests succeed:
npm test
-
Run the application:
npm start
-
Check it out at http://localhost:3000
-
Expose the application to the wider Internet using ngrok To let our Twilio Phone number use the callback endpoint we exposed, our development server will need to be publicly accessible. We recommend using ngrok to solve this problem.
ngrok http 3000
-
Provision a number under the Manage Numbers page on your account. Set the voice URL for the number to
http://<your-ngrok-subdomain>.ngrok.io/ivr/welcome
.
That's it!
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.