In my case, the problem is caused by the Apple MagSafe leather case that is slightly moving out on the left side of the phone when it's squeezed in my pockets. The case slip out and activate the switch...
When the phone is taken out of the pocket, everything go back in place except that the switch is activates... So, this case is nice but can be a real problem...
Using the "Accessibility" option from the menu followed by "Touch" to activate "AssistiveTouch" will allow to mute and activate the ringer from the "Phone icon" when using "AssistiveTouch icon"...
When using this trick, the switch must remain on the mute position to keep full control from the screen. Flipping the switch back and forth will mute the phone!