How to get out of someone else's trap?

Earlier, I accidentally fell into a trap built inside someone else’s structure. The walls were covered with spikes.
I’m on a PvE-C server, so I can’t destroy other players’ buildings.
Is there any solution other than killing myself to get out?

You appear to be corrupted, so perhaps you know sorcery. If you always keep some pouches on you, you can cast Call of Nergal and fly out. Summoning your corpse is also an option with sorcery, it doesn’t avoid the whole killing yourself thing, but it does mean you can get your gear back.

If you have followers with you, you can try to get on top of them and jump off them to gain more height. Fences and crenellations can’t be climbed, but they can be vaulted over if you manage to hit high enough on them. Both getting on top of your follower and vaulting a spiked wall may take some finagling to get right, but if you are stuck, you have nothing better to do with your time anyway.

Call of Nergal couldn’t be used because the space was too small.

Later, we used magic to build an ice bridge and got out.

Thank you for your answer and suggestion ^^