This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:devel:pseudovariables [2018/03/21 15:13] miconda [$C(xy) - Foreground and background colors] |
cookbooks:devel:pseudovariables [2018/09/25 08:45] miconda [$redisd(key)] |
||
---|---|---|---|
Line 490: | Line 490: | ||
**$Rut** - local socket where the SIP messages was received in URI format, always with transport parameter. | **$Rut** - local socket where the SIP messages was received in URI format, always with transport parameter. | ||
+ | ==== $sas - Source address in socket format ==== | ||
+ | |||
+ | **$sas** - get source address in socket format (proto: | ||
==== $sbranch(attr) - Static Branch ==== | ==== $sbranch(attr) - Static Branch ==== | ||
Line 519: | Line 522: | ||
**$si** - reference to IP source address of the message - see also $siz | **$si** - reference to IP source address of the message - see also $siz | ||
+ | ==== $sid - Server ID ==== | ||
+ | |||
+ | **$sid** - the value for server id (server_id parameter) | ||
==== $siz - Source IP address ==== | ==== $siz - Source IP address ==== | ||
Line 748: | Line 754: | ||
**$(hdr(name)[N])** - represents the body of the N-th header identified by ' | **$(hdr(name)[N])** - represents the body of the N-th header identified by ' | ||
- | If [N] is omitted then the body of the first header is printed. The first header is got when N=0, for the second N=1, a.s.o. In case of a comma-separated multi-body headers, it returns all the bodies, comma-separated. To print the last header of that type, use -1, or other negative values to count from the end. No white spaces are allowed inside the specifier (before }, before or after {, [, ] symbols). When N=' | + | If [N] is omitted then the body of the first header is printed. The body of first header is returned |
+ | |||
+ | If name is *, then any header name is matched, e.g., $hdr(*) is body of first header, $(hdr(*)[-1]) is body of last header. | ||
The module should identify compact header names. It is recommended to use dedicated specifiers for headers (e.g., $ua for user agent header), if they are available -- they are faster. | The module should identify compact header names. It is recommended to use dedicated specifiers for headers (e.g., $ua for user agent header), if they are available -- they are faster. | ||
Line 1502: | Line 1510: | ||
* $nh(P) - transport protocol (upper case p) | * $nh(P) - transport protocol (upper case p) | ||
- | ===== GeoIP module Pseudo-Variables | + | ===== NDB_REDIS Module ===== |
+ | |||
+ | ==== $redis(res=> | ||
+ | |||
+ | Access the attributes of the Redis response. | ||
+ | |||
+ | The key can be: | ||
+ | |||
+ | * type - type of the reply (as in hiredis.h) | ||
+ | * value - the value returned by REDIS server; | ||
+ | * info - in case of error from REDIS, it will contain an info message. | ||
+ | |||
+ | If reply type is an array (as in hiredis.h), there are other keys available: | ||
+ | |||
+ | * size - returns number of elements in the array. | ||
+ | |||
+ | * type[n] - returns the type of the nth element in the array. type - returns array type. | ||
+ | |||
+ | * value[n] - returns value of the nth element. value - returns null for an array. You need to get each element by index. | ||
+ | |||
+ | In case one of the members of the array is also an array (for example calling SMEMBERS in a MULTI/EXEC transaction), | ||
+ | |||
+ | Example: | ||
+ | |||
+ | < | ||
+ | redis_cmd(" | ||
+ | xlog(" | ||
+ | </ | ||
+ | |||
+ | ==== $redisd(key) ==== | ||
+ | |||
+ | Return the corresponding value for various defines from hiredis library. | ||
+ | |||
+ | The key can be: | ||
+ | |||
+ | * rpl_str - return REDIS_REPLY_STRING | ||
+ | * rpl_arr - return REDIS_REPLY_ARRAY | ||
+ | * rpl_int - return REDIS_REPLY_INTEGER | ||
+ | * rpl_nil - return REDIS_REPLY_NIL | ||
+ | * rpl_sts - return REDIS_REPLY_STATUS | ||
+ | * rpl_err - return REDIS_REPLY_ERROR | ||
+ | |||
+ | $redisd(rpl_XYZ) can be compared with $redis(r=> | ||
+ | |||
+ | Example: | ||
+ | |||
+ | < | ||
+ | redis_cmd(" | ||
+ | if ($redis(r=> | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== GeoIP Module | ||
==== $gip(pvc=> | ==== $gip(pvc=> |