(a)No person shall intentionally, knowingly, or recklessly carry on or about the person while inside a room in which judicial proceedings are in progress any weapon prohibited by T.C.A. 39-17-1302(a), for the purpose of going armed; provided, that if the weapon carried is a firearm, the person is in violation of this section regardless of whether is carried for the purpose of going armed.
(b) Any person violating subsection (a) commits a Class E felony.
(c) The provisions of subsection (a) shall not apply to any person who:
(1) Is in the actual discharge of official duties as a law enforcement officer, or is employed in the army, air force, navy, coast guard or marine service of the United States or any member of the Tennessee national guard in the line of duty and pursuant to military regulations, or is in the actual discharge of official duties as a guard employed by a penal institution, or as a bailiff, marshal or other court officer who has responsibility for protecting persons or property or providing security; or
(2) Has been directed by a court to bring the firearm for purposes of providing evidence.