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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cognigy/click-to-call-sdk

v0.0.7

Published

A standalone WebRTC SDK for SIP-based voice calling with custom audio support

Downloads

118

Readme

Click To Call SDK

A standalone, framework-agnostic SDK for SIP-based voice calling with WebRTC. Built on JsSIP.

Features

  • 🚀 Framework Agnostic — works with React, Angular, Vue, or vanilla JS.
  • 🔒 Type Safe — full TypeScript support.
  • 📞 SIP/WebRTC — built on JsSIP for reliable communication.
  • 🎛️ Full Control — start, end, mute, unmute, send info messages.
  • 🔄 Event Driven — 17 events for real-time state updates.
  • 🎵 Auto Audio — remote audio plays automatically; raw stream available via captureAudio event.
  • 💬 Transcription — real-time transcription events, auto-separated from info messages.

Installation

npm install @cognigy/click-to-call-sdk

Quick Start

import { createWebRTCClient, checkWebRTCSupport } from '@cognigy/click-to-call-sdk';

// 1. Check browser support
const support = checkWebRTCSupport();
if (!support.supported) throw new Error('Missing: ' + support.missing);

// 2. Create client
const client = await createWebRTCClient({
  endpointUrl: 'https://your-cognigy-environment.com/token',
  userId: 'user-123',
});

// 3. Listen to events
client.on('answered', (session) => console.log('Call answered:', session.id));
client.on('ended', (session, endInfo) => console.log('Call ended:', endInfo.cause));
client.on('error', (error) => console.error('Error:', error.message));

// 4. Connect and call
await client.connectAndCall();

// 5. Cleanup on page unload
window.addEventListener('beforeunload', () => {
  void client.destroy().catch(() => {
    // Ignore errors during page unload
  });
});

Note: The call must be initiated from a user gesture (e.g. button click) for browser autoplay policies to allow audio.

Configuration

interface WebRTCClientConfig {
  endpointUrl: string;        // URL to fetch SIP configuration
  userId?: string;            // Optional user identifier
  pcConfig?: RTCConfiguration; // WebRTC peer connection config
  captureAudio?: boolean;     // Enable captureAudio event to receive raw MediaStream
}

API

| Method | Description | |-------------------------|----------------------------------------------| | connect() | Connect to SIP server and register | | disconnect() | Disconnect from SIP server | | connectAndCall() | Connect + start call in one step | | startCall() | Start a call (must be connected first) | | endCall() | End the current call | | mute() / unmute() | Toggle microphone | | sendInfo(text, data?) | Send info message during a call | | isConnected() | Check connection state | | getCurrentSession() | Get active CallSession or null | | on(event, callback) | Add event listener (returns this) | | off(event, callback) | Remove event listener (returns this) | | destroy() | Disconnect, end calls, release all resources |

Events

| Event | Callback | |-----------------|-------------------------------------------------------------------------| | connecting | () | | connected | () | | disconnected | () | | registered | () | | unregistered | () | | ringing | (session: CallSession) | | answered | (session: CallSession) | | ended | (session: CallSession, endInfo: CallEndInfo) | | failed | (session: CallSession, endInfo: CallEndInfo) | | muted | (session: CallSession) | | unmuted | (session: CallSession) | | captureAudio | Remote audio stream available (requires opt-in) (stream: MediaStream) | | audioEnded | () | | infoSent | (text: string, data: Record<string, any>) | | infoReceived | (data: { originator: string; info: { body: string } }) | | transcription | (transcription: { originator: string; messages: { text: string }[] }) | | error | (error: Error) |

Browser Compatibility

Chrome 93+ · Firefox 92+ · Safari 15.4+ · Edge 93+

Documentation

For the full guide, API reference, event reference, and troubleshooting:

License

MIT