This capability is not built into 3CX. This question gets asked frequently. Perhaps I can offer a solution, but be aware this would require custom programming.
Since we do not have a way of customizing how queues route calls (beyond the polling strategy), we will have to make the routing decisions BEFORE routing the call to a queue.
There are two applications needed: (1) a service that monitors and records in a database the last agent that answered a call from the caller, and (2) a Call Flow Designer (CFD) that either routes the call to the previous agent or forwards the call to a queue.
The CFD would be placed in front of the queue. The CFD would need to look up in the database whether there is an entry for the Caller ID Number. If an entry is found, it would need to check the availability of the agent (logged into the queue, presence is available, and not currently in a call). If the agent is available, the CFD would route the call to the agent. If the agent is not available, it would route to the queue.
I have always thought an expiration date would be appropriate for database entries. For example, if it had been more than a year since the person had called, then perhaps sending the call back to the same agent would not be necessary.