[asterisk-bugs] [Asterisk 0013416]: Function CUT doesn't work if passed as parameter to macro in AEL

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Sep 3 15:25:36 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13416 
====================================================================== 
Reported By:                yarns
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   13416
Category:                   PBX/pbx_ael
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.19 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-09-03 14:08 CDT
Last Modified:              2008-09-03 15:25 CDT
====================================================================== 
Summary:                    Function CUT doesn't work if passed as parameter to
macro in AEL
Description: 
Function CUT do not worik if passed as parameter to macro

Sample macro:

macro test (abc,cba)
{
  NoOp(${cba});
};

Calling macro:
&gsmSelect("testing",${CUT(EXTEN,,3)});

Output from console:
[Sep  3 20:58:42] ERROR[6251]: func_cut.c:263 acf_cut_exec: Syntax:
CUT(<varname>,<char-delim>,<range-spec>) - missing argument!
    -- Executing [8-0-693697987 at outgoing:4]
Macro("SIP/192.168.1.215-c4121d60", "test|"testing"|") in new stack

====================================================================== 

---------------------------------------------------------------------- 
 (0092037) blitzrage (administrator) - 2008-09-03 15:25
 http://bugs.digium.com/view.php?id=13416#c92037 
---------------------------------------------------------------------- 
I have gone ahead and reproduced this issue. It appears to be an AEL thing,
and not a func_cut thing -- although it could actually be CUT() not
accepting or understanding the commas in the dialplan. Here is my
extensions.ael and extensions.conf files:

extensions.ael:

macro test (abc,cba)
{
        NoOp(${cba});
};

context 13416 {
        100 => {
                &test("testing",${CUT(EXTEN,,3)});
        };

        101 => {
                res=${CUT(EXTEN,,3)};
                &test("testing",${res});
        };
};


extensions.conf:

[13416-conf]
exten => 102,1,Set(res=$[${CUT(EXTEN,,3)}])
exten => 102,n,Macro(test,"testing",${res})



And here is the output of 'show dialplan':

  '102' =>          1. Set(res=$[${CUT(EXTEN||3)}])              
[pbx_config]
                    2. Macro(test|"testing"|${res})              
[pbx_config]

[ Context '13416' created by 'pbx_ael' ]
  '100' =>          1. Macro(test|"testing"|${CUT(EXTEN,,3)})   
[pbx_ael]
  '101' =>          1. Set(res=$[${CUT(EXTEN,,3)}])             
[pbx_ael]
                    2. Macro(test|"testing"|${res})              
[pbx_ael]

[ Context 'macro-test' created by 'pbx_ael' ]
  's' =>            1. Set(abc=${ARG1})                          
[pbx_ael]
                    2. Set(cba=${ARG2})                          
[pbx_ael]
                    3. NoOp(${cba})                              
[pbx_ael]



I even tried putting in the hyphen in CUT() to see if that helped, but
still got the same error.

I notice that in 'show dialplan' the commas show up in the pbx_ael lines,
but in pbx_config they are converted to pipes (as per 1.4 style) -- so
maybe that has something to do with it?

Or... this could also be a syntax issue in AEL. I'm not sure about that as
I haven't really used AEL much (this was actually my first time in a couple
years :)) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-09-03 15:25 blitzrage      Note Added: 0092037                          
======================================================================




More information about the asterisk-bugs mailing list