Queues, Event when called

I have a help desk and we have a simple queue setup for support calls. I use a modified version of the readily available script that looks up CID #s in SugarCRM and creates a new case automatically.

What I would LIKE to do is make it so it automatically assigns the case to the tech that answers the phone. Im sure there is a way that I can use the Event when called feature to do this, but Im not sure where to begin. Is there a way to simply make FreePBX/Asterisk simply run a shell script with the asterisk call-id and the queue extension that picked up the phone as parameters to the script? This is all I would need, I can handle the SQL myself.

On the same subject, we use the rrmemory queue method, so each tech gets an even # of calls. This works great, except when one customer calls back 3 times in 20 minutes regarding the same issue. Is there some way, again, using the SugarCRM SQL database, that I could have any call that matches a certain criteria in the past 30 or 60 minutes get routed to the previous queue extension FIRST, then, on failure get dumped into the regular queue?

If I can get the first problem whipped, Im sure I can get the second done by writing an AGI script that looks up the criteria and dynamically chooses an extension to try.

Im sure there is a pretty simple way to accomplish this, but I just dont know where to start.