Answered by the team at islamtoday.net. Original fatwa can be found here.
If my cell phone starts ringing while I am praying in congregation at the mosque, what should I do? Must I break off my prayer to switch it off? Is it possible for me to take out my cell phone and switch if off without nullifying my prayers?
Sheikh Ahmad al-Khalîl, professor at al-Imâm University, Qasîm Branch
You should take care to turn off your cell phone before entering the mosque. If you forget to do so and the phone rings while you are praying, then you should turn it off to avoid causing any disturbance to your fellow worshippers who are humbling themselves before Allah in prayer.
When switching off your cell phone, you must take care to use the least amount of movement possible. Such a small movement will not invalidate your prayer, because you are doing it for the benefit of the prayer.
And Allah knows best.