VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
ethy.brito at inexo.co... Guest
|
Posted: Sat Nov 28, 2015 8:14 am Post subject: [asterisk-users] endwhile jumping out of macro |
|
|
Hi
I have a 3 level nested while-endwhile loop in a macro that when the
execution reaches endwhile, it is jumping out to the While at the caller
macro.
It shouldn't since the are instructions after the endwhile.
-- Executing [s@macro-call-from-outside:72] EndWhile("DAHDI/i1/1234567-4a7f", "") in new stack
== Channel 'DAHDI/i1/1234567-4a7f' jumping out of macro 'call-from-outside'
-- Executing [s@macro-recurse_check_redirect_not_mailbox:7]
While("DAHDI/i1/1234567-4a7f", "1") in new stack
I checked the while-endwhile balance and it seems ok.
I also checked if I GoTo() outside the loop. I don't.
Macroexit is executed inside the while-endwhile loop in certain cases
exiting some inner loop.
Could MacroExiting inside a while loop cause this lost of balance?
Regards
Ethy
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Mon Nov 30, 2015 10:51 am Post subject: [asterisk-users] endwhile jumping out of macro |
|
|
On Sat, Nov 28, 2015 at 7:14 AM, Ethy H. Brito <ethy.brito@inexo.com.br (ethy.brito@inexo.com.br)> wrote:
Quote: |
Hi
I have a 3 level nested while-endwhile loop in a macro that when the
execution reaches endwhile, it is jumping out to the While at the caller
macro.
It shouldn't since the are instructions after the endwhile.
-- Executing [s@macro-call-from-outside:72] EndWhile("DAHDI/i1/1234567-4a7f", "") in new stack
== Channel 'DAHDI/i1/1234567-4a7f' jumping out of macro 'call-from-outside'
-- Executing [s@macro-recurse_check_redirect_not_mailbox:7]
While("DAHDI/i1/1234567-4a7f", "1") in new stack
I checked the while-endwhile balance and it seems ok.
I also checked if I GoTo() outside the loop. I don't.
Macroexit is executed inside the while-endwhile loop in certain cases
exiting some inner loop.
Could MacroExiting inside a while loop cause this lost of balance?
|
Yes it could. A While loop should be terminated with an EndWhile.
Both the While application as well as the Macro application attempt to control the PBX flow while a channel is executing within them. Terminating an outer container of PBX flow without properly terminating an inner one can inbalance the stack.
And just as a reminder, Macros are deprecated. They tend to have odd side effects at times, and overly nesting Macros can result in a crash. You should consider switching to subroutines.
Matt
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
ethy.brito at inexo.co... Guest
|
Posted: Mon Nov 30, 2015 12:35 pm Post subject: [asterisk-users] endwhile jumping out of macro |
|
|
On Mon, 30 Nov 2015 09:40:50 -0600
Matthew Jordan <mjordan@digium.com> wrote:
Quote: | On Sat, Nov 28, 2015 at 7:14 AM, Ethy H. Brito <ethy.brito@inexo.com.br>
wrote:
Quote: |
Hi
I have a 3 level nested while-endwhile loop in a macro that when the
execution reaches endwhile, it is jumping out to the While at the caller
macro.
It shouldn't since the are instructions after the endwhile.
-- Executing [s@macro-call-from-outside:72]
EndWhile("DAHDI/i1/1234567-4a7f", "") in new stack
== Channel 'DAHDI/i1/1234567-4a7f' jumping out of macro
'call-from-outside'
-- Executing [s@macro-recurse_check_redirect_not_mailbox:7]
While("DAHDI/i1/1234567-4a7f", "1") in new stack
I checked the while-endwhile balance and it seems ok.
I also checked if I GoTo() outside the loop. I don't.
Macroexit is executed inside the while-endwhile loop in certain cases
exiting some inner loop.
Could MacroExiting inside a while loop cause this lost of balance?
| Yes it could. A While loop should be terminated with an EndWhile.
|
I've already suspected that.
I did some changes in the code. It is now running smooth.
BTW, is there a "breakwhile" or something like that, that jumps out of a
while-endwhile loop? Just like the "C" break command.
Quote: |
Both the While application as well as the Macro application attempt to
control the PBX flow while a channel is executing within them. Terminating
an outer container of PBX flow without properly terminating an inner one
can inbalance the stack.
And just as a reminder, Macros are deprecated. They tend to have odd side
effects at times, and overly nesting Macros can result in a crash. You
should consider switching to subroutines.
|
Can you please point me some good tutorial on converting Macros to subroutines?
Or on subroutines operation themselves?
Regards
Ethy
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Mon Nov 30, 2015 12:50 pm Post subject: [asterisk-users] endwhile jumping out of macro |
|
|
On Mon, Nov 30, 2015 at 11:34 AM, Ethy H. Brito <ethy.brito@inexo.com.br (ethy.brito@inexo.com.br)> wrote:
Quote: | On Mon, 30 Nov 2015 09:40:50 -0600
Matthew Jordan <mjordan@digium.com (mjordan@digium.com)> wrote:
Quote: | On Sat, Nov 28, 2015 at 7:14 AM, Ethy H. Brito <ethy.brito@inexo.com.br (ethy.brito@inexo.com.br)>
wrote:
Quote: |
Hi
I have a 3 level nested while-endwhile loop in a macro that when the
execution reaches endwhile, it is jumping out to the While at the caller
macro.
It shouldn't since the are instructions after the endwhile.
-- Executing [s@macro-call-from-outside:72]
EndWhile("DAHDI/i1/1234567-4a7f", "") in new stack
== Channel 'DAHDI/i1/1234567-4a7f' jumping out of macro
'call-from-outside'
-- Executing [s@macro-recurse_check_redirect_not_mailbox:7]
While("DAHDI/i1/1234567-4a7f", "1") in new stack
I checked the while-endwhile balance and it seems ok.
I also checked if I GoTo() outside the loop. I don't.
Macroexit is executed inside the while-endwhile loop in certain cases
exiting some inner loop.
Could MacroExiting inside a while loop cause this lost of balance?
| Yes it could. A While loop should be terminated with an EndWhile.
|
I've already suspected that.
I did some changes in the code. It is now running smooth.
BTW, is there a "breakwhile" or something like that, that jumps out of a
while-endwhile loop? Just like the "C" break command.
|
Yup - ExitWhile.
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_ExitWhile
Quote: | >
Quote: | Both the While application as well as the Macro application attempt to
control the PBX flow while a channel is executing within them. Terminating
an outer container of PBX flow without properly terminating an inner one
can inbalance the stack.
And just as a reminder, Macros are deprecated. They tend to have odd side
effects at times, and overly nesting Macros can result in a crash. You
should consider switching to subroutines.
|
Can you please point me some good tutorial on converting Macros to subroutines?
Or on subroutines operation themselves? |
The Asterisk wiki has a number of pages on this subject, including the 'special' subroutines (hangup handlers, pre-dial handlers, etc.):
https://wiki.asterisk.org/wiki/display/AST/GoSub
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|