There are occasions when an issue is localized to a certain application, such as when the microphone won't function on one app but not on others. Try restarting your iPhone to rule out the potential of small app faults causing the microphone system to cease operating. If the initial restart does not work, try again.
To restart your iPhone 7, just press and hold the Power button until the Slide to Power Off label displays, then drag the slider to completely shut off your smartphone. To turn it back on, wait around 30 seconds before pushing the Power button again.
This will eliminate any small faults and software issues that may have harmed the microphone system.