View on GitHub

LeanWebrtc

A simple WebRTC softphone & signalling server.

Lean WebRTC-Phone

Few years ago, I was tasked with developing a web based video enabled Call Center for a customer. Back then, I had a rather short deadline so I used a third party library for it. I wanted to write my own library using the official API but that task has always been pushed back due to a torrent of priorities. But when I read webkit announcing IPhone & Mac support is upon us, I decided to make some basic preperations for it. Coming from a low level CTI programmer (on C++ mostly) background, I felt the urge to add WebRTC to my collection. Most of the sample codes out there were either make-pretend (no proper signalling) or just huge. So i coded this little script. Anyone can feel free to use the code.

My goals were;

Structure

Technologies used

How signalling in the code works

I always wanted to have an awkward conversation with JD from Scrubs.

Sequence

Dependencies

Prerequisites

Installing

Setup signalling server

Setup client

Running the tests

Before you start, a lot will be going on the browser’s debugger console and on the server console. So you may want to check those.

  1. From the browser, navigate to your hosted index.html.
  2. Select what you want to transmit (default is Video only)
  3. Enter a client name, click “Connect To Server”. This connects client to signalling server, registers its name, broadcasts everyone that you have connected, opens your camera and gets the stream. Essentially you are ready to make a call.
  4. Need more clients. So open additional browsers/tabs and navigate to index.html. Repeat processes 1-2-3 for each client. This should populate “Users List” on every user’s screen since signalling server broadcasts its phone book when a new user registers or closes. Users List will NOT display your own user name since it would be weird to call yourself.
  5. Select a user from Users List and click Call button. This will enable Hangup button so you can end the call whenever.
  6. The person you have called should see Ringing. This will enable Accept, Reject and Hangup options while disabling Call option for the callee.
  7. Callee accepts the call and the conversation begins. Either party can Hangup.

I ran all the tests on LAN without firewall between peers. You may want to find or host a good STUN / TURN server if you want to test behind firewalls as it is the case in production. In the code, stun:stun.l.google.com:19302 is used.

This is how it looks like. The one on the left is my notebook’s camera, the one on the right is Chrome running on Windows 10 running on Virtualbox with a virtual cam driver streaming the desktop. Also, I’m not going to put my unshaved face here. Instead, take a look at the windmill at my terrace. SS

##Tested browsers

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

History

0.1.0

To Do

References