I'm assuming there's no case or cover on the phone?
One of our members @viridis is very knowledgeable on Sony products.
He may be able to advise further.
I have no affiliation whatsoever with O2 or any subsidiary companies. Comments posted are entirely of my own opinion. This is not Customer Service so we are unable to help with account specific issues.
If you've done the service menu to check for microphone and it works, then you can try some of the following: Go into settings, apps and in the top right select "show system" find the app called "phone" and clear the data and cache. See if that works. If not.... Start the phone in safe mode and see if it works in there, if it does, it means a 3rd party app is using the mic when it shouldn't. Look for recently installed apps that use the mic and remove to test. If not, try backing up using Xperia companion and performing a software repair, this almost certainly will fix it.