Handling delays in bots
Provide feedback to users while backend processing is happening
When the gather verb collects a user utterance and submits it to the jambonz webhook or websocket application for processing, there may be a noticeable delay depending on what the back-end logic needs to do.
For instance, it may need to update a CRM system, make an http request, or feed an LLM and wait for a response. Some of these operations may take a while to complete, and you may want to be able to provide a user with some calming feedback that this is normal system processing.
The actionhook delay feature provides a way to pre-program instructions on what to say or play
something when these sorts of delays are experienced. This feature is enabled by the actionHookDelayAction
property
in either the gather or config verbs.
Parameters
An array of actions (jambonz
verbs) to take when noResponseTimeout
is triggered.
Enable or disable the actionHookDelayAction
feature.
Length of time (in seconds) to give up and stop performing actions.
Default: none
.
Length of delay (in seconds) that triggers an action.
Default: 0
.
Number of times to perform actions, with a noResponseTimeout
between each retry.
Default: 1
.
Examples
Providing filler noise
A simple use case is to provide filler noise when a back end operation takes a long time. Here, if the response takes longer than two seconds we play some typing sounds to the caller.
Providing a series of prompts
A more complex use case would be to prompt multiple times as the delay gets longer, and then hang up the call if the bot does not respond in 20 seconds.
Note in the above that we have an array with two prompts. The first is played after 5 seconds of delay and a different prompt is played if the user is still waiting for a response after 10 seconds. If the delay reaches 20 seconds, then the call is terminated.