If you’re not prepared to face cancellations or delays on your next trip to the airport, you may not have heard the news: Summer travel is hell. Airlines continue to deal with staffing shortages, downsized routes and summer storms, which has upped the chances you may not get to your final destination on time — or at all.

If nothing else, the trials of this unpredictable travel landscape have taught travelers to expect the unexpected. But if you aren’t prepared to be stuck in limbo, consider this your one-stop shop for everything you need before you head out for your next flight.

You should prepare for cancellations and delays before you even arrive at the airport. In fact, do it as soon as you’re booking a flight. Phil Dengler, co-founder of travel blog the Vacationersays start by booking directly with the airline rather than a third party.

“If your flight gets canceled, you’re going to want to talk to a customer service agent. Book directly with the airline so you have access to them in case something goes wrong,” Dengler says. And, if you can, while you’re booking your flight avoid flights with layovers. More stops only increases the likelihood of travel chaos, he says.

The dos and don’ts of flying this summer

Booking one of the first flights of the day is also key. Cancellations and delays have a domino effect, and flying early will decrease your chances of issues — and give you more flight options later in the day if you do run into problems.

Use technology to your advantage

Dengler and Heather Poole, a flight attendant for American Airlines, both gave the same advice: Download the airline’s app, and be ready to get on Twitter if your flight is canceled. The airline apps can alert you to gate changes and cancellations before the information has made it to the gate agent. And once a flight is canceled, direct messaging an airline’s Twitter account can be the quickest way to speak to someone as companies continue to deal with hours-long hold times on the phone.

Should you fly or drive this summer? Here’s how to decide.

Airline apps can also help you avoid lines at the check-in counter by allowing you to download your boarding pass to your phone, pick your seat, upload documents and even now check your bag. Alaska Airlines announced this week that it will allow customers to register their checked luggage before they get to the airport and transfer their flight information to electronic bag tags through an app.

Plus, if your flight is canceled, the airline’s app will probably be the fastest way to see what other flights the airline has available.

For a flight arriving or departing from the United States, you are entitled to a refund if your flight is canceled or significantly delayed and you choose not to take another option, under Department of Transportation rules. It also applies if you are involuntarily downgraded to a lower-tier service than what you paid for. There are no laws requiring US airlines to provide hotels, meal vouchers or other services beyond the cost of the flight, but you should always ask your airline what it can do. These services usually need to be requested in person at the airport, not on the phone or online.

You’re also entitled to compensation if you have been denied boarding because your flight was overbooked and you didn’t volunteer to give up your seat. Airlines are allowed to overbook flights, and there is no minimum they must offer when asking travelers if anyone is willing to take a later flight. recently, passengers have reported that airlines have been offering thousands for people to volunteer to be bumped from flights.

How to get refunds if your flight is canceled

If you are involuntarily bumped, airlines should give you a form detailing your rights for compensation, which is often tied to when you get to your final destination. Keep in mind, most airlines require you to be checked in or at the gate by a certain time to be eligible for compensation beyond the cost of the flight.

Rules for compensation differ around the world. For flights within Europe, regulation EU 261 lays out compensation rules and assistance for passengers if their flight is canceled or delayed, or if they’re not able to board.

If your flight is arriving or departing from a European Union airport, you are entitled to up to 600 euros for long delays or cancellations. And if your flight is delayed for more than two hours, you are entitled to meals.

There is a checklist of requirements for the cause of the delay that has to be met to claim compensation — passengers need to be checked in on time, the airline must be responsible for the delay and the flight must have taken off or landed in the EU , to name a few. Airlines don’t need to provide compensation under “extraordinary circumstances,” which includes bad weather and security risks, among other things.

If you are going to be stuck at the airport, you’ll want to be to use all your devices. An external battery might set you back $30 or more, but it will be worth it knowing you won’t have to fight for outlet space or be tethered to a wall if you need to rebook on your phone or use it to entertain yourself.

A special to-go meal can beat the end of vacation blues

Also, airport food is expensive. Even if you’re unphased by the price, there is no guarantee options will be open as airports deal with the staffing shortages. “A peanut butter and jelly is going to taste 1,000 times better than anything you’re going to get on the plane,” Poole said. As a flight attendant, she often carries oatmeal, tuna, crackers and almonds.

Lastly, having a book, magazine or other non-electronic form of entertainment can help occupy the time when you can’t use your phone.

A canceled flight doesn’t make anyone happy. Fellow travelers are frustrated, and airlines have fewer people on staff right now to deal with heightened emotions. Poole, noting her 25 years of experience, said, “Just a smile will go so far. Like a please and a thank you… . Now more than ever, you just want to do anything for the person that is nice.”

“It’s just so rare to have somebody who is calm and patient and kind,” she said. “If I could do anything for someone like that, I will go out of my way.”

A canceled-flight emergency kit: What to pack and know