Hangup hook to put back a call into a queue

I hope someone can help me:-)
we’ve got a freepbx server. there are 2 special extensions (2001, 2002). if someone call this extensions (or a call is forwarded to these extensions) and these extension hangup (not the caller party), then we’d like to put the calls back into a queue (1000) and wouldn’t like to hangup.

I read your description about hangup hooks:

but still not able to implement it:-(
what I’ve done:

  • found out in a hard way how to detect the current destination extension (because it’s turn out that CALLERID(dnid) is not working in case of forwarded call it’s show the original destination)
  • write a macro-dialout-one-predial-hook and a hook marco like this:

exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,GotoIf($["${DEXTEN}"=“2001”]?special)
exten => s,n,GotoIf($["${DEXTEN}"=“2002”]?special)
exten => s,n,MacroExit
exten => s,n(special),NoOp(--------------- Push Special Hangup Handler ------------------)
exten => s,n,Set(CHANNEL(hangup_handler_push)=back-to-1000-hangup,s,1)
exten => s,n,MacroExit

exten => s,1,Noop(====== Entering user defined context back-to-1000-hangup =======)
;exten => s,n,Gosub(ext-intercom,*801000,1())
exten => s,n,Queue(1000)
;exten => s,n,Hangup
;exten => s,n,MacroExit
exten => s,n,Return

it seem to be called and seem to enter into to call but immediately hangup.
first of all in this case when in the hangup handler I will NOT like to hangup how should I finish the marco?:

how to redirect the call to the queue?:

and what is the reason I can’t put the call back to the queue?

thank you for your help in advance.


If the calls are coming from a queue, there is an option in the paid commercial module VQ Plus to send queue callers to a destination on hangup:

1 Like

but the call do not come from a queue. it a call outside and ended in an extension. now when the extension hangup, than i’d like to put the call into a queue.

anyway it seems to me a very easily implementable feature for those who know what’s happened during the hangup. imho the only problem is that the hangup process run further even after i put the call into the queue.

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