[SOLVED] Queue Hold Time in CDR

What is the best way to get this done?

I would think a CDR() function using QEHOLDTIME from setqueueentryvar=no in queues.conf.

Which would get run in an AGI in the Queue() command??
exten => s,n,Queue(,AGI)

Or after the caller finishes with the queue agent has hung up have more dialplan??
exten => s,n,Queue(,…)
exten => s,n,CDR(…)
But in that situation if the caller hangs up, it wouldn’t work.

So basically my only solution is an AGI(which I’m not even sure would work), but also seems like a lot of work to get hold time in the CDR. I’m clearly not considering something.

Thanks.

Edit: We’re operating under 1.4.22.

Thanks to pabelanger-lap in #asterisk for helping me with this one.

Proper solutions require Asterisk v1.6+ using the -c option with Queue() Such that after Queue() finishes we can do a Set(CDR(holdtime)=${QEHOLDTIME}) assuming setqueueentryvar=yes in the queues.conf. Using cdr_custom.conf I can then report the holdtime to the Master.csv.

As an alternative to the -c option(or to access the CDR variables in the queue), the macro option in Queue() is also a possiblity.