[OpenSIPS-Users] How to prevent error when using invalid index on s.select

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Apr 13 19:14:57 CEST 2010


The line you posted is bogus - there are some trailing chars, but guess 
is c'n'p error.

In my test I also did an assignment (see the last line the block I 
pasted) - the index 4 is out scale .

Regards,
Bogdan

Brett Nemeroff wrote:
> Bogdan,
> I believe the problem is in the assignment of the value to a variable.
> ie:
> $avp(s:someval) = $(var(s){s.select,$var(i),,})\n");
>
>
> Basically the r-value is non-existant. In other languages, I'd
> typically check the value with an If (or enclose in an eval) before
> performing the assignment. What's the right way in the config syntax?
>
> Thanks,
> Brett
>
> On Tue, Apr 13, 2010 at 5:18 AM, Bogdan-Andrei Iancu
> <bogdan at voice-system.ro> wrote:
>   
>> Hi Brett,
>>
>> the following script :
>>    $var(s)="1,2,3,4";
>>    $var(i)= 4;
>>    xlog("----------$(var(s){s.select,$var(i),,})\n");
>>    xlog("----------\n");
>>    $var(x) = $(var(s){s.select,$var(i),,});
>>
>> does not produce the error you mentioned...
>>
>> maybe you have something different ?
>>
>> Regards,
>> Bogdan
>>
>> Brett Nemeroff wrote:
>>     
>>> Hello List,
>>> I'm using s.select to iterate over a list of values. I don't know how
>>> big the list is so I'm going to hit the end and it's going to error
>>> out..
>>>
>>> OpenSIPs produces an ERROR on this and I'd like to suppress this
>>> error. I've typically seen this performed in an eval or perhaps by
>>> knowing ahead of time how big the array is (which I don't know).
>>>
>>> So is there a right way to do this to not get the error?
>>>
>>> Here's what I'm getting:
>>> Apr 12 20:16:37 domU-XX-XX-XX-XX-XX-XX /usr/local/sbin/opensips[2611]:
>>> ERROR:core:eval_elem: invalid string operands
>>> Apr 12 20:16:37 domU-XX-XX-XX-XX-XX-XX /usr/local/sbin/opensips[2611]:
>>> ERROR:core:do_assign: no value in right expression
>>> Apr 12 20:16:37 domU-XX-XX-XX-XX-XX-XX /usr/local/sbin/opensips[2611]:
>>> ERROR:core:do_assign: error at line: 514
>>>
>>> Thanks,
>>> Brett
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>       
>> --
>> Bogdan-Andrei Iancu
>> www.voice-system.ro
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>     
>
> _______________________________________________
> 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