Call redirection with PIN for incoming call -help plyzzzzzz

I need one option for my IVR menu for incoming calls - something like:
“If you want to connect with outbound consultant press 2 and than put your pin”

Pin can be taken from “pin sets” or defined individually. When caller chose “2” option should be simple redirected to an PSTN number via sip trunk (eg with “9” prefix for outbound route) after checking PIN.
For any inside extensions sip trunk should be “open” without any pins.

If somebody could help me and have any idea how to define such menu option as a “custom apps” (for IVR menu) please post it here.

Many thanks.