I have certainly found that once you are past the walls phalanxes are perfect. The defenders just smash into them, take horrendous casualties, break and run away, then run back for more. With three units of archers with flaming arrows, it is quite nasty.

Obviously, with wooden walls that you can take down with rams, phalanxes have no trouble. Send skirmishers and mercenaries to knock three holes in the walls, then send in the phalanxes for the enemy to crash against hopelessly.

For stone walls it gets trickier. Most of the time I just auto-resolve. If it's a close thing, then probably mercenaries along with judicious use of missile weapons should work. Onagers would do the trick too (blast three holes in the walls with onagers instead of knocking the holes with rams). I have only used mining once, when I discovered it existed by accident. That would probly be a very good way to get through without storming the walls, and gives your peasants something to do.