Setting Up the Elea Voice Bot Service for Twilio (Server Admin)
Introduction
This guide is for the server administrator. It switches on the Elea voice service, the small program that lets Elea answer phone calls that come in through Twilio.
It is a one-time job and takes about 15 minutes. Once it is done, a Faveo admin can finish the rest of the Twilio setup (Twilio account, voice agent, phone numbers and agent dialer) from the browser, without server access.
What the voice service does:
- Twilio sends the live audio of each call to the voice service.
- The voice service talks to the caller in a natural voice using OpenAI, answers from your Faveo knowledge base, and asks Faveo whether the caller should be handed to a human agent.
- When the call ends, Faveo saves the conversation and lists the call under Call Logs.
This guide covers both:
- Debian based systems: Ubuntu, Debian
- RedHat based systems: RHEL, Alma Linux, Rocky Linux
Where the commands differ, each step has a separate block for each OS family. Run only the block that matches your server.
Before You Start
Make sure the following are true:
- Faveo is installed at
/var/www/faveo. - Faveo is served over HTTPS at the domain root, for example
https://support.example.com. - You have
sudoaccess to the server. - In Faveo, Admin > Plugins shows Telephony and Elea Assistant as Active.
Replace the example domain: This guide uses
support.example.comas the Faveo domain. Replace it with your own Faveo domain everywhere it appears.
Recommended: Set up MongoDB first using the MongoDB guide. The voice bot answers questions from your knowledge base, which Elea stores in MongoDB. Without it, the bot can still talk but will not know your products.
Names used on each OS
Some names differ between the two OS families. Keep this table handy:
| Item | Debian / Ubuntu | RedHat / Alma / Rocky |
|---|---|---|
| Package manager | apt |
dnf |
| Apache service | apache2 |
httpd |
| Apache SSL site file | /etc/apache2/sites-available/faveo-ssl.conf |
/etc/httpd/conf.d/faveo-ssl.conf |
| Supervisor config folder | /etc/supervisor/conf.d/ (.conf files) |
/etc/supervisord.d/ (.ini files) |
| Web server user (Apache) | www-data |
apache |
| Web server user (Nginx) | www-data |
nginx |
Quick overview of the steps
| Step | What you do |
|---|---|
| 1 | Install Node.js 22 |
| 2 | Install the voice service |
| 3 | Keep it running with Supervisor |
| 4 | Let Twilio reach it through Apache (or Nginx) |
| 5 | Allow the browser to use the microphone |
| 6 | Verify everything works |
| 7 | Give the stream address to the Faveo admin |
Step 1: Install Node.js 22
The voice service runs on Node.js and needs Node.js 22.
Check whether Node.js is already installed:
node -v
If it shows v22.x, move on to Step 2. If Node.js is not installed, or shows a different version, install Node.js 22 with the commands below.
Debian / Ubuntu:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
RedHat / Alma / Rocky:
curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -
sudo dnf install -y nodejs
Confirm the version:
node -v
npm -v
Step 2: Install the Voice Service
The voice service is already included with Faveo. You only need to download its libraries.
1. Go to the voice service folder and install its libraries:
cd /var/www/faveo/app/Plugins/EleaAssistant/Elea-voice-node
sudo npm install --omit=dev
2. Give the web server user ownership of the folder. The service updates a file inside node_modules when it starts, so this is required.
Debian / Ubuntu:
sudo chown -R www-data:www-data /var/www/faveo/app/Plugins/EleaAssistant/Elea-voice-node
RedHat / Alma / Rocky (use nginx:nginx instead of apache:apache if you run Nginx):
sudo chown -R apache:apache /var/www/faveo/app/Plugins/EleaAssistant/Elea-voice-node
Step 3: Keep It Running with Supervisor
Supervisor starts the voice service in the background and restarts it automatically if it stops.
Debian / Ubuntu
Create the configuration file:
sudo nano /etc/supervisor/conf.d/faveo-voicebot.conf
Paste the following content:
[program:faveo-voicebot]
directory=/var/www/faveo/app/Plugins/EleaAssistant/Elea-voice-node
command=/usr/bin/node start.js
user=www-data
autostart=true
autorestart=true
environment=TRANSFER_CHECK_URL="https://support.example.com/twilio/should-transfer",MONGO_URL="mongodb://faveo-elea:<password>@127.0.0.1:27017/faveo-elea?authSource=faveo-elea",MONGO_DB="faveo-elea",NODE_ENV="production"
stdout_logfile=/var/www/faveo/storage/logs/voicebot.log
stderr_logfile=/var/www/faveo/storage/logs/voicebot.log
RedHat / Alma / Rocky
Create the configuration file:
sudo nano /etc/supervisord.d/faveo-voicebot.ini
Paste the following content. If you run Nginx, change user=apache to user=nginx.
[program:faveo-voicebot]
directory=/var/www/faveo/app/Plugins/EleaAssistant/Elea-voice-node
command=/usr/bin/node start.js
user=apache
autostart=true
autorestart=true
environment=TRANSFER_CHECK_URL="https://support.example.com/twilio/should-transfer",MONGO_URL="mongodb://faveo-elea:<password>@127.0.0.1:27017/faveo-elea?authSource=faveo-elea",MONGO_DB="faveo-elea",NODE_ENV="production"
stdout_logfile=/var/www/faveo/storage/logs/voicebot.log
stderr_logfile=/var/www/faveo/storage/logs/voicebot.log
What to change in the environment= line:
| Setting | What to enter |
|---|---|
TRANSFER_CHECK_URL |
Your Faveo address followed by /twilio/should-transfer. Replace support.example.com with your own domain. |
MONGO_URL |
The same MongoDB connection string used in the MongoDB guide. Replace <password> with the password of the faveo-elea MongoDB user. If MongoDB runs on a separate server, replace 127.0.0.1 with its IP address. |
MONGO_DB |
faveo-elea, the database created in the MongoDB guide. |
NODE_ENV |
Leave as production. |
Password with special characters? In the connection string,
@,:,/,?,#and%must be URL-encoded (for example,@becomes%40). In this Supervisor file, every%must then be written twice (%%), so@becomes%%40. Supervisor treats a single%as a special character: the service still starts, but the password is silently changed and the MongoDB login fails.
Protect the file: it contains the MongoDB password, so make it readable by
rootonly. Debian / Ubuntu:sudo chmod 600 /etc/supervisor/conf.d/faveo-voicebot.conf. RedHat / Alma / Rocky:sudo chmod 600 /etc/supervisord.d/faveo-voicebot.ini.
Good to know: Faveo also sends the MongoDB details from the MongoDB Settings page at the start of every call. The values in this file are used when Faveo does not send them, so keep both the same.
Start the service (all OS)
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl status faveo-voicebot
The status must show RUNNING. The log file should contain the line:
Twilio WS running at ws://localhost:3000/ws/twilio
You can check it with:
tail -n 20 /var/www/faveo/storage/logs/voicebot.log
Step 4: Let Twilio Reach the Voice Service
How it works: Twilio connects to wss://support.example.com/ws/twilio on port 443. The web server forwards that connection to the voice service on port 3000.
Security: Do not open port 3000 in the firewall. Twilio only needs port 443, and the web server forwards the traffic internally.
Follow the section for your web server.
Option A: Apache
1. Enable the required modules.
Debian / Ubuntu:
sudo a2enmod proxy proxy_http proxy_wstunnel rewrite
RedHat / Alma / Rocky: these modules come with Apache and are loaded by default. Check with:
httpd -M | grep -E 'proxy_module|proxy_http_module|proxy_wstunnel_module|rewrite_module'
You should see all four modules.
2. Open the SSL site file. This is the file that contains SSLCertificateFile.
Debian / Ubuntu:
sudo nano /etc/apache2/sites-available/faveo-ssl.conf
RedHat / Alma / Rocky:
sudo nano /etc/httpd/conf.d/faveo-ssl.conf
If you set up SSL with Certbot, the file may be named
faveo-le-ssl.conf. Use the file that contains your<VirtualHost *:443>section.
3. Add this block inside the <VirtualHost *:443> section:
# Elea voice bot (Twilio media stream)
ProxyPass /ws/twilio ws://localhost:3000/ws/twilio retry=0
ProxyPassReverse /ws/twilio ws://localhost:3000/ws/twilio
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/ws/twilio(.*) ws://localhost:3000/ws/twilio$1 [P,L]
4. RedHat / Alma / Rocky only: allow Apache to connect to the voice service (SELinux). If getenforce shows Enforcing, run:
sudo setsebool -P httpd_can_network_connect 1
5. Test the configuration and reload Apache.
Debian / Ubuntu:
sudo apachectl configtest
sudo systemctl reload apache2
RedHat / Alma / Rocky:
sudo apachectl configtest
sudo systemctl reload httpd
configtest should return Syntax OK before you reload.
Option B: Nginx
If your server runs Nginx instead of Apache, add this inside the HTTPS server { } block of your Faveo site configuration:
location /ws/twilio {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 60m;
}
RedHat / Alma / Rocky only: if SELinux is Enforcing, run sudo setsebool -P httpd_can_network_connect 1.
Test the configuration and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
Step 5: Allow the Browser to Use the Microphone
Agents use a phone dialer inside Faveo to talk to callers. It needs the browser’s microphone.
Some servers send a Permissions-Policy header that switches the microphone off (microphone=()). This is common on servers hardened with the Faveo security guides or set up with the Faveo installation script. If the microphone is switched off, the dialer can never hear the agent.
1. Check what your server sends:
curl -sI https://support.example.com/ | grep -i permissions-policy
- Nothing shown, or the line contains
microphone=(self): nothing to do. Move on to Step 6. - The line contains
microphone=(): continue below.
2. Find the setting in your web server configuration:
Debian / Ubuntu (Apache):
sudo grep -rn "microphone=()" /etc/apache2/
RedHat / Alma / Rocky (Apache):
sudo grep -rn "microphone=()" /etc/httpd/
Nginx (all OS):
sudo grep -rn "microphone=()" /etc/nginx/
3. Edit the file shown and change microphone=() to microphone=(self). Leave the rest of the line as it is. For example:
Header always set Permissions-Policy "geolocation=(), microphone=(self), camera=()"
4. Test and reload the web server as shown at the end of Step 4.
5. Check again. It must now show microphone=(self):
curl -sI https://support.example.com/ | grep -i permissions-policy
Step 6: Verify the Setup
Run through these checks:
1. The voice service is running:
sudo supervisorctl status faveo-voicebot
The status should show RUNNING.
2. It is listening on port 3000:
sudo ss -ltnp | grep 3000
You should see a line showing node listening on port 3000.
3. Twilio can reach it through the web server. Run this from the server (replace the domain):
curl -s -i -N --max-time 5 \
-H "Connection: Upgrade" -H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
https://support.example.com/ws/twilio | head -1
It must show:
HTTP/1.1 101 Switching Protocols
4. The microphone is allowed (see Step 5): the Permissions-Policy header is missing or contains microphone=(self).
Step 7: Give the Stream Address to the Faveo Admin
The Voice Stream URL is your Faveo domain with /ws/twilio at the end, starting with wss://:
wss://support.example.com/ws/twilio
Send this address to the Faveo admin. They will paste it into Voice Stream URL under Admin > Receive requests > Phone and text > Twilio > Settings.
🎉 The server part is done. The Faveo admin can now continue with the Twilio account, voice agent and phone number setup in the browser.
Troubleshooting
| Problem | Cause and fix |
|---|---|
faveo-voicebot is not RUNNING |
Check the log with tail -n 50 /var/www/faveo/storage/logs/voicebot.log. Common causes: Node.js is not version 22 (see Step 1), npm install was not run (see Step 2), or another program is already using port 3000 (sudo ss -ltnp \| grep 3000). |
Log shows Could not patch ws package.json or EACCES |
The service user cannot write to its own folder. Repeat the chown command in Step 2, then run sudo supervisorctl restart faveo-voicebot. |
/usr/bin/node: not found in the log |
Node.js is installed in a different place. Run which node and use that path in the command= line of the Supervisor file, then run sudo supervisorctl reread and sudo supervisorctl update. |
The check in Step 6 returns 404, 400 or 503 instead of 101 |
The proxy block is missing, is outside the HTTPS virtual host, or proxy_wstunnel is not enabled. Repeat Step 4. On RedHat / Alma / Rocky, a 503 usually means SELinux is blocking the connection: run sudo setsebool -P httpd_can_network_connect 1. |
| Calls connect, but nobody speaks | The voice service is not running or Twilio cannot reach it. Run the checks in Step 6, and confirm the Faveo admin entered the Voice Stream URL from Step 7. |
| The dialer says “The browser blocked access to the microphone” | The server still sends microphone=(). Repeat Step 5, then reload the Faveo page and allow the microphone when the browser asks. |
| Elea talks but does not know your products | MongoDB is not set up, or no data source was trained. Follow the MongoDB guide, then train the bot’s data sources in Faveo. |
Useful commands
# Check the voice service status
sudo supervisorctl status faveo-voicebot
# Restart the voice service
sudo supervisorctl restart faveo-voicebot
# View the latest voice service log entries
tail -n 50 /var/www/faveo/storage/logs/voicebot.log
# Check the voice service is listening on port 3000
sudo ss -ltnp | grep 3000
# Check the microphone permission header
curl -sI https://support.example.com/ | grep -i permissions-policy