🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

voice-sdk-dialer

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

latest
npmnpm
Version
1.4.2
Version published
Maintainers
1
Created
Source

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

Keywords

webrtc

FAQs

Package last updated on 27 Aug 2025

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