Even as the missiles flew across the waters separating Iran and Qatar, diplomacy was in motion. And it worked.