Skip to main content

CallPrompt

Represents a current or past prompting session in a call.

Accessors

confidence

get confidence(): number

Confidence level for the speech recognition result (if type is "speech"), from 0 to 100. For example, 83.2.

Returns

number


digits

get digits(): string

The digits that have been collected (if type is "digit"). For example, "12345".

Returns

string


id

get id(): string

The unique id for this prompt.

Returns

string


reason

get reason(): "no_match" | "no_input" | "error"

Alias for type, in case of errors. Use this field to check the reason of the error.

Returns

"no_match" | "no_input" | "error"


terminator

get terminator(): string

The terminator used to complete the prompt (if type is "digit"). For example, "#".

Returns

string


text

get text(): string

The text that has been collected (if type is "speech"). For example, "hello who's there".


type

get type(): "error" | "no_input" | "no_match" | "digit" | "speech"

The type of this prompt.

Returns

"error" | "no_input" | "no_match" | "digit" | "speech"

Methods

ended

ended(): Promise<CallPrompt>

Returns a promise that is resolved only after this prompt finishes (or is stopped).

Returns

Promise<CallPrompt>

Example

const prompt = await call.promptTTS({
text: "Please enter your PIN",
digits: {
max: 5,
digitTimeout: 2,
terminators: "#*",
},
});
const { type, digits, terminator } = await prompt.ended();

setVolume

setVolume(volume): Promise<CallPrompt>

Changes the volume of the audio.

Parameters

NameTypeDescription
volumenumberVolume value between -40dB and +40dB.

Returns

Promise<CallPrompt>

Example

const prompt = await call.promptTTS({
text: "Please enter your PIN",
digits: {
max: 5,
digitTimeout: 2,
terminators: "#*",
},
});
await prompt.setVolume(-20);

stop

stop(): Promise<CallPrompt>

Stops the prompt.

Returns

Promise<CallPrompt>

Example

const prompt = await call.promptTTS({
text: "Please enter your PIN",
digits: {
max: 5,
digitTimeout: 2,
terminators: "#*",
},
});
await prompt.stop();

waitForResult

waitForResult(): Promise<CallPrompt>

Returns a promise that is resolved only after this prompt finishes (or is stopped).

caution

This method is deprecated. See ended instead.