My iPhone volume not working?

My iPhones volume will go off randomly. After a certain period of time it will come back on. The only way it will turn back on is if I put earphones in it. Why does it do this? What do I do to stop this?

Switch to a samsung galaxy device

You could try resetting your phone.
Save your contacts and everything you need and try that.

Also, have you tried this?
http://www.apple.com/...ne/repair/

And maybe, there's something physically wrong with your iPhone.
If that's the case, you should find a trusted place or website that can fix it.