> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.jambonz.org/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.jambonz.org/_mcp/server.

# Handling delays in bots

When the [gather verb](/verbs/verbs/gather) 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/verbs/config) verbs.

## Parameters

**`actions`** `array` — required

An array of actions (`jambonz` verbs) to take when `noResponseTimeout` is triggered.

---

**`enabled`** `boolean` — required

Enable or disable the `actionHookDelayAction` feature.

---

**`noResponseGiveUpTimeout`** `number`

Length of time (in seconds) to give up and stop performing actions.\
Default: `none`.

---

**`noResponseTimeout`** `number`

Length of delay (in seconds) that triggers an action.\
Default: `0`.

---

**`retries`** `number`

Number of times to perform actions, with a `noResponseTimeout` between each retry.\
This count applies to each verb in the actions array, so if you have 2 actions and set retries to 3 it will play the first, then the 2nd, then the first  again. If it is not set or is less than the length of the array then each verb in the array will run only once.
Default: `1`.

---

> **Warning**
>
> If you are using Webhooks as opposed to Websockets then the HTTP\_TIMEOUT parameter of the system will limit the maximum length the `noResponseGiveUpTimeout` can be, as if no response is received within the HTTP TIMEOUT the webhook will fail.
> The Default value for HTTP\_TIMEOUT on Jambonz.cloud is 10seconds.

## 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.

```json
{
  "verb": "gather",
  "actionHook": "/processUserUtterance",
  "actionHookDelayAction" : {
    "enabled": true,
    "noResponseTimeout": 2,
    "actions": [
      {
        "verb": "play",
        "url": "http://adfads/typing-sounds.mp3"
      }
    ]
  }
}
```

#### 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.

```json
{
  "verb": "config",
  "actionHookDelayAction" : {
    "enabled": true,
    "retries": 2,
    "noResponseTimeout": 5,
    "noResponseGiveUpTimeout": 20,
    "actions": [
      {
        "verb": "say",
        "text": "Please hold while we complete your transaction"
      },
      {
        "verb": "say",
        "text": "Please continue to hold."
      }
    ]
  }
},
{
  "verb": "gather",
  "say": "Would you like us to book your flight now?",
  "input": ["speech"],
  "actionHook": "/processUserUtterance"
}
```

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.