Kamailio-kamailio.cfg: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
Line 91: Line 91:
     block
     block
     comment */
     comment */
</pre>
단, #! 로 시작되는 preprocessor 지시어는 코멘트 처리되지 않는다.
=== Values ===
세가지 타입의 value 가 있다.
* integer: Numbers of 32-bit size.
* boolean: aliases to 1(true, on, yes) or 0(false, off, no).
* string: tokens enclosed in between double or single quotes.
<pre>
// next two are strings
  "this is a string value"
  'this is another string value"
// next is a boolean
  yes
// next is an integer
  64
</pre>
</pre>



Revision as of 10:38, 13 July 2019

Overview

kamailio.cfg 파일 내용 정리

Basic

kamailio.cfg 파일은 크게 세가지 영역으로 구분된다.

  • global parameters
  • modules settings
  • routing blocks

Global Parameters Section

Configuration 파일의 첫번째 부분으로, Kamailio 의 core 와 custom global parameter 설정을 한다.

일반적으로 다음과 같이 설정된다.

name=value

name 부분은 core parameter 에 나와있는 항목이어야 한다. 만약 항목에 없는 name 을 설정했다면, kamailio 는 에러를 발생시키고 시작하지 앟는다.

value 부분은 integer, boolean, string 으로 설정한다. 하지만 몇몇 parameter 들은 복합된 형식의 value 로도 설정이 가능하다.

log_facility=LOG_LOCAL0

children=4

disable_tcp=yes

alias="sip.mydomain.com"

listen=udp:10.0.0.10:5060

대부분의 parameter의 설정은 라인의 끝부분까지이지만, 세미콜론(;)을 사용할 수도 있다. 이는 parameter 설정이 한번에 여러개의 값을 설정할 수 있도록 허용한 경우에 사용할 수 있다.

alias="sip.mydomain.com";

만약 reserved config keyword 를 parameter로 사용하고 싶다면, ""로 감싸야 한다. 아래의 예에서 reserved config keyword 는 "dns"이다.

listen=tcp:127.0.0.1:5060 advertise "sip.dns.example.com":5060

Modules Settings Section

Configuration file 의 두번째 부분으로써, module 들을 로드하는 지시어와 설정값들로 이루어져 있다.

설정의 첫부분에는 mpath 지시어로 모듈 디렉토리를 지정한다.

/* set paths to location of modules */
# mpath="/usr/local/lib64/kamailio/modules/"

loadmoudle 과 modparam 지시어가 사용된다.

loadmodule "debugger.so"
...
modparam("debugger", "cfgtrace", 1)

Routing Blocks Section

Configuration 파일의 마지막 부분으로서 SIP 트래픽의 routing logic 을 설정한다.

가장 중요한 routing block 은 request_route 이다. 이 request_route 에서 SIP 트래픽의 경로를 결정한다.

request_route {
 
    # per request initial checks
    route(REQINIT);
 
    ...
}
 
branch_route[MANAGE_BRANCH] {
    xdbg("new branch [$T_branch_idx] to $ru\n");
    route(NATMANAGE);
}

Generic Elements

Comments

  1. 혹은 // 로 시작하는 라인은 해당 라인이 코멘트로 인식된다.

/* 과 */ 에 포함되는 모든 부분도 코멘트로 인식된다.

  # this is a line comment
  
  // this is another line comment
  
  /* this
     is
     a
     block
     comment */

단, #! 로 시작되는 preprocessor 지시어는 코멘트 처리되지 않는다.


Values

세가지 타입의 value 가 있다.

  • integer: Numbers of 32-bit size.
  • boolean: aliases to 1(true, on, yes) or 0(false, off, no).
  • string: tokens enclosed in between double or single quotes.
// next two are strings
 
  "this is a string value"
  'this is another string value"
 
// next is a boolean
 
  yes
 
// next is an integer
 
  64

See also