New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ringcentral-softphone

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ringcentral-softphone

This is a TypeScript SDK for RingCentral Softphone. It is a complete rewrite of the [RingCentral Softphone SDK for JavaScript](https://github.com/ringcentral/ringcentral-softphone-js)

  • 0.6.2
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-90.73%
Maintainers
1
Weekly downloads
 
Created
Source

RingCentral Softphone SDK for TypeScript

This is a TypeScript SDK for RingCentral Softphone. It is a complete rewrite of the RingCentral Softphone SDK for JavaScript

Users are recommended to use this SDK instead of the JavaScript SDK.

Installation

yarn install ringcentral-softphone

Where to get SIP_INFO_USERNAME, SIP_INFO_PASSWORD and SIP_INFO_AUTHORIZATION_ID?

  1. Login to https://service.ringcentral.com
  2. Find the user/extension you want to use
  3. Check the user's "Devices & Numbers"
  4. Find a phone/device that you want to use
  5. if there is none, you need to create one. Check steps below for more details
  6. Click the "Set Up and Provision" button
  7. Click the link "Set up manually using SIP"
  8. At the bottom part of the page, you will find "User Name", "Password" and "Authorization ID"

Usage

import fs from 'fs';
import Softphone from 'ringcentral-softphone';
import type { RtpPacket } from 'werift-rtp';

const softphone = new Softphone({
  username: process.env.SIP_INFO_USERNAME,
  password: process.env.SIP_INFO_PASSWORD,
  authorizationId: process.env.SIP_INFO_AUTHORIZATION_ID,
});
const main = async () => {
  await softphone.register();
  // inbound call
  softphone.on('invite', async (inviteMessage) => {
    // answer the call
    const callSession = await softphone.answer(inviteMessage);
    // receive audio
    const writeStream = fs.createWriteStream(`${callSession.callId}.raw`, { flags: 'a' });
    callSession.on('audioPacket', (rtpPacket: RtpPacket) => {
      writeStream.write(rtpPacket.payload);
    });
    // receive DTMF
    callSession.on('dtmf', (digit) => {
      console.log('dtmf', digit);
    });
  });
};
main();

For a complete example, see src/index.ts

Notes

How to play saved audio file

ffplay -autoexit -f mulaw -ar 8000 test.raw

Or

play -b 8 -r 8000 -e mu-law test.raw

Todo

  • outbound call
  • Try other payload types, such as OPUS
  • support callerId
  • do not hard code domain and outboundProxy

FAQs

Package last updated on 05 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc