Ray / Acceleration Structure Traversal

Based on my knowledge the intersection shader is executed when a ray intersects with one of the primitives (i.e. the leaf nodes of BVH). I want to make a function that is executed when the ray intersects any nodes on the BVH (internal and leaf nodes). Is that possible?