This is an example Rack server demonstrate bi-directional asynchronous streaming in ruby using websockets. We use the falcon server and the asyc gem.
Add your OpenAI API key to the .env
file.
OPENAI_API_KEY=abcdefghijklexample
HOST=example.ngrok.com
Then run
bin/server
You'll need to set up your twilio webhooks to point to your server. If you're on a local dev machine then you can use NGrok to connect your localhost to a public url.
ngrok http localhost:9292
Twilio provide a brilliant application called dev phone for testing calling numbers using your web browser. Install the Twilio CLI. Then run the following command:
twilio dev-phone