I am afraid that what you may have is a phone connected to the building that has no smarts, just rings, waits for you to dial a code and hang up. The building people may not appreciate you accessing any wiring, etc.
I thought about a door/gate access system for a neighbor and this is what I came up with...
A gate entry system which used a phone ringing and then sending a touchtone to open the gate and drive in. The building asked for a local phone number at the house which they would automatically call when the button was pressed. You pick up, get a tone or announcement and press a digit to open the gate.
The system I came up with does no security checking, thus it is like them pressing the button almost always opens the door. There could be a time criteria so that it would only work within certain hours.
Using a system such as
Voip.Ms or other Voip services, a call comes in, the system looks at the Caller-ID number. If it is the caller-ID for the gate, it sends a touchtone back and hangs up.
If the building asks for your telephone number to call then you would find their Caller-ID and have the calls directed to a VOIP number with the smarts mentioned above.