4.19. route_if_exists(route)
4.20. core_hash(string1, string2, size)
- 5. MI Commands
+ 5. RPC Commands
- 5.1. rand_set_prop
- 5.2. rand_reset_prob
- 5.3. rand_get_prob
- 5.4. check_config_hash
- 5.5. get_config_hash
- 5.6. set_gflag
- 5.7. reset_gflag
- 5.8. is_gflag
- 5.9. get_gflags
+ 5.1. cfgutils.rand_set_prop
+ 5.2. cfgutils.rand_reset_prob
+ 5.3. cfgutils.rand_get_prob
+ 5.4. cfgutils.check_config_hash
+ 5.5. cfgutils.get_config_hash
+ 5.6. cfgutils.set_gflag
+ 5.7. cfgutils.reset_gflag
+ 5.8. cfgutils.is_gflag
+ 5.9. cfgutils.get_gflags
- 6. RPC Commands
+ 6. Exported pseudo-variables
- 6.1. cfgutils.set_gflag
- 6.2. cfgutils.reset_gflag
- 6.3. cfgutils.is_gflag
-
- 7. Exported pseudo-variables
-
- 7.1. $RANDOM
+ 6.1. $RANDOM
List of Examples
1.22. check_route_exists() usage
1.23. route_if_exists() usage
1.24. core_hash() usage
- 1.25. rand_set_prob usage
- 1.26. rand_reset_prob usage
- 1.27. rand_get_prob usage
- 1.28. check_config_hash usage
- 1.29. get_config_hash usage
- 1.30. set_gflag usage
- 1.31. reset_gflag usage
- 1.32. is_gflag usage
- 1.33. get_gflags usage
- 1.34. cfgutils.set_gflag usage
- 1.35. cfgutils.reset_gflag usage
- 1.36. cfgutils.is_gflag usage
- 1.37. RANDOM pseudo-variable usage
+ 1.25. cfgutils.rand_set_prob usage
+ 1.26. cfgutils.rand_reset_prob usage
+ 1.27. cfgutils.rand_get_prob usage
+ 1.28. cfgutils.check_config_hash usage
+ 1.29. cfgutils.get_config_hash usage
+ 1.30. cfgutils.set_gflag usage
+ 1.31. cfgutils.reset_gflag usage
+ 1.32. cfgutils.is_gflag usage
+ 1.33. cfgutils.get_gflags usage
+ 1.34. RANDOM pseudo-variable usage
Chapter 1. Admin Guide
4.19. route_if_exists(route)
4.20. core_hash(string1, string2, size)
- 5. MI Commands
-
- 5.1. rand_set_prop
- 5.2. rand_reset_prob
- 5.3. rand_get_prob
- 5.4. check_config_hash
- 5.5. get_config_hash
- 5.6. set_gflag
- 5.7. reset_gflag
- 5.8. is_gflag
- 5.9. get_gflags
+ 5. RPC Commands
- 6. RPC Commands
+ 5.1. cfgutils.rand_set_prop
+ 5.2. cfgutils.rand_reset_prob
+ 5.3. cfgutils.rand_get_prob
+ 5.4. cfgutils.check_config_hash
+ 5.5. cfgutils.get_config_hash
+ 5.6. cfgutils.set_gflag
+ 5.7. cfgutils.reset_gflag
+ 5.8. cfgutils.is_gflag
+ 5.9. cfgutils.get_gflags
- 6.1. cfgutils.set_gflag
- 6.2. cfgutils.reset_gflag
- 6.3. cfgutils.is_gflag
+ 6. Exported pseudo-variables
- 7. Exported pseudo-variables
-
- 7.1. $RANDOM
+ 6.1. $RANDOM
1. Overview
Default value is “10”.
Example 1.1. initial_probability parameter usage
+...
modparam("cfgutils", "initial_probability", 15)
+...
3.2. hash_file (string)
functionality is disabled.
Example 1.2. hash_file parameter usage
+...
modparam("cfgutils", "hash_file", "/etc/kamailio/kamailio.cfg")
+...
3.3. initial_gflags (integer)
Default value is “0”.
Example 1.3. initial parameter usage
+...
modparam("cfgutils", "initial_gflags", 15)
+...
3.4. lock_set_size (integer)
Default value is “0” - no lock set created.
Example 1.4. lock_set_size parameter usage
+...
modparam("cfgutils", "lock_set_size", 4)
+...
4. Functions
Example 1.8. rand_get_prob() usage
...
rand_get_prob();
+...
4.5. sleep(time)
core_hash("$ci", "", 4);
...
-5. MI Commands
+5. RPC Commands
- 5.1. rand_set_prop
- 5.2. rand_reset_prob
- 5.3. rand_get_prob
- 5.4. check_config_hash
- 5.5. get_config_hash
- 5.6. set_gflag
- 5.7. reset_gflag
- 5.8. is_gflag
- 5.9. get_gflags
+ 5.1. cfgutils.rand_set_prop
+ 5.2. cfgutils.rand_reset_prob
+ 5.3. cfgutils.rand_get_prob
+ 5.4. cfgutils.check_config_hash
+ 5.5. cfgutils.get_config_hash
+ 5.6. cfgutils.set_gflag
+ 5.7. cfgutils.reset_gflag
+ 5.8. cfgutils.is_gflag
+ 5.9. cfgutils.get_gflags
Functions that check or change some global flags accepts one parameter
which is the flag bitmap/mask specifing the corresponding flags. It is
not possible to specify directly the flag position that should be
changed as in the functions available in the routing script.
-5.1. rand_set_prop
+5.1. cfgutils.rand_set_prop
Set the probability value to the given parameter. The parameter should
be a percent value.
The parameter value must be a number from 0 to 100.
- Example 1.25. rand_set_prob usage
+ Example 1.25. cfgutils.rand_set_prob usage
...
-$ kamctl fifo rand_set_prob 10
+$ kamcmd cfgutils.rand_set_prob 10
...
-5.2. rand_reset_prob
+5.2. cfgutils.rand_reset_prob
Reset the probability value to the inital start value.
This command don't need a parameter.
- Example 1.26. rand_reset_prob usage
+ Example 1.26. cfgutils.rand_reset_prob usage
...
-$ kamctl fifo rand_reset_prob
+$ kamcmd cfgutils.rand_reset_prob
...
-5.3. rand_get_prob
+5.3. cfgutils.rand_get_prob
Return the actual probability setting.
The function return the actual probability value.
- Example 1.27. rand_get_prob usage
+ Example 1.27. cfgutils.rand_get_prob usage
...
-$ kamctl fifo get_prob
-The actual probability is 50 percent.
+$ kamcmd cfgutils.rand_get_prob
...
-5.4. check_config_hash
+5.4. cfgutils.check_config_hash
Check if the actual config file hash is identical to the stored one.
there are not identical, 404 if no file for hashing has been configured
and 500 on errors. Additional a short text message is printed.
- Example 1.28. check_config_hash usage
+ Example 1.28. cfgutils.check_config_hash usage
...
-$ kamctl fifo check_config_hash
-The actual config file hash is identical to the stored one.
+$ kamcmd cfgutils.check_config_hash
...
-5.5. get_config_hash
+5.5. cfgutils.get_config_hash
Return the stored config file hash.
The function returns 200 OK and the hash value on success or 404 if no
file for hashing has been configured.
- Example 1.29. get_config_hash usage
+ Example 1.29. cfgutils.get_config_hash usage
...
-$ kamctl fifo get_config_hash
-1580a37104eb4de69ab9f31ce8d6e3e0
+$ kamcmd cfgutils.get_config_hash
...
-5.6. set_gflag
+5.6. cfgutils.set_gflag
Set the value of some flags (specified by bitmask) to 1.
The parameter value must be a bitmask in decimal or hexadecimal format.
The bitmask has a 32 bit size.
- Example 1.30. set_gflag usage
+ Example 1.30. cfgutils.set_gflag usage
...
-$ kamctl fifo set_gflag 1
-$ kamctl fifo set_gflag 0x3
+$ kamcmd cfgutils.set_gflag 1
...
-5.7. reset_gflag
+5.7. cfgutils.reset_gflag
Reset the value of some flags to 0.
The parameter value must be a bitmask in decimal or hexadecimal format.
The bitmask has a 32 bit size.
- Example 1.31. reset_gflag usage
+ Example 1.31. cfgutils.reset_gflag usage
...
-$ kamctl fifo reset_gflag 1
-$ kamctl fifo reset_gflag 0x3
+$ kamcmd cfgutils.reset_gflag 1
...
-5.8. is_gflag
+5.8. cfgutils.is_gflag
Returns true if the all the flags from the bitmask are set.
The function returns TRUE if all the flags from the set are set and
FALSE if at least one is not set.
- Example 1.32. is_gflag usage
+ Example 1.32. cfgutils.is_gflag usage
...
-$ kamctl fifo set_gflag 1024
-$ kamctl fifo is_gflag 1024
-TRUE
-$ kamctl fifo is_gflag 1025
-TRUE
-$ kamctl fifo is_gflag 1023
-FALSE
-$ kamctl fifo set_gflag 0x10
-$ kamctl fifo is_gflag 1023
-TRUE
-$ kamctl fifo is_gflag 1007
-FALSE
-$ kamctl fifo is_gflag 16
+$ kamcmd cfgutils.set_gflag 1024
+$ kamcmd cfgutils.is_gflag 1024
TRUE
...
-5.9. get_gflags
+5.9. cfgutils.get_gflags
Return the bitmap with all flags. The function gets no parameters and
returns the bitmap in hexadecimal and decimal format.
- Example 1.33. get_gflags usage
-...
-$ kamctl fifo get_gflags
-0x3039
-12345
+ Example 1.33. cfgutils.get_gflags usage
...
-
-6. RPC Commands
-
- 6.1. cfgutils.set_gflag
- 6.2. cfgutils.reset_gflag
- 6.3. cfgutils.is_gflag
-
-6.1. cfgutils.set_gflag
-
- Set the value of some flags (specified by bitmask) to 1.
-
- The parameter value must be a bitmask in decimal or hexadecimal format.
- The bitmask has a 32 bit size.
-
- Example 1.34. cfgutils.set_gflag usage
-...
-$ kamctl cfgutils.set_gflag s:1
-...
-
-6.2. cfgutils.reset_gflag
-
- Reset the value of some flags to 0.
-
- Reset the value of some flags (specified by bitmask) to 1.
-
- The parameter value must be a bitmask in decimal or hexadecimal format.
- The bitmask has a 32 bit size.
-
- Example 1.35. cfgutils.reset_gflag usage
-...
-$ kamctl cfgutils.reset_gflag s:0x1
-...
-
-6.3. cfgutils.is_gflag
-
- Returns string "TRUE" if all the flags from the given set are set and
- "FALSE" if at least one is not set.
-
- The parameter value must be a bitmask in decimal or hexadecimal format.
- The bitmask has a 32 bit size.
-
- Example 1.36. cfgutils.is_gflag usage
-...
-$ kamctl cfgutils.set_gflag s:1024
-$ kamctl cfgutils.is_gflag s:1024
-TRUE
-$ kamctl cfgutils.is_gflag s:1023
-FALSE
-$ kamctl cfgutils.set_gflag s:0x7FFF
-$ kamctl cfgutils.is_gflag s:1023
-TRUE
+$ kamcmd cfgutils.get_gflags
...
-7. Exported pseudo-variables
+6. Exported pseudo-variables
- 7.1. $RANDOM
+ 6.1. $RANDOM
-7.1. $RANDOM
+6.1. $RANDOM
Returns a random value from the [0 - 2^31) range.
- Example 1.37. RANDOM pseudo-variable usage
+ Example 1.34. RANDOM pseudo-variable usage
...
if (rand_event()) {
$avp(i:10) = ($RANDOM / 16777216); # 2^24