Managing Inbound Calls Based on CID in VitalPBX Using Agents' Individual Phonebooks

1. Primary Scenario: Each agent has their own client phonebook. I would like incoming calls from clients listed in an agent’s phonebook to be automatically routed to that specific agent. Essentially, each agent would have a personalized list of phone numbers, and I want to set up a system that checks these individual phonebooks and routes calls accordingly.

2. Alternative: If it is not possible to configure routing based on individual phonebooks, it would be useful to implement a solution where if an agent has contacted a client, any return call from that client would be automatically routed to the agent who last communicated with them. This would be a form of call routing based on call history.

Has anyone implemented such a solution in VitalPBX, or can anyone provide suggestions on how I might achieve this? I am interested in any modules, settings, or configuration examples that could help with this.

Thank you very much!