Integrate Linkus SDK for Windows Core

Linkus SDK for Windows Core provides core call functionalities without UI components. This topic describes how to integrate Linkus SDK for Windows Core with your Windows project.

Prerequisites

Demo and Source code

Before the integration, we recommend that you try out the React Demo of 'Linkus SDK for Windows Core', and review the source code to have an overview of the framework and workflow of 'Linkus SDK for Windows Core'.

Supported module formats

'Linkus SDK for Windows Core' supports 4 module formats: UMD, CJS, ESM, and IIFE. You can choose a module format according to your needs.
Note: If you prefer a smaller SDK bundle size or your Windows projects support ESM, we recommend that you import the ESM module.

Step 1. Import 'Linkus SDK for Windows Core'

  1. Go to the GitHub Repository of 'Linkus SDK for Windows Core', and download 'Linkus SDK for Windows Core'.
  2. Use either of the following methods to import 'Linkus SDK for Windows Core' to your project.
    • Use npm to install 'Linkus SDK for Windows Core'
      npm install ys-webrtc-sdk-core
    • Use script to import 'Linkus SDK for Windows Core'
      <script src="./ys-webrtc.umd.js"></script>

Step 2. Initialize 'Linkus SDK for Windows Core'

Use the init method to initialize 'Linkus SDK for Windows Core'. After successful initialization, 2 instantiated Operator objects PBXOperator and PhoneOperator, and a method destroy are returned.
Name Type Description
PBXOperator Object This object contains methods and attributes related to the PBX, such as querying CDR records, logging out of user account, and more.
PhoneOperator Object This object contains methods and attributes related to calls, such as making a call, answering a call, ending a call, and more.
destroy Method This method is used to destroy 'Linkus SDK for Windows Core'.
Method
init({
    params //Refer to the following table for specific parameters
})
Parameters
Parameter Type Required Description
username string Yes Email address.
secret string Yes Linkus SDK login signature.
pbxURL URL | string Yes The URL for accessing your PBX system, including the transfer protocol and the corresponding port number.

For example, https://yeastardocs.example.yeastarcloud.com.

enableLog boolean No Whether to enable log output and report error logs to PBX.
Valid value:
  • true: Enable
  • false: Disable
Note: This feature is enabled by default.
reRegistryPhoneTimes number No Define the number of retry attempts for SIP UA (User Agent) registration. By default, it is unlimited.
userAgent WebPC" | "WebClient No The User Agent in Asterisk, which indicates the type of Linkus client. The default value is WebClient.
deviceIds { cameraId?: string; microphoneId?: string;} No Define the IDs of the audio and video input devices, including the camera ID and microphone ID.
disableCallWaiting boolean No Whether to disable call waiting.
Valid value:
  • true: Disable call waiting.

    The call waiting time set on PBX will NOT take effect and the PBX only handles a single call.

  • false: Enable call waiting.
Sample code
  • Use npm to install and initialize 'Linkus SDK for Windows Core'.
    import { init, on } from 'ys-webrtc-sdk-core';
    
    init({
        username: '1000',
        secret: 'sdkshajgllliiaggskjhf',
        pbxURL: 'https://yeastardocs.example.yeastarcloud.com'
    })
        .then((operator) => {
          // Obtain the 'PhoneOperator' instance, 'PBXOperator' instance, and 'destroy' method
          const { phone, pbx, destroy } = operator;
        })
        .catch((error) => {
          console.log(error);
        });
  • Use script to import and initialize 'Linkus SDK for Windows Core'.
    <script src="./ys-webrtc.umd.js"></script>
    <script>
      // After successful import, initialize 'Linkus SDK for Web  Core' using the 'YSWebRTC' object 
      YSWebRTC.init({
        username: '1000',
        secret: 'sdkshajgllliiaggskjhf',
        pbxURL: 'https://yeastardocs.example.yeastarcloud.com',
      })
        .then((operator) => {
          // Obtain the 'PhoneOperator' instance, 'PBXOperator' instance, and 'destroy' method
          const { phone, pbx, destroy } = operator;
        })
        .catch((error) => {
          console.log(error);
        });
    </script>