[asterisk-bugs] [Asterisk 0013178]: Can not substring a variable using variables

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Jul 28 10:54:07 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13178 
====================================================================== 
Reported By:                leobrown
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13178
Category:                   Core/PBX
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.6.0-beta9 
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-07-28 05:47 CDT
Last Modified:              2008-07-28 10:54 CDT
====================================================================== 
Summary:                    Can not substring a variable using variables
Description: 
The asterisk format for creating substrings ${VAR:1:2} works perfectly with
static figures, but does not accept variable offsets, for instance:

${VAR:0:-${LEN}}

What happens in this case, where VAR=123 and LEN=1 is an evaluation to
"1231" rather than "12" - a string with a single character removed from the
back.

Possible workaround in dialplans would be an asterisk SUBSTR() function,
but this does not exist.
====================================================================== 

---------------------------------------------------------------------- 
 (0090760) Corydon76 (administrator) - 2008-07-28 10:54
 http://bugs.digium.com/view.php?id=13178#c90760 
---------------------------------------------------------------------- 
Seems to work fine for me:

    -- Executing [123 at test:1] Set("Local/123 at test-3d26,2", "VAR=123") in
new stack
    -- Executing [123 at test:2] Set("Local/123 at test-3d26,2", "LEN=1") in new
stack
    -- Executing [123 at test:3] NoOp("Local/123 at test-3d26,2", "12") in new
stack
 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-07-28 10:54 Corydon76      Note Added: 0090760                          
======================================================================




More information about the asterisk-bugs mailing list