# @yealink_dev/yealink-node-sdk-rcc

> NodeJS SDK for Yealink Devices, Only for call control

Latest version **1.0.5** (published 2025-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yealink_dev/yealink-node-sdk-rcc
pnpm add @yealink_dev/yealink-node-sdk-rcc
yarn add @yealink_dev/yealink-node-sdk-rcc
bun add @yealink_dev/yealink-node-sdk-rcc
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2025-12-01 |
| First published | 2022-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Yealink |
| Maintainers | yealinkdevs |
| Keywords | yealink, sdk |

## Links

- npm: https://www.npmjs.com/package/@yealink_dev/yealink-node-sdk-rcc
- npm.io page: https://npm.io/package/@yealink_dev/yealink-node-sdk-rcc

## Dependencies (2)

- [bindings](https://npm.io/package/bindings.md) 1.5.0
- [node-addon-api](https://npm.io/package/node-addon-api.md) ^3.0.2

## Recent versions

- 1.0.5 (latest) — 2025-12-01
- 1.0.4 — 2025-08-15
- 1.0.3 — 2025-05-28
- 1.0.2 — 2025-04-03
- 1.0.1 — 2023-04-28
- 1.0.0 — 2022-07-11

## README

Yealink Node.js SDK

# Table of Contents

- [Table of Contents](#table-of-contents)
  - [Pre-requisite](#pre-requisite)
  - [Installation](#installation)
  - [Debugging and Logging](#debugging-and-logging)
  - [API Reference](#api-reference)
  - [Examples](#examples)
    - [Simple button events example using javascript and plain promises](#simple-button-events-example-using-javascript-and-plain-promises)
    - [Simple button events example using typescript and plain promises](#simple-button-events-example-using-typescript-and-plain-promises)
    - [Multiple device management with typescript and async/await](#multiple-device-management-with-typescript-and-asyncawait)
  - [Sequence diagrams](#sequence-diagrams)
  - [Setup VSCode](#setup-vscode)
    - [Windows](#windows)

## Pre-requisite

1. Node.js v8.x or later.
2. **On MacOS:** `xcode` & `python 2.7`. By default, Python is installed on macOS but make sure correct version(2.7.x) is installed. Install Xcode from App store or download it from [here](https://developer.apple.com/xcode/download/).
3. **On Windows:** `Visual C++ Build Tools` & `Python 2.7`. You can install all of these by following any of the below mentioned steps.

    3.1. **During Node.js installation** By ticking the checkbox when prompted during Node.js installation for `Tools for Native modules`, this installs both `Visual C++ Build Tools` & `Python 2.7`. **Note** This is prompted only for Windows platform. For other platforms like Linux or MAC, C++ compilation tools has to be installed separately as mentioned in other steps.

    3.2. Both `Visual C++ Build Tools` & `Python 2.7` can also be installed using command `npm install --global --production --add-python-to-path windows-build-tools`. To know more about this tool, see [this link.](https://github.com/felixrieseberg/windows-build-tools). **Note** For executing this command through `Windows Command Prompt` or `Windows PowerShell`, they should be ran in Administrator mode.

5. **All Platforms:** `node-gyp`. You can install this using command `npm install -g node-gyp`. To know more about this, see [this link](https://www.npmjs.com/package/node-gyp)

6. **For Electron.JS:** If you are using `asar` packaging then you may need to `unpack` some of the resources used in this module. These resources are native library files i.e `libyealinkusbsdk.dll`, `libyealinkusbsdk.dylib` & `libyealinkusbsdk.so`, which is stored in a `build\Release` folder. By default latest electron builder will automatically unpack, but if it does not work then you can provide below option to your build process. To know more, see [this link](https://www.electron.build/configuration/configuration)

```javascript
"build": {
    "asarUnpack": ["node_modules/@yealink_dev/yealink-node-sdk-rcc"]
}
```

## Installation

npm install @yealink_dev/yealink-node-sdk-rcc

## Debugging and Logging

Below environment variables are defined for logging and debugging purpose. User can change the values as per preference.

Environment Variable | Value | Description
--- | --- | ---
YEALINKSDK_TRACE_LEVEL |  error, warning, info(default), verbose | Log levels
YEALINKSDK_RESOURCE_PATH | **On Mac:** ~/Library/Application Support/YealinkSdk/ **On Windows:** %appdata%/YealinkSdk  | This determine the system path where logs and device related files are written.

## API Reference

API doc is in html format. See doc folder inside installed module `node_modules\@yealink_dev\yealink-node-sdk\dist\doc` and open `index.html`.

## Examples

For all examples, user should first register the app from yealink teams to get appID. User should pass this appID to `initSdk` in order to initialize the yealink module:

### Simple button events example using javascript and plain promises

```javascript
const sdk = require("@yealink_dev/yealink-node-sdk-rcc");
sdk.initSdk('test_App_Id').then((ylSdk) => { // test_App_Id is appId here
    ylSdk.RegEvent('attach', (deviceImpl) => {
        console.log('press any key on yealink device ' + deviceImpl.deviceName);
        
        deviceImpl.RegEvent('btnPress', (btnType, btnValue) => {
          console.log('new input from device is received: ', sdk.DeviceBtnType[btnType], btnValue);
        });
    });    
});
```

### Simple button events example using typescript and plain promises

```typescript
import { initSdk, DeviceBtnType } from '@yealink_dev/yealink-node-sdk-rcc';
initSdk('test_App_Id').then((ylSdk) => { // test_App_Id is appId here
    ylSdk.RegEvent('attach', (deviceImpl) => {
        console.log('press any key on yealink device ' + deviceImpl.deviceName);

        deviceImpl.RegEvent('btnPress', (btnType, btnValue) => {
          console.log('new input from device is received: ', DeviceBtnType[btnType], btnValue);
        });
    });   
});
```

### For more examples, see src/simpletest


### Multiple device management with typescript and async/await

```typescript
import { initSdk } from '@yealink_dev/yealink-node-sdk-rcc';

(async () => {
    let ylSdk = await initSdk('test_App_Id'); // test_App_Id is appId here

    await ylSdk.firseScanForDeviceDoneAsync(); // Wait for all pre-attached devices to be scanned.

    const deviceInstanceList = ylSdk.getAttachedDevices();
    if (deviceInstanceList.length<2) {
        throw new Error('please make sure 2 yealink devices are attached');
    }

    const firstDevice = deviceInstanceList[0];
    await firstDevice.ringAsync();

    const secondDevice = deviceInstanceList[1];
    await secondDevice.ringAsync();

    // Dispose yealink sdk to enable node process to shutdown.
    await ylSdk.disposeAsync();
})();
```

## Setup VSCode

The project includes config files for debugging typescript and C++ source files
in [Visual Studio Code](https://code.visualstudio.com/) via the
[C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools),
for both Windows. The configuration files work without any
modification, provided that you set up your environment first, by installing
the necessary tools and defining some environment variable.

To debug a C++ file, open a typescript file referencing the C++ file and start
the debugger (Running the debugger on C++ files directly won't work). Make sure
the "Run"-dropdown at the top of the debugging-sidebar is set to "Current TS
File - native code only (&lt;your operating system&gt;)"

Below, the setup steps for Windows.

### Windows

You can more or less follow the instruction in
[the VSCode C++ extension guide](https://code.visualstudio.com/docs/cpp/config-msvc).
Then, you need to make sure all project [pre-requisites](#pre-requisite) are
installed correctly, and finally set the following environment variables:

Environment Variable | Value | Description
--- | --- | ---
YEALINK_NODESDK_WIN_NODE_GYP_CACHE_PATH | eg. %appdata%\Local\node-gyp\Cache\12.16.3\include\node | Used by the C/C++ extension to resolve include paths
YEALINK_NODESDK_WIN_CPP_COMPILER_PATH | eg. C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe | Used by the C/C++ extension to infer the path to the C++ standard library header files

---
_Source: https://npm.io/package/@yealink_dev/yealink-node-sdk-rcc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
