Skip to main content
Returns the current active call session, or null if no call is active.

Signature

const session = client.getCurrentSession();

Parameters

None.

Returns

CallSession | null — the active call session, or null if no call is in progress.

Example

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

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

More Information