Administrator TOOTAI
2013-Mar-21 18:45 UTC
[asterisk-users] Howto create variable from the name of another one and get content of it
Hello, I have a variable created like ... Set(__myVar=${ARG1}) ... Set(__${myVar}STATUS=) If ARG1 is abcd, variable is abcdSTATUS and should be empty. This is OK. Now I would like to get the value of abcdSTATUS. How to do it? ${${myVar}STATUS}} isn't working, nor ${{myvar}STATUS} Thanks for any hint -- Daniel
Asghar Mohammad
2013-Mar-21 18:59 UTC
[asterisk-users] Howto create variable from the name of another one and get content of it
hi, ${myVar}STATUS is empty you have not assign any value here your var Set(__${myVar}STATUS=) is empty. use instead Set(__myVar=${ARG1}STATUS) and remove second line. On Thu, Mar 21, 2013 at 7:45 PM, Administrator TOOTAI <admin at tootai.net>wrote:> Hello, > > I have a variable created like > > ... Set(__myVar=${ARG1}) > ... Set(__${myVar}STATUS=) > > If ARG1 is abcd, variable is abcdSTATUS and should be empty. This is OK. > > Now I would like to get the value of abcdSTATUS. How to do it? > ${${myVar}STATUS}} isn't working, nor ${{myvar}STATUS} > > Thanks for any hint > > -- > Daniel > > -- > ______________________________**______________________________**_________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/**mailman/listinfo/asterisk-**users<http://lists.digium.com/mailman/listinfo/asterisk-users> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130321/bfb05af0/attachment.htm>
Steve Edwards
2013-Mar-21 19:27 UTC
[asterisk-users] Howto create variable from the name of another one and get content of it
On Thu, 21 Mar 2013, Administrator TOOTAI wrote:> I have a variable created like > > ... Set(__myVar=${ARG1}) > ... Set(__${myVar}STATUS=) > > If ARG1 is abcd, variable is abcdSTATUS and should be empty. This is OK. > > Now I would like to get the value of abcdSTATUS. How to do it? > ${${myVar}STATUS}} isn't working, nor ${{myvar}STATUS}If 'variable is abcdSTATUS and should be empty' what value are you trying to get? In your first try '${${myVar}STATUS}}' you have 1 too many closing brace. In your second try '${{myvar}STATUS}' you're missing a 'dollar.' Is this what you are trying to do? exten = *,n, set(ARG1=abcd) exten = *,n, set(__myVar=${ARG1}) exten = *,n, set(__${myVar}STATUS=status) exten = *,n, verbose(myVar = ${myVar}) exten = *,n, verbose(dollar{myVar}STATUS = ${${myVar}STATUS}) exten = *,n, hangup() -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000