CallTap

View as Markdown

Represents a current or past tapping of a call. You can obtain instances of this class by starting a Tap with one of the following methods:

Example

As soon as the other party answers the phone, start transmitting the audio of the call to an external service.

1import { Voice } from "@signalwire/realtime-api";
2
3const client = new Voice.Client({
4 project: "<project-id>",
5 token: "<api-token>",
6 topics: ["office"],
7});
8
9const call = await client.dialPhone({
10 from: "+YYYYYYYYYY",
11 to: "+XXXXXXXXXX",
12});
13
14// Start tapping the audio of the call
15const tap = await call.tapAudio({
16 direction: "both",
17 device: {
18 type: "ws",
19 uri: "wss://example.domain.com/endpoint",
20 },
21});
22console.log("Tap id:", tap.id);

Properties

id

The unique id for this tapping.

Syntax: CallTap.id()

Returns: string

Methods

ended

  • ended(): Promise<CallTap> - See CallTap for more details.

Returns a promise that is resolved only after this tap finishes (or is stopped).

Returns

Promise<CallTap> - See CallTap for more details.

Example

1const tap = await call.tapAudio({
2 direction: "both",
3 device: {
4 type: "ws",
5 uri: "wss://example.domain.com/endpoint",
6 },
7});
8
9await tap.ended();

stop

  • stop(): Promise<CallTap> - See CallTap for more details.

Stops the tapping.

Returns

Promise<CallTap> - See CallTap for more details.

Example

1const tap = await call.tapAudio({
2 direction: "both",
3 device: {
4 type: "ws",
5 uri: "wss://example.domain.com/endpoint"
6 },
7});
8
9await tap.stop();