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.
-
Clone this repository and
cd
into its directory:git clone git@github.com:TwilioDevEd/ivr-recording-django.git cd ivr-recording-django
-
The file
ivr/fixtures/agents.json
contains the agents phone numbers. Replace any of these phone numbers with yours.When the application asks you to select an agent, choose the one you just modified and it will then call your phone.
-
Create a local virtual environment and activate it:
python -m venv venv && source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Set environment variables:
cp .env.example .env
Then add a value to
SECRET_KEY
.Note:
DEBUG
variable is False by default. Feel free to update it to True if needed. -
Set up database and run migrations:
python manage.py migrate
-
Load initial agents' data:
python manage.py loaddata ivr/fixtures/agents.json
-
Make sure the tests succeed:
python manage.py test
-
Run the application:
python manage.py runserver
-
Check it out at http://localhost:8000/ivr. You can go to the agents page to see and listen the saved recordings.
-
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 8000
-
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.