This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:devel:core [2019/11/25 08:58] henningw [force_send_socket] |
cookbooks:devel:core [2020/10/14 21:52] miconda [sip_warning (noisy feedback)] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== Core Cookbook ====== |
+ | Version: Kamailio SIP Server v5.5.x (devel) | ||
===== Overview ===== | ===== Overview ===== | ||
Line 970: | Line 971: | ||
</ | </ | ||
+ | |||
+ | ==== ipv6_hex_style ==== | ||
+ | |||
+ | Can be set to " | ||
+ | |||
+ | Example of usage: | ||
+ | |||
+ | <code c> | ||
+ | ipv6_hex_style = " | ||
+ | </ | ||
==== kemi.onsend_route_callback ==== | ==== kemi.onsend_route_callback ==== | ||
Line 1025: | Line 1036: | ||
==== latency_limit_action ==== | ==== latency_limit_action ==== | ||
- | Limit of latency in ms 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. | + | Limit of latency in us (micro-seconds) |
Default value is 0 (disabled). | Default value is 0 (disabled). | ||
Line 1058: | Line 1069: | ||
==== listen ==== | ==== listen ==== | ||
- | Set the network addresses the SIP server should listen to. It can be an IP address, hostname or network | + | Set the network addresses the SIP server should listen to. It can be an IP address, hostname or network |
Example of usage: | Example of usage: | ||
Line 1073: | Line 1084: | ||
<code c> | <code c> | ||
- | listen=udp: | + | listen=udp: |
</ | </ | ||
Line 1079: | Line 1090: | ||
<code c> | <code c> | ||
- | listen=udp: | + | listen=udp: |
</ | </ | ||
Line 1085: | Line 1096: | ||
A typical use case for advertise address is when running SIP server behind a NAT/ | A typical use case for advertise address is when running SIP server behind a NAT/ | ||
+ | |||
+ | 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** identifier. | ||
+ | |||
+ | <code c> | ||
+ | listen=udp: | ||
+ | listen=udp: | ||
+ | listen=udp: | ||
+ | listen=udp: | ||
+ | ... | ||
+ | $fsn = " | ||
+ | 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. | ||
==== loadmodule ==== | ==== loadmodule ==== | ||
Line 1333: | Line 1360: | ||
It can be set via config reload framework. | It can be set via config reload framework. | ||
- | Default is 0 (disabled). | + | Default is 1 (enabled). |
<code c> | <code c> | ||
Line 1527: | Line 1554: | ||
==== route_locks_size ==== | ==== route_locks_size ==== | ||
- | Set the number of mutex locks to be used for synchronizing the execution of messages sharing the same Call-Id. In other words, enables Kamailio to execute sequentially 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. | + | 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 |
- | For smaller impact on parallel processing, its value it should be at least twice the number of kamailio | + | For smaller impact on parallel processing, its value it should be at least twice the number of Kamailio |
Example: | Example: | ||
Line 1536: | Line 1563: | ||
route_locks_size = 256 | 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 ==== | ==== server_id ==== | ||
Line 1576: | Line 1605: | ||
shm_mem_size = 64 (default 64) | 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) | ||
+ | |||
+ | <code 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 | ||
+ | |||
+ | <code c> | ||
+ | sip_parser_mode = 0 | ||
+ | </ | ||
==== sip_warning (noisy feedback) ==== | ==== sip_warning (noisy feedback) ==== | ||
- | Can be 0 or 1. If set to 1 (default value) a ' | + | Can be 0 or 1. If set to 1 (default value is 0) a ' |
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. | 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. | ||
Line 1662: | Line 1715: | ||
+ | ==== stats_name_separator ==== | ||
+ | Specify the character used as a separator for the internal statistics' | ||
+ | Default value is " | ||
+ | Example of usage: | ||
+ | |||
+ | stats_name_separator = " | ||
==== tos ==== | ==== tos ==== | ||
Line 3577: | Line 3636: | ||
Example: if (defined $v && !strempty($v)) $len=strlen($v); | 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**: | ||
+ | |||
+ | < | ||
+ | # kamailio -h | ||
+ | |||
+ | version: kamailio 5.4.0-dev4 (x86_64/ | ||
+ | Usage: kamailio [options] | ||
+ | Options: | ||
+ | -a mode Auto aliases mode: enable with yes or on, | ||
+ | disable with no or off | ||
+ | --alias=val | ||
+ | (like for ' | ||
+ | -A define | ||
+ | -A ' | ||
+ | -b nr Maximum receive buffer size which will not be exceeded by | ||
+ | auto-probing procedure even if OS allows | ||
+ | -c Check configuration file for syntax errors | ||
+ | -d | ||
+ | -D | ||
+ | -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: / | ||
+ | -g gid | ||
+ | -G file Create a pgid file | ||
+ | -h This help message | ||
+ | --help | ||
+ | -I Print more internal compile flags and options | ||
+ | -K Turn on " | ||
+ | -l address | ||
+ | mean listening on more addresses). The address format is | ||
+ | [proto: | ||
+ | where proto=udp|tcp|tls|sctp, | ||
+ | addr_lst= addr|(addr, addr_lst), | ||
+ | addr=host|ip_address|interface_name and | ||
+ | advaddr=addr[: | ||
+ | E.g: -l localhost, -l udp: | ||
+ | -l udp: | ||
+ | -l " | ||
+ | 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: / | ||
+ | -m nr Size of shared memory allocated in Megabytes | ||
+ | --modparam=modname: | ||
+ | type has to be ' | ||
+ | example: --modparam=corex: | ||
+ | -M nr Size of private memory allocated, in Megabytes | ||
+ | -n processes Number of child processes to fork per interface | ||
+ | (default: 8) | ||
+ | -N | ||
+ | -O nr Script optimization level (debugging option) | ||
+ | -P file Create a pid file | ||
+ | -Q | ||
+ | -r Use dns to check if is necessary to add a " | ||
+ | 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 | ||
+ | -t dir | ||
+ | -T | ||
+ | -u uid | ||
+ | -v | ||
+ | --version | ||
+ | -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 | ||
+ | -w dir | ||
+ | -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: | ||
+ | |||
+ | 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 | ||
+ | * **M** - strip EOL (' | ||
+ | * **N** - do not add EOL at the end of JSON document | ||
+ | |||
+ | Example of JSON logs when running Kamailio with " | ||
+ | |||
+ | < | ||
+ | { " | ||
+ | |||
+ | { " | ||
+ | |||
+ | </ |