***
id: c38c1051-7ef6-4a68-a97b-2dd0e4145bf9
title: tapAudio
slug: /node/reference/voice/call/tap-audio
description: tapAudio method for the Call class.
max-toc-depth: 3
----------------
[calltap-onstarted]: /docs/server-sdk/v4/node/reference/voice/call-tap#onstarted
[calltap]: /docs/server-sdk/v4/node/reference/voice/call-tap
[tapdevice]: /docs/server-sdk/v4/node/reference/voice/types#tapdevice
### tapAudio
* **tapAudio**(`params`): `Promise`\<[`CallTap`][calltap]>
Intercept call audio and stream it to the specified WebSocket endpoint.
This is an experimental method. The destination must be a hosted WebSocket/RTP server, with an address that SignalWire can reach.
A current limitation of this method is that the destination device does not receive any metadata regarding the origin of the stream.
#### Parameters
Object containing the parameters for tapping the call audio.
Destination device. Can be either WebSocket or RTP. See [`TapDevice`][tapdevice].
Direction to tap. Can be `"listen"` (what the caller hears), `"speak"` (what the caller says), or `"both"`.
Callback to listen for events. List of tap events can be found [here][calltap]. Example event: [`onStarted`][calltap-onstarted].
#### Returns
`Promise`\<[`CallTap`][calltap]>
A promise that resolves to a [`CallTap`][calltap] object that you can use to
view the current state and results of the `tap` session.
#### Example
In this example, we dial a phone number and tap the call audio
to a WebSocket endpoint. After the call is tapped, we play a TTS message
to the caller, and then stop the tap and hangup the call.
```js
import { SignalWire } from "@signalwire/realtime-api";
const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
const voiceClient = client.voice;
// Listen for incoming calls
await voiceClient.listen({
topics: ["office"],
onCallReceived: async (call) => {
console.log("Call received");
// Answer the call
await call.answer();
// Start a tap
const callTap = call.tapAudio({
direction: "both",
device: {
type: "ws",
uri: "wss://example.domain.com/websocket_endpoint"
},
listen: {
onStarted: () => {
console.log("Tap started");
},
onEnded: () => {
console.log("Tap ended");
}
}
}).onStarted();
await call.playTTS({ text: "We are currently tapping the call audio." });
// Stop the tap
await callTap.stop();
call.hangup();
}
});
```