Looks like a bug, then. I'll add this text to the bugnote. The ${FOO:-1:1} seems to always return theh "right" reply (the last character of the string) but the = operator for some reason doesn't like "*" (ironic, since it's an Asterisk. :-)
exten => 2213,1,SetVar(FOO=123**) exten => 2213,2,SetVar(CHECK=${FOO:-1:1})
-- Executing SetVar("SIP/2203-2a83", "FOO=123**") in new stack
-- Executing SetVar("SIP/2203-2a83", "CHECK=*") in new stackJT
What does this step show on the CLI ? exten => 1,1,SetVar(FOO=123**) exten => 1,2,SetVar(CHECK=${FOO:-1:1})
? If you're going to see CHECK=* then there is a bug in = operator ...
Martin
On Fri, 5 Sep 2003, John Todd wrote:
I am having Yet Another Regular Expression problem, but this one might not be my fault, or at least it might not be obviously my fault. :-)
exten => 2212,1,SetVar(FOO=123456**) exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = *])
This script continues with a value of 0 in BAR.
Similarly, none of the following changes made a difference in that result, which is expected since the * is not listed in README.variables as a character that must be escaped:
exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "*"]) exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "\*"]) exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = \*])
I have also tried setting the variable ${BAZ}=* and then using that in my comparison, with the same unexpected results.
Oddly enough, this almost-identical example below has different, but "normal", results: BAR=1
exten => 2212,1,SetVar(FOO=123456##) exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = #])
What gives? Am I colliding with a problem that is the result of the "*" character being used in expr evaluations and somehow not being handled correctly, or am I simply not implementing the syntax correctly?
JT _______________________________________________ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
