I found a solution but with limitation. I have Lumia icon for 2 years and this year I have experienced the problem 2 times. I never use headphone jack. First time, I did factory reset under Settings/about/reset your phone and it works, but that I hate since it wipes out all your data. Today, I have the problem again. I keep plugging and unplugging the headphone jack, hoping it will suddenly work, but it does not. And, every time when I plug the headphone jack, Cortana shows up. It is very annoying. So, I turn off Cortana by clicking Cortana tile/menu (on top right corner)/settings/turn off/restart. After the phone powers up, the problem is gone. It gets out of headphone mode. Then, you can turn on Cortana if you need Cortana. I think Cortana has something to do with the problem. So, if you don't need Cortana, just leave it off. Also, when I plug the headphone jack again, the problem will show up again. Then, I will just need to turn off Cortana again or turn on, then turn off Cortana. This mean I am better off not using headphone jack and Cortana to keep the problem away.
Updated:
Unbelievable! Today the problem happens again for no reason. And it is still stuck in Headphones mode after I turn on/off Cortana. I gave up & very ready to get a new phone, not Windows phone. After 15 minutes, I checked my phone and it changed back to Ringer mode itself. When it is stuck in Headphones mode, fortunately, it will still ring loud when the call comes in & you can answer the call with a headphone or Speaker feature turned on. I search google and find out even Android phone and iPhone have the same problem. So, good luck.