During an active shooter incident, time is critical. Never run toward the sound of gunshots. Get as far away as possible as soon as you can, and avoid large open or common areas, warning others as you encounter them.
If you are unable to escape, and you remain inside an office or classroom, lock the doors and block them if possible. Cover the windows and get under any available shelter, such as a desk or table. If you have access to a phone, call 911 immediately. Tell them where you are, what is happening, and that you are trapped. Do not answer the door if someone knocks. Stay low and out of sight, if possible. It may take quite a while for officers to get to you, because their must first focus on stopping the shooter(s). When law enforcement arrives, stay out of the way. Slowly and calmly announce your presence, which way the shooter went (if you know), and show them your hands. Law enforcement might not know who or where the shooter is, and they will be aggressively seeking that person.
If you are trapped with no means of escape and you are directly confronted by a shooter, group attack in self-defense may be the only viable option, but only as a last report to preserve your life and the lives of those trapped with you.