Skip to main content

Relay.Calling.PromptAction

This object returned from one of asynchronous prompt methods that represents a prompt attempt that is currently active on a call.

Properties

PropertyTypeDescription
resultRelay.Calling.PromptResultFinal result of this prompt
statestringCurrent state
completedbooleanWhether the prompt attempt has finished
payloadobjectPayload sent to Relay to start prompt
controlIdstringUUID to identify the prompt

Methods

stop

Stop the action immediately.

Parameters

None

Returns

Promise<StopResult> - Promise object that will be fulfilled with a Relay.Calling.StopResult object.

Examples

Ask user to enter a PIN and force-stop the action after 5 seconds.

async function main() {
const collect = {
type: 'digits',
digits_max: 3,
initial_timeout: 10,
text: 'Please, enter your 3 digit PIN.'
}
const action = await call.promptTTSAsync(collect)

// ...

setTimeout(async () => {
const stopResult = await action.stop()
}, 5000)
}

main().catch(console.error)

volume

Control the volume of the playback.

Parameters

ParameterTypeRequiredDescription
volumenumberVolume value between -40dB and +40dB where 0 is unchanged

Returns

Promise<PromptVolumeResult> - Promise object that will be fulfilled with a Relay.Calling.PromptVolumeResult object.

Examples

Start the prompt and increase the playback volume.

async function main() {
const collect = {
type: 'digits',
digits_max: 3,
text: 'Please, enter your 3 digit PIN.'
}
const action = await call.promptTTSAsync(collect)

const volumeResult = await action.volume(5.0)
}

main().catch(console.error)