decline method

Future<void> decline()

Decline the current inbound call.

Implementation

Future<void> decline() async {
  final call = current.value;
  if (call == null) return;
  await _guard(() => _callKit.reportEnded(call.sessionId));
  _dismissNativeCall(call.sessionId);
  _markEnded(call.sessionId);
  if (call.legId != null) {
    await _post('/partner/voice/legs/hangup', {'legId': call.legId, 'reason': 'declined'});
  }
  _set(call.copyWith(state: VoiceCallState.rejected, endReason: 'declined'));
  _teardown();
}