[asterisk-users] Wierd behavior of illegal extension

Tilghman Lesher tlesher at digium.com
Sun May 30 14:07:30 CDT 2010


On Sunday 30 May 2010 13:01:30 Richard Kenner wrote:
> > You really shouldn't be calling a Gosub routine from Macro.  We've
> > already had to deal with some really odd interactions between the
> > two.  If you're going to make the jump to Gosub, go completely over
> > and only use Gosub.  Don't use Macro in conjunction with Gosub.
>
> I find each most useful for different things.  Macros work best when there
> are a lot of return points and/or conditional returns since MacroExit
> is optional and I can exit by just doing a Goto to a nonexistant priority.

Relying upon that behavior is utterly awful.  It's much better to create a
label that is your exit point and going to that explicitly.

> Gosub is better when I don't want to have an 's' extension (due to wanting
> to be able to go to invalid extensions).
>
> If I can't mix them, I understand, but it'll make things more complex.

I think trying to mix them is actually more complex, due to the differing
behaviors.  The only area where Macro still might have an advantage is that
it returns upon hangup to execute the "h" extension in the original calling
context, though even that is conditional, based upon it having been broken
for a long time.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list