We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at github.com/twilio-labs/code-exchange/issues and we'll try to help you.
Learn how to use Twilio Client to make browser-to-phone and browser-to-browser calls with ease. The unsatisfied customers of the Birchwood Bicycle Polo Co. need your help!
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/phone-numbers/dev-tools/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.
This project is built using the Ruby on Rails web framework. It runs on Ruby 2.3.1.
-
First clone this repository and
cd
into it:git clone git@github.com:TwilioDevEd/browser-calls-rails.git cd browser-calls-rails
-
Install the dependencies
$ bundle
-
Copy the sample configuration file and edit it to match your configuration
$ cp .env.example .env
You can find your
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
in your Twilio Account Settings. You will also need aTWILIO_NUMBER
, which you may find here.Run
source .env
to export the environment variables -
Create database and run migrations
Make sure you have installed PostgreSQL. If on a Mac, I recommend Postgres.app.
$ bundle exec rake db:setup
-
Make sure the tests succeed
$ bundle exec rspec
-
Run the server
$ bundle exec rails s
-
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
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.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.