Is this simply about restricting internal calls, and DID numbers? An external caller cannot reach an internal extension by DID, if there is no DID rule in place. The only other method would be for an external caller to go through an IVR and attempt to dial the extension directly. This is one thread in how to deal with blocking certain extension numbers coming through an IVR (Digital Receptionist)
The door phones I'm, familiar with , require that the call initiate with the "visitor" at the door. A call (be it a code, or hotline) is placed to an extension, the called party verifies the visitor then press a DTMF button to unlatch the door. Call drops.
Having a door phone that accepts incoming calls, and allows anyone dialling the door phone number, to unlatch the door, seems like a major security issue, and I'd think (hope), that the door phone itself is designed to either prevent this, or has an option to prevent this.
If I'm not understanding your problem, please provide some call scenarios.