> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# setEchoCancellation

> Toggle echo cancellation on the local mic at runtime.

```ts
setEchoCancellation(enabled): Promise<void>
```

Toggle echo cancellation on the local mic at runtime. Applied via
`track.applyConstraints`; browsers that don't honour runtime constraints
(notably iOS Safari) fall back to re-acquiring the track with the new
constraint set and plumbing the replacement through the local audio
pipeline if one is active.

## **Parameters**

Whether echo cancellation should be enabled.

## **Returns**

`Promise<void>` — resolves after the constraint has been applied (via `applyConstraints` or, on browsers without runtime support, after a track replacement).

## **Examples**

### Toggle from a UI switch

```ts
echoSwitch.addEventListener('change', async (e) => {
  await call.setEchoCancellation(e.target.checked);
});
```

## **See**

* [`setAutoGainControl`](/docs/browser-sdk/v4/reference/webrtc-call/set-auto-gain-control), [`setNoiseSuppression`](/docs/browser-sdk/v4/reference/webrtc-call/set-noise-suppression) — companion processing toggles.