To begin understanding the problem, you should go to settings -> about phone -> diagnostics -> tests and test the functionality of the microphone. Alternatively, you can dial *#*#7378423#*#* and test the mic in the service menu.
The test result is important for undestanding the problem. You can get muffled sound, no sound at all, or just buzzing. The test result defines what kind of actions you should take to repair your device.
Also test the secondary microphone (used for things like recording sound for video), it might come in handy later to know if it works.