Friday, May 17, 2019

Kamailio – Updates To Command Line Arguments

Recently, a series of commits focused on updating the command line arguments for Kamailio. With an increased popularity of deploying Kamailio in containerised environments, the flexibility of using command line arguments when starting the SIP server can simplify the orchestration.
For long time, Kamailio accepted only arguments with short name (single character argument name), so one of these new additions was the option to handle arguments with long name, opening the door to add a lot more variants.
The list of command line arguments is printed by running ‘kamailio -h‘, with the version built from the latest Git master branch, these are:
# kamailio -h

version: kamailio 5.3.0-dev5 (x86_64/darwin) 104147-dirty
Usage: kamailio [options]
Options:
    -a mode      Auto aliases mode: enable with yes or on,
                  disable with no or off
    --alias=val  Add an alias, the value has to be '[proto:]hostname[:port]'
                  (like for 'alias' global parameter)
    -A define    Add config pre-processor define (e.g., -A WITH_AUTH,
                  -A 'FLT_ACC=1', -A 'DEFVAL="str-val"')
    -b nr        Maximum receive buffer size which will not be exceeded by
                  auto-probing procedure even if  OS allows
    -c           Check configuration file for syntax errors
    -d           Debugging mode (multiple -d increase the level)
    -D           Control how daemonize is done:
                  -D..do not fork (almost) anyway;
                  -DD..do not daemonize creator;
                  -DDD..daemonize (default)
    -e           Log messages printed in terminal colors (requires -E)
    -E           Log to stderr
    -f file      Configuration file (default: /tmp/kamailio-dev/etc/kamailio/kamailio.cfg)
    -g gid       Change gid (group id)
    -G file      Create a pgid file
    -h           This help message
    --help       Long option for `-h`
    -I           Print more internal compile flags and options
    -K           Turn on "via:" host checking when forwarding replies
    -l address   Listen on the specified address/interface (multiple -l
                  mean listening on more addresses). The address format is
                  [proto:]addr_lst[:port][/advaddr],
                  where proto=udp|tcp|tls|sctp,
                  addr_lst= addr|(addr, addr_lst),
                  addr=host|ip_address|interface_name and
                  advaddr=addr[:port] (advertised address).
                  E.g: -l localhost, -l udp:127.0.0.1:5080, -l eth0:5062,
                  -l udp:127.0.0.1:5080/1.2.3.4:5060,
                  -l "sctp:(eth0)", -l "(eth0, eth1, 127.0.0.1):5065".
                  The default behaviour is to listen on all the interfaces.
    -L path      Modules search path (default: /tmp/kamailio-dev/lib64/kamailio/modules)
    -m nr        Size of shared memory allocated in Megabytes
    -M nr        Size of private memory allocated, in Megabytes
    -n processes Number of child processes to fork per interface
                  (default: 8)
    -N           Number of tcp child processes (default: equal to `-n')
    -O nr        Script optimization level (debugging option)
    -P file      Create a pid file
    -Q           Number of sctp child processes (default: equal to `-n')
    -r           Use dns to check if is necessary to add a "received="
                  field to a via
    -R           Same as `-r` but use reverse dns;
                  (to use both use `-rR`)
    --server-id=num set the value for server_id
    --subst=exp set a subst preprocessor directive
    --substdef=exp set a substdef preprocessor directive
    --substdefs=exp set a substdefs preprocessor directive
    -S           disable sctp
    -t dir       Chroot to "dir"
    -T           Disable tcp
    -u uid       Change uid (user id)
    -v           Version number
    --version    Long option for `-v`
    -V           Alternative for `-v`
    -x name      Specify internal manager for shared memory (shm)
                  - can be: fm, qm or tlsf
    -X name      Specify internal manager for private memory (pkg)
                  - if omitted, the one for shm is used
    -Y dir       Runtime dir path
    -w dir       Change the working directory to "dir" (default: "/")
    -W type      poll method (depending on support in OS, it can be: poll,
                  epoll_lt, epoll_et, sigio_rt, select, kqueue, /dev/poll)
Among the latest argument additions:
  • add domain aliases with –alias
  • set advertised address to listen sockets speficied with -l socket/advertise
  • set server id with –server-id
  • set a subst, substdef or substdefs preprocessor expression with –subst, –substdef or –substdefs
Couple of more will be added in the future, aiming to make it easier to control Kamailio from command line. If you have suggestions, do not hesitate to propose them to sr-users mailing list.
Thanks for flying Kamailio!

No comments:

Post a Comment