cookbooks:4.0.x:core:cfg
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cookbooks:4.0.x:core:cfg [2013/06/18 05:56] – 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 |
+ | |||
+ | 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. | ||
+ | |||
+ | * Configuration Directives | ||
+ | * Comments | ||
+ | * Instruction Separator | ||
+ | |||
+ | |||
+ | ----- | ||
+ | ----- | ||
==== Configuration Directives ==== | ==== Configuration Directives ==== | ||
- | There are five (5) types of configuration directives used with Kamailio. | + | There are five (5) types of configuration directives used with Kamailio.\\ |
+ | ^ <fc # | ||
- C-Style Control Directives | - C-Style Control Directives | ||
- | - Apache-Like Name/Value Pairs (delimited by a space, value within quotes) | + | - Apache-Like Name/Value Pairs |
- | - Normal Name/Value Pairs (delimited by an equals sign) | + | - Normal Name/Value Pairs |
- Modify Parameter Procedure | - Modify Parameter Procedure | ||
- Route Functions | - Route Functions | ||
+ | |||
+ | ----- | ||
==== Comments ==== | ==== Comments ==== | ||
- | Configuration file comments are PHP style, without the double-slash line comment. | + | ^ < |
- | <fc #FF0000>//This gets confusing since the hash-bang (#!) is used at the beginning of the C-Style Control Directives.//</fc> | + | |
- | < | + | Comments in the configuration file are a mixture of C-Style (**not C++**) and scripting language syntaxes.\\ |
- | /* block comment | + | It closely resembles the PHP style, **//except//** you **can not use** double-slash ( ⁄ ⁄ ) for line comments. |
- | block comment | + | It can be confusing seeing the C-Style Control Directives ([[cfg# |
- | // this is NOT a line comment | + | |
- | # this is a line comment | + | |
- | #!c_style_directive | + | |
- | </ | + | |
+ | ^ Examples: | ||
+ | |Block Comment:< | ||
+ | /* This is a ... | ||
+ | block comment */</ | ||
+ | |<fc # | ||
+ | |Line Comment:< | ||
+ | |**<fc # | ||
+ | |||
+ | ----- | ||
==== Instruction Separator ==== | ==== Instruction Separator ==== | ||
- | The semicolon works with all forms of configuration directives as an instruction separator. | + | <fc # |
- | < | + | The semicolon (;) is **//not required// |
- | configuration_directive_a; configuration_directive_b | + | |
- | configuration_directive; | + | |
- | </code> | + | |
+ | The general use is to allow for comments or additional configuration directives be placed on the same line. | ||
- | C-Style Control Directives | + | ^ 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.1371535001.txt.gz · Last modified: 2013/06/18 05:56 by poing