Samsung S7 speaker phone not working + echo in call
I got exactly the same problem with my Phone(Oneplus 5). 
I've tried a lot of things software side but nothing helped.
Due to my work, my phone was exposed to flour and I got flour in every opening of my phone, therefore also my charging plug didn't work perfectly. So I replaced the charging plug and with it the bottom microphone. Afterward all worked perfectly again.

So I guess your microphone is broken too.

Hope my answer helps.