Saw a bunch of posts on this and some of the answers are pretty stupid. In fact, some are malicious. There is no software reset, reboot, network reset steps to do this. The headphone jack is DIRTY and/or got wet. That simple. Phone thinks there is a jack in there so its stuck in headphone mode. One suggestion was to stick a paperclip in the jack. That will potentially damage your jack and phone!!! How stupid can one be?
Heres a fix that is SAFE and works. Use a cotton swab to rub alcohol or contact cleaner on the head phone cable jack and insert it a few times. Each time you pull it out, wipe the jack clean and insert it again. keep doing it until you see your ringer volume pop back up. Don't stuff a cotton swab up in there. I ended up using a toothpick with a tiny lens cleaner cloth wrapped around it and was able to insert it into the jack and rotate as I pulled it out. Lens cloth came out very dirty. Phone works now.