***
id: 22a46086-90fa-4ccf-ba4f-1e7fb598b7c8
title: prompt
slug: /node/reference/voice/call/prompt
description: prompt method for the Call class.
max-toc-depth: 3
----------------
[callprompt-onstarted]: /docs/server-sdk/v4/node/reference/voice/call-prompt#onstarted
[callprompt]: /docs/server-sdk/v4/node/reference/voice/call-prompt
[collectdigitsconfig]: /docs/server-sdk/v4/node/reference/voice/types#collectdigitsconfig
[collectspeechconfig]: /docs/server-sdk/v4/node/reference/voice/types#collectspeechconfig
[promptaudio]: /docs/server-sdk/v4/node/reference/voice/call/prompt-audio
[promptringtone]: /docs/server-sdk/v4/node/reference/voice/call/prompt-ringtone
[prompttts]: /docs/server-sdk/v4/node/reference/voice/call/prompt-tts
[voiceplaylist]: /docs/server-sdk/v4/node/reference/voice/playlist
### prompt
* **prompt**(`params`): `Promise`\<[`CallPrompt`][callprompt]>
Generic method to prompt the user for input.
Take a look at [`promptAudio`][promptaudio], [`promptRingtone`][promptringtone], or [`promptTTS`][prompttts] for the more specific input methods.
#### Parameters
Object containing the parameters for prompting the user for input.
A media playlist to play. See [`VoicePlaylist`][voiceplaylist].
Configuration for collecting digits. You must either set this, or `speech`. See [`CollectDigitsConfig`][collectdigitsconfig].
Configuration for collecting speech. You must either set this, or `digits`. Pass an empty object to use the default configuration. See [`CollectSpeechConfig`][collectspeechconfig].
Initial timeout in seconds.
Callback to listen for events. List of prompt events can be found [here][callprompt]. Example event: [`onStarted`][callprompt-onstarted].
#### Returns
`Promise`\<[`CallPrompt`][callprompt]>
A promise that resolves to a [`CallPrompt`][callprompt] object that you can use to
view the current state and results of the `prompt` session.
#### Examples
**Digits Example**
In this example, we dial a phone number and prompt for digits. After the digits are entered or a timeout occurs, the prompt session will end and return the digits results,
and the call will hangup.
We also listen for prompt events.
```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();
// Prompt for digits. After the digits are entered or a timeout occurs, the prompt session will end and return the digits results, and the call will hangup.
await call.prompt({
playlist: new Voice.Playlist().add(
Voice.Playlist.TTS({ text: "Please enter your PIN number."})
),
digits: {
max: 4,
digitTimeout: 10,
terminators: "#*"
},
listen: {
onStarted: () => console.log("Prompt started!"),
onFailed: () => console.log("Prompt failed!"),
onUpdated: (promptResult) => console.log("Prompt updated!", promptResult.result),
onEnded: (promptResult) => {
console.log("Prompt ended!", promptResult.result);
call.hangup();
}
}
}).onStarted();
}
});
```
**Speech Example**
In this example, we dial a phone number and prompt for speech. After the speech is entered or a timeout occurs, the call will hangup.
We also listen for prompt events.
```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();
// Prompt for speech. After the speech is entered or a timeout occurs, the call will hangup.
await call.prompt({
playlist: new Voice.Playlist().add(
Voice.Playlist.TTS({ text: "Please enter your PIN number."})
),
speech: {
model: "enhanced.phone_call"
},
listen: {
onStarted: () => console.log("Prompt started!"),
onFailed: () => console.log("Prompt failed!"),
onUpdated: (promptResult) => console.log("Prompt updated!", promptResult.result),
onEnded: (promptResult) => {
console.log("Prompt ended!", promptResult.result);
call.hangup();
}
}
}).onStarted();
}
});
```