Summary:ASTERISK-14006: Dial() within AEL Macros does not allow use of 'h' extension
Reporter:Leo Brown (netfuse)Labels:
Date Opened:2009-04-23 04:42:05Date Closed:2011-06-07 14:07:47
Versions:Frequency of
Description:Due to the way Macros are handled in AEL, it is not possible to capture hangup within the Macro itself. The caller hangs up first, the 'g' option to Dial allows commands to continue being executed in the current context, but this only allows capture of, say, 50% of calls.

However, due to the syntax of AEL macros, it is not possible to specify 'h' extension as all extensions are executed under the 's' label.

Shown below is an abbreviated console output showing that despite 'g' flag in Dial() options, the channel is dropped, rather than 'auto fallthrough' which would indicate there was the option of processing more priorities, but they did not exist.

I'm not able to contribute AEL code as it's fairly complex, but this seems like an unnecessary restriction. A possible solution would be new syntax for t/i/h within Macro context in the usual brace-enclosed format.


 -- Executing [s@IPBX:18] Dial("IAX2/chan-9864", "IAX2/dest/4410000000,,ge") in new stack
 -- Call accepted by (format alaw)
 -- Hungup 'IAX2/dest-13451'
 == Spawn extension (IPBX, s, 18) exited non-zero on 'IAX2/acumen-9864'
   -- Hungup 'IAX2/acumen-9864'
Comments:By: Steve Murphy (murf) 2009-04-24 12:07:25

Have you tried the "catch" construct within your AEL macro?

macro mymacro(a,b)
     NoOp(some message);
     /* other code, as necc */
     catch h
        /* code associated with the h exten */

The above will probably get all its nice formatting
removed, but you should be able to see what to do...

See the wiki @  http://www.voip-info.org/wiki/view/Asterisk+AEL2#Macros

By: Leo Brown (netfuse) 2009-04-25 16:28:38

Sincere apologies - this does work. Documentation is certainly sporadic out there, however. Did loads of research before knowing i could 'catch' h extension. How can i contribute to the * book? :O

By: Steve Murphy (murf) 2009-04-25 17:08:40


I know what you you are talking about. I had done the development of AEL2 from pretty much start to finish, but didn't really understand what catch was for (I just made sure it did the same thing as the old AEL). I had a user point out to me what the catch was good for, and then I finally understood what was going on!

I guess I should put in some words into the voip-info wiki at least, what the catch is good for, so the next guy doesn't have the same problem. I'll do that now.

I'm closing out the issue. I'll throw you a little karma, as this bug is a valid bug about documentation!