Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cookbooks:core-cookbook:devel [2011/03/01 10:20]
klaus3000
cookbooks:core-cookbook:devel [2013/01/11 14:48] (current)
alexh [workdir]
Line 10: Line 10:
 ==== include_file ==== ==== include_file ====
  
 +<code>
    include_file "path_to_file"    include_file "path_to_file"
 +</code>
  
 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 **#!include_file** or **!!include_file**.
  
 Example of usage:  Example of usage: 
Line 34: Line 40:
 --- ---
 </code> </code>
 +
 +==== import_file ====
 +
 +<code>
 +   import_file "path_to_file"
 +</code>
 +
 +Similar to **include_file**, but does not throw error if the included file is not found.
  
 ==== 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:
 </code> </code>
  
 +  * you can define values for IDs
 +
 +<code c>
 +#!define MYINT 123
 +#!define MYSTR "xyz"
 +</code>
 +
 +  * defined IDs are replaced at startup, during config parsing, e.g.,:
 +
 +<code c>
 +$var(x) = 100 + MYINT;
 +</code>
 +
 +  * is interpreted as:
 +
 +<code c>
 +$var(x) = 100 + 123;
 +</code>
 +
 +  * you can have multi-line defined IDs
 +
 +<code c>
 +#!define IDLOOP $var(i) = 0; \
 +                while($var(i)<5) { \
 +                    xlog("++++ $var(i)\n"); \
 +                    $var(i) = $var(i) + 1; \
 +                }
 +</code>
 +
 +  * then in routing block
 +
 +<code c>
 +route {
 +    ...
 +    IDLOOP
 +    ...
 +}
 +</code>
 +
 +  * 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. 
 +
 +==== 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 "/regexp/subst/flags"
 +</code>
 +
 +  * flags is optional and can be: 'i' - ignore case; 'g' - global replacement
 +
 +Example:
 +
 +<code c>
 +#!subst "/DBPASSWD/xyz/"
 +modparam("acc", "db_url", "mysql://user:DBPASSWD@localhost/db")
 +</code>
 +
 +  * will do the substitution of db password in db_url parameter value
 +
 +==== substdef ====
 +
 +<code c>
 +#!subst "/ID/subst/"
 +</code>
 +
 +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:
 +
 +<code>
 +corelog=1
 +</code> 
 ==== 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:
 +
 +<code>
 +pv_buffer_size=2048
 +</code>
 +
 +==== 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:
 +
 +<code>
 +pv_buffer_slots=12
 +</code>
  
 ==== 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 server.
   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/Kamailio was compiled with STUN support ("make STUN=1 cfg")
  
 ==== 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/To/CallID/ If syn_branch is turned off, calculation is derived from transaction key, i.e., as an md5 of From/To/CallID/
Line 895: Line 1021:
 user_agent_header="User-Agent: My Super SIP Server" user_agent_header="User-Agent: My Super SIP Server"
 </code> </code>
 +
 +==== 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 "version".
 +
 +Example of usage:
 +
 +     table_version=sr_table_version
  
 ==== workdir ==== ==== workdir ====
Line 1108: Line 1241:
  
    tcp_accept_aliases= yes|no    tcp_accept_aliases= yes|no
 +
 +
 +==== 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
 +</code>
  
 ==== 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:** Using TLS over asynch TCP is not supported at the momentIf you use TLS you have to disable asynch TCP!+**Note:** It also applies for TLS.
  
   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). 
      Possible values:    - off      Possible values:    - off
                         1  - the "fast" timer                         1  - the "fast" timer
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 nto what you want. Thus it is better to call append_branch without parameter and then modify the main branch.+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 not what you want. Thus it is better to call append_branch without parameter and then modify the main branch.
  
 Note that it's not possible to append a new branch in "on_failure_route" block if a 6XX response has been previously received (it would be against RFC 3261). Note that it's not possible to append a new branch in "on_failure_route" block if a 6XX response has been previously received (it would be against RFC 3261).

Navigation

Wiki

Other

QR Code
QR Code cookbooks:core-cookbook:devel (generated for current page)