[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81526":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":13,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},81526,"baileys-caller","SheIITear\u002Fbaileys-caller","SheIITear","VoIP calls thru Baileys",null,"TypeScript",35,26,1,0,3,8,4.29,"MIT License",false,"main",true,[],"2026-06-12 02:04:16","# baileys-caller\n\nPlace WhatsApp voice calls from Node.js.\n\nWraps WhatsApp Web's official VoIP WASM stack and uses [Baileys](https:\u002F\u002Fgithub.com\u002FWhiskeySockets\u002FBaileys) for authentication and signaling. Audio (MP3, WAV, or `Float32Array`) is encoded with Opus and sent over the live RTP session.\n\n> **Author:** ShellTear\n\n## Status\n\n- ✅ Outbound 1:1 voice calls\n- ✅ Stream audio from MP3\u002FWAV files\n- ✅ Receive remote audio as `Float32Array`\n- ✅ Mute \u002F unmute \u002F hang up\n- ❌ Group calls\n- ❌ Video\n- ❌ Inbound calls\n\n## Requirements\n\n- Node.js ≥ 20\n- `ffmpeg` on `PATH` (used to decode\u002Fresample audio sources)\n- A linked WhatsApp account (you'll scan a QR on first run)\n\n## Install\n\nThis package isn't published on npm. Pull it in directly from git:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FSheIITear\u002Fbaileys-caller\ncd baileys-caller\nnpm install\nnpm run build\n```\n\nYou can also depend on it from another project via a git URL in `package.json`:\n\n```json\n{\n  \"dependencies\": {\n    \"baileys-caller\": \"git+https:\u002F\u002Fgithub.com\u002FSheIITear\u002Fbaileys-caller.git\",\n    \"@whiskeysockets\u002Fbaileys\": \"^7.0.0-rc11\"\n  }\n}\n```\n\n`@whiskeysockets\u002Fbaileys` is a peer dependency — install it in your project alongside this one.\n\n## Quick Start\n\n```ts\nimport { VoipClient } from \"baileys-caller\";\n\nconst client = new VoipClient({ authDir: \".\u002Fauth\" });\n\nawait client.connect(); \u002F\u002F first run prints a QR for WhatsApp > Linked Devices\n\nconst call = await client.call(\"12345678901\", {\n  audioSource: \".\u002Fhello.mp3\",\n});\n\ncall.on(\"ringing\",   () => console.log(\"ringing\"));\ncall.on(\"connected\", () => console.log(\"connected\"));\ncall.on(\"audio\",     (pcm) => { \u002F* 16 kHz mono Float32Array from the peer *\u002F });\ncall.on(\"ended\",     (reason) => console.log(\"ended:\", reason));\n\nawait call.waitForEnd();\nclient.disconnect();\n```\n\nRun the bundled example from a clone:\n\n```bash\nnpx tsx examples\u002Fcall.mts .\u002Fauth 12345678901 .\u002Fhello.mp3\n```\n\n## API\n\n### `new VoipClient(options)`\n\n| Option    | Type     | Description                                |\n|-----------|----------|--------------------------------------------|\n| `authDir` | `string` | Baileys multi-file auth state directory    |\n\n### `client.connect(): Promise\u003Cvoid>`\n\nConnects to WhatsApp. On first run a QR code is printed; scan it from `WhatsApp > Settings > Linked Devices`. Subsequent runs reuse `authDir`.\n\n### `client.call(phoneNumber, opts?): Promise\u003CActiveCall>`\n\nPlaces an outbound call. `phoneNumber` is digits only (e.g. `\"12345678901\"`).\n\n| Option        | Type                  | Description                                              |\n|---------------|-----------------------|----------------------------------------------------------|\n| `audioSource` | `string \\| \"silence\"` | Path to MP3\u002FWAV, or `\"silence\"` for an empty stream      |\n| `durationMs`  | `number?`             | Auto-hangup after N ms                                   |\n\n### `client.disconnect(): void`\n\nCloses the WhatsApp socket and releases resources.\n\n### `ActiveCall`\n\nReturned by `client.call()`. Extends `EventEmitter`.\n\n#### Events\n\n| Event       | Payload         | When                                          |\n|-------------|-----------------|-----------------------------------------------|\n| `ringing`   | —               | Remote device is ringing                      |\n| `connected` | —               | Call answered, media flowing                  |\n| `audio`     | `Float32Array`  | 16 kHz mono PCM frame from the remote peer    |\n| `ended`     | `string`        | Call ended (`hangup`, `timeout`, `rejected`)  |\n| `error`     | `Error`         | Fatal error                                   |\n\n#### Methods\n\n- `call.end(): void` — hang up\n- `call.mute(muted: boolean): void` — toggle outgoing mute\n- `call.waitForEnd(): Promise\u003Cstring>` — resolves with end reason\n\n#### Properties\n\n- `call.callId: string`\n\n## How it works\n\n1. Baileys handles WhatsApp authentication, encryption, and signaling stanzas.\n2. The WhatsApp Web VoIP WASM stack runs in-process to negotiate the call, encode\u002Fdecode Opus, and manage the RTP\u002FSRTP session.\n3. A pthread pool of `worker_threads` mirrors the browser's Web Worker pool the WASM expects.\n4. Outbound audio is decoded with `ffmpeg`, resampled to 16 kHz mono, fed into the WASM, and delivered to the relay.\n5. Inbound audio is exposed as `Float32Array` chunks via the `audio` event.\n\n## Auth state\n\n`authDir` stores Baileys session keys after the first QR scan. Treat it like a credential — anyone with that directory can act as your linked device.\n\n## WASM resources\n\nThe WASM binary and its loader (`whatsapp.wasm`, `loader.js`, `worker-modules.js`) live under `assets\u002Fwasm\u002F`. To refresh them from a current WhatsApp Web session:\n\n```bash\nnpm run fetch-wasm\n```\n\n## License\n\nMIT © ShellTear\n","baileys-caller 是一个基于 Node.js 的项目，用于通过 WhatsApp 发起语音通话。该项目利用了 WhatsApp Web 官方的 VoIP WASM 栈，并结合 Baileys 库进行认证和信令处理，支持从 MP3 或 WAV 文件中流式传输音频数据，并使用 Opus 编码后通过实时 RTP 会话发送。此外，它还提供了静音、取消静音及挂断等基本功能。目前仅支持单向发起的语音通话，不支持群组通话、视频通话或接听来电。适用于需要集成 WhatsApp 语音通话功能的 Node.js 应用场景，如自动化客服系统或远程协助工具。",2,"2026-06-11 04:05:24","CREATED_QUERY"]