If you resolve the Deferred before your ajax call completes, then $.when will consider it finished and will call the next function (call2). What you need to do is resolve it on the success/fail of your ajax call inside call1.
Edit: You actually need to combine all the promises from your ajax calls so you only resolve the deferred after all of them have completed. I only just noticed the $.each call.