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

# endCall

> Terminates the current active voice call and cleans up the session in the Click To Call SDK.

Ends the current active call. You can end a call only after the remote party has answered it. While the call is ringing, the method fails.

## Signature

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

## Parameters

None.

## Returns

`Promise<void>`

## Throws

An error if there is no active session to terminate or if the termination fails. The error messages start with `Failed to end call:`, for example, `Failed to end call: No active session to terminate`.

## Example

```typescript theme={null}
await client.endCall();
console.log('Call ended');
```

### With Error Handling

```typescript theme={null}
try {
  await client.endCall();
} catch (error) {
  console.error('Failed to end call:', error.message);
}
```

## More Information

* [startCall](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/start-call.md)
* [disconnect](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/disconnect.md)
* [ended](https://docs-classic.cognigy.com/click-to-call/sdk/event-reference/ended.md) event
* [failed](https://docs-classic.cognigy.com/click-to-call/sdk/event-reference/failed.md) event


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.