Re: [asterisk-users] AEL in 1.6 and Gosub

2010-03-17 Thread Klaus Darilion


Am 17.03.2010 00:40, schrieb Steve Murphy:



 How about:


 blacklist(${exten});


 macro blacklist(the_exten)
 {
  switch(the_exten)
  {
  pattern +4390[01]: Hangup();
  default: return;
  }
 }

Yes, that would work. I didn't knew the pattern statement.

 Basically, you are using the pattern matching capability to
 end the call for certain extensions... so the above should
 come close. If you really, really want to keep your gosub call,
 then you can, you'll just have to ignore the warnings, iirc.

I think I will just ignore it :-)

thanks
klaus


-- 
_
-- 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


Re: [asterisk-users] AEL in 1.6 and Gosub

2010-03-17 Thread Elliot Murdock
Hello Klaus,

Just for your quick reference, here are some other changes in the AEL
from versions 1.4 to 1.6 (source:
http://asteriskuptospeed.linuxinnovations.com/core1.4-1.6.2.html and
CHANGES file) :

Macros are now implemented underneath with the Gosub() application.
Heaven Help You if you wrote code depending on any aspect of this!
Previous to 1.6, macros were implemented with the Macro() app, which
provided a nice feature of auto-returning. The compiler will do its
best to insert a Return() app call at the end of your macro if you did
not include it, but really, you should make sure that all execution
paths within your macros end in return;.

The conf2ael program is 'introduced' in this release; it is in a
rather crude state, but deemed useful for making a first pass at
converting extensions.conf code into AEL. More intelligence will come
with time.

AEL upgraded to use the Gosub with Arguments instead of Macro
application, to hopefully reduce the problems seen with the
artificially low stack ceiling that Macro bumps into. Macros can only
call other Macros to a depth of 7. Tests run using gosub, show depths
limited only by virtual memory. A small test demonstrated recursive
call depths of 100,000 without problems. -- in addition to this, all
apps that allowed a macro to be called, as in Dial, queues, etc, are
now allowing a gosub call in similar fashion.

AEL now generates LOCAL(argname) declarations when it Set()'s the each
arg name to the value of ${ARG1}, ${ARG2), etc. That makes the
arguments local in scope. The user can define their own local
variables in macros, now, by saying local myvar=someval; or using
Set() in this fashion: Set(LOCAL(myvar)=someval); (local is now an
AEL keyword).
utils/conf2ael introduced. Will convert an extensions.conf file into
extensions.ael. Very crude and unfinished, but will be improved as
time goes by. Should be useful for a first pass at conversion.

aelparse will now read extensions.conf to see if a referenced macro or
context is there before issueing a warning.

AEL parser sets a local channel variable ~~EXTEN~~, to preserve the
value of ${EXTEN} thru switch statements.

