Skip to content
Warm transfer implementation with Flask and Twilio
Python HTML JavaScript Mako CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
migrations
tests
warm_transfer_flask
.env
.gitignore
.travis.yml
README.md
manage.py
requirements.txt

README.md

Warm Transfer: Transfer support calls from one agent to another using Flask

Build Status

Local development

This project is built using the Flask web framework.

  1. Clone this repository and cd into it.

  2. Create a new virtual environment.

  3. Install the requirements.

    pip install -r requirements.txt
    
  4. Copy the sample configuration file and edit it to match your configuration.

$ cp .env.example .env

You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN in your Twilio Account Settings. You will also need a TWILIO_NUMBER that you may find here.

Run source .env to export the environment variables.

  1. Run the migrations.

    Our app uses SQLite, so you probably will not need to install additional software.

    python manage.py db upgrade
    
  2. Expose your application to the wider internet using ngrok.

    To actually forward incoming calls, your development server will need to be publicly accessible. We recommend using ngrok to solve this problem.

    $ ngrok http 5000

    Once you have started ngrok, the public accessible URL will look like this:

    https://<your-ngrok-id>.ngrok.io/
    
  3. Start the development server.

    python manage.py runserver
    
  4. Configure Twilio to call your webhooks.

You will also need to configure Twilio to call your application when calls are received on your TWILIO_NUMBER. The voice URL should look something like this:

http://<your-ngrok-id>.ngrok.io/conference/connect/client

Configure Voice

That's it!

How to Demo

  1. Navigate to https://<ngrok_subdomain>.ngrok.io in two different browser tabs or windows.

    Notes:

    • Remember to use your SSL enabled ngrok URL https. Failing to do this won't allow you to receive incoming calls.

    • The application has been tested with Chrome and Firefox. Safari is not supported at the moment.

  2. In one window/tab click Connect as Agent 1 and in the other one click Connect as Agent 2. Now both agents are waiting for an incoming call.

  3. Dial your Twilio Number to start a call with Agent 1. Your TWILIO_NUMBER environment variable was set when configuring the application to run.

  4. When Agent 1 answers the call from the client, he/she can dial Agent 2 in by clicking on the Dial agent 2 in button.

  5. Once Agent 2 answers the call all three participants will have joined the same call. After that, Agent 1 can drop the call and leave both the client and Agent 2 having a pleasant talk.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.
You can’t perform that action at this time.