Three mayors walk into an elevator — but what happened next was no joke, though the officials managed to amuse themselves until they could be rescued about 40 minutes later.

Pittsburgh Mayor Bill Peduto got stuck in the Westin Hotel elevator Thursday evening along with the mayors of Pennsylvania towns of Millvale and Leetsdale. They had been attending a meeting of the Allegheny League of Municipalities.

At first, it wasn't clear how they'd get out because none of the mayors, and others stuck along with them, could get cellphone service. Luckily, one of the stranded passengers worked at the hotel and was able to summon maintenance crews and first responders using a walkie-talkie.

And while the mayors couldn't call for help, they did manage to use their phones to take a selfie.