New operator in $[...] expressions: the ~~ operator serves as a
concatenation operator. AT THE MOMENT, it is really only necessary and
useful in AEL, especially in if() expressions. Operation: ${a} ~~ ${b|
with force both a and b to strings, strip any enclosing double-quotes,
and evaluate to the value of a concatenated with the value of b. For
example if a is set to xyz and b has the value abc, then ${a} ~~
${b| would evaluate to xyzabc

Good luck with your upgrade!
Elliot

On Wed, Mar 17, 2010 at 12:48 PM, Klaus Darilion
klaus.mailingli...@pernau.at wrote:


 Am 17.03.2010 00:40, schrieb Steve Murphy:
 
 

  How about:
 
         
  blacklist(${exten});
         
 
  macro blacklist(the_exten)
  {
       switch(the_exten)
       {
       pattern +4390[01]: Hangup();
       default: return;
       }
  }

 Yes, that would work. I didn't knew the pattern statement.

  Basically, you are using the pattern matching capability to
  end the call for certain extensions... so the above should
  come close. If you really, really want to keep your gosub call,
  then you can, you'll just have to ignore the warnings, iirc.

 I think I will just ignore it :-)

 thanks
 klaus


 --
 _
 -- 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

-- 
_
-- 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


Re: [asterisk-users] AEL in 1.6 and Gosub

2010-03-16 Thread Steve Murphy
On Mon, Mar 15, 2010 at 12:47 PM, Klaus Darilion 
klaus.mailingli...@pernau.at wrote:



 Am 15.03.2010 13:48, schrieb Kevin P. Fleming:
  Klaus Darilion wrote:
  Hi!
 
  I just updated from 1.4 to 1.6.2.6 and Asterisk complains about my AEL
  dialplan:
 
  application call to Gosub affects flow of control, and needs to
  be re-written using AEL if, while, goto, etc. keywords instead
 
  What is the suggested replacement for an explicit Gosub() call? I use it
  like this:
 
  ...
  Gosub(blacklist,${exten},1);
  ...
 
  context blacklist {
  _+43900! =  Hangup();
  _+43910! =  Hangup();
  _+X. =  return;
 
  }


How about:

  
  blacklist(${exten});
  

macro blacklist(the_exten)
{
switch(the_exten)
{
pattern +4390[01]: Hangup();
default: return;
}
}

You could use something like the above.

Basically, you are using the pattern matching capability to
end the call for certain extensions... so the above should
come close. If you really, really want to keep your gosub call,
then you can, you'll just have to ignore the warnings, iirc.

murf


  In 1.6, AEL macro() is implemented using Gosub(), so you can use it as a
  direct replacement. This is listed in the CHANGES file.

 Hi Kevin!

 I know that AEL macro does not use Macro() anymore, but Gosub(). But
 does that imply the other way round too?

 Using an AEL macro (which is implemented as Gosub) instead of a Gosub
 does not work as the target is a context, not a macro which is
 implemented as pseudo context with an 's' extension.

 I do not see a way to implement the above dialplan using an AEL macro.
 Do I miss something?

 regards
 Klaus

 --
 _
 -- 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




-- 
Steve Murphy
ParseTree Corp
-- 
_
-- 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

[asterisk-users] AEL in 1.6 and Gosub

2010-03-15 Thread Klaus Darilion
Hi!

I just updated from 1.4 to 1.6.2.6 and Asterisk complains about my AEL 
dialplan:

   application call to Gosub affects flow of control, and needs to
   be re-written using AEL if, while, goto, etc. keywords instead

What is the suggested replacement for an explicit Gosub() call? I use it 
like this:

   ...
   Gosub(blacklist,${exten},1);
   ...

context blacklist {
   _+43900! = Hangup();
   _+43910! = Hangup();
   _+X. = return;

}

thanks
klaus

-- 
_
-- 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


Re: [asterisk-users] AEL in 1.6 and Gosub

2010-03-15 Thread Kevin P. Fleming
Klaus Darilion wrote:
 Hi!
 
 I just updated from 1.4 to 1.6.2.6 and Asterisk complains about my AEL 
 dialplan:
 
application call to Gosub affects flow of control, and needs to
be re-written using AEL if, while, goto, etc. keywords instead
 
 What is the suggested replacement for an explicit Gosub() call? I use it 
 like this:
 
...
Gosub(blacklist,${exten},1);
...
 
 context blacklist {
_+43900! = Hangup();
_+43910! = Hangup();
_+X. = return;
 
 }

In 1.6, AEL macro() is implemented using Gosub(), so you can use it as a
direct replacement. This is listed in the CHANGES file.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kflem...@digium.com
Check us out at www.digium.com  www.asterisk.org

-- 
_
-- 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


Re: [asterisk-users] AEL in 1.6 and Gosub

2010-03-15 Thread Klaus Darilion


Am 15.03.2010 13:48, schrieb Kevin P. Fleming:
 Klaus Darilion wrote:
 Hi!

 I just updated from 1.4 to 1.6.2.6 and Asterisk complains about my AEL
 dialplan:

 application call to Gosub affects flow of control, and needs to
 be re-written using AEL if, while, goto, etc. keywords instead

 What is the suggested replacement for an explicit Gosub() call? I use it
 like this:

 ...
 Gosub(blacklist,${exten},1);
 ...

 context blacklist {
 _+43900! =  Hangup();
 _+43910! =  Hangup();
 _+X. =  return;

 }

 In 1.6, AEL macro() is implemented using Gosub(), so you can use it as a
 direct replacement. This is listed in the CHANGES file.

Hi Kevin!

I know that AEL macro does not use Macro() anymore, but Gosub(). But 
does that imply the other way round too?

Using an AEL macro (which is implemented as Gosub) instead of a Gosub 
does not work as the target is a context, not a macro which is 
implemented as pseudo context with an 's' extension.

I do not see a way to implement the above dialplan using an AEL macro. 
Do I miss something?

regards
Klaus

-- 
_
-- 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