There are 2 different mics in the iPhone, One on the bottom for voice memo and calls, the other on the top near the headphone jack for videos. THe one that is not working is mart of the charging port assembly. You would need to take the phone apart and make sure there isn't any liquid damage on or around the charger port connector on the main board. If not, then I would suspect the charger port it'self. Once this is replaced with a new on you should be good to go.
I work for a large unnamed "refrubisher/insurance" company and we see this issue all the time. The two main culprits are; 1. Corrosion on the board (IE: Liquid Damage) 2. Bad charging port assembly. If you don't see the first, change the second. Works 99% of the time. Hope this helps.