Same here, exact same problem with my iphone7.
The first time I took it to the store (5/15/18) the problem had disappeared when I got there, very frustrating, so I walked out without a solution. It did come back though a couple of days later, and today I was back in the store, no sound and speaker greyed out. They were aware of the issue and replaced my phone, just out of warranty, but still in warranty at the time I first reported it. Phew!
Just wondering whether I can safely restore from my backup, or better set up as new? If it is a hardware issue, surely my brand new phone is not going to be affected...?