AWS

All posts tagged AWS

Maybe I have been working in the communications industry too long, but much of the usual telephone experience seems ridiculously antiquated to me. Using a string of digits as a user address? Anyone can call you for any reason they want whether I know them and want to speak to them or not? Of all of the telephony systems daily nuisances, I find conference calls to be the worst! The process of looking up a random string of digits to dial into a bridge, listen to the same repetitive prompts, and then needing to look up and enter another random string of digits drives me insane every time.  I would prefer to just provide a user-friendly URL, like the chadwallacehart.com I own and to make my phone service available when I choose.

Also, a video option would be nice – sometimes. I like to do video calls with my parents so they can see my kids which means negotiating which video telephony service we will use first, usually via text message, based on who happens to be sitting in front of what device. Allowing multi-party video would be even better so I can let my kids have one camera to show off in the background and I can call in with another to have a real conversation.

There are many solutions out there for the problems above, but none of them allow me to “own” the solution and change it to fit my needs. Fortunately I know something about WebRTC and have rudimentary programming skills, so I set out to make my own phone service during the holiday break.

 

As I have mentioned in past posts, I do not get paid to code for a living and I do not ever plan to. Please treat my step-by-step (and sometimes step-by-misstep) log and commentary below as a rough guide as opposed to an exact instruction set to follow. If you just want to look at or copy the code, you can skip all this and just go to the ChadWallaceHart.com Github page here.

Pick a Signaling Server

I have limited skills in node.js and I knew I did not want to code everything myself, so first I looked did some investigation of what server tools I wanted to use. If I had more confidence then I probably should have started with the design step I highlight below and then picked the right tool for my needs. There were 14 vendors in the Tool Directory as illustrated below and a bunch more that I should probably add to this list:

I decided to use Priologic’s EasyRTC Server largely because:

  1. It is totally open source
  2. The server comes with many reusable demos illustrating various call-flow scenarios
  3. They just released a NPM module for node with lots of documentation making it easy to get up and running
  4. I am somewhat familiar with the API based from my WebRTC Motion Detecting Baby Monitor (with the added bonus I could reuse the server for that project too)

#2 was really the most critical for me here since I had a lot of call flow scenarios in mind that I wanted to experiment with without having to do much coding. I encourage you to check out the others too since there is a wide variety of choices depending on how you like to code and what you are looking to do.

Service Design

Next I thought through how I wanted my phone service to work with a sketch:

Basically I want a basic presence system for myself to show when I am available and when I am not. I can do this simply with a means to log-in, log-out, and a waiting room. In most cases I prefer my real-time interactions to be scheduled, so I will log in when I know someone is going to call me and logout when I am done. For situations where my schedule is more flexible – i.e. call me this afternoon – I can just stay logged in. At this point I don’t need a means of authenticating callers into the system other than myself – I assume if you are visiting my site at a time when I happened to be logged-in that you are not randomly there to harass me.

Initial WebRTC tests

The documentation for setting up the EasyRTC server is very straight forward. I am using WebMatrix in Windows for my initial tests, so I just had to use their built-in NPM easyrtc module to add it:

From there I followed their instructions and copied their demo server.js and static directory and installed express and socket.io from NPM. That was all I needed to get up and running enough to check out their demos. I decided to start with a multi-party conferencing demo which has a HTML5 UI similiar to Priologic’s tawk.com to start.

server.js quick start from EasyRTC

The only trick I recommend for Windows users using WebMatrix is to run node directly from a command prompt instead of using WebMatrix’s built in hooks to Microsoft’s Internet Information Services (IIS) which is installed with WebMatrix. IIS did not seem to like port 8080 on my machine and it was faster to run dependently than mess with IIS . Also, my Windows setup is strictly for development – I will deploy on Ubuntu.

Basic node.js Setup

Now that demonstrated that the WebRTC part would be straight forward to copy from the EasyRTC demos, I decided to frame out the rest of the logic in node.js. I made a brief attempt to use Jade to help dynamically serve the pages I would need, but after spending some time I on it I concluded this was not worth the effort for the initial prototype. Here is how my basic setup looked- ...  Continue reading