Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (58 sloc) 2.82 KB

Click to Call Spring

Build Status

An example application implementing Click to Call using Twilio.

Run the application

  1. Clone the repository and cd into it.

  2. The application uses Gradle to manage dependencies.

  3. Edit the sample configuration file .env.example and edit it to match your configuration.

    Once you have edited the .env.example file, if you are using a unix operating system, just use the source command to load the variables into your environment:

    $ source .env.example

    If you are using a different operating system, make sure that all the variables from the .env.example file are loaded into your environment.

    You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN under your Twilio Account Settings. You can buy Twilio phone numbers at Twilio numbers TWILIO_NUMBER should be set to the phone number you purchased above.

  4. Configure Twilio to call your webhooks

    You will also need to configure Twilio to call your application when calls are received.

    You will need to provision at least one Twilio number with voice capabilities so the application's users can trigger phone calls. You can buy a number right here. Once you have a number you need to configure it so that it works with your application. Open the number management page and open the number's configuration by clicking on it.

    Remember that the number where you change the voice webhooks must be the same one you set on the TWILIO_NUMBER environment variable.

    Configure Voice

  5. Run the application using Gradle. The --debug option is helpful to view full request and response logs.

    $ ./gradlew bootRun --debug

    This will run the application on port 8080.

  6. Expose the application to the wider Internet using ngrok

    $ ngrok 8080

    Configure your Twilio's number voice URL to match your ngrok URL. Also, be sure to set the Webhook method to GET in your Twilio Console. It should look something like this:

    http://<your-ngrok-subdomain>.ngrok.io/connect
    
  7. Next, open the following url in your browser:

    http://<your-ngrok-subdomain>.ngrok.io/index.html
    

Dependencies

This application uses this Twilio helper library.

Run the tests

  1. Run at the top-level directory.

    $ ./gradlew test
You can’t perform that action at this time.