Today at the WebRTC Expo (http://www.webrtcworld.com/conference/) and I demonstrated how Plantronics can seamlessly integrate our headset devices into a WebRTC call flow. The demo consisted of three parts. 

 

The first part was a node.js sever application that will serve as a rendezvous point for setting up a simple WebRTC call.  To build the server app we modified code we borrowed from an existing demo that Anant Narayanan put together called Gupshup.  The code for the server project can be found and downloaded from github (carybran/webrtc-server · GitHub .  The server code is relatively painless to use once you have node.js installed.

To run the server navigate to the webrtc-server project

  • Run the node package manager in the directory as follows: "npm install app.js", this will download the dependent packages for the application
  • Start node as follows: AUDIENCE="http://youripaddress:8000" node app.js
  • The server is now ready to go.

 

The second part is using a nightly build of Mozilla Firefox.  You should use the same version on each machine and I would recommend building your own copy of the nightly. To see what we used for the demo check out this file: webrtc-server/WebRTCExpo2012-demo-machine-config.txt at master · carybran/webrtc-server · GitHub Note: this demo was written for use with Mozilla but could easily be modified to work with Google Chrome.

 

The third part is the Plantronics client side code also on Github: carybran/PlantronicsWebRTC · GitHub.  This code connects the Plantronics headset functionality to the web browser using websockets.  For more information on how to build and use the code - check out the readme on Github

PlantronicsWebRTC/README.md at master · carybran/PlantronicsWebRTC · GitHub

Once you have the server up and running and your Mozilla nightly configured to run WebRTC applications you should be able to connect to the node.js application and login with the username of your choice.

 

If you have questions or comments about getting the demo running please let me know.

 

-Cary

 

Comments


Cary -

Great post! And I was present in the WebRTC Expo as well. One question is - if I want to do something very basic like whether any headset is plugged-in and raise an error - I still need to run some client to talk to Plantronics runtime and query that (using websockets) from my web-app? Or such simple scenarios - some other way like a browser plugin or browser setting (for Plantronics) is available?

Thx

Rajarshi


Hi Rajarshi,

Thanks for your interest in Plantronics APIs!

With our current Spokes SDK to find if headset is plugged-in you need to connect to one of the Spokes APIs and ask Spokes what is the "active device", and also you can monitor subsequent device add/remove events. The active device is defined as the first Plantronics device attached to the PC that Spokes enumerates.

The Spokes APIs available today are:

- .NET Interop to COM Service, which was used by the WebRTC demo

- COM Service which can be used by a C++ app

- REST Service which potentially any language that can use HTTP protocol can use (note the REST implementation may be changing later this year but a REST service will continue to exist).

The WebRTC demo was a browser based app that opened a WebSocket to talk to a C# command line app. That C# app connected to Spokes via .NET Interop to COM Service to interact with Plantronics device. The C# app passed device events etc back to the browser based app via the WebSocket.

The REST Service API holds the potential to allow a local browser based app to directly communicate with Spokes. However the WebSocket implementation used in WebRTC demo gets around the JavaScript same origin policy that you may encounter using just REST Service API if loading a browser based app from remote site.

The below diagram summarizes the available Spokes API options for your particular scenario:

rajarshi how to know if headset plugged in.png

Location of relevant sample codes:

C# samples:

SpokesSDKCOMNETSample - comprehensive sample of C# integration to COM Service API
http://developer.plantronics.com/docs/DOC-1221

Spokes Easy Demo - supporting Plantronics devices made easy with SpokesWrapper.cs!!!
http://developer.plantronics.com/docs/DOC-1216

C++ sample:

Standalone application integrated to Spokes SpokesSDKCOMSample
http://developer.plantronics.com/docs/DOC-1125

JavaScript samples:

REST API JavaScript Example
http://developer.plantronics.com/docs/DOC-1076

"Hello World!" Spokes JavaScript API sample
http://developer.plantronics.com/docs/DOC-1162
Testing this sample code without a device…
Connecting...
Error
: Device was null on connecting to Spokes. Is there a Plantronics device connected?


Let us know any more questions.

Have fun!

Lewis.


Thx a lot Lewis for adding so much details. Yes - I'm planning to download and run the sample apps very soon. I guess for my plans using the REST Service could be the most effective one (will explore).

- Rajarshi