This would be an ideal task for Asterisk, but you're probably not going to get far with FreePBX. All phones are put in the same context by default.
If you put each phone in a separate context, they should only be able to call other phones in the context.
There's a lot of great info here for making that work
http://www.trixbox.org/forums/trixbo...ict-extensions
Also, if you're new to Asterisk, try to build it from scratch without FreePBX. You can do a lot of cool stuff with * once you're familiar with it.
-Andreas