This might be caused by several things, one of them being your phone believing it's connected to an external speaker through the 30-pin connector. When your phone believes it's connected to an external speaker, it assumes the speaker controls the volume, so you can't control the volume. In addition to that, the phone will attempt to transmit any audio through the 30-pin connector. I can't really think of any solution, other than trying to connect and disconnect from a charching cable or docking station, or try a restore.
I assume you've already attempted to reboot the phone, another thing you could try is to connect it to some headphones with the mini-jack port and see if you're able to control the volume with them plugged in. If you have a cotton swab that can fit in the 30-pin connector, you can also try to clean it (do NOT use water, soap or acid, simply a dry, clean swab).
If nothing helps, I suggest you hand it in for a check-up at the nearest Apple Retail store.