Skip to content

Using AnyCable and Hanami to build an app to process Twilio Media streams

Notifications You must be signed in to change notification settings

anycable/anycable-twilio-hanami-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnyCable + Twilio Media Streams + Hanami

This repository contains example applications demonstrating how to build phone calls processing pipelines with Twilio Media Streams, AnyCable-Go and Ruby (Hanami).

Read more in the "AnyCable off Rails: connecting Twilio streams with Hanami" blog post.

The example application peforms speech recognition (via Vosk) and shows results in a web browser.

Quick start (w/ Twilio)

You need a Twilio account and a phone number to use this demo. Create one, copy the .env.sample into .env (within the kaisen folder) and populate with the required Twilio information.

Then, start all the components:

  • Start Ngrok: ngrok http 8080.
  • Start Hanami application with NGrok url provided: (cd kaisen && TWILIO_CABLE_URL=wss://<some-id>.ngrok.io/streams hanami server). IMPORTANT: The url must have wss:// scheme and /streams path.
  • Start Vosk server: (cd twilio-cable && make vosk-server) (you can use the fake server, too, see below).
  • Start AnyCable server: (cd twilio-cable && make run).

Now, open a browser at localhost:2300, type in your phone number into the form and click "Call". Wait for the call, pick up the phone, and start talking—the logs should appear in the browser!

Very quick start (no Twilio, no Docker)

You can play with this application without Twilio access by emulating media streams via wsdirector.

First, start all the components:

  • Start Hanami application: (cd kaisen && hanami server).
  • Start Vosk fake server: (cd twilio-cable && make vosk-fake-server).
  • Start AnyCable server: (cd twilio-cable && make run).

Now, you can emulate a phone call and watch the real-time logs in the browser:

  • Open localhost:2300
  • Run wsdirector: (cd twilio-cable && make wsdirector).

See the logs in the browser!

About

Using AnyCable and Hanami to build an app to process Twilio Media streams

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published