One is considered to be at prayer as long as he is detained by it. Nothing prevents him from going out except waiting for it.
Mu'awiyah went out to a circle in the mosque and asked: Why are you sitting? They replied: We sat down to remember Allah and praise him for guiding us to Islam and blessing us with it. He said: I adjure you by Allah, has nothing made you sit together except this? They replied: By Allah, we have not sit down together except for this. He then said: Actually, I did not adjure you because I suspected you, and there was no one in the position I was as to the Messenger of Allah (PBUH) who narrates less hadiths of him than me. Indeed, the Messenger of Allah went out to a circle of his companions and asked: Why are you sitting? They replied: We sat down to remember Allah and praise him for guiding us to Islam and blessing us with it. The prophet (PBUH) said: I adjure you by Allah, has nothing made you sit together except this? They replied: By Allah, we have not sit down together except for this. The prophet (PBUH) said: Actually, I did not adjure you because I suspected you, but Gabriel came to me and told me that Allah is talking proudly about you before the angels.