# Prompt

The Prompt component plays audio to callers as they move through a call flow. Use it to greet people, read out instructions, or hold them with music while the rest of the flow decides where to send them.

## What you can play

The component supports three kinds of prompt.

| Prompt type | What it plays |
| --- | --- |
| Custom Prompt | An existing custom prompt, or a new one you record from an extension or upload as an audio file. |
| Music on Hold (MoH) | A hold-music track you have already saved on the system. |
| Text to Speech (TTS) | Text you type, spoken back in the language and voice style you choose. |

:::note
Before you can select Music on Hold, the track has to exist. Add it under **PBX Settings > Voice Prompt > Music on Hold** first.

![Choosing a saved hold-music track for the component](/images/pbx/moh-call-flow.png)
:::

:::note
Text to Speech only appears once the feature is turned on. Enable it under **Integrations > AI**.

![Turning on the text-to-speech integration](/images/pbx/enable-tts-cfd.png)
:::

## Configure the component

1. Add the Prompt component to your call flow, then click it to open its settings.

   ![Opening the Prompt component to begin configuration](/images/pbx/prompt-cfd.png)

2. Choose a prompt type and fill in its settings, following the relevant section below.

3. Click **Confirm** in the bottom-right corner. The prompt you picked now shows on the component.

   ![The configured prompt shown on the component](/images/pbx/prompt-selected-cfd.png)

### Play a custom prompt

![Selecting one or more custom prompts](/images/pbx/custom-prompt-prompt.png)

1. Select **Custom Prompt**.
2. Choose the prompt or prompts to play.

   :::note
   You can add up to **5** custom prompts.
   :::

   - To use a prompt that already exists, pick it from the **Prompt** list.
   - To add a new one, click **Record New** to record from an extension, or **Upload** to add an audio file.

     :::note
     New prompts are saved under **PBX Settings > Voice Prompt > Custom Prompt**.
     :::

3. Optional: to repeat the prompt(s) continuously, select **Enable Loop Playback**.

   :::caution
   The loop is not permanent. As soon as the caller reaches the next connected component, if that component has its own prompt it takes over and the loop stops. Do not rely on loop playback to hold a caller indefinitely.
   :::

### Play music on hold

![Selecting a saved hold-music track](/images/pbx/select-moh-prompt.png)

1. Select **Music on Hold**.
2. Pick a saved track from the **Music on Hold** list.

:::note
The hold music is cut short if the next connected component has its own prompt, that prompt takes over.
:::

### Play a text-to-speech message

![Entering text and choosing a voice for text to speech](/images/pbx/tts-prompt.png)

1. Select **Text to Speech**.
2. Enter the message and choose its voice style. You can write either static or dynamic text.

   - **Static text**: type the message straight into the **Text** field.
   - **Dynamic text**: type the message and drop in placeholders backed by [variables](/pbx/call-flow-designer-guide/constants-and-variables-in-cloud-voice-cfd-expression/), so the wording is built at call time. You can also set how long the system may take to generate the speech and where to send the caller if that limit is hit.

     **Example:**

     ![A dynamic text-to-speech message built from variables](/images/pbx/cfd-tts-example.gif)

   The generated speech is stored on the system and synced to **PBX Settings > Voice Prompt > Custom Prompt**.

3. Optional: to control what happens when the speech takes too long to generate, select **TTS Response Timeout**, then attach the next components to the **TTS Playback Success** and **TTS Response Timeout** branches.

   :::note
   Leave the timeout branch unset and a caller who hits the limit simply moves on to the next component without hearing anything.
   :::

## Component variable

When a Prompt component uses text to speech, the system saves the outcome in a variable. Expression-aware components such as [Condition](/pbx/call-flow-designer-guide/condition/) can read that value and route the call accordingly.

:::note
Because a call flow can hold several Prompt components, each one is numbered in the order it was added (Prompt 1, Prompt 2, and so on). Include the right index in the variable so you read the outcome of the component you mean.
:::

| Variable | Type | Description | Example |
| --- | --- | --- | --- |
| `$Prompt{index}.ttsResult` | String | The text-to-speech outcome of the Prompt component: `PromptTTSResult.Success` means the text was converted and played to the caller; `PromptTTSResult.Timeout` means it was not generated in time, so the caller moved straight to the next component with no prompt. | `$Prompt1.ttsResult(STRING)=PromptTTSResult.Success` |

## Connect the component

A Prompt component connects to **one** downstream component, or **two** when **TTS Response Timeout** is on (one for success, one for the timeout). You can connect any of the components below.

| Component | What it does |
| --- | --- |
| [Prompt](/pbx/call-flow-designer-guide/prompt/) | Plays another audio prompt or text-to-speech message to the caller. |
| [Business Hours](/pbx/call-flow-designer-guide/business-hours/) | Routes calls to different destinations based on the time of day. |
| [Menu](/pbx/call-flow-designer-guide/menu/) | Offers callers a set of options and routes on the DTMF (Dual-Tone Multi-Frequency, the touch-tone signal a phone keypad sends) digit they press. |
| [User Input](/pbx/call-flow-designer-guide/user-input/) | Collects DTMF digits from the caller, usually paired with Condition to route on what was entered. |
| [Language](/pbx/call-flow-designer-guide/language/) | Switches the system-prompt language for the components that follow. |
| [Record](/pbx/call-flow-designer-guide/record/) | Starts recording once the caller connects to another party, with optional notice prompts, or disables recording for a call that would otherwise be recorded. |
| [Dial by Number](/pbx/call-flow-designer-guide/dial-by-number/) | Lets callers dial a number directly to reach their destination. |
| [Dial by Name](/pbx/call-flow-designer-guide/dial-by-name/) | An end component that lets callers reach a user by typing the first three letters of their name. |
| [Transfer](/pbx/call-flow-designer-guide/transfer/) | An end component that hands the caller to a set destination, with an optional prompt announcing the transfer. |
| [Hang Up Call](/pbx/call-flow-designer-guide/hang-up-call/) | An end component that disconnects the caller. |
| [Condition](/pbx/call-flow-designer-guide/condition/) | Routes calls according to logical expressions. |
| [Loop](/pbx/call-flow-designer-guide/loop/) | Repeats a group of components a set number of times or until a condition is met. |
| Internal Data Ops | Reads from and writes to the PBX's built-in database. See [Get Extension Presence Status](/pbx/call-flow-designer-guide/get-extension-presence-status/), [Set Extension Presence Status](/pbx/call-flow-designer-guide/set-extension-presence-status/), [Get Queue Agent](/pbx/call-flow-designer-guide/get-queue-agent/), [Get Queue Info](/pbx/call-flow-designer-guide/get-queue-info/), [Get Agent Status](/pbx/call-flow-designer-guide/get-agent-status/), [Set Agent Status](/pbx/call-flow-designer-guide/set-agent-status/), [Get System Info](/pbx/call-flow-designer-guide/get-system-info/), [Get System Capacity](/pbx/call-flow-designer-guide/get-system-capacity/), [Get Extension Info](/pbx/call-flow-designer-guide/get-extension-info/), and [Get Company Contact Info](/pbx/call-flow-designer-guide/get-company-contact-info/). |
| [Email Sender](/pbx/call-flow-designer-guide/email-sender/) | Sends email for real-time notifications, alerts, or user-specific information. |
| [Database Access](/pbx/call-flow-designer-guide/database-access/) | Runs SQL (Structured Query Language, the language used to read and write database records) against a database mid-call to read or update data. |
| [HTTP Request](/pbx/call-flow-designer-guide/http-request/) | Sends HTTP requests to external servers to exchange data with third-party services. |
