Skip to main content

CallTap

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.

import { Voice } from "@signalwire/realtime-api";

const client = new Voice.Client({
project: "<project-id>",
token: "<api-token>",
topics: ["office"],
});

const call = await client.dialPhone({
from: "+YYYYYYYYYY",
to: "+XXXXXXXXXX",
});

// Start tapping the audio of the call
const tap = await call.tapAudio({
direction: "both",
device: {
type: "ws",
uri: "wss://example.domain.com/endpoint",
},
});
console.log("Tap id:", tap.id);

Accessors

id

get id(): string

The unique id for this tapping.

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

const tap = await call.tapAudio({
direction: "both",
device: {
type: "ws",
uri: "wss://example.domain.com/endpoint",
},
});

await tap.ended();

stop

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

Stops the tapping.

Returns

Promise<CallTap> - See CallTap for more details.

Example

const tap = await call.tapAudio({
direction: "both",
device: {
type: "ws",
uri: "wss://example.domain.com/endpoint"
},
});

await tap.stop();