Is there a software problem that only allows sound through the headset? The speaker works with alarms. When the headset is unplugged, the side volume buttons do nothing so it recognizes that the headset is not attached. Thank you.
The side switch is the key. Depending on your settings, it may affect the mute or it may affect the rotation lock. Whichever function it supports, the other function is performed by a "soft switch." This support article from Apple provides detail.
In case you're wondering, here is the history. Originally, the mechanical switch affected only the rotation lock and the mute was a software switch elsewhere. In IOS-3, it was changed to be the mute switch and the rotation lock became a software switch. This was done to ensure consistency among IOS devices. Unfortunately, a large quantity of users complained loudly, alleging that they turned the rotation lock on and off several times every hour and the convenience of the mechanical switch is essential. In IOS-4, Apple bowed to the whiners and made the switch function selectable and now we're stuck with a mess.