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

# Event Reference

The Cognigy Click To Call SDK uses an event-driven architecture. You can subscribe to events using [`client.on()`](/click-to-call/sdk/api-reference/on) and unsubscribe using [`client.off()`](/click-to-call/sdk/api-reference/off). All events are fully typed when using TypeScript.

## Connection Events

| Event                                                           | Description                         | Callback Parameters |
| --------------------------------------------------------------- | ----------------------------------- | ------------------- |
| [connecting](/click-to-call/sdk/event-reference/connecting)     | SIP connection is starting.         | `()`                |
| [connected](/click-to-call/sdk/event-reference/connected)       | SIP connection established.         | `()`                |
| [disconnected](/click-to-call/sdk/event-reference/disconnected) | SIP connection lost.                | `()`                |
| [registered](/click-to-call/sdk/event-reference/registered)     | SIP client registered successfully. | `()`                |
| [unregistered](/click-to-call/sdk/event-reference/unregistered) | SIP client unregistered.            | `()`                |

## Call Events

| Event                                                   | Description                             | Callback Parameters                            |
| ------------------------------------------------------- | --------------------------------------- | ---------------------------------------------- |
| [ringing](/click-to-call/sdk/event-reference/ringing)   | Call is ringing (progress).             | `(session: CallSession)`                       |
| [answered](/click-to-call/sdk/event-reference/answered) | Call was answered by the remote party.  | `(session: CallSession)`                       |
| [ended](/click-to-call/sdk/event-reference/ended)       | Call ended normally.                    | `(session: CallSession, endInfo: CallEndInfo)` |
| [failed](/click-to-call/sdk/event-reference/failed)     | Call failed to connect or was rejected. | `(session: CallSession, endInfo: CallEndInfo)` |
| [muted](/click-to-call/sdk/event-reference/muted)       | Local microphone was muted.             | `(session: CallSession)`                       |
| [unmuted](/click-to-call/sdk/event-reference/unmuted)   | Local microphone was unmuted.           | `(session: CallSession)`                       |

## Audio Events

| Event                                                            | Description                                                                                                   | Callback Parameters     |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------- |
| [captureAudio](/click-to-call/sdk/event-reference/capture-audio) | Remote audio stream is available for advanced processing. Requires `captureAudio: true` in the client config. | `(stream: MediaStream)` |
| [audioEnded](/click-to-call/sdk/event-reference/audio-ended)     | Remote audio stream ended.                                                                                    | `()`                    |

## Info Message Events

| Event                                                            | Description                                  | Callback Parameters                                      |
| ---------------------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------- |
| [infoSent](/click-to-call/sdk/event-reference/info-sent)         | Info message was sent successfully.          | `(text: string, data: Record<string, any>)`              |
| [infoReceived](/click-to-call/sdk/event-reference/info-received) | Info message received from the remote party. | `(data: { originator: string, info: { body: string } })` |

## Transcription Events

| Event                                                             | Description                  | Callback Parameters                                                     |
| ----------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------- |
| [transcription](/click-to-call/sdk/event-reference/transcription) | Transcription data received. | `(transcription: { originator: string; messages: { text: string }[] })` |

## Error Events

| Event                                             | Description        | Callback Parameters |
| ------------------------------------------------- | ------------------ | ------------------- |
| [error](/click-to-call/sdk/event-reference/error) | An error occurred. | `(error: Error)`    |

## Unsubscribing from Events

To remove an event listener, use [`client.off()`](/click-to-call/sdk/api-reference/off) with the same event name and callback reference:

```typescript theme={null}
const onAnswered = (session) => {
  console.log('Call answered:', session.id);
};

// Subscribe
client.on('answered', onAnswered);

// Unsubscribe
client.off('answered', onAnswered);
```

<Warning>
  When using `off()`, you must pass the same function reference that was used with `on()`. Anonymous functions can't be removed.
</Warning>
