This is a WebRTC test application running on node.js and express.js
- Install node.js if not installed (https://nodejs.org/en/download/)
- Clone and install
$ https://github.com/callstats-io/webrtc-demoapp.git
$ cd webrtc-demoapp/
$ npm install
- Set environment variables:
- port: server port if no SSL is used
- portSSL: server port if SSL is used
- SSL: boolean if SSL should be enabled
- APPID: callstats app ID from your dashboard
- APPSECRET: callstats secret key from your dashboard, necessary if no JWT is used (see here)
- KEYID: callstats key ID for JWT authentication (see here)
- JWT: boolean if JWT authentication should be used
- CSJSURL: callstats.js URL
Example:
port=8081
portSSL=4040
SSL=true
APPID=callstatsAppId
APPSECRET=callstatsAppSecret
KEYID=callstatsKeyID
JWT=true
CSJSURL=http://127.0.0.1:3000/static/callstats.min.js
- If you want to use SSL, generate SSL certificates to webrtc-demoapp/ssl/ folder (see below)
- If you want to use JWT authentication, generate EC key to webrtc-demoapp/ssl/ (see below)
- Run the app
$ npm start
Try the app locally by opening https://localhost:4040/.
Needs ca.crt, server.crt, server.key:
openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt -passin pass:v2ZIZj2jKUap -subj '/CN=localhost/O=Local/C=FI'
cp server.crt ca.crt
Needs ecpriv.key, ecpubkey.pem:
openssl ecparam -name prime256v1 -genkey > ecpriv.key
openssl ec -in ecpriv.key -pubout -out ecpubkey.pem