2
0
Эх сурвалжийг харах

cookbook files for release series 6.0.x

Daniel-Constantin Mierla 7 сар өмнө
parent
commit
d46fb6cf84

+ 5936 - 0
docs/cookbooks/6.0.x/core.md

@@ -0,0 +1,5936 @@
+# Core Cookbook
+
+Version: Kamailio SIP Server v6.0.x (stable)
+
+## Overview
+
+This tutorial collects the functions and parameters exported by Kamailio
+core to configuration file.
+
+**Note:** The parameters on this page are **NOT** in alphabetical order.
+
+## Structure
+
+The structure of the kamailio.cfg can be seen as three parts:
+
+- global parameters
+- modules settings
+- routing blocks
+
+For clarity and making it easy to maintain, it is recommended to keep
+them in this order, although some of them can be mixed.
+
+### Global Parameters Section
+
+This is the first part of the configuration file, containing the
+parameters for the core of kamailio and custom global parameters.
+
+Typically this is formed by directives of the form:
+
+``` c
+name=value
+```
+
+The name corresponds to a core parameter as listed in one of the next
+sections of this document. If a name is not matching a core parameter,
+then Kamailio will not start, rising an error during startup.
+
+The value is typically an integer, boolean or a string.
+
+Several parameters can get a complex value which is formed from a group
+of integer, strings or identifiers. For example, such parameter is
+**listen**, which can be assigned a value like **proto:ipaddress:port**.
+
+Example of content:
+
+``` c
+log_facility=LOG_LOCAL0
+
+children=4
+
+disable_tcp=yes
+
+alias="sip.mydomain.com"
+
+listen=udp:10.0.0.10:5060
+```
+
+Usually setting a parameter is ended by end of line, but it can be also
+ended with **;** (semicolon). This should be used when the grammar of a
+parameter allows values on multiple lines (like **listen** or **alias**)
+and the next line creates a conflict by being swallowed as part of value
+for previous parameter.
+
+``` c
+alias="sip.mydomain.com";
+```
+
+If you want to use a reserved config keyword as part of a parameter, you
+need to enclose it in quotes. See the example below for the keyword
+"dns".
+
+``` c
+listen=tcp:127.0.0.1:5060 advertise "sip.dns.example.com":5060
+```
+
+### Modules Settings Section
+
+This is the second section of the configuration file, containing the
+directives to load modules and set their parameters.
+
+It contains the directives **loadmodule** and **modparam**. In the
+default configuration file starts with the line setting the path to
+modules (the assignment to **mpath** core parameter.
+
+Example of content:
+
+``` c
+loadmodule "debugger.so"
+...
+modparam("debugger", "cfgtrace", 1)
+```
+
+### Routing Blocks Section
+
+This is the last section of the configuration file, typically the
+biggest one, containing the routing blocks with the routing logic for
+SIP traffic handled by Kamailio.
+
+The only mandatory routing block is **request_route**, which contains
+the actions for deciding the routing for SIP requests.
+
+See the chapter **Routing Blocks** in this document for more details
+about what types of routing blocks can be used in the configuration file
+and their role in routing SIP traffic and Kamailio behaviour.
+
+Example of content:
+
+``` c
+request_route {
+
+    # per request initial checks
+    route(REQINIT);
+
+    ...
+}
+
+branch_route[MANAGE_BRANCH] {
+    xdbg("new branch [$T_branch_idx] to $ru\n");
+    route(NATMANAGE);
+}
+```
+
+## Generic Elements
+
+### Comments
+
+Line comments start with `#` (hash/pound character - like in shell) or
+`//` (double forward slash - like in C++/Java).
+
+Block comments start with `/*` (forward slash and asterisk) and are ended
+by `*/` (asterisk and forward slash) (like in C, C++, Java).
+
+Example:
+
+``` c
+# this is a line comment
+
+// this is another line comment
+
+/* this
+    is
+    a
+    block
+    comment */
+```
+
+Important: be aware of preprocessor directives that start with `#!`
+(hash/pound and exclamation) - those are no longer line comments.
+
+### Values
+
+There are three types of values used for parameters, assignments, arithmetic
+or string expressions:
+
+- integer - numbers of 32bit size
+- boolean - aliases to `1` (`true`, `on`, `yes`) or `0` (`false`, `off`, `no`)
+- string - tokens enclosed in between double or single quotes
+
+Example:
+
+``` c
+// next two are strings
+
+  "this is a string value"
+  'this is another string value'
+
+// next is a boolean
+
+  yes
+
+// next is an integer
+
+  64
+
+```
+
+Note: be aware of specific rules for logical evaluation of expressions and
+return codes, see the docs for `IF` and `return`.
+
+### Identifiers
+
+Identifiers are tokens which are not enclosed in single or double quotes
+and to match the rules for integer or boolean values.
+
+For example, the identifiers are the core parameters and functions,
+module functions, core keywords and statements.
+
+Example:
+
+``` c
+return
+```
+
+### Variables
+
+The variables start with **$** (dollar character).
+
+You can see the list with available variables in the Pseudo-Variables
+Cookbook.
+
+Example:
+
+``` c
+$var(x) = $rU + "@" + $fd;
+```
+
+### Actions
+
+An action is an element used inside routing blocks ended by **;**
+(semicolon). It can be an execution of a function from core or a module,
+a conditional or loop statement, an assignment expression.
+
+Example:
+
+``` c
+  sl_send_reply("404", "Not found");
+  exit;
+```
+
+### Expressions
+
+An expression is an association group of statements, variables,
+functions and operators.
+
+Example:
+
+``` c
+if(!t_relay())
+
+if($var(x)>10)
+
+"sip:" + $var(prefix) + $rU + "@" + $rd
+```
+
+## Config Pre-Processor Directives
+
+Pre-processor directives are evaluated before building the execution
+tree (before 'understanding' configuration file content). They require an
+end-of-line (`\n`) after each one in order to be properly identified
+(e.g., `#!else\n`, `#!endif\n`).
+
+### include_file
+
+``` c
+include_file "path_to_file"
+```
+
+Include the content of the file in config before parsing. path_to_file
+must be a static string. Including file operation is done at startup. If
+you change the content of included file, you have to restart the SIP
+server to become effective.
+
+The path_to_file can be relative or absolute. If it is not absolute
+path, first attempt is to locate it relative to current directory, and
+if fails, relative to directory of the file that includes it. There is
+no restriction where include can be used or what can contain - any part
+of config file is ok. There is a limit of maximum 10 includes in depth,
+otherwise you can use as many includes as you want. Reporting of the cfg
+file syntax errors prints now the file name for easier troubleshooting.
+
+If the included file is not found, the config file parser throws error.
+You can find this error message at the logging destination, usually in
+the system logging (file).
+
+You can use also the syntax **#!include_file** or **!!include_file**.
+
+Example of usage:
+
+``` c
+request_route {
+    ...
+    include_file "/etc/kamailio/checks.cfg"
+    ...
+}
+```
+
+- `/etc/kamailio/checks.cfg`:
+
+```c
+
+   if (!mf_process_maxfwd_header("10")) {
+       sl_send_reply("483","Too Many Hops");
+       exit;
+   }
+```
+
+### import_file
+
+``` c
+import_file "path_to_file"
+```
+
+Similar to `include_file`, but does not throw error if the included
+file is not found.
+
+### define
+
+Control in C-style what parts of the config file are executed. The parts
+in non-defined zones are not loaded, ensuring lower memory usage and
+faster execution.
+
+Available directives:
+
+- `#!define NAME` - define a keyword
+- `#!define NAME VALUE` - define a keyword with value
+- `#!ifdef NAME` - check if a keyword is defined
+- `#!ifndef` - check if a keyword is not defined
+- `#!ifexp` - check if an expression is true (see corresponding section for more)
+- `#!else` - switch to false branch of `ifdef/ifndef/#!ifexp` region (needs `EoL`
+  after it to be detected)
+- `#!endif` - end `ifdef/ifndef/#!ifexp` region (needs `EoL` after it to be detected)
+- `#!trydef` - add a define if not already defined
+- `#!redefine` - force redefinition even if already defined
+
+Predefined keywords:
+
+- `KAMAILIO_X[_Y[_Z]]` - Kamailio versions
+- `MOD_X` - when module `X` has been loaded
+- `KAMAILIO_VERSION` - associated with a number representation of Kamailio
+     version (e.g., for version `X.Y.Z`, the value is `X00Y00Z`, representing
+    `X*1000000 + Y*1000 + Z`)
+- `OS_NAME` - associated with a string representing the Operating System name
+
+Examples:
+
+``` c
+KAMAILIO_5
+KAMAILIO_5_6
+KAMAILIO_5_6_2
+
+MOD_acc
+MOD_corex
+```
+
+See `kamctl rpc core.ppdefines_full` for full list.
+
+Among benefits:
+
+- easy way to enable/disable features (e.g., see default cfg --
+    controlling support of nat traversal, presence, etc...)
+- switch control for parts where conditional statements were not
+    possible (e.g., global parameters, module settings)
+- faster by not using conditional statements inside routing blocks
+    when switching between running environments
+
+Example: how to make config to be used in two environments, say testbed
+and production, controlled just by one define to switch between the two
+modes:
+
+``` c
+...
+
+#!define TESTBED_MODE
+
+#!ifdef TESTBED_MODE
+  debug=5
+  log_stderror=yes
+  listen=192.168.1.1
+#!else
+  debug=2
+  log_stderror=no
+  listen=10.0.0.1
+#!endif
+
+...
+
+#!ifdef TESTBED_MODE
+modparam("acc|auth_db|usrloc", "db_url",
+    "mysql://kamailio:kamailiorw@localhost/kamailio_testbed")
+#!else
+modparam("acc|auth_db|usrloc", "db_url",
+    "mysql://kamailio:[email protected]/kamailio_production")
+#!endif
+
+...
+
+#!ifdef TESTBED_MODE
+route[DEBUG] {
+  xlog("SCRIPT: SIP $rm from: $fu to: $ru - srcip: $si"\n);
+}
+#!endif
+
+...
+
+request_route {
+#!ifdef TESTBED_MODE
+  route(DEBUG);
+#!endif
+
+  ...
+}
+
+...
+```
+
+- you can define values for IDs
+
+``` c
+#!define MYINT 123
+#!define MYSTR "xyz"
+```
+
+- defined IDs are replaced at startup, during config parsing, e.g.,:
+
+``` c
+$var(x) = 100 + MYINT;
+```
+
+- is interpreted as:
+
+``` c
+$var(x) = 100 + 123;
+```
+
+- you can have multi-line defined IDs
+
+``` c
+#!define IDLOOP $var(i) = 0; \
+                while($var(i)<5) { \
+                    xlog("++++ $var(i)\n"); \
+                    $var(i) = $var(i) + 1; \
+                }
+```
+
+- then in routing block
+
+``` c
+request_route {
+    ...
+    IDLOOP
+    ...
+}
+```
+
+- number of allowed defines is now set to 256
+
+- notes:
+  * multilines defines are reduced to single line, so line counter
+    should be fine
+  * column counter goes inside the define value, but you have to
+    omit the `\` and `CR` for the accurate inside-define position
+  * text on the same line as the directive will cause problems. Keep
+    the directive lines clean and only comment on a line before or
+    after.
+
+### ifexp
+
+Evaluate an expression and if true, then enable first region, otherwise
+enable the `#!else` region (if it exists).
+
+The expression has to be till the end of the line (no support for multi-line yet).
+
+The evaluation is done using `snexpr` (which is embedded inside Kamailio code):
+
+- [https://github.com/miconda/snexpr](https://github.com/miconda/snexpr)
+
+Defined IDs can be used inside expressions with the following characteristics:
+
+- if there is an associated value, then the value is used as a string, with the
+enclosing quotes being removed
+- if there is no associated value, but the ID is defined, then the value `1`
+(integer) is used (equivalent of `true`)
+- if the ID is not defined, then the value `0` is used (equivalent of `false`)
+
+The result of an expression is evaluated to:
+
+- `true` if it is a number different than `0`
+- `false` if it is number `0`
+- `true` if it is a string with length greater than `0`
+- `false` if it is an empty string (length is `0`)
+
+Comparison operations between two strings are done using `strcmp(s1, s2)` and
+it is considered:
+
+- `s1 < s2` -  if the result of `strcmp(s1, s2)` is negative
+- `s1 == s2` -  if the result of `strcmp(s1, s2)` is `0`
+- `s1 > s2` -  if the result of `strcmp(s1, s2)` is positive
+
+Operations between two values with different types are done by converting
+the second value (right operand) to the type of the first value (left operand).
+
+Examples:
+
+``` c
+1 + "20" -> converted to: 1 + 20 (result: 21)
+```
+
+``` c
+"1" + 20 -> converted to: "1" + "20" (result: "120")
+```
+
+``` c
+4 > "20" -> converted to: 4 > 20 (result: false)
+```
+
+``` c
+"4" > 20 -> converted to: "4" > "20" (result: true)
+```
+
+#### Available Operators
+
+Arithmetic operations:
+
+- `+` - addition
+- `-` - subtraction
+- `*` - multiplication
+- `/` - division
+- `%` - modulus (remainder)
+- `**` - power
+
+Bitwise operations
+
+- `<<` - shift left
+- `>>` - shift right
+- `&` - and
+- `|` - or
+- `^` - xor (unary bitwise negation)
+
+Logical operations:
+
+- `==` - equal
+- `!=` - not equal (different)
+- `<` - less than
+- `>` - greater than
+- `<=` - less than or equal to
+- `>=` - greater than or equal to
+- `&&` - and
+- `||` - or
+- `!` - unary not
+
+String operations:
+
+- `+` - concatenation
+
+Other operations:
+
+- `=` - assignment
+- `( ... )` - parenthesis to group parts of the expression
+- `,` - comma (separates expressions or function parameters)
+
+#### ifexp examples
+
+``` c
+#!ifexp KAMAILIO_VERSION >= 5006000
+...
+#!else
+...
+#!endif
+
+
+#!ifexp MOD_xlog && (OS_NAME == "darwin")
+...
+#!endif
+
+
+#!define WITH_NAT
+#!define WITH_RTPENGINE
+
+#!ifexp WITH_NAT && WITH_RTPENGINE
+...
+#!endif
+
+
+#!ifexp WITH_RTPENGINE || WITH_RTPPROXY
+...
+#!endif
+```
+
+### defexp
+
+Preprocessor directive to define an ID to the value of an expression.
+
+``` c
+#!defenv ID STM
+```
+
+The evaluation of `STM` is done using `snexpr`, see the section for `#!ifexp`
+for more details about how the expression can be built, what data types and
+operators are supported.
+
+Examples:
+
+``` c
+#!define IPADDR 127.0.0.1
+
+#!defexp SIPURI "sip:" + IPADDR + ":5060"
+#!defexp QSIPURI '"sip:' + IPADDR + ':5060"'
+
+#!defexp V16 1<<4
+```
+
+### defexps
+
+Preprocessor directive similar to `#!defexp`, but the the result being enclosed
+in double quotes, suitable to be used for string values.
+
+### defenv
+
+Preprocessor directive to define an ID to the value of an environment
+variable with the name ENVVAR.
+
+``` c
+#!defenv ID=ENVVAR
+```
+
+It can also be just **$!defenv ENVVAR** and the defined ID is the ENVVAR
+name.
+
+Example:
+
+``` c
+#!defenv SHELL
+```
+
+If environment variable $SHELL is '/bin/bash', then it is like:
+
+``` c
+#!define SHELL /bin/bash
+```
+
+Full expression variant:
+
+``` c
+#!defenv ENVSHELL=SHELL
+```
+
+Then it is like:
+
+``` c
+#!define ENVSHELL /bin/bash
+```
+
+It is a simplified alternative of using **#!substdef** with
+**$env(NAME)** in the replacement part.
+
+### defenvs
+
+Similar to **#!defenv**, but the value is defined in between double
+quotes to make it convenient to be used as a string token.
+
+``` c
+#!defenvs ENVVAR
+#!defenvs ID=ENVVAR
+```
+
+### trydefenv
+
+``` c
+#!trydefenv ID=ENVVAR
+```
+
+Similar to **defenv**, but will not error if the environmental variable
+is not set. This allows for boolean defines via system ENVVARs. For
+example, using an environmental variable to toggle loading of db_mysql:
+
+``` c
+#!trydefenv WITH_MYSQL
+
+#!ifdef WITH_MYSQL
+loadmodule "db_mysql.so"
+#!ifdef
+```
+
+### trydefenvs
+
+Similar to **#!trydefenv**, but the value is defined in between double
+quotes to make it convenient to be used as a string token.
+
+``` c
+#!trydefenvs ENVVAR
+#!trydefenvs ID=ENVVAR
+```
+
+### subst
+
+- perform substitutions inside the strings of config (note that define
+    is replacing only IDs - alphanumeric tokens not enclosed in quotes)
+- `#!subst` offers an easy way to search and replace inside strings
+    before cfg parsing. E.g.,:
+
+``` c
+#!subst "/regexp/subst/flags"
+```
+
+- flags is optional and can be: 'i' - ignore case; 'g' - global
+    replacement
+
+Example:
+
+``` c
+#!subst "/DBPASSWD/xyz/"
+modparam("acc", "db_url", "mysql://user:DBPASSWD@localhost/db")
+```
+
+- will do the substitution of db password in db_url parameter value
+
+### substdef
+
+``` c
+#!substdef "/ID/subst/"
+```
+
+Similar to `#!subst`, but in addition it adds a `#!define ID subst`.
+
+### substdefs
+
+``` c
+#!substdefs "/ID/subst/"
+```
+
+Similar to `#!subst`, but in addition it adds a `#!define ID "subst"`
+(note the difference from `#!substdef` that the value for define is
+enclosed in double quotes, useful when the define is used in a place for
+a string value).
+
+## Core Keywords
+
+Keywords specific to SIP messages which can be used mainly in `if`
+expressions.
+
+### af
+
+The address family of the received SIP message. It is INET if the
+message was received over IPv4 or INET6 if the message was received over
+IPv6.
+
+Exampe of usage:
+
+``` c
+    if (af==INET6) {
+        log("Message received over IPv6 link\n");
+    }
+```
+
+### dst_ip
+
+The IP of the local interface where the SIP message was received. When
+the proxy listens on many network interfaces, makes possible to detect
+which was the one that received the packet.
+
+Example of usage:
+
+``` c
+   if(dst_ip==127.0.0.1) {
+      log("message received on loopback interface\n");
+   };
+```
+
+### dst_port
+
+The local port where the SIP packet was received. When Kamailio is
+listening on many ports, it is useful to learn which was the one that
+received the SIP packet.
+
+Example of usage:
+
+``` c
+   if(dst_port==5061)
+   {
+       log("message was received on port 5061\n");
+   };
+```
+
+### from_uri
+
+This script variable is a reference to the URI of 'From' header. It can
+be used to test 'From'- header URI value.
+
+Example of usage:
+
+``` c
+    if(is_method("INVITE") && from_uri=~".*@kamailio.org")
+    {
+        log("the caller is from kamailio.org\n");
+    };
+```
+
+### method
+
+The variable is a reference to the SIP method of the message.
+
+Example of usage:
+
+``` c
+    if(method=="REGISTER")
+    {
+       log("this SIP request is a REGISTER message\n");
+    };
+```
+
+### msg:len
+
+The variable is a reference to the size of the message. It can be used
+in 'if' constructs to test message's size.
+
+Example of usage:
+
+``` c
+    if(msg:len>2048)
+    {
+        sl_send_reply("413", "message too large");
+        exit;
+    };
+```
+
+.
+
+### proto
+
+This variable can be used to test the transport protocol of the SIP
+message.
+
+Example of usage:
+
+``` c
+    if(proto==UDP)
+    {
+        log("SIP message received over UDP\n");
+    };
+```
+
+### status
+
+If used in onreply_route, this variable is a referece to the status code
+of the reply. If it used in a standard route block, the variable is a
+reference to the status of the last reply sent out for the current
+request.
+
+Example of usage:
+
+``` c
+    if(status=="200")
+    {
+        log("this is a 200 OK reply\n");
+    };
+```
+
+### snd_af
+
+### snd_ip
+
+### snd_port
+
+### snd_proto
+
+### src_ip
+
+Reference to source IP address of the SIP message.
+
+Example of usage:
+
+``` c
+    if(src_ip==127.0.0.1)
+    {
+        log("the message was sent from localhost!\n");
+    };
+```
+
+### src_port
+
+Reference to source port of the SIP message (from which port the message
+was sent by previous hop).
+
+Example of usage:
+
+``` c
+    if(src_port==5061)
+    {
+        log("message sent from port 5061\n");
+    }
+```
+
+### to_ip
+
+### to_port
+
+### to_uri
+
+This variable can be used to test the value of URI from To header.
+
+Example of usage:
+
+``` c
+  if(to_uri=~"sip:[email protected]")
+  {
+      log("this is a request for kamailio.org users\n");
+  };
+```
+
+### uri
+
+This variable can be used to test the value of the request URI.
+
+Example of usage:
+
+``` c
+    if(uri=~"sip:[email protected]")
+    {
+        log("this is a request for kamailio.org users\n");
+    };
+```
+
+## Core Values
+
+Values that can be used in `'if`' expressions to check against Core
+Keywords
+
+### INET
+
+Variant: `IPv4`
+
+This keyword can be used to test whether the SIP packet was received
+over an IPv4 connection.
+
+Example of usage:
+
+``` c
+    if (af==INET) {
+        log("the SIP message was received over IPv4\n");
+    }
+```
+
+### INET6
+
+Variant: `IPv6`
+
+This keyword can be used to test whether the SIP packet was received
+over an IPv6 connection.
+
+Example of usage:
+
+``` c
+  if(af==INET6)
+  {
+      log("the SIP message was received over IPv6\n");
+  };
+```
+
+### SCTP
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over SCTP or not.
+
+Example of usage:
+
+``` c
+  if(proto==SCTP)
+  {
+      log("the SIP message was received over SCTP\n");
+  };
+```
+
+### TCP
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over TCP or not.
+
+Example of usage:
+
+``` c
+  if(proto==TCP)
+  {
+      log("the SIP message was received over TCP\n");
+  };
+```
+
+### TLS
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over TLS or not.
+
+Example of usage:
+
+``` c
+  if(proto==TLS)
+  {
+      log("the SIP message was received over TLS\n");
+  };
+```
+
+### UDP
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over UDP or not.
+
+Example of usage:
+
+``` c
+  if(proto==UDP)
+  {
+      log("the SIP message was received over UDP\n");
+  };
+```
+
+### WS
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over WS or not.
+
+Example of usage:
+
+``` c
+  if(proto==WS)
+  {
+      log("the SIP message was received over WS\n");
+  };
+```
+
+### WSS
+
+This keyword can be used to test the value of 'proto' and check whether
+the SIP packet was received over WSS or not.
+
+Example of usage:
+
+``` c
+  if(proto==WSS)
+  {
+      log("the SIP message was received over WSS\n");
+  };
+```
+
+### max_len
+
+Note: This command was removed.
+
+### myself
+
+This is a reference to the list of local IP addresses, hostnames and
+aliases that has been set in the Kamailio configuration file. This lists
+contain the domains served by Kamailio.
+
+The variable can be used to test if the host part of an URI is in the
+list. The usefulness of this test is to select the messages that has to
+be processed locally or has to be forwarded to another server.
+
+See "alias" to add hostnames, IP addresses and aliases to the list.
+
+Example of usage:
+
+``` c
+    if(uri==myself) {
+        log("the request is for local processing\n");
+    };
+```
+
+Note: You can also use the is_myself() function.
+
+## Core parameters
+
+### advertised_address
+
+It can be an IP address or string and represents the address advertised
+in Via header. If empty or not set (default value) the socket address
+from where the request will be sent is used.
+
+    WARNING:
+    - don't set it unless you know what you are doing (e.g. nat traversal)
+    - you can set anything here, no check is made (e.g. foo.bar will be accepted even if foo.bar doesn't exist)
+
+Example of usage:
+
+``` c
+advertised_address="​1.2.3.4"​
+advertised_address="kamailio.org"
+```
+
+Note: this option may be deprecated and removed in the near future, it
+is recommended to set **advertise** option for **listen** parameter.
+
+### advertised_port
+
+The port advertised in Via header. If empty or not set (default value)
+the port from where the message will be sent is used. Same warnings as
+for 'advertised_address'.
+
+Example of usage:
+
+``` c
+advertised_port=5080
+```
+
+Note: this option may be deprecated and removed in the near future, it
+is recommended to set **advertise** option for **listen** parameter.
+
+### alias
+
+**Alias name:** **domain**
+
+Parameter to set alias hostnames for the server. It can be set many
+times, each value being added in a list to match the hostname when
+'myself' is checked.
+
+It is necessary to include the port (the port value used in the "port="
+or "listen=" defintions) in the alias definition otherwise the
+loose_route() function will not work as expected for local forwards.
+Even if you do not use 'myself' explicitly (for example if you use the
+domain module), it is often necessary to set the alias as these aliases
+are used by the loose_routing function and might be needed to handle
+requests with pre-loaded route set correctly.
+
+Example of usage:
+
+``` c
+alias=other.domain.com:5060
+alias=another.domain.com:5060
+
+domain=new.domain.com:5060
+```
+
+Note: the hostname has to be enclosed in between quotes if it has
+reserved tokens such as **forward**, **drop** ... or operators such as
+**-** (minus) ...
+
+### async_workers
+
+Specify how many child processes (workers) to create for asynchronous
+execution in the group "default". These are processes that can receive
+tasks from various components (e.g, modules such as async, acc, sqlops)
+and execute them locally, which is different process than the task
+sender.
+
+Default: 0 (asynchronous framework is disabled).
+
+Example:
+
+``` c
+async_workers=4
+```
+
+### async_nonblock
+
+Set the non-block mode for the internal sockets used by default group of
+async workers.
+
+Default: `0`
+
+Example:
+
+``` c
+async_nonblock=1
+```
+
+### async_usleep
+
+Set the number of microseconds to sleep before trying to receive next
+task (can be useful when async_nonblock=1).
+
+Default: `0`
+
+Example:
+
+``` c
+async_usleep=100
+```
+
+### async_workers_group
+
+Define groups of asynchronous worker processes.
+
+Prototype:
+
+``` c
+async_workers_group="name=X;workers=N;nonblock=[0|1];usleep=M"
+```
+
+The attributes are:
+
+- **name** - the group name (used by functions such as
+    **sworker_task(name)**)
+- **workers** - the number of processes to create for this group
+- **nonblock** - set or not set the non-block flag for internal
+    communication socket
+- **usleep** - the number of microseconds to sleep before trying to
+    receive next task (can be useful if nonblock=1)
+
+Default: "".
+
+Example:
+
+``` c
+async_workers_group="name=reg;workers=4;nonblock=0;usleep=0"
+```
+
+If the **name** is default, then it overwrites the value set by
+**async_workers**.
+
+See also `event_route[core:pre-routing]` and `sworker` module.
+
+### async_tkv_evcb
+
+Set the name of the event route or KEMI callback for processing tkv.
+
+Default: `` (empty string)
+
+Example:
+
+``` c
+async_tkv_evcb = "core:tkv"
+...
+async_tkv_evcb = "ksr_core_tkv"
+```
+
+### async_tkv_gname
+
+Set the name of the async group to be used for processing TKV events. The
+async group has to be defined.
+
+Default: `` (empty string)
+
+Example:
+
+``` c
+async_workers_group="name=tkv;workers=1;nonblock=0;usleep=0"
+
+async_tkv_gname = "tkv"
+```
+
+### auto_aliases
+
+**Alias name:** **auto_domains**
+
+Kamailio by default discovers all IPv4 addresses on all interfaces and
+does a reverse DNS lookup on these addresses to find host names.
+Discovered host names are added to aliases list, matching the **myself**
+condition. To disable host names auto-discovery, turn off auto_aliases.
+
+Example:
+
+``` c
+auto_aliases=no
+
+auto_domains=no
+```
+
+### auto_bind_ipv6
+
+When turned on, Kamailio will automatically bind to all IPv6 addresses
+(much like the default behaviour for IPv4).
+
+Default is `0`.
+
+Example:
+
+``` c
+auto_bind_ipv6=1
+```
+
+### bind_ipv6_link_local
+
+If set to `1`, try to bind also IPv6 link local addresses by discovering
+the scope of the interface. If set to `2`, skip binding link local addresses.
+
+Note: for UDP sockets by first implementation, to be added for the other protocols.
+
+Default is `0`.
+
+Example:
+
+``` c
+bind_ipv6_link_local=1
+```
+
+### check_via
+
+Check if the address in top most via of replies is local. Default value
+is 0 (check disabled).
+
+Example of usage:
+
+``` c
+check_via=1
+```
+
+### children
+
+Number of children to fork for the UDP interfaces (one set for each
+interface - ip:port). Default value is 8. For example if you configure
+the proxy to listen on 3 UDP ports, it will create 3xchildren processes
+which handle the incoming UDP messages.
+
+For configuration of the TCP/TLS worker threads see the option
+"tcp_children".
+
+Example of usage:
+
+``` c
+children=16
+```
+
+### chroot
+
+The value must be a valid path in the system. If set, Kamailio will
+chroot (change root directory) to its value.
+
+Example of usage:
+
+``` c
+chroot=/other/fakeroot
+```
+
+### corelog
+
+Set the debug level used to print some log messages from core, which
+might become annoying and don't represent critical errors. For example,
+such case is failure to parse incoming traffic from the network as SIP
+message, due to someone sending invalid content.
+
+Default value is `-1` (`L_ERR`).
+
+Example of usage:
+
+``` c
+corelog=1
+```
+
+### debug
+
+Set the debug level. Higher values make Kamailio to print more debug
+messages. Log messages are usually sent to syslog, except if logging to
+stderr was activated (see [#log_stderror](#log_stderror) parameter).
+
+The following log levels are defined:
+
+``` c
+L_ALERT     -5
+L_BUG       -4
+L_CRIT2     -3
+L_CRIT      -2
+L_ERR       -1
+L_WARN       0
+L_NOTICE     1
+L_INFO       2
+L_DBG        3
+```
+
+A log message will be logged if its log-level is lower than the defined
+debug level. Log messages are either produced by the the code, or
+manually in the configuration script using log() or xlog() functions.
+For a production server you usually use a log value between -1 and 2.
+
+Default value: `L_WARN` (`debug=0`)
+
+Examples of usage:
+
+- debug=3: print all log messages. This is only useful for debugging
+    of problems. Note: this produces a lot of data and therefore should
+    not be used on production servers (on a busy server this can easily
+    fill up your hard disk with log messages)
+- debug=0: This will only log warning, errors and more critical
+    messages.
+- debug=-6: This will disable all log messages.
+
+Value of 'debug' parameter can also be obtained and set dynamically using the
+'debug' Core MI function or the RPC function, e.g.:
+
+``` bash
+kamcmd cfg.get core debug
+kamcmd cfg.set_now_int core debug 2
+kamcmd cfg.set_now_int core debug -- -1
+```
+
+Note: There is a difference in log-levels between Kamailio 3.x and
+Kamailio\<=1.5: Up to Kamailio 1.5 the log level started with 4, whereas
+in Kamailio>=3 the log level starts with 3. Thus, if you were using
+debug=3 in older Kamailio, now use debug=2.
+
+For configuration of logging of the memory manager see the parameters
+[#memlog](#memlog) and [#memdbg](#memdbg).
+
+Further information can also be found at:
+
+- [https://www.kamailio.org/wiki/tutorials/3.2.x/syslog](https://www.kamailio.org/wiki/tutorials/3.2.x/syslog)
+
+### description
+
+**Alias name:** **descr desc**
+
+This is a keyword that can be used when declaring custom global parameters to
+specify their text description. See the section `Custom Global Parameters`.
+
+### disable_core_dump
+
+Can be 'yes' or 'no'. By default core dump limits are set to unlimited
+or a high enough value. Set this config variable to 'yes' to disable
+core dump-ing (will set core limits to 0).
+
+Default value is `no`.
+
+Example of usage:
+
+``` c
+disable_core_dump=yes
+```
+
+### disable_tls
+
+**Alias name:** **tls_disable**
+
+Global parameter to disable TLS support in the SIP server. Default value
+is 'yes'.
+
+Note: Make sure to load the "tls" module to get tls functionality.
+
+Example of usage:
+
+``` c
+disable_tls=yes
+```
+
+In Kamailio TLS is implemented as a module. Thus, the TLS configuration
+is done as module configuration. For more details see the README of the
+TLS module: <http://kamailio.org/docs/modules/devel/modules/tls.html>
+
+### enable_tls
+
+**Alias name:** **tls_enable**
+
+Reverse Meaning of the disable_tls parameter. See disable_tls parameter.
+
+``` c
+enable_tls=yes # enable tls support in core
+```
+
+### exit_timeout
+
+**Alias name:** **ser_kill_timeout**
+
+How much time Kamailio will wait for all the shutdown procedures to
+complete. If this time is exceeded, all the remaining processes are
+immediately killed and Kamailio exits immediately (it might also
+generate a core dump if the cleanup part takes too long).
+
+Default: 60 s. Use 0 to disable.
+
+``` c
+exit_timeout = seconds
+```
+
+### flags
+
+SIP message (transaction) flags can have string names. The *name* for
+flags cannot be used for **branch** or **script flags**(\*)
+
+``` c
+...
+flags
+  FLAG_ONE   : 1,
+  FLAG_TWO   : 2;
+...
+```
+
+- NOTE: The named flags feature was propagated from the source code merge
+  back in 2008 and is not extensively tested. The recommended way of
+  defining flags is using [#!define](core.md#define) (which
+  is also valid for branch/script flags):
+
+``` c
+#!define FLAG_NAME FLAG_BIT
+```
+
+### force_rport
+
+Value: `yes`/`no` (default `no`)
+
+Similar to the force_rport() function, but activates symmetric response routing
+globally.
+
+### fork
+
+If set to 'yes' the proxy will fork and run in daemon mode - one process
+will be created for each network interface the proxy listens to and for
+each protocol (TCP/UDP), multiplied with the value of 'children'
+parameter.
+
+When set to 'no', the proxy will stay bound to the terminal and runs as
+single process. First interface is used for listening to. This is
+equivalent to setting the server option "-F".
+
+Default value is 'yes'.
+
+Example of usage:
+
+``` c
+fork=no
+```
+
+### fork_delay
+
+Number of usecs to wait before forking a process.
+
+Default is 0 (don't wait).
+
+Example of usage:
+
+``` c
+fork_delay=5000
+```
+
+### group
+
+**Alias name:** **gid**
+
+The group id to run Kamailio.
+
+Example of usage:
+
+``` c
+group="kamailio"
+```
+
+### http_reply_parse
+
+Alias: http_reply_hack
+
+When enabled, Kamailio can parse HTTP replies, but does so by treating
+them as SIP replies. When not enabled HTTP replies cannot be parsed.
+This was previously a compile-time option, now it is run-time.
+
+Default value is 'no'.
+
+Example of usage:
+
+``` c
+http_reply_parse=yes
+```
+
+### ip_free_bind
+
+Alias: ipfreebind, ip_nonlocal_bind
+
+Control if Kamailio should attempt to bind to non local ip. This option
+is the per-socket equivalent of the system **ip_nonlocal_bind**.
+
+Default is 0 (do not bind to non local ip).
+
+Example of usage:
+
+``` c
+  ip_free_bind = 1
+```
+
+### ipv6_hex_style
+
+Can be set to `a`, `A` or `c` to specify if locally computed string
+representation of IPv6 addresses should be expanded lowercase, expanded
+uppercase or compacted lowercase hexa digits.
+
+Default is `c` (compacted lower hexa digits, conforming better with RFC
+5952).
+
+`A` is preserving the behaviour before this global parameter was
+introduced, while `a` enables the ability to follow some of the
+recommendations of RFC 5952, section 4.3.
+
+Example of usage:
+
+``` c
+  ipv6_hex_style = "a"
+```
+
+### kemi.onsend_route_callback
+
+Set the name of callback function in the KEMI script to be executed as
+the equivalent of `onsend_route` block (from the native configuration
+file).
+
+Default value: ksr_onsend_route
+
+Set it to empty string or `none` to skip execution of this callback
+function.
+
+Example:
+
+``` c
+kemi.onsend_route_callback="ksr_my_onsend_route"
+```
+
+### kemi.received_route_callback
+
+Set the name of callback function in the KEMI script to be executed as
+the equivalent of `event_route[core:msg-received]` block (from the
+native configuration file). For execution, it also require to have the
+received_route_mode global parameter set to 1.
+
+Default value: `none`
+
+Set it to empty string or `none` to skip execution of this callback
+function.
+
+Example:
+
+``` c
+kemi.received_route_callback="ksr_my_receieved_route"
+```
+
+### kemi.reply_route_callback
+
+Set the name of callback function in the KEMI script to be executed as
+the equivalent of `reply_route` block (from the native configuration
+file).
+
+Default value: `ksr_reply_route`
+
+Set it to empty string or `none` to skip execution of this callback
+function.
+
+Example:
+
+``` c
+kemi.reply_route_callback="ksr_my_reply_route"
+```
+
+### kemi.pre_routing_callback
+
+Set the name of callback function in the KEMI script to be executed as
+the equivalent of `event_route[core:pre-routing]` block (from the
+native configuration file).
+
+Default value: `none`
+
+Set it to empty string or `none` to skip execution of this callback
+function.
+
+Example:
+
+``` c
+kemi.pre_routing_callback="ksr_pre_routing"
+```
+
+### latency_cfg_log
+
+If set to a log level less or equal than debug parameter, a log message
+with the duration in microseconds of executing request route or reply
+route is printed to syslog.
+
+Default value is `3` (`L_DBG`).
+
+Example:
+
+``` c
+latency_cfg_log=2
+```
+
+### latency_limit_action
+
+Limit of latency in us (micro-seconds) for config actions. If a config
+action executed by cfg interpreter takes longer than its value, a
+message is printed in the logs, showing config path, line and action
+name when it is a module function, as well as internal action id.
+
+Default value is `0` (disabled).
+
+``` c
+latency_limit_action=`500`
+```
+
+### latency_limit_db
+
+Limit of latency in us (micro-seconds) for db operations. If a db
+operation executed via DB API v1 takes longer that its value, a message
+is printed in the logs, showing the first 50 characters of the db query.
+
+Default value is `0` (disabled).
+
+``` c
+latency_limit_db=`500`
+```
+
+### latency_log
+
+Log level to print the messages related to latency.
+
+Default value is `-1` (`L_ERR`).
+
+``` c
+latency_log=3
+```
+
+### listen
+
+Set the network addresses the SIP server should listen to. It can be an
+`IP address`, `hostname` or `network interface id` or combination of
+`protocol:address:port` (e.g., `udp:10.10.10.10:5060`). This parameter can
+be set multiple times in same configuration file, the server is listening
+on all addresses specified.
+
+Example of usage:
+
+``` c
+    listen=10.10.10.10
+    listen=eth1:5062
+    listen=udp:10.10.10.10:5064
+```
+
+If you omit this directive then the SIP server will listen on all network
+interfaces. On start the SIP server reports all the interfaces that it
+is listening on. Even if you specify only UDP interfaces here, the
+server will start the TCP engine too. If you don't want this, you need
+to disable the TCP support completely with the core parameter
+`disable_tcp`.
+
+If you specify IPv6 addresses, you should put them into square brackets,
+e.g.:
+
+``` c
+    listen=udp:[2a02:1850:1:1::18]:5060
+```
+
+You can specify an advertise address (like `ip:port`) per listening socket, it
+will be used to build the SIP headers such as Via and Record-Route:
+
+``` c
+    listen=udp:10.10.10.10:5060 advertise 11.11.11.11:5060
+```
+
+The advertise address must be in the format `address:port`, the protocol is
+taken from the bind socket. The advertise address is a convenient
+alternative to `advertised_address` / `advertised_port` config parameters or
+`set_advertised_address()` / `set_advertised_port()` config functions.
+
+A typical use case for advertise address is when running SIP server
+behind a NAT/Firewall, when the local IP address (to be used for bind)
+is different than the public IP address (to be used for advertising).
+
+A unique name can be set for sockets to simplify the selection of the
+socket for sending out. For example, the rr and path modules can use the
+socket name to advertise it in header URI parameter and use it as a
+shortcut to select the corresponding socket for routing subsequent
+requests.
+
+The name has to be provided as a string enclosed in between quotes after
+the `name` keyword.
+
+``` c
+    listen=udp:10.0.0.10:5060 name "s1"
+    listen=udp:10.10.10.10:5060 advertise 11.11.11.11:5060 name "s2"
+    listen=udp:10.10.10.20:5060 advertise "mysipdomain.com" name "s3"
+    listen=udp:10.10.10.30:5060 advertise "mysipdomain.com" name "s4"
+    ...
+    $fsn = "s4";
+    t_relay();
+```
+
+Note that there is no internal check for uniqueness of the socket names,
+the admin has to ensure it in order to be sure the desired socket is
+selected, otherwise the first socket with a matching name is used.
+
+As of 5.6, there is now a `virtual` keyword which can be added to
+the end of each listen directive. This can be used in combination with
+any other keyword, but must be added at the end of the line.
+
+``` c
+    listen=udp:10.1.1.1:5060 virtual
+    listen=udp:10.0.0.10:5060 name "s1" virtual
+    listen=udp:10.10.10.10:5060 advertise 11.11.11.11:5060 virtual
+    listen=udp:10.10.10.20:5060 advertise "mysipdomain.com" name "s3" virtual
+```
+
+The `virtual` keyword is meant for use in situations where you have
+a floating/virtual IP address on your system that may not always be
+active on the system. It is particularly useful for active/active
+virtual IP situations, where otherwise things like usrloc PATH support
+can break due to incorrect `check_self` results.
+
+This identifier will change the behaviour of how `myself`, `is_myself()`
+or `check_self` matches against traffic destined to this IP address. By
+default, Kamailio always considers traffic destined to a listen IP as
+`local` regardless of if the IP is currently locally active. With this
+flag set, Kamailio will do an extra check to make sure the IP is
+currently a local IP address before considering the traffic as local.
+
+This means that if Kamailio is listening on an IP that is not currently
+local, it will recognise that, and can relay the traffic to another
+Kamailio node as needed, instead of thinking it always needs to handle
+the traffic.
+
+### loadmodule
+
+Loads a module for later usage in the configuration script. The module
+is searched in the path specified by `loadpath` (or `mpath`).
+
+Prototypes:
+
+- `loadmodule "modulepath"`
+- `loadmodule("modulepath")`
+- `loadmodule("modulepath", "opts")`
+
+If `modulepath` is only `modulename` or `modulename.so`, then Kamailio will
+try to search also for `modulename/modulename.so`, very useful when
+using directly the version compiled in the source tree.
+
+The `opts` parameter is a list of characters that can specify loading options.
+They can be:
+
+- `g` (or `G`) - open the module shared object file with `RTLD_GLOBAL` set,
+  which can be used for modules related to external scripting languages to avoid
+  reloading.
+
+Example of usage:
+
+``` c
+    loadpath "/usr/local/lib/kamailio/:usr/local/lib/kamailio/modules/"
+
+    loadmodule "/usr/local/lib/kamailio/modules/db_mysql.so"
+    loadmodule "modules/usrloc.so"
+    loadmodule "tm"
+    loadmodule "dialplan.so"
+    loadmodule("app_lua.so", "g")
+```
+
+### loadmodulex
+
+Similar to `loadmodule` with the ability to evaluate variables in its
+parameter.
+
+### loadpath
+
+**Alias name:** `mpath`
+
+Set the module search path. `loadpath` takes a list of directories
+separated by `:`. The list is searched in-order. For each directory `d`,
+`$d/${module_name}.so` and `$d/${module_name}/${module_name}.so` are tried.
+
+This can be used to simplify the loadmodule parameter and can include
+many paths separated by colon. First module found is used.
+
+Example of usage:
+
+``` c
+    loadpath "/usr/local/lib/kamailio/modules:/usr/local/lib/kamailio/mymodules"
+
+    loadmodule "mysql"
+    loadmodule "uri"
+    loadmodule "uri_db"
+    loadmodule "sl"
+    loadmodule "tm"
+```
+
+The proxy tries to find the modules in a smart way, e.g: `loadmodule "uri"`
+tries to find `uri.so` in the loadpath, but also `uri/uri.so`.
+
+### local_rport
+
+Similar to **add_local_rport()** function, but done in a global scope,
+so the function does not have to be executed for each request.
+
+Default: off
+
+Example:
+
+``` c
+local_rport = on
+```
+
+### log_engine_data
+
+Set specific data required by the log engine. See also the
+**log_engine_type**.
+
+``` c
+log_engine_type="udp"
+log_engine_data="127.0.0.1:9"
+```
+
+### log_engine_type
+
+Specify what logging engine to be used and its initialization data. A
+logging engine is implemented as a module. Supported values are a matter
+of the module.
+
+For example, see the readme of **log_custom** module for more details.
+
+``` c
+log_engine_type="udp"
+log_engine_data="127.0.0.1:9"
+```
+
+### log_facility
+
+If Kamailio logs to syslog, you can control the facility for logging.
+Very useful when you want to divert all Kamailio logs to a different log
+file. See the man page syslog(3) for more details.
+
+For more see:
+
+- [https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages](https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages)
+
+Default value is LOG_DAEMON.
+
+Example of usage:
+
+``` c
+log_facility=LOG_LOCAL0
+```
+
+### log_name
+
+Allows to configure a log_name prefix which will be used when printing
+to syslog -- it is also known as syslog tag, and the default value is
+the application name or full path that printed the log message. This is
+useful to filter log messages when running many instances of Kamailio on
+same server.
+
+``` c
+log_name="kamailio-proxy-5080"
+```
+
+### log_prefix
+
+Specify the text to be prefixed to the log messages printed by Kamailio
+while processing a SIP message (that is, when executing route blocks).
+It can contain script variables that are evaluated at runtime. See
+[#log_prefix_mode](#log_prefix_mode) about when/how evaluation is done.
+
+If a log message is printed from a part of the code executed out of
+routing blocks actions (e.g., can be timer, evapi worker process, ...),
+there is no log prefix set, because this one requires a valid SIP
+message structure to work with.
+
+Example - prefix with message type (1 - request, 2 - response), CSeq and
+Call-ID:
+
+``` c
+log_prefix="{$mt $hdr(CSeq) $ci} "
+```
+
+### log_prefix_mode
+
+Control if [log prefix](#log_prefix) is re-evaluated.
+
+If set to 0 (default), then log prefix is evaluated when the sip message
+is received and then reused (recommended if the **log_prefix** has only
+variables that have same value for same message). This is the current
+behaviour of **log_prefix** evaluation.
+
+If set to 1, then the log prefix is evaluated before/after each config
+action (needs to be set when the **log_prefix** has variables that are
+different based on the context of config execution, e.g., $cfg(line)).
+
+Example:
+
+``` c
+log_prefix_mode=1
+```
+
+### log_stderror
+
+With this parameter you can make Kamailio to write log and debug
+messages to standard error. Possible values are:
+
+- `yes` - write the messages to standard error
+- `no` - write the messages to syslog
+
+Default value is `no`.
+
+For more see:
+
+- [https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages](https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages)
+
+Example of usage:
+
+``` c
+log_stderror=yes
+```
+
+### cfgengine
+
+Set the config interpreter engine for execution of the routing logic
+inside the configuration file. Default is the native interpreter.
+
+Example of usage:
+
+``` c
+cfgengine="name"
+cfgengine "name"
+```
+
+If name is `native` or `default`, it expects to have in native config
+interpreter for routing logic.
+
+The name can be the identifier of an embedded language interpreter, such
+as `lua` which is registered by the `app_lua` module:
+
+``` c
+cfgengine "lua"
+```
+
+### maxbuffer
+
+The size in bytes multiplied by 2 not to be exceeded during the auto-probing
+procedure of discovering and increasing the maximum OS buffer size for receiving
+UDP messages (socket option SO_RCVBUF). Default value is 262144.
+
+Example of usage:
+
+``` c
+maxbuffer=65536
+```
+
+Note: it is not the size of the internal SIP message receive buffer.
+
+### maxsndbuffer
+
+The size in bytes multiplied by 2 not to be exceeded during the auto-probing
+procedure of discovering and increasing the maximum OS buffer size for sending
+UDP messages (socket option SO_SNDBUF). Default value is 262144.
+
+Example of usage:
+
+``` c
+maxsndbuffer=65536
+```
+
+### max_branches
+
+The maximum number of outgoing branches for each SIP request. It has
+impact on the size of destination set created in core (e.g., via
+append_branch()) as well as the serial and parallel forking done via tm
+module. It replaces the old defined constant MAX_BRANCHES.
+
+The value has to be at least 1 and the upper limit is 30.
+
+Default value: 12
+
+Example of usage:
+
+``` c
+max_branches=16
+```
+
+### max_recursive_level
+
+The parameters set the value of maximum recursive calls to blocks of
+actions, such as sub-routes or chained IF-ELSE (for the ELSE branches).
+Default is 256.
+
+Example of usage:
+
+``` c
+max_recursive_level=500
+```
+
+### max_while_loops
+
+The parameters set the value of maximum loops that can be done within a
+"while". Comes as a protection to avoid infinite loops in config file
+execution. Default is 100. Setting to 0 disables the protection (you
+will still get a warning when you start Kamailio if you do something
+like while(1) {...}).
+
+Example of usage:
+
+``` c
+max_while_loops=200
+```
+
+### mcast
+
+This parameter can be used to set the interface that should join the
+multicast group. This is useful if you want to **listen** on a multicast
+address and don't want to depend on the kernel routing table for
+choosing an interface.
+
+The parameter is reset after each **listen** parameter, so you can join
+the right multicast group on each interface without having to modify
+kernel routing beforehand.
+
+Example of usage:
+
+``` c
+mcast="eth1"
+listen=udp:224.0.1.75:5060
+```
+
+### mcast_loopback
+
+It can be 'yes' or 'no'. If set to 'yes', multicast datagram are sent
+over loopback. Default value is 'no'.
+
+Example of usage:
+
+``` c
+mcast_loopback=yes
+```
+
+### mcast_ttl
+
+Set the value for multicast ttl. Default value is OS specific (usually
+1).
+
+Example of usage:
+
+``` c
+mcast_ttl=32
+```
+
+### memdbg
+
+**Alias name:** `mem_dbg`
+
+This parameter specifies on which log level the memory debugger messages
+will be logged. If memdbg is active, every request (alloc, free) to the
+memory manager will be logged. (Note: if compile option NO_DEBUG is
+specified, there will never be logging from the memory manager).
+
+Default value: L_DBG (memdbg=3)
+
+For example, memdbg=2 means that memory debugging is activated if the
+debug level is 2 or higher.
+
+``` c
+debug=3    # no memory debugging as debug level
+memdbg=4   # is lower than memdbg
+
+debug=3    # memory debugging is active as the debug level
+memdbg=2   # is higher or equal memdbg
+```
+
+Please see also [#memlog](#memlog) and [#debug](#debug).
+
+### memlog
+
+**Alias name:** `mem_log`
+
+This parameter specifies on which log level the memory statistics will
+be logged. If memlog is active, Kamailio will log memory statistics on
+shutdown (or if requested via signal SIGUSR1). This can be useful for
+debugging of memory leaks.
+
+Default value: L_DBG (memlog=3)
+
+For example, memlog=2 means that memory statistics dumping is activated
+if the debug level is 2 or higher.
+
+``` c
+debug=3    # no memory statistics as debug level
+memlog=4   # is lower than memlog
+
+debug=3    # dumping of memory statistics is active as the
+memlog=2   # debug level is higher or equal memlog
+```
+
+Please see also [#memdbg](#memdbg) and [#debug](#debug).
+
+### mem_add_size
+
+Size in bytes to be added for each chunk allocated by the internal `qm` (quick malloc) memory manager.
+It could be useful in cases when external libraries initialized to use `qm` expose issues of buffer
+overflow.
+
+It can be set via config reload framework.
+
+Default is 0.
+
+``` c
+mem_add_size=4
+```
+
+### mem_join
+
+If set to 1, memory manager (e.g., q_malloc) does join of free fragments.
+It is effective if MEM_JOIN_FREE compile option is defined.
+
+It can be set via config reload framework.
+
+Default is 1 (enabled).
+
+``` c
+mem_join=1
+```
+
+To change its value at runtime, **kamcmd** needs to be used and the
+modules **ctl** and **cfg_rpc** loaded. Enabling it can be done with:
+
+``` bash
+kamctl rpc cfg.set_now_int core mem_join 1
+```
+
+To disable, set its value to 0.
+
+### mem_safety
+
+If set to `1`, memory free operation does not call `abort()` for double
+freeing a pointer or freeing an invalid address. The server still prints
+the alerting log messages. If set to 0, the SIP server stops by calling
+`abort()` to generate a core file.
+
+It can be set via config reload framework.
+
+Default is `1` (enabled).
+
+``` c
+mem_safety=0
+```
+
+### mem_status_mode
+
+If set to `1`, memory status dump for `qm` allocator will print details
+about used fragments. If set to `0`, the dump contains only free
+fragments. It can be set at runtime via cfg param framework (e.g., via
+`kamcmd`).
+
+Default is `0`.
+
+``` c
+mem_status_mode=1
+```
+
+### mem_summary
+
+Parameter to control printing of memory debugging information displayed
+on `exit` or `SIGUSR1`. The value can be composed by following flags:
+
+- `1` - dump all the pkg used blocks (status)
+- `2` - dump all the shm used blocks (status)
+- `4` - summary of pkg used blocks
+- `8` - summary of shm used blocks
+- `16` - short status
+
+If set to `0`, nothing is printed.
+
+Default value: `12`
+
+Example:
+
+``` c
+mem_summary=15
+```
+
+### mhomed
+
+Set the server to try to locate outbound interface on multihomed host.
+This parameter affects the selection of the outgoing socket for
+forwarding requests. By default is off (0) - it is rather time
+consuming. When deactivated, the incoming socket will be used or the
+first one for a different protocol, disregarding the destination
+location. When activated, Kamailio will select a socket that can reach
+the destination (to be able to connect to the remote address). (Kamailio
+opens a UDP socket to the destination, then it retrieves the local IP
+which was assigned by the operating system to the new UDP socket. Then
+this socket will be closed and the retrieved IP address will be used as
+IP address in the Via/Record-Route headers)
+
+Example of usage:
+
+``` c
+mhomed=1
+```
+
+### mlock_pages
+
+Locks all Kamailio pages into memory making it unswappable (in general
+one doesn't want his SIP proxy swapped out :-))
+
+``` c
+mlock_pages = yes |no (default no)
+```
+
+### modinit_delay
+
+Number of microseconds to wait after initializing a module - useful to
+cope with systems where are rate limits on new connections to database
+or other systems.
+
+Default value is 0 (no wait).
+
+``` c
+modinit_delay=100000
+```
+
+### modparam
+
+The modparam command will be used to set the options (parameters) for the loaded
+modules.
+
+Prototypes:
+
+``` c
+modparam("modname", "paramname", intval)
+modparam("modname", "paramname", "strval")
+```
+
+The first pameter is the name of the module or a list of module names separated
+by `|` (pipe). Actually, the `modname` is enclosed in beteen `^(` and `)$` and
+matched with the names of the loaded modules using POSIX regexp operation. For example,
+when `auth` is given, then the module name is matched with `^(auth)$`; when
+`acc|auth` is given, then the module name is matched with `^(acc|auth)$`. While
+using only `|` between the names of the modules is recommended for clarity, any
+value that can construct a valid regular expression can be used. Note also that
+`modparam` throws error only when no module name is matched and no parameter is
+set. If the list of modules in `modname` includes a wrong name, Kamailio starts.
+For example setting `modname` to `msilo|notamodule` does not result in a startup
+error if `msilo` module is loaded. Be also careful with expressions than can
+match more module names than wanted, for example setting `modname` to `a|b` can
+result in matching all module names that include either `a` or `b`.
+
+The second parameter of `modparam` is the name of the module parameter.
+
+The third parameter of `modparam` has to be either an interger or a string value,
+a matter of what the module parameter expects, as documented in the README of the
+module.
+
+Example:
+
+``` c
+modparam("usrloc", "db_mode", 2)
+modparam("usrloc", "nat_bflag", 6)
+modparam("auth_db|msilo|usrloc", "db_url",
+    "mysql://kamailio:kamailiorw@localhost/kamailio")
+```
+
+See the documenation of the respective module to find out the available
+options.
+
+### modparamx
+
+Similar to **modparam**, with ability to evaluate the variables in its
+parameters.
+
+### msg_recv_max_size
+
+Set the maximum size in bytes of a SIP message to be accepted by Kamailio.
+
+Default: `32767` (`2^15 - 1`)
+
+Example:
+
+``` c
+msg_recv_max_size = 10000
+```
+
+### onsend_route_reply
+
+If set to 1 (yes, on), onsend_route block is executed for received
+replies that are sent out. Default is 0.
+
+``` c
+onsend_route_reply=yes
+```
+
+### open_files_limit
+
+If set and bigger than the current open file limit, Kamailio will try to
+increase its open file limit to this number. Note: Kamailio must be
+started as root to be able to increase a limit past the hard limit
+(which, for open files, is `1024` on most systems). "Files" include
+network sockets, so you need one for every concurrent session
+(especially if you use connection-oriented transports, like TCP/TLS).
+
+Example of usage:
+
+``` c
+open_files_limit=2048
+```
+
+### phone2tel
+
+By enabling this feature, Kamailio internally treats SIP URIs with
+user=phone parameter as TEL URIs. If you do not want this behavior, you
+have to turn it off.
+
+Default value: `1` (enabled)
+
+``` c
+phone2tel = 0
+```
+
+### pmtu_discovery
+
+If set to 1, the don't-fragment (DF) bit will be set in outbound IP
+packets, but no fragmentation from the kernel will be done for IPv4
+and IPv6. This means that packets might be dropped and it is up to
+the user to reduce the packet size and try again.
+
+If set to 2, the kernel will will fragment a packet if needed
+according to the path MTU, or will set the don't-fragment flag
+otherwise. For IPv6 the kernel will fragment a packet if needed
+according to the path MTU. The kernel keeps track of the path MTU
+per destination host.
+
+The default is 0, do not set the don't-fragment bit or fragment
+packets for IPv4 and IPv6.
+
+``` c
+pmtu_discovery = 0 | 1 | 2 (default 0)
+```
+
+### port
+
+The port the SIP server listens to. The default value for it is 5060.
+
+Example of usage:
+
+``` c
+port=5080
+```
+
+### pv_buffer_size
+
+The size in bytes of internal buffer to print dynamic strings with
+pseudo-variables inside. The default value is 8192 (8kB). Please keep in
+mind that for xlog messages, there is a dedicated module parameter to
+set the internal buffer size.
+
+Example of usage:
+
+``` c
+pv_buffer_size=2048
+```
+
+### pv_buffer_slots
+
+The number of internal buffer slots to print dynamic strings with
+pseudo-variables inside. The default value is 10.
+
+Example of usage:
+
+``` c
+pv_buffer_slots=12
+```
+
+### pv_cache_limit
+
+The limit how many pv declarations in the cache after which an action is
+taken. Default value is 2048.
+
+``` c
+pv_cache_limit=1024
+```
+
+### pv_cache_action
+
+Specify what action to be done when the size of pv cache is exceeded. If
+`0`, print a warning log message when the limit is exceeded. If `1`,
+warning log messages is printed and the cache systems tries to drop a
+`$sht(...)` declaration. Default is `0`.
+
+    pv_cache_action=1
+
+### rpc_exec_delta
+
+Specify the time interval (in seconds) required to wait before executing again
+an RPC command exported with the flag `RPC_EXEC_DELTA`. Practically it enables
+an execution rate limit for such command. The rate limiting is per RPC command.
+
+Such RPC commands can be those related to reload of data records or config options
+from backends such as database or hard drive. For them, executing the RPC command
+too ofter can result in compromizing the internal structures (e.g., previous reload
+of data was not finished when next reload is triggered).
+
+Default value: `0` (no rate limiting)
+
+Example:
+
+``` c
+rpc_exec_delta=5
+```
+
+### rundir
+
+Alias: run_dir
+
+Set the folder for creating runtime files such as MI fifo or CTL
+unixsocket.
+
+Default: `/var/run/kamailio`
+
+Example of usage:
+
+``` c
+rundir="/tmp"
+```
+
+### received_route_mode
+
+Enable or disable the execution of `event_route[core:msg-received]`
+routing block or its corresponding Kemi callback.
+
+Default value: `0` (disabled)
+
+Example of usage:
+
+``` c
+received_route_mode=1
+```
+
+### reply_to_via
+
+If it is set to 1, any local reply is sent to the IP address advertised
+in top most Via of the request instead of the IP address from which the
+request was received. Default value is 0 (off).
+
+Example of usage:
+
+``` c
+reply_to_via=0
+```
+
+### route_locks_size
+
+Set the number of mutex locks to be used for synchronizing the execution
+of config script for messages sharing the same `Call-Id`. In other words,
+enables Kamailio to execute the config script sequentially for the
+requests and replies received within the same dialog -- a new message
+received within the same dialog waits until the previous one is routed
+out.
+
+For smaller impact on parallel processing, its value it should be at
+least twice the number of Kamailio processes (all children processes).
+
+Example:
+
+``` c
+route_locks_size = 256
+```
+
+Note that ordering of the SIP messages can still be changed by network
+transmission (quite likely for UDP, especially on long distance paths)
+or CPU allocation for processes when executing pre-config and
+post-config tasks (very low chance, but not to be ruled out completely).
+
+### server_id
+
+A configurable unique server id that can be used to discriminate server
+instances within a cluster of servers when all other information, such
+as IP addresses are the same.
+
+``` c
+  server_id = number
+```
+
+### server_header
+
+Set the value of Server header for replies generated by Kamailio. It
+must contain the header name, but not the ending `CRLF`.
+
+Example of usage:
+
+``` c
+server_header="Server: My Super SIP Server"
+```
+
+### server_signature
+
+This parameter controls the "Server" header in any locally generated
+message.
+
+Example of usage:
+
+``` c
+server_signature=no
+```
+
+If it is enabled (default=yes) a header is generated as in the following
+example:
+
+``` c
+Server: Kamailio (<version> (<arch>/<os>))
+```
+
+### shm_force_alloc
+
+Tries to pre-fault all the shared memory, before starting. When "on",
+start time will increase, but combined with mlock_pages will guarantee
+Kamailio will get all its memory from the beginning (no more kswapd slow
+downs)
+
+``` c
+shm_force_alloc = yes | no (default no)
+```
+
+### shm_mem_size
+
+Set shared memory size (in Mb).
+
+``` c
+shm_mem_size = 64 (default 64)
+```
+
+### sip_parser_log
+
+Log level for printing debug messages for some of the SIP parsing
+errors.
+
+Default: `0` (`L_WARN`)
+
+``` c
+sip_parser_log = 1
+```
+
+### sip_parser_mode
+
+Control sip parser behaviour.
+
+If set to `1`, the parser is more strict in accepting messages that have
+invalid headers (e.g., duplicate To or From). It can make the system
+safer, but loses the flexibility to be able to fix invalid messages with
+config operations.
+
+If set to `0`, the parser is less strict on checking validity of headers.
+
+Default: `1`
+
+``` c
+sip_parser_mode = 0
+```
+
+### sip_warning (noisy feedback)
+
+Can be `0` or `1`. If set to `1` (default value is `0`) a 'Warning' header is
+added to each reply generated by Kamailio. The header contains several
+details that help troubleshooting using the network traffic dumps, but
+might reveal details of your network infrastructure and internal SIP
+routing.
+
+Example of usage:
+
+``` c
+sip_warning=0
+```
+
+### socket
+
+Specify an address to listen (bind) to, a simplified alternative to `listen`
+paramter that allows specifying the attributes using a structure style.
+
+Prototype:
+
+``` c
+socket = {
+    attr1 = value1;
+    ...
+    attrN = valueN;
+}
+```
+
+The attributes are:
+
+- `bind` - the address to listen on in format `[proto:]address[:port]` or
+  `[proto:]address[:port1-port2]`
+- `advertise` - the address to advertise in SIP headers in format `address[:port]`
+- `name` - name of the socket to be referenced in configuration file
+- `agname` - async (action) group name where to push SIP messages received using
+  multi-threaded mode
+- `virtual` - set to `yes/no` to indicate if the IP has to be considered virtual or not
+
+The attribute `bind` is mandatory and has to provide at list the address to listen on.
+
+Example:
+
+``` c
+socket = {
+    bind = udp:10.10.10.10:5060;
+    advertise = 11.11.11.11:5060;
+    name = "s0";
+    virtual = yes;
+}
+```
+
+The above is the equivalent of:
+
+``` c
+listen=udp:10.10.10.10:5060 advertise 11.11.11.11:5060 name "s0" virtual
+```
+
+When attribute `bind` is set to `[proto:]address[:port1-port2]`, then Kamailio
+binds to a range of ports from `port1` to `port2` (the start and end ports are
+inclusive). If socket `name` is provided in this case, then the port is appended,
+becoming `[name][port]` for each of the sockets created in the port range. If
+`advertise` is also provided, then a corresponding range of ports is used for
+advertised addresses, although only the start port for advertise has to be provided.
+
+If the following `socket` definition is provided:
+
+``` c
+socket = {
+    bind = udp:10.10.10.10:5060-5068;
+    advertise = 11.11.11.11:5060;
+    name = "s0p";
+    virtual = yes;
+}
+```
+
+The first bind socket in rage is the equivalent of:
+
+``` c
+socket = {
+    bind = udp:10.10.10.10:5060;
+    advertise = 11.11.11.11:5060;
+    name = "s0p5060";
+    virtual = yes;
+}
+```
+
+And the last one is:
+
+``` c
+socket = {
+    bind = udp:10.10.10.10:5068;
+    advertise = 11.11.11.11:5068;
+    name = "s0p5068";
+    virtual = yes;
+}
+```
+
+### socket_workers
+
+Number of workers to process SIP traffic per listen socket - typical use
+is before a **listen** global parameter.
+
+- when used before **listen** on UDP or SCTP socket, it overwrites
+    **children** or **sctp_children** value for that socket.
+- when used before **listen** on TCP or TLS socket, it adds extra tcp
+    workers, these handling traffic only on that socket.
+
+The value of **socket_workers** is reset with next **listen** socket
+definition that is added, thus use it for each **listen** socket where
+you want custom number of workers.
+
+If this parameter is not used at all, the values for **children**,
+**tcp_children** and **sctp_children** are used as usually.
+
+Example for udp sockets:
+
+``` c
+children=4
+socket_workers=2
+listen=udp:127.0.0.1:5080
+listen=udp:127.0.0.1:5070
+listen=udp:127.0.0.1:5060
+```
+
+- it will start 2 workers to handle traffic on udp:127.0.0.1:5080
+    and 4 for each of udp:127.0.0.1:5070 and udp:127.0.0.1:5060. In
+    total there are 10 worker processes
+
+Example for tcp sockets:
+
+``` c
+children=4
+socket_workers=2
+listen=tcp:127.0.0.1:5080
+listen=tcp:127.0.0.1:5070
+listen=tcp:127.0.0.1:5060
+```
+
+- it will start 2 workers to handle traffic on tcp:127.0.0.1:5080 and
+    4 to handle traffic on both tcp:127.0.0.1:5070 and
+    tcp:127.0.0.1:5060. In total there are 6 worker processes
+
+### sql_buffer_size
+
+The size in bytes of the SQL buffer created for data base queries. For
+database drivers that use the core db_query library, this will be
+maximum size object that can be written or read from a database. Default
+value is 65535.
+
+Example of usage:
+
+``` c
+sql_buffer_size=131070
+```
+
+### statistics
+
+Kamailio has built-in support for statistics counter. This means, these
+counters can be increased, decreased, read and cleared. The statistics
+counter are defined either by the core (e.g. tcp counters), by modules
+(e.g. 2xx_transactions by "tmx" module) or by the script writer using
+the "statistics" module.
+
+The statistics counters are read/updated either automatically by
+Kamailio internally (e.g. tcp counters), by the script writer via the
+module functions of the "statistics" module, by the script writer using
+the `$stat()` pseudo variable (read-only), or via MI commands.
+
+Following are some examples how to access statistics variables:
+
+**script**:
+
+``` c
+modparam("statistics", "variable", "NOTIFY")
+
+(if method == "NOTIFY") {
+    update_stat("NOTIFY", "+1");
+}
+
+xlog("Number of received NOTIFYs: $stat(NOTIFY)");
+```
+
+**RPC**:
+
+``` bash
+# get counter value
+kamctl rpc stats.get_statistics NOTIFY
+# set counter to zero
+kamctl rpc stats.reset_statistics NOTIFY
+# get counter value and then set it to zero
+kamctl rpc stats.clear_statistics NOTIFY
+
+# or use the kamcmd tool
+kamcmd stats.get_statistics 1xx_replies
+```
+
+### stats_name_separator
+
+Specify the character used as a separator for the internal statistics'
+names. Default value is `_`.
+
+Example of usage:
+
+``` c
+stats_name_separator = "-"
+```
+
+### tos
+
+The TOS (Type Of Service) to be used for the sent IP packages (both TCP
+and UDP).
+
+Example of usage:
+
+``` c
+tos=IPTOS_LOWDELAY
+tos=0x10
+tos=IPTOS_RELIABILITY
+```
+
+### udp_mtu
+
+Fallback to another protocol (`udp_mtu_try_proto` must be set also either
+globally or per packet) if the constructed request size is greater than
+udp_mtu.
+
+RFC 3261 specified size: `1300`. Default: `0` (off).
+
+``` c
+udp_mtu = number
+```
+
+### udp_mtu_try_proto
+
+If `udp_mtu != 0` and udp forwarded request size (after adding all the
+"local" headers) `> udp_mtu`, use this protocol instead of udp. Only the
+Via header will be updated (e.g. The Record-Route will be the one built
+for udp).
+
+**Warning:** Although RFC3261 mandates automatic transport protocol
+changing, enabling this feature can lead to problems with clients which
+do not support other protocols or are behind a firewall or NAT. Use this
+only when you know what you do!
+
+See also `udp_mtu_try_proto(proto)` function.
+
+Default: `UDP` (`off`). Recommended: `TCP`.
+
+``` c
+udp_mtu_try_proto = TCP|TLS|SCTP|UDP
+```
+
+### udp_receiver_mode
+
+Specify how UDP traffic is received, either via a pool of processes per UDP socket
+or a single multi-threaded process with a thread per socket.
+
+Default value is `0` (pool of processes defined by `children`, old-style behaviour).
+
+Value `1` switches to multi-threaded process receiver for all UDP sockets.
+SIP messages are pushed to `udp` async tasks group, sending is still done by any
+of processes.
+
+```c
+async_workers_group="name=udp;workers=8"
+udp_receiver_mode = 1
+```
+
+Value `2` allows to define sockets that can be groupped to a specific async tasks
+group by providing the `agname` to `socket` definition. These sockets use the
+multi-threaded receiver style. The sockets without `agname` set use the old-style
+multi-process receivers.
+
+```c
+async_workers_group="name=udp507x;workers=8"
+async_workers_group="name=udp5080;workers=8"
+udp_receiver_mode = 2
+
+// multi-process UDP receiving
+socket = {
+    bind = udp:10.10.10.10:5060;
+    advertise = 11.11.11.11:5060;
+    name = "s5060";
+}
+// multi-threaded UDP receiving
+socket = {
+    bind = udp:10.10.10.10:5070;
+    name = "s5070";
+    agname = "udp507x";
+}
+// multi-threaded UDP receiving
+socket = {
+    bind = udp:10.10.10.10:5072;
+    name = "s5072";
+    agname = "udp507x";
+}
+// multi-threaded UDP receiving
+socket = {
+    bind = udp:10.10.10.10:5080;
+    advertise = 11.11.11.11:5080;
+    name = "s5080";
+    agname = "udp5080";
+}
+```
+
+### uri_host_extra_chars
+
+Specify additional chars that should be allowed in the host part of URI.
+
+``` c
+uri_host_extra_chars = "_"
+```
+
+### user
+
+**Alias name:** **uid**
+
+The user id to run Kamailio (Kamailio will suid to it).
+
+Example of usage:
+
+``` c
+    user="kamailio"
+```
+
+### user_agent_header
+
+Set the value of User-Agent header for requests generated by Kamailio.
+It must contain header name as well, but not the ending CRLF.
+
+``` c
+user_agent_header="User-Agent: My Super SIP Server"
+```
+
+### verbose_startup
+
+Control if printing routing tree and udp probing buffer debug messages
+should be printed at startup.
+
+Default is 0 (don't print); set to 1 to get those debug messages.
+
+Example of usage:
+
+``` c
+   verbose_startup=1
+```
+
+### version_table
+
+Set the name of the table holding the table version. Useful if the proxy
+is sharing a database within a project and during upgrades. Default
+value is "version".
+
+Example of usage:
+
+``` c
+   version_table="version44"
+```
+
+### wait_worker1_mode
+
+Enable waiting for child SIP worker one to complete initialization, then
+create the other child worker processes.
+
+Default: 0 (do not wait for child worker one to complete
+initialization).
+
+Example:
+
+``` c
+wait_worker1_mode = 1
+```
+
+### wait_worker1_time
+
+How long to wait for child worker one to complete the initialization. In
+micro-seconds.
+
+Default: 4000000 (micro-seconds = 4 seconds).
+
+Example:
+
+``` c
+wait_worker1_time = 1000000
+```
+
+### wait_worker1_usleep
+
+Waiting for child worker one to complete the initialization is done in
+a loop, which loop waits until wait_worker1_time passes.  This parameter
+specifies how long after each iteration of that loop to wait in micro-seconds.
+
+Default: 100000 (micro-seconds = 0.1 seconds).
+
+Example:
+
+``` c
+wait_worker1_usleep = 50000
+```
+
+### workdir
+
+**Alias name:** **wdir**
+
+The working directory used by Kamailio at runtime. You might find it
+useful when it comes to generating core files :)
+
+Example of usage:
+
+``` c
+wdir="/usr/local/kamailio"
+# or
+wdir=/usr/kamwd
+```
+
+### xavp_via_params
+
+Set the name of the XAVP of which subfields will be added as local `Via`
+-header parameters.
+
+If not set, `XAVP` to `Via` header parameter manipulation is not applied
+(default behaviour).
+
+If set, local `Via` header gets additional parameters from defined `XAVP`.
+Core flag `FL_ADD_XAVP_VIA_PARAMS` needs to be set¹.
+
+Example:
+
+``` c
+xavp_via_params="via"
+```
+
+`[1]` See function `via_add_xavp_params()` from "corex" module.
+
+### xavp_via_fields
+
+Set the name of xavp from where to take Via header field: address and
+port. Use them to build local Via header.
+
+Example:
+
+``` c
+xavp_via_fields="customvia"
+
+request_route {
+  ...
+  $xavp(customvia=>address) = "1.2.3.4";
+  $xavp(customvia[0]=>port) = "5080";  # must be string
+  via_use_xavp_fields("1");
+  t_relay();
+}
+```
+
+See function `via_use_xavp_fields()` from "corex" module.
+
+### xavp_via_reply_params
+
+Set the name of the XAVP of which subfields will be added as header parameters to the top `Via` of the replies sent out.
+
+If not set, `XAVP` to `Via` header parameter manipulation is not applied
+(default behaviour).
+
+If set, top `Via` header of the to-be-sent reply gets additional parameters from defined `XAVP`.
+Core flag `FL_ADD_XAVP_VIA_REPLY PARAMS` needs to be set¹.
+
+Example:
+
+``` c
+xavp_via_reply_params="viarpl"
+```
+
+`[1]` See function `via_reply_vadd_xavp_params()` from "corex" module.
+
+## DNS Parameters
+
+Note: See also file `doc/tutorials/dns.txt` for details about Kamailio's
+DNS client.
+
+Kamailio has an internal DNS resolver with caching capabilities. If this
+caching resolver is activated (default setting) then the system's stub
+resolver won't be used. Thus, also local name resolution configuration
+like `/etc/hosts` entries will not be used. If the DNS cache is
+deactivated (`use_dns_cache=no`), then system's resolver will be used. The
+DNS failover functionality in the tm module references directly records
+in the DNS cache (which saves a lot of memory) and hence DNS based
+failover only works if the internal DNS cache is enabled.
+
+| DNS resolver comparison                  | internal resolver | system resolver |
+|------------------------------------------|-------------------|-----------------|
+| Caching of resolved records              | yes               | no\*            |
+| NAPTR/SRV lookups with correct weighting | yes               | yes             |
+| DNS based failover                       | yes               | no              |
+
+- Of course you can use the resolving name servers configured in
+`/etc/resolv.conf` as caching nameservers.
+
+If the internal resolver/cache is enabled you can add/remove records by
+hand (using kamcmd or xmlrpc) using the DNS RPCs, e.g. dns.add_a,
+dns.add_srv, dns.delete_a a.s.o. For more info on DNS RPCs see:
+
+- [https://www.kamailio.org/docs/docbooks/devel/rpc_list/rpc_list.html#dns.add_a](https://www.kamailio.org/docs/docbooks/devel/rpc_list/rpc_list.html#dns.add_a)
+
+Note: During startup of Kamailio, before the internal resolver is
+loaded, the system resolver will be used (it will be used for queries
+done from module register functions or modparams fixups, but not for
+queries done from `mod_init()` or normal fixups).
+
+Note: The dns cache uses the DNS servers configured on your server
+(`/etc/resolv.conf`), therefore even if you use the internal resolver you
+should have a working DNS resolving configuration on your server.
+
+Kamailio also allows you to finetune the DNS resolver settings.
+
+The maximum time a dns request can take (before failing) is (if
+`dns_try_ipv6` is yes, multiply it again by `2`; if `SRV` and `NAPTR` lookups
+are enabled, it can take even longer!):
+
+``` c
+(dns_retr_time*(dns_retr_no+1)*dns_servers_no)*(search_list_domains)
+```
+
+Note: During DNS lookups, the process which performs the DNS lookup
+blocks. To minimize the blocked time the following parameters can be
+used (max 2s):
+
+``` c
+dns_try_ipv6=no
+dns_retr_time=1
+dns_retr_no=1
+dns_use_search_list=no
+```
+
+### dns
+
+This parameter controls if the SIP server will try doing a DNS lookup on
+the address in the Via header of a received sip request to decide if
+adding a `received=src_ip` parameter to the Via is necessary. Note that
+Vias containing DNS names (instead of IPs) should have `received=` added,
+so turning dns to yes is not recommended.
+
+Default is `no`.
+
+### rev_dns
+
+**Alias name:** **dns_rev_via**
+
+This parameter controls if the SIP server will try doing a reverse DNS
+lookup on the source IP of a sip request to decide if adding a
+`received=src_ip` parameter to the Via is necessary (if the Via
+contains a DNS name instead of an IP address, the result of the reverse
+dns on the source IP will be compared with the DNS name in the Via). See
+also dns (the effect is cumulative, both can be turned on and in that
+case if the DNS lookup test fails the reverse DNS test will be tried).
+Note that Vias containing DNS names (instead of IPs) should have
+`received=` added, so turning rev_dns to yes is not recommended.
+
+Default is `no`.
+
+### dns_cache_del_nonexp
+
+**Alias name:** **dns_cache_delete_nonexpired**
+
+``` c
+dns_cache_del_nonexp = yes | no (default: no)
+```
+
+      allow deletion of non-expired records from the cache when there is no more space
+      left for new ones. The last-recently used entries are deleted first.
+
+### dns_cache_rec_pref
+
+``` c
+dns_cache_rec_pref = number (default 0)
+```
+
+      dns cache record preference, determines how new DNS records are stored internally in relation to existing entries.
+      Possible values:
+        0 - do not check duplicates
+        1 - prefer old records
+        2 - prefer new records
+        3 - prefer records with longer lifetime
+
+### dns_cache_flags
+
+``` c
+dns_cache_flags = number (default 0)
+```
+
+      dns cache specific resolver flags, used for overriding the default behaviour (low level).
+      Possible values:
+        1 - ipv4 only: only DNS A requests are performed, even if Kamailio also listens on ipv6 addresses.
+        2 - ipv6 only: only DNS AAAA requests are performed. Ignored if dns_try_ipv6 is off or Kamailio
+            doesn't listen on any ipv6 address.
+        4 - prefer ipv6: try first to resolve a host name to an ipv6 address (DNS AAAA request) and only
+            if this fails try an ipv4 address (DNS A request). By default the ipv4 addresses are preferred.
+
+### dns_cache_gc_interval
+
+Interval in seconds after which the dns cache is garbage collected
+(default: 120 s)
+
+``` c
+dns_cache_gc_interval = number
+```
+
+### dns_cache_init
+
+If off, the dns cache is not initialized at startup and cannot be
+enabled at runtime, this saves some memory.
+
+``` c
+dns_cache_init = on | off (default on)
+```
+
+### dns_cache_max_ttl
+
+``` c
+dns_cache_max_ttl = time in seconds (default MAXINT)
+```
+
+### dns_cache_mem
+
+Maximum memory used for the dns cache in KB (default 500 K)
+
+``` c
+dns_cache_mem = number
+```
+
+### dns_cache_min_ttl
+
+``` c
+dns_cache_min_ttl = time in seconds (default 0)
+```
+
+### dns_cache_negative_ttl
+
+Tells how long to keep negative DNS responses in cache. If set to 0,
+disables caching of negative responses. Default is 60 (seconds).
+
+### dns_naptr_ignore_rfc
+
+If the DNS lookup should ignore the remote side's protocol preferences,
+as indicated by the Order field in the NAPTR records and mandated by RFC
+2915.
+
+``` c
+dns_naptr_ignore_rfc = yes | no (default yes)
+```
+
+### dns_retr_no
+
+Number of dns retransmissions before giving up. Default value is system
+specific, depends also on the '/etc/resolv.conf' content (usually 4).
+
+Example of usage:
+
+``` c
+dns_retr_no=3
+```
+
+### dns_retr_time
+
+Time in seconds before retrying a dns request. Default value is system
+specific, depends also on the '/etc/resolv.conf' content (usually 5s).
+
+Example of usage:
+
+``` c
+dns_retr_time=3
+```
+
+### dns_search_full_match
+
+When name was resolved using dns search list, check the domain added in
+the answer matches with one from the search list (small performance hit,
+but more safe)
+
+``` c
+dns_search_full_match = yes | no (default yes)
+```
+
+### dns_servers_no
+
+How many dns servers from the ones defined in '/etc/resolv.conf' will be
+used. Default value is to use all of them.
+
+Example of usage:
+
+``` c
+dns_servers_no=2
+```
+
+### dns_srv_lb
+
+**Alias name:** **dns_srv_loadbalancing**
+
+Enable dns srv weight based load balancing (see doc/tutorials/dns.txt)
+
+``` c
+dns_srv_lb = yes | no (default no)
+```
+
+### dns_try_ipv6
+
+Can be 'yes' or 'no'. If it is set to 'yes' and a DNS lookup fails, it
+will retry it for ipv6 (AAAA record). Default value is 'no'.
+
+Note: If dns_try_ipv6 is off, no hostname resolving that would result in
+an ipv6 address would succeed - it doesn't matter if an actual DNS
+lookup is to be performed or the host is already an ip address. Thus, if
+the proxy should forward requests to IPv6 targets, this option must be
+turned on!
+
+Example of usage:
+
+``` c
+dns_try_ipv6=yes
+```
+
+### dns_try_naptr
+
+Enable NAPTR support according to RFC 3263 (see doc/tutorials/dns.txt
+for more info)
+
+``` c
+dns_try_naptr = yes | no (default no)
+```
+
+### dns_sctp_pref, dns_tcp_pref, dns_tls_pref, dns_udp_pref
+
+**Alias name:** **dns_sctp_preference, dns_tcp_preference,
+dns_tls_preference, dns_udp_preference**
+
+Set preference for each protocol when doing naptr lookups. By default
+dns_udp_pref=30, dns_tcp_pref=20, dns_tls_pref=10 and dns_sctp_pref=20.
+To use the remote site preferences set all dns\_\*\_pref to the same
+positive value (e.g. dns_udp_pref=1, dns_tcp_pref=1, dns_tls_pref=1,
+dns_sctp_pref=1). To completely ignore NAPTR records for a specific
+protocol, set the corresponding protocol preference to -1 (or any other
+negative number). (see doc/tutorials/dns.txt for more info)
+
+``` c
+dns_{udp,tcp,tls,sctp}_pref = number
+```
+
+### dns_use_search_list
+
+Can be 'yes' or 'no'. If set to 'no', the search list in
+'/etc/resolv.conf' will be ignored (=> fewer lookups => gives up
+faster). Default value is 'yes'.
+
+HINT: even if you don't have a search list defined, setting this option
+to 'no' will still be "faster", because an empty search list is in fact
+search "" (so even if the search list is empty/missing there will still
+be 2 dns queries, eg. foo+'.' and foo+""+'.')
+
+Example of usage:
+
+``` c
+dns_use_search_list=no
+```
+
+### use_dns_cache
+
+**Alias name:** **dns_use_cache**
+
+Tells if DNS responses are cached - this means that the internal DNS
+resolver (instead of the system's stub resolver) will be used. If set to
+"off", disables caching of DNS responses and, as side effect, DNS
+failover. Default is "on". Settings can be changed also during runtime
+(switch from internal to system resolver and back).
+
+### use_dns_failover
+
+**Alias name:** **dns_use_failover**
+
+``` c
+use_dns_failover = on | off (default off)
+```
+
+If `on` and sending a request fails (due to not being allowed from an `onsend_route`,
+send failure, blocklisted destination or, when using tm, invite timeout), and the
+destination resolves to multiple ip addresses and/or multiple `SRV` records, the send
+will be re-tried using the next ip/record. In `tm` case, a new branch will be
+created for each new send attempt.
+
+## TCP Parameters
+
+The following parameters allows to tweak the TCP behaviour.
+
+### disable_tcp
+
+Global parameter to disable TCP support in the SIP server. Default value
+is `no`.
+
+Example of usage:
+
+``` c
+disable_tcp=yes
+```
+
+### tcp_accept_aliases
+
+If a message received over a tcp connection has "alias" in its via a new
+tcp alias port will be created for the connection the message came from
+(the alias port will be set to the via one).
+
+Based on `draft-ietf-sip-connect-reuse-00.txt`, but using only the port
+(host aliases are dangerous, involve extra DNS lookups and the need for
+them is questionable)
+
+See `force_tcp_alias` for more details.
+
+Note: For NAT traversal of TCP clients it is better to not use
+tcp_accept_aliases but just use nathelper module and
+`fix_nated_[contact|register]()` functions.
+
+Default is `no` (`off`)
+
+``` c
+tcp_accept_aliases= yes|no
+```
+
+### tcp_accept_haproxy
+
+Enable the internal TCP stack to expect a PROXY-protocol-formatted
+header as the first message of the connection. Both the human-readable
+(v1) and binary-encoded (v2) variants of the protocol are supported.
+This option is typically useful if you are behind a TCP load-balancer,
+such as HAProxy or an AWS' ELB, and allows the load-balancer to provide
+connection information regarding the upstream client. This enables the
+use of IP-based ACLs, even behind a load-balancer.
+
+Please note that enabling this option will reject any inbound TCP
+connection that does not conform to the PROXY-protocol spec.
+
+For reference - the PROXY protocol:
+
+- [https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)
+
+Default value is **no**.
+
+``` c
+tcp_accept_haproxy=yes
+```
+
+### tcp_accept_hep3
+
+Enable internal TCP receiving stack to accept HEP3 packets. This option
+has to be set to **yes** on a Kamailio instance acting as Homer
+SIPCapture server that is supposed to receive HEP3 packets over TCP/TLS.
+
+Default value is **no**.
+
+``` c
+tcp_accept_hep3=yes
+```
+
+### tcp_accept_iplimit
+
+Set limit for accepted connections from the same IP address.
+
+Default: `1024`.
+
+``` c
+tcp_accept_iplimit=32
+```
+
+It can be set to `0` (or a negative value) to disable this limit.
+
+### tcp_accept_no_cl
+
+Control whether to throw or not error when there is no Content-Length
+header for requests received over TCP. It is required to be set to
+**yes** for XCAP traffic sent over HTTP/1.1 which does not use
+Content-Length header, but splits large bodies in many chunks. The
+module **sanity** can be used then to restrict this permission to HTTP
+traffic only, testing in route block in order to stay RFC3261 compliant
+about this mandatory header for SIP requests over TCP.
+
+Default value is **no**.
+
+``` c
+tcp_accept_no_cl=yes
+```
+
+### tcp_accept_unique
+
+If set to `1`, reject duplicate connections coming from same source IP and
+port.
+
+Default set to `0`.
+
+``` c
+tcp_accept_unique = 1
+```
+
+### tcp_async
+
+**Alias name:** **tcp_buf_write**
+
+If enabled, all the tcp writes that would block / wait for connect to
+finish, will be queued and attempted latter (see also `tcp_conn_wq_max`
+and `tcp_wq_max`).
+
+**Note:** It also applies for TLS.
+
+``` c
+tcp_async = yes | no (default yes)
+```
+
+### tcp_check_timer
+
+Set the check interval (in seconds) for tcp connections. It is used to check
+if there was any data received on new connections or if the receiving of SIP
+messages takes too long. See also `tcp_msg_data_timeout` and `tcp_msg_read_timeout`.
+
+Default half of `tcp_msg_data_timeout` or `tcp_msg_read_timeout` value depending on
+which one is smaller and not zero or 0 if both are zero
+
+``` c
+tcp_check_timer=5
+```
+
+### tcp_children
+
+Number of children processes to be created for reading from TCP
+connections. If no value is explicitly set, the same number of TCP
+children as UDP children (see "children" parameter) will be used.
+
+Example of usage:
+
+``` c
+tcp_children=4
+```
+
+### tcp_clone_rcvbuf
+
+Control if the received buffer should be cloned from the TCP stream,
+needed by functions working inside the SIP message buffer (such as
+msg_apply_changes()).
+
+Default is `0` (don't clone), set it to `1` for cloning.
+
+Example of usage:
+
+``` c
+tcp_clone_rcvbuf=1
+```
+
+### tcp_connection_lifetime
+
+Lifetime in seconds for TCP sessions. TCP sessions which are inactive
+for longer than **tcp_connection_lifetime** will be closed by Kamailio.
+Default value is defined is `120`. Setting this value to 0 will close the
+TCP connection pretty quick.
+
+Note: As many SIP clients are behind NAT/Firewalls, the SIP proxy should
+not close the TCP connection as it is not capable of opening a new one.
+
+Example of usage:
+
+``` c
+tcp_connection_lifetime=3605
+```
+
+### tcp_connection_match
+
+If set to `1`, try to be more strict in matching outbound TCP connections,
+attempting to lookup first the connection using also local port, not
+only the local IP and remote IP+port.
+
+Default is `0`.
+
+``` c
+tcp_connection_match=1
+```
+
+### tcp_connect_timeout
+
+Time in seconds before an ongoing attempt to establish a new TCP
+connection will be aborted. Lower this value for faster detection of TCP
+connection problems. The default value is 10s.
+
+Example of usage:
+
+``` c
+tcp_connect_timeout=5
+```
+
+### tcp_conn_wq_max
+
+Maximum bytes queued for write allowed per connection. Attempting to
+queue more bytes would result in an error and in the connection being
+closed (too slow). If tcp_buf_write is not enabled, it has no effect.
+
+``` c
+tcp_conn_wq_max = bytes (default 32 K)
+```
+
+### tcp_crlf_ping
+
+Enable SIP outbound TCP keep-alive using PING-PONG (CRLFCRLF - CRLF).
+
+``` c
+tcp_crlf_ping = yes | no default: yes
+```
+
+### tcp_defer_accept
+
+Tcp accepts will be delayed until some data is received (improves
+performance on proxies with lots of opened tcp connections). See linux
+`tcp(7)` `TCP_DEFER_ACCEPT` or freebsd `ACCF_DATA(0)`. For now linux and
+freebsd only.
+
+WARNING: the linux `TCP_DEFER_ACCEPT` is buggy (`<=2.6.23`) and doesn't
+work exactly as expected (if no data is received it will retransmit syn
+acks for `~ 190 s`, irrespective of the set timeout and then it will
+silently drop the connection without sending a RST or FIN). Try to use
+it together with tcp_syncnt (this way the number of retrans. SYNACKs can
+be limited => the timeout can be controlled in some way).
+
+On FreeBSD:
+
+``` c
+tcp_defer_accept =  yes | no (default no)
+```
+
+On Linux:
+
+``` c
+tcp_defer_accept =  number of seconds before timeout (default disabled)
+```
+
+### tcp_delayed_ack
+
+Initial ACK for opened connections will be delayed and sent with the
+first data segment (see linux tcp(7) TCP_QUICKACK). For now linux only.
+
+``` c
+tcp_delayed_ack  = yes | no (default yes when supported)
+```
+
+### tcp_fd_cache
+
+If enabled FDs used for sending will be cached inside the process
+calling tcp_send (performance increase for sending over tcp at the cost
+of slightly slower connection closing and extra FDs kept open)
+
+``` c
+tcp_fd_cache = yes | no (default yes)
+```
+
+### tcp_keepalive
+
+Enables keepalive for tcp (sets SO_KEEPALIVE socket option)
+
+``` c
+tcp_keepalive = yes | no (default yes)
+```
+
+### tcp_keepcnt
+
+Number of keepalives sent before dropping the connection (TCP_KEEPCNT
+socket option). Linux only.
+
+``` c
+tcp_keepcnt = number (not set by default)
+```
+
+### tcp_keepidle
+
+Time before starting to send keepalives, if the connection is idle
+(TCP_KEEPIDLE socket option). Linux only.
+
+``` c
+tcp_keepidle  = seconds (not set by default)
+```
+
+### tcp_keepintvl
+
+Time interval between keepalive probes, when the previous probe failed
+(TCP_KEEPINTVL socket option). Linux only.
+
+``` c
+tcp_keepintvl = seconds (not set by default)
+```
+
+### tcp_linger2
+
+Lifetime of orphaned sockets in FIN_WAIT2 state (overrides
+tcp_fin_timeout on, see linux tcp(7) TCP_LINGER2). Linux only.
+
+``` c
+tcp_linger2 = seconds (not set by default)
+```
+
+### tcp_max_connections
+
+Maximum number of tcp connections (if the number is exceeded no new tcp
+connections will be accepted). Default is defined in tcp_init.h: #define
+DEFAULT_TCP_MAX_CONNECTIONS 2048
+
+Example of usage:
+
+``` c
+tcp_max_connections=4096
+```
+
+### tcp_msg_data_timeout
+
+Duration in seconds for how long to wait till data is received on a new tcp
+connection. Default 20.
+
+``` c
+tcp_msg_data_timeout=10
+```
+
+### tcp_msg_read_timeout
+
+Duration in seconds for how long to wait till data is received on a new tcp
+connection. Default 20.
+
+``` c
+tcp_msg_read_timeout=10
+```
+
+### tcp_no_connect
+
+Stop outgoing TCP connects (also stops TLS) by setting tcp_no_connect to
+yes.
+
+You can do this any time, even even if Kamailio is already started (in
+this case using the command "kamcmd cfg.set_now_int tcp no_connect 1").
+
+### tcp_poll_method
+
+Poll method used (by default the best one for the current OS is
+selected). For available types see io_wait.c and poll_types.h: none,
+poll, epoll_lt, epoll_et, sigio_rt, select, kqueue, /dev/poll
+
+Example of usage:
+
+``` c
+tcp_poll_method=select
+```
+
+### tcp_rd_buf_size
+
+Buffer size used for tcp reads. A high buffer size increases performance
+on server with few connections and lot of traffic on them, but also
+increases memory consumption (so for lots of connection is better to use
+a low value). Note also that this value limits the maximum message size
+(SIP, HTTP) that can be received over tcp.
+
+The value is internally limited to 16MByte, for higher values recompile
+Kamailio with higher limit in tcp_options.c (search for "rd_buf_size"
+and 16777216). Further, you may need to increase the private memory, and
+if you process the message stateful you may also have to increase the
+shared memory.
+
+Default: 4096, can be changed at runtime.
+
+``` c
+tcp_rd_buf_size=65536
+```
+
+### tcp_reuse_port
+
+Allows reuse of TCP ports. This means, for example, that the same TCP
+ports on which Kamailio is listening on, can be used as source ports of
+new TCP connections when acting as an UAC. Kamailio must have been
+compiled in a system implementing SO_REUSEPORT (Linux \> 3.9.0, FreeBSD,
+OpenBSD, NetBSD, MacOSX). This parameter takes effect only if also the
+system on which Kamailio is running on supports SO_REUSEPORT.
+
+``` c
+tcp_reuse_port = yes (default no)
+```
+
+### tcp_script_mode
+
+Specify if connection should be closed (set to CONN_ERROR) if processing
+the received message results in error (that can also be due to negative
+return code from a configuration script main route block). If set to 1,
+the processing continues with the connection open.
+
+Default `0` (close connection)
+
+``` c
+tcp_script_mode = 1
+```
+
+### tcp_send_timeout
+
+Time in seconds after a TCP connection will be closed if it is not
+available for writing in this interval (and Kamailio wants to send
+something on it). Lower this value for faster detection of broken TCP
+connections. The default value is 10s.
+
+Example of usage:
+
+``` c
+tcp_send_timeout=3
+```
+
+### tcp_source_ipv4, tcp_source_ipv6
+
+Set the source IP for all outbound TCP connections. If setting of the IP
+fails, the TCP connection will use the default IP address.
+
+``` c
+tcp_source_ipv4 = IPv4 address
+tcp_source_ipv6 = IPv6 address
+```
+
+### tcp_syncnt
+
+Number of SYN retransmissions before aborting a connect attempt (see
+linux tcp(7) TCP_SYNCNT). Linux only.
+
+``` c
+tcp_syncnt = number of syn retr. (default not set)
+```
+
+### tcp_wait_data
+
+Specify how long to wait (in milliseconds) to wait for data on tcp
+connections in certain cases. Now applies when reading on tcp connection
+for haproxy protocol.
+
+Default: `5000ms` (`5secs`)
+
+``` c
+tcp_wait_data = 10000
+```
+
+### tcp_wq_blk_size
+
+Block size used for tcp async writes. It should be big enough to hold a
+few datagrams. If it's smaller than a datagram (in fact a tcp write())
+size, it will be rounded up. It has no influenced on the number of
+datagrams queued (for that see tcp_conn_wq_max or tcp_wq_max). It has
+mostly debugging and testing value (can be ignored).
+
+Default: `2100` (`~ 2 INVITEs`), can be changed at runtime.
+
+### tcp_wq_max
+
+Maximum bytes queued for write allowed globally. It has no effect if
+tcp_buf_write is not enabled.
+
+``` c
+tcp_wq_max = bytes (default 10 Mb)
+```
+
+## TLS Parameters
+
+Most of TLS layer attributes can be configured via TLS module
+parameters.
+
+### tls_port_no
+
+The port the SIP server listens to for TLS connections.
+
+Default value is `5061`.
+
+Example of usage:
+
+``` c
+tls_port_no=6061
+```
+
+### tls_max_connections
+
+Maximum number of TLS connections (if the number is exceeded no new TLS
+connections will be accepted). It cannot exceed tcp_max_connections.
+
+Default value is `2048`.
+
+Example of usage:
+
+``` c
+tls_max_connections=4096
+```
+
+### tls_threads_mode
+
+Control how to initialize the internal multi-threading system that impacts
+libssl 3.x.
+
+Values:
+
+- `0` - no thread-specific initialization/execution (default)
+- `1` - for each function that might initialize OpenSSL, run it in a temporary
+  thread; this leaves the thread-local variables in rank 0, main thread at their
+  default value of 0x0
+- `2` - use at-fork handler to set thread-local variables to 0x0; the
+  implementation will set thread-local keys from 0-15 to have value 0x0.
+
+``` c
+tls_threads_mode = 2
+```
+
+With libssl v3.x, the recommended value for production is `2`. For
+development/troubleshooting, value `1` can be used.
+
+## SCTP Parameters
+
+### disable_sctp
+
+Global parameter to disable SCTP support in the SIP server. See also
+`enable_sctp`.
+
+Default value is `auto`.
+
+Example of usage:
+
+``` c
+disable_sctp=yes
+```
+
+### enable_sctp
+
+``` c
+enable_sctp = 0/1/2  - SCTP disabled (0)/ SCTP enabled (1)/auto (2),
+                        default auto (2)
+```
+
+### sctp_children
+
+sctp children no (similar to udp children)
+
+``` c
+sctp_children = number
+```
+
+### sctp_socket_rcvbuf
+
+Size for the sctp socket receive buffer
+
+**Alias name:** **sctp_socket_receive_buffer**
+
+``` c
+sctp_socket_rcvbuf = number
+```
+
+### sctp_socket_sndbuf
+
+Size for the sctp socket send buffer
+
+**Alias name:** **sctp_socket_send_buffer**
+
+``` c
+sctp_socket_sndbuf = number
+```
+
+### sctp_autoclose
+
+Number of seconds before autoclosing an idle association (default: `180`
+s). Can be changed at runtime, but it will affect only new associations.
+E.g.:
+
+``` shell
+kamcmd cfg.seti sctp autoclose 120
+```
+
+``` c
+sctp_autoclose = seconds
+```
+
+### sctp_send_ttl
+
+Number of milliseconds before an unsent message/chunk is dropped
+(default: `32000` ms or `32` s). Can be changed at runtime, e.g.:
+
+``` shell
+kamcmd cfg.seti sctp send_ttl 180000
+```
+
+``` c
+sctp_send_ttl = milliseconds - n
+```
+
+### sctp_send_retries
+
+How many times to attempt re-sending a message on a re-opened
+association, if the sctp stack did give up sending it (it's not related
+to sctp protocol level retransmission). Useful to improve reliability
+with peers that reboot/restart or fail over to another machine.
+
+WARNING: use with care and low values (e.g. 1-3) to avoid "multiplying"
+traffic to unresponding hosts (default: 0). Can be changed at runtime.
+
+``` c
+sctp_send_retries = 1
+```
+
+### sctp_assoc_tracking
+
+Controls whether or not sctp associations are tracked inside Kamailio.
+Turning it off would result in less memory being used and slightly
+better performance, but it will also disable some other features that
+depend on it (e.g. `sctp_assoc_reuse`). Default: yes.
+
+Can be changed at runtime ("kamcmd sctp assoc_tracking 0"), but changes
+will be allowed only if all the other features that depend on it are
+turned off (for example it can be turned off only if first
+`sctp_assoc_reuse` was turned off).
+
+Note: turning `sctp_assoc_tracking` on/off will delete all the tracking
+information for all the currently tracked associations and might
+introduce a small temporary delay in the sctp processing if lots of
+associations were tracked.
+
+Config options depending on `sctp_assoc_tracking` being on:
+`sctp_assoc_reuse`.
+
+``` c
+sctp_assoc_tracking = yes/no
+```
+
+### sctp_assoc_reuse
+
+Controls sctp association reuse. For now only association reuse for
+replies is affected by it. Default: `yes`. Depends on `sctp_assoc_tracking`
+being on.
+
+Note that even if turned off, if the port in via corresponds to the
+source port of the association the request was sent on or if rport is
+turned on (`force_rport()` or via containing a rport option), the
+association will be automatically reused by the sctp stack. Can be
+changed at runtime (sctp assoc_reuse), but it can be turned on only if
+`sctp_assoc_tracking` is on.
+
+``` c
+sctp_assoc_reuse = yes/no
+```
+
+### sctp_max_assocs
+
+Maximum number of allowed open sctp associations. -1 means maximum
+allowed by the OS. Default: -1. Can be changed at runtime (e.g.:
+`kamcmd cfg.seti sctp max_assocs 10`). When the maximum associations
+number is exceeded and a new associations is opened by a remote host,
+the association will be immediately closed. However it is possible that
+some SIP packets get through (especially if they are sent early, as part
+of the 4-way handshake).
+
+When Kamailio tries to open a new association and the max_assocs is
+exceeded the exact behaviour depends on whether or not
+`sctp_assoc_tracking` is on. If on, the send triggering the active open
+will gracefully fail, before actually opening the new association and no
+packet will be sent. However if `sctp_assoc_tracking` is off, the
+association will first be opened and then immediately closed. In general
+this means that the initial sip packet will be sent (as part of the
+4-way handshake).
+
+``` c
+sctp_max_assocs = number
+```
+
+### sctp_srto_initial
+
+Initial value of the retr. timeout, used in RTO calculations (default:
+OS specific).
+
+Can be changed at runtime (sctp `srto_initial`) but it will affect only
+new associations.
+
+``` c
+sctp_srto_initial = milliseconds
+```
+
+### sctp_srto_max
+
+Maximum value of the retransmission timeout (RTO) (default: OS
+specific).
+
+WARNING: values lower than the sctp `sack_delay` will cause lots of
+retransmissions and connection instability (see sctp_srto_min for more
+details).
+
+Can be changed at runtime (sctp `srto_max`) but it will affect only new
+associations.
+
+``` c
+sctp_srto_max = milliseconds
+```
+
+### sctp_srto_min
+
+Minimum value of the retransmission timeout (RTO) (default: OS
+specific).
+
+WARNING: values lower than the sctp `sack_delay` of any peer might cause
+retransmissions and possible interoperability problems. According to the
+standard the `sack_delay` should be between 200 and 500 ms, so avoid
+trying values lower than 500 ms unless you control all the possible sctp
+peers and you do make sure their `sack_delay` is higher or their sack_freq
+is 1.
+
+Can be changed at runtime (sctp `srto_min`) but it will affect only new
+associations.
+
+``` c
+sctp_srto_min = milliseconds
+```
+
+### sctp_asocmaxrxt
+
+Maximum retransmissions attempts per association (default: OS specific).
+It should be set to `sctp_pathmaxrxt` `*` no. of expected paths.
+
+Can be changed at runtime (sctp asocmaxrxt) but it will affect only new
+associations.
+
+``` c
+sctp_asocmaxrxt   = number
+```
+
+### sctp_init_max_attempts
+
+Maximum INIT retransmission attempts (default: OS specific).
+
+Can be changed at runtime (sctp init_max_attempts).
+
+``` c
+sctp_init_max_attempts = number
+```
+
+### sctp_init_max_timeo
+
+Maximum INIT retransmission timeout (RTO max for INIT). Default: OS
+specific.
+
+Can be changed at runtime (sctp init_max_timeo).
+
+``` c
+sctp_init_max_timeo = milliseconds
+```
+
+### sctp_hbinterval
+
+sctp heartbeat interval. Setting it to -1 will disable the heartbeats.
+Default: OS specific.
+
+Can be changed at runtime (sctp hbinterval) but it will affect only new
+associations.
+
+``` c
+sctp_hbinterval = milliseconds
+```
+
+### sctp_pathmaxrxt
+
+Maximum retransmission attempts per path (see also sctp_asocmaxrxt).
+Default: OS specific.
+
+Can be changed at runtime (sctp pathmaxrxt) but it will affect only new
+associations.
+
+``` c
+sctp_pathmaxrxt = number
+```
+
+### sctp_sack_delay
+
+Delay until an ACK is generated after receiving a packet. Default: OS
+specific.
+
+WARNING: a value higher than srto_min can cause a lot of retransmissions
+(and strange problems). A value higher than srto_max will result in very
+high connections instability. According to the standard the `sack_delay`
+value should be between 200 and 500 ms.
+
+Can be changed at runtime (sctp `sack_delay`) but it will affect only new
+associations.
+
+``` c
+sctp_sack_delay = milliseconds
+```
+
+### sctp_sack_freq
+
+Number of packets received before an ACK is sent (without waiting for
+the `sack_delay` to expire). Default: OS specific.
+
+Note: on linux with `lksctp` up to and including 1.0.9 is not possible to
+set this value (having it in the config will produce a warning on
+startup).
+
+Can be changed at runtime (sctp `sack_freq`) but it will affect only new
+associations.
+
+``` c
+sctp_sack_freq = number
+```
+
+### sctp_max_burst
+
+Maximum burst of packets that can be emitted by an association. Default:
+OS specific.
+
+Can be changed at runtime (sctp `max_burst`) but it will affect only new
+associations.
+
+``` c
+sctp_max_burst = number
+```
+
+## UDP Parameters
+
+### udp4_raw
+
+Enables raw socket support for sending UDP IPv4 datagrams (40-50%
+performance increase on linux multi-cpu).
+
+Possible values: `0` - disabled (default), `1` - enabled, `-1` auto.
+
+In "auto" mode it will be enabled if possible (sr started as root or
+with `CAP_NET_RAW`). `udp4_raw` can be used on Linux and FreeBSD. For other
+BSDs and Darwin one must compile with `-DUSE_RAW_SOCKS`. On Linux one
+should also set `udp4_raw_mtu` if the MTU on any network interface that
+could be used for sending is smaller than `1500`.
+
+The parameter can be set at runtime as long as sr was started with
+enough privileges (`core.udp4_raw`).
+
+``` c
+udp4_raw = on
+```
+
+### udp4_raw_mtu
+
+MTU value used for UDP IPv4 packets when udp4_raw is enabled. It should
+be set to the minimum MTU of all the network interfaces that could be
+used for sending. The default value is 1500. Note that on BSDs it does
+not need to be set (if set it will be ignored, the proper MTU will be
+used automatically by the kernel). On Linux it should be set.
+
+The parameter can be set at runtime (`core.udp4_raw_mtu`).
+
+### udp4_raw_ttl
+
+TTL value used for UDP IPv4 packets when udp4_raw is enabled. By default
+it is set to auto mode (`-1`), meaning that the same TTL will be used as
+for normal UDP sockets.
+
+The parameter can be set at runtime (`core.udp4_raw_ttl`).
+
+## Blocklist Parameters
+
+### dst_blocklist_expire
+
+**Alias name:** **dst_blocklist_ttl**
+
+How much time a blocklisted destination will be kept in the blocklist
+(w/o any update).
+
+``` c
+dst_blocklist_expire = time in s (default 60 s)
+```
+
+### dst_blocklist_gc_interval
+
+How often the garbage collection will run (eliminating old, expired
+entries).
+
+``` c
+dst_blocklist_gc_interval = time in s (default 60 s)
+```
+
+### dst_blocklist_init
+
+If off, the blocklist is not initialized at startup and cannot be
+enabled at runtime, this saves some memory.
+
+``` c
+dst_blocklist_init = on | off (default on)
+```
+
+### dst_blocklist_mem
+
+Maximum shared memory amount used for keeping the blocklisted
+destinations.
+
+``` c
+dst_blocklist_mem = size in Kb (default 250 Kb)
+```
+
+### use_dst_blocklist
+
+Enable the destination blocklist: Each failed send attempt will cause
+the destination to be added to the blocklist. Before any send, this
+blocklist will be checked and if a match is found, the send is no longer
+attempted (an error is returned immediately).
+
+Note: using the blocklist incurs a small performance penalty.
+
+See also `doc/dst_blocklist.txt`.
+
+``` c
+use_dst_blocklist = on | off (default off)
+```
+
+## Real-Time Parameters
+
+### real_time
+
+Sets real time priority for all the Kamailio processes, or the timers
+(bitmask).
+
+       Possible values:   0  - off
+                          1  - the "fast" timer
+                          2  - the "slow" timer
+                          4  - all processes, except the timers
+
+Example: `real_time= 7` => everything switched to real time priority.
+
+``` c
+real_time = <int> (flags) (default off)
+```
+
+### rt_policy
+
+Real time scheduling policy, `0 = SCHED_OTHER`, `1= SCHED_RR` and
+`2=SCHED_FIFO`
+
+``` c
+rt_policy= <0..3> (default 0)
+```
+
+### rt_prio
+
+Real time priority used for everything except the timers, if `real_time`
+is enabled.
+
+``` c
+rt_prio = <int> (default 0)
+```
+
+### rt_timer1_policy
+
+**Alias name:** **rt_ftimer_policy**
+
+Like `rt_policy` but for the "fast" timer.
+
+``` c
+rt_timer1_policy=<0..3> (default 0)
+```
+
+### rt_timer1_prio
+
+**Alias name:** **rt_fast_timer_prio, rt_ftimer_prio**
+
+Like `rt_prio` but for the "fast" timer process (if `real_time & 1`).
+
+``` c
+rt_timer1_prio=<int> (default 0)
+```
+
+### rt_timer2_policy
+
+**Alias name:** **rt_stimer_policy**
+
+Like `rt_policy` but for the "slow" timer.
+
+``` c
+rt_timer2_policy=<0..3> (default 0)
+```
+
+### rt_timer2_prio
+
+**Alias name:** **rt_stimer_prio**
+
+Like `rt_prio` but for the "slow" timer.
+
+``` c
+rt_timer2_prio=<int> (default 0)
+```
+
+## Core Functions
+
+Functions exported by core that can be used in route blocks.
+
+### add_local_rport
+
+Add **rport** parameter to local generated Via header -- see RFC3581. In
+effect for forwarded SIP requests.
+
+Example of usage:
+
+``` c
+add_local_rport();
+```
+
+### avpflags
+
+### break
+
+'break' statement can be used to end a 'case' block in a 'switch'
+statement or exit from a 'while' statement.
+
+### drop
+
+Stop the execution of the configuration script and alter the implicit
+action which is done afterwards.
+
+If the function is called in a 'branch_route' then the branch is
+discarded (implicit action for 'branch_route' is to forward the
+request).
+
+If the function is called in the default 'onreply_route' then you can
+drop any response. If the function is called in a named 'onreply_route'
+(transaction stateful) then any provisional reply is discarded.
+(Implicit action for 'onreply_route' is to send the reply upstream
+according to Via header.)
+
+Example of usage:
+
+``` c
+onreply_route {
+    if(status=="200") {
+        drop(); # this works
+    }
+}
+
+onreply_route[FOOBAR] {
+    if(status=="200") {
+        drop(); # this is ignored
+    }
+}
+```
+
+### exit
+
+Stop the execution of the configuration script -- it has the same
+behaviour as return(0). It does not affect the implicit action to be
+taken after script execution.
+
+``` c
+request_route {
+    if (route(ABC)) {
+    xlog("L_NOTICE","method $rm is INVITE\n");
+    } else {
+    xlog("L_NOTICE","method is $rm\n");
+    }
+}
+
+route[ABC] {
+    if (is_method("INVITE")) {
+    return(1);
+    } else if (is_method("REGISTER")) {
+    return(-1);
+    } else if (is_method("MESSAGE")) {
+    sl_send_reply("403","IM not allowed");
+    exit;
+    }
+}
+```
+
+### error
+
+``` c
+error("p1", "p2");
+```
+
+Not properly implemented yet - prints a log messages with the two string parameters.
+
+### exec
+
+Basic implementation of executing an external application with C `system()`
+function. Look also at the functions exported by `exec` module.
+
+``` c
+exec("/path/to/app");
+```
+
+### force_rport()
+
+The `force_rport()` adds the rport parameter to the first Via header of the
+received message. Thus, Kamailio will add the received port to the top
+most Via header in the SIP message, even if the client does not indicate
+support for rport. This enables subsequent SIP messages to return to the
+proper port later on in a SIP transaction.
+
+This is useful for NAT traversal, to enforce symmetric response
+signaling.
+
+The rport parameter is defined in RFC 3581.
+
+Note: there is also a `force_rport` parameter which changes the global
+behavior of the SIP proxy.
+
+Example of usage:
+
+``` c
+force_rport();
+```
+
+### add_rport
+
+Alias for force_rport();
+
+### force_send_socket
+
+Force to send the message from the specified socket (it **must** be one
+of the sockets specified with the `listen` directive). If the protocol
+doesn't match (e.g. UDP message "forced" to a TCP socket) the closest
+socket of the same protocol is used.
+
+This function does not support pseudo-variables, use the `set_send_socket()`
+function from the corex module instead.
+
+Example of usage:
+
+``` c
+force_send_socket(10.10.10.10:5060);
+force_send_socket(udp:10.10.10.10:5060);
+```
+
+### force_tcp_alias
+
+**Alias name:** **add_tcp_alias**
+
+`force_tcp_alias(port)`
+
+adds a tcp port alias for the current connection (if tcp). Useful if you
+want to send all the traffic to port_alias through the same connection
+this request came from (it could help for firewall or nat traversal).
+With no parameters adds the port from the message via as the alias. When
+the "aliased" connection is closed (e.g. it's idle for too much time),
+all the port aliases are removed.
+
+### forward
+
+Forward in stateless mode the SIP request to destination address set in `$du`
+or `$ru`.
+
+Example of usage:
+
+``` c
+$du = "sip:10.0.0.10:5060;transport=tcp";
+forward();
+```
+
+### isavpflagset
+
+### isflagset
+
+Test if a flag is set for current processed message (if the flag value
+is 1). The value of the parameter can be in range of 0..31.
+
+For more see:
+
+- [Kamailio - Flag Operations](../../tutorials/kamailio-flag-operations.md)
+
+Example of usage:
+
+``` c
+if(isflagset(3)) {
+    log("flag 3 is set\n");
+};
+```
+
+Kamailio also supports named flags. They have to be declared at the
+beginning of the config file with:
+
+``` shell
+     flags  flag1_name[:position],  flag2_name ...
+```
+
+Example:
+
+``` c
+flags test, a:1, b:2 ;
+request_route {
+    setflag(test);
+    if (isflagset(a)){ # equiv. to isflagset(1)
+        ....
+    }
+    resetflag(b);  # equiv. to resetflag(2)
+```
+
+### is_int
+
+Checks if a pseudo variable argument contains integer value.
+
+``` c
+if(is_int("$avp(foobar)")) {
+    log("foobar contains an integer\n");
+}
+```
+
+### log
+
+Write text message to standard error terminal or syslog. You can specify
+the log level (the integer id) as first parameter.
+
+The parameters are static values. If you want dynamic parameters with
+variables, look at `xlog` module.
+
+For more see:
+
+- [https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages](https://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages)
+
+Example of usage:
+
+``` c
+log("just some text message\n");
+log(1, "another text message\n");
+```
+
+### prefix
+
+Add the string parameter in front of username in R-URI.
+
+Example of usage:
+
+``` c
+prefix("00");
+```
+
+### resetavpflag
+
+### resetflag
+
+### return
+
+The return() function allows you to return any integer value from a
+called route() block. You can test the value returned by a route using
+`$retcode` variable (which is same as `$rc` or `$?`).
+
+`return(0)` is same as [`exit()`](#exit);
+
+In logical evaluation expressions:
+
+- Negative is FALSE
+- Positive is TRUE
+
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
+
+Example usage:
+
+``` c
+request_route {
+    if (route(RET)) {
+        xlog("L_NOTICE","method $rm is INVITE\n");
+    } else {
+        xlog("L_NOTICE","method $rm is REGISTER\n");
+    };
+}
+
+route[RET] {
+    if (is_method("INVITE")) {
+        return(1);
+    } else if (is_method("REGISTER")) {
+        return(-1);
+    } else {
+        return(0);
+    };
+}
+```
+
+IMPORTANT: do not compare route block or module function execution in a condition
+with the value of the return code. Next example is showing a wrong use:
+
+``` c
+request_route {
+    if (route(RET) == -2) {
+    xinfo("return is -2\n");
+    } else {
+    xinfo("return is not -2\n"); ### THIS IS GOING TO BE EXECUTED
+    }
+}
+
+route[RET] {
+    return -2;
+}
+```
+
+See also the FAQ for how the function return code is evaluated:
+
+- [Frequently Asked Questions](../tutorials/../../tutorials/faq/main.md#how-is-the-function-return-code-evaluated)
+
+Note: starting with version `5.7.0-dev`, this behaviour can be changed with
+`return_mode` global parameter.
+
+### return_mode
+
+Control the return code evaluation mode:
+
+- 0 (default) - evaluation is like so far (negative is false, positive is true)
+- 1 - propagate return value and evaluation has to be done with `>0` or `<0`, otherwise
+  `value!=0` is evaluated to true no matter is negative or positive
+
+### revert_uri
+
+Set the R-URI to the value of the R-URI as it was when the request was
+received by server (undo all changes of R-URI).
+
+Example of usage:
+
+``` c
+      revert_uri();
+```
+
+### rewritehostport
+
+**Alias name:** **sethostport, sethp**
+
+Rewrite the domain part and port of the R-URI with the value of
+function's parameter. Other parts of the R-URI like username and URI
+parameters remain unchanged.
+
+Example of usage:
+
+``` c
+      rewritehostport("1.2.3.4:5080");
+```
+
+### rewritehostporttrans
+
+**Alias name:** **sethostporttrans, sethpt**
+
+Rewrite the domain part and port of the R-URI with the value of
+function's parameter. Also allows to specify the transport parameter.
+Other parts of the R-URI like username and URI parameters remain
+unchanged.
+
+Example of usage:
+
+      rewritehostporttrans("1.2.3.4:5080");
+
+### rewritehost
+
+**Alias name:** **sethost, seth**
+
+Rewrite the domain part of the R-URI with the value of function's
+parameter. Other parts of the R-URI like username, port and URI
+parameters remain unchanged.
+
+Example of usage:
+
+      rewritehost("1.2.3.4");
+
+### rewriteport
+
+**Alias name:** **setport, setp**
+
+Rewrites/sets the port part of the R-URI with the value of function's
+parameter.
+
+Example of usage:
+
+      rewriteport("5070");
+
+### rewriteuri
+
+**Alias name:** **seturi**
+
+Rewrite the request URI.
+
+Example of usage:
+
+      rewriteuri("sip:[email protected]");
+
+### rewriteuserpass
+
+**Alias name:** **setuserpass, setup**
+
+Rewrite the password part of the R-URI with the value of function's
+parameter.
+
+Example of usage:
+
+      rewriteuserpass("my_secret_passwd");
+
+### rewriteuser
+
+**Alias name:** **setuser, setu**
+
+Rewrite the user part of the R-URI with the value of function's
+parameter.
+
+Example of usage:
+
+      rewriteuser("newuser");
+
+### route()
+
+Execute route block given in parameter. Parameter may be name of the
+block or a string valued expression.
+
+Examples of usage:
+
+      route(REGISTER_REQUEST);
+      route(@received.proto + "_proto_" + $var(route_set));
+
+### selval
+
+Select a value based on conditional expression.
+
+Prototype:
+
+``` c
+selval(evalexpr, valexp1, valexpr2)
+```
+
+This is a core statement that return the 2nd parameter if the 1st
+parameter is evaluated to true, or 3rd parameter if the 1st parameter is
+evaluated to false. It can be considered a core function that is
+equivalent of ternary condition/operator
+
+Example:
+
+``` c
+$var(x) = selval($Ts mod 2, "true/" + $ru, "false/" + $rd);
+```
+
+The first parameter is a conditional expression, like those used for IF,
+the 2nd and 3rd parameters can be expressions like those used in the
+right side of assignments.
+
+### set_advertised_address
+
+Same as `advertised_address` but it affects only the current message. It
+has priority if `advertised_address` is also set.
+
+Example of usage:
+
+      set_advertised_address("kamailio.org");
+
+### set_advertised_port
+
+Same as `advertised_port` but it affects only the current message. It
+has priority over `advertised_port`.
+
+Example of usage:
+
+      set_advertised_port(5080);
+
+### set_forward_no_connect
+
+The message will be forwarded only if there is already an existing
+connection to the destination. It applies only to connection oriented
+protocols like TCP and TLS (TODO: SCTP), for UDP it will be ignored. The
+behavior depends in which route block the function is called:
+
+- normal request route: affects stateless forwards and tm. For tm it
+    affects all the branches and the possible retransmissions (in fact
+    there are no retransmission for TCP/TLS).
+
+<!-- -->
+
+- `onreply_route[0]` (stateless): equivalent to `set_reply_*()` (it's
+    better to use `set_reply_*` though)
+
+<!-- -->
+
+- `onreply_route[!=0]` (tm): ignored
+
+<!-- -->
+
+- branch_route: affects the current branch only (all messages sent on
+    this branch, like possible retransmissions and CANCELs).
+
+<!-- -->
+
+- onsend_route: like branch route
+
+Example of usage:
+
+      route {
+        ...
+        if (lookup()) {
+          //requests to local users. They are usually behind NAT so it does not make sense to try
+          //to establish a new TCP connection
+          set_forward_no_connect();
+          t_relay();
+        }
+        ...
+      }
+
+### set_forward_close
+
+Try to close the connection (the one on which the message is sent out)
+after forwarding the current message. Can be used in same route blocks
+as `set_forward_no_connect()`.
+
+Note: Use with care as you might not receive the replies anymore as the
+connection is closed.
+
+### set_reply_no_connect
+
+Like `set_forward_no_connect()`, but for replies to the current message
+(local generated replies and replies forwarded by tm). The behavior
+depends in which route block the function is called:
+
+- normal request route: affects all replies sent back on the
+  transaction (either local or forwarded) and all local stateless
+  replies (`sl_reply()`).
+
+<!-- -->
+
+- `onreply_route`: affects the current reply (so the send_flags set in
+    the `onreply_route` will be used if the reply for which they were set
+    is the winning final reply or it's a provisional reply that is
+    forwarded)
+
+<!-- -->
+
+- branch_route: ignored.
+
+<!-- -->
+
+- onsend_route: ignored
+
+Example of usage:
+
+``` c
+      route[4] {
+        //requests from local users. There are usually behind NAT so it does not make sense to try
+        //to establish a new TCP connection for the replies
+        set_reply_no_connect();
+        // do authentication and call routing
+        ...
+      }
+```
+
+### set_reply_close
+
+Like `set_reply_no_connect`, but closes the TCP connection after sending.
+Can be used in same route blocks as `set_reply_no_connect`.
+
+Example of usage:
+
+``` c
+      route {
+        ...
+        if (...caller-is-not-registered...) {
+          // reject unregistered client
+          // if request was received via TCP/TLS close the connection, as
+          // this may trigger re-registration of the client.
+          set_reply_close();
+          sl_send_reply("403","REGISTER first");
+          exit;
+        }
+        ...
+      }
+```
+
+### setavpflag
+
+### setflag
+
+Set a flag for current processed message. The value of the parameter can
+be in range of 0..31. The flags are used to mark the message for special
+processing (e.g., accounting) or to keep some state (e.g., message
+authenticated).
+
+For more see:
+
+- [Kamailio - Flag Operations](../../tutorials/kamailio-flag-operations.md)
+
+Example of usage:
+
+      setflag(3);
+
+### strip
+
+Strip the first N-th characters from username of R-URI (N is the value
+of the parameter).
+
+Example of usage:
+
+      strip(3);
+
+### strip_tail
+
+Strip the last N-th characters from username of R-URI (N is the value of
+the parameter).
+
+Example of usage:
+
+    strip_tail(3);
+
+### udp_mtu_try_proto(proto)
+
+- proto - `TCP|TLS|SCTP|UDP` - like `udp_mtu_try_proto` global
+  parameter but works on a per packet basis and not globally.
+
+Example:
+
+    if($rd=="10.10.10.10")
+        udp_mtu_try_proto(SCTP);
+
+### userphone
+
+Add `user=phone` parameter to R-URI.
+
+## Custom Global Parameters
+
+These are parameters that can be defined by the writer of kamailio.cfg
+in order to be used inside routing blocks. One of the important
+properties for custom global parameters is that their value can be
+changed at runtime via RPC commands, without restarting Kamailio.
+
+The definition of a custom global parameter must follow the pattern:
+
+    group.variable = value desc "description"
+
+The value can be a quoted string or integer number.
+
+Example:
+
+``` c
+pstn.gw_ip = "1.2.3.4" desc "PSTN GW Address"
+```
+
+The custom global parameter can be accessed inside a routing block via:
+
+    $sel(cfg_get.group.variable)
+
+Example:
+
+``` c
+$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
+```
+
+**Note:** Some words cannot be used as (part of) names for custom
+variables or groups, and if they are used a syntax error is logged by
+kamailio. Among these keywords: "yes", "true", "on", "enable", "no",
+"false", "off", "disable", "udp", "UDP", "tcp", "TCP", "tls", "TLS",
+"sctp", "SCTP", "ws", "WS", "wss", "WSS", "inet", "INET", "inet6",
+"INET6", "sslv23", "SSLv23", "SSLV23", "sslv2", "SSLv2", "SSLV2",
+"sslv3", "SSLv3", "SSLV3", "tlsv1", "TLSv1", "TLSV1"
+
+## Routing Blocks
+
+The routing blocks are the parts of the configuration file executed by
+kamailio at runtime. They can be seen as blocks of actions similar to
+functions (or procedures) from common programming languages.
+
+A routing block is identified by a specific token, followed by a name in
+between square brackets and actions in between curly braces.
+
+``` c
+route_block_id[NAME] {
+  ACTIONS
+}
+```
+
+The name can be any alphanumeric string, with specific routing blocks
+enforcing a particular format.
+
+🔥**IMPORTANT**: Note: `route(number)` is equivalent to `route("number")`.
+
+Route blocks can be executed on network events (e.g., receiving a SIP
+message), timer events (e.g., retransmission timeout) or particular
+events specific to modules.
+
+There can be so called sub-route blocks, which can be invoked from
+another route blocks, like a function. Invocation is done with `route`
+followed by the name of sub-route to execute, enclosed in between
+parentheses.
+
+Example:
+
+``` c
+  request_route{
+    ...
+    route("test");
+    ...
+  }
+
+  route["test"]{
+    ...
+  }
+```
+
+### request_route
+
+Request routing block - is executed for each SIP request.
+
+It contains a set of actions to be executed for SIP requests received
+from the network. It is the equivalent of `main()` function for
+handling the SIP requests.
+
+🔥**IMPORTANT**: For backward compatibility reasons, the main request
+`route` block can be identified by `route{...}` or
+`route[0]{...}`'.
+
+The implicit action after execution of the main route block is to drop
+the SIP request. To send a reply or forward the request, explicit
+actions (e.g., sl_send_reply(), forward(), t_relay()) must be called
+inside the route block.
+
+Example of usage:
+
+``` c
+    request_route {
+         if(is_method("OPTIONS")) {
+            # send reply for each options request
+            sl_send_reply("200", "ok");
+            exit();
+         }
+         route(FWD);
+    }
+    route[FWD] {
+         # forward according to uri
+         forward();
+    }
+```
+
+### route block
+
+This block is used to define 'sub-routes' - group of actions that can be
+executed from another routing block. Originally targeted as being
+executed from 'request_route', it can be executed now from all the other
+blocks. Be sure you put there the actions valid for the root routing
+block executing the sub-route.
+
+The definition of the sub-route block follows the general rules, with a
+name in between square brackets and actions between curly braces. A
+sub-route can return an integer value back to the routing block that
+executed it. The return code can be retrieved via $rc variables.
+
+Evaluation of the return of a subroute is done with following rules:
+
+- negative value is evaluated as false
+- 0 - is interpreted as **exit**
+- positive value is evaluated as true
+
+``` c
+request_route {
+  if(route(POSITIVE)) {
+    xlog("return number is positive\n");
+  }
+  if( ! route(NEGATIVE)) {
+    xlog("return number is negative\n");
+  }
+  if( route(ZERO)) {
+    xlog("this log message does not appear\n");
+  }
+}
+
+route[POSITIVE] {
+  return 10;
+}
+
+route[NEGATIVE] {
+  return -8;
+}
+
+route[ZERO] {
+  return 0;
+}
+```
+
+A sub-route can execute another sub-route. There is a limit to the
+number of recursive levels, avoiding ending up in infinite loops -- see
+**max_recursive_level** global parameter.
+
+The sub-route blocks allow to make the configuration file modular,
+simplifying the logic and helping to avoid duplication of actions.
+
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
+### branch_route
+
+Request's branch routing block. It contains a set of actions to be taken
+for each branch of a SIP request. It is executed only by TM module after
+it was armed via `t_on_branch("branch_route_index")`.
+
+Example of usage:
+
+``` c
+    request_route {
+        lookup("location");
+        t_on_branch("OUT");
+        if(!t_relay()) {
+            sl_send_reply("500", "relaying failed");
+        }
+    }
+    branch_route[OUT] {
+        if(uri=~"10\.10\.10\.10") {
+            # discard branches that go to 10.10.10.10
+            drop();
+        }
+    }
+```
+
+### failure_route
+
+Failed transaction routing block. It contains a set of actions to be
+taken each transaction that received only negative replies (`>=300`) for
+all branches. The `failure_route` is executed only by TM module after it
+was armed via `t_on_failure("failure_route_index")`.
+
+Note that in `failure_route` is processed the request that initiated the
+transaction, not the reply .
+
+Example of usage:
+
+``` c
+    request_route {
+        lookup("location");
+        t_on_failure("TOVOICEMAIL");
+        if(!t_relay()) {
+            sl_send_reply("500", "relaying failed");
+        }
+    }
+    failure_route[TOVOICEMAIL] {
+        if(is_method("INVITE")) {
+             # call failed - relay to voice mail
+             t_relay_to_udp("voicemail.server.com","5060");
+        }
+    }
+```
+
+### reply_route
+
+Main SIP response (reply) handling block - it contains a set of actions
+to be executed for SIP replies. It is executed for all replies received
+from the network.
+
+It does not have a name and it is executed by the core, before any other
+module handling the SIP reply. It is triggered only by SIP replies
+received on the network.
+
+There is no network route that can be enforced for a SIP reply - it is
+sent based on Via header, according to SIP RFC3261 - therefore no
+dedicated actions for forwarding the reply must be used in this block.
+
+This routing block is optional, if missing, the SIP reply is sent to the
+address in 2nd Via header.
+
+One can decide to drop a SIP reply by using **drop** action.
+
+Example:
+
+``` c
+reply_route {
+  if(status=="128") {
+    drop;
+  }
+}
+```
+
+🔥**IMPORTANT**: Note: In reply_route, if the last executed function fails, the SIP response processing is considered unsuccessful, and kamailio will not relay the reply. To ensure proper relay of the SIP response, make sure the last command in reply_route is either a **successful** function or a **return** statement.
+
+🔥**IMPORTANT**: Note: for backward compatibility reasons, the main `reply`
+routing block can be also identified by `onreply_route {...}` or
+`onreply_route[0] {...}`.
+
+### onreply_route
+
+SIP reply routing block executed by **tm** module. It contains a set of
+actions to be taken for SIP replies in the context of an active
+transaction.
+
+The `onreply_route` must be armed for the SIP requests whose replies
+should be processed within it, via `t_on_reply`("`onreply_route_index`").
+
+Core 'reply_route' block is executed before a possible **tm**
+'onreply_route' block.
+
+``` c
+  request_route {
+      lookup("location");
+      t_on_reply("LOGRPL");
+      if(!t_relay()) {
+          sl_send_reply("500", "relaying failed");
+      }
+  }
+
+  reply_route {
+      if(!t_check_trans()) {
+          drop;
+      }
+  }
+
+  onreply_route[LOGRPL] {
+      if(status=~"1[0-9][0-9]") {
+           log("provisional response\n");
+      }
+  }
+```
+
+### onsend_route
+
+The route is executed in when a SIP request is sent out. Only a limited
+number of commands are allowed (`drop`, `if` + all the checks, msg flag
+manipulations, `send()`, `log()`, `textops::search()`).
+
+In this route the final destination of the message is available and can
+be checked (with `snd_ip`, `snd_port`, `to_ip`, `to_port`, `snd_proto`, `snd_af`).
+
+This route is executed only when forwarding requests - it is not
+executed for replies, retransmissions, or locally generated messages
+(e.g. via fifo uac).
+
+Example:
+
+``` c
+  onsend_route {
+    if(to_ip==1.2.3.4 && !isflagset(12)){
+      log(1, "message blocked\n");
+      drop;
+    }
+  }
+```
+
+- snd_ip, snd_port - behave like src_ip/src_port, but contain the
+  ip/port Kamailio will use to send the message
+- to_ip, to_port - like above, but contain the ip/port the message
+  will be sent to (not to be confused with dst_ip/dst_port, which are
+  the destination of the original received request: Kamailio's ip and
+  port on which the message was received)
+- snd_proto, snd_af - behave like proto/af but contain the
+  protocol/address family that Kamailio will use to send the message
+- msg:len - when used in an onsend_route, msg:len will contain the
+  length of the message on the wire (after all the changes in the
+  script are applied, Vias are added a.s.o) and not the lentgh of the
+  original message.
+
+### event_route
+
+Generic type of route executed when specific events happen.
+
+Prototype: `event_route[groupid:eventid]`
+
+- groupid - should be the name of the module that triggers the event
+- eventid - some meaningful short text describing the event
+
+#### Core Event Routes
+
+Implementations:
+
+- `event_route[core:worker-one-init]` - executed by core after the
+  first udp sip worker process executed the child_init() for all
+  modules, before starting to process sip traffic
+  * note that due to forking, other sip workers can get faster to
+    listening for sip traffic
+
+``` c
+event_route[core:worker-one-init] {
+        xlog("L_INFO","Hello world\n");
+}
+```
+
+- `event_route[core:msg-received]` - executed when a message is
+  received from the network. It runs with a faked request and makes
+  available the $rcv(key) variables to access what was received and
+  related attribtues.
+  * it has to be enabled with received_route_mode global parameter.
+    For usage via Kemi, set kemi.received_route_callback global
+    parameter.
+  * if drop is executed, the received message is no longer processed
+
+``` c
+event_route[core:msg-received] {
+  xlog("rcv on $rcv(af)/$rcv(proto): ($rcv(len)) [$rcv(buf)] from [$rcv(srcip):$rcv(srcport)] to [$rcv(rcvip):$rcv(rcvport)]\n");
+  if($rcv(srcip) == "1.2.3.4") {
+    drop;
+  }
+}
+```
+
+- `event_route[core:pre-routing]` - executed by core on receiving
+  SIP traffic before running request_route or reply_route.
+  * if drop is used, then the message is not processed further with
+    request_route or reply_route in the same process. This can be
+    useful together with sworker module which can delegate the
+    processing to another worker.
+
+``` c
+async_workers_group="name=reg;workers=4"
+...
+event_route[core:pre-routing] {
+    xinfo("pre-routing rules\n");
+    if(is_method("REGISTER")) {
+        # delegate processing of REGISTERs to a special group of workers
+        if(sworker_task("reg")) {
+            drop;
+        }
+    }
+}
+```
+
+- `event_route[core:receive-parse-error]` - executed by core
+  on receiving a broken SIP message that can not be parsed.
+  * note that the SIP message is broken in this case, but it gets
+    access to source and local socket addresses (ip, port, proto,
+    af) as well as the whole message buffer and its size
+
+``` c
+event_route[core:receive-parse-error] {
+        xlog("got a parsing error from $si:$sp, message $mb\n");
+}
+
+```
+
+- `event_route[core:modinit-before]` - executed by core before the
+  module-init callbacks are run:
+
+``` c
+event_route[core:modinit-before] {
+    $shv(x) = 0;
+}
+```
+
+- `event_route[core:tkv]` - executed by core for events emitted with a
+type-key-value (mostly for catching error cases):
+
+``` c
+async_workers_group="name=tkv;workers=1;nonblock=0;usleep=0"
+async_tkv_gname = "tkv"
+async_tkv_evcb = "core:tkv"
+
+event_route[core:tkv] {
+    xlog("$atkv(type) / $atkv(key) / $atkv(val)\n");
+}
+```
+
+The event route is executed in an async worker process.
+
+#### Module Event Routes
+
+Here are only a few examples, to see if a module exports event_route
+blocks and when they are executed, check the readme of the module.
+
+- `event_route[htable:mod-init]` - executed by **htable** module
+    after all modules have been initialised. Good for initialising
+    values in hash tables.
+
+``` c
+modparam("htable", "htable", "a=>size=4;")
+
+event_route[htable:mod-init] {
+  $sht(a=>calls-to::10.10.10.10) = 0;
+  $sht(a=>max-calls-to::10.10.10.10) = 100;
+}
+
+request_route {
+  if(is_method("INVITE") && !has_totag())
+  {
+    switch($rd) {
+      case "10.10.10.10":
+        lock("calls-to::10.10.10.10");
+        $sht(a=>calls-to::10.10.10.10) =
+            $sht(a=>calls-to::10.10.10.10) + 1;
+        unlock("calls-to::10.10.10.10");
+        if($sht(a=>calls-to::10.10.10.10)>$sht(a=>max-calls-to::10.10.10.10))
+        {
+           sl_send_reply("500", "To many calls to .10");
+           exit;
+        }
+      break;
+      ...
+    }
+  }
+}
+```
+
+- `event_route[tm:local-request]` - executed on locally generated
+    requests.
+
+``` c
+event_route [tm:local-request] { # Handle locally generated requests
+  xlog("L_INFO", "Routing locally generated $rm to <$ru>\n");
+  t_set_fr(10000, 10000);
+}
+```
+
+- `event_route[tm:branch-failure]` - executed on all failure
+    responses.
+
+``` c
+request_route {
+    ...
+    t_on_branch_failure("myroute");
+    t_relay();
+}
+
+event_route[tm:branch-failure:myroute] {
+  xlog("L_INFO", "Handling $T_reply_code response to $rm to <$ru>\n");
+  if (t_check_status("430")) { # Outbound flow failed
+    unregister("location", "$tu", "$T_reply_ruid");
+    if (t_next_contact_flow()) {
+      t_relay();
+    }
+  }
+}
+```
+
+## Compatibility Modes
+
+With the merge of source trees from `Kamailio` and `SER` in 2008, there were
+some different behaviours in various module parameters and functions. To control
+the behaviour, the compatibility mode can be specified with `#!KAMAILIO` or
+`#!SER` at the beginning (first line) of the configuration file.
+
+The default mode is `#!KAMAILIO`.
+
+The parameters and functions that behave differently should have a note in their
+documentation.
+
+Note: the first line having `#!KAMAILIO` is also used to set the file type by
+extenssions in editors like `vim`, `vscode`, `atom`, `mcedit` or `emacs`.
+
+## Script Statements
+
+### if
+
+IF-ELSE statement
+
+Prototype:
+
+``` c
+    if(expr) {
+       actions;
+    } else {
+       actions;
+    }
+```
+
+The `expr` should be a valid logical expression.
+
+The logical operators that can be used in `expr`:
+
+- `==`:      equal
+- `!=`:      not equal
+- `=~`:      case-insensitive regular expression matching: Note: Posix regular expressions will be used, e.g. use `[[:digit:]]{3}` instead of `\d\d\d`
+- `!~`:      regular expression not-matching (NOT PORTED from Kamailio 1.x, use `!(x =~ y)`)
+- `>`:       greater
+- `>=`:      greater or equal
+- `<`:       less
+- `<=`:      less or equal
+- `&&`:      logical AND
+- `||`:      logical OR
+- `!`:       logical NOT
+
+Example of usage:
+
+``` c
+      if(is_method("INVITE"))
+      {
+          log("this sip message is an invite\n");
+      } else {
+          log("this sip message is not an invite\n");
+      }
+```
+
+See also the FAQ for how the function return code is evaluated:
+
+- [How is the function code evaluated](../../tutorials/faq/main.md#how-is-the-function-return-code-evaluated)
+
+### switch
+
+SWITCH statement - it can be used to test the value of a pseudo-variable.
+
+NOTE: `break` can be used only to mark the end of a `case`
+branch (as it is in shell scripts).
+
+Example of usage:
+
+``` c
+    request_route {
+        route(1);
+        switch($retcode)
+        {
+            case -1:
+                log("process INVITE requests here\n");
+            break;
+            case 1:
+                log("process REGISTER requests here\n");
+            break;
+            case 2:
+            case 3:
+                log("process SUBSCRIBE and NOTIFY requests here\n");
+            break;
+            default:
+                log("process other requests here\n");
+        }
+
+        # switch of R-URI username
+        switch($rU)
+        {
+            case "101":
+                log("destination number is 101\n");
+            break;
+            case "102":
+                log("destination number is 102\n");
+            break;
+            case "103":
+            case "104":
+                log("destination number is 103 or 104\n");
+            break;
+            # cases with starting slash are regular expressions
+            case /"\+49.*":
+                log("destination number is germany\n");
+            break;
+            case /"\+33.*":
+                log("destination number is france\n");
+            break;
+            default:
+                log("unknown destination number\n");
+        }
+    }
+
+    route[1] {
+        if(is_method("INVITE"))
+        {
+            return(-1);
+        };
+        if(is_method("REGISTER"))
+            return(1);
+        }
+        if(is_method("SUBSCRIBE"))
+            return(2);
+        }
+        if(is_method("NOTIFY"))
+            return(3);
+        }
+        return(-2);
+    }
+```
+
+NOTE: take care while using `return` - `return(0)` stops the execution
+of the script.
+
+### while
+
+while statement - conditional loop
+
+Example of usage:
+
+``` c
+    $var(i) = 0;
+    while($var(i) < 10)
+    {
+        xlog("counter: $var(i)\n");
+        $var(i) = $var(i) + 1;
+    }
+```
+
+## Script Operations
+
+Assignments together with string and arithmetic operations can be done
+directly in configuration file.
+
+### Assignment
+
+Assignments can be done like in C, via `=` (equal). Among the
+pseudo-variables that can be used in left side of an assignment:
+
+- Unordered List Item AVPs - to set the value of an AVP
+- script variables `($var(...))` - to set the value of a script variable
+- shared variables (`$shv(...)`)
+- `$ru` - to set R-URI
+- `$rd` - to set domain part of R-URI
+- `$rU` - to set user part of R-URI
+- `$rp` - to set the port of R-URI
+- `$du` - to set dst URI
+- `$fs` - to set send socket
+- `$br` - to set branch
+- `$mf` - to set message flags value
+- `$sf` - to set script flags value
+- `$bf` - to set branch flags value
+
+    $var(a) = 123;
+
+For avp's there a way to remove all values and assign a single value in
+one statement (in other words, delete existing AVPs with same name, add
+a new one with the right side value). This replaces the `:=` assignment
+operator from kamailio `< 3.0`.
+
+``` c
+    $(avp(i:3)[*]) = 123;
+    $(avp(i:3)[*]) = $null;
+```
+
+### String Operations
+
+For strings, `+` is available to concatenate.
+
+``` c
+    $var(a) = "test";
+    $var(b) = "sip:" + $var(a) + "@" + $fd;
+```
+
+### Arithmetic Operations
+
+For numbers, one can use:
+
+- `+` : plus
+- `-` : minus
+- `/` : divide
+- `*` : multiply
+- `mod` : modulo (SER uses `%` instead of `mod`)
+- `|` : bitwise OR
+- `&` : bitwise AND
+- `^` : bitwise XOR
+- `~` : bitwise NOT
+- `<<` : bitwise left shift
+- `>>` : bitwise right shift
+
+Example:
+
+``` c
+$var(a) = 4 + ( 7 & ( ~2 ) );
+```
+
+NOTE: to ensure the priority of operands in expression evaluations do
+use **parenthesis**.
+
+Arithmetic expressions can be used in condition expressions.
+
+``` c
+if( $var(a) & 4 )
+    log("var a has third bit set\n");
+```
+
+## Operators
+
+1. type casts operators: `(int)`, `(str)`.
+2. string comparison: `eq`, `ne`
+3. integer comparison: `ieq`, `ine`
+
+Note: The names are not yet final (use them at your own risk). Future
+version might use `==`/`!=` only for ints (`ieq/ine`) and `eq/ne` for strings
+(under debate). They are almost equivalent to `==` or `!=`, but they force
+the conversion of their operands (`eq` to string and `ieq` to int), allowing
+among other things better type checking on startup and more
+optimizations.
+
+Non equivalent examples:
+
+`0 == ""` (true) is not equivalent to `0 eq ""` (false: it evaluates to `"0" eq ""`).
+
+`"a" ieq "b"` (true: `(int)"a" is 0` and `(int)"b" is 0`) is not equivalent to `"a" == "b"` (false).
+
+Note: internally `==` and `!=` are converted on startup to `eq/ne/ieq/ine`
+whenever possible (both operand types can be safely determined at start
+time and they are the same).
+
+- Kamailio tries to guess what the user wanted when operators that
+  support multiple types are used on different typed operands. In
+  general convert the right operand to the type of the left operand
+  and then perform the operation. Exception: the left operand is
+  undef. This applies to the following operators: `+`, `==` and `!=`.
+
+- Special case: undef as left operand:
+  For `+`: `undef + expr` -> `undef` is converted to string => "" + expr.
+  For `==` and `!=`:   `undef == expr` -> `undef` is converted to type_of expr.
+  If `expr` is `undef`, then `undef == undef` is `true` (internally is converted
+  to string).
+
+- expression evaluation changes: Kamailio will auto-convert to integer
+  or string in function of the operators:
+
+``` c
+    int(undef)==0,  int("")==0, int("123")==123, int("abc")==0
+    str(undef)=="", str(123)=="123"
+```
+
+- `defined expr` - returns true if expr is defined, and false if not.
+  Note: only a standalone avp or pvar can be
+  undefined, everything else is defined.
+- `strlen(expr)` - returns the lenght of expr evaluated as string.
+- `strempty(expr)` - returns true if expr evaluates to the empty
+  string (equivalent to expr=="").
+  Example: `if (defined $v && !strempty($v)) $len=strlen($v);`
+
+## Command Line Parameters
+
+Kamailio can be started with a set of command line parameters, providing
+more flexibility to control what is doing at runtime. Some of them can
+be quite useful when running on containerised environments.
+
+To see the the available command line parameters, run **kamailio -h**:
+
+``` c
+~# kamailio -h
+
+version: kamailio 5.8.3 (aarch64/linux) be1fe9
+Usage: kamailio [options]
+Options:
+    -a mode      Auto aliases mode: enable with yes or on,
+                  disable with no or off
+    --alias=val  Add an alias, the value has to be '[proto:]hostname[:port]'
+                  (like for 'alias' global parameter)
+    --atexit=val Control atexit callbacks execution from external libraries
+                  which may access destroyed shm memory causing crash on shutdown.
+                  Can be y[es] or 1 to enable atexit callbacks, n[o] or 0 to disable,
+                  default is no.
+    -A define    Add config pre-processor define (e.g., -A WITH_AUTH,
+                  -A 'FLT_ACC=1', -A 'DEFVAL="str-val"')
+    -b nr        Maximum OS UDP receive buffer size which will not be exceeded by
+                  auto-probing-and-increase procedure even if OS allows
+    -B nr        Maximum OS UDP send buffer size which will not be exceeded by
+                  auto-probing-and-increase procedure even if OS allows
+    -c           Check configuration file for syntax errors
+    --cfg-print  Print configuration file evaluating includes and ifdefs
+    -d           Debugging level control (multiple -d to increase the level from 0)
+    --debug=val  Debugging level value
+    -D           Control how daemonize is done:
+                  -D..do not fork (almost) anyway;
+                  -DD..do not daemonize creator;
+                  -DDD..daemonize (default)
+    -e           Log messages printed in terminal colors (requires -E)
+    -E           Log to stderr
+    -f file      Configuration file (default: /usr/local/etc/kamailio/kamailio.cfg)
+    -g gid       Change gid (group id)
+    -G file      Create a pgid file
+    -h           This help message
+    --help       Long option for `-h`
+    -I           Print more internal compile flags and options
+    -K           Turn on "via:" host checking when forwarding replies
+    -l address   Listen on the specified address/interface (multiple -l
+                  mean listening on more addresses). The address format is
+                  [proto:]addr_lst[:port][/advaddr],
+                  where proto=udp|tcp|tls|sctp,
+                  addr_lst= addr|(addr, addr_lst),
+                  addr=host|ip_address|interface_name and
+                  advaddr=addr[:port] (advertised address).
+                  E.g: -l localhost, -l udp:127.0.0.1:5080, -l eth0:5062,
+                  -l udp:127.0.0.1:5080/1.2.3.4:5060,
+                  -l "sctp:(eth0)", -l "(eth0, eth1, 127.0.0.1):5065".
+                  The default behaviour is to listen on all the interfaces.
+    --loadmodule=name load the module specified by name
+    --log-engine=log engine name and data
+    -L path      Modules search path (default: /usr/local/lib64/kamailio/modules)
+    -m nr        Size of shared memory allocated in Megabytes
+    --modparam=modname:paramname:type:value set the module parameter
+                  type has to be 's' for string value and 'i' for int value,
+                  example: --modparam=corex:alias_subdomains:s:kamailio.org
+    --all-errors Print details about all config errors that can be detected
+    -M nr        Size of private memory allocated, in Megabytes
+    -n processes Number of child processes to fork per interface
+                  (default: 8)
+    -N           Number of tcp child processes (default: equal to `-n')
+    -O nr        Script optimization level (debugging option)
+    -P file      Create a pid file
+    -Q           Number of sctp child processes (default: equal to `-n')
+    -r           Use dns to check if is necessary to add a "received="
+                  field to a via
+    -R           Same as `-r` but use reverse dns;
+                  (to use both use `-rR`)
+    --server-id=num set the value for server_id
+    --subst=exp set a subst preprocessor directive
+    --substdef=exp set a substdef preprocessor directive
+    --substdefs=exp set a substdefs preprocessor directive
+    -S           disable sctp
+    -t dir       Chroot to "dir"
+    -T           Disable tcp
+    -u uid       Change uid (user id)
+    -v           Version number
+    --version    Long option for `-v`
+    -V           Alternative for `-v`
+    -x name      Specify internal manager for shared memory (shm)
+                  - can be: fm, qm or tlsf
+    -X name      Specify internal manager for private memory (pkg)
+                  - if omitted, the one for shm is used
+    -Y dir       Runtime dir path
+    -w dir       Change the working directory to "dir" (default: "/")
+    -W type      poll method (depending on support in OS, it can be: poll,
+                  epoll_lt, epoll_et, sigio_rt, select, kqueue, /dev/poll)
+```
+
+### Log Engine CLI Parameter
+
+The **--log-engine** parameter allows to specify what logging engine to
+be used, which is practically about the format of the log messages. If
+not set at all, then Kamailio does the classic style of line-based plain
+text log messages.
+
+The value of this parameter can be **--log-engine=name** or
+**--log-engine=name:data**.
+
+The name of the log engine can be:
+
+- **json** - write logs in structured JSON format
+  * the **data** for **json** log engine can be a set of character
+        flags:
+    + **a** - add log prefix as a special field
+    + **A** - do not add log prefix
+    + **c** - add Call-ID (when available) as a dedicated JSON attribute
+    + **j** - the log prefix and message fields are printed in
+      JSON structure format, detecting if they are enclosed in
+      between **{ }** or adding them as a **text** field
+    + **M** - strip EOL (`\n`) from the value of the log message field
+    + **N** - do not add EOL at the end of JSON document
+    + **p** - the log prefix is printed as it is in the root json
+      document, it has to start with comma (**,**) and be a valid
+      set of json fields
+    + **U** - CEE (Common Event Expression) schema format -
+      [https://cee.mitre.org/language/1.0-beta1/core-profile.html](https://cee.mitre.org/language/1.0-beta1/core-profile.html)
+
+Example of JSON logs when running Kamailio with `--log-engine=json:M` :
+
+``` c
+    { "idx": 1, "pid": 18239, "level": "DEBUG", "module": "maxfwd", "file": "mf_funcs.c", "line": 74, "function": "is_maxfwd_present", "logprefix": "{1 1 OPTIONS [email protected]} ", "message": "value = 70 " }
+
+    { "idx": 1, "pid": 18239, "level": "DEBUG", "module": "core", "file": "core/socket_info.c", "line": 644, "function": "grep_sock_info", "logprefix": "{1 1 OPTIONS [email protected]} ", "message": "checking if host==us: 9==9 && [127.0.0.1] == [127.0.0.1]" }
+```
+
+Example config for printing log message with `j` flag:
+
+``` c
+xinfo("{ \"src_ip\": \"$si\", \"method\": \"$rm\", \"text\": \"request received\" }");
+```
+
+Example config for printing log messages with `p` flag:
+
+``` c
+log_prefix=", \"src_ip\": \"$si\", \"tv\": $TV(Sn), \"mt\": $mt, \"ua\": \"$(ua{s.escape.common})\", \"cseq\": \"$hdr(CSeq)\""
+```

+ 3753 - 0
docs/cookbooks/6.0.x/pseudovariables.md

@@ -0,0 +1,3753 @@
+# Pseudo-Variables
+
+Version: Kamailio SIP Server v6.0.x (stable)
+
+## Introduction
+
+The term `pseudo-variable` is used for special tokens that can be given
+as parameters to different script functions and they will be replaced
+with a value before the execution of the function.
+
+The beginning of a `pseudo-variable` is marked by the character `$`. If
+you want to have the character `$` just double it `$$`.
+
+There is a set of predefined pseudo-variables, which have the name
+composed from one or more characters, and special pseudo-variables that
+are references to dynamic fields (AVP and Headers).
+
+Pseudo-Variables are implemented by various modules, most of them are
+provided by **pv** (if there is no special reference to a module, expect
+that the pseudo-variable is provided by **pv** module).
+
+## Pseudo-variables usage
+
+Pseudo-variables can be used with many modules, among them:
+
+- acc
+- avpops
+- htable
+- http_async_client
+- textops
+- uac
+- xlog
+
+## The list of pseudo-variables
+
+Predefined pseudo-variables are listed in alphabetical order.
+
+### $$ - Pseudo-variable marker
+
+`$$` - represents the character `$`
+
+### $\_s(format) - Evaluate dynamic format
+
+**$\_s(format)** - returns the string after evaluating all
+pseudo-variables in format
+
+        $var(x) = "sip:" + $rU + "@" + $fd;
+
+        # is equivalent of:
+
+        $var(x) = $_s(sip:$rU@$fd);
+
+### $ai - URI in P-Asserted-Identity header
+
+**$ai** - reference to URI in request's P-Asserted-Identity header (see
+RFC 3325)
+
+### $adu - Auth Digest URI
+
+**$adu** - URI from Authorization or Proxy-Authorization header. This
+URI is used when calculating the HTTP Digest Response.
+
+### $aa - Auth algorithm
+
+**$aa** - algorithm from Authorization or Proxy-Authorization header.
+
+### $ar - Auth realm
+
+**$ar** - realm from Authorization or Proxy-Authorization header
+
+### $au - Auth username user
+
+**$au** - user part of username from Authorization or
+Proxy-Authorization header
+
+### $ad - Auth username domain
+
+**$ad** - domain part of username from Authorization or
+Proxy-Authorization header
+
+### $aU - Auth whole username
+
+**$aU** - whole username from Authorization or Proxy-Authorization
+header
+
+### $Au - Acc username and realm/domain
+
+**$Au** - username for accounting purposes. It's a selective pseudo
+variable (inherited from acc module). It returns the auth username and
+realm ($au@$ar) if it exists or From URI ($fu) otherwise.
+
+### $AU - Acc username
+
+**$AU** - username for accounting purposes. It's a selective pseudo
+variable (inherited from acc module). It returns the auth username ($au)
+if it exists or From user ($fU) otherwise.
+
+### $branch(name) - Branch attributes
+
+**$branch(name)** - reference to attribute 'name' of a branch
+
+This pseudo variable gives you access to the "additional branches" only,
+not to the "main branch". E.g. if there are 3 clients registered for the
+same AoR, after lookup() you will have one contact in the "main branch"
+and two "additional branches". Using $branch() you can access the
+additional branches, the main branch can be accessed using $ru and $du.
+(Note: In branch_routes there is no distinction between the main and the
+additional branches - the branch_route will be called once for each one
+of them.)
+
+The 'name' can be:
+
+- uri - return uri of the branch
+- dst_uri - return destination uri (next hop address)
+- path - return the path vector for the branch
+- q - return the q value of the branch as integer `0..100` (representing `q * 100`)
+- send_socket - return the socket to be used to send the branch
+- count - return the number of the branches
+- flags - return the branch flags value
+- ruid - return the ruid of the branch (Record internal Unique ID from
+    usrloc)
+
+The PV can take an index to access a specific branch:
+$(branch(name)\[index\])
+
+Example:
+
+``` c
+$var(i)=0;
+while($var(i)<$branch(count))
+{
+   xlog("$(branch(uri)[$var(i)])\n");
+   $var(i) = $var(i) + 1;
+}
+```
+
+Starting with 3.1.0, you can assign value per attribute. Index can be
+used to update a specific branch:
+
+``` c
+$(branch(attr)[index]) = value;
+```
+
+If index is missing, first branch is used. If index is -1 the last
+branch is used.
+
+Assigning $null to uri attribute will drop the branch, for the rest of
+attributes will just set the value to null.
+
+``` c
+$(branch(uri)[2]) = "sip:[email protected];transport=sctp";
+```
+
+### $br - Request's first branch
+
+**$br** - reference to request's first branch
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file (will add a new branch).
+
+### $bR - Request's all branches
+
+**$bR** - reference to request's all branches
+
+### $bf - Branch flags
+
+**$bf** - reference to branch flags of branch 0 (RURI) - decimal output
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $bF - Branch flags
+
+**$bF** - reference to branch flags of branch 0 (RURI) - hexa output
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $bs - Body size
+
+**$bs** - body size
+
+### $ci - Call-Id
+
+**$ci** - reference to the value of call-id header
+
+### $cl - Content-Length
+
+**$cl** - reference to the value of content-length header
+
+### $cnt(pv) - Count number of pvs
+
+**$cnt(avp)** - return the number of avps
+
+``` c
+xlog("$$avp(x) found $cnt($avp(x)) times\n");
+```
+
+**$cnt(xavp)** - return the number of xavps
+
+     * $cnt($xavp(key[*])) : number of XAVPs "key".
+     * $cnt($xavp(key[n]=>sub[*])) : number of children "sub" in XAVP "key[n]".
+     * $cnt($xavp(key[*]=>sub[*])) : total number of children "sub" in all XAVPs "key".
+
+     * $cnt($xavp(key[n])) : 1 or 0 (if this index exists or not).
+     * $cnt($xavp(key[-n])) : same but with reverse indexing (-1 is the last index).
+
+     * $cnt($xavp(key[*]=>sub[n])) : number of children "sub[n]" that exist in all XAPVs "key".
+
+     * $cnt($xavp(key)) is the same as $cnt($xavp(key[*])).
+     * $cnt($xavp(key=>sub)) is the same as $cnt($xavp(key[*]=>sub[*]))
+
+### $conid - TCP Connection ID
+
+**$conid** - The TCP connection ID of the connection the current message
+arrived on for TCP, TLS, WS, and WSS. Set to $null for SCTP and UDP.
+
+### $cs - CSeq Number
+
+**$cs** - reference to the sequence number in the CSeq header. The
+method in the CSeq header is identical to the request method, thus use
+$rm to get the method (works also for responses).
+
+### $csb - CSeq Header Body
+
+**$csb** - reference to the CSeq header body (number method).
+
+### $ct - Contact header
+
+**$ct** - reference to the value of contact header
+
+### $cts - Contact Header Star Status
+
+**$cts** - 1 - if Contact header has `*` value; 0 - otherwise
+
+### $ctu - Contact Header URI
+
+**$ctu** - reference to the URI part of the contact header
+
+### $cT - Content-Type
+
+**$cT** - reference to the value of content-type header
+
+### $dd - Domain of destination URI
+
+**$dd** - reference to domain of destination uri (without port)
+
+### $def(name) - Defined Value
+
+**$def(name)** - return a defined value.
+
+Example:
+
+``` c
+#!define ABC xyz
+
+xlog("FLT_ACC: $def(ABC)\n");
+```
+
+### $defn(name) - Defined Value As Number
+
+**$defn(name)** - return a defined value as a signed integer.
+
+Example:
+
+``` c
+#!define FLT_ACC 1
+
+xlog("FLT_ACC: $defn(FLT_ACC)\n");
+```
+
+### $di - Diversion header URI
+
+**$di** - reference to Diversion header URI
+
+### $dip - Diversion "privacy" parameter
+
+**$dip** - reference to Diversion header "privacy" parameter value
+
+### $dir - Diversion "reason" parameter
+
+**$dir** - reference to Diversion header "reason" parameter value
+
+### $dic - Diversion "counter" parameter
+
+**$dic** - reference to Diversion header "counter" parameter value
+
+### $dp - Port of destination URI
+
+**$dp** - reference to port of destination uri
+
+### $dP - Transport protocol of destination URI
+
+**$dP** - reference to transport protocol of destination uri
+
+### $ds - Destination set
+
+**$ds** - reference to destination set
+
+### $du - Destination URI
+
+**$du** - reference to destination uri
+
+If loose_route() returns TRUE a destination uri is set according to the
+first Route header. $du is also set if lookup() function of 'registrar'
+module finds contact(s) behind NAT or if you use the path functionality.
+The function handle_ruri_alias() from the nathelper module will also set
+it. You can set $du to any SIP URI.
+
+     sip:kamailio.org
+     sip:pbx123.kamailio.org;transport=udp
+     sip:[2001:DB8::33:2]:5980;transport=tls
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+To reset $du:
+
+    $du = $null;
+
+### $Eb - Back Slash
+
+Return `\`.
+
+### $En - LF
+
+Return `\n`.
+
+### $En - CR
+
+Return `\r`.
+
+### $Et - Tab
+
+Return `\t`.
+
+### $Es - Space
+
+Return ` `. <!-- markdownlint-disable MD038 -->
+
+### $Ec - Comma
+
+Return `,`.
+
+### $Eq - Double Quote
+
+Return `"`.
+
+### $Ek - Single Quote
+
+Return `'`.
+
+### $Ei - Colon
+
+Return `:`.
+
+### $Ej - Semicolon
+
+Return `;`.
+
+### $Ev - Back Tick
+
+Return `\``.
+
+### $fd - From URI domain
+
+**$fd** - reference to domain in URI of 'From' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+### $fn - From display name
+
+**$fn** - reference to display name of 'From' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+**NOTE:** _When using this along with $fu to change part of the message, applying them all at once can result in unintended side-effects. To ensure that the changes are applied to the message as intended, it is suggested to use the `msg_apply_changes()` function from the `textopsx` module after each change to the message. This function can ensure that the changes are applied correctly and that the message remains valid._
+
+Example:
+
+```c
+loadmodule "textopsx.so"
+...
+$fu = "sip:[email protected]"
+msg_apply_changes()
+$fn = "New Display Name"
+msg_apply_changes()
+...
+```
+
+**Recommendation**: Use `uac` module functions such as `uac_replace_from` for updating values reliably.
+
+[See FAQ for more info.](../../tutorials/faq/main.md#sip-message-processing)
+
+### $fs - Forced Send Socket
+
+**$fs** - reference to the forced send socket for the SIP message (if
+any) in the form "proto:ip:port". It is the socket from where Kamailio
+is going to send out the message.
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file). Transport proto can be omitted when assigning
+value, in which case it is taken from destination URI of the
+message.
+
+Example:
+
+``` c
+listen=udp:1.2.3.4:5060
+...
+$fs = "udp:1.2.3.4:5060";
+```
+
+### $fsn - Forced Send Socket Name
+
+**$fsn** - reference to the name of the forced send socket for the SIP
+message. The name can be assigned to this variable to select a send
+socket via its name.
+
+``` c
+listen=udp:1.2.3.4:5060 name "s1"
+...
+$fsn = "s1";
+...
+$fs = "udp:1.2.3.4:5060";
+xdbg("name for forced send socket: $fsn\n");
+```
+
+### $ft - From tag
+
+**$ft** - reference to tag parameter of 'From' header
+
+### $fti - Initial From tag
+
+**$fti** - reference to tag parameter of 'From' header as it was in the
+initial request (e.g., initial INVITE).
+
+The value From tag in the initial request can be in the To tag, if the
+request within the dialog is sent by the callee. This variable detects
+who sent the request within the dialog and returns the proper value that
+was in the From tag of the request initiating the dialog.
+
+It is exported by **rr** module and has to be used after loose_route().
+The append_fromtag parameter is required to be set to 1 in order to have
+this variable returning the right value.
+
+### $fu - From URI
+
+**$fu** - reference to URI of 'From' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+Note that changing the From: header may break backwards compatibility
+with SIP 1.0 devices.
+
+**NOTE:** _When using this along with $fn to change part of the message, applying them all at once can result in unintended side-effects. To ensure that the changes are applied to the message as intended, it is suggested to use the `msg_apply_changes()` function from the `textopsx` module after each change to the message. This function can ensure that the changes are applied correctly and that the message remains valid._
+
+Example:
+
+```c
+loadmodule "textopsx.so"
+...
+$fu = "sip:[email protected]"
+msg_apply_changes()
+$fn = "New Display Name"
+msg_apply_changes()
+...
+```
+
+**Recommendation**: Use `uac` module functions such as `uac_replace_from` for updating values reliably.
+
+[See FAQ for more info.](../../tutorials/faq/main.md#sip-message-processing)
+
+### $fU - From URI username
+
+**$fU** - reference to username in URI of 'From' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+Note that changing the From: header may break backwards compatibility
+with SIP 1.0 devices.
+
+### $fUl - From URI Username Length
+
+**$fUl** - length of the username in the From URI
+
+### $mb - SIP message buffer
+
+**$mb** - reference to SIP message buffer
+
+### $mbu - updated SIP message buffer
+
+**$mbu** - reference to updated SIP message buffer, after applying
+changes
+
+### $mf - Flags
+
+**$mf** - reference to message/transaction flags set for current SIP
+request
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $mF - Flags in hexadecimal
+
+**$mF** -reference to message/transaction flags set for current SIP
+request in hexa-decimal
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $mi - SIP message id
+
+**$mi** - reference to SIP message id
+
+### $ml - SIP message length
+
+**$ml** - reference to SIP message length
+
+### $mt - SIP Message Type
+
+**$mt** - returns 1 if the sip message is a request, returns 2 if the
+sip message is a reply
+
+### $od - Domain original R-URI
+
+**$od** - reference to domain in request's original R-URI
+
+### $op - Port in original R-URI
+
+**$op** - reference to port of original R-URI
+
+### $oP - Protocol of original R-URI
+
+**$oP** - reference to transport protocol of original R-URI
+
+### $ou - Original R-URI
+
+**$ou** - reference to request's original URI
+
+### $oU - Username in original R-URI
+
+**$oU** - reference to username in request's original URI
+
+### $oUl - Original R-URI Username Length
+
+**$oUl** - the length of the username in the original R-URI
+
+### $pd - Domain in P-Preferred-Identity header URI
+
+**$pd** - reference to domain in request's P-Preferred-Identity header
+URI (see RFC 3325)
+
+### $pn - Display Name in P-Preferred-Identity header
+
+**$pn** - reference to Display Name in request's P-Preferred-Identity
+header (see RFC 3325)
+
+### $pp - Process id
+
+**$pp** - reference to process id (pid)
+
+### $pr or $proto - Protocol of received message
+
+**$pr** or **$proto** - protocol of received message (udp, tcp, tls,
+sctp, ws, wss)
+
+### $prid - protocol id
+
+**$prid** - internal protocol id
+
+- 0 - NONE
+- 1 - UDP
+- 2 - TCP
+- 3 - TLS
+- 4 - SCTP
+- 5 - WS
+- 6 - WSS
+- 7 - OTHER
+
+### $pU - User in P-Preferred-Identity header URI
+
+**$pU** - reference to user in request's P-Preferred-Identity header URI
+(see RFC 3325)
+
+### $pu - URI in P-Preferred-Identity header
+
+**$pu** - reference to URI in request's P-Preferred-Identity header (see
+RFC 3325)
+
+### $rb - Body of request/reply
+
+**$rb** - reference to message body
+
+### $rc - Returned code
+
+**$rc** - reference to returned code by last invoked function
+
+**$retcode** - same as **$rc**
+
+Note that the value of $rc is overwritten by each new function call.
+
+Example of use:
+
+``` c
+    lookup("location");
+    $var(rc) = $rc;
+    if ($var(rc) < 0) {
+        t_newtran();
+        switch ($var(rc)) {
+            case -1:
+            case -3:
+                send_reply("404", "Not Found");
+                exit;
+            case -2:
+                send_reply("405", "Method Not Allowed");
+                exit;
+        }
+    }
+
+```
+
+### $rd - Domain in R-URI
+
+**$rd** - reference to domain in request's URI (without port) or to the
+Namespace Specific String of a URN (see RFC 2141)
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $rdir(key) - Request Direction
+
+**$rdir(key)** - get the direction of the request within dialog.
+
+The direction is 'downstream' if sent by the caller and 'upstream' if
+sent by callee.
+
+The key can be:
+
+- id - the returned value is an integer: 1 - for direction downstream,
+    2 - for direction upstream
+- name - the returned value is a string: 'downstream' or 'upstream'
+
+Example:
+
+``` c
+if($rdir(name)=="upstream") {
+  xlog("request was sent by callee\n");
+}
+```
+
+The variable is exported by **rr** module and append_fromtag parameter
+must be enabled. The variable has to be used after loose_route()
+function.
+
+### $re - Remote-Party-ID header URI
+
+**$re** - reference to Remote-Party-ID header URI
+
+### $rm - SIP method
+
+**$rm** - reference to request's method. Works also for replies (by
+using the CSeq header)
+
+### $rmid - SIP Method ID
+
+**$rmid** - returns internal integer representation of SIP method type
+
+### $route_uri - URI in first Route header
+
+**$route_uri** - returns the string with URI field in the first Route
+header
+
+### $rp - Port in R-URI
+
+**$rp** - reference to port of R-URI
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $rP - Protocol of R-URI
+
+**$rP** - reference to transport protocol of R-URI
+
+### $rr - SIP reply reason phrase
+
+**$rr** - reference to reply's reason phrase (the text after reply code)
+
+### $rs - SIP reply code
+
+**$rs** - reference to reply's status (status-code, response-code,
+reply-code)
+
+### $rt - Refer-to URI
+
+**$rt** - reference to URI of refer-to header
+
+### $ru - Request URI
+
+**$ru** - reference to request's URI (address in the first line of a SIP
+request)
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $rU - Username in R-URI
+
+**$rU** - reference to username in request's URI or to the Namespace
+Identifier of a URN (see RFC 2141)
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+### $rUl - R-URI Username Length
+
+**$rUl** - the length of the username in R-URI
+
+### $rv - SIP message version
+
+**$rv** - reference to SIP message (reply or request) version
+
+### $ruid - Record internal Unique ID
+
+**$ruid** - the Record internal Unique ID for the location record
+selected by calling registrar:lookup()
+
+### $rz - URI Scheme of R-URI
+
+**$rz** - returns R-URI scheme, possible values: sip, sips, tel, tels
+and urn, R-URI scheme parsing error should be reflected by value: none
+
+### $RAi - Received advertised IP address
+
+**$RAi** - reference to advertised IP address of the interface where the
+request has been received, or $Ri if no advertised address.
+
+### $RAp - Received advertised port
+
+**$RAp** - reference to advertised port where the request has been
+received, or $Rp if no advertised port.
+
+### $Ri - Received IP address
+
+**$Ri** - reference to IP address of the interface where the request has
+been received
+
+### $Rp - Received port
+
+**$Rp** - reference to the port where the message was received
+
+### $Rn - Received socket name
+
+**$Rn** - reference to the name of the socket where the message was
+received
+
+### $RAu - Advertised socket URI
+
+**$RAu** - local socket where the SIP messages was received in URI
+format, without transport parameter for UDP, using advertised address
+when available.
+
+### $RAut - Advertised socket URI
+
+**$RAut** - local socket where the SIP messages was received in URI
+format, always with transport parameter, using advertised address when
+available.
+
+### $Ru - Received socket URI
+
+**$Ru** - local socket where the SIP messages was received in URI
+format, without transport parameter for UDP.
+
+### $Rut - Received socket URI
+
+**$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:address:port).
+
+### $sbranch(attr) - Static Branch
+
+**$sbranch(attr)** - class of variables allowing to manage the values of
+attributes for static branch. The static branch is internal structure
+that is used by the functions sbranch_push_ruri() and sbranch_append()
+from **pv** module, enabling more flexibility in updating the R-URI
+(first) branch attributes as well as extra branches (e.g., for parallel
+forking).
+
+The **attr** can be any of the supported values for **$branch(attr)**
+class of variables -- see above for proper details.
+
+Example of usage:
+
+``` c
+sbranch_reset();
+$sbranch(uri) = "sip:127.0.0.1:5080";
+$sbranch(dst_uri) =  "sip:127.0.0.1:5090";
+$sbranch(path) =  "sip:127.0.0.1:5090, sip:127.0.0.1:5094";
+$sbranch(send_socket) =  "udp:127.0.0.1:5060";
+sbranch_set_ruri();
+```
+
+### $sf - Script flags
+
+**$sf** - reference to script flags - decimal output
+
+### $sF - Script flags
+
+**$sF** - reference to script flags - hexa output
+
+### $si - Source IP address
+
+**$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** - reference to IP source address of the message, with enclosing
+square brackets for IPv6
+
+### $sp - Source port
+
+**$sp** - reference to the source port of the message
+
+### $stat(name) - Statistics
+
+**$stat(name)** - return the value of statistic item specified by 'name'
+
+### $su - Source address as URI
+
+**$su** - returns the representation of source address (ip, port, proto)
+as SIP URI. If the proto is UDP, then it is not added (being the default
+transport protocol).
+
+Its value looks like:
+
+    "sip:ip:port" -- if proto is UDP
+    "sip:ip:port;transport=proto"  -- if proto is not UDP
+
+Note that WS and WSS are both represented by transport=ws, conforming
+with the IETF RFC for SIP over WebSocket.
+
+### $sut - Source address as full URI
+
+**$sut** - returns the representation of source address (ip, port,
+proto) as full SIP URI. The proto UDP is added also as transport
+parameter.
+
+Its value looks like:
+
+    "sip:ip:port;transport=proto"
+
+### $td - To URI Domain
+
+**$td** - reference to domain in URI of 'To' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+### $tn - To display name
+
+**$tn** - reference to display name of 'To' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+**NOTE:** _When using this along with $tu to change part of the message, applying them all at once can result in unintended side-effects. To ensure that the changes are applied to the message as intended, it is suggested to use the `msg_apply_changes()` function from the `textopsx` module after each change to the message. This function can ensure that the changes are applied correctly and that the message remains valid._
+
+Example:
+
+```c
+loadmodule "textopsx.so"
+...
+$tu = "sip:[email protected]"
+msg_apply_changes()
+$tn = "New Display Name"
+msg_apply_changes()
+...
+```
+
+**Recommendation**: Use `uac` module functions such as `uac_replace_to` for updating values reliably.
+
+[See FAQ for more info.](../../tutorials/faq/main.md#sip-message-processing)
+
+### $tt - To tag
+
+**$tt** - reference to tag parameter of 'To' header
+
+### $tti - Initial To tag
+
+**$tti** - reference to tag parameter of 'To' header as it was in the
+SIP response to the initial request (e.g., 200ok to the initial INVITE).
+
+The value To tag in the initial transaction can be in the From tag, if
+the request within the dialog is sent by the callee. This variable
+detects who sent the request within the dialog and returns the proper
+value that was in the To tag of the transaction initiating the dialog.
+
+It is exported by **rr** module and has to be used after loose_route().
+The append_fromtag parameter is required to be set to 1 in order to have
+this variable returning the right value.
+
+### $tu - To URI
+
+**$tu** - reference to URI of 'To' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+**NOTE:** _When using this along with $tn to change part of the message, applying them all at once can result in unintended side-effects. To ensure that the changes are applied to the message as intended, it is suggested to use the `msg_apply_changes()` function from the `textopsx` module after each change to the message. This function can ensure that the changes are applied correctly and that the message remains valid._
+
+Example:
+
+```c
+loadmodule "textopsx.so"
+...
+$fu = "sip:[email protected]"
+msg_apply_changes()
+$fn = "New Display Name"
+msg_apply_changes()
+...
+```
+
+**Recommendation**: Use `uac` module functions such as `uac_replace_to` for updating values reliably.
+
+[See FAQ for more info.](../../tutorials/faq/main.md#sip-message-processing)
+
+### $tU - To URI Username
+
+**$tU** - reference to username in URI of 'To' header
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file, but its value does not change)
+
+### $tUl - To URI Username Length
+
+**$tUl** - the length of the username in To URI
+
+### $Tb - Startup timestamp
+
+**$Tb** - reference to unix timestamp of the time at which kamailio was
+started (boot time)
+
+### $Tf - String formatted time - cached
+
+**$Tf** - reference string formatted time
+
+Note: the system time is retrieved only once for each processed SIP
+message. Subsequent calls of $Tf for same SIP message will return same
+value.
+
+### $TF - String formatted time - current
+
+**$TF** - reference string formatted time
+
+Note: the system time is computed for each call of $TF. Subsequent calls
+of $TF for same SIP message may return different values.
+
+### $Ts - Unix time stamp - cached
+
+**$Ts** - reference to unix time stamp
+
+Note: the system time is retrieved only once for each processed SIP
+message. Subsequent calls of $Ts for same SIP message will return same
+value.
+
+### $TS - Unix time stamp - current
+
+**$TS** - reference to unix time stamp
+
+Note: the system time is computed for each call of $TS. Subsequent calls
+of $TS for same SIP message may return different values.
+
+### $ua - User agent header
+
+**$ua** - reference to user agent header field
+
+### $version() - version
+
+**$version(num)** - version as number
+
+**$version(full)** - full version string "name version
+architecture/platform"
+
+**$version(hash)** - TBA
+
+## $env(NAME) - environment variables
+
+**$env(NAME)** - value of the environment variable named NAME
+
+Example:
+
+``` c
+xdbg("PATH environment variable:  $env(PATH)\n");
+```
+
+## $avp(id) - AVPs
+
+**$avp(id)** - the value of the AVP identified by 'id'.
+
+**$(avp(id)\[N\])** - represents the value of N-th AVP identified by
+'id'.
+
+The 'id' can be:
+
+- "\[(s\|i):\]name" - name is the id of an AVP; 's' and 'i' specifies
+    if the id is string or integer. If missing, it is considered to be
+    string.
+- "name" - the name is an AVP alias, or if the alias is not found, it
+    is a string name
+- pseudo variable - if value of pv is integer, id is integer, if
+    string, id is string
+
+$(avp(id)\[0\]) can be written in shorter form as $avp(id) and
+$avp(s:name) as $avp(name).
+
+AVPs are special variables that are attached to SIP transactions. It is
+a list of pairs (name,value). Before the transaction is created, the AVP
+list is attached to SIP request. Note that the AVP list works like a
+stack, last added value is retrieved first, and there can be many values
+for same AVP name, an assignment to the same AVP name does not overwrite
+old value, it will add the new value in the list.
+
+To delete the first AVP with name 'id' you have to assign to it '$null':
+
+``` c
+$avp(id) = $null;
+```
+
+To delete all the AVP with name 'id' you have to assign $null to the
+index '\*':
+
+``` c
+$(avp(id)[*]) = $null;
+```
+
+To overwrite the value of the AVP with name 'id' you have to assign the
+new value to the index '\*':
+
+``` c
+$(avp(id)[*]) = newvalue;
+```
+
+The value of an AVP can be integer or string. To assign a value as
+string, it has to be enclosed in double quotes. To assign the value as
+integer, it has to be a valid number given without quotes.
+
+Example of usage:
+
+``` c
+$avp(x) = 1;  # assign of integer value
+$avp(x) = 2;
+$avp(y) = "abc"; # assign of string value
+if($(avp(x)[1])==1) {
+  ...
+}
+$(avp(x)[1]) = $null;
+```
+
+It is R/W variable (you can assign values to it directly in
+configuration file).
+
+## $expires(key) - Expires Values
+
+Return the min and max of expires value for current SIP message. Contact
+headers are checked with higher priority, if no expires parameter there,
+then Expires header is used
+
+If none is found, $null is returned.
+
+Possible 'key' values:
+
+- $expires(min) - the minimum value for expires
+- $expires(max) - the maximum value for expires
+
+When there is only one expires value, then min and max return the same.
+
+Example of usage:
+
+``` c
+if($expires(max)!=$null) {
+    xlog("max expires value is: $expires(max)\n");
+}
+```
+
+## $xavp(id) - XAVPs
+
+**xavp** - eXtended AVPs - are variables that can store multiple values,
+which can also be grouped in a structure-like fashion. Their value can
+be a string, an integer number or a list of named values (child values).
+
+They work like a stack, similar to AVPs, and are attached to SIP
+transactions and automatically destroyed when the transaction is
+finished.
+
+Each xavp has a string name and can contain a string, an integer or a
+list of named values. The structure name (or root list name) and the
+value name (or field name, or child value name) are separated by => like
+$xavp(root=>field) where "root" is the name of the structure and "field"
+is the name of the (child) value.
+
+To assign a single value use:
+
+``` c
+$xavp(root)="string value";
+$xavp(root)=intnumber;
+```
+
+To assign a named value use:
+
+``` c
+$xavp(root=>field)="string value";
+$xavp(root=>field)=intnumber;
+```
+
+Like avps, xavp act like a stack. To refer to an existing value, use an
+index. The newest xavp has index zero \[0\].
+
+``` c
+$xavp(root[0]=>field)=12;
+```
+
+If you assign a value without an index, a new xavp is allocated and the
+old one is pushed up the stack, becoming index \[1\]. Old index \[1\]
+becomes \[2\] etc.
+
+``` c
+# new item (person => [(lastname = "Smith")])
+$xavp(person=>lastname)="Smith";
+
+# add new item (person => [(lastname = "Doe")])
+$xavp(person=>lastname)="Doe";
+
+# add another named value to the last example item
+#   (person => [(firstname="John"), (lastname = "Doe")])
+$xavp(person[0]=>firstname)="John";
+
+# add another named value to first example item
+#   (person => [(firstname="Alice"), (lastname = "Smith")])
+xavp(person[1]=>firstname)="Alice";
+```
+
+Another example:
+
+``` c
+# create new (the first) root xavp with a named value of string type
+$xavp(sf=>uri)="sip:10.10.10.10";
+
+# add named values (child values)
+$xavp(sf[0]=>fr_timer)=10;
+$xavp(sf[0]=>fr_inv_timer)=15;
+$xavp(sf[0]=>headers)="X-CustomerID: 1234\r\n";
+
+# create new (the second) root xavp with a named value of string type, moving previous one to sf[1]
+$xavp(sf=>uri)="sip:10.10.10.11";
+# add named values (child values)
+$xavp(sf[0]=>fr_timer)=20;
+$xavp(sf[0]=>fr_inv_timer)=35;
+
+# create new (the third) xavp with a named value of string type, moving previous one to sf[1] and the other one to sf[2]
+$xavp(sf=>uri)="sip:10.10.10.12";
+# add named values (child values)
+$xavp(sf[0]=>fr_timer)=10;
+$xavp(sf[0]=>fr_inv_timer)=15;
+$xavp(sf[0]=>headers)="X-CustomerID: pw45\r\n";
+```
+
+xavps are read and write variables.
+
+## $xavu(id) - XAVUs
+
+Similar to XAVPs, but with single value items, therefore there are no
+indexes in the naming format. XAVUs are also stored in transaction
+context and destroyed when the transaction is terminated.
+
+Examples:
+
+``` c
+$xavu(x) = 123; # <- set the value
+$xavu(x) = 234; # <- update to the value, not adding to a list like for xavps
+$xavu(x) = $null; # <- delete the xavu
+$xavu(a=>b) = "xyz"; # <- two level naming supported
+```
+
+## $xavi(id) - XAVIs
+
+Similar to XAVPs, but with key names are case insensitive. XAVIs are
+also stored in transaction context and destroyed when the transaction is
+terminated.
+
+Examples:
+
+``` c
+$xavi(WhatEver=>FoO) = 123; # <- set the value
+# $xavi(whatever[0]=>foo) == 123
+```
+
+## $hdr(name) - Headers
+
+**$hdr(name)** - represents the body of first header field identified by
+'name'
+
+**$(hdr(name)\[N\])** - represents the body of the N-th header field
+identified by 'name'.
+
+If \[N\] is omitted then the body of the first header is printed. The
+body of first header is returned 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='\*', all headers of that type are printed.
+
+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.
+
+Example of usage:
+
+``` c
+if($hdr(From)=~"kamailio\.org") {
+...
+}
+```
+
+🔥**IMPORTANT**: It is read-only variable. You can remove or add headers
+using functions from textops module.
+
+## $hfl(name) - Header Field With List Of Bodies
+
+Similar to **$hdr(name)**, but for some of the standard headers that can
+have many bodies serialized in the same header field (i.e., comma
+separated list of bodies in same header field) is able to return the
+individual body values.
+
+Implemented for:
+
+- Contact
+- Record-Route
+- Route
+- Via
+- Diversion
+- P-Asserted-Identity
+- P-Preferred-Identity
+
+For the rest of the headers works like **$hdr(name)**.
+
+**$hfl(name)** - represents the first body of first header field
+identified by 'name'.
+
+**$(hfl(name)\[N\])** - represents the body of the N-th header field
+identified by 'name'.
+
+Example of usage:
+
+``` c
+if($(hfl(Via)[1])=~"TLS") {
+...
+}
+```
+
+## $hdrc(name) - Number of Headers
+
+**$hdrc(name)** - get the number of headers with the respective name
+
+Example of usage:
+
+``` c
+if($hdrc(Via) == 2) {
+...
+}
+```
+
+## $hflc(name) - Number of Header Bodies
+
+Similar to **$hdrc(name)**, but for some of the standard headers that
+can have many bodies serialized in the same header field (i.e., comma
+separated list of bodies in same header field) is able to count the
+number of individual bodies.
+
+Implemented for:
+
+- Record-Route
+- Route
+- Via
+- Diversion
+- P-Asserted-Identity
+- P-Preferred-Identity
+
+For the rest of the headers works like **$hdrc(name)**.
+
+Example of usage:
+
+``` c
+if($hflc(Via)==3) {
+...
+}
+```
+
+## $var(name) - Private memory variables (zero)
+
+**$var(name)** - refers to variables that can be used in configuration
+script, having integer or string value. This kind of variables are
+faster than AVPs, being referenced directly to memory location.
+
+Example of usage:
+
+``` c
+$var(a) = 2; #-- sets the value of variable 'a' to integer '2'
+$var(a) = "2"; #-- sets the value of variable 'a' to string '2'
+$var(a) = "sip:" + $au + "@" + $fd; #-- compose a value from authentication username and From URI domain
+$var(a) = 3 + (7&(~2));
+
+if( $var(a) & 4 ) {
+  xlog("var a has third bit set\n");
+}
+```
+
+**Note:** Setting a variable to $null is actually initializing the value
+to integer '0'. This type of script variables doesn't have $null value.
+
+``` c
+$var(x) = $null;
+
+if($var(x)==0) { # this is true
+  ...
+}
+```
+
+**Note:** A script variable persists over the Kamailio process in which
+it was initialized, so be sure of giving it a new value before reading
+it or you'll get the value assigned in any other previous message
+processed by the same Kamailio process (pid).
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+**pv** module can be used to initialize the script variables.
+
+## $vz(name) - Private memory variables (zero)
+
+Same as $var(name) -- added to pair with $vn(name).
+
+## $vn(name) - Private memory variables (null)
+
+Similar to $var(name) and able to hold $null (which is the default
+value). The value is kept in private memory (pkg) and it is persistent
+across SIP message processing, within the space of each Kamailio
+process.
+
+Example of usage:
+
+``` c
+$vn(x) = 1;
+$vn(x) = "abc";
+$vn(x) = $null;
+
+if($vn(x) == $null) { ... }
+```
+
+## $shv(name) - Shared memory variables
+
+**$shv(name)** - it is a class of pseudo-variables stored in shared
+memory. The value of $shv(name) is visible across all Kamailio
+processes. Each “shv” has single value and it is initialised to integer
+0. You can use “shvset” parameter of **pv module** to initialize the
+shared variable. The module exports a set of RPC functions to get/set
+the value of shared variables.
+
+Example - $shv(name) pseudo-variable usage:
+
+```
+    ...
+    modparam("pv", "shvset", "debug=i:1")
+    ...
+    if ($shv(debug) == 1) {
+        xlog("request: $rm from $fu to $ru\n");
+    }
+    ...
+```
+
+These variables can be set also via RPC:
+
+```
+ksmctl rpc pv.shvSet debug int 2
+```
+
+🔥**IMPORTANT**: It is R/W variable (you can assign values to it directly in
+configuration file)
+
+## $dsv(key) - Dispatcher variables
+
+Return attributes related to dispatcher module.
+
+The key can be:
+
+- code - the SIP response code that caused the execution of
+    event_route 'dispatcher:dst-up' or 'dispatcher:dst-down', if
+    available
+- reason - the SIP response reason that caused the execution of
+    event_route 'dispatcher:dst-up' or 'dispatcher:dst-down', if
+    available
+- flags - flags set internally when executing event_route
+    'dispatcher:dst-up' or 'dispatcher:dst-down'
+
+## $dsg(key) - Dispatcher group attributes
+
+Return attributes related to dispatcher group that is set via
+`ds_dsg_fetch()` or `ds_dsg_fetch_uri()`.
+
+The key can be:
+
+- `count` - the number of records (destination addresses) in the group
+- `active`- the number of active destinations in the group
+- `pactive`- the percent of active destinations in the group
+- `inactive` - the number of inactive destination in the group
+- `pinactive` - the percent of inactive destination in the group
+
+When `ds_dsg_fetch_uri()` is used, the key can also be:
+
+- `octime_sec` - the value of `octime_sec` for the corresponding URI in the group
+- `octime_usec` - the value of `octime_isec` for the corresponding URI in the group
+- `ocseq` - the value of `ocseq` for the corresponding URI in the group
+- `ocrate` - the value of `ocrate` for the corresponding URI in the group
+
+
+## $time(name) - Broken-down time
+
+**$time(name)** - the PV provides access to broken-down time attributes
+in the local timezone.
+
+The 'name' can be:
+
+- sec - return seconds (int 0-59)
+- min - return minutes (int 0-59)
+- hour - return hours (int 0-23)
+- mday - return the day of month (int 0-59)
+- mon - return the month (int 1-12)
+- year - return the year (int, e.g., 2008)
+- wday - return the day of week (int, 1=Sunday - 7=Saturday)
+- yday - return the day of year (int, 1-366)
+- isdst - return daylight saving time status (int, 0 - DST off, >0 DST
+    on)
+
+Example - time(name) pseudo-variable usage:
+
+``` c
+...
+if ($time(year) == 2008) {
+    xlog("request: $rm from $fu to $ru in year 2008\n");
+}
+...
+```
+
+## $utime(name) - Broken-down time
+
+**$utime(name)** - the PV provides access to broken-down time attributes
+in UTC.
+
+See **$time(name)** above for the possible attributes
+
+## $timef(format) - Strftime Formatted Time
+
+**$timef(format)** - return current time as formatted by strftime
+'format'. See 'man strftime' to see the available time attribute
+specifiers.
+
+Example:
+
+``` c
+xlog("Today is $timef(%m/%d/%y)\n");
+```
+
+## $utimef(format) - Strftime Formatted UTC Time
+
+**$utimef(format)** - return current time in UTC as formatted by
+strftime 'format'. See 'man strftime' to see the available time
+attribute specifiers.
+
+Example:
+
+``` c
+xlog("The time is $utimef(%m/%d/%y %H:%M:%S)\n");
+```
+
+## $ccp(key) - Config Custom Parameters
+
+Get the value for global custom parameters:
+
+- [Custom Global parameters](core.md#custom-global-parameters)
+
+Example:
+
+``` c
+gv.sval = "hello" desc "hello var"
+gv.ival = 10 desc "ten var"
+
+request_route {
+    xinfo("global vars: $ccp(gv.sval) :: $ccp(gv.ival)\n");
+}
+```
+
+## $sel(name) - Selects
+
+**$sel(name)** - return the value of **select** specified by name.
+**select** refers a class of config variables introduced by SER 2.0,
+allowing to select and return parts of sip messages and not only.
+
+List of available selects:
+
+- [Selects](selects.md)
+
+Example:
+
+``` c
+if($sel(via[1].host)=="10.10.10.10")
+{
+  ...
+}
+```
+
+## Received Data Attributes
+
+### $rcv(key)
+
+Attributes of received data. The variables must be used inside
+**event_route\[core:msg-received\]** routing block.
+
+The key can be:
+
+- buf - received message
+- len - lenght of received message
+- srcip - source ip
+- rcvip - local ip where it was received
+- scrport - source port
+- rcvport - local port where it was received
+- proto - protocol as int id
+- sproto - protocol as string
+- af - address family
+
+Example of usage:
+
+``` c
+event_route[core:msg-received] {
+  xlog("rcv on $rcv(af)/$rcv(proto): ($rcv(len)) [$rcv(buf)] from [$rcv(srcip):$rcv(srcport)] to [$rcv(rcvip):$rcv(rcvport)]\n");
+}
+```
+
+## $rpl(key)
+
+Attributes of the SIP reply processed at that moment. The variables must
+be used during SIP reply processing, otherwise it returns $null.
+
+The key can be:
+
+- duri - SIP URI corresponding to the address where the SIP reply is
+    going to be sent based on 2nd via
+- dhost - host part of duri
+- dport - port part of duri
+- dproto - proto part of duri
+- dprotoid - proto id of duri
+- cntvia - the number of Via header bodies
+
+Example of usage:
+
+``` c
+reply_route{
+  xinfo("reply to be sent to: $rpl(duri)\n");
+}
+```
+
+## $msgbuf(index)
+
+Get or set the character in the message buffer at the position index.
+
+The index has to be a positive integer or a variable holding such value.
+
+Note that the variable returns a clone of the character stored in a
+static buffer, copy it to another variable if you want to compare with
+another $msgbuf(index).
+
+The update is done directly and immediately in the message buffer -- use
+it with care!
+
+Example of usage:
+
+``` c
+if ($msgbuf(20)=="V") {
+    $msgbuf(20) = "v";
+}
+```
+
+## Header Field Iterator
+
+### $hfitname(iname)
+
+The header name of the header field iterator.
+
+Example:
+
+``` c
+    hf_iterator_start("i1");
+    while(hf_iterator_next("i1")) {
+        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
+    }
+    hf_iterator_end("i1");
+```
+
+### $hfitbody(iname)
+
+The header body of the header field iterator.
+
+Example:
+
+``` c
+    hf_iterator_start("i1");
+    while(hf_iterator_next("i1")) {
+        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
+    }
+    hf_iterator_end("i1");
+```
+
+## Body Line Iterator
+
+### $blitval(iname)
+
+The value of the body line iterator.
+
+Example:
+
+``` c
+    bl_iterator_start("b1");
+    while(bl_iterator_next("b1")) {
+        xlog("body line: $blitval(b1)");
+    }
+    bl_iterator_end("b1");
+```
+
+## Send Data Attributes
+
+### $sndfrom(name)
+
+**$snd(name)** - return attributes of the address from where the request
+is going to be sent (local socket).
+
+**$sndfrom(name)** - return attributes of the address from where the
+request is going to be sent (local socket, same as $snd(name)).
+
+The name can have same values as for $sndto(...).
+
+### $sndto(name)
+
+**$sndto(name)** - return attributes of the address to where the request
+is going to be sent (remote socket).
+
+They are available in **onsend_route**. The name can be:
+
+- ip - IP address of destination
+- af - address family to be used to send (numeric)
+- port - port of destination address
+- proto - transport protocol to be used to send (numeric - UDP=1,
+    TCP=2, TLS=3, SCTP=4, WS=5, WSS=6)
+- sproto - transport protocol to be used to send (string)
+- buf - entire send buffer as string
+- len - length of outgoing packet (length of above buf)
+
+Example:
+
+``` c
+onsend_route {
+  if($snd(ip)=="10.10.10.10")
+  {
+    ...
+  }
+}
+```
+
+## SIPDUMP Module
+
+### $sipdump(name)
+
+**$sipdump(name)** - return attributes of the message handled in the
+event_route\[sipdump:msg\].
+
+The name can be:
+
+- tag - the tag of processing (rcv or snd)
+- buf - entire message buffer as string
+- len - length of the message (length of above buf)
+- af - address family
+- src_ip - source IP address as string
+- dst_ip - destination IP address as string
+- src_port - port of source address as number
+- dst_port - port of source address as number
+- proto - transport protocol
+
+Example:
+
+``` c
+event_route[sipdump:msg] {
+  if($sipdump(len) > 1024) {
+    ...
+  }
+}
+```
+
+## SIPTRACE Module
+
+### $siptrace(name)
+
+**$siptrace(name)** - return attributes of the message handled in the
+event_route\[siptrace:msg\].
+
+The name can be:
+
+- src_addr - source socket address (proto:ip:port)
+- dst_addr - destination socket address (proto:ip:port)
+- src_host - source host, for IPv6 host contains \`\[\]\`
+- dst_host - destination host, for IPv6 host contains \`\[\]\`
+- src_hostip - source host, for IPv6 host do not contains \`\[\]\`
+- dst_hostip - destination host, for IPv6 host do not contains
+    \`\[\]\`
+- src_port - source port
+- dst_port - destination port
+- src_proto - source proto
+- dst_proto - destination proto
+
+Example:
+
+``` c
+event_route[siptrace:msg]
+{
+    if (allow_address("1", "$siptrace(src_hostip)", "0")) {
+        return;
+
+    }
+    if (compare_ips($siptrace(src_host), "[2001:DB8::1]")) {
+        return;
+    }
+}
+```
+
+## Benchmark Module
+
+### $BM_time_diff
+
+$BM_time_diff - the time difference elapsed between calls of
+bm_start_timer(name) and bm_log_timer(name). The value is 0 if no
+bm_log_timer() was called.
+
+## Dialog Module
+
+### $dlg(attr)
+
+Return the attribute of the current processed dialog.
+
+🔥**IMPORTANT**: It is R/O variable.
+
+The 'attr' can be:
+
+- h_id - hash id
+- h_entry - hash entry
+- ref - reference count
+- state - state of dialog
+- to_rs - To route set
+- from_rs - From route set
+- dflags - dialog internal flags
+- sflags - dialog script flags
+- callid - sip call id
+- to_uri - To uri
+- to_tag - To tag
+- from_uri - From uri
+- from_tag - From tag
+- toroute - timeout route
+- lifetime - timeout inteval
+- start_ts - start timestamp
+- to_cseq - To CSeq
+- from_cseq - From CSeq
+- to_contact - To contact address
+- from_contact - From contact address
+- to_bindaddr - To bind address
+- from_bindaddr - From bind address
+
+### $dlg_ctx(attr)
+
+Return the attribute of the context for current processed dialog.
+
+🔥**IMPORTANT**: Some of the attributes are R/W variables.
+
+The 'attr' can be:
+
+- set - returns 1 if the dialog for current context is set, 0
+    otherwise
+- flags - get/set dialog flags
+- timeout_route - get/set route name to be executed on timeout
+- timeout_route_id - get internal id for the route to be executed on
+    timeout
+- timeout_bye - set to 1 if BYE has to be sent when dialog lifetime
+    elapses
+- timeout - set the dialog lifetime (in seconds)
+- on - get/set an integer value associated with the context (cfg
+    usage)
+- dir - get direction of the request for the dialog of the current
+    context (0 - unknown, 1 - downstream, 2 - upstream)
+
+### $dlg_var(key)
+
+Store and retrieve custom variable for current processed dialog.
+
+🔥**IMPORTANT**: It is R/W variable.
+
+The 'key' can be any string.
+
+## Erlang Module
+
+### Attributes
+
+\* type - get variable type. Possible types are: atom, integer, list,
+string, tuple, pid and ref.
+
+\* length - get length of list or tuple.
+
+\* format - prints a term, in clear text. It tries to resemble the term
+printing in the Erlang shell.
+
+### $erl_atom(name)
+
+_$erl_atom(name)_ pseudo variable allows create analog to Erlang atom
+data type. Erlang atom is a literal, a constant with name. Formatted
+output pseudo variable atom could be enclosed in single quotes (') if it
+does not begin with a lower-case letter or if it contains other
+characters than alphanumeric characters, underscore (\_), or @.
+
+Example:
+
+``` c
+$erl_atom(A) = "[email protected]";
+
+xlogl("L_DEBUG","$$erl_atom(A): $erl_atom(A=>format)\n");
+```
+
+### $erl_list(name)
+
+Compound data type with a variable number of terms. Formally, a list is
+either the empty list \[\] or consists of one or more elements.
+
+Example:
+
+``` c
+$erl_atom(E) = "example";
+$erl_list(L) = "list";
+$erl_list(L) = "of";
+$erl_list(L) = $erl_atom(E);
+
+xlogl("L_DEBUG","length(L): $erl_list(L=>length), format(L): $erl_list(L=>format)\n");
+
+# empty list
+$erl_tuple(E[*]) = $null;
+```
+
+### $erl_tuple(name)
+
+From the Erlang point of view the tuple compound data type with a fixed
+number of terms. The module implementation of tuple has the same
+behavior as the list.
+
+Example:
+
+``` c
+$erl_atom(e) = "error";
+
+$erl_tuple(T) = "badrpc";
+$erl_tuple(T) = $erl_atom(e);
+
+xlogl("L_DEBUG","length(T): $erl_tuple(T=>length), format(T): $erl_tuple(T=>format)\n");
+```
+
+### $erl_pid(name)
+
+Holds Eralng process identifier. Provides access to Erlang PID value and
+could be used in send message.
+
+### $erl_ref(name)
+
+Holds Erlang reference. Provides access to reference value and could be
+used in send message.
+
+### $erl_xbuff(name)
+
+Generic pseudo variable to acts as other pseudo variables exported from
+Erlang module.
+
+## EVAPI Module
+
+### $evapi(srcaddr)
+
+The source ip
+
+### $evapi(srcport)
+
+The source port
+
+### $evapi(msg)
+
+Received event message
+
+### $evapi(conidx)
+
+internal connection index
+
+## HTable Module
+
+### $sht(htable=>key)
+
+Access hash table entries.
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file. Hash table entry can be deleted by assigning value
+$null to it. Value of a non-existing hash table entry is $null.
+
+The “htname” must be a hash table name defined via “htable” parameter.
+
+The “key” can be:
+
+- static string - set of characters without pseudo-variables
+- dynamic string - set of characters that include pseudo-variables.
+    The pseudo-variables will be evaluated at runtime.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;")
+    ...
+    $sht(a=>$au) = 1;
+    $sht(a=>$ru) = $fu;
+    ...
+
+### $shtex(htable=>key)
+
+Access hash table entry expire value. Value represents the seconds until
+the htable entry will expire and be deleted from htable.
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file.
+
+The “htname” must be a hash table name defined via “htable” parameter
+and have auto-expire greater than 0.
+
+The “key” can be:
+
+- static string - set of characters without pseudo-variables
+- dynamic string - set of characters that include pseudo-variables.
+    The pseudo-variables will be evaluated at runtime.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;autoexpire=120;")
+    ...
+    $sht(a=>$au) = 1;
+    $shtex(a=>$au) = 10;
+    ...
+
+### $shtcn(htable=>exp)
+
+Count items matching the name by regexp.
+
+The “htname” must be a hash table name defined via “htable” parameter.
+
+The **exp** can be:
+
+- reqexp - match by regular expression 'regexp'
+- \~\~regexp - match by regular expression 'regexp'
+- \~%prefix - match by right prefix
+- %\~prefix - match by left prefix
+- ==value - match by string value
+- eqvalue - match by integer value
+- \* \* - (two asterisks next to each other) - count all items
+
+The **exp** can contain pseudo-variables.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;")
+    ...
+    $sht(a=>abc) = 1;
+    $shtex(a=>ade) = 10;
+    xlog("$shtcn(a=>a.*)");
+    ...
+
+### $shtcv(htable=>exp)
+
+Count items matching the value by regexp.
+
+The “htname” must be a hash table name defined via “htable” parameter.
+
+The **exp** must follow same rules as for **$shtcn(...)**.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;")
+    ...
+    $sht(a=>abc) = "xyz";
+    $shtex(a=>ade) = "xwt";
+    xlog("$shtcv(a=>x.*)");
+    ...
+
+### $shtinc(htable=>key)
+
+Atomic increment of the value for the hash table item.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;")
+    ...
+    $sht(a=>$au) = 1;
+    xlog("==== $shtinc(a=>$au)\n");
+    ...
+
+### $shtdec(htable=>key)
+
+Atomic decrement of the value for the hash table item.
+
+    ...
+    modparam("htable", "htable", "a=>size=4;")
+    ...
+    $sht(a=>$au) = 1;
+    xlog("==== $shtdec(a=>$au)\n");
+    ...
+
+### $shtitkey(iname)
+
+The key at the current position in the iterator.
+
+### $shtitval(iname)
+
+The value at the current position in the iterator.
+
+Example:
+
+``` c
+    sht_iterator_start("i1", "h1");
+    while(sht_iterator_next("i1")) {
+        xlog("h1[$shtitkey(i1)] is: $shtitval(i1)\n");
+    }
+    sht_iterator_end("i1");
+```
+
+### $shtrecord(id)
+
+Get the key or the value of expired item inside the
+event_route\[htable:expired:\_table_name\_\].
+
+The id can be:
+
+- key
+- value
+
+Example:
+
+``` c
+event_route[htable:expired:h1] {
+  xlog("expired item ($shtrecord(key),$shtrecord(value))\n");
+}
+```
+
+## Memcached Module
+
+### $mct(key)
+
+Access hash table entries stored in the memcached server.
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file.
+
+The “key” can be:
+
+- static string - set of characters without pseudo-variables
+- dynamic string - set of characters that include pseudo-variables.
+    The pseudo-variables will be evaluated at runtime.
+
+When assigning values, the default expiry will be used.
+
+    ...
+    $mct($au) = 1;
+    $mct($ru) = $fu;
+    $mct(test) = 1;
+    xlog("stored value is $mct(test)");
+    $mct(test) = null; # delete it
+    xlog("stored value is $mct(test)"); # will return <null>
+    ...
+
+### $mct(key=>expiry)
+
+Using this alternative format, the default expiry may be overidden by
+including a custom value at time of assignment.
+
+    ...
+    $mct(test=>30) = 1; # set expire time to 30 seconds
+    xlog("stored value is $mct(test)");
+    # sleep 30 seconds
+    xlog("stored value is $mct(test)"); # will return <null>
+    ...
+
+### $mcinc(key)
+
+Do an atomic increment operation on the value stored in memcached. You
+need to add a value previously.
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file.
+
+The “key” can be:
+
+- static string - set of characters without pseudo-variables
+- dynamic string - set of characters that include pseudo-variables.
+    The pseudo-variables will be evaluated at runtime.
+
+    ...
+    $mct(cnt) = 1;
+    $mcinc(cnt) = 2; # increment by 2
+    xlog("counter is now $mct(cnt)");
+    ...
+
+### $mcdec(key)
+
+Do an atomic decrement operation on the value stored in memcached. You
+need to add a value previously.
+
+🔥**IMPORTANT**: It is R/W variable, you can assign values to it directly in
+configuration file.
+
+The “key” can be:
+
+- static string - set of characters without pseudo-variables
+- dynamic string - set of characters that include pseudo-variables.
+    The pseudo-variables will be evaluated at runtime.
+
+    ...
+    $mct(cnt) = 10;
+    $mcdec(cnt) = 2; # decrement by 2
+    xlog("counter is now $mct(cnt)");
+    ...
+
+## http_async_client Module
+
+### $http_req_id
+
+The $http_req_id read-only variable can be used in REQUEST_ROUTE to
+retrive the unique identifier for a query after sending it or in the
+HTTP callback route to retrive the id of the query the reply belongs to.
+Useful mainly in non-transactional context.
+
+### $http_req(key)
+
+The $http_req(key) write-only variable can be used to set custom
+parameters before sending a HTTP query.
+
+**key** can be one of:
+
+- all: if set to $null, resets all the parameters to their default
+    value (the ones defined in modparam)
+- hdr: sets/modifies/removes a HTTP header. N.B.: setting this
+    variable multiple times will add several headers to the query.
+- body: sets/modifies/removes the request body
+- method: sets the HTTP method: either "GET", "POST", "PUT" or
+    "DELETE" (these are the supported methods). (Note: if the method is
+    not set, curl will use GET, or POST if a body is specified)
+- timeout: sets the HTTP timeout. (Note, this timeout should be
+    normally less than tm.fr_timer timeout, because transaction timeout
+    has a higher priority over HTTP timeout)
+- tls_client_cert: sets the client certificate to use
+- tls_client_key: sets the client certificate key to use
+- tls_ca_path: sets the CA certificate path to use
+- authmethod: Sets the preferred authentication mode for HTTP/HTTPS
+    requests. The value is a bitmap and multiple methods can be used.
+    Note that in this case, the CURL library will make an extra request
+    to discover server-supported authentication methods. You may want to
+    use a specific value. Valid values are:
+
+  + 1 - BASIC authentication
+  + 2 - HTTP Digest authentication
+  + 4 - GSS-Negotiate authentication
+  + 8 - NTLM authentication
+  + 16 - HTTP Digest with IE flavour.
+  + (Default value is 3 - BASIC and Digest authentication.)
+- username: sets the username to use for authenticated requests
+- password: sets the password to use for authenticated requests
+- suspend: if set to 0 it doesn't suspend the current transaction before performing the query
+- tcp_keepalive: enable TCP keepalive
+- tcp_ka_idle: set TCP keepalive idle time wait
+- tcp_ka_interval: set TCP keepalive interval
+
+### Other read-only variables
+
+The following read-only pseudo variables can only be used in the
+callback routes executed by http_async_query()
+
+#### $http_ok
+
+1 if cURL executed the request successfully, 0 otherwise (check
+$http_err for details).
+
+#### $http_err
+
+cURL error string if an error occurred, $null otherwise.
+
+#### $http_rs
+
+HTTP status.
+
+#### $http_rr
+
+HTTP reason phrase.
+
+#### $http_hdr(Name)
+
+Value of the Name header (the $(http_hdr(Name)\[N\]) syntax can also be
+used, check the SIP $hdr() PV documentation for details).
+
+#### $http_mb and $http_ml
+
+HTTP response buffer (including headers) and length.
+
+#### $http_rb and $http_bs
+
+HTTP response body and body length,
+
+## XMLOPS Pseudo-Variables
+
+### $xml(name=>spec)
+
+- name - id to refer the documet
+- spec - specifier:
+  + doc - set/get the document as text
+  + xpath:xpath-expression - evaluate xpath expression
+
+Example:
+
+    $xml(x=>doc) = '<?xml version="1.0" encoding="UTF-8"?><a><b>test</b></a>';
+    xlog("content of node b: $xml(x=>xpath:/a/b/text())\n");
+    $xml(x=>xpath:/a/b) = "1234";
+
+## TMX Module
+
+### $T_branch_idx
+
+- the index (starting with 0 for the first branch) of the branch for
+    which is executed the branch_route\[\].
+- in failure_route\[\] block, the value is the number of completed
+    branches added to the number of new new branches
+- in request_route block, the value is number of created branches
+- in onreply_route\[\], the value is the index of the branch receiving
+    the reply
+- if used outside of transaction processing, the value is '-1'
+
+### $T_reply_ruid
+
+- the ruid stored in the current branch of the transaction. The ruid
+    is stored in a branch from the details in a contact binding. In an
+    event_route\[tm:branch-failure\] block, this is the ruid of the
+    branch that sent a failure reply. In a failure_route\[\] block, this
+    is the ruid of the winning failure response.
+
+### $T_reply_code
+
+- the code of the reply, as follows: in request_route will be the last
+    stateful sent reply; in reply_route will be the current processed
+    reply; in failure_route will be the negative winning reply. In case
+    of no-reply or error, '0' value is returned
+
+### $T_req(pv)
+
+- can be used in reply routes or inside the modules to get access to
+    attributes of the request belonging to same transaction as the reply
+
+    route {
+      t_on_reply("1");
+      t_relay();
+    }
+
+    onreply_route[1] {
+      xlog("Request SRCIP:PORT = $T_req($si):$T_req($sp)\n");
+    }
+
+### $T_rpl(pv)
+
+- can be used in failure routes or inside the modules to get access to
+    attributes of the winning reply belonging to same transaction as the
+    request
+
+    route {
+      t_on_failure("1");
+      t_relay();
+    }
+
+    failure_route[1] {
+      xlog("Reply SRCIP:PORT = $T_rpl($si):$T_rpl($sp)\n");
+    }
+
+### $T_inv(pv)
+
+- can be used in request routes or inside the modules to get access to
+    attributes of the INVITE request while processing a CANCEL.
+
+    route {
+      if(is_method("CANCEL"))
+      {
+         if($T_inv($mf) & 1 )
+         {
+            # first flag is set in the INVITE transaction
+         }
+      }
+    }
+
+### $T(name)
+
+- pseudo-variable class to access TM attributes
+
+The **name** can be:
+
+- id_index - return the internal index of current transaction or $null
+    if no transaction is found
+- id_label - return the internal label of current transaction or $null
+    if no transaction is found
+- id_index_n - return the internal index of current transaction, if no
+    transaction exists yet, create it
+- id_label_n - return the internal label of current transaction, if no
+    transaction exists yet, create it
+- reply_code - reply code (alias to $T_reply_code)
+- reply_reason - reply reason
+- reply_last - last received reply code
+- branch_index - branch index (alias to $T_branch_idx)
+- ruid - return the internal location ruid field for current branch
+- reply_type - 1 if it is a local generated reply, 0 - if no reply for
+    transaction or it is a received reply
+
+Note: the pair (id_index,id_label) uniquely identifies a transaction.
+
+### $T_branch(name)
+
+- pseudo-variable class to access TM branch attributes
+
+The **name** can be:
+
+- flags - Flags of the branch. In an event_route\[tm:branch-failure\]
+    block, this is the flags of the branch that sent a failure reply. In
+    a failure_route\[\] block, this is the flags of the winning failure
+    response.
+- uri - the R-URI of the branch. Can be used in onreply_route\[id\] -
+    reply route blocks executed by tm module. For other routing blocks
+    handling requests, the R-URI is returned by $ru
+
+## UAC Module
+
+### $uac_req(key)
+
+- used to build the input for uac_send_req() function of UAC module
+
+The key can be:
+
+- method - SIP method
+- ruri - request URI
+- furi - From URI
+- turi - To URI
+- ouri - Outbound proxy URI
+- hdrs - SIP Headers
+- body - Body
+- flags - flags for processing
+  + 1 - the password is provided in HA1 format
+- auser - authentication username
+- apasswd - authentication password
+- sock - local socket to be used for sending (proto:address:port)
+- callid - SIP-Call-ID of the generated request (by default, a call-id
+    is generated)
+- cseqno - CSeq number to be used if greater than 0
+- all - alias useful to reset all fields - $uac_req(all) = $null;
+- evroute - it has to be set to 1 in order to execute
+    event_route\[uac:reply\] when reply is received
+- evcode - reply code for the request sent with uac_req_send(),
+    available inside event_route\[uac:reply\]
+- evtype - is 1 if the reply was received via network, 2 if the reply
+    was locally generated (e.g., retransmission timeout), available
+    inside event_route\[uac:reply\]
+- evparam - generic data buffer associated with the request that can
+    be set before sending it and retrieved when executing the event
+    route. It has a size of 128 characters.
+
+``` c
+$uac_req(method)="OPTIONS";
+$uac_req(ruri)="sip:kamailio.org";
+$uac_req(furi)="sip:kamailio.org";
+$uac_req(turi)="sip:kamailio.org";
+$uac_req(evroute) = 1;
+uac_req_send();
+...
+event_route[uac:reply] {
+  xlog("request sent to $uac_req(ruri) completed with code: $uac_req(evcode)\n");
+}
+```
+
+## Nathelper Module
+
+### $rr_count
+
+- Number of Record Routes in received SIP request or reply.
+
+### $rr_top_count
+
+- If topmost Record Route in received SIP request or reply is a double
+    Record Route, value of $rr_top_count is 2. If it a single Record
+    Route, value of $rr_top_count is 1. If there is no Record Route(s),
+    value of $rr_top_count is 0.
+
+## MQueue Module
+
+### $mqk(q)
+
+- return the key of fetched item from queue q
+
+### $mqv(q)
+
+- return the value of fetched item from queue q
+
+``` c
+...
+mq_add("myq", "$rU", "call from $fU at $Tf");
+...
+while(mq_fetch("myq"))
+{
+   xlog("$mqk(myq) - $mqv(myq)\n");
+}
+...
+```
+
+## TimeVal
+
+### $TV(name)
+
+Seconds and microseconds taken from struct timeval. The time at that
+moment is represented by **seconds.microseconds**.
+
+- $TV(s) - seconds (cached at first call per sip message)
+- $TV(u) - microseconds (cached at first call per sip message)
+- $TV(sn) - seconds (not cached, taken at that moment)
+- $TV(un) - microseconds (corresponding to the moment $TV(sn) is
+    retrieved)
+- $TV(Sn) - string representation seconds.microseconds (not cached,
+    taken at that moment)
+- $TV(Sm) - string representation of an always increasing monotonic
+    counter. Note that even if is based on clock, it starts from an
+    unspecified point in time, so should really be treated as an
+    opaque counter.
+
+## Next hop address
+
+### $nh(key)
+
+Return attributes of next hop for the SIP messages. For SIP requests,
+the address is taken from dst_uri, if set, if not from new r-uri or
+original r-uri. For SIP replies, the attributes are taken from 2nd Via
+header (username is always $null for SIP replies).
+
+- $nh(u) - uri (lower case u)
+- $nh(U) - username (upper case u)
+- $nh(d) - domain
+- $nh(p) - port (lower case p)
+- $nh(P) - transport protocol (upper case p)
+
+## NDB_REDIS Module
+
+### $redis(res=>key)
+
+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), the members of the array
+can be accessed by adding any of the above keys, after a value\[n\] key.
+The first value\[n\] references the element in the first array, while
+the next key references an element of the referenced array.
+
+Example:
+
+    redis_cmd("srvN", "GET foo", "r");
+    xlog("===== result type: $redis(r=>type) * value: $redis(r=>value)\n");
+
+### $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=>type).
+
+Example:
+
+    redis_cmd("srvN", "GET foo", "r");
+    if ($redis(r=>type) == $redisd(rpl_int)) {
+    }
+
+## GeoIP Module
+
+### $gip(pvc=>key)
+
+Variables exported by GeoIP module, returning geo-location attributes.
+The attributes are populated upon calling function **geoip_match(ipaddr,
+pvc)**.
+
+**pvc** (container id) is second parameter of geoip_match(..) and
+**key** can be:
+
+- cc - country code
+- tz - time zone
+- zip - postal code
+- lat - latitude
+- lon - longitude
+- dma - dma code
+- ips - ip start
+- ipe - ip end
+- city - city
+- area - area code
+- regc - region
+- regn - region name
+- metro - metro code
+- contc - continent code
+
+You can call several time **geoip_match(ipaddr, pvc)** with different ip
+address and containers in your config, to compare, for example,
+attributes of source and destination of a call.
+
+``` c
+geoip_match("$si", "src");
+geoip_match("$nh(d)", "dst");
+
+if($gip(src=>cc)==$gip(dst=>cc))
+{
+    # source and destination from same country
+}
+
+```
+
+### $gip2(pvc=>key)
+
+Variables exported by GeoIP2 module, returning geo-location attributes.
+The attributes are populated upon calling function
+**geoip_match2(ipaddr, pvc)**.
+
+**pvc** (container id) is second parameter of geoip_match2(..) and
+**key** can be:
+
+- cc - country code
+- tz - time zone
+- zip - postal code
+- lat - latitude
+- lon - longitude
+- dma - dma code
+- ips - ip start
+- ipe - ip end
+- city - city
+- area - area code
+- regc - region
+- regn - region name
+- metro - metro code
+- contc - continent code
+
+You can call several time **geoip_match(ipaddr, pvc)** with different ip
+address and containers in your config, to compare, for example,
+attributes of source and destination of a call.
+
+``` c
+geoip_match2("$si", "src");
+geoip_match2("$nh(d)", "dst");
+
+if($gip2(src=>cc)==$gip2(dst=>cc))
+{
+    # source and destination from same country
+}
+
+```
+
+## TLS Module
+
+### $tls(key)
+
+Variables related to TLS communication and certificates.
+
+The **key** can be:
+
+- **m_issuer_line** - return local (my) certificate issuer line
+- **p_issuer_line** - return remote (peer) certificate issuer line
+- **m_subject_line** - return local (my) certificate subject line
+- **p_subject_line** - return remote (peer) certificate subject line
+
+Example:
+
+``` c
+if(proto==TLS) {
+    xinfo("local certificate subject: $tls(m_subject_line)\n");
+}
+```
+
+### $tls_version
+
+The TLS/SSL version which is used on the TLS connection from which the
+message was received. String type.
+
+### $tls_description
+
+The TLS/SSL description of the TLS connection from which the message was
+received. String type.
+
+### $tls_cipher_info
+
+The TLS/SSL cipher which is used on the TLS connection from which the
+message was received. String type.
+
+### $tls_cipher_bits
+
+The number of cipher bits which are used on the TLS connection from
+which the message was received. String and Integer type.
+
+### $tls_peer_version
+
+The version of the certificate. String type.
+
+### $tls_my_version
+
+The version of the certificate. String type.
+
+### $tls_peer_serial
+
+The serial number of the certificate. String and Integer type.
+
+### $tls_my_serial
+
+The serial number of the certificate. String and Integer type.
+
+### $tls_peer_subject
+
+ASCII dump of the fields in the subject section of the certificate.
+String type. Example:
+
+      /C=AT/ST=Vienna/L=Vienna/O=enum.at/CN=enum.at
+
+### $tls_peer_issuer
+
+ASCII dump of the fields in the issuer section of the certificate.
+String type.
+
+### $tls_my_subject
+
+ASCII dump of the fields in the subject section of the certificate.
+String type.
+
+### $tls_my_issuer
+
+ASCII dump of the fields in the issuer section of the certificate.
+String type.
+
+### $tls_peer_subject_cn
+
+commonName in the subject section of the certificate. String type.
+
+### $tls_peer_issuer_cn
+
+commonName in the issuer section of the certificate. String type.
+
+### $tls_my_subject_cn
+
+commonName in the subject section of the certificate. String type.
+
+### $tls_my_issuer_cn
+
+commonName in the issuer section of the certificate. String type.
+
+### $tls_peer_subject_locality
+
+localityName in the subject section of the certificate. String type.
+
+### $tls_peer_issuer_locality
+
+localityName in the issuer section of the certificate. String type.
+
+### $tls_my_subject_locality
+
+localityName in the subject section of the certificate. String type.
+
+### $tls_my_issuer_locality
+
+localityName in the issuer section of the certificate. String type.
+
+### $tls_peer_subject_country
+
+countryName in the subject section of the certificate. String type.
+
+### $tls_peer_issuer_country
+
+countryName in the issuer section of the certificate. String type.
+
+### $tls_my_subject_country
+
+countryName in the subject section of the certificate. String type.
+
+### $tls_my_issuer_country
+
+countryName in the issuer section of the certificate. String type.
+
+### $tls_peer_subject_state
+
+stateOrProvinceName in the subject section of the certificate. String
+type.
+
+### $tls_peer_issuer_state
+
+stateOrProvinceName in the issuer section of the certificate. String
+type.
+
+### $tls_my_subject_state
+
+stateOrProvinceName in the subject section of the certificate. String
+type.
+
+### $tls_my_issuer_state
+
+stateOrProvinceName in the issuer section of the certificate. String
+type.
+
+### $tls_peer_subject_organization
+
+organizationName in the subject section of the certificate. String type.
+
+### $tls_peer_issuer_organization
+
+organizationName in the issuer section of the certificate. String type.
+
+### $tls_my_subject_organization
+
+organizationName in the subject section of the certificate. String type.
+
+### $tls_my_issuer_organization
+
+organizationName in the issuer section of the certificate. String type.
+
+### $tls_peer_subject_unit
+
+organizationalUnitName in the subject section of the certificate. String
+type.
+
+### $tls_peer_subject_uid
+
+UID in the subject section of the certificate. String type.
+
+### $tls_peer_issuer_unit
+
+organizationalUnitName in the issuer section of the certificate. String
+type.
+
+### $tls_my_subject_unit
+
+organizationalUnitName in the subject section of the certificate. String
+type.
+
+### $tls_my_subject_uid
+
+UID in the subject section of the certificate. String type.
+
+### $tls_my_issuer_unit
+
+organizationalUnitName in the issuer section of the certificate. String
+type.
+
+### $tls_peer_san_email
+
+email address in the "subject alternative name" extension. String type.
+
+### $tls_my_san_email
+
+email address in the "subject alternative name" extension. String type.
+
+### $tls_peer_san_hostname
+
+hostname (DNS) in the "subject alternative name" extension. String type.
+
+### $tls_my_san_hostname
+
+hostname (DNS) in the "subject alternative name" extension. String type.
+
+### $tls_peer_san_uri
+
+URI in the "subject alternative name" extension. String type.
+
+### $tls_my_san_uri
+
+URI in the "subject alternative name" extension. String type.
+
+### $tls_peer_san_ip
+
+ip address in the "subject alternative name" extension. String type.
+
+### $tls_my_san_ip
+
+ip address in the "subject alternative name" extension. String type.
+
+### $tls_peer_verified
+
+Returns 1 if the peer's certificate was successfully verified. Otherwise
+it returns 0. String and Integer type.
+
+### $tls_peer_revoked
+
+Returns 1 if the peer's certificate was revoked. Otherwise it returns 0.
+String and Integer type.
+
+### $tls_peer_expired
+
+Returns 1 if the peer's certificate is expired. Otherwise it returns 0.
+String and Integer type.
+
+### $tls_peer_selfsigned
+
+Returns 1 if the peer's certificate is selfsigned. Otherwise it returns
+0. String and Integer type.
+
+### $tls_peer_notBefore
+
+Returns the notBefore validity date of the peer's certificate. String
+type.
+
+### $tls_peer_notAfter
+
+Returns the notAfter validity date of the peer's certificate. String
+type.
+
+### $tls_peer_server_name
+
+The SNI server name of the peer
+
+### $tls_peer_raw_cert
+
+The raw PEM-encoded client certificate. String type.
+
+### $tls_my_raw_cert
+
+The raw PEM-encoded client certificate. String type.
+
+### $tls_peer_urlencoded_cert
+
+The PEM-encoded client certificate, urlencoded. String type.
+
+### $tls_my_urlencoded_cert
+
+The PEM-encoded client certificate, urlencoded. String type.
+
+## SIP Message Attributes
+
+### $msg(attr)
+
+Return attributes of SIP message:
+
+- $msg(len) - sip message length
+- $msg(buf) - sip message buffer
+- $msg(body) - sip message body
+- $msg(body_len) - sip message body length
+- $msg(hdrs) - sip message headers (surrounding white space and EoL
+    chars trimmed)
+- $msg(fline) - sip message first line (surrounding white space and
+    EoL chars trimmed)
+- $msg(fpart) - sip message first line and the headers
+- $msg(lpart) - sip message headers and the body
+
+## POSOPS Module
+
+### $pos(key)
+
+Get attributes after a function of the module is executed.
+
+The key can be:
+
+- ret - the return code on success or -1
+- idx - position inside message buffer, for find/search it is the
+    start of matching
+- len - the length of matching string for search functions
+
+## XHTTP Module
+
+### $hu
+
+- URL of http request.
+
+## MSRP Module
+
+This class of pseudo-variables is exported by MSRP module and give
+access to attributes of MSRP frames.
+
+### $msrp(buf)
+
+The entire content of MSRP frame - first line, headers, body and
+end-line.
+
+### $msrp(body)
+
+The body of MSRP frame.
+
+### $msrp(code)
+
+The code of MSRP replies.
+
+### $msrp(hdrs)
+
+The headers in a MSRP frame.
+
+### $msrp(msgid)
+
+The body of Message-Id header.
+
+### $msrp(method)
+
+The method of a MSRP request.
+
+### $msrp(buflen)
+
+The length of entire MSRP frame.
+
+### $msrp(sessid)
+
+The session id for MSRP frame. It is taken from the first MSRP URI in
+To-Path header.
+
+### $msrp(reason)
+
+The reason text in a MSRP reply.
+
+### $msrp(crthop)
+
+The URI for current hop - it is the first URI in To-Path header.
+
+### $msrp(bodylen)
+
+The length of the body in MSRP frame.
+
+### $msrp(transid)
+
+The transaction ID from the first line of MSRP frame.
+
+### $msrp(prevhop)
+
+The MSRP URI of the previous hop - the first address in From-Path
+header.
+
+### $msrp(nexthop)
+
+The URI of the next hop - the second address in To-Path header.
+
+### $msrp(lasthop)
+
+The last hop URI - the last address in To-Path header.
+
+### $msrp(srcaddr)
+
+The address of the previous hop set as MSRP URI using received source IP
+and port.
+
+### $msrp(srcsock)
+
+The local socket where the MSRP frame was received, set as
+**proto:ipaddr:port**.
+
+### $msrp(firsthop)
+
+The URI of the first hop - the last address in From-Path header.
+
+### $msrp(prevhops)
+
+The number of previous hops - it is the number of addresses in From-Path
+header.
+
+### $msrp(nexthops)
+
+The number of next hops - it is the number of addresses in To-Path
+header minus 1 (the first address in To-Path is current hop).
+
+### $msrp(conid)
+
+The internal integer id for TCP/TLS connection.
+
+## SIPT Module
+
+### $sipt(calling_party_number.presentation) / $sipt_presentation
+
+Returns the value of the Address presentation restricted indicator
+contained in the Calling Party Number header of the IAM message if it
+exists. Returns -1 if there isn't a Calling Party Number header.
+
+The following values can be returned:
+
+- 0 presentation allowed
+- 1 resentation restricted
+- 2 address not avail (national use)
+- 3 spare
+
+Example:
+
+``` c
+if($sipt(calling_party_number.presentation) == 1)
+{
+        append_hf("Privacy: id\r\n");
+        $fn = "Anonymous";
+}
+```
+
+### $sipt(calling_party_number.screening) / $sipt_screening
+
+Returns the value of the Screening Indicator contained in the Calling
+Party Number header of the IAM message if it exists. Returns -1 if there
+isn't a Calling Party Number header.
+
+Can return the following values:
+
+- 0 Reserved (user provided, not verified)
+- 1 User Provided, Verified and Passed
+- 2 Reserved (user provided, verified and failed)
+- 3 Network provided
+
+Example:
+
+``` c
+# remove P-Asserted-Identity header if the screening isn't verified
+# or network provided
+$avp(s:screening) = $sipt(calling_party_number.screening);
+if($avp(s:screening) != 1 && $avp(s:screening) != 3)
+{
+        remove_hf("P-Asserted-Id");
+}
+```
+
+### $sipt(hop_counter) / $sipt_hop_counter
+
+Returns the value of the Hop Counter for the IAM message if it exists.
+Returns -1 if there isn't a hop counter.
+
+Example:
+
+``` c
+# get the hop counter and update the Max-Forwards header if it exists
+$avp(s:hop) = $sipt(hop_counter);
+if($avp(s:hop) > 0)
+{
+        remove_hf("Max-Forwards");
+        append_hf("Max-Forwards: $avp(s:hop)\r\n");
+}
+```
+
+### $sipt(calling_party_category) / $sipt(cpc) / $sipt_cpc
+
+Returns the value of the Calling Party Category for the IAM message.
+Returns -1 if there is a parsing error.
+
+### $sipt(calling_party_number.nature_of_address) / $sipt.(calling_party_number.nai) / $sipt_calling_party_nai
+
+Returns the value of the Nature of Address Indicator of the Calling
+Party for the IAM message. Returns -1 if there is a parsing error or if
+the Calling Party Number is not present.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number (national use)
+- 4 International use
+
+Example:
+
+``` c
+# get the Calling Nai and add country code if national
+if($sipt(calling_party_number.nai) == 3)
+{
+        $fU = "32" + "$fU";
+}
+```
+
+### $sipt(called_party_number.nature_of_address) / $sipt(called_party_number.nai) / $sipt_called_party_nai
+
+Returns the value of the Nature of Address Indicator of the Called Party
+for the IAM message. Returns -1 if there is a parsing error.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number
+- 4 International use
+- 5 Network-specific number (national use)
+
+Example:
+
+``` c
+# get the Called Nai and add country code if national
+if($sipt(called_party_number.nai) == 3)
+{
+        $rU = "32" + "$rU";
+}
+```
+
+### $sipt(event_info)
+
+Returns the value of the Event Info header of the CPG message. Returns
+-1 if there is a parsing error.
+
+Can return the following values:
+
+- 0 Spare
+- 1 ALERTING
+- 2 PROGRESS
+- 3 In-band information or an appropriate pattern is now available
+- 4 Call forward on busy
+- 5 Call forward on no reply
+- 6 Call forward unconditional
+
+### $sipt(backward_call_indicator.charge_indicator)
+
+Returns the value of the charge indication of the backward call
+indicator header in the ACM or COT message. Returns -1 if there is a
+parsing error
+
+Can return the following values:
+
+- 0 no indication
+- 1 no charge
+- 2 charge
+- 3 spare
+
+### $sipt(redirection_info) / $sipt_redirection_info
+
+Returns the value of the Redirecting reason of the Call Diversion
+Information header from ISUP. Returns -1 if there is a parsing error or
+if the Call Diversion Information is not present.
+
+Can return the following values:
+
+- 0 Unknown
+- 1 User busy
+- 2 no reply
+- 3 unconditional
+- 4 deflection during alerting
+- 5 deflection immediate response
+- 6 mobile subscriber not reachable
+
+### $sipt(redirection_number) / $sipt_redirection_number
+
+Returns the value (Address signal) of the Redirection Number. Returns -1
+if there is a parsing error or if the Redirection Number is not present.
+
+Example:
+
+``` c
+# get the redirection number
+$avp(s:redir_num) = $sipt(redirection_number);
+```
+
+### $sipt(redirection_number.nai) / $sipt_redirection_number_nai
+
+Returns the value of the Nature of Address Indicator of the Redirection
+Number. Returns -1 if there is a parsing error or if the Redirection
+Number is not present.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number
+- 4 International use
+
+### $sipt(calling_party_number)
+
+Returns the value (Address signal) of the Calling Party for the IAM
+message. Returns -1 if there is a parsing error or if the Calling Party
+Number is not present.
+
+### $sipt(called_party_number)
+
+Returns the value (Address signal) of the Called Party for the IAM
+message. Returns -1 if there is a parsing error or if the Called Party
+Number is not present.
+
+### $sipt(sipt_redirection_information_reason)
+
+Returns the value of the Redirection reason of the Redirection
+information header from ISUP. Returns -1 if there is a parsing error or
+if the Redirection information is not present.
+
+### $sipt(sipt_redirection_information_original_reason)
+
+Returns the value of the Original Redirection reason of the Redirection
+information header from ISUP. Returns -1 if there is a parsing error or
+if the Redirection information is not present.
+
+### $sipt(redirecting_number.nai)
+
+Returns the value of the Nature of Address Indicator of the Redirecting
+Number. Returns -1 if there is a parsing error or if the Redirecting
+Number is not present.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number
+- 4 International use
+
+### $sipt(redirecting_number)
+
+Returns the value (Address signal) of the Redirecting Number for the IAM
+message. Returns -1 if there is a parsing error or if the Redirecting
+Number is not present.
+
+### $sipt(original_called_number.nai)
+
+Returns the value of the Nature of Address Indicator of the Original
+Called Number. Returns -1 if there is a parsing error or if the Original
+Called Number is not present.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number
+- 4 International use
+
+### $sipt(original_called_number)
+
+Returns the value (Address signal) of the Original Called Number for the
+IAM message. Returns -1 if there is a parsing error or if the Original
+Called Number is not present.
+
+### $sipt(generic_number.nai)
+
+Returns the value of the Nature of Address Indicator of the Generic
+Number. Returns -1 if there is a parsing error or if the Generic Number
+is not present.
+
+Can return the following values:
+
+- 0 Spare
+- 1 Subscriber Number (national use)
+- 2 Unknown (national use)
+- 3 National (significant) number
+- 4 International use
+
+### $sipt(generic_number)
+
+Returns the value (Address signal) of the Generic Number for the IAM
+message. Returns -1 if there is a parsing error or if the Generic Number
+is not present.
+
+
+## $dns(pvid=>key) - DNS Query Result
+
+This variable stores the DNS result details after a call of
+dns_query(hostname, pvid) function from ipops module.
+
+- pvid can be any string
+- key can be:
+  + count - number of addresses
+  + ipv4 - set to 1 if at least one ipv4 address (otherwise 0)
+  + ipv6 - set to 1 if at least one ipv6 address (otherwise 0)
+  + addr\[index\] - the address as string from position index in the
+        list (0 based indexing)
+  + type\[index\] - the type of address from position index in the
+        list (0 based indexing), the value is 4 for ipv4 and 6 for ipv6
+
+The index can be an integer or a variable with integer value. First
+address has the index 0. If negative value, the returned address is
+counted from the end of the list, -1 being the last address. If no index
+is provided, then the first address is returned.
+
+``` c
+if(dns_query("test.com", "xyz"))
+{
+    xlog(" number of addresses: $dns(xyz=>count)\n");
+    xlog(" ipv4 address found: $dns(xyz=>ipv4)\n");
+    xlog(" ipv6 address found: $dns(xyz=>ipv6)\n");
+    $var(i) = 0;
+    while($var(i)&lt;$dns(xyz=>count)) {
+        xlog(" #[$var(i)] type ($dns(xyz=>type[$var(i)]))"
+             " addr [$dns(xyz=>addr[$var(i)])]\n");
+        $var(i) = $var(i) + 1;
+    }
+}
+```
+
+## $HN(key) - Hostname details
+
+Give local hostname details (implemented by ipops module).
+
+The key can be:
+
+- n - the hostname
+- f - the fullname
+- d - the domain
+- i - the ip address
+
+``` c
+xlog("local hostanme is $HN(n)\n");
+```
+
+## $RANDOM - Random number
+
+Returns a random value from the \[0 - 2^31) range.
+(Part of the cfgutils module)
+
+``` c
+if (rand_event()) {
+  $avp(i:10) = ($RANDOM / 16777216); # 2^24
+  if ($avp(i:10) < 10) {
+     $avp(i:10) = 10;
+  }
+  append_to_reply("Retry-After: $avp(i:10)\n");
+  sl_send_reply("503", "Try later");
+  exit;
+};
+# normal message processing follows
+```
+
+## JSONRPCS Variables
+
+### $jsonrpl(key) - JSONRPC Reply
+
+This variable gives access to JSONRPC reply after executing
+jsonrpc_exec(...) in kamailio.cfg.
+
+The key can be:
+
+- code - code for the JSONRPC response
+- text - text of the code for the JSONRPC response
+- body - the body of the JSONRPC response
+
+## Corex Module
+
+### $cfg(key) - Config File Attributes
+
+Attributes related to configuration file.
+
+The key can be:
+
+- line - return the current line in config
+- name - return the name of current config file
+- file - return the name of current config file
+- route - return the name of routing block
+
+Example:
+
+``` c
+send_reply("404", "Not found at line $cfg(line)");
+```
+
+### $lsock(expr) - Listen Socket Attributes
+
+Get attributes for listen sockets.
+
+The **expr** is an expression specifying what to match and return, the
+format is:
+
+    matchid/value/field
+
+The **expr** can contain variables that are evaluated before parsing the
+expression.
+
+The **matchid** can be:
+
+- n - match on name
+- l - match on listen address
+
+The **value** specifies what to match with.
+
+The **field** can be (only first character matches):
+
+- name - return name
+- listen - return the listen address
+- advertise - return the advertise address
+- index - return the index in the list of all sockets
+
+Example:
+
+``` c
+    listen=udp:127.0.0.1:5060 advertise 127.0.0.1:5090 name "s0"
+    ...
+    xinfo("$lsock(n/s0/listen)\n");
+    xinfo("$lsock(l/udp:127.0.0.1:5060/name)\n");
+    $var(s0) = "n/s0/listen";
+    xinfo("$lsock($var(s0))\n");
+```
+
+### $atkv(name) - Async Type-Key-Value Event Attributes
+
+Attributes for Async Type-Key-Value events.
+
+The key can be:
+
+- type - type of event
+- key - key of event
+- val - value of event
+- gname - async group name
+
+Example:
+
+``` c
+event_route[core:tkv] {
+    xlog("$atkv(type) / $atkv(key) / $atkv(val)\n");
+}
+```
+
+## Evrexec Module
+
+### $evr(key)
+
+evrexec attributes:
+
+- $evr(data) - processing data
+- $evr(srcip) - source ip
+- $evr(srcport) - sourceport as string
+- $evr(srcportno) - source port as number
+
+## Presence Module
+
+### $subs(key) - Subscription Attributes
+
+This variable gives access to attributes of the current subscription.
+The variable has to be used after executing _handle_subscription()_ in
+order to provide accurate values.
+
+The key can be:
+
+- uri - subscription URI. Useful in particular for subscriptions
+    within the dialog, when the request URI in SUBSCRIBE is the Contact
+    address from the initial subscription.
+
+## Registrar Module
+
+### $ulc(profile=>attr) - Registered Contact Attributes
+
+Access the attributes of contact addresses stored in 'profile'.
+
+It must be used after a call of “reg_fetch_contacts()”.
+
+## Sipcapture Module
+
+### $hep(key) - HEP Packet Attributes
+
+The key refers to HEP packet header values:
+
+- version - HEP version
+- src_ip - source IP address
+- dst_ip - destination IP address
+- 0x000 - HEP attribute 0x000
+- 0x999 - HEP attribute 0x999
+
+## Phonenum Variables
+
+$phn(rid=>key) - rid is an identifier for this query result; it is
+designated by the second parameter of phonenum_match(). The key can be
+one of the following:
+
+- number - phone number that is matched
+- valid - 1 if the matched number has a valid result; 0 otherwise
+- normalized - normalized phone number
+- cctel - country code for phone number
+- ltype - local network type
+- ndesc - phone number description
+- error - error string if phone number matching fails.
+
+``` c
+if(phonenum_match("1-484-555-8888", "src")) {
+    if($phn(src=>valid)==1) {
+        xlog("number normalized to: $phn(src=>normalized)\n");
+    } else {
+        xlog("number normalization error: $phn(src=>error)\n");
+    }
+}
+```
+
+## SecSIPId Variables
+
+$secsipid(key) - return attributes of secsipid module.
+
+The key can be:
+
+- val - the value of Identity computed by secsipid_build_identity(...)
+- ret - the return code of the libsecsipid function used by
+    secsipid_build_identity(...)
+
+Example:
+
+``` c
+if(secsipid_build_identity("$fU", "$rU", "A", "",
+        "https://kamailio.org/stir/$rd/cert.pem", "/secsipid/$rd/key.pem")) {
+    xinfo("identity value: $secsipid(val)\n");
+}
+```
+
+## sdpops module variables
+
+The variables are read-only unless specified otherwise.
+
+- `$sdp(body)` or `$sdp(raw)` - full SDP body
+- `$sdp(sess_version)` - `sess-version` attribute from SDP `o=` line. When
+    set to special value `-1`, current value is incremented. (read +
+    write)
+- `$sdp(c:ip)` - connection IP - taken from first media stream if specified,
+    otherwise from first session
+- `$sdp(c:af)` - connection address family
+- `$sdp(o:ip)` - origin IP
+- `$sdp(m0:raw)` - all lines (raw) of first media stream
+- `$sdp(m0:rtp:port)` - rtp port of first media stream
+- `$sdp(m0:rtcp:port)` - rtcp port of first media stream, if not set is rtp port incremented
+- `$sdp(m0:b:AS)` - value from `b=AS:...` line of first media stream
+- `$sdp(m0:b:RR)` - value from `b=RR:...` line of first media stream
+- `$sdp(m0:b:RS)` - value from `b=AS:...` line of first media stream
+
+## $sruid - Unique ID
+
+- $sruid - return unique ID generated internally Kamailio
+
+## $ltt(key) - Local To-Tag
+
+$ltt(key) - return local generated To-tag when Kamailio sends a reply
+
+- $ltt(s) - the to-tag used in stateless replies
+- $ltt(t) - the to-tag used in transaction stateful replies
+    (transaction has to be created at that time, eg., by t_newtran() or
+    in a branch/failure route, otherwise it returns $null)
+- $ltt(x) - $ltt(t) if the transaction was created already, otherwise
+    $ltt(s)
+
+## $via0(attr) - Via\[0\] Attributes
+
+$via0(attr) - attributes of first Via header.
+
+The attr can be:
+
+- host - host part (string)
+- port - port (number)
+- proto - protocol - transport part (string)
+- protoid - protocol id (integer id)
+- branch - branch parameter
+- rport - rport parameter value (string)
+- received - received parameter value (string)
+- i - i parameter value (string)
+- params - all parameters
+- oc - 0 if the oc parameter is not present; 1 if present but no value; 2 if present with value
+- ocval - value of oc parameter
+- ocalgo - the value of oc-algo parameter
+- ocvalidity - the value of oc-validity parameter
+- ocseq - the value of oc-seq parameter
+
+## $via1(attr) - Second Via Attributes
+
+$via1(attr) - attributes of second Via header. The attr can be the same
+as for $via0(attr).
+
+## $viaZ(attr) - Last Via Attributes
+
+$viaZ(attr) - attributes of last Via header. The attr can be the same as
+for $via0(attr).
+
+## tcpops module variable
+
+$tcp(key) - return TCP connection attributes.
+
+The key can be:
+
+- `c_si` - connection source ip (useful with HAProxy connections), if the connection
+    is not found, it returns the SIP message source IP
+- `c_sp` - connection source port (useful with HAProxy connections), if the connection
+    is not found, it returns the SIP message source port
+- `conid` - connection id
+- `ac_si` - active connection source ip (useful with HAProxy connections), if the connection
+    is not found, it returns `$null`
+- `ac_sp` - active connection source port (useful with HAProxy connections), if the connection
+    is not found, it returns `$null`
+- `aconid` - active connection id, if the connection is not found, it returns `$null`
+
+## pv_headers module variables
+
+- $x_hdr(_header_name_): _header_name_ header value
+- $x_fu: Full From header
+- $x_fU: From header user part
+- $x_fd: From header domain part
+- $x_fn: From header Display Name part
+- $x_ft: From header Tag
+- $x_tu: Full To header
+- $x_tU: To header user part
+- $x_td: To header domain part
+- $x_tn: To header Display Name part
+- $x_tt: To header Tag
+- $x_rs:
+- $x_rr:
+
+## microhttpd module variables
+
+`$mhttpd(key)` - return attributes of the HTTP request received by microhttpd module.
+
+The key can be:
+
+- `url` - the http url
+- `data` - the body of http request
+- `size` - the size of the body
+- `method` - the http method
+- `srcip` - the source ip
+- `version` - the http version
+
+## $C(xy) - Foreground and background colors
+
+$C(xy) - reference to an escape sequence. “x” represents the foreground
+color and “y” represents the background color.
+
+Colors could be:
+
+- x : default color of the terminal
+- s : Black
+- r : Red
+- g : Green
+- y : Yellow
+- b : Blue
+- p : Purple
+- c : Cyan
+- w : White
+
+## $K(key) - Kamailio Constants
+
+$K(key) - return the numeric values corresponding to Kamailio
+configuration constants.
+
+The key can be:
+
+- IPv4 - return AF_INET
+- IPv6 - return AF_INET6
+- UDP - return PROTO_UDP
+- TCP - return PROTO_TCP
+- TLS - return PROTO_TLS
+- SCTP - return PROTO_SCTP
+- WS - return PROTO_WS
+- WSS - return PROTO_WSS
+
+``` c
+xinfo("proto UDP numeric id: $K(UDP)\n");
+```
+
+## Examples
+
+A few examples of usage.
+
+Example 1. Pseudo-variables usage
+
+``` c
+...
+avp_aliases="uuid=I:50"
+...
+route {
+...
+    $avp(uuid)="caller_id";
+    $avp(i:20)= $avp(uuid) + ": " + $fu;
+    xdbg("$(C(bg))avp(i:20)$(C(xx)) [$avp(i:20)] $(C(br))cseq$(C(xx))=[$hdr(cseq)]\n");
+...
+}
+...
+```
+
+### Request-URI and Destination-URI parsing
+
+Following are some examples how RURI and DURI are parsed, for SIP-URIs,
+tel-URIs and Service-URNs:
+
+```shell
+    # Request URI contains SIP URI
+    $ru = "sip:example.com"
+    $rz = "sip"
+    $rU = "<null>"
+    $rd = "example.com"
+    $rp = "5060"
+    $rP = "UDP"
+
+    # Request URI contains SIP URI
+    $ru = "sips:john.q.public:[email protected]:6061 transport=tls;foo=bar"
+      $rz = "sips"
+      $rU = "john.q.public"
+      $rd = "example.com"
+      $rp = "6061"
+      $rP = "tls"
+
+    # Request URI contains service URN
+    $ru = "urn:service:sos.fire"
+      $rz = "urn"
+      $rU = "service"
+      $rd = "sos.fire"
+      $rp = "5060"
+      $rP = "UDP"
+
+    # Request URI contains tel: URI
+    $ru = "tel:+1-201-555-0123"
+      $rz = "tel"
+      $rU = "+1-201-555-0123"
+      $rd = "<null>"
+      $rp = "5060"
+      $rP = "UDP"
+
+    # Request URI contains tel: URI with phone-context
+    $ru = "tel:7042;phone-context=example.com"
+      $rz = "tel"
+      $rU = "7042"
+      $rd = "<null>"
+      $rp = "5060"
+      $rP = "UDP"
+
+    # Destination URI (must be a SIP(S) URI)
+    $du = "sip:example.com:6061;transport=tls;foo=bar"
+      $dd = "example.com"
+      $dp = "6061"
+      $dP = "tls"
+```

BIN
docs/cookbooks/6.0.x/pseudovariables.png


+ 3053 - 0
docs/cookbooks/6.0.x/selects.md

@@ -0,0 +1,3053 @@
+# Selects Variables
+
+Version: Kamailio SIP Server v6.0.x (stable)
+
+The **select** is a READ-ONLY "function", that helps to get direct
+access to some parts of SIP message within the script (like @to,
[email protected], @msg\["P-anyheader-youwant"\]), but generally it could be
+seen as a function with a certain number of parameters that returns a
+string.
+
+Selects are available via pseudo-variable $sel(...), respectively
+**@name** corresponds to **$sel(name)**.
+
+Each module can extend the syntax the select framework understands by
+registering its own select table. Look at the TLS module or db_ops as
+good samples.
+
+For a more detailed overview check [The Select Framework](http://sip-router.org/wiki/ref_manual/selects).
+
+## Select Classes
+
+### contact
+
+Select handling Contact headers.
+
+### from
+
+Select handling From header
+
+### msg
+
+Select handling SIP message.
+
+### ruri
+
+Select handling R-URI.
+
+Syntax:
+
+``` c
+@ruri
+```
+
+Return the value of request URI (R-URI).
+
+### tls
+
+Select handling TLS environment.
+
+### to
+
+Select handling To header.
+
+### sys
+
+Select handling system values
+
+### via
+
+Select handling Via header.
+
+Syntax:
+
+``` c
+@via
+@via[index]
+@via[index].param
+...
+```
+
+Return entire or parts of Via header.
+
+Example:
+
+- return the IP of top most Via header
+
+``` c
+@via[1].host
+```
+
+### xmlrpc
+
+Select handling XMLRPC requests via XMLRPC module.
+
+## The List Of Selects
+
+
+Note that this list might not be complete.
+
+The next part was auto-generated from ser_objdump CSV output. If you want to
+add description, examples, comments, etc., please add entries above.
+
+    awk -F, '{print $3 " " $1;}' selects.csv | sort | awk '{print "==== " $1 " ====\n\nExported by: " $2 "\n\n";}'
+
+### @authorization\[%s\]
+
+Exported by: core
+
+### @authorization\[%s\].algorithm
+
+Exported by: core
+
+### @authorization\[%s\].cnonce
+
+Exported by: core
+
+### @authorization\[%s\].nc
+
+Exported by: core
+
+### @authorization\[%s\].nonce
+
+Exported by: core
+
+### @authorization\[%s\].opaque
+
+Exported by: core
+
+### @authorization\[%s\].qop
+
+Exported by: core
+
+### @authorization\[%s\].realm
+
+Exported by: core
+
+### @authorization\[%s\].response
+
+Exported by: core
+
+### @authorization\[%s\].uri
+
+Exported by: core
+
+### @authorization\[%s\].username
+
+Exported by: core
+
+### @authorization\[%s\].username.domain
+
+Exported by: core
+
+### @authorization\[%s\].username.user
+
+Exported by: core
+
+### @contact
+
+Exported by: core
+
+### @contact.expires
+
+Exported by: core
+
+### @contact.instance
+
+Exported by: core
+
+### @contact.method
+
+Exported by: core
+
+### @contact.name
+
+Exported by: core
+
+### @contact.params\[%s\]
+
+Exported by: core
+
+### @contact.q
+
+Exported by: core
+
+### @contact.received
+
+Exported by: core
+
+### @contact.uri
+
+Exported by: core
+
+### @contact.uri.host
+
+Exported by: core
+
+### @contact.uri.hostport
+
+Exported by: core
+
+### @contact.uri.params
+
+Exported by: core
+
+### @contact.uri.params\[%s\]
+
+Exported by: core
+
+### @contact.uri.port
+
+Exported by: core
+
+### @contact.uri.pwd
+
+Exported by: core
+
+### @contact.uri.type
+
+Exported by: core
+
+### @contact.uri.user
+
+Exported by: core
+
+### @cseq
+
+Exported by: core
+
+### @cseq.method
+
+Exported by: core
+
+### @cseq.num
+
+Exported by: core
+
+### @db.fetch\[%i\]
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].count
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].field\[%i\]
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].field\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].field\[%i\].uri
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].row\[%i\]
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].row\[%i\].field\[%i\]
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].row\[%i\].field\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].row\[%i\].field\[%i\].uri
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].row_no
+
+Exported by: db_ops
+
+### @db.fetch\[%i\].uri
+
+Exported by: db_ops
+
+### @db.query\[%i\]
+
+Exported by: db_ops
+
+### @db.query\[%i\].count
+
+Exported by: db_ops
+
+### @db.query\[%i\].field\[%i\]
+
+Exported by: db_ops
+
+### @db.query\[%i\].field\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.query\[%i\].field\[%i\].uri
+
+Exported by: db_ops
+
+### @db.query\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.query\[%i\].row\[%i\]
+
+Exported by: db_ops
+
+### @db.query\[%i\].row\[%i\].field\[%i\]
+
+Exported by: db_ops
+
+### @db.query\[%i\].row\[%i\].field\[%i\].nameaddr
+
+Exported by: db_ops
+
+### @db.query\[%i\].row\[%i\].field\[%i\].uri
+
+Exported by: db_ops
+
+### @db.query\[%i\].uri
+
+Exported by: db_ops
+
+### @dst.ip
+
+Exported by: core
+
+### @dst.ip_port
+
+Exported by: core
+
+### @dst.port
+
+Exported by: core
+
+### @dst_uri
+
+Exported by: core
+
+### @dst_uri.host
+
+Exported by: core
+
+### @dst_uri.hostport
+
+Exported by: core
+
+### @dst_uri.params
+
+Exported by: core
+
+### @dst_uri.params\[%s\]
+
+Exported by: core
+
+### @dst_uri.port
+
+Exported by: core
+
+### @dst_uri.pwd
+
+Exported by: core
+
+### @dst_uri.type
+
+Exported by: core
+
+### @dst_uri.user
+
+Exported by: core
+
+### @eval.get\[%i\]
+
+Exported by: eval
+
+### @eval.get\[%i\].nameaddr
+
+Exported by: eval
+
+### @eval.get\[%i\].uri
+
+Exported by: eval
+
+### @eval.pop\[%i\]
+
+Exported by: eval
+
+### @eval.reg\[%s\]
+
+Exported by: eval
+
+### @eval.reg\[%s\].nameaddr
+
+Exported by: eval
+
+### @eval.reg\[%s\].uri
+
+Exported by: eval
+
+### @eval.uuid
+
+Exported by: eval
+
+### @event
+
+Exported by: core
+
+### @f
+
+Exported by: core
+
+### @f.name
+
+Exported by: core
+
+### @f.params\[%s\]
+
+Exported by: core
+
+### @f.tag
+
+Exported by: core
+
+### @f.uri
+
+Exported by: core
+
+### @f.uri.host
+
+Exported by: core
+
+### @f.uri.hostport
+
+Exported by: core
+
+### @f.uri.params
+
+Exported by: core
+
+### @f.uri.params\[%s\]
+
+Exported by: core
+
+### @f.uri.port
+
+Exported by: core
+
+### @f.uri.pwd
+
+Exported by: core
+
+### @f.uri.type
+
+Exported by: core
+
+### @f.uri.user
+
+Exported by: core
+
+### @from
+
+Exported by: core
+
+### @from.name
+
+Exported by: core
+
+### @from.params\[%s\]
+
+Exported by: core
+
+### @from.tag
+
+Exported by: core
+
+### @from.uri
+
+Exported by: core
+
+### @from.uri.host
+
+Exported by: core
+
+### @from.uri.hostport
+
+Exported by: core
+
+### @from.uri.params
+
+Exported by: core
+
+### @from.uri.params\[%s\]
+
+Exported by: core
+
+### @from.uri.port
+
+Exported by: core
+
+### @from.uri.pwd
+
+Exported by: core
+
+### @from.uri.type
+
+Exported by: core
+
+### @from.uri.user
+
+Exported by: core
+
+### @hf_value.%s
+
+Exported by: textops
+
+### @hf_value.%s.%s
+
+Exported by: textops
+
+### @hf_value.%s.name
+
+Exported by: textops
+
+### @hf_value.%s.nameaddr
+
+Exported by: textops
+
+### @hf_value.%s.p\[%s\]
+
+Exported by: textops
+
+### @hf_value.%s.param\[%s\]
+
+Exported by: textops
+
+### @hf_value.%s.uri
+
+Exported by: textops
+
+### @hf_value.%s.uri
+
+Exported by: textops
+
+### @hf_value.%s\[%i\]
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].%s
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].name
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].nameaddr
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].p\[%s\]
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].param\[%s\]
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].uri
+
+Exported by: textops
+
+### @hf_value.%s\[%i\].uri
+
+Exported by: textops
+
+### @hf_value2.%s
+
+Exported by: textops
+
+### @hf_value2.%s.%s
+
+Exported by: textops
+
+### @hf_value2.%s.%s
+
+Exported by: textops
+
+### @hf_value2.%s.%s
+
+Exported by: textops
+
+### @hf_value2.%s\[%i\]
+
+Exported by: textops
+
+### @hf_value2.%s\[%i\].%s
+
+Exported by: textops
+
+### @hf_value2.%s\[%i\].%s
+
+Exported by: textops
+
+### @hf_value2.%s\[%i\].%s
+
+Exported by: textops
+
+### @hf_value_exists\[%s\].%s
+
+Exported by: textops
+
+### @m
+
+Exported by: core
+
+### @m.expires
+
+Exported by: core
+
+### @m.instance
+
+Exported by: core
+
+### @m.method
+
+Exported by: core
+
+### @m.name
+
+Exported by: core
+
+### @m.params\[%s\]
+
+Exported by: core
+
+### @m.q
+
+Exported by: core
+
+### @m.received
+
+Exported by: core
+
+### @m.uri
+
+Exported by: core
+
+### @m.uri.host
+
+Exported by: core
+
+### @m.uri.hostport
+
+Exported by: core
+
+### @m.uri.params
+
+Exported by: core
+
+### @m.uri.params\[%s\]
+
+Exported by: core
+
+### @m.uri.port
+
+Exported by: core
+
+### @m.uri.pwd
+
+Exported by: core
+
+### @m.uri.type
+
+Exported by: core
+
+### @m.uri.user
+
+Exported by: core
+
+### @method
+
+Exported by: core
+
+### @msg.%s
+
+Exported by: core
+
+### @msg.%s.nameaddr
+
+Exported by: core
+
+### @msg.%s.nameaddr.name
+
+Exported by: core
+
+### @msg.%s.nameaddr.params
+
+Exported by: core
+
+### @msg.%s.nameaddr.params\[%s\]
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.host
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.hostport
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.params
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.params\[%s\]
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.port
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.pwd
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.type
+
+Exported by: core
+
+### @msg.%s.nameaddr.uri.user
+
+Exported by: core
+
+### @msg.%s.params\[%s\]
+
+Exported by: core
+
+### @msg.%s\[%i\]
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.name
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.params
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.params\[%s\]
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.host
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.hostport
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.params
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.params\[%s\]
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.port
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.pwd
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.type
+
+Exported by: core
+
+### @msg.%s\[%i\].nameaddr.uri.user
+
+Exported by: core
+
+### @msg.%s\[%i\].params\[%s\]
+
+Exported by: core
+
+### @nathelper.rewrite_contact\[%i\]
+
+Exported by: nathelper
+
+### @nathelper.rewrite_contact\[%i\].nameaddr
+
+Exported by: nathelper
+
+### @next_hop
+
+Exported by: core
+
+### @next_hop.host
+
+Exported by: core
+
+### @next_hop.hostport
+
+Exported by: core
+
+### @next_hop.params
+
+Exported by: core
+
+### @next_hop.params\[%s\]
+
+Exported by: core
+
+### @next_hop.port
+
+Exported by: core
+
+### @next_hop.pwd
+
+Exported by: core
+
+### @next_hop.type
+
+Exported by: core
+
+### @next_hop.user
+
+Exported by: core
+
+### @proxy_authorization\[%s\]
+
+Exported by: core
+
+### @proxy_authorization\[%s\].algorithm
+
+Exported by: core
+
+### @proxy_authorization\[%s\].cnonce
+
+Exported by: core
+
+### @proxy_authorization\[%s\].nc
+
+Exported by: core
+
+### @proxy_authorization\[%s\].nonce
+
+Exported by: core
+
+### @proxy_authorization\[%s\].opaque
+
+Exported by: core
+
+### @proxy_authorization\[%s\].qop
+
+Exported by: core
+
+### @proxy_authorization\[%s\].realm
+
+Exported by: core
+
+### @proxy_authorization\[%s\].response
+
+Exported by: core
+
+### @proxy_authorization\[%s\].uri
+
+Exported by: core
+
+### @proxy_authorization\[%s\].username
+
+Exported by: core
+
+### @proxy_authorization\[%s\].username.domain
+
+Exported by: core
+
+### @proxy_authorization\[%s\].username.user
+
+Exported by: core
+
+### @received.ip
+
+Exported by: core
+
+### @received.ip_port
+
+Exported by: core
+
+### @received.port
+
+Exported by: core
+
+### @received.proto
+
+Exported by: core
+
+### @received.proto_ip_port
+
+Exported by: core
+
+### @record_route
+
+Exported by: core
+
+### @record_route.name
+
+Exported by: core
+
+### @record_route.params\[%s\]
+
+Exported by: core
+
+### @record_route.uri
+
+Exported by: core
+
+### @record_route.uri.host
+
+Exported by: core
+
+### @record_route.uri.hostport
+
+Exported by: core
+
+### @record_route.uri.params
+
+Exported by: core
+
+### @record_route.uri.params\[%s\]
+
+Exported by: core
+
+### @record_route.uri.port
+
+Exported by: core
+
+### @record_route.uri.pwd
+
+Exported by: core
+
+### @record_route.uri.type
+
+Exported by: core
+
+### @record_route.uri.user
+
+Exported by: core
+
+### @rr
+
+Exported by: core
+
+### @rr.dialog_cookie
+
+Exported by: rr
+
+### @rr.name
+
+Exported by: core
+
+### @rr.params\[%s\]
+
+Exported by: core
+
+### @rr.uri
+
+Exported by: core
+
+### @rr.uri.host
+
+Exported by: core
+
+### @rr.uri.hostport
+
+Exported by: core
+
+### @rr.uri.params
+
+Exported by: core
+
+### @rr.uri.params\[%s\]
+
+Exported by: core
+
+### @rr.uri.port
+
+Exported by: core
+
+### @rr.uri.pwd
+
+Exported by: core
+
+### @rr.uri.type
+
+Exported by: core
+
+### @rr.uri.user
+
+Exported by: core
+
+### @ruri
+
+Exported by: core
+
+### @ruri.host
+
+Exported by: core
+
+### @ruri.hostport
+
+Exported by: core
+
+### @ruri.params
+
+Exported by: core
+
+### @ruri.params\[%s\]
+
+Exported by: core
+
+### @ruri.port
+
+Exported by: core
+
+### @ruri.pwd
+
+Exported by: core
+
+### @ruri.type
+
+Exported by: core
+
+### @ruri.user
+
+Exported by: core
+
+### @src.ip
+
+Exported by: core
+
+### @src.ip_port
+
+Exported by: core
+
+### @src.port
+
+Exported by: core
+
+### @t
+
+Exported by: core
+
+### @t.name
+
+Exported by: core
+
+### @t.params\[%s\]
+
+Exported by: core
+
+### @t.tag
+
+Exported by: core
+
+### @t.uri
+
+Exported by: core
+
+### @t.uri.host
+
+Exported by: core
+
+### @t.uri.hostport
+
+Exported by: core
+
+### @t.uri.params
+
+Exported by: core
+
+### @t.uri.params\[%s\]
+
+Exported by: core
+
+### @t.uri.port
+
+Exported by: core
+
+### @t.uri.pwd
+
+Exported by: core
+
+### @t.uri.type
+
+Exported by: core
+
+### @t.uri.user
+
+Exported by: core
+
+### @timer\[%i\].enabled
+
+Exported by: timer
+
+### @tls
+
+Exported by: tls
+
+### @tls.cipher
+
+Exported by: tls
+
+### @tls.cipher.bits
+
+Exported by: tls
+
+### @tls.desc
+
+Exported by: tls
+
+### @tls.description
+
+Exported by: tls
+
+### @tls.me
+
+Exported by: tls
+
+### @tls.me.IPAddress
+
+Exported by: tls
+
+### @tls.me.dns
+
+Exported by: tls
+
+### @tls.me.email
+
+Exported by: tls
+
+### @tls.me.emailAddress
+
+Exported by: tls
+
+### @tls.me.email_address
+
+Exported by: tls
+
+### @tls.me.expired
+
+Exported by: tls
+
+### @tls.me.host
+
+Exported by: tls
+
+### @tls.me.hostname
+
+Exported by: tls
+
+### @tls.me.ip
+
+Exported by: tls
+
+### @tls.me.ip_address
+
+Exported by: tls
+
+### @tls.me.issuer
+
+Exported by: tls
+
+### @tls.me.issuer.c
+
+Exported by: tls
+
+### @tls.me.issuer.cn
+
+Exported by: tls
+
+### @tls.me.issuer.commonName
+
+Exported by: tls
+
+### @tls.me.issuer.common_name
+
+Exported by: tls
+
+### @tls.me.issuer.country
+
+Exported by: tls
+
+### @tls.me.issuer.countryName
+
+Exported by: tls
+
+### @tls.me.issuer.country_name
+
+Exported by: tls
+
+### @tls.me.issuer.l
+
+Exported by: tls
+
+### @tls.me.issuer.locality
+
+Exported by: tls
+
+### @tls.me.issuer.localityName
+
+Exported by: tls
+
+### @tls.me.issuer.locality_name
+
+Exported by: tls
+
+### @tls.me.issuer.name
+
+Exported by: tls
+
+### @tls.me.issuer.o
+
+Exported by: tls
+
+### @tls.me.issuer.organization
+
+Exported by: tls
+
+### @tls.me.issuer.organizationName
+
+Exported by: tls
+
+### @tls.me.issuer.organization_name
+
+Exported by: tls
+
+### @tls.me.issuer.organizationalUnitName
+
+Exported by: tls
+
+### @tls.me.issuer.organizational_unit_name
+
+Exported by: tls
+
+### @tls.me.issuer.ou
+
+Exported by: tls
+
+### @tls.me.issuer.st
+
+Exported by: tls
+
+### @tls.me.issuer.state
+
+Exported by: tls
+
+### @tls.me.issuer.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.me.issuer.state_or_province_name
+
+Exported by: tls
+
+### @tls.me.issuer.unit
+
+Exported by: tls
+
+### @tls.me.notAfter
+
+Exported by: tls
+
+### @tls.me.notBefore
+
+Exported by: tls
+
+### @tls.me.not_after
+
+Exported by: tls
+
+### @tls.me.not_before
+
+Exported by: tls
+
+### @tls.me.revoked
+
+Exported by: tls
+
+### @tls.me.self_signed
+
+Exported by: tls
+
+### @tls.me.serialNumber
+
+Exported by: tls
+
+### @tls.me.serial_number
+
+Exported by: tls
+
+### @tls.me.sn
+
+Exported by: tls
+
+### @tls.me.subj
+
+Exported by: tls
+
+### @tls.me.subj.c
+
+Exported by: tls
+
+### @tls.me.subj.cn
+
+Exported by: tls
+
+### @tls.me.subj.commonName
+
+Exported by: tls
+
+### @tls.me.subj.common_name
+
+Exported by: tls
+
+### @tls.me.subj.country
+
+Exported by: tls
+
+### @tls.me.subj.countryName
+
+Exported by: tls
+
+### @tls.me.subj.country_name
+
+Exported by: tls
+
+### @tls.me.subj.l
+
+Exported by: tls
+
+### @tls.me.subj.locality
+
+Exported by: tls
+
+### @tls.me.subj.localityName
+
+Exported by: tls
+
+### @tls.me.subj.locality_name
+
+Exported by: tls
+
+### @tls.me.subj.name
+
+Exported by: tls
+
+### @tls.me.subj.o
+
+Exported by: tls
+
+### @tls.me.subj.organization
+
+Exported by: tls
+
+### @tls.me.subj.organizationName
+
+Exported by: tls
+
+### @tls.me.subj.organization_name
+
+Exported by: tls
+
+### @tls.me.subj.organizationalUnitName
+
+Exported by: tls
+
+### @tls.me.subj.organizational_unit_name
+
+Exported by: tls
+
+### @tls.me.subj.ou
+
+Exported by: tls
+
+### @tls.me.subj.st
+
+Exported by: tls
+
+### @tls.me.subj.state
+
+Exported by: tls
+
+### @tls.me.subj.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.me.subj.state_or_province_name
+
+Exported by: tls
+
+### @tls.me.subj.unit
+
+Exported by: tls
+
+### @tls.me.subject
+
+Exported by: tls
+
+### @tls.me.subject.c
+
+Exported by: tls
+
+### @tls.me.subject.cn
+
+Exported by: tls
+
+### @tls.me.subject.commonName
+
+Exported by: tls
+
+### @tls.me.subject.common_name
+
+Exported by: tls
+
+### @tls.me.subject.country
+
+Exported by: tls
+
+### @tls.me.subject.countryName
+
+Exported by: tls
+
+### @tls.me.subject.country_name
+
+Exported by: tls
+
+### @tls.me.subject.l
+
+Exported by: tls
+
+### @tls.me.subject.locality
+
+Exported by: tls
+
+### @tls.me.subject.localityName
+
+Exported by: tls
+
+### @tls.me.subject.locality_name
+
+Exported by: tls
+
+### @tls.me.subject.name
+
+Exported by: tls
+
+### @tls.me.subject.o
+
+Exported by: tls
+
+### @tls.me.subject.organization
+
+Exported by: tls
+
+### @tls.me.subject.organizationName
+
+Exported by: tls
+
+### @tls.me.subject.organization_name
+
+Exported by: tls
+
+### @tls.me.subject.organizationalUnitName
+
+Exported by: tls
+
+### @tls.me.subject.organizational_unit_name
+
+Exported by: tls
+
+### @tls.me.subject.ou
+
+Exported by: tls
+
+### @tls.me.subject.st
+
+Exported by: tls
+
+### @tls.me.subject.state
+
+Exported by: tls
+
+### @tls.me.subject.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.me.subject.state_or_province_name
+
+Exported by: tls
+
+### @tls.me.subject.unit
+
+Exported by: tls
+
+### @tls.me.uri
+
+Exported by: tls
+
+### @tls.me.url
+
+Exported by: tls
+
+### @tls.me.urn
+
+Exported by: tls
+
+### @tls.me.verified
+
+Exported by: tls
+
+### @tls.me.version
+
+Exported by: tls
+
+### @tls.my
+
+Exported by: tls
+
+### @tls.my.IPAddress
+
+Exported by: tls
+
+### @tls.my.dns
+
+Exported by: tls
+
+### @tls.my.email
+
+Exported by: tls
+
+### @tls.my.emailAddress
+
+Exported by: tls
+
+### @tls.my.email_address
+
+Exported by: tls
+
+### @tls.my.expired
+
+Exported by: tls
+
+### @tls.my.host
+
+Exported by: tls
+
+### @tls.my.hostname
+
+Exported by: tls
+
+### @tls.my.ip
+
+Exported by: tls
+
+### @tls.my.ip_address
+
+Exported by: tls
+
+### @tls.my.issuer
+
+Exported by: tls
+
+### @tls.my.issuer.c
+
+Exported by: tls
+
+### @tls.my.issuer.cn
+
+Exported by: tls
+
+### @tls.my.issuer.commonName
+
+Exported by: tls
+
+### @tls.my.issuer.common_name
+
+Exported by: tls
+
+### @tls.my.issuer.country
+
+Exported by: tls
+
+### @tls.my.issuer.countryName
+
+Exported by: tls
+
+### @tls.my.issuer.country_name
+
+Exported by: tls
+
+### @tls.my.issuer.l
+
+Exported by: tls
+
+### @tls.my.issuer.locality
+
+Exported by: tls
+
+### @tls.my.issuer.localityName
+
+Exported by: tls
+
+### @tls.my.issuer.locality_name
+
+Exported by: tls
+
+### @tls.my.issuer.name
+
+Exported by: tls
+
+### @tls.my.issuer.o
+
+Exported by: tls
+
+### @tls.my.issuer.organization
+
+Exported by: tls
+
+### @tls.my.issuer.organizationName
+
+Exported by: tls
+
+### @tls.my.issuer.organization_name
+
+Exported by: tls
+
+### @tls.my.issuer.organizationalUnitName
+
+Exported by: tls
+
+### @tls.my.issuer.organizational_unit_name
+
+Exported by: tls
+
+### @tls.my.issuer.ou
+
+Exported by: tls
+
+### @tls.my.issuer.st
+
+Exported by: tls
+
+### @tls.my.issuer.state
+
+Exported by: tls
+
+### @tls.my.issuer.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.my.issuer.state_or_province_name
+
+Exported by: tls
+
+### @tls.my.issuer.unit
+
+Exported by: tls
+
+### @tls.my.notAfter
+
+Exported by: tls
+
+### @tls.my.notBefore
+
+Exported by: tls
+
+### @tls.my.not_after
+
+Exported by: tls
+
+### @tls.my.not_before
+
+Exported by: tls
+
+### @tls.my.revoked
+
+Exported by: tls
+
+### @tls.my.self_signed
+
+Exported by: tls
+
+### @tls.my.serialNumber
+
+Exported by: tls
+
+### @tls.my.serial_number
+
+Exported by: tls
+
+### @tls.my.sn
+
+Exported by: tls
+
+### @tls.my.subj
+
+Exported by: tls
+
+### @tls.my.subj.c
+
+Exported by: tls
+
+### @tls.my.subj.cn
+
+Exported by: tls
+
+### @tls.my.subj.commonName
+
+Exported by: tls
+
+### @tls.my.subj.common_name
+
+Exported by: tls
+
+### @tls.my.subj.country
+
+Exported by: tls
+
+### @tls.my.subj.countryName
+
+Exported by: tls
+
+### @tls.my.subj.country_name
+
+Exported by: tls
+
+### @tls.my.subj.l
+
+Exported by: tls
+
+### @tls.my.subj.locality
+
+Exported by: tls
+
+### @tls.my.subj.localityName
+
+Exported by: tls
+
+### @tls.my.subj.locality_name
+
+Exported by: tls
+
+### @tls.my.subj.name
+
+Exported by: tls
+
+### @tls.my.subj.o
+
+Exported by: tls
+
+### @tls.my.subj.organization
+
+Exported by: tls
+
+### @tls.my.subj.organizationName
+
+Exported by: tls
+
+### @tls.my.subj.organization_name
+
+Exported by: tls
+
+### @tls.my.subj.organizationalUnitName
+
+Exported by: tls
+
+### @tls.my.subj.organizational_unit_name
+
+Exported by: tls
+
+### @tls.my.subj.ou
+
+Exported by: tls
+
+### @tls.my.subj.st
+
+Exported by: tls
+
+### @tls.my.subj.state
+
+Exported by: tls
+
+### @tls.my.subj.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.my.subj.state_or_province_name
+
+Exported by: tls
+
+### @tls.my.subj.unit
+
+Exported by: tls
+
+### @tls.my.subject
+
+Exported by: tls
+
+### @tls.my.subject.c
+
+Exported by: tls
+
+### @tls.my.subject.cn
+
+Exported by: tls
+
+### @tls.my.subject.commonName
+
+Exported by: tls
+
+### @tls.my.subject.common_name
+
+Exported by: tls
+
+### @tls.my.subject.country
+
+Exported by: tls
+
+### @tls.my.subject.countryName
+
+Exported by: tls
+
+### @tls.my.subject.country_name
+
+Exported by: tls
+
+### @tls.my.subject.l
+
+Exported by: tls
+
+### @tls.my.subject.locality
+
+Exported by: tls
+
+### @tls.my.subject.localityName
+
+Exported by: tls
+
+### @tls.my.subject.locality_name
+
+Exported by: tls
+
+### @tls.my.subject.name
+
+Exported by: tls
+
+### @tls.my.subject.o
+
+Exported by: tls
+
+### @tls.my.subject.organization
+
+Exported by: tls
+
+### @tls.my.subject.organizationName
+
+Exported by: tls
+
+### @tls.my.subject.organization_name
+
+Exported by: tls
+
+### @tls.my.subject.organizationalUnitName
+
+Exported by: tls
+
+### @tls.my.subject.organizational_unit_name
+
+Exported by: tls
+
+### @tls.my.subject.ou
+
+Exported by: tls
+
+### @tls.my.subject.st
+
+Exported by: tls
+
+### @tls.my.subject.state
+
+Exported by: tls
+
+### @tls.my.subject.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.my.subject.state_or_province_name
+
+Exported by: tls
+
+### @tls.my.subject.unit
+
+Exported by: tls
+
+### @tls.my.subject.uid
+
+Exported by: tls
+
+### @tls.my.subject.uniqueIdentifier
+
+Exported by: tls
+
+### @tls.my.subject.unique_identifier
+
+Exported by: tls
+
+### @tls.my.uri
+
+Exported by: tls
+
+### @tls.my.url
+
+Exported by: tls
+
+### @tls.my.urn
+
+Exported by: tls
+
+### @tls.my.verified
+
+Exported by: tls
+
+### @tls.my.version
+
+Exported by: tls
+
+### @tls.myself
+
+Exported by: tls
+
+### @tls.myself.IPAddress
+
+Exported by: tls
+
+### @tls.myself.dns
+
+Exported by: tls
+
+### @tls.myself.email
+
+Exported by: tls
+
+### @tls.myself.emailAddress
+
+Exported by: tls
+
+### @tls.myself.email_address
+
+Exported by: tls
+
+### @tls.myself.expired
+
+Exported by: tls
+
+### @tls.myself.host
+
+Exported by: tls
+
+### @tls.myself.hostname
+
+Exported by: tls
+
+### @tls.myself.ip
+
+Exported by: tls
+
+### @tls.myself.ip_address
+
+Exported by: tls
+
+### @tls.myself.issuer
+
+Exported by: tls
+
+### @tls.myself.issuer.c
+
+Exported by: tls
+
+### @tls.myself.issuer.cn
+
+Exported by: tls
+
+### @tls.myself.issuer.commonName
+
+Exported by: tls
+
+### @tls.myself.issuer.common_name
+
+Exported by: tls
+
+### @tls.myself.issuer.country
+
+Exported by: tls
+
+### @tls.myself.issuer.countryName
+
+Exported by: tls
+
+### @tls.myself.issuer.country_name
+
+Exported by: tls
+
+### @tls.myself.issuer.l
+
+Exported by: tls
+
+### @tls.myself.issuer.locality
+
+Exported by: tls
+
+### @tls.myself.issuer.localityName
+
+Exported by: tls
+
+### @tls.myself.issuer.locality_name
+
+Exported by: tls
+
+### @tls.myself.issuer.name
+
+Exported by: tls
+
+### @tls.myself.issuer.o
+
+Exported by: tls
+
+### @tls.myself.issuer.organization
+
+Exported by: tls
+
+### @tls.myself.issuer.organizationName
+
+Exported by: tls
+
+### @tls.myself.issuer.organization_name
+
+Exported by: tls
+
+### @tls.myself.issuer.organizationalUnitName
+
+Exported by: tls
+
+### @tls.myself.issuer.organizational_unit_name
+
+Exported by: tls
+
+### @tls.myself.issuer.ou
+
+Exported by: tls
+
+### @tls.myself.issuer.st
+
+Exported by: tls
+
+### @tls.myself.issuer.state
+
+Exported by: tls
+
+### @tls.myself.issuer.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.myself.issuer.state_or_province_name
+
+Exported by: tls
+
+### @tls.myself.issuer.unit
+
+Exported by: tls
+
+### @tls.myself.notAfter
+
+Exported by: tls
+
+### @tls.myself.notBefore
+
+Exported by: tls
+
+### @tls.myself.not_after
+
+Exported by: tls
+
+### @tls.myself.not_before
+
+Exported by: tls
+
+### @tls.myself.revoked
+
+Exported by: tls
+
+### @tls.myself.self_signed
+
+Exported by: tls
+
+### @tls.myself.serialNumber
+
+Exported by: tls
+
+### @tls.myself.serial_number
+
+Exported by: tls
+
+### @tls.myself.sn
+
+Exported by: tls
+
+### @tls.myself.subj
+
+Exported by: tls
+
+### @tls.myself.subj.c
+
+Exported by: tls
+
+### @tls.myself.subj.cn
+
+Exported by: tls
+
+### @tls.myself.subj.commonName
+
+Exported by: tls
+
+### @tls.myself.subj.common_name
+
+Exported by: tls
+
+### @tls.myself.subj.country
+
+Exported by: tls
+
+### @tls.myself.subj.countryName
+
+Exported by: tls
+
+### @tls.myself.subj.country_name
+
+Exported by: tls
+
+### @tls.myself.subj.l
+
+Exported by: tls
+
+### @tls.myself.subj.locality
+
+Exported by: tls
+
+### @tls.myself.subj.localityName
+
+Exported by: tls
+
+### @tls.myself.subj.locality_name
+
+Exported by: tls
+
+### @tls.myself.subj.name
+
+Exported by: tls
+
+### @tls.myself.subj.o
+
+Exported by: tls
+
+### @tls.myself.subj.organization
+
+Exported by: tls
+
+### @tls.myself.subj.organizationName
+
+Exported by: tls
+
+### @tls.myself.subj.organization_name
+
+Exported by: tls
+
+### @tls.myself.subj.organizationalUnitName
+
+Exported by: tls
+
+### @tls.myself.subj.organizational_unit_name
+
+Exported by: tls
+
+### @tls.myself.subj.ou
+
+Exported by: tls
+
+### @tls.myself.subj.st
+
+Exported by: tls
+
+### @tls.myself.subj.state
+
+Exported by: tls
+
+### @tls.myself.subj.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.myself.subj.state_or_province_name
+
+Exported by: tls
+
+### @tls.myself.subj.unit
+
+Exported by: tls
+
+### @tls.myself.subject
+
+Exported by: tls
+
+### @tls.myself.subject.c
+
+Exported by: tls
+
+### @tls.myself.subject.cn
+
+Exported by: tls
+
+### @tls.myself.subject.commonName
+
+Exported by: tls
+
+### @tls.myself.subject.common_name
+
+Exported by: tls
+
+### @tls.myself.subject.country
+
+Exported by: tls
+
+### @tls.myself.subject.countryName
+
+Exported by: tls
+
+### @tls.myself.subject.country_name
+
+Exported by: tls
+
+### @tls.myself.subject.l
+
+Exported by: tls
+
+### @tls.myself.subject.locality
+
+Exported by: tls
+
+### @tls.myself.subject.localityName
+
+Exported by: tls
+
+### @tls.myself.subject.locality_name
+
+Exported by: tls
+
+### @tls.myself.subject.name
+
+Exported by: tls
+
+### @tls.myself.subject.o
+
+Exported by: tls
+
+### @tls.myself.subject.organization
+
+Exported by: tls
+
+### @tls.myself.subject.organizationName
+
+Exported by: tls
+
+### @tls.myself.subject.organization_name
+
+Exported by: tls
+
+### @tls.myself.subject.organizationalUnitName
+
+Exported by: tls
+
+### @tls.myself.subject.organizational_unit_name
+
+Exported by: tls
+
+### @tls.myself.subject.ou
+
+Exported by: tls
+
+### @tls.myself.subject.st
+
+Exported by: tls
+
+### @tls.myself.subject.state
+
+Exported by: tls
+
+### @tls.myself.subject.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.myself.subject.state_or_province_name
+
+Exported by: tls
+
+### @tls.myself.subject.unit
+
+Exported by: tls
+
+### @tls.myself.uri
+
+Exported by: tls
+
+### @tls.myself.url
+
+Exported by: tls
+
+### @tls.myself.urn
+
+Exported by: tls
+
+### @tls.myself.verified
+
+Exported by: tls
+
+### @tls.myself.version
+
+Exported by: tls
+
+### @tls.peer
+
+Exported by: tls
+
+### @tls.peer.IPAddress
+
+Exported by: tls
+
+### @tls.peer.dns
+
+Exported by: tls
+
+### @tls.peer.email
+
+Exported by: tls
+
+### @tls.peer.emailAddress
+
+Exported by: tls
+
+### @tls.peer.email_address
+
+Exported by: tls
+
+### @tls.peer.expired
+
+Exported by: tls
+
+### @tls.peer.host
+
+Exported by: tls
+
+### @tls.peer.hostname
+
+Exported by: tls
+
+### @tls.peer.ip
+
+Exported by: tls
+
+### @tls.peer.ip_address
+
+Exported by: tls
+
+### @tls.peer.issuer
+
+Exported by: tls
+
+### @tls.peer.issuer.c
+
+Exported by: tls
+
+### @tls.peer.issuer.cn
+
+Exported by: tls
+
+### @tls.peer.issuer.commonName
+
+Exported by: tls
+
+### @tls.peer.issuer.common_name
+
+Exported by: tls
+
+### @tls.peer.issuer.country
+
+Exported by: tls
+
+### @tls.peer.issuer.countryName
+
+Exported by: tls
+
+### @tls.peer.issuer.country_name
+
+Exported by: tls
+
+### @tls.peer.issuer.l
+
+Exported by: tls
+
+### @tls.peer.issuer.locality
+
+Exported by: tls
+
+### @tls.peer.issuer.localityName
+
+Exported by: tls
+
+### @tls.peer.issuer.locality_name
+
+Exported by: tls
+
+### @tls.peer.issuer.name
+
+Exported by: tls
+
+### @tls.peer.issuer.o
+
+Exported by: tls
+
+### @tls.peer.issuer.organization
+
+Exported by: tls
+
+### @tls.peer.issuer.organizationName
+
+Exported by: tls
+
+### @tls.peer.issuer.organization_name
+
+Exported by: tls
+
+### @tls.peer.issuer.organizationalUnitName
+
+Exported by: tls
+
+### @tls.peer.issuer.organizational_unit_name
+
+Exported by: tls
+
+### @tls.peer.issuer.ou
+
+Exported by: tls
+
+### @tls.peer.issuer.st
+
+Exported by: tls
+
+### @tls.peer.issuer.state
+
+Exported by: tls
+
+### @tls.peer.issuer.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.peer.issuer.state_or_province_name
+
+Exported by: tls
+
+### @tls.peer.issuer.unit
+
+Exported by: tls
+
+### @tls.peer.notAfter
+
+Exported by: tls
+
+### @tls.peer.notBefore
+
+Exported by: tls
+
+### @tls.peer.not_after
+
+Exported by: tls
+
+### @tls.peer.not_before
+
+Exported by: tls
+
+### @tls.peer.revoked
+
+Exported by: tls
+
+### @tls.peer.self_signed
+
+Exported by: tls
+
+### @tls.peer.serialNumber
+
+Exported by: tls
+
+### @tls.peer.serial_number
+
+Exported by: tls
+
+### @tls.peer.sn
+
+Exported by: tls
+
+### @tls.peer.subj
+
+Exported by: tls
+
+### @tls.peer.subj.c
+
+Exported by: tls
+
+### @tls.peer.subj.cn
+
+Exported by: tls
+
+### @tls.peer.subj.commonName
+
+Exported by: tls
+
+### @tls.peer.subj.common_name
+
+Exported by: tls
+
+### @tls.peer.subj.country
+
+Exported by: tls
+
+### @tls.peer.subj.countryName
+
+Exported by: tls
+
+### @tls.peer.subj.country_name
+
+Exported by: tls
+
+### @tls.peer.subj.l
+
+Exported by: tls
+
+### @tls.peer.subj.locality
+
+Exported by: tls
+
+### @tls.peer.subj.localityName
+
+Exported by: tls
+
+### @tls.peer.subj.locality_name
+
+Exported by: tls
+
+### @tls.peer.subj.name
+
+Exported by: tls
+
+### @tls.peer.subj.o
+
+Exported by: tls
+
+### @tls.peer.subj.organization
+
+Exported by: tls
+
+### @tls.peer.subj.organizationName
+
+Exported by: tls
+
+### @tls.peer.subj.organization_name
+
+Exported by: tls
+
+### @tls.peer.subj.organizationalUnitName
+
+Exported by: tls
+
+### @tls.peer.subj.organizational_unit_name
+
+Exported by: tls
+
+### @tls.peer.subj.ou
+
+Exported by: tls
+
+### @tls.peer.subj.st
+
+Exported by: tls
+
+### @tls.peer.subj.state
+
+Exported by: tls
+
+### @tls.peer.subj.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.peer.subj.state_or_province_name
+
+Exported by: tls
+
+### @tls.peer.subj.unit
+
+Exported by: tls
+
+### @tls.peer.subject
+
+Exported by: tls
+
+### @tls.peer.subject.c
+
+Exported by: tls
+
+### @tls.peer.subject.cn
+
+Exported by: tls
+
+### @tls.peer.subject.commonName
+
+Exported by: tls
+
+### @tls.peer.subject.common_name
+
+Exported by: tls
+
+### @tls.peer.subject.country
+
+Exported by: tls
+
+### @tls.peer.subject.countryName
+
+Exported by: tls
+
+### @tls.peer.subject.country_name
+
+Exported by: tls
+
+### @tls.peer.subject.l
+
+Exported by: tls
+
+### @tls.peer.subject.locality
+
+Exported by: tls
+
+### @tls.peer.subject.localityName
+
+Exported by: tls
+
+### @tls.peer.subject.locality_name
+
+Exported by: tls
+
+### @tls.peer.subject.name
+
+Exported by: tls
+
+### @tls.peer.subject.o
+
+Exported by: tls
+
+### @tls.peer.subject.organization
+
+Exported by: tls
+
+### @tls.peer.subject.organizationName
+
+Exported by: tls
+
+### @tls.peer.subject.organization_name
+
+Exported by: tls
+
+### @tls.peer.subject.organizationalUnitName
+
+Exported by: tls
+
+### @tls.peer.subject.organizational_unit_name
+
+Exported by: tls
+
+### @tls.peer.subject.ou
+
+Exported by: tls
+
+### @tls.peer.subject.st
+
+Exported by: tls
+
+### @tls.peer.subject.state
+
+Exported by: tls
+
+### @tls.peer.subject.stateOrProvinceName
+
+Exported by: tls
+
+### @tls.peer.subject.state_or_province_name
+
+Exported by: tls
+
+### @tls.peer.subject.unit
+
+Exported by: tls
+
+### @tls.peer.subject.uid
+
+Exported by: tls
+
+### @tls.peer.subject.uniqueIdentifier
+
+Exported by: tls
+
+### @tls.peer.subject.unique_identifier
+
+Exported by: tls
+
+### @tls.peer.uri
+
+Exported by: tls
+
+### @tls.peer.url
+
+Exported by: tls
+
+### @tls.peer.urn
+
+Exported by: tls
+
+### @tls.peer.verified
+
+Exported by: tls
+
+### @tls.peer.version
+
+Exported by: tls
+
+### @tls.version
+
+Exported by: tls
+
+### @to
+
+Exported by: core
+
+### @to.name
+
+Exported by: core
+
+### @to.params\[%s\]
+
+Exported by: core
+
+### @to.tag
+
+Exported by: core
+
+### @to.uri
+
+Exported by: core
+
+### @to.uri.host
+
+Exported by: core
+
+### @to.uri.hostport
+
+Exported by: core
+
+### @to.uri.params
+
+Exported by: core
+
+### @to.uri.params\[%s\]
+
+Exported by: core
+
+### @to.uri.port
+
+Exported by: core
+
+### @to.uri.pwd
+
+Exported by: core
+
+### @to.uri.type
+
+Exported by: core
+
+### @to.uri.user
+
+Exported by: core
+
+### @sys.now
+
+Exported by: core
+
+### @sys.pid
+
+Exported by: core
+
+### @sys.unique
+
+Exported by: core
+
+### @sys.now.utc
+
+Exported by: core
+
+### @sys.now.gmt
+
+Exported by: core
+
+### @sys.now.local
+
+Exported by: core
+
+### @v
+
+Exported by: core
+
+### @v.alias
+
+Exported by: core
+
+### @v.branch
+
+Exported by: core
+
+### @v.comment
+
+Exported by: core
+
+### @v.host
+
+Exported by: core
+
+### @v.i
+
+Exported by: core
+
+### @v.name
+
+Exported by: core
+
+### @v.params\[%s\]
+
+Exported by: core
+
+### @v.port
+
+Exported by: core
+
+### @v.received
+
+Exported by: core
+
+### @v.rport
+
+Exported by: core
+
+### @v.transport
+
+Exported by: core
+
+### @v.version
+
+Exported by: core
+
+### @v\[%i\]
+
+Exported by: core
+
+### @v\[%i\].alias
+
+Exported by: core
+
+### @v\[%i\].branch
+
+Exported by: core
+
+### @v\[%i\].comment
+
+Exported by: core
+
+### @v\[%i\].host
+
+Exported by: core
+
+### @v\[%i\].i
+
+Exported by: core
+
+### @v\[%i\].name
+
+Exported by: core
+
+### @v\[%i\].params\[%s\]
+
+Exported by: core
+
+### @v\[%i\].port
+
+Exported by: core
+
+### @v\[%i\].received
+
+Exported by: core
+
+### @v\[%i\].rport
+
+Exported by: core
+
+### @v\[%i\].transport
+
+Exported by: core
+
+### @v\[%i\].version
+
+Exported by: core
+
+### @via
+
+Exported by: core
+
+### @via.alias
+
+Exported by: core
+
+### @via.branch
+
+Exported by: core
+
+### @via.comment
+
+Exported by: core
+
+### @via.host
+
+Exported by: core
+
+### @via.i
+
+Exported by: core
+
+### @via.name
+
+Exported by: core
+
+### @via.params\[%s\]
+
+Exported by: core
+
+### @via.port
+
+Exported by: core
+
+### @via.received
+
+Exported by: core
+
+### @via.rport
+
+Exported by: core
+
+### @via.transport
+
+Exported by: core
+
+### @via.version
+
+Exported by: core
+
+### @via\[%i\]
+
+Exported by: core
+
+### @via\[%i\].alias
+
+Exported by: core
+
+### @via\[%i\].branch
+
+Exported by: core
+
+### @via\[%i\].comment
+
+Exported by: core
+
+### @via\[%i\].host
+
+Exported by: core
+
+### @via\[%i\].i
+
+Exported by: core
+
+### @via\[%i\].name
+
+Exported by: core
+
+### @via\[%i\].params\[%s\]
+
+Exported by: core
+
+### @via\[%i\].port
+
+Exported by: core
+
+### @via\[%i\].received
+
+Exported by: core
+
+### @via\[%i\].rport
+
+Exported by: core
+
+### @via\[%i\].transport
+
+Exported by: core
+
+### @via\[%i\].version
+
+Exported by: core
+
+### @xmlrpc.method
+
+Exported by: xmlrpc

+ 1032 - 0
docs/cookbooks/6.0.x/transformations.md

@@ -0,0 +1,1032 @@
+# Transformations
+
+Version: Kamailio SIP Server v6.0.x (devel)
+
+    Main author:
+       Daniel-Constantin Mierla <miconda (at) gmail.com>
+
+**Transformation** is basically a function that is applied to a
+pseudo-variable (PV) to get a property of it. The value of PV is not
+affected at all.
+
+Transformations are implemented by various modules, most of them being
+in **pv** module.
+
+The transformations are intended to facilitate access to different
+attributes of PV (like strlen of value, parts of value, substrings) or
+complete different value of PV (encoded in hexa, md5 value,
+escape/unescape PV value for DB operations...).
+
+A transformation is represented in between **'{'** and **'}'** and
+follows the name of a PV. When using transformations, the PV name and
+transformations **must** be enclosed in between **'('** and **')'**,
+following the **$** sign.
+
+    # the length of From URI ($fu is PV for From URI)
+
+    $(fu{s.len})
+
+Many transformations can be applied in the same time to a PV.
+
+    # the length of escaped 'Test' header body
+
+    $(hdr(Test){s.escape.common}{s.len})
+
+The transformations can be used anywhere, being considered parts of PV
+-- in xlog, avpops or other modules' functions and parameters, in right
+side assignment expressions or in comparisons.
+
+## String Transformations
+
+The name of these transformation starts with 's.'. They are intended to
+apply string operations to PV.
+
+Available transformations in this class:
+
+### {s.len}
+
+Return strlen of PV value
+
+    $var(x) = "abc";
+    if($(var(x){s.len}) == 3)
+    {
+       ...
+    }
+
+### {s.int}
+
+Return integer value of a string-represented number
+
+    $var(x) = "1234";
+    if($(var(x){s.int})==1234) {
+      ...
+    }
+
+### {s.md5}
+
+Return md5 over PV value
+
+    xlog("md5 over From username: $(fU{s.md5})");
+
+### {s.sha256}
+
+Return sha 256 over PV value
+
+    xlog("sha 256 over From username: $(fU{s.sha256})");
+
+### {s.sha384}
+
+Return sha 384 over PV value
+
+    xlog("sha 384 over From username: $(fU{s.sha384})");
+
+### {s.sha512}
+
+Return sha 512 over PV value
+
+    xlog("sha 512 over From username: $(fU{s.sha512})");
+
+### {s.substr,offset,length}
+
+Return substring starting at offset having size of 'length'. If offset
+is negative, then it is counted from the end of PV value, -1 being the
+last char. In case of positive value, 0 is first char. Length must be
+positive, in case of 0, substring to the end of PV value is returned.
+offset and length can be PV as well.
+
+Example:
+
+    $var(x) = "abcd";
+    $(var(x){s.substr,1,0}); => "bcd"
+
+### {s.select,index,separator}
+
+Return a field from PV value. The field is selected based on separator
+and index.
+
+Index must be an integer value or a PV. If index is negative, the
+count of fields starts from end of PV value, -1 being last field. If
+index is positive, 0 is the first field.
+
+The separator must be a character used to identify the fields. It can also be
+an escaped character: `\\`, `\t`, `\n`, `\r` or `\s` (all whitespaces).
+
+Example:
+
+```
+    $var(x) = "12,34,56";
+    $(var(x){s.select,1,,}) => "34" ;
+
+    $var(x) = "12,34,56";
+    $(var(x){s.select,-2,,}) => "34"
+```
+
+### {s.encode.7bit}
+
+Return encoding in 7Bit of PV value
+
+### {s.decode.7bit}
+
+Return decoding of PV value in 7Bit
+
+### {s.encode.hexa}
+
+Return encoding in hexa of PV value
+
+### {s.decode.hexa}
+
+Return decoding from hexa of PV value
+
+### {s.encode.base58}
+
+Return base58 encoding of PV value.
+
+The set of base58 digits is:
+
+    123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
+
+### {s.decode.base58}
+
+Return base58 decoding of PV value.
+
+### {s.encode.base64}
+
+Return base64 encoding of PV value
+
+### {s.decode.base64}
+
+Decode base64 encoded PV and return value
+
+### {s.encode.base64t}
+
+Return base64 encoding of PV value without trailing padding
+characters('=').
+
+### {s.decode.base64t}
+
+Decode base64 encoded PV, handling missing trailing padding characters,
+and return value.
+
+### {s.encode.base64url}
+
+Return base64-url encoding of PV value
+
+### {s.decode.base64url}
+
+Decode base64-url encoded PV and return value
+
+### {s.encode.base64urlt}
+
+Return base64-url encoding of PV value without trailing padding
+characters('=').
+
+### {s.decode.base64urlt}
+
+Decode base64-url encoded PV, handling missing trailing padding
+characters, and return value.
+
+### {s.escape.common}
+
+Return escaped string of PV value. Characters escaped are ', ", \\ and
+0. Useful when doing DB queries (care should be taken for non Latin
+character set).
+
+### {s.unescape.common}
+
+Return unescaped string of PV value. Reverse of above transformation.
+
+### {s.escape.user}
+
+Return escaped string of PV value, changing to '%hexa' the characters
+that are not allowed in user part of SIP URI following RFC requirements.
+
+### {s.unescape.user}
+
+Return unescaped string of PV value, changing '%hexa' to character code.
+Reverse of above transformation.
+
+### {s.escape.param}
+
+Return escaped string of PV value, changing to '%hexa' the characters
+that are not allowed in the param part of SIP URI following RFC
+requirements.
+
+### {s.unescape.param}
+
+Return unescaped string of PV value, changing '%hexa' to character code.
+Reverse of above transformation.
+
+### {s.escape.csv}
+
+Escapes a string to use as a CSV field, as specified in RFC4180:
+
+     * enclose string in double quotes
+     * escape double quotes with a second double quote
+
+Example:
+
+``` c
+$var(x) = 'foo,bar"baz';
+$(var(x){s.escape.csv}); # contains '"foo,bar""baz"'
+```
+
+### {s.numeric}
+
+Removes all non-numeric parts of string.
+
+Example:
+
+    $var(x) = "(040)1234/567-89";
+    $(var(x){s.numeric}) => "040123456789" ;
+
+### {s.tolower}
+
+Return string with lower case ASCII letters.
+
+### {s.toupper}
+
+Return string with upper case ASCII letters.
+
+### {s.strip,len}
+
+Return string after removing starting 'len' characters. Parameter 'len'
+can be positive integer or pseudo-variable holding a positive integer.
+
+Example:
+
+``` c
+$var(x) = "1234";
+$var(y) = $(var(x){s.strip,2}); # resulted value is "34"
+```
+
+### {s.striptail,len}
+
+Return string after removing ending 'len' characters. Parameter 'len'
+can be positive integer or pseudo-variable holding a positive integer.
+
+### {s.prefixes\[,len\]}
+
+Return series of comma separated prefixes of the pv. Parameter 'len' is
+optional and will limit the maximum prefix length.
+
+Example:
+
+``` c
+$var(x) = "123456";
+$(var(x){s.prefixes}) => 1,12,123,1234,12345,123456
+$(var(x){s.prefixes,4} => 1,12,123,1234
+```
+
+### {s.prefixes.quoted\[,len\]}
+
+Return series of comma separated quoted prefixes of the pv. Parameter
+'len' is optional and will limit the maximum prefix length.
+
+Example:
+
+``` c
+$var(x) = "123456";
+$(var(x){s.prefixes.quoted} => '1','12','123','1234','12345','123456'
+$(var(x){s.prefixes.quoted,4} => '1','12','123','1234'
+```
+
+### {s.replace,match,repl}
+
+Replace all occurrences of **match** with **repl**. The parameters can
+be pseudo-variables.
+
+Example:
+
+``` c
+$var(x) = "abababa";
+$(var(x){s.replace,a,c} => "cbcbcbc"
+```
+
+### {s.ftime,format}
+
+Format the epoch in the pv according to the parameter. The parameter has
+to be strftime formatting string.
+
+``` c
+$(TS{s.ftime,%Y-%m-%d %H:%M:%S})
+```
+
+### {s.trim}
+
+Remove left and right whitespaces (' ', '\\t', '\\r', '\\n') around PV
+value.
+
+``` c
+$(var(x){s.trim})
+```
+
+### {s.rtrim}
+
+Remove right whitespaces (' ', '\\t', '\\r', '\\n') around PV value.
+
+``` c
+$(var(x){s.rtrim})
+```
+
+### {s.ltrim}
+
+Remove left whitespaces (' ', '\\t', '\\r', '\\n') around PV value.
+
+``` c
+$(var(x){s.ltrim})
+```
+
+### {s.rm,match}
+
+Remove occurrences of 'match' from PV. 'match' can be static string or
+variable.
+
+``` c
+$(var(x){s.rm,test})
+```
+
+### {s.rmhdws}
+
+Remove header-like duplicated whitespaces (i.e., end of line followed
+by whitespaces or tabs are replaced by a single whitespace).
+
+``` c
+$(var(x){s.rmhdws})
+```
+
+### {s.rmhlws}
+
+Remove header line split white spaces (i.e., remove end of lines and following
+white spaces or tabls, like in a multi-line header value to make it single line).
+
+``` c
+$(var(x){s.rmhlws})
+```
+
+### {s.rmws}
+
+Remove occurrences of whitespace characters (' ', '\\t, '\\r', '\\n').
+
+``` c
+$(var(x){s.rmws})
+```
+
+### {s.corehash,n}
+
+Return the hash id computed with Kamailio's core hashing function. The
+parameter n is optional, it has to be a number of a pv holding a number.
+If n is provided, the value returned is **(hashid)&(n-1)**. If n is
+power of two, the result is the modulo operation between hashid and n
+(hash id % n).
+
+Note: the value is returned as string.
+
+``` c
+$(var(x){s.corehash})
+```
+
+### {s.unquote}
+
+Return the value without surrounding single (') or double quotes (").
+
+``` c
+$var(x) = "\"alice\"";
+$var(alice) = $(var(x){s.unquote});
+```
+
+### {s.unbracket}
+
+Return the value without surrounding (), \[\], {} or \<\>.
+
+``` c
+$var(x) = "<sip:[email protected]>";
+$var(uri) = $(var(x){s.unbracket});
+```
+
+### {s.count,c}
+
+Count how many times c appears in the pv value.
+
+``` c
+"abababa"{s.count,a}
+# will return 4
+```
+
+### {s.after,x}
+
+Return the part of the string after the character **x** searched from
+the start of the value. If the character **x** is not found, it returns
+empty string.
+
+``` c
+"abcdef"{s.after,c}
+# will return "def"
+```
+
+### {s.rafter,x}
+
+Return the part of the string after the character **x** searched from
+the end of the value. If the character **x** is not found, it returns
+empty string.
+
+``` c
+"abcdefcgh"{s.rafter,c}
+# will return "gh"
+```
+
+### {s.before,x}
+
+Return the part of the string before the character **x** searched from
+the start of the value. If the character **x** is not found, it returns
+the entire input string.
+
+``` c
+"abcdef"{s.before,c}
+# will return "ab"
+```
+
+### {s.rbefore,x}
+
+Return the part of the string before the character **x** searched from
+the end of the value. If the character **x** is not found, it returns
+the entire input string.
+
+``` c
+"abcdefcgh"{s.rbefore,c}
+# will return "abcdef"
+```
+
+### {s.fmtlines,n,m}
+
+Format the value in lines of n characters, adding m spaces to the start
+of each new line (not to first line). Each line is ended with "\\r\\n"
+apart of last line.
+
+``` c
+"abcdefgh"{s.fmtlines,4,2}
+```
+
+### {s.fmtlinet,n,m}
+
+Format the value in lines of n characters, adding m tabs to the start of
+each new line (not to first line). Each line is ended with "\\r\\n"
+apart of last line.
+
+``` c
+"abcdefgh"{s.fmtlinet,4,2}
+```
+
+### {s.urlencode.param}
+
+Encode the value for URL param format.
+
+### {s.urldecode.param}
+
+Decode the value from URL param format.
+
+## URI Transformations
+
+The name of transformation starts with 'uri.'. The PV value is
+considered to be a SIP URI. This transformation returns parts of SIP URI
+(see struct sip_uri). If that part is missing, the returned value is an
+empty string.
+
+Available transformations in this class:
+
+### {uri.user}
+
+Return the user part
+
+### {uri.host}
+
+(same as **{uri.domain}**)
+
+Return the domain part
+
+### {uri.passwd}
+
+Return the password
+
+### {uri.port}
+
+Return the port
+
+### {uri.params}
+
+Return the URI parameters in a string
+
+### {uri.param,name}
+
+Return the value of parameter with name 'name'
+
+### {uri.headers}
+
+Return URI headers
+
+### {uri.transport}
+
+Return the value of transport parameter
+
+### {uri.ttl}
+
+Return the value of ttl parameter
+
+### {uri.uparam}
+
+Return the value of user parameter
+
+### {uri.maddr}
+
+Return the value of maddr parameter
+
+### {uri.method}
+
+Return the value of method parameter
+
+### {uri.lr}
+
+Return the value of lr parameter
+
+### {uri.r2}
+
+Return the value of r2 parameter
+
+### {uri.scheme}
+
+Return the string value of URI scheme.
+
+### {uri.tosocket}
+
+Return the string value corresponding to socket address matching proto,
+address and port from the URI. In other words, converts from a format
+like **<sip:address:port;transport=proto>** to **proto:address:port**.
+
+Example:
+
+    "sip:[email protected]:5060;transport=udp"{uri.tosocket} => "udp:127.0.0.1:5060"
+
+### {uri.duri}
+
+Return the destination URI for routing, keeping only schema, host, port
+and transport parameter. If port and transport are not in the original
+value, they are also not in the returned value.
+
+Example:
+
+``` c
+$var(ouri) = "sip:[email protected]:5060;nat=yes;transport=tcp;line=xyz";
+$var(duri) = $(var(ouri){uri.duri}); # => "sip:server.com:5060;transport=tcp"
+```
+
+### {uri.saor}
+
+Return the SIP AoR, keeping only schema, user and host. If user is not
+in the original value, it is also not in the returned value.
+
+Example:
+
+``` c
+$var(ouri) = "sip:[email protected]:5060;nat=yes;transport=tcp;line=xyz";
+$var(suri) = $(var(ouri){uri.saor}); # => "sip:[email protected]"
+```
+
+### {uri.suri}
+
+Return the simple URI for routing, keeping only schema, user, host, port
+and transport parameter. If user, port and transport are not in the
+original value, they are also not in the returned value.
+
+Example:
+
+``` c
+$var(ouri) = "sip:[email protected]:5060;nat=yes;transport=tcp;line=xyz";
+$var(suri) = $(var(ouri){uri.suri}); # => "sip:[email protected]:5060;transport=tcp"
+```
+
+## Parameters List Transformations
+
+The name of the transformation starts with 'param.'. The PV value is
+considered to be a string like name1=value1;name2=value2;...". The
+transformations returns the value for a specific parameter, or the name
+of a parameter at a specific index.
+
+Available transformations in this class are presented in the next
+sections.
+
+**Important Note:** the delimiter cannot be comma (,), because this
+transformation is using SIP header/URI parameters parser and the comma
+is a delimiter between serialized SIP header/URI bodies. The workaround
+is to use the subst transformation to replace the comma with another
+character that is used then as separator.
+
+### {param.value,name\[, delimiter\]}
+
+Return the value of parameter 'name'
+
+Example:
+
+    "a=1;b=2;c=3"{param.value,c} = "3"
+
+'name' can be a pseudo-variable
+
+'delimiter' allows you to specify a single character to use as the
+parameter delimiter. For example, when parsing HTTP URL query strings
+use '&'.
+
+### {param.in,name\[,delimiter\]}
+
+Return 1 if the parameter 'name' is found in parameters list, 0 if not
+found.
+
+Example:
+
+    "a=1;b=2;c=3"{param.in,c} = 1
+
+'name' can be a pseudo-variable
+
+'delimiter' allows you to specify a single character to use as the
+parameter delimiter. For example, when parsing HTTP URL query strings
+use '&'.
+
+### {param.valueat,index\[, delimiter\]}
+
+Return the value of parameter at position given by 'index' (0-based
+index)
+
+Example:
+
+    "a=1;b=2;c=3"{param.valueat,1} = "2"
+
+'index' can be a pseudo-variable
+
+'delimiter' allows you to specify a single character to use as the
+parameter delimiter. For example, when parsing HTTP URL query strings
+use '&'.
+
+### {param.name,index\[, delimiter\]}
+
+Return the name of parameter at position 'index'.
+
+Example:
+
+    "a=1;b=2;c=3"{param.name,1} = "b"
+
+'delimiter' allows you to specify a single character to use as the
+parameter delimiter. For example, when parsing HTTP URL query strings
+use '&'.
+
+### {param.count\[, delimiter\]}
+
+Return the number of parameters in the list.
+
+Example:
+
+    "a=1;b=2;c=3"{param.count} = 3
+
+'delimiter' allows you to specify a single character to use as the
+parameter delimiter. For example, when parsing HTTP URL query strings
+use '&'.
+
+## Name-address Transformations
+
+The name of the transformation starts with 'nameaddr.'. The PV value is
+considered to be a string like '\[display_name\] uri'. The
+transformations returns the value for a specific field.
+
+Available transformations in this class:
+
+### {nameaddr.name}
+
+Return the value of display name
+
+Example:
+
+    '"test" <sip:[email protected]>' {nameaddr.name} = "test"
+
+### {nameaddr.uri}
+
+Return the value of URI
+
+Example:
+
+    '"test" <sip:[email protected]>' {nameaddr.uri} = sip:[email protected]
+
+### {nameaddr.len}
+
+Return the length of the entire name-addr part from the value.
+
+## To-Body Transformations
+
+🔥**IMPORTANT**: This transformation class is exported by **pv**
+module.
+
+Access parts of a ToBody-like structure.
+
+### {tobody.uri}
+
+\* return URI from To body
+
+### {tobody.display}
+
+\* return Display name from To body
+
+### {tobody.tag}
+
+\* return Tag parameter from To body
+
+### {tobody.user}
+
+\* return URI User from To body
+
+### {tobody.host}
+
+\* return URI Host from To body
+
+### {tobody.params}
+
+\* return parameters part from To body
+
+## Line Transformations
+
+Line-based operations on text values.
+
+### {line.count}
+
+Return the number of lines.
+
+Example:
+
+``` c
+$(var(x){line.count})
+```
+
+### {line.at,pos}
+
+Return the line at position 'pos'. The index start from 0. Negative
+position can be used to count from last line (which is -1). The pos can
+be also a variable holding the index value.
+
+Example:
+
+``` c
+$(var(x){line.at,2})
+```
+
+### {line.sw,match}
+
+Return the line starting with **match**.
+
+Example:
+
+``` c
+$(var(x){line.sw,mytext})
+```
+
+## MSRP Transformations
+
+🔥**IMPORTANT**: This transformation class is exported by **msrp**
+module.
+
+### {msrpuri.user}
+
+User part of a MSRP URI.
+
+### {msrpuri.host}
+
+Host part of a MSRP URI.
+
+### {msrpuri.port}
+
+Port part of a MSRP URI.
+
+### {msrpuri.session}
+
+Session ID part of a MSRP URI.
+
+### {msrpuri.proto}
+
+Transport layer part of a MSRP URI.
+
+### {msrpuri.params}
+
+Parameters part of a MSRP URI.
+
+### {msrpuri.userinfo}
+
+User-Info part of a MSRP URI. This is the same as user part, when there
+are no user parameters or password fields. Otherwise, it include the
+whole part after scheme and before '@' in front of host.
+
+## Regular Expression Transformations
+
+🔥**IMPORTANT**: This transformation class is exported by **textops**
+module.
+
+### {re.subst,expression}
+
+Perform POSIX regex substitutions on string value pseudo-variables.
+
+``` c
+# Assign Request-URI user to PV
+$var(user) = $(ru{re.subst,/^sip:(.*)@(.*)/\1/});
+```
+
+``` c
+# Assign Request-URI user to PV, where every 'A' has been replaced by 'a'
+$var(user) = $(rU{re.subst,/A/a/g});
+```
+
+The prototype is:
+
+``` c
+{re.subst,/match_expression/replacement_expression/flags}
+```
+
+- match_expression - Posix regular expression
+- replacement_expression - substitution expression with back
+    references to matched tokes: \\1, \\2, ..., \\9
+- flags:
+  - i - match ignore case
+  - s - match within multi-lines strings
+  - g - replace all matches
+
+## SQL Transformations
+
+🔥**IMPORTANT**: The transformations in this class are exported by the
+**sqlops** module.
+
+### {sql.val}
+
+This transformation outputs valid SQL values for various PV values:
+
+- \<null> values are output as NULL
+- integers are output as integers
+- everything else is output as quoted and escaped string
+
+``` c
+    $var(null) = $null;
+    $avp(null) = $null;
+    $avp(str) = "String with \ illegal \\characters";
+    $avp(nr) = 12345;
+    $avp(strnr) = "12345";
+
+    xlog("$$rm = $rm = $(rm{sql.val})");
+    xlog("$$var(null) = $var(null) = $(var(null){sql.val})");
+    xlog("$$avp(null) = $avp(null) = $(avp(null){sql.val})");
+    xlog("$$avp(str) = $avp(str) = $(avp(str){sql.val})");
+    xlog("$$avp(nr) = $avp(nr) = $(avp(nr){sql.val})");
+    xlog("$$avp(strnr) = $avp(strnr) = $(avp(strnr){sql.val})");
+
+  Output:
+    $rm = ACK = 'ACK'
+    $var(null) = 0 = 0
+    $avp(null) = <null> = NULL
+    $avp(str) = String with \ illegal \characters = 'String with \\ illegal \\characters'
+    $avp(nr) = 12345 = 12345
+    $avp(strnr) = 12345 = '12345'
+```
+
+### {sql.val.int}
+
+Like sql.val, but output number 0 for null values.
+
+### {sql.val.str}
+
+Like sql.val, but output string '' for null values.
+
+## Examples
+
+Within a PV, many transformation can be applied, being executed from
+left to right.
+
+\* The length of the value of parameter at postion 1 (remember 0 is
+first position, 1 is second position)
+
+    $var(x) = "a=1;b=22;c=333";
+    $(var(x){param.value,$(var(x){param.name,1})}{s.len}) = 2
+
+\* Test if whether is un-registration or not
+
+    if(is_method("REGISTER") && is_present_hf("Expires") && $(hdr(Expires){s.int})==0)
+        xlog("This is an un-registration\n");
+
+## HTTP URL Transformations
+
+🔥**IMPORTANT**: This transformation class is exported by **xhttp**
+module.
+
+### {url.path}
+
+Path part of an HTTP URL.
+
+For example,
+
+    # When the first line of HTTP request is
+    # "GET /path/to/file/?this=is&the=querystring"
+
+    $(hu{url.path}) => "/path/to/file/"
+
+### {url.querystring}
+
+Query string part of an HTTP URL. For example,
+
+    # When the first line of HTTP request is
+    # "GET /path/to/file/?this=is&the=querystring"
+
+    $(hu{url.querystring}) => "this=is&the=querystring"
+
+## JSON Transformations
+
+🔥**IMPORTANT**: This transformation class is exported by **json**
+module.
+
+### {json.parse}
+
+You can use the transformation to extract values from the json
+structured pseudo-variables
+
+    $var(Custom-Data) = $(rb{json.parse,Custom-Data});
+
+## Socket Address Transformations
+
+Transformations related to socket address values (**proto:host:port**).
+
+### {sock.host}
+
+Return the host part.
+
+### {sock.port}
+
+Return the port part.
+
+### {sock.proto}
+
+Return the proto part.
+
+### {sock.touri}
+
+Return the socket address converted to SIP URI:
+**<sip:host:port;transport=proto>**.
+
+## URI Alias Transformations
+
+Transformations related to URI alias values (**addr\~port\~protoid**).
+
+### {urialias.encode}
+
+Encode SIP URI to alias value.
+
+``` c
+"sip:127.0.0.1:5060;transport=udp"{urialias.encode} => "127.0.0.1~5060~1"
+```
+
+### {urialias.decode}
+
+Decode from alias value to SIP URI.
+
+``` c
+"127.0.0.1~5060~1"{urialias.decode} => "sip:127.0.0.1:5060;transport=udp"
+```
+
+## Value Transformations
+
+Exported by **pv** module.
+
+### {val.json}
+
+If value is $null, return empty string; if value is string, then it is
+escaped for use as json value (without surrounding quotes.
+
+``` c
+$var(x) = '"name" <sip:[email protected]>';
+$(var(x){val.json}) => \"name\" <sip:[email protected]>
+```
+
+### {val.n0}
+
+Return integer 0 for values that are $null.
+
+``` c
+$sht(a=>x) = $null;
+$(sht(a=>x){val.n0}) => 0
+```
+
+### {val.ne}
+
+Return empty string for values that are $null.
+
+``` c
+$sht(a=>x) = $null;
+# $(sht(a=>x){val.ne});
+```
+
+### {val.jsonqe}
+
+If value is $null, return quoted empty string; if value is string, then
+it is escaped for use as json value already with surrounding quotes; if
+the value is int, then it is preserved as it is.
+
+``` c
+$var(x) = '"name" <sip:[email protected]>';
+$(var(x){val.jsonqe}) => "\"name\" <sip:[email protected]>"
+```

+ 1 - 0
docs/index.md

@@ -97,6 +97,7 @@ available at the **Old Wiki Site**:*
 |---------|-------------------------------|------------------------------------------|------------------------------------------|----------------------------------|--------------------------------------------------|
 | Version | Core Cookbook                 | Pseudo Variables                         | Transformations                          | Selects                          | Modules                                          |
 | devel   | [link](cookbooks/devel/core.md) | [link](cookbooks/devel/pseudovariables.md) | [link](cookbooks/devel/transformations.md) | [link](cookbooks/devel/selects.md) | [link](https://kamailio.org/docs/modules/devel/) |
+| 6.0.x   | [link](cookbooks/6.0.x/core.md) | [link](cookbooks/6.0.x/pseudovariables.md) | [link](cookbooks/6.0.x/transformations.md) | [link](cookbooks/6.0.x/selects.md) | [link](https://kamailio.org/docs/modules/6.0.x/) |
 | 5.8.x   | [link](cookbooks/5.8.x/core.md) | [link](cookbooks/5.8.x/pseudovariables.md) | [link](cookbooks/5.8.x/transformations.md) | [link](cookbooks/5.8.x/selects.md) | [link](https://kamailio.org/docs/modules/5.8.x/) |
 | 5.7.x   | [link](cookbooks/5.7.x/core.md) | [link](cookbooks/5.7.x/pseudovariables.md) | [link](cookbooks/5.7.x/transformations.md) | [link](cookbooks/5.7.x/selects.md) | [link](https://kamailio.org/docs/modules/5.7.x/) |
 | 5.6.x   | [link](cookbooks/5.6.x/core.md) | [link](cookbooks/5.6.x/pseudovariables.md) | [link](cookbooks/5.6.x/transformations.md) | [link](cookbooks/5.6.x/selects.md) | [link](https://kamailio.org/docs/modules/5.6.x/) |