[asterisk-users] Hangup hook to put back a call into a queue

Farkas Levente lfarkas at lfarkas.org
Wed Feb 5 10:33:29 CST 2020


hi,
I hope someone can help me:-)
we’ve got a freepbx server. there are 2 special extensions (2001, 2002). 
if someone calls 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:
https://community.freepbx.org/t/hooking-for-fun-and-income/57718

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:

[macro-dialout-one-predial-hook]
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

[back-to-1000-hangup]
exten => s,1,Noop(====== Entering user defined context 
back-to-1000-hangup =======)
exten => s,n,Queue(1000)
exten => s,n,Return

it seems 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?:

Hangup
Return
MacroExit
how to redirect the call to the queue?:

Queue(1000)
ChannelRedirect(${CHANNEL},,1000,1)
Gosub(ext-intercom,*801000,1())
dial-one,HhTtrM(auto-blkvm),1000
and what is the reason I can’t put the call back to the queue?
I know that I'm already in the hangup sequence, but still wouldn't like 
to hangup.
or this can't be done in the hangup handler?

thank you for your help in advance.

regards.
-- 
   Levente                               "Si vis pacem para bellum!"



More information about the asterisk-users mailing list