Assuming that the queue does not call the virtual extension again, is because the local queue channel is in use, so you may want to try redirect the caller’s channel by using ChannelRedirect()
in your dialplan along with a custom dynamic feature.
In /etc/asterisk/features_featuremap_custom.conf add the following:
[applicationmap](+)
ccredirect => #48,self/caller,Gosub(chan-redirect,s,1)
Then, you will need to add that custom dynamic feature to the incoming calls, you can either do it on the Trunk or send the calls to a custom context prior to sending to the queue.
in extensions_custom.conf
[add-custom-dynamic-feature]
exten => s,1,Noop(Entering custom context ${CONTEXT} to add the dynamic feature)
exten => s,n,Set(__DYNAMIC_FEATURES=ccredirect)
exten => s,n,Return()
Then modify the below dialplan to fit your needs
[chan-redirect]
exten => s,1,Noop(Entering custom context ${CONTEXT} to add the transfer the call)
exten => s,n,Read(ext_to_transfer,custom/please-enter-ext-number,4,,2,5) ; this should ask them to enter the extension number. I allowed 4 digits, change to whatever fits your needs.
;Here you can ask the person to confirm what they entered is correct by playing back to them the variable with SayDigits()
;You can also validate to make sure that the extension they want to transfer to exists in the DB by using the DB_EXISTS function
;Once you are sure that it will be transferred to the right destination, allow the call to the next line
exten => s,n,ChannelRedirect(${BRIDGEPEER},from-internal,${ext_to_transfer},1)
exten => s,n,Return()
Note: I tested this on calls that were not routed through a queue and it works. It might need some adjustments. Please keep us updated with your trouble/findings…
If you get a bonus this month, remember why