onRejectReceived method

Future<void> onRejectReceived(
  1. String? reason
)

Implementation

Future<void> onRejectReceived(String? reason) async {
  Logs().v('[VOIP] Reject received for call ID $callId');
  // No need to check party_id for reject because if we'd received either
  // an answer or reject, we wouldn't be in state InviteSent
  final shouldTerminate = (state == CallState.kFledgling &&
          direction == CallDirection.kIncoming) ||
      CallState.kInviteSent == state ||
      CallState.kRinging == state;

  if (shouldTerminate) {
    await terminate(
        CallParty.kRemote, reason ?? CallErrorCode.UserHangup, true);
  } else {
    Logs().e('Call is in state: ${state.toString()}: ignoring reject');
  }
}