# Get Queue Agent

Get Queue Agent is one of the Internal Data Ops operations. Point it at a queue, choose which agent statuses you care about, and it returns the matching agents as a list you can use later in the flow.

## What it does

The component looks inside a single queue and hands back every agent whose status matches the one(s) you asked for. You can name the queue outright or build an expression so the target is decided while the call is running. Whatever comes back is written to variables, ready to be passed into a following component or evaluated in a **Condition**.

:::tip
Get Queue Agent only gathers information: it does not play audio or route the call on its own. The usual pattern is to follow it with a **Condition** component that checks the result, for example routing to the queue only when at least one agent is logged in, and to voicemail otherwise.
:::

## Configure the component

1. Drag the **Internal Data Ops** component onto the canvas, then click it to open its settings.

   ![The Internal Data Ops block placed on the call flow canvas](/images/pbx/developer-component-cfd.png)

2. In the **Component Type** drop-down list, choose **Get Queue Agent**.

   ![Choosing Get Queue Agent from the Component Type list](/images/pbx/get-queue-agent-cfd.png)

3. Point the component at a queue using one of these methods:

   ![Selecting the target queue for the lookup](/images/pbx/developer-select-queue-cfd.png)

   - **Queue**: pick a queue from the drop-down list.
   - **Expression**: click the *fx* icon and enter an expression to resolve the queue at runtime.

     ![Entering an expression that resolves the target queue](/images/pbx/get-queue-agent-expression.png)

     For example, `$UserInput1.userInput` uses the queue number the caller keyed in.

   :::note
   For the variables and functions you can use in an expression, see [Variables and Functions in Cloud Voice Expression](/pbx/call-flow-designer-guide/constants-and-variables-in-cloud-voice-cfd-expression/).
   :::

4. In the **Agent Status** drop-down list, select one or more statuses to filter the agents by.

   ![Selecting one or more agent statuses to filter the results](/images/pbx/agent-status-cfd.png)

5. Click **Confirm** in the bottom-right corner.

## Variables

Adding a Get Queue Agent component writes the matching agents into the variables below. Read them from any expression-aware component, **Condition**, for instance, to branch on what the lookup returned.

:::note
A call flow can hold more than one Get Queue Agent component, so each is numbered in the order you add it (Get Queue Agent 1, Get Queue Agent 2, and so on). Include the matching index in the variable name so you read from the right component.
:::

| Variable | Type | Description | Example |
|----------|------|-------------|---------|
| `$GetQueueAgent{index}.agentList` | Object | The matching agents in the queue, each returned as its extension number paired with its current status. | `"1001,Log Out;1003,Log Out;1004,Log Out"` |
| `$GetQueueAgent{index}.agentNumberList` | Object | The matching agents in the queue, returned as extension numbers only. | `"1001,1003,1004"` |

:::tip
Two functions help you read individual values out of the returned list:

- `GET_LIST_ITEM_COUNT`, the number of items in the list. For example, `FX_GREATER_THAN(FX_GET_LIST_ITEM_COUNT($GetQueueAgent1.agentNumberList),0)` tests whether at least one logged-in agent was found.
- `GET_LIST_ITEM`, the value at a given position. For example, `FX_GET_LIST_ITEM($GetQueueAgent1.agentNumberList,2)` returns the third agent in the list.
:::

## What it can connect to

A Get Queue Agent component leads to **exactly one** downstream component. Any of the following can follow it:

| Component | Purpose |
|-----------|---------|
| [Prompt](/pbx/call-flow-designer-guide/prompt/) | Play an audio file or a text-to-speech message to the caller. |
| [Business Hours](/pbx/call-flow-designer-guide/business-hours/) | Route the call to different destinations depending on the time of day. |
| [Menu](/pbx/call-flow-designer-guide/menu/) | Offer callers a set of options and route them by the DTMF (Dual-Tone Multi-Frequency, the touch-tone signal a phone keypad sends) key they press. |
| [User Input](/pbx/call-flow-designer-guide/user-input/) | Collect DTMF digits from the caller, usually paired with **Condition** to act on what was entered. |
| [Language](/pbx/call-flow-designer-guide/language/) | Change the system prompt language for the rest of the flow. |
| [Record](/pbx/call-flow-designer-guide/record/) | Start recording once the caller connects to another party, with optional notification prompts, or turn recording off for a call that would otherwise be recorded. |
| [Dial by Number](/pbx/call-flow-designer-guide/dial-by-number/) | Let 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 sends the caller to a chosen destination, with optional prompts announcing the transfer. |
| [Hang Up Call](/pbx/call-flow-designer-guide/hang-up-call/) | An end component that disconnects the call. |
| [Condition](/pbx/call-flow-designer-guide/condition/) | Route the call based on logical expressions. |
| [Loop](/pbx/call-flow-designer-guide/loop/) | Repeat a group of components a set number of times or until a condition is met. |
| Internal Data Ops | Read from and write to the Cloud Voice system's own 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/) | Send an email for real-time notifications, alerts, or user-specific information. |
| [Database Access](/pbx/call-flow-designer-guide/database-access/) | Run a SQL (Structured Query Language) operation against an external database during the call flow. |
| [HTTP Request](/pbx/call-flow-designer-guide/http-request/) | Send an HTTP (Hypertext Transfer Protocol) request to an external server to exchange data with a third-party service. |
