*** id: 5ccdad3c-fe24-4611-a7e1-82f61dfab0ab title: recordAudio slug: /node/reference/voice/call/record-audio description: recordAudio method for the Call class. max-toc-depth: 3 ---------------- [callrecording-onstarted]: /docs/server-sdk/v4/node/reference/voice/call-recording#onstarted [callrecording]: /docs/server-sdk/v4/node/reference/voice/call-recording ### recordAudio \[#voice\_call\_record\_audio] * **recordAudio**(`params?`): `Promise`\<[`CallRecording`][callrecording]> Records the audio from the call. #### Parameters Object containing the parameters for recording audio. Whether to play a beep before recording. Format of the recording. Whether to record in stereo mode. Direction to record. Can be `listen` (what the caller hears), `speak` (what the caller says), or `both`. How long to wait (in seconds) until something is heard in the recording. Disable by passing `0`. How long to wait (in seconds) until the caller has stopped speaking. Disable by passing `0`. DTMF digits that, when dialed, will end the recording. Controls how sensitive the voice activity detector is to background noise, where `0` is least sensitive (hear nothing) and `100` is most sensitive (hear everything). Callback to listen for events. List of recording events can be found [here][callrecording]. Example event: [`onStarted`][callrecording-onstarted]. #### Returns `Promise`\<[`CallRecording`][callrecording]> A promise that resolves to a [`CallRecording`][callrecording] object that you can use to view the current state and results of the `recording` session. #### Example In this example, we dial a phone number and record the call audio. During the recording, we play a TTS message. Once the TTS message is finished, we hangup the call and print the URL of the recording to console. ```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 call.answer(); await call.recordAudio({ beep: true, format: "mp3", direction: "both", initialTimeout: 0, endSilenceTimeout: 0, terminators: "#", stereo: true, listen: { onStarted: async (recording) => { console.log("Recording started"); await call.playTTS({ text: "This is a call recording test.", }); // Stop the recording after the TTS is played recording.stop(); }, onFailed: () => { console.log("Recording failed"); }, onUpdated: (recording) => { console.log("Recording updated", recording.state); }, onEnded: (recording) => { console.log("Recording ended", recording.url, recording.state); call.hangup(); }, } }).onStarted(); } }); ```