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

# getCurrentSession

> Returns the active call session object or null if no call is in progress.

Returns the current active call session, or `null` if no call is active. The session becomes active when the remote party answers the call. While the call is ringing, the method returns `null`.

## Signature

```typescript theme={null}
const session = client.getCurrentSession();
```

## Parameters

None.

## Returns

[`CallSession`](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/types#callsession) `| null` — the active call session, or `null` if no call is in progress.

## Example

```typescript theme={null}
const session = client.getCurrentSession();
if (session) {
  console.log('Active call:', session.id);
  console.log('Muted:', session.muted);
} else {
  console.log('No active call');
}
```

### Toggle Mute Based on Current State

```typescript theme={null}
const session = client.getCurrentSession();
if (session) {
  if (session.muted) {
    await client.unmute();
  } else {
    await client.mute();
  }
}
```

## More Information

* [CallSession](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/types.md#callsession)
* [mute](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/mute.md)
* [unmute](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/unmute.md)


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