Browse code

cfgutils: improve example for $RANDOM

(cherry picked from commit 79b2e4b00ebf7a7cdf0ed3b9c4ab7f0176d78686)
(cherry picked from commit 2b3e09d781a157629c5f9bdb809f7c43bf41dbe2)

Henning Westerholt authored on 03/05/2022 17:45:49 • Daniel-Constantin Mierla committed on 15/09/2022 11:25:03
Showing 1 changed files
... ...
@@ -839,11 +839,11 @@ $ &kamcmd; cfgutils.get_gflags
839 839
 				<programlisting format="linespecific">
840 840
 ...
841 841
 if (rand_event()) {
842
-  $avp(i:10) = ($RANDOM / 16777216); # 2^24
843
-  if ($avp(i:10) &lt; 10) {
844
-     $avp(i:10) = 10;
842
+  $var(value) = ($RANDOM / 16777216); # 2^24
843
+  if ($var(value) &lt; 10) {
844
+     $var(value) = 10;
845 845
   }
846
-  append_to_reply("Retry-After: $avp(i:10)\n");
846
+  append_to_reply("Retry-After: $var(value)\n");
847 847
   sl_send_reply("503", "Try later");
848 848
   exit;
849 849
 };