I inspected the repository and key files to learn how the project is structured and how to run it.
What I gathered:
- Project purpose: a WebRTC-based telemedicine platform for real-time video diagnostics (doctor, patient, interpreter).
- Main components:
- www/ — PHP web application (MVC framework). Entry: www/index.php. Configuration: www/config.inc and many bundled libraries/plugins (PayPal SDK, PHPExcel, TCPDF, etc.).
- scs/ — Node.js Signaling & Chat server (WebSocket) for WebRTC signaling. Entry: scs/server.js. Config: scs/config.js. package.json lists server dependencies.
- recording/ — Recording web app and integration; entry: recording/index.php and recording/config.inc. Uses bundled ffmpeg binaries in recording/resource/ffmpeg.
- database/teleclinic.sql — MySQL schema + data dump to create the teleclinic DB.
- environment/apache2/teleclinic.conf — example Apache VirtualHost for deploying the web app over HTTPS.
- turn/, resource/service scripts and init files for system services are present (for production).
- Important runtime requirements discovered:
- PHP (minimum from sysconfig: 5.4.7) — many PHP files under www/ and recording/.
- MySQL (database dump present).
- Node.js & npm for scs (package.json).
- ffmpeg for recording (binaries included, config points to FFMPEG path).
- TLS certificates (several server.crt/.key files included; replace with proper certs).
- Ports: 443 for HTTPS & WSS, TURN/STUN ports (if using TURN), possible 3478 for TURN.
- I reviewed config samples (www/config.inc, recording/config.inc, scs/config.js) that show what must be changed to match your environment (DB host, credentials, SCS_URL, ICE_SERVERS, API endpoints).
Key README sections I decided to include and why:
- Project overview & architecture: to quickly explain what each component does.
- Quickstart (minimum steps): a small, runnable path to get the system up locally or on a server.
- Detailed setup: DB import, configuration edits (what to change & where), starting services (scs, Apache), testing ffmpeg and SCS.
- Deployment hints: Apache VirtualHost, systemd/service hints, TLS, running scs as a background service.
- Troubleshooting: common issues (ports, ffmpeg path, permissions, config mistakes).
- Security & notes: many example config files contain credentials — alert maintainers to rotate and never commit secrets.
- Contributing & License: brief pointers.
Structure & style choices:
- Short introduction and architecture diagram (text) to make the stack clear at a glance.
- Step-by-step commands for the most common use-case (Ubuntu/Debian) — these are pragmatic and copy-paste ready.
- Emphasize files to edit and what values matter (DB, SCS URL, ICE servers, ffmpeg path).
- Keep examples short and actionable; avoid exposing secrets — call out where secrets exist and that they must be changed.
- Provide references to service scripts included under resource/service and scs/service to help production deployments.
I will now produce the final README in Markdown following these decisions.
Real-time Video Diagnostics Web System between Doctor, Patient and Interpreter based on WebRTC
Table of Contents
- Overview
- Repository layout
- Prerequisites
- Quickstart (minimum to run)
- Detailed setup
- Testing & verification
- Troubleshooting
- Security notes
- Development & build
- Contributing
- License
This repository implements a telemedicine platform that supports real-time video/audio, chat and recording between doctors, patients and interpreters using WebRTC. The system is split into three primary components:
- PHP web application (www/) — primary frontend and REST API endpoints for administration and user workflows.
- Node.js Signaling & Chat Server (scs/) — WebSocket-based signaling server that relays SDP offers/answers/candidates and in-room messages.
- Recording service (recording/) — a web component used for recording WebRTC sessions (uses ffmpeg).
A MySQL schema is provided (database/teleclinic.sql). Example Apache configuration is available at environment/apache2/teleclinic.conf.
Architecture (simplified)
- Browser (client) <-> Frontend (www) (HTTPS)
- Browser WebRTC <-> Peer (P2P / TURN) for media
- Browser <-> scs (WSS) for signaling and chat
- recording service receives media or coordinates recording via ffmpeg
- README.md — (this file)
- LICENSE — MIT
- database/teleclinic.sql — MySQL schema & initial data
- www/ — PHP web application (MVC)
- index.php, config.inc, application/, core/, resource/, package.json, etc.
- scs/ — WebSocket signaling server (Node.js)
- server.js, config.js, package.json
- recording/ — recording web app and ffmpeg binaries
- environment/apache2/teleclinic.conf — example Apache VirtualHost
- turn/ — TURN server archives / account.txt (not pre-built)
See the full tree in the repo for all included plugins and resources.
These are the typical requirements to run the platform.
System
- Linux (Ubuntu / Debian recommended for the example commands)
- Root/privileged user to configure services / Apache / ports
Software
- PHP >= 5.4.7 (sysconfig declares MIN_PHP_VER '5.4.7'; modern PHP is recommended)
- Required PHP extensions: mysqli, mbstring, openssl, zip, gd (typical LAMP stack)
- MySQL / MariaDB (create
teleclinicdatabase and import SQL) - Apache2 (or any PHP-capable web server)
- Node.js (>= 0.10.0 per package.json; use a maintained LTS version)
- npm (to install scs dependencies)
- ffmpeg and ffprobe (the project includes ffmpeg/ffprobe under recording/resource/ffmpeg; you may use system packages)
- Optional: TURN server (coturn) for NAT traversal in restrictive networks
- Open ports: 443 (HTTPS / WSS), 3478 (TURN), 80 (optional; HTTP redirect)
Note: The repo contains example certs and example credentials. Replace them before production use.
This section shows the minimal steps to get a working setup for development/testing.
- Clone the repository:
git clone https://github.com/Markcus0526/ife-hospital-webrtc-web.git teleclinic
cd teleclinic- Import the database:
# create DB and import
mysql -u root -p
CREATE DATABASE teleclinic CHARACTER SET utf8 COLLATE utf8_general_ci;
EXIT
mysql -u root -p teleclinic < database/teleclinic.sql- Configure the PHP web app:
- Edit
www/config.incand set:- DB_HOSTNAME, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT
- FRONTEND_URL (your site URL)
- SCS_URL (set to your scs WSS endpoint, e.g. wss://your.domain:443)
- ICE_SERVERS (STUN/TURN list)
- Configure and start the Signaling Server:
cd scs
# optional: edit scs/config.js to set api_prefix, ssl cert paths, port
npm install
# start in foreground for testing
node server.js
# or use server.min.js or a process manager (pm2/systemd) in production- Deploy web app to Apache docroot:
- Place the
wwwfolder under your web root (e.g. /var/www/teleclinic or symlink). - Use the included example
environment/apache2/teleclinic.conffor HTTPS VirtualHost (replace certificate paths). - Restart Apache and ensure PHP is configured.
- Visit your FRONTEND_URL.
- Recording:
- Configure
recording/config.inc(DB, ffmpeg path FFMPEG & FFPROBE paths). - Deploy
recordingunder its own HTTPS host (e.g. record.example.com) and ensureRECORDING_APIinwww/config.incpoints to that host.
- Import the SQL dump as shown above.
- The
database/teleclinic.sqlcontains tables and seed data. - If you intend to run multiple instances, review
www/core/sql/*for migrations & conversions.
- Primary configuration file:
www/config.inc.- Update database credentials, mail/SMS API keys, PayPal/CHINAPAY credentials,
SCS_URL,ICE_SERVERSandFRONTEND_URL. - Default language and many timeouts are configured here (see comments).
- Update database credentials, mail/SMS API keys, PayPal/CHINAPAY credentials,
- Document root: point Apache's VirtualHost DocumentRoot to the
wwwdirectory. - Vendor code: repository includes many libraries (PayPal SDK, PHPExcel, TCPDF). Composer is not strictly required but you may use it if you prefer.
Permissions
- Ensure
www/data,www/log,www/data/avartar(and similar runtime directories) are writable by the web server user (www-data/apache).
- Edit
scs/config.js:ssl,port,ssl_key,ssl_cert,api_prefix(the API prefix your PHP server exposes).
- Install dependencies and run:
cd scs
npm install
node server.js- For production run as a service:
- Use the provided scripts in
scs/service/*(Ubuntu/RedHat) or create a systemd unit to runnode server.jsas a managed service. - Example: run under
pm2orsystemdto auto-restart.
- Use the provided scripts in
recording/config.inc:- Set DB credentials, FFMPEG and FFPROBE paths (FFMPEG & FFPROBE included at recording/resource/ffmpeg but you can use system-installed).
- The recording app expects to be hosted on HTTPS (recording API endpoints referenced by web app).
- In restrictive NAT scenarios a TURN server is necessary.
- The repository includes sources/archives under
turn/and a sampleturn/account.txt. For production use, set up coturn and updateICE_SERVERSinwww/config.incandrecording/config.inc.
- See
environment/apache2/teleclinic.conffor an example SSL-enabled virtual host pointing to/www/teleclinic. - Replace
SSLCertificateFileandSSLCertificateKeyFilewith your CA-signed certs. - Ensure
SCS_URL(in www/config.inc) useswss://with a host that matches scs certificate.
- Verify backend:
# test DB connectivity (example in PHP CLI)
php -r "require 'www/core/global.php'; echo 'OK';"- Test scs:
node scs/server.js
# should print "Teleclinic SC(Signaling & Chat) Server started..." per config- Test ffmpeg:
/your/path/to/ffmpeg -version
# Or use the bundled binary: recording/resource/ffmpeg/ffmpeg -version- Web UI:
- Open your FRONTEND_URL in a browser and try a demo call (depends on app data and accounts).
- Check browser console for WSS connection to
SCS_URLand ICE connectivity.
-
WSS connection fails:
- Ensure scs is running and its certificate matches the host used by clients.
- Check firewall (port 443) and proxy configuration.
-
STUN/TURN issues (media not connecting):
- Verify ICE_SERVERS JSON is correct (format and reachable).
- If behind strict NAT, deploy TURN and include TURN credentials in ICE_SERVERS.
-
ffmpeg recording failures:
- Confirm
FFMPEGandFFPROBEpaths inrecording/config.inc. - Run ffmpeg manually to ensure execution permissions.
- Confirm
-
Permission errors:
- Ensure PHP runtime directories under www/ are writable by web server user.
-
Database connection errors:
- Double-check host/port/user/password in
www/config.incand that MySQL allows connections from the host.
- Double-check host/port/user/password in
-
Long startup logs or “already listening”:
- Ensure ports are not used by other services (e.g. existing Apache or another Node process).
- Many configuration files in this repo contain example credentials and certificate files (e.g.
www/config.inc,recording/config.inc). NEVER leave default passwords/certificates in production. - Replace example TLS certificates with CA-signed certs (Let's Encrypt or commercial CA).
- Rotate API keys, SMS keys, email creds, PayPal/CHINAPAY secrets before production.
- Move secret credentials to environment variables or protected configuration not checked into git if customizing.
- Frontend build tools:
www/package.jsonlists Grunt & frontend tooling. Usenpm installthengrunt/grunt watchwhere appropriate.
- Signaling server:
scs/package.jsoncontains dependencies (ws, mysql, request). Usenpm installin scs/ before running.
- Unit tests:
- Some vendor packages include tests; project-wide tests are not included by default.
Example:
# scs
cd scs
npm install
node server.js
# www (optional build steps)
cd www
npm install
# install grunt cli if needed
npm install -g grunt-cli
grunt- Please open issues for bugs or feature requests.
- For code contributions:
- Fork the repo, create a feature branch, run and test locally, open a pull request with a clear description.
- Keep secrets out of commits. If a config file must be changed for CI, provide a template with placeholders (do not commit secrets).
This project is licensed under the MIT License — see the LICENSE file.
If you want, I can:
- Produce a sanitized sample
www/config.inc.sampleandscs/config.js.samplewith placeholders for secrets. - Create systemd unit examples for scs and recording.
- Add a quick "developer local" guide for running everything via Docker (if you prefer containerized steps).