Queue action depends on queue length

Hi,

I would like to set up a queue, where the “max wait time” depends on the number of callers waiting in line.

My aim is the following:
When nobody is in the office (nobody picks up any of the phones), calls must be forwarded to a mobile number through the GSM adapter. I have set it via the “max wait time”. But, if somebody is in the office, but busy on the phone (talks to a caller already), than do not forward the next caller after the “max wait time”, but let the caller wait in the queue till the previous call ends. If the operator does not answer (within max_wait_time) the next call in line, than let it be forwarded to the GSM.
Do you have any idea, how can I set this?

Thanks
Zoltan