As for public gatherings, such as with guests, or in open spaces and the like, a person greets everyone, but in mosques, some are praying and some are reciting the Quran, so he should not raise his voice with the greeting, but rather greet those who are present.