1: Get on the crewlist, and exit through the entrance room.
2: Be assigned pilot. See last part of number one.
3: Be assigned commander. See last part of number one.
4: Contact owner of ship. Get assigned as one of the first parts of the previous three numbers. Repeat last step of any previous number.
5: Get on a ship owned by you that is docked in the ship you are trapped in. Undock.
Disclaimer: This post may or may not contain stupid material.
DUnta, why do you need to be on the crewlist? THey are already on the ship, so being added to the crewlist won't make any difference - they can still move around without having 'access'.
Being assigned will help, just be letting you know where you are so you can let someone else know where to pick you up from.
Anyway, send a DM to the person/faction that owns the ship if you went inactive while on there. Then try posting in the Traders Lounge and see if anyone knows the owner of the ship you are in. THen it will be a matter of being assigned so you can fly around, or getting the location so someone can come and pick you up.
I am also trapped in a ship.. This is a same case for me.. But for me.. I just stopped playing the game 3 years ago.. The problem is it seems that my faction has disappeared.. It was called frost.. Something.. And now i cant even see my locarion on the galaxy..