cookbooks:4.0.x:core:cfg
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
cookbooks:4.0.x:core:cfg [2013/06/18 05:44] – created poing | cookbooks:4.0.x:core:cfg [2013/06/26 07:39] (current) – [Configuration Directives] poing | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <fc # | + | ====== The Configuration File ====== |
- | The Configuration | + | ===== Configuration |
- | Configuration Directives | + | For the sake and sanity of the user of this software, we should cover the basic elements of the configuration before getting to the meat and potatoes. |
- | There are five (5) types of configuration directives used with Kamailio. | + | * Configuration Directives |
+ | * Comments | ||
+ | * Instruction Separator | ||
- | - C-Style Control Directives | ||
- | - Apache-Like Name/Value Pairs (delimited by a space, value within quotes) | ||
- | - Normal Name/Value Pairs (delimited by an equals sign) | ||
- | - Modify Parameter Procedure | ||
- | - Route Functions | ||
- | Comments | + | ----- |
+ | ----- | ||
- | Configuration | + | ==== Configuration |
- | This is confusing, since the hash-bang | + | There are five (5) types of configuration directives used with Kamailio.\\ |
+ | ^ <fc # | ||
- | /* block comment | + | - C-Style Control Directives |
- | block comment */ | + | - Apache-Like Name/Value Pairs |
- | // this is NOT a line comment | + | - Normal Name/Value Pairs |
- | # this is a line comment | + | - Modify Parameter Procedure |
- | # | + | - Route Functions |
- | Instruction Separator | + | ----- |
- | The semicolon works with all forms of configuration directives as an instruction separator. | + | ==== Comments ==== |
- | configuration_directive_a; | + | ^ < |
- | configuration_directive; | + | |
+ | Comments in the configuration file are a mixture of C-Style (**not C++**) and scripting language syntaxes.\\ | ||
+ | It closely resembles the PHP style, **// | ||
+ | It can be confusing seeing the C-Style Control Directives ([[cfg# | ||
- | C-Style Control Directives | + | ^ Examples: |
+ | |Block Comment:< | ||
+ | /* This is a ... | ||
+ | block comment */</ | ||
+ | |<fc # | ||
+ | |Line Comment:< | ||
+ | |**<fc # | ||
+ | |||
+ | ----- | ||
+ | |||
+ | ==== Instruction Separator ==== | ||
+ | |||
+ | <fc # | ||
+ | |||
+ | The semicolon (;) is **//not required// | ||
+ | |||
+ | The general use is to allow for comments or additional configuration directives be placed on the same line. | ||
+ | |||
+ | ^ Examples: | ||
+ | |< | ||
+ | configuration_directive_a | ||
+ | configuration_directive_b; | ||
+ | configuration_directive_c; | ||
+ | configuration_directive_e; | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | ----- | ||
+ | |||
+ | ===== Configuration Directives ===== | ||
+ | |||
+ | ^ Type ^ Format ^ Comment ^ | ||
+ | | C-Style Control Directives | #!directive [ NAME [ VALUE ] ] | Begins with hash-bang (#!) | | ||
+ | | Apache-Like Name/Value Pairs | name " | ||
+ | | Normal Name/Value Pairs | name=value | Delimited by an equals sign | | ||
+ | | Modify Parameter Procedure | modparam(" | ||
+ | | Route Functions | route {...} | Scripting Language | | ||
+ | ==== C-Style Control 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 | + | |
- | #!else - swtich to false branch of ifdef/ | + | |
- | #!endif - end ifdef/ | + | |
- | #!trydef - add a define if not already defined | + | |
- | #!redefine - force redefinition even if already defined | + | |
- | #!subst | + | |
- | #!substdef | + | |
+ | |||
+ | ^ Example: | ||
+ | |<code c> | ||
+ | #!define MODULE_NAME | ||
+ | |||
+ | #!ifdef MODULE_NAME | ||
+ | " | ||
+ | #!else | ||
+ | " | ||
+ | #!endif | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | ==== Apache Name/Value Pairs ==== | ||
+ | |||
+ | ^ Syntax | ||
+ | | <code c>name " | ||
+ | |||
+ | <fc # | ||
+ | |||
+ | ^ Examples | ||
+ | |< | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | include_file " | ||
+ | import_file "/ | ||
+ | </ | ||
+ | |||
+ | ------- | ||
+ | ==== Normal Name/Value Pairs ==== | ||
+ | |||
+ | These name/value pairs are normally delimited by an equal sign. | ||
+ | |||
+ | ^ Syntax: | | ||
+ | |<code c> | ||
+ | |||
+ | <fc # | ||
+ | Check the [[../ | ||
+ | |||
+ | ^ Examples: | ||
+ | |< | ||
+ | memdbg=5 | ||
+ | memlog=5 | ||
+ | log_facility=LOG_LOCAL0 | ||
+ | fork=yes | ||
+ | children=4 | ||
+ | # | ||
+ | auto_aliases=no | ||
+ | alias=" | ||
+ | </ | ||
+ | |||
+ | ------ | ||
+ | ==== Modify Parameter Procedure ==== | ||
+ | |||
+ | The modify parameter is similar to other types programming procedure.\\ | ||
+ | You call the procedure and it modifies the defined modules parameter. | ||
+ | |||
+ | ^ Syntax: | ||
+ | | <code c> | ||
+ | |||
+ | <fc # | ||
+ | |||
+ | See the [[http:// | ||
+ | |||
+ | ^ Examples: | ||
+ | |< | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | ==== Route Functions ==== | ||
+ | |||
+ | I will not go into too much detail here, the scripting methods, functions, and procdedures should be covered elsewhere in this wiki.\\ | ||
+ | |||
+ | |||
+ | ^ Example: | ||
+ | |<code c> | ||
+ | route(REQINIT); | ||
+ | route(NATDETECT); | ||
+ | |||
+ | # CANCEL ?? | ||
+ | if (is_method(" | ||
+ | | ||
+ | } | ||
+ | |||
+ | # OTHER SCRIPT CODE HERE | ||
+ | }</ |
cookbooks/4.0.x/core/cfg.1371534256.txt.gz · Last modified: 2013/06/18 05:44 by poing