Git Product home page Git Product logo

twiliodeved / browser-calls-rails Goto Github PK

View Code? Open in Web Editor NEW
21.0 23.0 10.0 3.09 MB

A sample application which shows you how to make and receive phone calls with a browser and Twilio Client

Home Page: https://www.twilio.com/docs/voice/sdks/javascript/get-started

License: MIT License

Ruby 61.33% JavaScript 14.47% CSS 2.02% HTML 20.00% Shell 1.38% Dockerfile 0.44% Makefile 0.35%
ruby rails twilio calls voice-url twilio-voice

browser-calls-rails's Introduction

Twilio

Browser Calls - Rails

This repository is now archived and is no longer being maintained. Check out the JavaScript SDK Quickstarts to get started with browser-based calling.

About

Learn how to use Twilio's JavaScript SDK to make browser-to-phone and browser-to-browser calls with ease. The unsatisfied customers of the Birchwood Bicycle Polo Co. need your help!

Set up

Requirements

Twilio Account Settings

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

Config Value Description
TWILIO_ACCOUNT_SID Your primary Twilio account identifier - find this in the Console.
TWILIO_PHONE_NUMBER A Twilio phone number in E.164 format - you can get one here
TWIML_APPLICATION_SID The TwiML application with a voice URL configured to access your server running this app - create one in the console here and use its Sid. Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running.
TWILIO_API_KEY / TWILIO_API_SECRET Your REST API Key information needed to create an Access Token - create one here.

Create a TwiML App

This project is configured to use a TwiML App, which allows us to easily set the voice URLs for all Twilio phone numbers we purchase in this app.

Create a new TwiML app at https://www.twilio.com/console/voice/twiml/apps and use its Sid as the TWIML_APPLICATION_SID environment variable wherever you run this app.

See the end of the "Local development" section for details on the exact URL to use in your TwiML app.

Local development

  1. First clone this repository and cd into it.

    git clone [email protected]:TwilioDevEd/browser-calls-rails.git
    cd browser-calls-rails
    
  2. Install the dependencies.

    make install
  3. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

  4. Create database and run migrations.

    make setup-serve
  5. Run the server, will run on port 3000.

    make serve
  6. Expose your application to the wider internet using ngrok. This step is important because the application won't work as expected if you run it through localhost.

    ngrok http 3000
  7. Once you have started ngrok, update your TwiML app's Voice URL setting to use your ngrok hostname, so it will look something like this:

    http://<your-ngrok-subdomain>.ngrok.io/call/connect
    

    You can read this blog post for more details on how to use ngrok.

  8. Everything is setup, now you can open two tabs in the browser to test the application.

    • To create a support ticket go to the home page. On this page you could fill some fields and create a ticket or you can call to support: http://localhost:3000

    • To respond to support tickets go to the dashboard page (you should open two windows or tabs). On this page you could call customers and answers phone calls: http://localhost:3000/dashboard

That's it!

Docker

If you have Docker already installed on your machine, you can use our docker-compose.yml to setup your project.

  1. Make sure you have the project cloned.
  2. Setup the .env file as outlined in the Local Development steps.
  3. Run docker-compose up.
  4. Follow the steps in Local Development on how to expose your port to Twilio using a tool like ngrok and configure the remaining parts of your application.

Tests

You can run the tests locally by typing:

bundle exec rspec

Resources

  • The CodeExchange repository can be found here.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

browser-calls-rails's People

Contributors

7kaji avatar acamino avatar bld010 avatar dependabot-preview[bot] avatar dependabot[bot] avatar hortega avatar joliveros avatar jonedavis avatar kwhinnery avatar maylonpedroso avatar rojastob avatar tomershvueli avatar well1791 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

browser-calls-rails's Issues

Code Exchange quality checklist

The purpose of this checklist is to assess the state of this repository, and bring it to an acceptable level for long-term support by completing the tasks listed below.

This checklist is used internally but can be used as a guidance for others

Please check every part of this checklist for us to process your request. You can do this by marking them with [x] instead of [ ].

Documentation

  • LICENSE file exists in repository

  • Code of Conduct exists in repository

  • CONTRIBUTING exists in repository

  • No broken links in README.md

  • Build status exists at top of README.md

  • Set up steps are complete and accurate

  • CodeExchange repository is linked in README.md

GitHub

  • Dependabot set up

  • Dependabot automerge set up

  • Uses GitHub Actions (required for Twilio sample) or other CI

Code

  • Packages/dependencies are up to date

  • Code compiles against latest packages/dependencies

  • Matches CodeExchange Guidelines to the best of ability

Tests

  • Functionality tests have been created

  • All tests pass

App

  • Confirmed sample behaves as expected (after dependencies have been updated)

  • This file has been copied into a wiki entry for the respective repository or added as a GitHub issue

General

  • App is released under a permissive license like MIT or Apache-2

  • I've read and followed the contribution guidelines

  • I've read and implemented my template according to the respective coding guidelines for my project

  • I agree and adhere to the Code of Conduct

  • The template has been authored by me / or my organization and will be kept up-to-date. If the template will not longer be maintained, I'll notify this project.

Improve assets.

On next branch: Modify the app/javascript/packs/application.js to include the assets which are going to be served through webpack and move all assets to app/javascript as described on the webpacker documentation. See more context here.

Note: After moving the file browser-calls.js to app/javascript/packs it will need some changes because variables and functions will not be exposed globally.

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.