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

call-llamada-natsu

v1.2.1

Published

WhatsApp voice call module by NatsuDev

Downloads

907

Readme

call-llamada-natsu

WhatsApp voice & video call module — wraps the official WhatsApp Web VoIP WASM stack for Node.js.

import { WhatsAppCaller, downloadAudio, isAudioMessage } from 'call-llamada-natsu';

const caller = new WhatsAppCaller({ authDir: './auth' });
await caller.connect();

const call = await caller.call('521234567890', audioBuffer);

call.on('ringing',   () => console.log('Ringing'));
call.on('connected', () => console.log('Connected'));
call.on('audio',      (pcm) => console.log('audio chunk', pcm.length));
call.on('ended',     (r) => console.log('Ended:', r));

await call.waitForEnd();
caller.disconnect();

Features

  • Outbound 1:1 voice & video calls — stream audio from files, buffers, or silence
  • Reuse existing Baileys socket — no QR, no secondary account
  • Standalone mode — own socket with authDir
  • Full call controlmute(), end(), durationMs, callId
  • Receive remote audioFloat32Array via audio event
  • Send video framescall.sendVideoFrame(buffer, width, height)
  • Phone number auto-normalization — MX (521), AR (549), CO (57)
  • TypeScript — full type definitions

Install

npm install call-llamada-natsu

baileys-natsu must also be installed in your host project:

npm install baileys-natsu

API

WhatsAppCaller

| Method | Description | |--------|-------------| | new WhatsAppCaller(config) | { sock?, baileys?, authDir? } | | .connect() | Initialize VoIP engine | | .call(number, audio?, opts?) | Place call → WhatsAppCall | | .disconnect() | Release resources |

WhatsAppCall

| Member | Description | |--------|-------------| | .callId | Unique call ID | | .state | Current CallState | | .end() | Hang up | | .mute(bool) | Mute/unmute mic | | .sendVideoFrame(buf, w, h) | Send raw video frame (YUV/NV12) | | .waitForEnd() | Promise → end reason | | .on('ringing', fn) | Remote ringing | | .on('connected', fn) | Call answered | | .on('audio', fn(pcm)) | Remote audio as Float32Array | | .on('videoFrame', fn(frame)) | Remote video frame | | .on('ended', fn(reason)) | Call ended | | .on('error', fn(err)) | Fatal error |

Helpers

| Function | Description | |----------|-------------| | downloadAudio(quoted) | Download audio from serialized quoted message → Buffer | | isAudioMessage(quoted) | Check if quoted message is audio |

Call options

const call = await caller.call('521234567890', audioBuffer, {
  durationMs: 60_000,       // auto-hangup after N ms (default 120000)
  isVideo: true,             // enable video call (send frames via sendVideoFrame)
});
  • audioBuffer, file path, or null/omit for silence
  • durationMs — auto-hangup after N ms
  • isVideo — enable video call mode

Phone number normalization

Numbers are automatically normalized for country formats:

| Country | Input | Normalized | |---------|-------|------------| | Mexico | 522234567890 | 5212234567890 | | Argentina | 541123456789 | 5491123456789 | | Colombia | 3221234567 | 573221234567 |

Fallback: raw input is tried if normalization fails.

Config

// Reuse bot's socket (no QR)
const caller = new WhatsAppCaller({ sock, baileys });

// Standalone (QR on first run, auth saved to ./caller_auth)
const caller = new WhatsAppCaller({ authDir: './caller_auth' });

Stability

  • Timer drift compensation — audio feeder uses wall-clock baseline to avoid drift
  • Graceful cleanup — playback interval is unref'd, capture buffers freed on re-init
  • Error resilienceonChunk errors stop the feeder instead of leaking ffmpeg
  • Video memory — WASM heap freed after each video frame via videoFrameConsumed
  • Event hygieneuncaughtException handler per-reconnect, no global removeAllListeners
  • Defensive checks — null-safe creds.me, debug logging on silent catch blocks

How it works

  1. Baileys handles WhatsApp auth and signaling stanzas.
  2. WASM VoIP stack (WhatsApp Web's official binary) runs in-process.
  3. Worker thread pool mirrors browser Web Workers for pthreads.
  4. Audio is decoded/resampled with ffmpeg, encoded with Opus, sent over RTP/SRTP.
  5. Video frames are pushed to the WASM worker pipeline, encoded with H.264, streamed over SRTP.

Requirements

  • Node.js ≥ 20
  • ffmpeg on PATH
  • A linked WhatsApp account

License

MIT