I would have a look at the iPhone No Sound troubleshooting page. But chances are there is an issue with the receiver speaker (earpiece speaker).
I would see if you can isolate which functions work properly. Try and play some media and set the balance entirely to one side or the other and see if that effects the sounds. That speaker will also function as an amplified speaker for playing media in stereo. It may just be the speaker grills are all gunked up.
The receiver speaker (or top speaker as Apple calls it) on these is no longer attached to the display, and if I recall correctly it takes some doing to get at if that turns out to be the issue. I believe the logic board has to come out to remove it.