<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:536888920;
        mso-list-type:hybrid;
        mso-list-template-ids:-205098102 -661062210 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:24.75pt;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hangup handling in Asterisk is horrible enough to make the Buddha cry.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The (mostly working) solution I came up with was <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:24.75pt;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>      </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Attach a hangup handler to the source channel as soon as possible in the dialplan to do whatever post call work which needs to be done.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:24.75pt;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>      </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Use the ā€œgā€ and ā€œFā€ options to Dial to play any needed intercept messages required after one leg of the call hangs up.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Daniel Gonzalez<br><b>Sent:</b> Thursday, December 11, 2014 10:58 AM<br><b>To:</b> Asterisk Users Mailing List<br><b>Subject:</b> [asterisk-users] Finish extension (avoid dialplan to silently continue in the next priority of another extension)<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.35pt;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>Hi,<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>I have run into a strange behaviour:<o:p></o:p></span></p><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline;max-height:600px;word-wrap:normal;overflow:auto'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>[ctx-test]<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p> </o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>exten => h,1,NoOp(*** hangup ***)<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p> </o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>exten => s,1,NoOp(*** ${EXTEN} ***)<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> same => n,...<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> same => n,...<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> same => n,Hangup()<o:p></o:p></span></code></pre><p style='margin:0in;margin-bottom:.0001pt;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>Strangely, the </span><code><span style='font-size:10.0pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in;background:#EEEEEE'>h</span></code><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'> extension continues on the priority 2 of the extension </span><code><span style='font-size:10.0pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in;background:#EEEEEE'>s</span></code><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>. Maybe this is caused by the use of </span><code><span style='font-size:10.0pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in;background:#EEEEEE'>same</span></code><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>? How can I make sure that an extension is really ending, something like:<o:p></o:p></span></p><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline;max-height:600px;word-wrap:normal;overflow:auto'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>exten => h,1,NoOp(*** hangup ***)<o:p></o:p></span></code></pre><pre style='line-height:13.35pt;background:#EEEEEE;vertical-align:baseline'><code><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> same => n,RellyEndHere()<o:p></o:p></span></code></pre><p style='margin:0in;margin-bottom:.0001pt;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>For subroutines there is the </span><code><span style='font-size:10.0pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in;background:#EEEEEE'>Return()</span></code><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'> application, but this can not be used generally in contexts. Is there any application to finish processing the extension in the context?<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>Thanks,<o:p></o:p></span></p><p style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.35pt;vertical-align:baseline;background-image:initial;background-repeat:initial'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>Daniel<o:p></o:p></span></p></div></div></div></body></html>