← Volver al índice de módulos

cfgutils

Useful extensions for the server configuration. The cfgutils module can be used to introduce randomness to the behaviour of the server.
🔀 Enrutamiento y Proxy SIP Kamailio 6.1 8 parámetros 25 funciones

Descripción general

Useful extensions for the server configuration. The cfgutils module can be used to introduce randomness to the behaviour of the server. It provides setup functions and the “rand_event” function. This function return either true or false, depending on a random value and a specified probability. E.g. if you set via fifo or script a probability value of 5%, then 5% of all calls to rand_event will return true. The pseudovariable “$RANDOM” could be used to introduce random values e.g. into a SIP reply. The benefit of this module is the probability of the decision can be manipulated by external applications such as web interface or command line tools. The probability must be specified as percent value, ranging from 0 to 100. The module exports commands to FIFO server that can be used to change the global settings via FIFO interface. The FIFO commands are: “set_prob”, “reset_prob” and “get_prob”. This module can be used for simple load-shedding, e.g. reply 5% of the Invites with a 503 error and an adequate random Retry-After value. The module provides as well functions to delay the execution of the server. The functions “sleep” and “usleep” could be used to let the server wait a specific time interval. It can also hash the config file used from the server with a (weak) cryptographic hash function on startup. This value is saved and can be later compared to the actual hash, to detect modifications of this file after the server start. This functions are available as the FIFO commands

Documentación oficial: https://www.kamailio.org/docs/modules/stable/modules/cfgutils.html
Código fuente: https://github.com/kamailio/kamailio/tree/master/src/modules/cfgutils

Parámetros de configuración

ParámetroTipoDescripción
initial_probability string 3.2. hash_file (string) 3.3. initial_gflags (integer) 3.4. lock_set_size (integer)
hash_file string 3.3. initial_gflags (integer) 3.4. lock_set_size (integer)
initial_gflags integer 3.4. lock_set_size (integer)
lock_set_size integer 3.1. initial_probability (string)
initial_probability string The initial value of the probability.
hash_file string The config file name for that a hash value should be calculated on startup.
initial_gflags integer The initial value of global flags bitmap.
lock_set_size integer Size of lock set - the value is used as power of two to compute the size of lock array.

Funciones exportadas

rand_event()

4.2. rand_set_prob(probability) 4.3. rand_reset_prob() 4.4. rand_get_prob() 4.5. sleep(time) 4.6. usleep(time) 4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14

rand_set_prob(probability)

4.3. rand_reset_prob() 4.4. rand_get_prob() 4.5. sleep(time) 4.6. usleep(time) 4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key

rand_reset_prob()

4.4. rand_get_prob() 4.5. sleep(time) 4.6. usleep(time) 4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock

rand_get_prob()

4.5. sleep(time) 4.6. usleep(time) 4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17.

sleep(time)

4.6. usleep(time) 4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key

usleep(time)

4.7. abort() 4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_ro

abort()

4.8. pkg_status() 4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(ro

pkg_status()

4.9. pkg_summary() 4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_i

pkg_summary()

4.10. shm_status() 4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.2

shm_status()

4.11. shm_summary() 4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string

shm_summary()

4.12. set_gflag(flag) 4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

set_gflag(flag)

4.13. reset_gflag(flag) 4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

reset_gflag(flag)

4.14. is_gflag(flag) 4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

is_gflag(flag)

4.15. lock(key [, key2]) 4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

lock(key [, key2])

4.16. trylock(key [, key2]) 4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

trylock(key [, key2])

4.17. unlock(key [, key2]) 4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

unlock(key [, key2])

4.18. check_route_exists(route) 4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

check_route_exists(route)

4.19. route_if_exists(route) 4.20. core_hash(string1, string2, size)

route_if_exists(route)

4.20. core_hash(string1, string2, size)

core_hash(string1, string2, size)

4.1. rand_event()

rand_event()

Return true or false, depending on a random value and a probability value.

rand_event()

usage ... if (rand_event()) { append_to_reply("Retry-After: 120\n"); sl_send_reply("503", "Try later"); exit; }; # normal message processing follows ...

rand_set_prob(probability)

Set the “probability” of the decision.

rand_set_prob()

usage ... rand_set_prob("4"); ...

rand_reset_prob()

Reset the probability back to the initial value.

Autores y contribuidores

Henning Westerholt <henning.westerholt@1und1.de>Carsten BockBASIS AudioNet GmbHElena-Ramona Modroiu <ramona@rosdev.ro>Jiri Kuthan <jiri@iptel.org>Olle E. Johansson <oej@edvina.net>Juha Heinanen <jh@tutpro.com>Daniel-Constantin Mierla <miconda@gmail.com>

Copyright © 2014, 2013, 2007, 2008, 2004 Edvina AB, 1und1 Internet AG,

Módulos relacionados

acc acc_diameter acc_json acc_radius alias_db app_jsdt carrierroute cfgt