# SessionEvents

Source: https://docs.voice.kheelona.com/reference/sdk/interfaces/sessionevents/

What `session.on(name, fn)` delivers.

## Properties

### ended

> **ended**: `object`

The session is over. Fires once. `reason` is one of `client_ended`, `partner_ended`, `max_duration`,
`idle_timeout`, `disconnected`, `server_shutdown`, `provider_failure`, `suspended`, `service_stopped` (the voice
service was switched off; start a new session once it is back) or `error`.

#### durationMs

> **durationMs**: `number`

#### reason

> **reason**: `string`

#### turns

> **turns**: `number`

***

### error

> **error**: [`SessionErrorInfo`](https://docs.voice.kheelona.com/reference/sdk/interfaces/sessionerrorinfo.md)

A problem. `fatal: false` means the session goes on (for example `audio_unavailable`).

***

### event

> **event**: [`ServerEvent`](https://docs.voice.kheelona.com/reference/sdk/type-aliases/serverevent.md)

Every event from the service, as parsed, for logging or for events the SDK doesn't map.

***

### interrupted

> **interrupted**: `object`

The reply was cut off (the person spoke, or `interrupt()` was called). `heardMs` is how much was heard.

#### heardMs

> **heardMs**: `number`

#### replyId

> **replyId**: `string`

***

### replySentence

> **replySentence**: `object`

One sentence of the voice's reply, with its emotion, as it is spoken.

#### emotion

> **emotion**: `string`

#### index

> **index**: `number`

#### replyId

> **replyId**: `string`

#### text

> **text**: `string`

***

### safety

> **safety**: `object`

The safety layer acted on a turn: the stage, the category (a level, never the text) and the action taken.

#### action

> **action**: `string`

#### category

> **category**: `string`

#### stage

> **stage**: `string`

#### turn

> **turn**: `number`

***

### state

> **state**: [`SessionState`](https://docs.voice.kheelona.com/reference/sdk/type-aliases/sessionstate.md)

The session's state changed.

***

### transcript

> **transcript**: `object`

What the person said, once the service has understood the turn. `languageStage` is the language's stage; `languageBeta` is true for any
language that is not supported (beta or alpha).

#### language

> **language**: `string`

#### languageBeta

> **languageBeta**: `boolean`

#### languageStage

> **languageStage**: [`LanguageStage`](https://docs.voice.kheelona.com/reference/sdk/type-aliases/languagestage.md)

#### text

> **text**: `string`

#### turn

> **turn**: `number`

***

### warning

> **warning**: `object`

A heads-up before the session ends, for example `secondsLeft` before the time limit.

#### code

> **code**: `string`

#### secondsLeft

> **secondsLeft**: `number`
