It was narrated from 'Ammar bin Yasir that:
He greeted the Messenger of Allah (ﷺ) with the Salam when he was praying, and he returned the greeting.