[OpenSIPS-Users] If statement Syntax issue

osiris123d duane.larson at gmail.com
Fri Dec 11 18:04:44 CET 2009


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
> 
> 

-- 
View this message in context: http://n2.nabble.com/If-statement-Syntax-issue-tp4122982p4152408.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list