@smititelu - that note from the docs sounds ok for me (maybe because I wrote it, although
I am not sure I did). Practically wants to say that assign explicitly a value before using
it, not to get the value set a while ago in another SIP message processing context.
If you do:
```
request_route {
...
while ($var(i) < 100) {
...
$var(i) = $var(i) + 1;
}
...
}
```
The while loop gets inside once because $var(i) is 0 first time, but then remains set to
100 for all next requests. Therefore set it to the value you want before using it:
```
request_route {
...
$var(i) = 0;
while ($var(i) < 100) {
...
$var(i) = $var(i) + 1;
}
...
}
```
Feel free to change the statement in the docs, if you consider more clarifications there,
but I don't see any benefit in storing an extra int field in the internal var
structure.
Maybe $vn() offers better the kind of variable you need. It is like $var() but can have
$null value (state).
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3114#issuecomment-1128770857
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3114/c1128770857(a)github.com>