GithubHelp home page GithubHelp logo

nuzayats / client-quickstart-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twiliodeved/client-quickstart-java

0.0 2.0 1.0 8 KB

Twilio Client Quickstart App

License: MIT License

PowerShell 8.61% Java 19.25% HTML 11.09% JavaScript 35.05% CSS 26.00%

client-quickstart-java's Introduction

Twilio Client Quickstart for Java

This application should give you a ready-made starting point for writing your own video apps with Twilio Video. Before we begin, we need to collect all the config values we need to run the application:

This application should give you a ready-made starting point for writing your own voice apps with Twilio Client. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account SID Your primary Twilio account identifier - find this in the console here.
Auth Token Used to authenticate - just like the above, you'll find this here.
TwiML App SID The TwiML application with a voice URL configured to access your server running this app - create one in the console here. Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running.
Twilio Phone # A Twilio phone number in E.164 format - you can get one here

Setting Up The Java Application

This application uses the lightweight Spark Framework, and requires Java 8 and Maven.

Mac & Linux

Begin by creating a configuration file for your application:

cp .env.example .env

Edit .env with the four configuration parameters we gathered from above. Export the configuration in this file as system environment variables like so on Unix based systems:

source .env

Windows (PowerShell)

Begin by creating a configuration file for your application:

cp .env.example.ps1 .env.ps1

Edit .env.ps1 with the four configuration parameters we gathered from above. "Dot-source" the file in PowerShell like so:

. .\.env.ps1

This assumes you will run the application in the same PowerShell session. If not, edit the .env.ps1 and uncomment the [Environment]::SetEnvironmentVariable calls. After re-running the script, the environment variables will be peramently set for your user account.

All Platforms

Next, we need to install our depenedencies from Maven:

mvn install

And compile our application code:

mvn package

Run the application using the java -jar command.

java -jar target/video-quickstart-1.0-SNAPSHOT.jar

Your application should now be running at http://localhost:4567.

There's just a few more steps to get Twilio's voice infrastructure talking to your server.

  1. Download and install ngrok

  2. Run ngrok:

    ngrok http 4567
  3. When ngrok starts up, it will assign a unique URL to your tunnel. It might be something like https://asdf456.ngrok.io. Take note of this.

  4. Configure your TwiML app's Voice "REQUEST URL" to be your ngrok URL plus /voice. For example:

    screenshot of twiml app

You should now be ready to rock! Make some phone calls. Open it on another device and call yourself. Note that Twilio Client requires WebRTC enabled browsers, so Edge and Internet Explorer will not work for testing. We'd recommend Google Chrome or Mozilla Firefox instead.

screenshot of phone app

License

MIT

client-quickstart-java's People

Watchers

 avatar  avatar

Forkers

lisb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.