The foremost task to be done when you are stalled in an elevator is to push the door open button. If you are near the landing the door will open. You can slowly and carefully step out of the elevator. Be sure to watch your step as the elevator floor may or may not be level with the landing.
The most important factor is to remain calm. If the door does not open, you are still safe. Do not try to exit the elevator. Wait for trained emergency personnel to arrive. Even if the air temperature feels warm, there is plenty of air circulating in the elevator and its shaft-way.
Relax and do not try to extract yourself from the elevator. Never try to exit a stalled elevator car. This can be extremely dangerous. Always wait for trained emergency personnel. The best courses of action you can resort to would be get comfortable and wait for professional assistance. This can cause inconvenience to you but you will be safe.
Elevator engineering handles this task and consults you the steps to be taken in case of such emergency. One can also approach elevator consulting services trying to ensure that you will nor require the need of safety measures during emergency.