The caller channel only reaches the h extension when they have been hung up, which, in your case, happens when they run out of normal dialplan. Both Dial and Queue, by default, request termination of normal dialplan execution when a successful call completes, but this can be overridden, with options. What then gets executed is the next dialplan priority (step) after the Queue or Dial application.
That just leaves how you access this capability from FreePBX, which I cannot answer without some research. If there is a commercial module, that may well mean that you need to rewrite the Queue() as raw Asterisk custom code, to be able to place code in the right place.
Hangup handlers are also run too late to be useful.
As well as setting the option which might not be too difficult (it’s the “c” option), you have to insert code amongst the code that handles things like no agents, and caller timeouts, which you probably can’t do without modifying the FreePBX code that generates the dialplan for queues, or by replacing the whole queue handling dialplan by custom dialplan.
I understand that. So the Queue sends to Local/[email protected] that does a bunch of things before sending the call to the Agent’s device. Yes, putting the g option is possible there too. This is what you end up with, Queue → Dial Local channel → Dial Endpoint. Adding the g option between the queue and the agent could have side effects in the queue itself, like thinking the caller is still on a call with an agent or the agent is on the call all while being someplace else in the dialplan.
I agree with you that the “c” option for the queue is the better way to handle things since it allows the queue to deal with it instead of it being a channel still being handled by the queue being bounced around.
I’m aware of the ‘c’ option for the queue app but we like to use [ext-queues] because it handles many queue options we can set from the GUI. Unfortunately, that context already queues the calls without using the ‘c’ and it looks like only the commercial version seems to be approppriately coded in order to do so whenever a post-queue destination was set.