The easy way without any programming:
Create an IVR with one destination (your ring group) and the menu option is the PIN number. Set the Long Greeting to something like "Please enter the PIN number". Set max failures and max timeouts to 1. Set your invalid destination to hangup.
The cooler way:
Write a small LUA script to take a channel variable to verify the PIN number and call session:transfer() if the PIN is correct.