Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cookbooks:core-cookbook:devel [2011/01/27 14:37] 83.136.33.3 |
cookbooks:core-cookbook:devel [2013/01/11 14:48] (current) alexh [workdir] |
||
---|---|---|---|
Line 10: | Line 10: | ||
==== include_file ==== | ==== include_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. | 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. | 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 use also the syntax **# | ||
Example of usage: | Example of usage: | ||
Line 34: | Line 40: | ||
--- | --- | ||
</ | </ | ||
+ | |||
+ | ==== import_file ==== | ||
+ | |||
+ | < | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Similar to **include_file**, | ||
==== define ==== | ==== define ==== | ||
Line 41: | Line 55: | ||
Available directives: | Available directives: | ||
* #!define NAME - define a keyword | * #!define NAME - define a keyword | ||
+ | * #!define NAME VALUE - define a keyword with value | ||
* #!ifdef NAME - check if a keyword is defined | * #!ifdef NAME - check if a keyword is defined | ||
* #!ifndef - check if a keyword is not defined | * #!ifndef - check if a keyword is not defined | ||
Line 99: | Line 114: | ||
</ | </ | ||
+ | * you can define values for IDs | ||
+ | |||
+ | <code c> | ||
+ | #!define MYINT 123 | ||
+ | #!define MYSTR " | ||
+ | </ | ||
+ | |||
+ | * defined IDs are replaced at startup, during config parsing, e.g.,: | ||
+ | |||
+ | <code c> | ||
+ | $var(x) = 100 + MYINT; | ||
+ | </ | ||
+ | |||
+ | * is interpreted as: | ||
+ | |||
+ | <code c> | ||
+ | $var(x) = 100 + 123; | ||
+ | </ | ||
+ | |||
+ | * you can have multi-line defined IDs | ||
+ | |||
+ | <code c> | ||
+ | #!define IDLOOP $var(i) = 0; \ | ||
+ | while($var(i)< | ||
+ | xlog(" | ||
+ | $var(i) = $var(i) + 1; \ | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | * then in routing block | ||
+ | |||
+ | <code c> | ||
+ | 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 ' | ||
+ | * 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. | ||
+ | |||
+ | ==== 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.,: | ||
+ | |||
+ | <code c> | ||
+ | #!subst "/ | ||
+ | </ | ||
+ | |||
+ | * flags is optional and can be: ' | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | #!subst "/ | ||
+ | modparam(" | ||
+ | </ | ||
+ | |||
+ | * will do the substitution of db password in db_url parameter value | ||
+ | |||
+ | ==== substdef ==== | ||
+ | |||
+ | <code c> | ||
+ | #!subst "/ | ||
+ | </ | ||
+ | |||
+ | Similar to **subst**, but in addition it adds a **#!define ID subst**. | ||
===== Core Keywords ===== | ===== Core Keywords ===== | ||
Line 409: | Line 497: | ||
+ | ==== 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: | ||
+ | |||
+ | < | ||
+ | corelog=1 | ||
+ | </ | ||
==== debug ==== | ==== debug ==== | ||
Line 639: | Line 738: | ||
maxbuffer=65536 | maxbuffer=65536 | ||
+ | | ||
+ | ==== 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: | ||
+ | |||
+ | sql_buffer_size=131070 | ||
==== max_while_loops ==== | ==== max_while_loops ==== | ||
Line 769: | Line 876: | ||
port=5080 | port=5080 | ||
+ | |||
+ | ==== pv_buffer_size ==== | ||
+ | |||
+ | The size in bytes of internal buffer to print dynamic strings with pseudo-variables inside. The default value is 1024. | ||
+ | |||
+ | Example of usage: | ||
+ | |||
+ | < | ||
+ | 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: | ||
+ | |||
+ | < | ||
+ | pv_buffer_slots=12 | ||
+ | </ | ||
==== reply_to_via ==== | ==== reply_to_via ==== | ||
Line 828: | Line 955: | ||
==== stun_allow_stun ==== | ==== stun_allow_stun ==== | ||
- | Use STUN or not (works only if sip-router was compiled with STUN support) | + | Activate internal |
stun_allow_stun = 0 | 1 (off | on); default 1 | stun_allow_stun = 0 | 1 (off | on); default 1 | ||
- | + | Note: STUN support is only available if sip-router/ | |
==== stun_refresh_interval ==== | ==== stun_refresh_interval ==== | ||
Line 841: | Line 967: | ||
==== syn_branch ==== | ==== syn_branch ==== | ||
- | The parameter controls how the branch parameter is calculated for stateless forwarding. | + | The parameter controls how the branch parameter is calculated for stateless forwarding. It also applies to statefull forwarding of ACK requests following 2xx responses. |
If syn_branch is turned off, calculation is derived from transaction key, i.e., as an md5 of From/ | If syn_branch is turned off, calculation is derived from transaction key, i.e., as an md5 of From/ | ||
Line 895: | Line 1021: | ||
user_agent_header=" | user_agent_header=" | ||
</ | </ | ||
+ | |||
+ | ==== version_table ==== | ||
+ | Set the name of the table holding the table version. Usefull if the proxy is sharing a database within a project and during upgrades. Default value is " | ||
+ | |||
+ | Example of usage: | ||
+ | |||
+ | | ||
==== workdir ==== | ==== workdir ==== | ||
Line 1108: | Line 1241: | ||
| | ||
+ | |||
+ | |||
+ | ==== 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**. | ||
+ | |||
+ | <code c> | ||
+ | tcp_accept_no_cl=yes | ||
+ | </ | ||
==== tcp_async ==== | ==== tcp_async ==== | ||
Line 1115: | Line 1259: | ||
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). | 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: | + | **Note: |
tcp_async = yes | no (default yes) | tcp_async = yes | no (default yes) | ||
| | ||
+ | |||
==== tcp_children ==== | ==== tcp_children ==== | ||
Line 1473: | Line 1618: | ||
==== real_time ==== | ==== real_time ==== | ||
- | Sets real time priority for all the ser processes, or the timers (bitmaks). | + | Sets real time priority for all the ser processes, or the timers (bitmask). |
| | ||
1 - the " | 1 - the " | ||
Line 1542: | Line 1687: | ||
Without parameter, the function copies the current URI into a new branch. Thus, leaving the main branch (the URI) for further manipulation. | Without parameter, the function copies the current URI into a new branch. Thus, leaving the main branch (the URI) for further manipulation. | ||
- | With a parameter, the function copies the URI in the parameter into a new branch. Thus, the current URI is not manipulated. Note: append_branch(uri) still copies the destination URI, which is usually | + | With a parameter, the function copies the URI in the parameter into a new branch. Thus, the current URI is not manipulated. Note: append_branch(uri) still copies the destination URI, which is usually |
Note that it's not possible to append a new branch in " | Note that it's not possible to append a new branch in " | ||
Line 1607: | Line 1752: | ||
If the function is called in a ' | If the function is called in a ' | ||
- | If the function is called in a ' | + | If the function is called in the default ' |
Example of usage: | Example of usage: | ||
onreply_route { | onreply_route { | ||
- | if(status==" | + | if(status==" |
- | drop(); | + | drop(); |
+ | } | ||
+ | } | ||
+ | |||
+ | onreply_route[FOOBAR] { | ||
+ | if(status==" | ||
+ | drop(); # this is ignored | ||
} | } | ||
} | } | ||
Line 2244: | Line 2395: | ||
The logical operators that can be used in ' | The logical operators that can be used in ' | ||
- | * == - equal | + | < |
- | | + | |
- | | + | != not equal |
- | | + | =~ regular expression matching: Note: Posix regular expressions will be used, e.g. use [[: |
- | | + | !~ regular expression not-matching |
- | | + | > |
- | | + | >= greater or equal |
- | | + | < |
- | | + | <= less or equal |
- | | + | && |
- | | + | || logical OR |
- | | + | ! |
+ | [ ... ] test operator - inside can be any arithmetic expression | ||
+ | </ | ||
Example of usage: | Example of usage: | ||
Line 2390: | Line 2543: | ||
* / : divide | * / : divide | ||
* * : multiply | * * : multiply | ||
- | * % : modulo | + | * % : modulo |
* | : bitwise OR | * | : bitwise OR | ||
* & : bitwise AND | * & : bitwise AND |