Login for hotdesk with single code

I received a request to implement a hot desk login with a single code. The background is that in this organisation every employee has one code for all kind of thinks like the xerox machine, the parking lot entrance, the coffe machine etc. They want to use the same 6 digit code for login in as hot desk.

The normal procedure is (depending on feature.conf)

*21# #

The perfect implementation would be:

pick up phone
ivr speaks “please enter your personal code”
# (where the code is the same for xerox machine, coffee machine parking lot etc)

From a users perspective this request makes sence but I guess this is a real challenge that start with noticing the off hook state and triggering the procedure. The procedure without off hook detection but with a feature code would also be great.

Has this been done before? Do you have any suggestion how to accomplish this with Asterisk. Any help, offer or suggestion is very welcome. Thanks in advance.