A proof of concept in building browser-based telephony applications using functional programming languages. The back-end is implemented with Elixir, the front-end implemented with Elm.
To improve my knowledge of functional programming. To learn what types of problems are more/less difficult to solve in the telephony domain using functional languages vs. object oriented languages.
- Make a call from the browser
- Receive a call from another browser
- Make a conference call
- Receive a call from a telephone
This project serves as an umbrella enclosing many smaller applications.
- Small, loosely coupled components, each with a narrow set of responsibilities
- Components that can be tested in isolation
Each of these components is implemented as a child-project under the /apps
directory. This was done to promote the abovementioned design goals.
- UI Serves the single page web application. Translates websocket messages from the client into events. Provides an endpoint for other applications (i.e. router) to send websocket messages back to the client.
- Callbacks Accepts webhook requests from Twilio. Responds back with TwiML instructions and/or publishes events to broadcast that call state in Twilio has changed.
- Telephony Manages the core business logic for the system. Maintains its own version of the call state separate from Twilio.
- Router Handlers for events. Runs a pool of consumer processes that pull events from the event queue and delegate to the telephony or ui applications.
- Events Contains event definitions used to communicate between applications and facilitates publishing of events
-
Install dependencies
brew bundle
-
Set environment variables
export TWILIO_ACCOUNT_SID=<account sid> export TWILIO_AUTH_TOKEN=<auth token>
-
Run the tests
mix test
-
Start the applications
iex -S mix phoenix.server
-
Open the application
open http://localhost:5000/?client_name=yourname
- Resilience to client crash (fetch state from server at load)
- Resilience to server crash (fetch call state from Twilio at boot)
- Rolling deploys (proposing Docker with Consul)