<div dir="ltr"><div dir="ltr">On Wed, Feb 5, 2020 at 12:34 PM Farkas Levente <<a href="mailto:lfarkas@lfarkas.org">lfarkas@lfarkas.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">hi,<br>
I hope someone can help me:-)<br>
we’ve got a freepbx server. there are 2 special extensions (2001, 2002). <br>
if someone calls this extensions (or a call is forwarded to these <br>
extensions) and these extension hangup (not the caller party), then we’d <br>
like to put the calls back into a queue (1000) and wouldn’t like to hangup.<br>
<br>
I read your description about hangup hooks:<br>
<a href="https://community.freepbx.org/t/hooking-for-fun-and-income/57718" rel="noreferrer" target="_blank">https://community.freepbx.org/t/hooking-for-fun-and-income/57718</a><br>
<br>
but still not able to implement it:-(<br>
what I’ve done:<br>
* found out in a hard way how to detect the current destination <br>
extension (because it’s turn out that CALLERID(dnid) is not working in <br>
case of forwarded call it’s show the original destination)<br>
* write a macro-dialout-one-predial-hook and a hook marco like this:<br>
<br>
[macro-dialout-one-predial-hook]<br>
exten => s,1,Noop(Entering user defined context <br>
macro-dialout-one-predial-hook in extensions_custom.conf)<br>
exten => s,n,GotoIf($["${DEXTEN}"=“2001”]?special)<br>
exten => s,n,GotoIf($["${DEXTEN}"=“2002”]?special)<br>
exten => s,n,MacroExit<br>
exten => s,n(special),NoOp(--------------- Push Special Hangup Handler <br>
------------------)<br>
exten => s,n,Set(CHANNEL(hangup_handler_push)=back-to-1000-hangup,s,1)<br>
exten => s,n,MacroExit<br>
<br>
[back-to-1000-hangup]<br>
exten => s,1,Noop(====== Entering user defined context <br>
back-to-1000-hangup =======)<br>
exten => s,n,Queue(1000)<br>
exten => s,n,Return<br>
<br>
it seems to be called and seem to enter into to call but immediately hangup.<br>
first of all, in this case when in the hangup handler I will NOT like to <br>
hangup how should I finish the marco?:<br></blockquote><div><br></div><div>Hangup handlers don't allow you any control over the hangup process. You can't stop it from occurring and in fact when it occurs the channel is already hung up. Anything that expects a live channel won't work.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hangup<br>
Return<br>
MacroExit<br>
how to redirect the call to the queue?:<br>
<br>
Queue(1000)<br>
ChannelRedirect(${CHANNEL},,1000,1)<br>
Gosub(ext-intercom,*801000,1())<br>
dial-one,HhTtrM(auto-blkvm),1000<br>
and what is the reason I can’t put the call back to the queue?<br>
I know that I'm already in the hangup sequence, but still wouldn't like <br>
to hangup.<br>
or this can't be done in the hangup handler?<br></blockquote><div><br></div><div>You can't do it from a hangup handler. The Dial option provides the g option[1] which can be used to continue dialplan execution when the called party hangs up, but I don't work on FreePBX so I can't comment on how best to use it there.</div></div><div><br></div>[1] <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Dial">https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Dial</a><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif"><font color="#073763">Joshua C. Colp</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Asterisk Technical Lead</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Sangoma Technologies</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Check us out at <a href="http://www.sangoma.com" target="_blank">www.sangoma.com</a> and <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a></font><br></div></div></div></div></div></div></div></div></div></div></div>