Rome only recovered because Hannibal didn't march on Rome.
Hannibal never marched on Rome because he knew he could never take it. Doing a siege in the area most loyal to Rome would have been suicidal for his force.
In case of siege, the Romans would not need to fight, they could simply wait until his army slowly died from attrition.
However, he 1) Failed to turn most of the socii to his side. 2) Ignored the western roman allies who were slowly eating away at Iberia.