User Tools

Site Tools


cookbooks:4.0.x:core:cfg

This is an old revision of the document!


This is a work in progress

The Configuration File

Configuration Elements

For the sake and sanity of the user of this software, we need to cover the basic elements of the configuration before getting to the meat and potatoes.

  • Comments
  • Configuration Directives
  • Instruction Separator

Comments

The first thing you should understand is the comment syntax used in the configuration file.

Comments in the configuration file are a mixture of C-Style (not C++) and scripting language syntax.
It closely resembles the PHP style, except you can not use double-slash ( ⁄ ⁄ ), and only hash (#) may be used for line comments.

It can be confusing seeing the C-Style Control Directives (explained later) that begin with a hash-bang (#!) mixed with line comments begin with a hash (#).

/* block comment
   block comment */
// this is NOT a line comment
# this is a line comment
#!c_style_directive  <-- VALID CONFIGURATION DIRECTIVE

Configuration Directives

There are five (5) types of configuration directives used with Kamailio.

Instruction Separator

The semicolon works with all forms of configuration directives as an instruction separator. Allowing for comments or additional configuration directives on the same line.

configuration_directive_a; configuration_directive_b
configuration_directive; # comment about the configuration directive

Configuration Directives

C-Style Control Directives

Available 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/ifndef region
  • #!endif - end ifdef/ifndef region
  • #!trydef - add a define if not already defined
  • #!redefine - force redefinition even if already defined
  • #!subst
  • #!substdef
#!define MODULE_NAME

#!ifdef MODULE_NAME
 .. set directives ..
#!else
 .. set alternate directives .. 
#!endif

Apache Name/Value Pairs

name "value"

The value MUST be enclosed in quotes.

loadmodule "module_name.so"
loadmodule "another_module.so"
include_file "file_to_include.cfg"
import_file "/path/to/file_to_import.cfg"

Normal Name/Value Pairs

name=value

(delimited by an equals sign)

core_parameters

memdbg=5
memlog=5
log_facility=LOG_LOCAL0
fork=yes
children=4
#disable_tcp=yes
auto_aliases=no
alias="sip.mydomain.com"

Modify Parameter Procedure

modparam("first_module", "module_parameter_text", "new_value");  # Set Text Value
modparam("second_module", "module_parameter_number", 10000);      # Set Numeric Value
modparam("second_module", "module_parameter_on", 1);              # Enable Parameter
modparam("third_module", "module_parameter_on", 0);             # Disable Parameter

Route Functions

cookbooks/4.0.x/core/cfg.1371542747.txt.gz · Last modified: 2013/06/18 10:05 by poing