[Queue] removing dynamic members after hangup

We wrote a script which adds dynamic agents based on their location. No problem. Works.
I wrote a script that also removes everyone from the queue after the call is completed.

I want to make it more foolproof so that agents are removed by channel.
Is it possible to add some random UUID or some random channel ID while sending them into the queue?
So i can distinguise them and it makes it easier to remove.

The problem I think can happen is this:

Call 1 comes in…agents are added, say 5. Call goes through an Asterisk dials first 5.
Another call comes a few seconds later, new (5) agents are added.

What will happen to the first call? Will Asterisk now call the 5 from the first call or will it start calling also the 5 of the second call since they’re in the same queue now?

It rebuilds the list once it has finished the retry delay. Depending on the exact options, it may try multiple ones from the original list before entering that time delay.

So, just to make sure that I completely understand:

It sort of “caches” the dynamic members currently in the queue for each call?
And after the retry time-out (exausted queue) it queries the current queue again?

That would be great since that makes sure it always calls the first 5 persons.
And I can clear the queue immediately since it caches the members.

Can you confirm this behaviour?