For 22 hours, hostages were trapped inside the headquarters of the Pakistani army before commandos raided the building and set them free from Islamist militants.