# CallExtensionScope

Artifact: [androidx.core:core-telecom](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/telecom/extensions/CallExtensionScope.kt+class:androidx.core.telecom.extensions.CallExtensionScope) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
interface CallExtensionScope
```

<br />

*** ** * ** ***

Provides a scope where extensions can be first initialized and next managed for a `https://developer.android.com/reference/android/telecom/Call.html` once `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#onConnected(kotlin.coroutines.SuspendFunction1)` is called.

The following extension is supported on a call:

- `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#addParticipantExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)` - Show the user more information about the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`s in the call.

```kotlin
class InCallServiceImpl : InCallServiceCompat() {
...
  override fun onCallAdded(call: Call) {
    lifecycleScope.launch {
      connectExtensions(context, call) {
        // Initialize extensions
        onConnected { call ->
          // change call states & listen for extension updates/send extension actions
        }
      }
      // Once the call is destroyed, control flow will resume again
    }
  }
 ...
}
```

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallIconExtensionRemote` | `@https://developer.android.com/reference/kotlin/androidx/core/telecom/util/ExperimentalAppActions https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#addCallIconSupport(kotlin.coroutines.SuspendFunction1)(onCallIconChanged: suspend (https://developer.android.com/reference/android/net/Uri.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Add support for call icon updates and provides a callback to receive those updates. |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/LocalCallSilenceExtensionRemote` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#addLocalCallSilenceExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( onIsLocallySilencedUpdated: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onCanUserUpdateSilence: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add support for this remote surface to display information related to the local call silence state for this call. |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/MeetingSummaryRemote` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#addMeetingSummaryExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( onCurrentSpeakerChanged: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onParticipantCountChanged: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add support for this remote surface to display meeting summary information for this call. |
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/ParticipantExtensionRemote` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#addParticipantExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( onActiveParticipantChanged: suspend (https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onParticipantsUpdated: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add support for this remote surface to display information related to the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`s in this call. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallExtensionScope#onConnected(kotlin.coroutines.SuspendFunction1)(block: suspend (https://developer.android.com/reference/android/telecom/Call.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Called when the `https://developer.android.com/reference/android/telecom/Call.html` extensions have been successfully set up and are ready to be used. |

## Public functions

### addCallIconSupport

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
@ExperimentalAppActions
fun addCallIconSupport(onCallIconChanged: suspend (Uri) -> Unit): CallIconExtensionRemote
```

Add support for call icon updates and provides a callback to receive those updates. This remote surface should implement a `https://developer.android.com/reference/android/database/ContentObserver.html` to observe changes to the icon's content URI. This is necessary to ensure the displayed icon reflects any updates made by the application if the URI remains the same.

```kotlin
connectExtensions(call) {
    val callIconExtension = addCallIconSupport(
        // consume call icon state changes
    )
    onConnected {
        // At this point, support for call icon extension will be known
    }
}
```

| Parameters |
|---|---|
| `onCallIconChanged: suspend (https://developer.android.com/reference/android/net/Uri.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A suspend function that will be invoked with the `https://developer.android.com/reference/android/net/Uri.html` of the new call icon whenever it changes. This callback will only be called if the calling application supports the call icon extension (i.e., `isSupported` returns `true`). |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallIconExtensionRemote` | A `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/CallIconExtensionRemote` instance that allows the remote to check if the calling application supports the call icon extension. The remote *must* use this instance to check support before expecting icon updates. |

### addLocalCallSilenceExtension

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addLocalCallSilenceExtension(
    onIsLocallySilencedUpdated: suspend (Boolean) -> Unit,
    onCanUserUpdateSilence: suspend (Boolean) -> Unit = { _ -> }
): LocalCallSilenceExtensionRemote
```

Add support for this remote surface to display information related to the local call silence state for this call.

```kotlin
connectExtensions(call) {
    val localCallSilenceExtension = addLocalCallSilenceExtension(
        // consume local call silence state changes
    )
    onConnected {
        // At this point, support for the local call silence extension will be known
    }
}
```

| Parameters |
|---|---|
| `onIsLocallySilencedUpdated: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called when the local call silence state has changed and the UI should be updated. |
| `onCanUserUpdateSilence: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = { _ -> }` | Called when the ability for the user to control the silence state has changed. If `false`, the UI should disable the mic control (e.g. grey out the button) because the user is restricted by a meeting moderator or hardware limitations. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/LocalCallSilenceExtensionRemote` | The interface that is used to interact with the local call silence extension methods. |

### addMeetingSummaryExtension

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
fun addMeetingSummaryExtension(
    onCurrentSpeakerChanged: suspend (CharSequence?) -> Unit,
    onParticipantCountChanged: suspend (Int) -> Unit
): MeetingSummaryRemote
```

Add support for this remote surface to display meeting summary information for this call.

This function establishes a connection with a remote service that provides meeting summary information, such as the current speaker and the number of participants. The extension will provide updates via the provided callbacks:

| Parameters |
|---|---|
| `onCurrentSpeakerChanged: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A suspend function that is called whenever the current speaker in the meeting changes. The function receives a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` representing the new speaker's identifier (e.g., name or ID) or null if there is no current speaker. |
| `onParticipantCountChanged: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A suspend function that is called whenever the number of participants in the meeting changes. It receives the new participant count as an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`, which is always 0 or greater. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/MeetingSummaryRemote` | A `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/MeetingSummaryRemote` object with an `isSupported` property of this object will indicate whether the meeting summary extension is supported by the calling application. Example Usage: ```kotlin connectExtensions(call) { val meetingSummaryRemote =  addMeetingSummaryExtension( onCurrentSpeakerChanged = { speaker -> // Update UI with the new speaker Log.d(TAG, "Current speaker: $speaker") }, onParticipantCountChanged = { count -> // Update UI with the new participant count Log.d(TAG, "Participant count: $count") } ) onConnected { if (meetingSummaryRemote.isSupported) { // The extension is ready to use } else { // Handle the case where the extension is not supported. } } } ``` |

### addParticipantExtension

```
fun addParticipantExtension(
    onActiveParticipantChanged: suspend (Participant?) -> Unit,
    onParticipantsUpdated: suspend (Set<Participant>) -> Unit
): ParticipantExtensionRemote
```

Add support for this remote surface to display information related to the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`s in this call.

```kotlin
connectExtensions(call) {
    val participantExtension = addParticipantExtension(
        // consume participant changed events
    )
    onConnected {
        // extensions have been negotiated and actions are ready to be used
    }
}
```

| Parameters |
|---|---|
| `onActiveParticipantChanged: suspend (https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called with the active `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant` in the call has changed. If this method is called with a `null` `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`, there is no active `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`. The active `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant` in the call is the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant` that should take focus and be either more prominent on the screen or otherwise featured as active in UI. For example, this could be the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant` that is actively talking or presenting. |
| `onParticipantsUpdated: suspend (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called when the `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/Participant`s in the `https://developer.android.com/reference/android/telecom/Call.html` have changed and the UI should be updated. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/telecom/extensions/ParticipantExtensionRemote` | The interface that is used to set up additional actions for this extension. |

### onConnected

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
fun onConnected(block: suspend (Call) -> Unit): Unit
```

Called when the `https://developer.android.com/reference/android/telecom/Call.html` extensions have been successfully set up and are ready to be used.

| Parameters |
|---|---|
| `block: suspend (https://developer.android.com/reference/android/telecom/Call.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called when the `https://developer.android.com/reference/android/telecom/Call.html` and initialized extensions are ready to be used. |