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

# VoiceDSP

## Methods

### addEventListener

Adds a handler for [Agentic.VoiceDSPEvents](/api-reference/voxengine/agentic/voice-dsp-events).
Use only functions as handlers; anything except a function leads to the error and scenario
termination when a handler is called.

```ts
addEventListener(event: Agentic.VoiceDSPEvents | T, callback: (event: Agentic._VoiceDSPEvents[T]) => any): void
```

**Parameters**

**`event`** `Agentic.VoiceDSPEvents | T` — required

---

**`callback`** `(event: Agentic._VoiceDSPEvents[T]) => any` — required

---

### close

Closes the VoiceDSP WebSocket connection.

```ts
close(): void
```

### id

Returns the VoiceDSP id.

```ts
id(): string
```

### removeEventListener

Removes a handler for the specified event.

```ts
removeEventListener(event: Agentic.VoiceDSPEvents | T, callback?: (event: Agentic._VoiceDSPEvents[T]) => any): void
```

**Parameters**

**`event`** `Agentic.VoiceDSPEvents | T` — required

---

**`callback`** `(event: Agentic._VoiceDSPEvents[T]) => any`

---

### reset

Reset the VoiceDSP context (sends a **Reset** message to the connector).

```ts
reset(): void
```

### signalAssistantTurnEnded

Signals that the assistant has finished speaking. Clears the assistant-speaking state used for `Agentic.VoiceDSPEvents.TurnStarted` **interrupted** and starts the `Agentic.VoiceDSPParameters.userTurnIdleTimeout` idle timer when no user turn is in progress (mirrors Pipecat `BotStoppedSpeakingFrame`).

```ts
signalAssistantTurnEnded(): void
```

### signalAssistantTurnStarted

Signals that the assistant has started speaking. Marks the assistant as speaking for `Agentic.VoiceDSPEvents.TurnStarted` **interrupted** and cancels the `Agentic.VoiceDSPParameters.userTurnIdleTimeout` idle timer (mirrors Pipecat `BotStartedSpeakingFrame`).

```ts
signalAssistantTurnStarted(): void
```

### stop

Stops the VoiceDSP (sends **Stop** to the connector, then closes the WebSocket).

```ts
stop(): void
```

### webSocketId

Returns the VoiceDSP WebSocket id.

```ts
webSocketId(): string
```