[asterisk-bugs] [Asterisk 0018453]: Dialplan does not work as it should

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Dec 10 11:02:16 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18453 
====================================================================== 
Reported By:                falves11
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18453
Category:                   PBX/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.2 
SVN Revision (number only!): 297824 
Request Review:              
====================================================================== 
Date Submitted:             2010-12-09 15:42 CST
Last Modified:              2010-12-10 11:02 CST
====================================================================== 
Summary:                    Dialplan does not work as it should
Description: 
Given a set of global variables GW0=A, GW1=B, etc,, and two integer global
variables MXC=0 and MX=1

The following line does not work (erroneously), 
exten =>_X.,1,Set(Target=${GW${${RAND(${MXC},${MX})}}})

So I had to break it in 2 separate lines, that do exactly what the first
line should do
exten =>_X.,1,Set(junky=${RAND(${MXC},${MX})})
exten =>_X.,n,Set(Target=${GW${junky}})

The goal os to have the variable Target to randomly fluctuate between GW0 
and GW1.
I think that the parser is flawed, since both ways to express the logic
are correct.


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

---------------------------------------------------------------------- 
 (0129538) tilghman (administrator) - 2010-12-10 11:02
 https://issues.asterisk.org/view.php?id=18453#c129538 
---------------------------------------------------------------------- 
You have an extra set of braces in there:
exten =>_X.,1,Set(Target=${GW${${RAND(${MXC},${MX})}}})
${${RAND(0,1)}}
evaluates to either ${0} or ${1}, which is blank, in both cases.  Thus,
it's trying to evaluate ${GW} in the final case, which is blank.  What you
actually want is
exten =>_X.,1,Set(Target=${GW${RAND(${MXC},${MX})}}) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-12-10 11:02 tilghman       Note Added: 0129538                          
======================================================================




More information about the asterisk-bugs mailing list