> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # collect > Collect DTMF or speech input without playing media. [play-and-collect]: /docs/server-sdks/reference/typescript/relay/call/play-and-collect [calling-call-collect]: /docs/server-sdks/reference/typescript/relay/call#events [call-events]: /docs/server-sdks/reference/typescript/relay/call#events [standalonecollectaction]: /docs/server-sdks/reference/typescript/relay/actions Collect DTMF digit or speech input without playing a prompt. Use this when you want to listen for input silently or after a prompt has already been played separately. For collecting input with a prompt, use [`playAndCollect()`][play-and-collect]. > **Info** > > This method emits [`calling.call.collect`][calling-call-collect] events. See [Call Events][call-events] for payload details. ## **Parameters** **`digits`** `Record | undefined` DTMF digit collection settings. --- **`digits.max`** `number` Maximum number of digits to collect. --- **`digits.digit_timeout`** `number` Seconds to wait between digits before completing. --- **`digits.terminators`** `string` Characters that terminate digit collection (e.g., `"#"`). --- **`speech`** `Record | undefined` Speech recognition settings. --- **`speech.end_silence_timeout`** `number` Seconds of silence to wait before finalizing speech input. --- **`speech.speech_timeout`** `number` Maximum seconds to listen for speech. --- **`speech.language`** `string` Speech recognition language code (e.g., `"en-US"`). --- **`speech.hints`** `string[]` Words or phrases to boost recognition accuracy. --- **`initialTimeout`** `number | undefined` Seconds to wait for the first input before ending with `no_input`. --- **`partialResults`** `boolean | undefined` Enable partial speech recognition results. --- **`continuous`** `boolean | undefined` Keep collecting after each result instead of stopping. --- **`sendStartOfInput`** `boolean | undefined` Send an event when input is first detected. --- **`startInputTimers`** `boolean | undefined` Start input timers immediately. If `false`, call `action.startInputTimers()` to start them manually. --- **`controlId`** `string | undefined` Custom control ID. Auto-generated if not provided. --- **`onCompleted`** `(event: RelayEvent) => void | Promise` Callback invoked when collection completes. --- ## **Returns** `Promise<`[`StandaloneCollectAction`][standalonecollectaction]`>` -- An action handle with `stop()`, `startInputTimers()`, and `wait()` methods. ## **Example** ```typescript {13} import { RelayClient } from '@signalwire/sdk'; const client = new RelayClient({ project: process.env.SIGNALWIRE_PROJECT_ID!, token: process.env.SIGNALWIRE_API_TOKEN!, contexts: ['default'] }); client.onCall(async (call) => { await call.answer(); // Collect digits silently (e.g., extension entry) const action = await call.collect({ digits: { max: 4, digit_timeout: 3, terminators: '#' }, initialTimeout: 10, }); const event = await action.wait(); const result = event.params.result as Record ?? {}; const extension = (result.digits ?? '') as string; console.log(`Extension entered: ${extension}`); }); await client.run(); ``` > Collect DTMF or speech input without playing media.