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 🙏

© 2025 – Pkg Stats / Ryan Hefner

voice-sdk-dialer

v1.4.2

Published

A powerful WebRTC SIP client library for making and receiving voice calls in web browsers. Built with modern JavaScript and TypeScript support.

Readme

Voice SDK Dialer

A powerful WebRTC SIP client library for making and receiving voice calls in web browsers. Built with modern JavaScript and TypeScript support.

🚀 Features

  • WebRTC SIP Integration - Full SIP protocol support over WebSocket
  • Call Management - Make, receive, hold, mute, and transfer calls
  • Real-time Events - Comprehensive callback system for call states
  • TypeScript Support - Complete type definitions included
  • Browser Compatible - Works in all modern browsers
  • Audio Controls - Mute, hold, speaker controls
  • Call Duration Tracking - Built-in call timer

📦 Installation

npm install voice-sdk-dialer

Or with yarn:

yarn add voice-sdk-dialer

🏗️ Quick Start

Basic Usage

import VoiceSDKDialer from 'voice-sdk-dialer';

// Initialize the dialer
const dialer = new VoiceSDKDialer({
  token: 'your-token',
  domain: 'your-domain.com'
});

// Start the dialer with SIP configuration
dialer.start({
  sipConfig: {
    server: 'sip.yourdomain.com',
    username: 'your-sip-username',
    password: 'your-sip-password',
    displayName: 'Your Display Name'
  },
  callbacks: {
    onConnected: () => console.log('Connected to SIP server'),
    onCallAnswered: (callInfo) => console.log('Call answered:', callInfo),
    onError: (error) => console.error('Error:', error)
  }
});

// Make a call
dialer.makeCall('+1234567890');

TypeScript Usage

import VoiceSDKDialer, { 
  VoiceSDKOptions, 
  CallInfo, 
  CALL_STATES 
} from 'voice-sdk-dialer';

const options: VoiceSDKOptions = {
  sipConfig: {
    server: 'sip.yourdomain.com',
    username: 'user',
    password: 'pass',
    displayName: 'User Name'
  },
  callbacks: {
    onCallAnswered: (callInfo: CallInfo) => {
      console.log(`Call with ${callInfo.caller} is active`);
    }
  }
};

const dialer = new VoiceSDKDialer({
  token: 'your-token',
  domain: 'your-domain'
});

dialer.start(options);

🔧 API Reference

Constructor

new VoiceSDKDialer(options)

Parameters:

  • options.token (string) - Authentication token
  • options.domain (string) - Your domain
  • options.defaultCountryCode (string, optional) - Default country code (default: '+84')

Methods

start(options)

Initialize and start the dialer with SIP configuration.

dialer.start({
  sipConfig: {
    server: 'sip.example.com',
    username: 'user',
    password: 'pass',
    displayName: 'Display Name',
    port: '8089' // optional
  },
  callbacks: {
    // Event callbacks
  }
});

makeCall(number)

Make an outgoing call to the specified number.

options = {
  'X-[name]' = value
}
await dialer.makeCall('+1234567890', options);

answerCall()

Answer an incoming call.

dialer.answerCall();

hangupCall()

End or decline the current call.

await dialer.hangupCall();

hold() / unhold()

Put the current call on hold or resume it.

await dialer.hold();
await dialer.unhold();

mute() / unmute()

Mute or unmute the microphone.

await dialer.mute();
await dialer.unmute();

destroy()

Clean up resources and destroy the dialer instance.

dialer.destroy();

📡 Events & Callbacks

The dialer supports comprehensive event callbacks:

const callbacks = {
  // Connection events
  onReady: (dialer) => console.log('Dialer ready'),
  onConnected: () => console.log('Connected to SIP server'),
  onDisconnected: () => console.log('Disconnected from server'),
  onRegistered: () => console.log('SIP registration successful'),
  
  // Call events
  onIncomingCall: (callInfo) => console.log('Incoming call from:', callInfo.caller),
  onOutgoingCall: (callInfo) => console.log('Calling:', callInfo.number),
  onCallAnswered: (callInfo) => console.log('Call answered'),
  onCallEnded: () => console.log('Call ended'),
  onCallInitiated: (callInfo) => console.log('Call initiated'),
  
  // Call controls
  onMuteToggle: (isMuted) => console.log('Mute:', isMuted),
  onHoldToggle: (isHeld) => console.log('Hold:', isHeld),
  onDurationUpdate: (seconds) => console.log('Duration:', seconds),
  
  // Error handling
  onError: (error) => console.error('Error:', error)
};

🌐 Browser Support

  • Chrome/Chromium 70+
  • Firefox 65+
  • Safari 12+
  • Edge 79+

📋 Requirements

  • Modern browser with WebRTC support
  • SIP server with WebSocket support
  • Valid SSL certificate (required for WebRTC)
  • Microphone permissions

📄 License

MIT License - see the LICENSE file for details.

📞 Support

🏷️ Changelog

v1.0.0

  • Initial release
  • Basic SIP calling functionality
  • WebRTC integration
  • TypeScript support
  • Call management features

v1.0.1

  • How to fix index.js

v1.0.2

  • How to fix hold/unhold

v1.0.3

  • How to fix not register

v1.0.4

v1.0.5

v1.0.6

v1.0.7

v1.0.8

  • How to fix cannot imported VoiceSDKDialer
  • Add more callback event

v1.0.9

  • Add more exported interface

v1.1.0

  • Add more exported interface
  • Re-export type for interface
  • Add check reconnect

v1.1.1

v1.1.2

v1.1.3

v1.1.4

v1.1.5

v1.1.6

v1.1.7

  • How to fix cannot imported VoiceSDKDialer

v1.1.8

  • How to fix cannot imported VoiceSDKDialer
  • Add check reconnect

v1.1.9

  • How to fix cannot imported VoiceSDKDialer
  • Add check reconnect
  • Remove check audio, add function InitAudio

v1.2.0

v1.2.1

v1.2.2

v1.2.3

v1.2.4

v1.2.5

v1.2.6

v1.2.7

  • How to fix cannot imported VoiceSDKDialer
  • Reactjs yarn add alias with link folder ../node_modules/voice-sdk-dialer

v1.2.8

  • How to fix hangup event

v1.2.9

  • How to fix hangup event
  • Add declineCall

v1.3.0

  • How to fix hangup event

v1.3.1

  • Update required SessionState

v1.3.2

  • Update required Inviter

v1.3.3

  • Replace hangupCall and DeclineCall

v1.3.4

  • Update callback object call details

v1.3.5

  • Update callback object call details
  • Add options make call

v1.3.6

  • Add options make call
  • Add on makecall in ts

v1.3.7

  • Fix error add options in make call

v1.3.8

  • Add options in hangupCall and declineCall

v1.3.9

  • Fixed Microphone permission

v1.4.0

  • Remove and not function isRegistered()

v1.4.1

  • Fixed cannot call outbound/inbound when fix permission microphone

v1.4.2

  • Fixed call in speaker