> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# SmartQueueTask

A [SmartQueue](/api-reference/voxengine/scenario-globals#smartqueue) task is for a certain agent, which can be a call or a chat.
Add the following line to your scenario code to use the class:

```
require(Modules.SmartQueue);
```

## Methods

### addEventListener

Adds a handler for the specified [SmartQueueEvents](/api-reference/voxengine/smart-queue-events) event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

```ts
addEventListener(event: SmartQueueEvents | T, callback: (event: _SmartQueueEvents[T]) => any): void
```

**Parameters**

**`event`** `SmartQueueEvents | T` — required

---

**`callback`** `(event: _SmartQueueEvents[T]) => any` — required

---

### end

Ends the current task.

```ts
end(description: string, terminationStatus?: TerminationStatus): void
```

**Parameters**

**`description`** `string` — required

---

**`terminationStatus`** `TerminationStatus`

---

### removeEventListener

Removes a handler for the specified [SmartQueueEvents](/api-reference/voxengine/smart-queue-events) event.

```ts
removeEventListener(event: SmartQueueEvents | T, callback?: (event: _SmartQueueEvents[T]) => any): void
```

**Parameters**

**`event`** `SmartQueueEvents | T` — required

---

**`callback`** `(event: _SmartQueueEvents[T]) => any`

---

## Properties

**`agentCall`** `Call | null`

The agent's Call object.

---

**`clientCall`** `Call | null`

The client's Call object.

---

**`id`** `string`

A [SmartQueue](/api-reference/voxengine/scenario-globals#smartqueue) task's ID.

---

**`parameters`** `SmartQueueTaskParameters`

SmartQueue task's parameters, such as required skills, priority, queue, etc.

---