Check the last argument of onCollision
It's a normal vector, that is, a vector perpendicular to the surface it hit, so on a cuboid brick it will either be "-1 0 0", "1 0 0", "0 -1 0", "0 1 0", "0 0 -1", or "0 0 1" and you can just build a small lookup table with which represents which direction ("0 0 1" would be the top surface, "0 0 -1" the bottom surface, etc)
It won't be quite that simple for bricks with round/diagonal edges in the collision mesh