4 posts / 0 new
Last post
parikshit@thepro.dev
Seeking Sample Node.js Code for Plantronics Actions on PC Execution
Hello everyone, I have been exploring the Plantronics JavaScript Sample available at [insert link: https://pltdev.github.io/Plantronics%20JavaScript%20Sample.html], which provides useful code snippets for integrating Plantronics devices into web applications. However, I am specifically looking for sample code written in Node.js that allows me to perform the actions mentioned in the provided link. The JavaScript sample code provided is designed for web-based execution, but I need to execute the code on my PC using Node.js. I understand that Node.js provides a server-side runtime environment for executing JavaScript, making it suitable for PC-based applications. Could someone kindly point me in the right direction or provide me with sample code that demonstrates how to leverage Node.js to perform Plantronics actions on a PC? It would greatly help me in developing an application that interacts with Plantronics devices in a PC-based environment. Thank you in advance for your assistance!

lcollins
Hi, The sample code you mention uses the spokes.js file, which in turn uses the Hub SDK REST API (http) requests to control the headset and poll for events from the headset. To do this in node.js, I might suggest you to take a look at doing the direct http requests https://blog.logrocket.com/5-ways-to-make-http-requests-in-node-js/ For guidance on how to do this, we have done it before from Java https://developer.plantronics.com/article/softphone-integration-code-samples (see Java Tab) and from C++ https://developer.plantronics.com/article/hubrestsample-new-c-rest-api-sample-pdc and from Go https://developer.plantronics.com/article/integrate-plantronics-rest-api-go I would suggest using the same approach in node.js, as demonstrated in these other languages, to Attach to API (keep retrying if for example Hub is not running, or no device is attached), then to Register a plugin. At that point you can notify IncomingCall, OutgoingCall etc, and receive events for headset actions by polling for them - refer to the run method in the Java sample code, which polls every 2000 milliseconds for headset action. Let us know if it helps. Thanks

parikshit@thepro.dev
Okay tell me how we can get the caller id to answer Zoom/Teams call using REST APIs that you are mentioning.

lcollins
You can’t control the teams calls using this REST API. This REST API is intended for browser based or any language based softphones to integrate with the Poly headset. You can control your own soft phone calls through this REST API and via Poly headset buttons, but you cannot control the calls of another softphone like Zoom or Teams. To do that you would need to explore the APIs offered by Zoom and Teams.

Add new comment