Ability for Employee "code" to rewrite their CLID

Good morning.

Asterisk 13/FPBX 13

First, I’ll tell you I’m not very skilled at writing anything custom within Asterisk, so I may just be dead in the water here, but I’m hoping someone with far more skill than I knows of a way to do what I need to do.

I need to create a macro/application that basically allows the caller to enter their particular code, which then truncates their code to the CLID if a match is found in a pre-defined list.

Here’s the scenario:
Employee calls in and enters their Employee Number (as sort of a password).
This identifies them as Employee X
They then continue on to a voicemail box to record a message (this can be a regular flow), but the CLID info has been modified to include their Employee Number (so it can be auto-sorted when the voicemail email is sent).

The list of Employee Codes must be something that can be stored in the system. My initial thought was to build a DISA module for each Employee, which in FreePBX has the ability to override Caller ID when entered, but the inbound DID always has to target that DISA module. My thought initially was to have the IVR only accept extension dialing for any of the DISA PINs, but I don’t believe I can do that because the PINs aren’t extensions.

I hope this made sense, and if so, does anyone have any thoughts on how to pull this off?


Something like this would set the CallerID to any number in the 1000-1999 range.
exten => _1XXX,1,NoOP()
same => n,Set(CallerID(NUM)=${EXTEN})
same => n,Voicemail(mailbox@context,options)

If you need to authenticate it you could do something with FUNC_ODBC or the Asterisk internal database where you could store allowed values.