This project was developed in the context of the Twilio x DEV community hackathon.
The Emergency Queue is a communication point between the medical responders of the national Medical Emergency Line and the patients. It is aimed at simplifying and improving the waiting process for the caller. The core feature of the application is an idle waiting line.
You can read more about the application functionalities and also check demo videos here.
Disclaimer:
For now, the setup process to prepare and start all the components of the project is somewhat cumbersome, so please be patient. It will be open to improvements in the future.
- Twilio account
- Docker
- Docker Compose (only for Linux systems, on desktop systems like Docker Desktop for Mac and Windows, Docker Compose is included as part of those desktop installs)
In your Twilio account, you need to create and setup two TwiML Apps. For now, fill only the "Friendly Name", we will setup the Voice and Messaging webhooks in a later step.
For setup purposes, from now on we will refer to the TwiML Apps as TwiML App 1 and TwiML App 2.
See here how you can create a TwiML App in the Twilio Console.
You also need to get two Twilio phone numbers with the following characteristics:
-
Phone number 1 must have SMS and Voice capabilities. For both Voice and SMS, configure this phone number with TwiML App 1.
-
Phone number 2 must have Voice capability. For Voice, configure this phone number with TwiML App 2.
See here how you can get a Twilio phone number.
Open the server/.env
file and set the environment variables with the respective values from your Twilio account:
Variable Name | Variable Value |
---|---|
TWILIO_ACCOUNT_SID | Your Twilio account identifier. Find it in the Console. |
TWILIO_AUTH_TOKEN | Your Twilio auth token. Find it in the Console. |
INCOMING_TWILIO_NUMBER | The Phone number 1 in E.164 format, e.g. "+351 987 654 321". |
RESPONDERS_TWILIO_TWIML_APP_SID | The application identifier of the TwiML App 2. |
RESPONDERS_TWILIO_NUMBER | The Phone number 2 in E.164 format, e.g. "+351 987 654 321". |
In the root of the project, execute the following command to start ngrok, the server and the database:
docker-compose up -d --build
Go to localhost:4040/status and find the ngrok URL that allows public access to the locally-running server service:
Go back to the Apps your created in the first step and configure their webhooks with the ngrok URL in the following way:
-
TwiML App 1:
Capability URL Method Voice ${ngrokURL}
/api/voice/incomingPOST SMS ${ngrokURL}
/api/text/holdtimePOST -
TwiML App 2:
Capability URL Method Voice ${ngrokURL}
/api/internal/call/dialPOST
In the client
folder, execute one of the following commands to build the executable file for the desired platform:
- Windows:
docker-compose -f docker-compose-dist.yml run --rm client-build-windows
After the build is complete, execute the generated dist/windows/client 0.1.0.exe
file.
- Linux:
docker-compose -f docker-compose-dist.yml run --rm client-build-linux
After the build is complete, run the generated dist/linux/client-0.1.0.AppImage
file.
- Alternativelly, you can start the client application in development mode by executing
npm run start
.