Box collider not colliding with Character controller

I have a player with a CharacterController attached. The player can move around.

There are obstacles which the player can collide with. These obstacles have a BoxCollider and a Rigidbody which is set to "kinematic" as I don’t want these obstacles to be affected by physics and they don’t move.

Every time the player collides with an obstacle he receives some damage. To do that I used this piece of code on the obstacle.

private void OnCollisionEnter(Collision collision) {      print("hit");      if (collision.gameObject.tag == "Player") {             collision.gameObject.GetComponent<Player>().TakeDamage(damage);             print("hit player");         }     } 

But the obstacle doesn’t register collision events from the Player.

The player on the other hand is able to receive collision from the obstacle in the OnControllerColliderHit() and I can set the damage received in there but I’m not sure if that’s a good way.