Call hold until first extension becomes available

I’m trying to make call holding when all extensions are busy. I used queue, and set up extensions.conf:
[all-busy]
exten => s,1,PlayBack(all-reps-busy)
exten => s,2,Queue(holding)
exten => s,n,Hangup()

When all busy, call is answered, music is played and announcements are reproduced in particular number of seconds.But, when another extension becomes available (hanged up), call in queue doesn’t go to this extension and music continue to play until hangup.
Please help. Maybe queues are not good solution for what I want.

You mean device not extension.

What is in queues.conf?

What is reported on the log.

What does queue show holding report?

queues.conf:
[holding]
music=default
context=rrmemory
timeout=15
wrapuptime=10
announce-frequency=30
announce-holdtime=yes
joinempty=yes
leavewhenempty=no

queue show:
localhost*CLI> queue show holding
holding has 0 calls (max unlimited) in ‘ringall’ strategy (0s holdtime, 0s talktime), W:0, C:0, A:2, SL:0.0%, SL2:0.0% within 0s
No Members
No Callers

Log just show playing music files

That’s your problem.

However, I think you probably have a fundamental misunderstanding about what Queue does, and without understanding what that is, it may be difficult to help.

You’re totally right. I didn’t fully understand queues. I tried with example I found on net, but with wrong member. Now, it works. I put my devices as members and it works now.
But, I still need one tiny issue to fix.
While device is in use (call in progress) and another incoming arrives (it is put in queue and it works fine) the device is called (ringing, and notification on softphone application pops up and says about another call). Is there a solution in configuration to ring first available only after hangup?

Check the strategy, the ring in use setting, and whether your peers are configured to provide device states.