This can be done with a Call Flow Designer (CFD) application. You would direct inbound calls to this CFD and have the CFD determine where to route the call based on who called this customer most recently.
The challenge is how to keep track of outbound calls made by the salespersons. One option would be to configure 3CX to create CDR files. These files are a summary of each call and includes the extension that called the customer. You could import the CDR data into a database. The CFD can look at the caller ID number of the inbound call and query this database to see who was the last person to call this number.
There are some additional considerations. If the last person to call this number was a year ago, you may want to ignore phone calls older than X number of days and simply route the call to the sales queue rather than the original salesperson.
The other consideration is the availability of the salesperson. If their presence is set to something other than "Available" or if they are already on the phone, you might want to send them to the queue. Nobody likes to keep a sale waiting in voicemail box.
If I were going to build this application, I would use either our
3CX Exporter tool to automatically parse the CDR files and put the data into a database the CFD could query, or I might use our
3CX Wrap-up Codes tool to track all outbound calls and use it's database of outbound calls for the CFD to query.