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
Property | Type | Description |
---|---|---|
result | Relay.Calling.PromptResult | Final result of this prompt |
state | string | Current state |
completed | boolean | Whether the prompt attempt has finished |
payload | object | Payload sent to Relay to start prompt |
controlId | string | UUID 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
Parameter | Type | Required | Description |
---|---|---|---|
volume | number | ✓ | Volume 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)