npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sangoma-headset

v0.2.1

Published

Interact with Sangoma branded headsets

Downloads

20

Readme

Sangoma Headset Connector

Basic connector that manages connection to Sangoma Headsets and listens for events such as button presses, placing or removing from cradle, etc.

Usage

const headset = require('sangoma-headset')
// Connect to the device
// Disconnection logic is handled within the headset object
headset.connect()

Call flow methods

  • inboundCall: Signal an inbound call and start ringing.
  • onCall: Signal that a call has started (either inbound or outbound).
  • finishCall: Signal that the on call state has finished.

Events

The headset object is an EventEmitter that can emit the following events:

  • placed-on-cradle: Headset is placed on cradle
  • removed-from-cradle: Headset is removed from cradle
  • hook-off: Hook button is pressed to take a call. It requires the call to have been signaled by calling the inboundCall method on the headset object.
  • hook-on: Hook button is pressed to finish a call. It requires the call to have been signaled by calling the inboundCall or onCall method on the headset object.
  • volume-up
  • volume-down
  • mute-toggle: mute button is pressed
  • unmute

CLI

This project includes a CLI that you can use for testing and debugging different commands, in order to use it you need to run the cli command.

npm install -g yarn
yarn install
yarn cli

Installation

This project makes use of node-hid in order to connect and communicate with the device. All requirements from node-hid apply here, specially when using it within Electron.

Electron projects using node-hid

In your electron project, add electron-rebuild to your devDependencies. Then in your package.json scripts add:

  "postinstall": "electron-rebuild --force"

This will cause npm to rebuild node-hid for the version of Node that is in Electron. If you get an error similar to The module "HID.node" was compiled against a different version of Node.js then electron-rebuild hasn't been run and Electron is trying to use node-hid compiled for Node.js and not for Electron.

If using node-hid with webpack or similar bundler, you may need to exclude node-hid and other libraries with native code. In webpack, you say which externals you have in your webpack-config.js:

  externals: {
    "node-hid": 'commonjs node-hid'
  }

Examples of node-hid in Electron:

Electron projects that use electron-builder

If you are using electron-builder there is no need for electron-rebuild as it is already included, sort of. Instead of electron-rebuild you can use:

"postinstall": "electron-builder install-app-deps"

install-app-deps can also take different parameters, useful for when you're building for a different OS (e.g. building for Windows from Linux or Mac), you could use something like this:

"rebuild-windows": "electron-builder install-app-deps --platform=win32 --arch=x64"

Additional information for electron-builder on MacOS

When building for MacOS using hardenedRuntime: true it is important to set the appropriate entitlements, in this case node-hid will require:

<key>com.apple.security.cs.disable-library-validation</key>
<true/>

You can find a complete list of entitlements here