On January 11, 2010, Kamailio 3.0.0 was released.
On July 28, 2008, OPENSER was renamed to KAMAILIO
Differences
This shows you the differences between two versions of the page.
|
core-cookbook:3.0.x [2010/02/17 14:50] 83.136.33.3 |
core-cookbook:3.0.x [2010/08/17 11:06] (current) 92.231.108.49 |
||
|---|---|---|---|
| Line 7: | Line 7: | ||
| **Note:** The parameters on this page are **NOT** in alphabetical order. | **Note:** The parameters on this page are **NOT** in alphabetical order. | ||
| - | ===== Include File Directive ===== | + | ===== Config Pre-Processor Directives ===== |
| ==== include_file ==== | ==== include_file ==== | ||
| Line 36: | Line 36: | ||
| </code> | </code> | ||
| + | ==== 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 | ||
| + | * #!ifdef NAME - check if a keyword is defined | ||
| + | * #!ifndef - check if a keyword is not defined | ||
| + | * #!else - swtich to false branch of ifdef/ifndef region | ||
| + | * #!endif - end ifdef/ifndef region | ||
| + | |||
| + | Among benefits: | ||
| + | * easy way to enable/disable features (e.g., see default cfg for 3.0.0 -- 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: | ||
| + | |||
| + | <code 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://openser:openserrw@localhost/openser_testbed") | ||
| + | #!else | ||
| + | modparam("acc|auth_db|usrloc", "db_url", | ||
| + | "mysql://openser:openserrw@10.0.0.2/openser_production") | ||
| + | #!endif | ||
| + | |||
| + | ... | ||
| + | |||
| + | #!ifdef TESTBED_MODE | ||
| + | route[DEBUG] { | ||
| + | xlog("SCRIPT: SIP $rm from: $fu to: $ru - srcip: $si"\n); | ||
| + | } | ||
| + | #!endif | ||
| + | |||
| + | ... | ||
| + | |||
| + | route { | ||
| + | #!ifdef TESTBED_MODE | ||
| + | route(DEBUG); | ||
| + | #!endif | ||
| + | |||
| + | ... | ||
| + | } | ||
| + | |||
| + | ... | ||
| + | </code> | ||
| ===== Core Keywords ===== | ===== Core Keywords ===== | ||
| Line 1017: | Line 1080: | ||
| Enable SIP outbound TCP keep-alive using PING-PONG (CRLFCRLF - CRLF). | Enable SIP outbound TCP keep-alive using PING-PONG (CRLFCRLF - CRLF). | ||
| - | tcp_crlf_ping = yes | no default: yes) | + | tcp_crlf_ping = yes | no (default: yes) |
| Line 1933: | Line 1996: | ||
| } | } | ||
| </code> | </code> | ||
| - | |||
| ==== branch_route ==== | ==== branch_route ==== | ||
| Line 1949: | Line 2011: | ||
| } | } | ||
| branch_route[1] { | branch_route[1] { | ||
| - | if(uri=~"10\.10\.10].10") { | + | if(uri=~"10\.10\.10\.10") { |
| # discard branches that go to 10.10.10.10 | # discard branches that go to 10.10.10.10 | ||
| drop(); | drop(); | ||
| Line 2260: | Line 2322: | ||
| NOTE: to ensure the priority of operands in expression evaluations do use __parenthesis__. | NOTE: to ensure the priority of operands in expression evaluations do use __parenthesis__. | ||
| - | Arithmetic expressions can be used in condition expressions via test operator ' [ ... ] '. | + | Arithmetic expressions can be used in condition expressions: |
| <code> | <code> | ||
| - | if( [ $var(a) & 4 ] ) | + | if( $var(a) & 4 ) |
| log("var a has third bit set\n"); | log("var a has third bit set\n"); | ||
| </code> | </code> | ||