If you could state what phone you have we could better help you through this problem :)
Also if nothing is blocking your speaker like Mathieu stated, try doing a back up of your device and doing a factory reset. Chances of this working aren't good because it sounds like it could be a hardware issue. If you do all the troubleshooting and it still doesn't work, I would look into seeing if your device is still covered under warranty or if you have extended warranty protection you could get it fixed that way. Depending on how old the device is of course.