Skip to content

Observe call events

Federico Marin edited this page Nov 20, 2023 · 7 revisions

Observe call events

To observe the call state it is necessary to observe the state flow exposed.

call.state
	.onEach { callState -> 
		Log.d("CALL STATE", "$callState")
	}
	.launchIn(MainScope())

Observe call recording

Whenever a call is recorded, the call recording type can be either manual (recording is started by admin callee) or automatic (recording starts when the call is connected).

Call.Recording.Type can be retrieved from call info as show below.

call.recording
	.onEach { callRecordingType ->
		Log.d("CALL RECORDING TYPE", "$callRecordingType") // Call.Recording.Type.OnConnect or Call.Recording.Type.OnDemand or Call.Recording.Type.Never
	}
	.launchIn(MainScope())

Call recording state can be observed as shown below:

call.recording.flatMapLatest { it.state }
	.onEach { callRecordingState ->
		Log.d("CALL RECORDING STATE", "$callRecordingState") // Call.Recording.Type.OnConnect or Call.Recording.Type.OnDemand or Call.Recording.Type.Never
	}
	.launchIn(MainScope())
Clone this wiki locally