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 06:57] – 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 File ====== | ||
===== Configuration Elements ===== | ===== Configuration Elements ===== | ||
+ | |||
+ | 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 # | ||
- | - [[cfg# | + | - C-Style Control Directives |
- | - [[cfg# | + | - Apache-Like Name/Value Pairs |
- | - [[cfg# | + | - Normal Name/Value Pairs |
- | - [[cfg# | + | - Modify Parameter Procedure |
- | - [[cfg# | + | - Route Functions |
+ | |||
+ | ----- | ||
==== Comments ==== | ==== Comments ==== | ||
- | Configuration | + | ^ <fc # |
- | <fc # | + | |
+ | Comments in the configuration | ||
+ | It closely resembles the PHP style, | ||
+ | It can be confusing | ||
- | < | + | ^ Examples: |
- | /* block comment | + | |Block Comment:< |
- | block comment */ | + | /* This is a ... |
- | // this is NOT a line comment | + | block comment */</ |
- | # this is a line 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; # comment about the configuration directive | + | 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; # comment about the configuration directive | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | ----- | ||
===== Configuration Directives ===== | ===== 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 ==== | ==== C-Style Control Directives ==== | ||
Line 54: | Line 86: | ||
* #!substdef | * #!substdef | ||
- | < | + | ^ Example: |
+ | |< | ||
#!define MODULE_NAME | #!define MODULE_NAME | ||
#!ifdef MODULE_NAME | #!ifdef MODULE_NAME | ||
- | .. set directives .. | + | ".. set directives .." |
#!else | #!else | ||
- | .. set alternate directives .. | + | ".. set alternate directives .." |
#!endif | #!endif | ||
- | </ | + | </ |
+ | ----- | ||
==== Apache Name/Value Pairs ==== | ==== Apache Name/Value Pairs ==== | ||
- | | + | ^ Syntax |
+ | | <code c>name " | ||
<fc # | <fc # | ||
- | | + | ^ Examples |
- | loadmodule " | + | |< |
- | include_file " | + | loadmodule " |
- | import_file " | + | loadmodule " |
+ | include_file " | ||
+ | import_file "/path/to/file_to_import.cfg" | ||
+ | </ | ||
- | | + | ------- |
==== Normal Name/Value Pairs ==== | ==== Normal Name/Value Pairs ==== | ||
- | | + | These name/value pairs are normally |
- | (delimited by an equals | + | |
- | [[../core# | + | ^ Syntax: | |
+ | |<code c> | ||
- | < | + | <fc # |
+ | Check the [[../ | ||
+ | |||
+ | ^ Examples: | ||
+ | |< | ||
memdbg=5 | memdbg=5 | ||
memlog=5 | memlog=5 | ||
Line 92: | Line 134: | ||
auto_aliases=no | auto_aliases=no | ||
alias=" | alias=" | ||
- | </ | + | </ |
+ | ------ | ||
==== Modify Parameter Procedure ==== | ==== 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(" | ||
modparam(" | modparam(" | ||
modparam(" | modparam(" | ||
- | </ | + | </ |
+ | ----- | ||
==== Route Functions ==== | ==== 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(" | ||
+ | exit; | ||
+ | } | ||
+ | |||
+ | # OTHER SCRIPT CODE HERE | ||
+ | }</ |
cookbooks/4.0.x/core/cfg.1371538663.txt.gz · Last modified: 2013/06/18 06:57 by poing