The range is from the center of the building; so two spaces to the edge on redoubts, mortars and towers; only one space on anti-tank guns (smaller footprint). A redoubt also has very slightly less detection radius than a tower - I did a base with just the two of them and some parallel roads; it looks like 1/4 of a space difference. I would estimate the tower is just over 7, and the redoubt just under, but they probably both round off to 7.
A key is that unit range is from the unit (probably its center too, but they are so small...) to the nearest point on the building. So especially coming in from a corner of the building, where it effectively sticks out the farthest relative to its detection circle, some units will be able to shoot without being fired back at.