To do the same in AEL, use 'catch' construct (ref <a href="https://issues.asterisk.org/view.php?id=14956">https://issues.asterisk.org/view.php?id=14956</a>). This is so that we can catch extension h and return to the calling macro, so that it can continue its priority after the Dail command. I've tested it and it works.<br>
<br>context test {<br> _NXXNXXXXXX => {<br> &test-dialout(${EXTEN});<br> };<br> h => {<br> &test-hangup(${EXTEN});<br> };<br>};<br><br>macro test-dialout(number) {<br> Dial(IAX2/XXXXX/${number},30);<br>
catch h {<br> return;<br> };<br>};<br><br>macro test-hangup(number) {<br> NOOP(${number});<br> if ("1"="1") {<br> NOOP(Hello);<br> };<br> ResetCDR(vw);<br> NoCDR();<br>
Hangup();<br>}; <br><br><br>Also the correct syntax for regular conf will be:<br><br>[test]<br>exten => _NXXNXXXXXX,1,macro(test-<div id=":1in" class="ii gt">dialout,${EXTEN})<br><div class="im"><br></div>[macro-test-dialout]<br>
exten => s,1,Dial(IAX2/6477226961/${ARG1})<br>exten => h,1,Macro(test-hangup)<div class="im"><br>
<br>[macro-test-hangup]<br>exten => s,1,GotoIf($["1"="1"]?2:3)<br>exten => s,n,NoOp(A)<br>exten => s,n,ResetCDR(vw)<br>exten => s,n,NoCDR()<br>exten => s,n,Hangup()</div></div><br><br><div class="gmail_quote">
On Wed, Jul 15, 2009 at 10:36 AM, Zeeshan Zakaria <span dir="ltr"><<a href="mailto:zishanov@gmail.com">zishanov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've found a work around, i.e. if put the dialout command in a separate macro, then CDR records the values fine, whether the hangup macro is called by the original context, or by the dialing macro.<br><br>Posting here in case somebody facing a similar issue like me can benefit from it:<br>
<br>[test]<br>exten => _NXXNXXXXXX,1,macro(test-dialout,${EXTEN})<div class="im"><br>exten => h,1,Macro(test-hangup)<br><br></div>[macro-test-dialout]<br>exten => s,1,Dial(IAX2/6477226961/${ARG1})<br>;exten => h,1,Macro(test-hangup)<div class="im">
<br>
<br>[macro-test-hangup]<br>exten => s,1,GotoIf($["1"="1"]?2:3)<br>exten => s,n,NoOp(A)<br>exten => s,n,ResetCDR(vw)<br>exten => s,n,NoCDR()<br>exten => s,n,Hangup()<br><br><br></div><div>
<div></div><div class="h5"><div class="gmail_quote">
On Wed, Jul 15, 2009 at 10:18 AM, Zeeshan Zakaria <span dir="ltr"><<a href="mailto:zishanov@gmail.com" target="_blank">zishanov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
(Both on Asterisk 1.2 and 1.4)<br><br>I was struggling to find out why my CDR was recording dst = h after a call hangup. It was working fine until I added a GotoIf statement before ResetCDR to calculate some value for userfield column. Today I tested and found out that if ResetCDR is put after GotoIf (or after if in AEL), it doesn't record correct value in dst column, and isntead puts 'h' there. If GotoIf removed, it works fine.<br>
<br>Is this is a bug, or is this how it is supposed to work? Is there any work around it. In my production scenario, I can't move ResetCDR before GotoIf.<br><br>Here are the test context and macro:<br><br>[test]<br>exten => _NXXNXXXXXX,1,Dial(IAX2/XXXXX/${EXTEN},30)<br>
exten => h,1,Macro(test-hangup)<br><br>[macro-test-hangup]<br>exten => s,1,GotoIf($["1"="1"]?2:3)<br>exten => s,n,NoOp(A)<br>exten => s,n,ResetCDR(vw)<br>exten => s,n,NoCDR()<br>exten => s,n,Hangup()<br>
<font color="#888888">
<br clear="all"><br>-- <br>Zeeshan A Zakaria<br>
</font></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>Zeeshan A Zakaria<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Zeeshan A Zakaria<br>