iPhone 6 Plus iOS 10.0.1
This started happening suddenly with my phone. Picked up a phone call and could not hear a thing; switched to speaker and the caller could be heard clearly. All along, the caller could hear me in speaker and non speaker mode. Reading along on some sites, a member recommended turning the volume up while the call was in progress, (or better yet, record a few seconds of voice memo and play it back while troubleshooting) if with the headphones unplugged you get the volume icon that says "headphones", then your phone is stuck in headphones mode. This individual recommended the use of compressed air to blow in the headphones jack. After I did that . . . . . voila . . . the phone worked as advertised.
Others have recommended plugging and unplugging the headset; this did not work for me. Because this appears to be a mechanical issue with the plug itself, restarting, resetting or restoring the phone will not work. All else fails take it to a local shop that can take it apart and clean or replace the jack.