How can the microphone work for speakerphone calls but not regular calls?
Lots of phones have more than one microphone on them. I know for a fact that my Oneplus One has three, and I think your phone has four. If that's the case then it could be a hardware issue.  before taking it back do a full reset and see whether that helps. At least then that eliminates the possibility of a software error.