gflags module (global flags) keeps a bitmap of flags in shared memory and may be used to change behavior of server based on value of the flags. Example:
if (is_gflag("1")) {
t_relay("udp:10.0.0.1:5060");
} else {
t_relay("udp:10.0.0.2:5060");
}
The benefit of this module is the value of the switch flags can be manipulated by external applications such as web interface or command line tools. The size of bitmap is 32.
The module exports external commands that can be used to change the global flags via OpenSER Management Interface (MI). The MI commands are:
- set_gflag – set a global flag
- reset_gflag – reset a global flag
- is_gflag – test a global flag