[asterisk-bugs] [Asterisk 0010870]: AEL & CUT

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Oct 2 14:53:22 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10870 
====================================================================== 
Reported By:                non-poster
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10870
Category:                   PBX/pbx_ael
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.11  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             10-02-2007 14:16 CDT
Last Modified:              10-02-2007 14:53 CDT
====================================================================== 
Summary:                    AEL & CUT
Description: 
CUT doesn't seem to work like I would expect.

This works:

macro route-enum-2(exten, Timeout, DialOpts, dns) {
    Set(ENLCOUNT=${ENUMLOOKUP(+${exten},ALL,c,,${dns})});
    if (${ENLCOUNT} > 0 )
    {
        for(count=1;${count} <= ${ENLCOUNT};count=${count} + 1) {
            Set(ENL=${ENUMLOOKUP(+${exten},ALL,,${count},${dns})});
            if (${LEN(${ENL})} > 0) {
                if ("${ENL:0:3}" = "sip") {
                    Dial(SIP/${ENL:4},${Timeout},o${DialOpts});
                } else if ("${ENL:0:4}" = "iax2") {
                    Dial(IAX2/${ENL:5},${Timeout},o${DialOpts});
                } else if ("${ENL:0:4}" = "h323") {
                    Dial(H323/${ENL:5},${Timeout},o${DialOpts});
                };
            };
        };
    };
};



This doesn't work:

                switch (${CUT(ENL,:,1)}) {
                    case sip:
                        Dial(SIP/${ENL:4},${Timeout},o${DialOpts});
                        break;
                    case iax2:
                        Dial(IAX2/${ENL:5},${Timeout},o${DialOpts});
                        break;
                    case h323:
                        Dial(H323/${ENL:5},${Timeout},o${DialOpts});
                        break;
                    default:
                        NoOp(blah);
                };



Asterisk 1.4.11, gcc 4.1.2, glibc 2.5, amd64 
====================================================================== 

---------------------------------------------------------------------- 
 non-poster - 10-02-07 14:53  
---------------------------------------------------------------------- 
> core show function CUT
  -= Info about function 'CUT' =-

[Syntax]
CUT(<varname>,<char-delim>,<range-spec>)

[Synopsis]
Slices and dices strings, based upon a named delimiter.

[Description]
  varname    - variable you want cut
  char-delim - defaults to '-'
  range-spec - number of the field you want (1-based offset)
             may also be specified as a range (with -)
             or group of ranges and fields (with &)


I would expect my example (eg ${CUT(ENL,:,1)} ) to return the first group
of characters that precede the ":" character. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-02-07 14:53  non-poster     Note Added: 0071351                          
======================================================================




More information about the asterisk-bugs mailing list