[OpenSIPS-Users] If statement Syntax issue
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Fri Dec 11 19:28:20 CET 2009
Hi,
In order to try to reproduce this, please post the values you use for:
$avp(s:mobile_time)
$var(current_day)
I will try to you exactly the same script code and values as you to see
what I get.
Regards,
Bogdan
osiris123d wrote:
> The left side variable is defined because I do an xlog before the if
> statement and make sure the variable is correct and also an integer. I am
> not sure if you saw my post right after my first message, but here it is
> again
>
> Ok so I did some more testing and I see the following. Below in my first
> post the $var(current_day) value was 7. The
> $(avp(s:mobile_time){s.substr,8,1}) value was 1 and
> $(avp(s:mobile_time){s.substr,9,1}) value was 5. Well if I changed the
> value of $(avp(s:mobile_time){s.substr,9,1}) to be 7 I don't see those
> errors and the if statement is true and moves on like it should. So are
> those errors the normal output when an operator is not true? I would figure
> that you would never see those errors if its true or not.
>
>
> So everything works correctly if the variables are TRUE, its only if the
> variables equal FALSE in the if statement that I get those errors in my log
> files. So are those logs normal if one of the statements in the IF
> statement are false?
>
>
>
>
> Bogdan-Andrei Iancu wrote:
>
>> Hi Osiris,
>>
>> Maybe the left side operand cannot be evaluated because was not defined
>> (the $var(current_day) ). Can you check this ?
>>
>> Regards,
>> Bogdan
>>
>> osiris123d wrote:
>>
>>> I have the following IF statement that looks to be good syntax but I am
>>> getting an error
>>>
>>> Here is the syntax
>>>
>>> if ( $var(current_day) >= $(avp(s:mobile_time){s.substr,8,1}) &&
>>> $var(current_day) <= $(avp(s:mobile_time){s.substr,9,1}) )
>>> {
>>> blah
>>> blah
>>> }
>>>
>>> The error I get is
>>> CRITICAL:core:comp_scriptvar: cannot get left var value
>>> WARNING:core:do_action: error in expression (l=650)
>>>
>>> All variables have values so I know thats not an issue and the substr
>>> Transformation is also correct . If I edit the IF statement to only have
>>> the following it works fine
>>>
>>> if ( $var(current_day) >= $(avp(s:mobile_time){s.substr,8,1}) )
>>> {
>>> blah
>>> blah
>>> }
>>>
>>> Any clues?
>>>
>>>
>>>
>>>
>> --
>> Bogdan-Andrei Iancu
>> www.voice-system.ro
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>
>
--
Bogdan-Andrei Iancu
www.voice-system.ro
More information about the Users
mailing list