> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# destroy

Disconnects from the SIP server, ends any active call, and releases all resources. This method calls `disconnect()`, then destroys all internal managers (`AudioManager`, `SessionManager`, `SipManager`), clears the cached configuration, and removes all event listeners. Call this method when the client is no longer needed, for example, on page unload. Once destroyed, the client instance cannot be reused.

## Signature

```typescript theme={null}
await client.destroy();
```

## Parameters

None.

## Returns

`Promise<void>`

## Throws

An error if the cleanup process fails.

## Example

```typescript theme={null}
await client.destroy();
console.log('Client destroyed');
```

### Cleanup on Page Unload

```typescript theme={null}
window.addEventListener('beforeunload', () => {
  void client.destroy().catch(() => {
    // Ignore errors during page unload
  });
});
```

## More Information

* [disconnect](/click-to-call/sdk/api-reference/disconnect)
* [endCall](/click-to-call/sdk/api-reference/end-call)
