[Home]

Summary:ASTERISK-12468: Can not substring a variable using variables
Reporter:Leo Brown (netfuse)Labels:
Date Opened:2008-07-28 05:47:07Date Closed:2008-07-28 11:11:03
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
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.
Comments:By: Tilghman Lesher (tilghman) 2008-07-28 10:54:07

Seems to work fine for me:

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


By: Leo Brown (netfuse) 2008-07-28 11:06:42

It's not my day today. This is resolved!