/call-forwarding-spark

A sample implementation of advanced call forwarding using Twilio with Java and Spark.

Primary LanguageJavaMIT LicenseMIT

Twilio

Advanced Call Forwarding with Java, Spark, and Twilio

Build Status

Learn how to use Twilio to forward a series of phone calls to your state senators.

Local Development

This project is built using the Spark web framework.

To run the app locally, follow these steps:

  1. Clone this repository and cd into it.

    git clone git@github.com:TwilioDevEd/call-forwarding-spark.git
    cd call-forwarding-spark
  2. Copy the sample configuration file and edit it to match your database configuration.

    cp .env.example .env
  3. Create application database: Make sure you have installed PostgreSQL. If on a Mac, I recommend Postgres.app.

    createdb call_forwarding
  4. Execute the migrations.

    ./gradlew flywayMigrate
  5. Expose your application to the internet using ngrok. In a separate terminal session, start ngrok with:

    ngrok http 9292

    Once you have started ngrok, update your TwiML application's voice URL setting to use your ngrok hostname. It will look something like this in your Twilio console:

    https://d06f533b.ngrok.io/callcongress/welcome
    
  6. Start your development server:

    ./gradlew run

    Once ngrok is running, open up your browser and go to your ngrok URL.

Run the Tests

./gradlew test

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.