That's a bummer!
This may sound like a silly suggestion, but is there any piece of packaging still over the microphone/bottom of the iPhone. This happened to someone i know: they put their new phone into a case, but didn't remove a piece of plastic that was covering the mic, resulting in horribly muffled sound.
Just a thought!
The iPhone 5 you're using now...is it new? As in, did you purchase it new or used? If it's new or was sold by a retailer that will accept exchange for defective phones within their written exchange/return policy then you may want to consider doing that. If you purchased it used you may have to troubleshoot to determine if there was some sort of damage to the device that's causing the issue.