I know this is a long shot but have you tried shooting canned air into the mic and speaker, or using a headset? Canned air has fixed two mystifying problems for us, and it seems equally likely that this random behavior is caused by hardware.
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?