<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
On 4/7/10 6:14 PM, Ovidiu Sas wrote:
<blockquote
 cite="mid:q2y6f497e131004070914l823d182dg9d512c47eae4e347@mail.gmail.com"
 type="cite">
  <pre wrap="">How about defining a new PV: '$true'.
If we have a constant word in the while loop, then yes, it might be a
missconfiguration and it is good to have the warning.
Having a '$true' PV will mean that we want an infinite loop and
there's no need to print the warning.
The '$true' will make the config more easy to read as opposed to
defining a variable just for the purpose of creating an infinite loop.
  </pre>
</blockquote>
never used the while (true) loop, was it in 1.5? If yes, we can wrap
the warning log in #!KAMAILIO compat mode.<br>
<br>
An optimization to Andrei's suggestion is to init the true var at
startup, to avoid assignment every cfg execution:<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<pre class="programlisting">modparam("pv", "varset", "true=i:1")
</pre>
Cheers,<br>
Daniel<br>
<br>
<blockquote
 cite="mid:q2y6f497e131004070914l823d182dg9d512c47eae4e347@mail.gmail.com"
 type="cite">
  <pre wrap="">
Thanks,
Ovidiu

On Fri, Apr 2, 2010 at 4:53 AM, Andrei Pelinescu-Onciul
<a class="moz-txt-link-rfc2396E" href="mailto:andrei@iptel.org">&lt;andrei@iptel.org&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">On Apr 01, 2010 at 22:23, Ovidiu Sas <a class="moz-txt-link-rfc2396E" href="mailto:osas@voipembedded.com">&lt;osas@voipembedded.com&gt;</a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">If I define an infinite loop like this:
while( true ) {
&nbsp; &nbsp; ...
}
the following warning is reported:
WARNING: &lt;core&gt; [cfg.y:3307]: warning in config file
/etc/kamailio/kamailio.cfg, line 4, column 9-12: constant value in
while(...)
The config file used for testing:
#!KAMAILIO

route{
&nbsp; &nbsp; &nbsp; &nbsp; while( true ) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; exit;
}


How can I define a simple infinite loop without getting a warning in the logs.

I don't want to define a variable just for the while loop and test it.
$var(true) = 1;
while ($var(true)) {
&nbsp; &nbsp; ...
}

Is there a specific PV like '$null' or a specific keyword?
      </pre>
    </blockquote>
    <pre wrap="">
No, you have to live with the warning.
In most cases infinite loops are a bug and hence we better have the
warning (this is a sip router and not a general programing language).

Andrei

    </pre>
  </blockquote>
  <pre wrap="">
_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
Daniel-Constantin Mierla
* <a class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com/</a> * <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a>
* <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/danielconstantinmierla">http://www.linkedin.com/in/danielconstantinmierla</a>
</div>
</body>
</html>