Overriding hangup handler for [ext-queues]

Hi there.

How would you override the default hangup handler for the queues context so the call is sent -for instance- to a survey?

Please note we are not willing to pay a U$D 475 VQ license to just override the one-liner preventing us from doing that.

exten => h,1,Macro(hangupcall,)

Thanks in advance.

Hangup handler or ‘h’ extension won’t do that. When a hangup handler is executed the call is already hung up. You can’t interact with the caller, because the caller is gone.

Oh I’m sorry. I didn’t mention we expect the agent to hang up, not the caller.

I assume it’s the caller’s channel who would then reach the ‘h’ extension, is that correct?

Thanks for your prompt answer.

The ‘h’ extension is executed when a channel is in the dialplan and the channel is hung up. Queues don’t change that behavior. You can’t use the ‘h’ extension or hangup handlers for this directly.

OK from what I see it looks like I’m mistakenly taking the ‘h’ extension for a hangup handler, which is not, so I need to look into hangup handlers in order to do what I need, am I right?

** EDIT ** I see this is a very common topic and I’m still wrong about using a hangup handler.

In fact I got the required behavior by dialing the queues with a g option but I thought there was a more elegant way to do that.

Thanks anyway.

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.

1 Like

That’s the commercial module. Sangoma generally put those features that are most useful to serious business users into the commercial modules.

“c” on Queue is the more elegant way on pure Asterisk.

1 Like

Queue() doesn’t have a “g” option, that is an option available for Dial(). So where exactly are you setting this “g” option on the call?

What he will have been doing is dialling a local channel with the g option, and its the local channel that accessed the extension that ran the queue application.

1 Like

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.

Queue() doesn’t have a “g” option, that is an option available for Dial(). So where exactly are you setting this “g” option on the call?

I’m sending the calls intended to be polled post-queue upon agent hangup to a custom context where I’m dialing towards the destination queue using option ‘g’.

Sort of:

exten => s,1,Noop(_____Poll______ )
exten => s,n,Dial(LOCAL/[email protected],120,gtr)
exten => s,n,SET(pollUid=${CDR('uniqueid')})
exten => s,n,Agi(agi://${pollUid})
exten => s,n,Hangup

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.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.