[asterisk-dev] (ASTERISK-19336) h exten is not run in the context that calls a AEL macro

Johan Wilfer lists at jttech.se
Thu Feb 23 05:54:30 CST 2012


Hi!

But if I change the code to scenario 1, no h-exten is run, is this the
intended behaviour?


context conference {
    incoming => {
      &testmacro();
    }

    h => {
      Noop(Called from the context that invokes the macro - THIS DOESN'T
WORK);
    }
  }

  macro testmacro() {
    Noop(Running testmacro!);
    Wait(20);
  }


Connected to Asterisk 1.8.9.2 currently running on dev01 (pid = 3762)
    -- Executing [incoming at conference:1] Gosub("SIP/trunk-00000000",
"testmacro,~~s~~,1") in new stack
    -- Executing [~~s~~@testmacro:1] NoOp("SIP/trunk-00000000", "ning
testmacro!") in new stack
    -- Executing [~~s~~@testmacro:2] Wait("SIP/trunk-00000000", "20") in
new stack
  == Spawn extension (testmacro, ~~s~~, 2) exited non-zero on
'SIP/trunk-00000000'



I like your hangup-handlers-patch, it seems like a nice solution.
Right now I can't use macros in ael where it's important to run the code
in the hangup exten, so I use gosub insted and use h => { goto
main_context,h,1 }.
However, this is quite hackish and the ael parser try to advice me
otherwise on every reload ("gosub affects call flow...").


/Johan

2012-02-22 23:35, Mark Murawski skrev:
> I agree.  This is not a bug.
>
> >>      -- Executing [h at testmacro:1] NoOp("SIP/trunk-00000002", "h
> catched in testmacro - OK!") in new stack
>
> Looks like the h exten executed exactly where it should have.
>
> Only the inner-most h will execute on hangup.
>
> You can check out my hangup handlers patch at
> https://reviewboard.asterisk.org/r/1230/
>
> I'm getting back in the swing of things in my development, so this and
> other projects will be committed within the next month.
>
>
> On 02/22/12 15:38, Johan Wilfer wrote:
>> I've noticed that the h exten isn't executed if using AEL and a call is
>> currently in a macro. (ASTERISK-19336)
>>
>> Maybe I was unclear in the bugreport, but I described two scenarios.
>> 1) ael context with h-exten (not executed on hangup) calling macro
>> 2) ael context with h-exten (not executed on hangup) calling macro with
>> catch h { ... } (executed on hangup)
>>
>> The issue was closed, refering to scenario 2.
>>
>> Can this issue be reopened? Because in scenario 1 not a single h-exten
>> is executed..
>>
>> Thanks!
>>
>> /Johan
>>
>>
>> -------- Ursprungligt meddelande --------
>> Ämne:     [JIRA] Closed: (ASTERISK-19336) h exten is not run in the
>> context
>> that calls a AEL macro
>> Datum:     Fri, 10 Feb 2012 08:36:19 -0600 (CST)
>> Från:     Matt Jordan (JIRA) <noreply at issues.asterisk.org>
>> Till:     johan at wilfer.se
>>
>>
>>
>>      
>> [https://issues.asterisk.org/jira/browse/ASTERISK-19336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>> ]
>>
>> Matt Jordan closed ASTERISK-19336.
>> ----------------------------------
>>
>>      Resolution: Not A Bug
>>
>> Only one hangup handler will ever be called.  The hangup handler that
>> is called will be the one closest in scope to the current location of
>> the executing call.
>>
>> Note that there is a proposed feature that would allow for a stack of
>> hangup handlers to be called; however, that would be a new feature
>> and not a bug.
>>
>>>  h exten is not run in the context that calls a AEL macro
>>>  --------------------------------------------------------
>>>
>>>                  Key: ASTERISK-19336
>>>                 
>>> URL:https://issues.asterisk.org/jira/browse/ASTERISK-19336
>>>              Project: Asterisk
>>>           Issue Type: Bug
>>>       Security Level: None
>>>           Components: PBX/pbx_ael
>>>     Affects Versions: 1.8.9.2
>>>             Reporter: Johan Wilfer
>>>
>>>  I expect the h exten to be run both in the macro catch-block and in
>>> the context calling the macro. This is not the case.
>>>  The following code:
>>>  {code:xml}
>>>    context conference {
>>>      incoming =>  {
>>>        &testmacro();
>>>      }
>>>      h =>  {
>>>        Noop(Called from the context that invokes the macro - THIS
>>> DOESN'T WORK);
>>>      }
>>>    }
>>>    macro testmacro() {
>>>      Noop(Running testmacro!);
>>>      Wait(20);
>>>      catch h {
>>>        Noop(h catched in testmacro - OK!);
>>>      }
>>>    }
>>>  {code}
>>>  Creates this output:
>>>  {code:xml}
>>>      -- Executing [incoming at conference:1]
>>> Gosub("SIP/trunk-00000002", "testmacro,~~s~~,1") in new stack
>>>      -- Executing [~~s~~@testmacro:1] NoOp("SIP/trunk-00000002",
>>> "Running testmacro!") in new stack
>>>      -- Executing [~~s~~@testmacro:2] Wait("SIP/trunk-00000002",
>>> "20") in new stack
>>>    == Spawn extension (testmacro, ~~s~~, 2) exited non-zero on
>>> 'SIP/trunk-00000002'
>>>      -- Executing [h at testmacro:1] NoOp("SIP/trunk-00000002", "h
>>> catched in testmacro - OK!") in new stack
>>>  {code}
>>>  The h-exten in the calling context is never called..
>>>  The issue is the same with 1.6.2.20, and it's also the same if you
>>> remove the "catch h { ... } "-block in the macro - the context that
>>> calls the macro never executes it's h-exten.
>>
>> -- 
>> This message is automatically generated by JIRA.
>> For more information on JIRA, see:http://www.atlassian.com/software/jira
>>
>>
>>
>> This body part will be downloaded on demand.
>
>
>
> -- 
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev


-- 
Med vänlig hälsning

Johan Wilfer                 email: johan at jttech.se
JT Tech | Utvecklare         webb: http://jttech.se
direkt: +46 31 380 91 01  support: +46 31 380 91 00

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120223/fd55d199/attachment-0001.htm>


More information about the asterisk-dev mailing list