<div dir="ltr">Thanks, Eric. I just tried a hangup handler, but it's showing a similar problem: When the peer hangs-up, the hangup handler is not invoked and the caller channel remains open.<div><div><br></div><div><div> same => n(callPeer),Set(GLOBAL(Peer${IndexIntoPeers}CurrentCallsCount)=$[${PeerCurrentCallsCount} + 1])</div><div> same => n,Set(CHANNEL(hangup_handler_push)=handleHangupByCallerOrPeer,doesntMatter,1(args))</div><div> same => n,Set(DialForPeer=SIP/${EXTEN:0:4}@${PeerBeingConsidered})</div><div> same => n,Dial(${DialForPeer})</div><div> same => n,Hangup()</div><div> </div><div>[handleHangupByCallerOrPeer] </div><div>exten => _.,1,NoOp(${PeerBeingConsidered}: Entered handleHangupByCallerOrPeer Calls ${Peer${IndexIntoPeers}CurrentCallsCount})</div><div> same => n,Set(GLOBAL(Peer${IndexIntoPeers}CurrentCallsCount)=$[${Peer${IndexIntoPeers}CurrentCallsCount} - 1])</div><div> same => n,Set(GLOBAL(${PeerBeingConsidered}EpochAtCallEnd)=${EPOCH})</div><div> same => n,Return()</div></div></div><div><br></div><div>I've also tried replacing the Dial above with:</div><div><br></div><div> same => n,Dial(${DialForPeer},,g)<br></div><div><br></div><div>Cheers,</div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 5, 2018 at 7:38 AM, Eric Wieling <span dir="ltr"><<a href="mailto:ewieling@nyigc.com" target="_blank">ewieling@nyigc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Use hangup handlers, they work around the issues with the 'h' extension.<span class=""><br>
<br>
On 06/05/2018 05:33 AM, David P wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Thanks, Anthony.<br>
<br>
I added both 'g' and 'F' options. Now, when the caller hangs-up, my cleanup code is run by both the caller channel and the peer channel, but I only want the caller channel to do that.<br>
<br>
Also, when the peer hangs-up, there is no execution of the priorities following the Dial.<br>
<br>
Finally, is there a way to reset all globals, maybe as a variant of "dialplan reload"?<br>
<br></span><span class="">
On Tue, Jun 5, 2018 at 1:21 AM, Antony Stone <<a href="mailto:Antony.Stone@asterisk.open.source.it" target="_blank">Antony.Stone@asterisk.open.so<wbr>urce.it</a> <mailto:<a href="mailto:Antony.Stone@asterisk.open.source.it" target="_blank">Antony.Stone@asterisk.<wbr>open.source.it</a>>> wrote:<br>
<br>
    On Tuesday 05 June 2018 at 08:33:26, David P wrote:<br>
<br>
    > We're using Asterisk 14.7.6 and I have a dialplan that ends like this:<br>
    >     >  same => n,Dial(SIP/${EXTEN:0:4}@peer1)<br>
    >  same => n,Set(GLOBAL(EpochAtCallEnd)=$<wbr>{EPOCH})<br>
    >  same => n,Hangup()<br>
    >     > When peer1 hangsup, the priorities after the Dial are executed fine. But<br>
    > when the caller hangsup during the Dial, the cleanup steps aren't done.<br>
    > Why?<br>
    >     > I did read "Note that on a successful connection, in the absence of the g<br>
    > and G modifiers (below), the Dial command does not return to allow<br>
    > execution of further commands for that extension in that context." at<br>
    > <a href="https://www.voip-info.org/asterisk-cmd-dial/" rel="noreferrer" target="_blank">https://www.voip-info.org/aste<wbr>risk-cmd-dial/</a><br>
    <<a href="https://www.voip-info.org/asterisk-cmd-dial/" rel="noreferrer" target="_blank">https://www.voip-info.org/ast<wbr>erisk-cmd-dial/</a>> But it seems not to apply<br>
    > because I'm seeing the 'g' behavior without specifying that option, and the<br>
    > 'G' option seems intended for a far more complicated scenario.<br>
<br>
    If you're getting "g" functionality without specifying it,<br>
    congratulations.<br>
<br>
    If you want something similar when the callER hangs up, you want to<br>
    use the F<br>
    option.<br>
<br>
    Regards,<br>
<br>
<br>
    Antony.<br>
<br>
<br>
<br>
</span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
<a href="http://help.nyigc.net/" rel="noreferrer" target="_blank">http://help.nyigc.net/</a><br>
</font></span></blockquote></div><br></div>