This is a sample server and web app for using network skills for WebRTC integration on Alexa.
The server must be hosted somewhere accessible to your Skill and Browser and fronted by a load balancer that terminates HTTPS. Additionally, it must have Node.js 16 or later installed. For simplicity a Node.js Elastic Beanstalk Environment is a great option.
Select a suitable hosting environment matching the above requirements.
Replace the following locations with your specific details
- ALEXA_REFRESH_TOKEN with the value of your refresh token from account linking
- ALEXA_CLIENT_ID with your Skill's Client ID
- ALEXA_CLIENT_SECRET with your Skill's Client Secret
Setup and start the server
> npm i
> npm start
Create a zip of the directory
> zip ../webrtc_server.zip -r *
Upload the created webrtc_server.zip
archive to a Node.js Elastic Beanstalk environment.
Once everything is deployed, you should now be able to open the WebApp at your server's URL and follow the instructions to place or receive a call to/from your Alexa devices.
The server setups up two different endpoints both on port 8080, one for standard REST HTTP requests accepting events from the skill and another WebSocket endpoint on /ws
for having
a bidirectional signaling channel with the browser. Events sent on these channels are
an overloaded form of the standard RTCSessionDescription with the general structure of
{
type: "register|offer|answer|ringing|end|error",
sdp: "<sdp blob>",
sessionId: "<sessionId from Alexa>",
target: "<Id of target, ony on offers>",
source: "<Id of source, only on offers>",
message: "<status message>"
}