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

# SmartQueueTask

A `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**

### end

Ends the current task.

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

**Parameters**

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

## Properties

The agent's Call object.

The client's Call object.

A `SmartQueue` task's ID.

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