iPhone silenced

Everything was just fine on my way home last night - earbuds in, music flowing, phone call clear as a bell... But last night I tried making a couple of phone calls from home - no sound of ringing, no audio in (or out, so I was told) until I put the call into speaker mode. Panic! But Googling "iPhone sound" turned up the answer quickly - plug in the earphones and unplug them again. Apparently it sometimes misses that you've unplugged the earphones.