Merge tag 'upstream/4.4.2'

Upstream version 4.4.2
changes/07/7007/1
Victor Seva 9 years ago
commit 04ca58409b

File diff suppressed because it is too large Load Diff

@ -27,7 +27,7 @@ endif # verbose
else
ifeq (,$(main_makefile))
# hack to automatically use config.mak in all the modules, without
# hack to automatically use config.mak in all the modules, without
# changing the current module makefiles (which all include Makefile.defs):
# if not called from the main makefile (module, lib or ut):
# include config.mak, but if not present or incomplete (makefile_defs!=1)
@ -96,7 +96,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
# version number
VERSION = 4
PATCHLEVEL = 4
SUBLEVEL = 1
SUBLEVEL = 2
# memory manager switcher
# 0 - f_malloc (fast malloc)
@ -149,7 +149,7 @@ OSREL_N:= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \
# TLS support
CORE_TLS ?=
CORE_TLS ?=
# by default compile with tls hooks support (so that no ser recompile is
# needed before the tls module can be used)
TLS_HOOKS=1
@ -176,7 +176,7 @@ INSTALL ?= install
TAR ?= tar
endif
INSTALL_TOUCH = touch # used to create the file first (good to
INSTALL_TOUCH = touch # used to create the file first (good to
# make solaris install work)
INSTALL_CFG = $(INSTALL) -m 644
INSTALL_BIN = $(INSTALL) -m 755
@ -220,8 +220,8 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
# CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3\
# |sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
# -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
# sed with POSIX.1 regex doesn't support |, + or ?
# (darwin, solaris ...) => this complicated expression
# sed with POSIX.1 regex doesn't support |, + or ?
# (darwin, solaris ...) => this complicated expression
MKDEP=$(CC) -MM -MG
#transform gcc version into 2.9x or 3.0
CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
@ -238,8 +238,10 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
-e 's/4\.[5-9]\..*/4.5+/' \
-e 's/4\.[5-9]$$/4.5+/' \
-e 's/5\.[0-9]\..*/5.0+/' \
-e 's/5\.[0-9]$$/5.0+/')
ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
-e 's/5\.[0-9]$$/5.0+/' \
-e 's/6\.[0-9]\..*/6.0+/' \
-e 's/6\.[0-9]$$/6.0+/')
ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
# dependencies can be generated on-the-fly while compiling *.c
CC_MKDEP_OPTS=-MMD -MP
endif # 3.0 <= $(CC_SHORTVER) <= 4.x
@ -250,7 +252,7 @@ ifneq (, $(findstring Sun, $(CC_LONGVER)))
CC_SHORTVER:=$(shell echo "$(CC_LONGVER)"|head -n 1| \
sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
CC_VER=$(CC) $(CC_SHORTVER)
MKDEP=$(CC) -xM1
MKDEP=$(CC) -xM1
endif
ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
@ -260,7 +262,7 @@ ifneq (, $(findstring Intel(R) C++ Compiler, $(CC_LONGVER)))
sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/g' )
CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
CC_VER=$(CC) $(CC_FULLVER)
MKDEP=$(CC) -MM
MKDEP=$(CC) -MM
endif
ifneq (, $(findstring clang, $(CC_LONGVER)))
@ -270,7 +272,7 @@ ifneq (, $(findstring clang, $(CC_LONGVER)))
CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
CC_VER=$(CC) $(CC_FULLVER)
CC_OPT=-O3
MKDEP=$(CC) -MM
MKDEP=$(CC) -MM
endif
ifeq (,$(CC_NAME))
@ -278,7 +280,7 @@ ifeq (,$(CC_NAME))
CC_NAME=$(CC)
CC_SHORTVER=unknown
CC_VER=unknown
MKDEP=gcc -MM
MKDEP=gcc -MM
$(warning Unknown compiler $(CC)\; supported compilers: \
gcc, sun cc, intel icc )
endif
@ -517,8 +519,8 @@ data_target = $(prefix)/$(data_dir)
# an implemetation of the "two levels segregated fit" malloc algorithm
# -DDL_MALLOC
# a malloc implementation based on Doug Lea's dl_malloc
# -DSF_MALLOC
# an experimental multi-CPU, pool based, multi-process safe version of
# -DSF_MALLOC
# an experimental multi-CPU, pool based, multi-process safe version of
# F_MALLOC. Should give better performance on machines with lots of CPUs
# after some tunning.
# -DLL_MALLOC
@ -534,7 +536,7 @@ data_target = $(prefix)/$(data_dir)
# -DUSE_SYSV_SEM
# uses sys v sems for locking (slower & limited number)
# -DUSE_PTHREAD_MUTEX
# uses pthread mutexes, faster than sys v or posix sems, but do not
# uses pthread mutexes, faster than sys v or posix sems, but do not
# work on all systems inter-processes (e.g. linux)
# -DUSE_POSIX_SEM
# uses posix semaphores for locking (faster than sys v)
@ -546,7 +548,7 @@ data_target = $(prefix)/$(data_dir)
# try busy waiting for a while and if the lock is still held go to
# force reschedule (FAST_LOCK)
# -DADAPTIVE_WAIT_LOOPS=number
# number of loops we busy wait, after "number" loops have elapsed we
# number of loops we busy wait, after "number" loops have elapsed we
# force a reschedule (FAST_LOCK)
# -DNOSMP
# don't use smp compliant locking (faster but won't work on SMP machines)
@ -560,26 +562,26 @@ data_target = $(prefix)/$(data_dir)
# -DDISABLE_NAGLE
# disable the tcp Nagle algorithm (lower delay)
# -DUSE_TLS
# compiles in tls support, requires -DUSE_TCP. Note: this is only
# compiles in tls support, requires -DUSE_TCP. Note: this is only
# generic support (parsing a.s.o.), it does not include the actual
# "tls engine". If you really want tls you need also either
# -DCORE_TLS and a tls/ subdir with the tls code or -DTLS_HOOKS and
# the tls module loaded.
# -DCORE_TLS
# compiles tls in-core support. Requires -DUSE_TLS, conflicts
# compiles tls in-core support. Requires -DUSE_TLS, conflicts
# -DTLS_HOOKS. Please use make CORE_TLS=1 instead (it will set all the
# needed defines automatically and extra libraries needed for linking).
# -DTLS_HOOKS
# compile tls module support (support for having the "tls engine" in a
# module). Requires -DUSE_TLS, conflicts -DCORE_TLS.
# Please use make TLS_HOOKS=1 (or TLS_HOOKS=0 to for disabling) instead
# of setting -DTLS_HOOKS (it will set all the needed defines
# of setting -DTLS_HOOKS (it will set all the needed defines
# automatically)
# -DHAVE_RESOLV_RES
# support for changing some of the resolver parameters present
# (_res structure in <resolv.h>)
# -DUSE_COMP
# compiles in comp=[sergz|sigcomp] support (parsing uri & via,
# compiles in comp=[sergz|sigcomp] support (parsing uri & via,
# adding it to via, lumps a.s.o). WARNING: right now this option
# is useless since the compression code doesn't exist yet.
# -DHONOR_MADDR
@ -602,7 +604,7 @@ data_target = $(prefix)/$(data_dir)
# if enabled profiling will be enabled for child processes
# Don't forget to set PROFILE (see below)
# -DNO_SIG_DEBUG
# turns off debugging messages in signal handlers (which might be
# turns off debugging messages in signal handlers (which might be
# unsafe)
# -DUSE_NAPTR
# turns on naptr support (but must be also enabled from the config)
@ -666,7 +668,7 @@ C_DEFS= $(extra_defs) \
# you may also want to set -DPROFILING
# WARNING: do not add mode=debug or mode=release anymore in the Makefile,
# use make mode=debug all instead. Anyway no by default ser is compiled w/
# use make mode=debug all instead. Anyway no by default ser is compiled w/
# debugging symbols in all cases (-g). --andrei
# memory managers and related debug mode
@ -736,7 +738,7 @@ ifeq ($(CC_NAME), gcc)
else echo "as" ; \
fi\
fi)
LDTYPE:=$(shell if $(LDPATH) -V 1>/dev/null 2>/dev/null; then \
if $(LDPATH) -V 2>&1|grep GNU >/dev/null; \
then echo gnu; \
@ -825,7 +827,7 @@ ifeq ($(ARCH), alpha)
endif
ifeq ($(use_fast_lock), yes)
C_DEFS+= -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
C_DEFS+= -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
found_lock_method=yes
endif
@ -836,13 +838,13 @@ C_INCLUDES=
ifeq ($(mode), release)
#if i386
ifeq ($(ARCH), i386)
# if gcc
ifeq ($(CC_NAME), gcc)
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=-g $(CC_OPT) -funroll-loops -Wcast-align $(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
$(call set_if_empty,CPUTYPE,athlon64)
CFLAGS+=-m32 -minline-all-stringops \
-falign-loops \
@ -857,7 +859,7 @@ $(call set_if_empty,CPUTYPE,athlon64)
CFLAGS+=-m32 -minline-all-stringops \
-falign-loops \
-ftree-vectorize \
-mtune=$(CPUTYPE)
-mtune=$(CPUTYPE)
LDFLAGS+=-m32
else
#if gcc 3.4+
@ -865,7 +867,7 @@ ifeq ($(CC_SHORTVER), 3.4)
$(call set_if_empty,CPUTYPE,athlon)
CFLAGS+=-m32 -minline-all-stringops \
-falign-loops \
-mtune=$(CPUTYPE)
-mtune=$(CPUTYPE)
LDFLAGS+=-m32
else
#if gcc 3.0+
@ -879,7 +881,7 @@ else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
for better results)
CFLAGS+=-m486 \
-malign-loops=4
else
@ -891,7 +893,7 @@ endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
ifeq ($(CC_NAME), clang)
@ -903,7 +905,7 @@ else # CC_NAME, clang
ifeq ($(CC_NAME), icc)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \
-tpp6 -xK #-openmp #optimize for PIII
-tpp6 -xK #-openmp #optimize for PIII
# -prefetch doesn't seem to work
#( ty to inline acroos files, unroll loops,prefetch,
# optimize for PIII, use PIII instructions & vect.,
@ -918,14 +920,14 @@ endif #ARCH, i386
#x86_64
ifeq ($(ARCH), x86_64)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=-g $(CC_OPT) -funroll-loops -Wcast-align $(PROFILE)
#if gcc 4.5+
# don't add '-mtune=$(CPUTYPE)' - gcc failure
ifeq ($(CC_SHORTVER),$(filter $(CC_SHORTVER),4.5+ 5.0+))
ifeq ($(CC_SHORTVER),$(filter $(CC_SHORTVER),4.5+ 5.0+ 6.0+))
$(call set_if_empty,CPUTYPE,opteron)
CFLAGS+=-m64 -minline-all-stringops \
-falign-loops \
@ -949,21 +951,21 @@ $(call set_if_empty,CPUTYPE,opteron)
CFLAGS+=-m64 -minline-all-stringops \
-falign-loops \
-ftree-vectorize \
-mtune=$(CPUTYPE)
-mtune=$(CPUTYPE)
LDFLAGS+=-m64
else
#if gcc 3.4
ifeq ($(CC_SHORTVER), 3.4)
$(call set_if_empty,CPUTYPE,athlon64)
CFLAGS+=-m64 -minline-all-stringops \
-falign-loops
-falign-loops
LDFLAGS+=-m64
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
$(call set_if_empty,CPUTYPE,athlon64)
CFLAGS+=-minline-all-stringops \
-falign-loops
-falign-loops
#-mcpu=$(CPUTYPE) \ # not working on all x86_64 gccs
#-mcpu=athlon
#-m64 on x86_64/x86 works starting with gcc 3.2
@ -971,7 +973,7 @@ else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
for better results)
CFLAGS+=-m486 \
-malign-loops=4
else
@ -984,20 +986,20 @@ endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 4.2+
endif # CC_SHORTVER, 5.0+, 4.5+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+
else # CC_NAME, gcc
ifeq ($(CC_NAME), clang)
$(call set_if_empty,CPUTYPE,opteron)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-g -m64 \
$(CC_OPT)
$(CC_OPT)
LDFLAGS+=-m64
else # CC_NAME, clang
ifeq ($(CC_NAME), icc)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS=-g -O3 -ipo -ipo_obj -unroll $(PROFILE) \
-tpp6 -xK #-openmp #optimize for PIII
-tpp6 -xK #-openmp #optimize for PIII
# -prefetch doesn't seem to work
#( ty to inline acroos files, unroll loops,prefetch,
# optimize for PIII, use PIII instructions & vect.,
@ -1018,9 +1020,9 @@ ifeq ($(CC_NAME), gcc)
#common stuff
CFLAGS=-g $(CC_OPT) -funroll-loops $(PROFILE) \
#-Wcast-align \
#-Wmissing-prototypes
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#-Wmissing-prototypes
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
$(call set_if_empty,CPUTYPE,ultrasparc)
#use 32bit for now
CFLAGS+=-m64 -mcpu=ultrasparc \
@ -1066,28 +1068,28 @@ $(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \
ifneq ($(OS), netbsd)
# on netbsd/sparc64, gcc 2.95.3 does not compile
# ser with -mv8
CFLAGS+= -mv9
CFLAGS+= -mv9
# -m64/-m32 on sparc works starting with gcc 3.0
endif
ifeq ($(ASTYPE), solaris)
CFLAGS+= -Wa,-xarch=v8plus
endif
endif
else #CC_SHORTVER, 2.9x
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
CFLAGS+= -mv9
CFLAGS+= -mv9
ifeq ($(ASTYPE), solaris)
CFLAGS+= -Wa,-xarch=v8plus
endif
endif
endif #CC_SHORTVER, 2.9x
endif #CC_SHORTVER, 3.0
endif #CC_SHORTVER, 3.4
endif #CC_SHORTVER, 4.x
endif #CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif #CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else #CC_NAME, gcc
ifeq ($(CC_NAME), suncc)
C_DEFS+=-DSPARC64_MODE
@ -1109,9 +1111,9 @@ ifeq ($(CC_NAME), gcc)
#common stuff
CFLAGS=-g $(CC_OPT) -funroll-loops $(PROFILE) \
#-Wcast-align \
#-Wmissing-prototypes
#-Wmissing-prototypes
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
$(call set_if_empty,CPUTYPE,v8)
#use 32bit for now
CFLAGS+= -mtune=$(CPUTYPE) \
@ -1147,13 +1149,13 @@ else #CC_SHORTVER, 2.9x
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif #CC_SHORTVER, 2.9x
endif #CC_SHORTVER, 3.0
endif #CC_SHORTVER, 3.4
endif #CC_SHORTVER, 4.x
endif #CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif #CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else #CC_NAME, gcc
ifeq ($(CC_NAME), suncc)
CFLAGS+= -g -xO5 -fast -native -xCC \
@ -1168,20 +1170,20 @@ endif #ARCH, sparc
#if ipaq/netwinder
ifeq ($(ARCH), arm)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=-marm -march=armv5t $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+= -ftree-vectorize -fno-strict-overflow
# not supported on arm: -minline-all-stringops
# not supported on arm: -minline-all-stringops
else
#if gcc 4.x+
ifeq ($(CC_SHORTVER), 4.x)
CFLAGS+= -ftree-vectorize
# not supported on arm: -minline-all-stringops
# not supported on arm: -minline-all-stringops
else
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)
@ -1189,41 +1191,41 @@ ifeq ($(CC_SHORTVER), 3.4)
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
CFLAGS+=
#-mcpu=athlon
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, arm
endif #ARCH, arm
#if armv6 cpu
#if armv6 cpu
ifeq ($(ARCH), arm6)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=-march=armv6 $(CC_OPT) -funroll-loops -fsigned-char \
$(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+= -ftree-vectorize -fno-strict-overflow
else
#if gcc 4.x+
@ -1236,25 +1238,25 @@ ifeq ($(CC_SHORTVER), 3.4)
else
#if gcc 3.0
ifeq ($(CC_SHORTVER), 3.0)
CFLAGS+=
CFLAGS+=
#-mcpu=athlon
else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
@ -1263,13 +1265,13 @@ endif #ARCH, arm6
#if mips (R3000)
ifeq ($(ARCH), mips)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=$(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+=-mfp32 -march=r3000 \
-ftree-vectorize -fno-strict-overflow
# not supported on mips: -minline-all-stringops
@ -1291,19 +1293,19 @@ else
ifeq ($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \
for better results)
CFLAGS+=-march=r3000
else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
@ -1312,13 +1314,13 @@ endif #ARCH, mips
#if >=mips2 (R4000, R5000, R6000 ....)
ifeq ($(ARCH), mips2)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS= -mips2 $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+=-ftree-vectorize -fno-strict-overflow
# not supported on mips: -minline-all-stringops
else
@ -1343,13 +1345,13 @@ else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
@ -1358,13 +1360,13 @@ endif #ARCH, mips2
#if >=mips64
ifeq ($(ARCH), mips64)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS= -mips64 $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+=-ftree-vectorize -fno-strict-overflow
# not supported on mips: -minline-all-stringops
@ -1390,13 +1392,13 @@ else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
@ -1405,19 +1407,19 @@ endif #ARCH, mips64
#if alpha
ifeq ($(ARCH), alpha)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS= $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 5.0+, 4.5 or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
CFLAGS+= -fno-strict-overflow
# not supported: -minline-all-stringops
else
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x)
CFLAGS+=
CFLAGS+=
# not supported: -minline-all-stringops
else
#if gcc 3.4+
@ -1436,28 +1438,28 @@ else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, alpha
endif #ARCH, alpha
#if ppc
ifeq ($(ARCH), ppc)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS=
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
$(call set_if_empty,CPUTYPE,powerpc)
ifeq ($(NOALTIVEC),)
CFLAGS += $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
@ -1493,28 +1495,28 @@ else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, ppc
endif #ARCH, ppc
#if ppc64
ifeq ($(ARCH), ppc64)
# if gcc
# if gcc
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS= $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
#if gcc 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+,$(CC_SHORTVER))))
#if gcc 6.0+, 5.0+, 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+ 5.0+ 6.0+,$(CC_SHORTVER))))
$(call set_if_empty,CPUTYPE,powerpc64)
CFLAGS+=-ftree-vectorize \
-fno-strict-overflow \
@ -1542,18 +1544,18 @@ else
#really old version
$(warning You are using an old and unsupported gcc \
version ($(CC_SHORTVER)), compile at your own risk!)
endif # CC_SHORTVER, 2.9x
endif # CC_SHORTVER, 3.0
endif # CC_SHORTVER, 3.4
endif # CC_SHORTVER, 4.x
endif # CC_SHORTVER, 5.0+, 4.5+ or 4.2+
endif # CC_SHORTVER, 6.0+, 5.0+, 4.5+ or 4.2+
else # CC_NAME, gcc
#other compilers
$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
endif #CC_NAME, gcc
endif #ARCH, ppc
endif #ARCH, ppc
CFLAGS+= $(CC_EXTRA_OPTS)
@ -1567,9 +1569,9 @@ ifeq ($(LDTYPE), solaris)
LIB_LDFLAGS:=-G $(LDFLAGS)
LIB_SONAME=-Wl,-h,
LD_RPATH=-Wl,-R,
else
else
#gcc and maybe others, => gnu ld
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
@ -1578,7 +1580,7 @@ endif
endif
ifeq ($(CC_NAME), icc)
#gcc and maybe others
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
@ -1598,10 +1600,10 @@ endif
ifeq ($(CC_NAME), clang)
LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE)
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath,
MOD_LDFLAGS:=-shared $(LDFLAGS)
LIB_LDFLAGS:=-shared $(LDFLAGS)
LIB_SONAME=-Wl,-soname,
LD_RPATH=-Wl,-rpath,
endif
LDFLAGS+= $(LD_EXTRA_OPTS)
@ -1724,8 +1726,8 @@ ifeq ($(OS), linux)
LIBS+=-lpthread
endif
endif
# check for >= 2.5.44
# check for >= 2.5.44
ifeq ($(shell [ $(OSREL_N) -ge 2005044 ] && echo has_epoll), has_epoll)
ifeq ($(NO_EPOLL),)
C_DEFS+=-DHAVE_EPOLL
@ -1824,7 +1826,7 @@ ifeq ($(CC_NAME), suncc)
endif
OLD_SOLARIS= $(shell echo "$(OSREL)" | \
sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
LIBS+= -L$(LOCALBASE)/lib -lxnet -lsocket -lnsl
LIBS+= -L$(LOCALBASE)/lib -lxnet -lsocket -lnsl
ifeq ($(OLD_SOLARIS), yes)
LIBS+=-lposix4
else
@ -1903,7 +1905,7 @@ ifeq ($(OS), openbsd)
# unfortunately pthread is needed for sigwait
LIBS= -lpthread
endif # if opensd
ifeq ($(OS), netbsd)
C_DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 \
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
@ -1924,7 +1926,7 @@ ifeq ($(OS), netbsd)
C_DEFS+=-DHAVE_SELECT
endif
YACC=yacc
LIBS=
LIBS=
endif
# OS X support, same as freebsd
@ -1951,7 +1953,7 @@ ifeq ($(OS), darwin)
C_DEFS+=-DHAVE_SELECT
endif
LDFLAGS= # darwin doesn't like -O2 or -E
# the modules uses symbols from ser => either
# the modules uses symbols from ser => either
# -flat_namespace -undefined_suppress or -bundle_loader ../../$(MAIN_NAME)
MOD_LDFLAGS:= -bundle -flat_namespace -undefined suppress
# for libs using symbols from ser (e.g srdb2, kcore a.s.o) we
@ -2015,7 +2017,7 @@ endif # ifeq ($(makefile_defs), 1)
# if incomplete or missing config.mak, or already exported vars, don't
# try to export/re-export
ifeq ($(makefile_defs),1)
ifeq ($(makefile_defs),1)
ifneq ($(exported_vars),1)

@ -2,6 +2,6 @@
* DO NOT EDIT IT
*/
#define REPO_VER "90be8b"
#define REPO_HASH "90be8b"
#define REPO_VER "892ad6"
#define REPO_HASH "892ad6"
#define REPO_STATE ""

@ -16,7 +16,7 @@
<!ENTITY kamcmd "kamcmd">
<!ENTITY kamailiohome "http://www.kamailio.org/">
<!ENTITY kamailiobugs "http://sip-router.org/tracker">
<!ENTITY kamailiobugs "https://github.com/kamailio/kamailio/issues">
<!ENTITY kamailiohelp "http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">
<!ENTITY kamailiousers "http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">
<!ENTITY kamailiodev "http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">

@ -184,11 +184,11 @@ void log_prefix_init(void);
#ifdef NO_LOG
# ifdef __SUNPRO_C
# define LOG__(facility, level, lname, prefix, fmt, ...)
# define LOG_(facility, level, prefix, fmt, ...)
# define LOG__(facility, level, lname, prefix, ...)
# define LOG_(facility, level, prefix, ...)
# define LOG(level, fmt, ...)
# define LOG_FC(facility, level, fmt, ...)
# define LOG_LN(level, lname, fmt, ...)
# define LOG_FC(facility, level, ...)
# define LOG_LN(level, lname, ...)
# else
# define LOG__(facility, level, lname, prefix, fmt, args...)
# define LOG_(facility, level, prefix, fmt, args...)
@ -212,78 +212,78 @@ void log_prefix_init(void);
# ifdef __SUNPRO_C
# define LOG__(facility, level, lname, prefix, fmt, ...) \
do { \
if (unlikely(get_debug_level(LOG_MNAME, LOG_MNAME_LEN) >= (level) && \
DPRINT_NON_CRIT)) { \
if (get_debug_level(LOG_MNAME, LOG_MNAME_LEN) >= (level) && \
DPRINT_NON_CRIT) { \
int __llevel; \
__llevel = ((level)<L_ALERT)?L_ALERT:(((level)>L_DBG)?L_DBG:level); \
DPRINT_CRIT_ENTER; \
if (likely(((level) >= L_ALERT) && ((level) <= L_DBG))){ \
if (unlikely(log_stderr)) { \
if (unlikely(log_color)) dprint_color(level); \
fprintf(stderr, "%2d(%d) %s: %s" fmt, \
process_no, my_pid(), \
(lname)?(lname):LOG_LEVEL2NAME(level), (prefix), \
__VA_ARGS__); \
if (unlikely(log_color)) dprint_color_reset(); \
if (unlikely(log_stderr)) { \
if (unlikely(log_color)) dprint_color(__llevel); \
if(unlikely(log_prefix_val)) { \
fprintf(stderr, "%.*s%2d(%d) %s: %s" fmt, \
log_prefix_val->len, log_prefix_val->s, \
process_no, my_pid(), \
(lname)?(lname):LOG_LEVEL2NAME(__llevel), \
(prefix) , __VA_ARGS__);\
} else { \
syslog(LOG2SYSLOG_LEVEL(level) | \
(((facility) != DEFAULT_FACILITY) ? \
(facility) : \
get_debug_facility(LOG_MNAME, LOG_MNAME_LEN)), \
"%s: %s" fmt, \
(lname)?(lname):LOG_LEVEL2NAME(level),\
(prefix), __VA_ARGS__); \
fprintf(stderr, "%2d(%d) %s: %s" fmt, \
process_no, my_pid(), \
(lname)?(lname):LOG_LEVEL2NAME(__llevel), \
(prefix) , __VA_ARGS__);\
} \
if (unlikely(log_color)) dprint_color_reset(); \
} else { \
if (log_stderr) { \
if (unlikely(log_color)) dprint_color(level); \
fprintf(stderr, "%2d(%d) %s" fmt, \
process_no, my_pid(), \
(prefix), __VA_ARGS__); \
if (unlikely(log_color)) dprint_color_reset(); \
if(unlikely(log_prefix_val)) { \
_km_log_func(LOG2SYSLOG_LEVEL(__llevel) |\
(((facility) != DEFAULT_FACILITY) ? \
(facility) : \
get_debug_facility(LOG_MNAME, LOG_MNAME_LEN)), \
"%.*s%s: %s" fmt,\
log_prefix_val->len, log_prefix_val->s, \
(lname)?(lname):LOG_LEVEL2NAME(__llevel),\
(prefix) , __VA_ARGS__); \
} else { \
if ((level)<L_ALERT) \
syslog(LOG2SYSLOG_LEVEL(L_ALERT) | \
(((facility) != DEFAULT_FACILITY) ? \
(facility) : \
get_debug_facility(LOG_MNAME, LOG_MNAME_LEN)), \
"%s" fmt, (prefix), __VA_ARGS__); \
else \
syslog(LOG2SYSLOG_LEVEL(L_DBG) | \
(((facility) != DEFAULT_FACILITY) ? \
(facility) : \
get_debug_facility(LOG_MNAME, LOG_MNAME_LEN)), \
"%s" fmt, (prefix), __VA_ARGS__); \
_km_log_func(LOG2SYSLOG_LEVEL(__llevel) |\
(((facility) != DEFAULT_FACILITY) ? \
(facility) : \
get_debug_facility(LOG_MNAME, LOG_MNAME_LEN)), \
"%s: %s" fmt,\
(lname)?(lname):LOG_LEVEL2NAME(__llevel),\
(prefix) , __VA_ARGS__); \
} \
} \
DPRINT_CRIT_EXIT; \
} \
} while(0)
# define LOG_(facility, level, lname, prefix, fmt, ...) \
LOG__(facility, level, NULL, prefix, fmt, __VA_ARGS__)
# define LOG_(facility, level, ...) \
LOG__(facility, level, NULL, __VA_ARGS__, NULL)
# ifdef LOG_FUNC_NAME
# define LOG(level, fmt, ...) \
# define LOG(level, ...) \
_LOG(level, __VA_ARGS__, NULL)
# define _LOG(level, fmt, ...) \
LOG_(DEFAULT_FACILITY, (level), LOC_INFO, "%s(): " fmt,\
_FUNC_NAME_, __VA_ARGS__)
# define LOG_FC(facility, level, fmt, ...) \
LOG_((facility), (level), LOC_INFO, "%s(): " fmt,\
_FUNC_NAME_, __VA_ARGS__)
# define LOG_FC(facility, level, ...) \
_LOG_FC(facility, level, __VA_ARGS__, NULL)
# define _LOG_FC(facility, level, fmt, ...) \
LOG_((facility), (level), LOC_INFO, "%s(): " fmt , _FUNC_NAME_, __VA_ARGS__)
# define LOG_LN(level, lname, fmt, ...) \
# define LOG_LN(level, lname, ...) \
_LOG_LN(level, lname, __VA_ARGS__, NULL)
# define _LOG_LN(level, lname, fmt, ...) \
LOG__(DEFAULT_FACILITY, (level), (lname), LOC_INFO, "%s(): " fmt,\
_FUNC_NAME_, __VA_ARGS__)
# else /* LOG_FUNC_NAME */
# define LOG(level, fmt, ...) \
LOG_(DEFAULT_FACILITY, (level), LOC_INFO, fmt, __VA_ARGS__)
# define LOG_FC(facility, level, fmt, ...) \
LOG_((facility), (level), LOC_INFO, fmt, __VA_ARGS__)
# define LOG_LN(level, lname, fmt, ...) \
LOG_(DEFAULT_FACILITY, (level), (lname), LOC_INFO, fmt, __VA_ARGS__)
# define LOG(level, ...) \
LOG_(DEFAULT_FACILITY, (level), LOC_INFO, __VA_ARGS__, NULL)
# define LOG_FC(facility, level, ...) \
LOG_((facility), (level), LOC_INFO, __VA_ARGS__, NULL)
# define LOG_LN(level, lname, ...) \
LOG__(DEFAULT_FACILITY, (level), (lname), LOC_INFO, __VA_ARGS__, NULL)
# endif /* LOG_FUNC_NAME */
@ -380,7 +380,7 @@ void log_prefix_init(void);
# define DBG(...)
# else
# define DBG(...) LOG(L_DBG, __VA_ARGS__)
# endif
# endif
/*@ } */
/* obsolete, do not use */

@ -43,6 +43,7 @@
#define _BSD_SOURCE 1 /* needed on linux to "fix" the effect
* of the above define on
* features.h/unistd.h syscall() */
#define _DEFAULT_SOURCE 1 /* _BSD_SOURCE is deprecated */
#else
#define _XOPEN_SOURCE_EXTENDED 1 /* solaris */
#endif
@ -52,8 +53,8 @@
#ifndef __OS_solaris
#undef _XOPEN_SOURCE
#undef _XOPEN_SOURCE_EXTENDED
#else
#undef _XOPEN_SOURCE_EXTENDED 1 /* solaris */
#else /* solaris */
#undef _XOPEN_SOURCE_EXTENDED
#endif
#include <limits.h>

@ -610,7 +610,7 @@ void sr_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
*context->buffer = 0x80;
}
/* Set the bit count: */
*(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
MEMCPY_BCOPY(&(context->buffer[SHA256_SHORT_BLOCK_LENGTH]), &(context->bitcount), sizeof(sha2_word64));
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
@ -927,8 +927,8 @@ void SHA512_Last(SHA512_CTX* context) {
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
MEMCPY_BCOPY(&(context->buffer[SHA512_SHORT_BLOCK_LENGTH+0]), &(context->bitcount[1]), sizeof(sha2_word64));
MEMCPY_BCOPY(&(context->buffer[SHA512_SHORT_BLOCK_LENGTH+8]), &(context->bitcount[0]), sizeof(sha2_word64));
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);

@ -262,19 +262,19 @@ static inline void fm_insert_free(struct fm_block* qm, struct fm_frag* frag)
* \param size fragement size
*/
static inline
#ifdef DBG_F_MALLOC
#ifdef DBG_F_MALLOC
void fm_split_frag(struct fm_block* qm, struct fm_frag* frag,
unsigned long size,
size_t size,
const char* file, const char* func, unsigned int line,
const char* mname)
#else
void fm_split_frag(struct fm_block* qm, struct fm_frag* frag,
unsigned long size)
size_t size)
#endif
{
unsigned long rest;
size_t rest;
struct fm_frag* n;
rest=frag->size-size;
#ifdef MEM_FRAG_AVOIDANCE
if ((rest> (FRAG_OVERHEAD+F_MALLOC_OPTIMIZE))||
@ -316,14 +316,15 @@ struct fm_block* fm_malloc_init(char* address, unsigned long size, int type)
char* end;
struct fm_block* qm;
unsigned long init_overhead;
/* make address and size multiple of 8*/
start=(char*)ROUNDUP((unsigned long) address);
DBG("fm_malloc_init: F_OPTIMIZE=%lu, /ROUNDTO=%lu\n",
F_MALLOC_OPTIMIZE, F_MALLOC_OPTIMIZE/ROUNDTO);
DBG("fm_malloc_init: F_HASH_SIZE=%lu, fm_block size=%lu\n",
F_HASH_SIZE, (long)sizeof(struct fm_block));
DBG("fm_malloc_init(%p, %lu), start=%p\n", address, size, start);
F_HASH_SIZE, (unsigned long)sizeof(struct fm_block));
DBG("fm_malloc_init(%p, %lu), start=%p\n", address, (unsigned long)size,
start);
if (size<start-address) return 0;
size-=(start-address);
@ -331,11 +332,12 @@ struct fm_block* fm_malloc_init(char* address, unsigned long size, int type)
size=ROUNDDOWN(size);
init_overhead=INIT_OVERHEAD;
if (size < init_overhead)
{
/* not enough mem to create our control structures !!!*/
LOG(L_ERR, "fm_malloc_init(%lu); No memory left to create control structures!\n",
(unsigned long)size);
return 0;
}
end=start+size;
@ -377,7 +379,7 @@ struct fm_block* fm_malloc_init(char* address, unsigned long size, int type)
* \param size memory allocation size
* \return address of allocated memory
*/
struct fm_frag* fm_search_defrag(struct fm_block* qm, unsigned long size)
struct fm_frag* fm_search_defrag(struct fm_block* qm, size_t size)
{
struct fm_frag* frag;
struct fm_frag* nxt;
@ -409,6 +411,9 @@ struct fm_frag* fm_search_defrag(struct fm_block* qm, unsigned long size)
frag = nxt;
}
LOG(L_ERR, "fm_search_defrag(%p, %lu); Free fragment not found!\n", qm,
(unsigned long)size);
return 0;
}
@ -421,10 +426,10 @@ struct fm_frag* fm_search_defrag(struct fm_block* qm, unsigned long size)
* \return address of allocated memory
*/
#ifdef DBG_F_MALLOC
void* fm_malloc(void* qmp, unsigned long size, const char* file,
void* fm_malloc(void* qmp, size_t size, const char* file,
const char* func, unsigned int line, const char* mname)
#else
void* fm_malloc(void* qmp, unsigned long size)
void* fm_malloc(void* qmp, size_t size)
#endif
{
struct fm_block* qm;
@ -435,8 +440,8 @@ void* fm_malloc(void* qmp, unsigned long size)
qm = (struct fm_block*)qmp;
#ifdef DBG_F_MALLOC
MDBG("fm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
line);
MDBG("fm_malloc(%p, %lu) called from %s: %s(%d)\n", qm,
(unsigned long)size, file, func, line);
#endif
/*malloc(0) should return a valid pointer according to specs*/
if(unlikely(size==0)) size=4;
@ -488,6 +493,14 @@ void* fm_malloc(void* qmp, unsigned long size)
if(frag) goto finish;
#ifdef DBG_F_MALLOC
LOG(L_ERR, "fm_malloc(%p, %lu) called from %s: %s(%d), module: %s; Free fragment not found!\n",
qm, (unsigned long)size, file, func, line, mname);
#else
LOG(L_ERR, "fm_malloc(%p, %lu); Free fragment not found!\n",
qm, (unsigned long)size);
#endif
return 0;
found:
@ -510,7 +523,7 @@ finish:
frag->func=func;
frag->mname=mname;
frag->line=line;
MDBG("fm_malloc(%p, %lu) returns address %p \n", qm, size,
MDBG("fm_malloc(%p, %lu) returns address %p \n", qm, (unsigned long)size,
(char*)frag+sizeof(struct fm_frag));
#endif
frag->check=ST_CHECK_PATTERN;
@ -625,25 +638,25 @@ void fm_free(void* qmp, void* p)
* \return reallocated memory block
*/
#ifdef DBG_F_MALLOC
void* fm_realloc(void* qmp, void* p, unsigned long size,
void* fm_realloc(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line,
const char *mname)
#else
void* fm_realloc(void* qmp, void* p, unsigned long size)
void* fm_realloc(void* qmp, void* p, size_t size)
#endif
{
struct fm_block* qm;
struct fm_frag *f;
unsigned long diff;
unsigned long orig_size;
size_t diff;
size_t orig_size;
struct fm_frag *n;
void *ptr;
qm = (struct fm_block*)qmp;
#ifdef DBG_F_MALLOC
MDBG("fm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
file, func, line);
MDBG("fm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p,
(unsigned long)size, file, func, line);
if ((p)&&(p>(void*)qm->last_frag || p<(void*)qm->first_frag)){
LOG(L_CRIT, "BUG: fm_free: bad pointer %p (out of memory block!) - "
"aborting\n", p);
@ -675,7 +688,8 @@ void* fm_realloc(void* qmp, void* p, unsigned long size)
if (f->size > size){
/* shrink */
#ifdef DBG_F_MALLOC
MDBG("fm_realloc: shrinking from %lu to %lu\n", f->size, size);
MDBG("fm_realloc: shrinking from %lu to %lu\n", f->size,
(unsigned long)size);
fm_split_frag(qm, f, size, file, "frag. from fm_realloc", line, mname);
#else
fm_split_frag(qm, f, size);
@ -683,7 +697,8 @@ void* fm_realloc(void* qmp, void* p, unsigned long size)
}else if (f->size<size){
/* grow */
#ifdef DBG_F_MALLOC
MDBG("fm_realloc: growing from %lu to %lu\n", f->size, size);
MDBG("fm_realloc: growing from %lu to %lu\n", f->size,
(unsigned long)size);
#endif
diff=size-f->size;
n=FRAG_NEXT(f);
@ -715,6 +730,14 @@ void* fm_realloc(void* qmp, void* p, unsigned long size)
if (ptr){
/* copy, need by libssl */
memcpy(ptr, p, orig_size);
} else {
#ifdef DBG_F_MALLOC
LOG(L_ERR, "fm_realloc(%p, %lu) called from %s: %s(%d), module: %s; fm_malloc() failed!\n",
qm, (unsigned long)size, file, func, line, mname);
#else
LOG(L_ERR, "fm_realloc(%p, %lu); fm_malloc() failed!\n",
qm, (unsigned long)size);
#endif
}
#ifdef DBG_F_MALLOC
fm_free(qm, p, file, func, line, mname);
@ -727,7 +750,7 @@ void* fm_realloc(void* qmp, void* p, unsigned long size)
/* do nothing */
#ifdef DBG_F_MALLOC
MDBG("fm_realloc: doing nothing, same size: %lu - %lu\n",
f->size, size);
f->size, (unsigned long)size);
#endif
}
#ifdef DBG_F_MALLOC
@ -1080,7 +1103,7 @@ static struct fm_block *_fm_shm_block = 0;
/*SHM wrappers to sync the access to memory block*/
#ifdef DBG_F_MALLOC
void* fm_shm_malloc(void* qmp, unsigned long size,
void* fm_shm_malloc(void* qmp, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1089,7 +1112,7 @@ void* fm_shm_malloc(void* qmp, unsigned long size,
shm_unlock();
return r;
}
void* fm_shm_realloc(void* qmp, void* p, unsigned long size,
void* fm_shm_realloc(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1098,7 +1121,7 @@ void* fm_shm_realloc(void* qmp, void* p, unsigned long size,
shm_unlock();
return r;
}
void* fm_shm_resize(void* qmp, void* p, unsigned long size,
void* fm_shm_resize(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1116,7 +1139,7 @@ void fm_shm_free(void* qmp, void* p, const char* file, const char* func,
shm_unlock();
}
#else
void* fm_shm_malloc(void* qmp, unsigned long size)
void* fm_shm_malloc(void* qmp, size_t size)
{
void *r;
shm_lock();
@ -1124,7 +1147,7 @@ void* fm_shm_malloc(void* qmp, unsigned long size)
shm_unlock();
return r;
}
void* fm_shm_realloc(void* qmp, void* p, unsigned long size)
void* fm_shm_realloc(void* qmp, void* p, size_t size)
{
void *r;
shm_lock();
@ -1132,7 +1155,7 @@ void* fm_shm_realloc(void* qmp, void* p, unsigned long size)
shm_unlock();
return r;
}
void* fm_shm_resize(void* qmp, void* p, unsigned long size)
void* fm_shm_resize(void* qmp, void* p, size_t size)
{
void *r;
shm_lock();

@ -134,11 +134,11 @@ struct fm_block* fm_malloc_init(char* address, unsigned long size, int type);
* \return address of allocated memory
*/
#ifdef DBG_F_MALLOC
void* fm_malloc(void* qmp, unsigned long size,
void* fm_malloc(void* qmp, size_t size,
const char* file, const char* func, unsigned int line,
const char* mname);
#else
void* fm_malloc(void* qmp, unsigned long size);
void* fm_malloc(void* qmp, size_t size);
#endif
@ -167,10 +167,10 @@ void fm_free(void* qmp, void* p);
* \return reallocated memory block
*/
#ifdef DBG_F_MALLOC
void* fm_realloc(void* qmp, void* p, unsigned long size,
void* fm_realloc(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char *mname);
#else
void* fm_realloc(void* qmp, void* p, unsigned long size);
void* fm_realloc(void* qmp, void* p, size_t size);
#endif

@ -20,27 +20,29 @@
#ifndef _sr_mem_api_
#define _sr_mem_api_
#include <string.h>
#include "src_loc.h"
#include "meminfo.h"
#include "memdbg.h"
#ifdef DBG_SR_MEMORY
typedef void* (*sr_malloc_f)(void* mbp, unsigned long size,
typedef void* (*sr_malloc_f)(void* mbp, size_t size,
const char* file, const char* func, unsigned int line, const char* mname);
typedef void (*sr_free_f)(void* mbp, void* p, const char* file, const char* func,
unsigned int line, const char* mname);
typedef void* (*sr_realloc_f)(void* mbp, void* p, unsigned long size,
typedef void* (*sr_realloc_f)(void* mbp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname);
typedef void* (*sr_resize_f)(void* mbp, void* p, unsigned long size,
typedef void* (*sr_resize_f)(void* mbp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname);
#else /*DBG_SR_MEMORY*/
typedef void* (*sr_malloc_f)(void* mbp, unsigned long size);
typedef void* (*sr_malloc_f)(void* mbp, size_t size);
typedef void (*sr_free_f)(void* mbp, void* p);
typedef void* (*sr_realloc_f)(void* mbp, void* p, unsigned long size);
typedef void* (*sr_resize_f)(void* mbp, void* p, unsigned long size);
typedef void* (*sr_realloc_f)(void* mbp, void* p, size_t size);
typedef void* (*sr_resize_f)(void* mbp, void* p, size_t size);
#endif /*DBG_SR_MEMORY*/

@ -188,8 +188,9 @@ struct qm_block* qm_malloc_init(char* address, unsigned long size, int type)
DBG("qm_malloc_init: QM_OPTIMIZE=%lu, /ROUNDTO=%lu\n",
QM_MALLOC_OPTIMIZE, QM_MALLOC_OPTIMIZE/ROUNDTO);
DBG("qm_malloc_init: QM_HASH_SIZE=%lu, qm_block size=%lu\n",
QM_HASH_SIZE, (long)sizeof(struct qm_block));
DBG("qm_malloc_init(%p, %lu), start=%p\n", address, size, start);
QM_HASH_SIZE, (unsigned long)sizeof(struct qm_block));
DBG("qm_malloc_init(%p, %lu), start=%p\n", address,
(unsigned long)size, start);
if (size<start-address) return 0;
size-=(start-address);
if (size <(MIN_FRAG_SIZE+FRAG_OVERHEAD)) return 0;
@ -197,11 +198,14 @@ struct qm_block* qm_malloc_init(char* address, unsigned long size, int type)
init_overhead=ROUNDUP(sizeof(struct qm_block))+sizeof(struct qm_frag)+
sizeof(struct qm_frag_end);
DBG("qm_malloc_init: size= %lu, init_overhead=%lu\n", size, init_overhead);
DBG("qm_malloc_init: size= %lu, init_overhead=%lu\n",
(unsigned long)size, init_overhead);
if (size < init_overhead)
{
/* not enough mem to create our control structures !!!*/
LOG(L_ERR, "qm_malloc_init(%lu); No memory left to create control structures!\n",
(unsigned long)size);
return 0;
}
end=start+size;
@ -262,12 +266,12 @@ static inline void qm_detach_free(struct qm_block* qm, struct qm_frag* frag)
#ifdef DBG_QM_MALLOC
static inline struct qm_frag* qm_find_free(struct qm_block* qm,
unsigned long size,
size_t size,
int *h,
unsigned int *count)
#else
static inline struct qm_frag* qm_find_free(struct qm_block* qm,
unsigned long size,
size_t size,
int* h)
#endif
{
@ -285,6 +289,8 @@ static inline struct qm_frag* qm_find_free(struct qm_block* qm,
/*try in a bigger bucket*/
}
/* not found */
LOG(L_ERR, "qm_find_free(%p, %lu); Free fragment not found!\n",
qm, (unsigned long)size);
return 0;
}
@ -293,13 +299,13 @@ static inline struct qm_frag* qm_find_free(struct qm_block* qm,
* new_size < size & rounded-up already!*/
static inline
#ifdef DBG_QM_MALLOC
int split_frag(struct qm_block* qm, struct qm_frag* f, unsigned long new_size,
int split_frag(struct qm_block* qm, struct qm_frag* f, size_t new_size,
const char* file, const char* func, unsigned int line, const char *mname)
#else
int split_frag(struct qm_block* qm, struct qm_frag* f, unsigned long new_size)
int split_frag(struct qm_block* qm, struct qm_frag* f, size_t new_size)
#endif
{
unsigned long rest;
size_t rest;
struct qm_frag* n;
struct qm_frag_end* end;
@ -341,11 +347,11 @@ int split_frag(struct qm_block* qm, struct qm_frag* f, unsigned long new_size)
#ifdef DBG_QM_MALLOC
void* qm_malloc(void* qmp, unsigned long size,
void* qm_malloc(void* qmp, size_t size,
const char* file, const char* func, unsigned int line,
const char *mname)
#else
void* qm_malloc(void* qmp, unsigned long size)
void* qm_malloc(void* qmp, size_t size)
#endif
{
struct qm_block* qm;
@ -359,8 +365,8 @@ void* qm_malloc(void* qmp, unsigned long size)
#ifdef DBG_QM_MALLOC
list_cntr = 0;
MDBG("qm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
line);
MDBG("qm_malloc(%p, %lu) called from %s: %s(%d)\n",
qm, (unsigned long)size, file, func, line);
#endif
/*malloc(0) should return a valid pointer according to specs*/
if(unlikely(size==0)) size=4;
@ -404,7 +410,8 @@ void* qm_malloc(void* qmp, unsigned long size)
FRAG_END(f)->check2=END_CHECK_PATTERN2;*/
MDBG("qm_malloc(%p, %lu) returns address %p frag. %p (size=%lu) on %d"
" -th hit\n",
qm, size, (char*)f+sizeof(struct qm_frag), f, f->size, list_cntr );
qm, (unsigned long)size, (char*)f+sizeof(struct qm_frag), f,
f->size, list_cntr);
#endif
#ifdef MALLOC_STATS
if(qm->type==MEM_TYPE_PKG) {
@ -413,6 +420,15 @@ void* qm_malloc(void* qmp, unsigned long size)
#endif
return (char*)f+sizeof(struct qm_frag);
}
#ifdef DBG_QM_MALLOC
LOG(L_ERR, "qm_malloc(%p, %lu) called from %s: %s(%d), module: %s; Free fragment not found!\n",
qm, (unsigned long)size, file, func, line, mname);
#else
LOG(L_ERR, "qm_malloc(%p, %lu); Free fragment not found!\n",
qm, (unsigned long)size);
#endif
return 0;
}
@ -427,7 +443,7 @@ void qm_free(void* qmp, void* p)
{
struct qm_block* qm;
struct qm_frag* f;
unsigned long size;
size_t size;
#ifdef MEM_JOIN_FREE
struct qm_frag* next;
struct qm_frag* prev;
@ -542,24 +558,25 @@ void qm_free(void* qmp, void* p)
#ifdef DBG_QM_MALLOC
void* qm_realloc(void* qmp, void* p, unsigned long size,
void* qm_realloc(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line,
const char *mname)
#else
void* qm_realloc(void* qmp, void* p, unsigned long size)
void* qm_realloc(void* qmp, void* p, size_t size)
#endif
{
struct qm_block* qm;
struct qm_frag* f;
unsigned long diff;
unsigned long orig_size;
size_t diff;
size_t orig_size;
struct qm_frag* n;
void* ptr;
qm = (struct qm_block*)qmp;
#ifdef DBG_QM_MALLOC
MDBG("qm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
MDBG("qm_realloc(%p, %p, %lu) called from %s: %s(%d)\n",
qm, p, (unsigned long)size,
file, func, line);
if ((p)&&(p>(void*)qm->last_frag_end || p<(void*)qm->first_frag)){
LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "
@ -600,7 +617,8 @@ void* qm_realloc(void* qmp, void* p, unsigned long size)
orig_size=f->size;
/* shrink */
#ifdef DBG_QM_MALLOC
MDBG("qm_realloc: shrinking from %lu to %lu\n", f->size, size);
MDBG("qm_realloc: shrinking from %lu to %lu\n",
f->size, (unsigned long)size);
if(split_frag(qm, f, size, file, "fragm. from qm_realloc", line, mname)!=0){
MDBG("qm_realloc : shrinked successful\n");
#else
@ -617,7 +635,8 @@ void* qm_realloc(void* qmp, void* p, unsigned long size)
}else if (f->size < size){
/* grow */
#ifdef DBG_QM_MALLOC
MDBG("qm_realloc: growing from %lu to %lu\n", f->size, size);
MDBG("qm_realloc: growing from %lu to %lu\n",
f->size, (unsigned long)size);
#endif
orig_size=f->size;
diff=size-f->size;
@ -653,6 +672,14 @@ void* qm_realloc(void* qmp, void* p, unsigned long size)
if (ptr){
/* copy, need by libssl */
memcpy(ptr, p, orig_size);
} else {
#ifdef DBG_QM_MALLOC
LOG(L_ERR, "qm_realloc(%p, %lu) called from %s: %s(%d), module: %s; qm_malloc() failed!\n",
qm, (unsigned long)size, file, func, line, mname);
#else
LOG(L_ERR, "qm_realloc(%p, %lu); qm_malloc() failed!\n",
qm, (unsigned long)size);
#endif
}
#ifdef DBG_QM_MALLOC
qm_free(qm, p, file, func, line, mname);
@ -665,7 +692,7 @@ void* qm_realloc(void* qmp, void* p, unsigned long size)
/* do nothing */
#ifdef DBG_QM_MALLOC
MDBG("qm_realloc: doing nothing, same size: %lu - %lu\n",
f->size, size);
f->size, (unsigned long)size);
#endif
}
#ifdef DBG_QM_MALLOC
@ -1045,7 +1072,7 @@ static struct qm_block *_qm_shm_block = 0;
/*SHM wrappers to sync the access to memory block*/
#ifdef DBG_QM_MALLOC
void* qm_shm_malloc(void* qmp, unsigned long size,
void* qm_shm_malloc(void* qmp, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1054,7 +1081,7 @@ void* qm_shm_malloc(void* qmp, unsigned long size,
shm_unlock();
return r;
}
void* qm_shm_realloc(void* qmp, void* p, unsigned long size,
void* qm_shm_realloc(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1063,7 +1090,7 @@ void* qm_shm_realloc(void* qmp, void* p, unsigned long size,
shm_unlock();
return r;
}
void* qm_shm_resize(void* qmp, void* p, unsigned long size,
void* qm_shm_resize(void* qmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1081,7 +1108,7 @@ void qm_shm_free(void* qmp, void* p, const char* file, const char* func,
shm_unlock();
}
#else
void* qm_shm_malloc(void* qmp, unsigned long size)
void* qm_shm_malloc(void* qmp, size_t size)
{
void *r;
shm_lock();
@ -1089,7 +1116,7 @@ void* qm_shm_malloc(void* qmp, unsigned long size)
shm_unlock();
return r;
}
void* qm_shm_realloc(void* qmp, void* p, unsigned long size)
void* qm_shm_realloc(void* qmp, void* p, size_t size)
{
void *r;
shm_lock();
@ -1097,7 +1124,7 @@ void* qm_shm_realloc(void* qmp, void* p, unsigned long size)
shm_unlock();
return r;
}
void* qm_shm_resize(void* qmp, void* p, unsigned long size)
void* qm_shm_resize(void* qmp, void* p, size_t size)
{
void *r;
shm_lock();

@ -128,10 +128,10 @@ struct qm_block{
struct qm_block* qm_malloc_init(char* address, unsigned long size, int type);
#ifdef DBG_QM_MALLOC
void* qm_malloc(void*, unsigned long size, const char* file,
void* qm_malloc(void*, size_t size, const char* file,
const char* func, unsigned int line, const char* mname);
#else
void* qm_malloc(void*, unsigned long size);
void* qm_malloc(void*, size_t size);
#endif
#ifdef DBG_QM_MALLOC
@ -141,10 +141,10 @@ void qm_free(void*, void* p, const char* file, const char* func,
void qm_free(void*, void* p);
#endif
#ifdef DBG_QM_MALLOC
void* qm_realloc(void*, void* p, unsigned long size,
void* qm_realloc(void*, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char *mname);
#else
void* qm_realloc(void*, void* p, unsigned long size);
void* qm_realloc(void*, void* p, size_t size);
#endif
void qm_check(struct qm_block*);

@ -1138,10 +1138,10 @@ void tlsf_meminfo(tlsf_t pool, struct mem_info *info)
info->total_size = control->total_size;
}
size_t tlsf_available(tlsf_t pool)
unsigned long tlsf_available(tlsf_t pool)
{
control_t* control = tlsf_cast(control_t*, pool);
return control->total_size - control->real_used;
return (unsigned long)(control->total_size - control->real_used);
}
void tlsf_status(tlsf_t pool)
@ -1370,7 +1370,7 @@ static tlsf_t _tlsf_shm_block = 0;
/*SHM wrappers to sync the access to memory block*/
#ifdef DBG_TLSF_MALLOC
void* tlsf_shm_malloc(void* tlsfmp, unsigned long size,
void* tlsf_shm_malloc(void* tlsfmp, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1379,7 +1379,7 @@ void* tlsf_shm_malloc(void* tlsfmp, unsigned long size,
shm_unlock();
return r;
}
void* tlsf_shm_realloc(void* tlsfmp, void* p, unsigned long size,
void* tlsf_shm_realloc(void* tlsfmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1388,7 +1388,7 @@ void* tlsf_shm_realloc(void* tlsfmp, void* p, unsigned long size,
shm_unlock();
return r;
}
void* tlsf_shm_resize(void* tlsfmp, void* p, unsigned long size,
void* tlsf_shm_resize(void* tlsfmp, void* p, size_t size,
const char* file, const char* func, unsigned int line, const char* mname)
{
void *r;
@ -1406,7 +1406,7 @@ void tlsf_shm_free(void* tlsfmp, void* p, const char* file, const char* func,
shm_unlock();
}
#else
void* tlsf_shm_malloc(void* tlsfmp, unsigned long size)
void* tlsf_shm_malloc(void* tlsfmp, size_t size)
{
void *r;
shm_lock();
@ -1414,7 +1414,7 @@ void* tlsf_shm_malloc(void* tlsfmp, unsigned long size)
shm_unlock();
return r;
}
void* tlsf_shm_realloc(void* tlsfmp, void* p, unsigned long size)
void* tlsf_shm_realloc(void* tlsfmp, void* p, size_t size)
{
void *r;
shm_lock();
@ -1422,7 +1422,7 @@ void* tlsf_shm_realloc(void* tlsfmp, void* p, unsigned long size)
shm_unlock();
return r;
}
void* tlsf_shm_resize(void* tlsfmp, void* p, unsigned long size)
void* tlsf_shm_resize(void* tlsfmp, void* p, size_t size)
{
void *r;
shm_lock();

@ -79,7 +79,7 @@ int tlsf_check_pool(pool_t pool);
void tlsf_meminfo(tlsf_t pool, struct mem_info *info);
void tlsf_status(tlsf_t pool);
void tlsf_sums(tlsf_t pool);
size_t tlsf_available(tlsf_t pool);
unsigned long tlsf_available(tlsf_t pool);
void tlsf_mod_get_stats(tlsf_t pool, void **root);
void tlsf_mod_free_stats(void *root);

@ -22,16 +22,18 @@ Bogdan-Andrei Iancu
Voice Sistem SRL
<bogdan@voice-system.ro>
Edited by
Sven Knoblich
1&1 Internet AG
<sven.knoblich@1und1.de>
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2004, 2006 Voice Sistem SRL
Copyright © 2004, 2006 Voice Sistem SRL
Copyright © 2011 1&1 Internet AG
Copyright © 2011 1&1 Internet AG
Revision History
Revision $Revision$ $Date$
__________________________________________________________________
@ -321,7 +323,7 @@ Chapter 1. Admin Guide
To account a transaction and to choose which set of backends to be
used, the script writer just has to set some flags (see the module
parameters section for flag definitions Section 6, "Parameters"). If
parameters section for flag definitions Section 6, “Parameters”). If
the accounting flag for a specific backend is set, the acc module will
then report on completed transaction. A typical usage of the module
takes no acc-specific script command -- the functionality binds
@ -333,7 +335,7 @@ Chapter 1. Admin Guide
The accounting module will log by default a fixed set of attributes for
the transaction - if you customize your accounting by adding more
information to be logged, please see the next chapter about extra
accounting - Section 2, "Extra accounting".
accounting - Section 2, “Extra accounting”.
The fixed minimal accounting information is:
* Request Method name
@ -360,7 +362,7 @@ Chapter 1. Admin Guide
gateway). However, CDR-base logging has the option to log existing
information from expired dialogs (the dlg_vars in cdr_extra) Please
see cdr_expired_dlg_enable parameter - Section 6.40,
"cdr_expired_dlg_enable (integer)".
“cdr_expired_dlg_enable (integer)”.
The SQL backend support is compiled in the module. For RADIUS and
DIAMETER you need to enable it by recompiling the module with properly
@ -572,21 +574,21 @@ Note
message is never transmitted. You can toggle on/off the generation of
CDR-based logging in such cases with only the dlg_vars showing by using
the cdr_expired_dlg_enable parameter - Section 6.40,
"cdr_expired_dlg_enable (integer)". Default behavior is not logging.
“cdr_expired_dlg_enable (integer)”. Default behavior is not logging.
4.2. CDR Extra
This section is similar to the "LOG accounting" part of Section 2,
"Extra accounting".
This section is similar to the “LOG accounting” part of Section 2,
“Extra accounting”.
4.2.1. Definitions and syntax
Selection of extra information is done similar to the transaction extra
Section 2.2, "Definitions and syntax".
Section 2.2, “Definitions and syntax”.
* cdr_extra = cdr_extra_definition (';'cdr_extra_definition)*
* cdr_extra_definition = cdr_log_name '=' pseudo_variable
See also Section 6.43, "cdr_extra (string)".
See also Section 6.43, “cdr_extra (string)”.
The full list of supported pseudo-variables in Sip-Router is available
at: http://sip-router.org/wiki/cookbooks/pseudo-variables/devel
@ -595,7 +597,7 @@ Note
4.3.1. Overview
As mentioned in Section 3, "Multi Call-Legs accounting", a leg
As mentioned in Section 3, “Multi Call-Legs accounting”, a leg
represents a parallel or forwarded call. In contrast to the normal
accounting the cdr logging uses dialogs instead of transaction to log
data. This may reduce the amount of information but it also make it
@ -606,7 +608,7 @@ Note
4.3.2. Configuration
When you route messages multiple times through your proxy (e.g. to
handle "call-forwardings") you have to use detect_spirals from the
handle “call-forwardings”) you have to use detect_spirals from the
dialog modules. Otherwise the proxy can't identify and reuse existing
dialogs.
@ -659,9 +661,9 @@ $dlg_var(callee) = $avp(callee); #callee='C'
listed modules must be loaded before this module):
* tm -- Transaction Manager
* a database module -- If SQL support is used.
* rr -- Record Route, if "detect_direction" module parameter is
* rr -- Record Route, if “detect_direction” module parameter is
enabled.
* dialog -- Dialog, if "cdr_enable" module parameter is enabled.
* dialog -- Dialog, if “cdr_enable” module parameter is enabled.
5.2. External Libraries or Applications
@ -841,7 +843,7 @@ modparam("acc", "acc_prepare_always", 1)
6.9. multi_leg_info (string)
Defines the AVP set to be used in per-call-leg accounting. See
Section 3, "Multi Call-Legs accounting" for a detailed description of
Section 3, “Multi Call-Legs accounting” for a detailed description of
the Multi Call-Legs accounting.
If empty, the multi-leg accounting support will be disabled.
@ -912,7 +914,7 @@ modparam("acc", "log_facility", "LOG_DAEMON")
6.14. log_extra (string)
Extra values to be logged. See section Section 2, "Extra accounting"
Extra values to be logged. See section Section 2, “Extra accounting”
for more details.
Default value is NULL.
@ -933,7 +935,7 @@ modparam("acc", "log_extra", "ua=$hdr(User-Agent);uuid=$avp(i:123)")
If the parameter is set to empty string, the RADIUS accounting support
will be disabled (even if compiled).
Default value is "NULL".
Default value is “NULL”.
Example 1.15. radius_config example
...
@ -978,7 +980,7 @@ modparam("acc", "service_type", 16)
6.19. radius_extra (string)
Extra values to be logged via RADIUS - RADIUS specific. See section
Section 2, "Extra accounting" for more details.
Section 2, “Extra accounting” for more details.
Default value is NULL.
@ -1016,7 +1018,7 @@ modparam("acc", "db_missed_flag", 3)
Table name of accounting successfull calls -- database specific. It can
contain config variables that will be evaluated at runtime.
Default value is "acc"
Default value is “acc”
Example 1.22. db_table_acc example
...
@ -1029,7 +1031,7 @@ modparam("acc", "db_table_acc", "acc_$time(year)_$time(mon)")
Table name for accounting missed calls -- database specific. It can
contain config variables that will be evaluated at runtime.
Default value is "missed_calls"
Default value is “missed_calls”
Example 1.23. db_table_missed_calls example
...
@ -1041,7 +1043,7 @@ modparam("acc", "db_table_missed_calls", "myMC_table")
SQL address -- database specific. If is set to NULL or emty string, the
SQL support is disabled.
Default value is "NULL" (SQL disabled).
Default value is “NULL” (SQL disabled).
Example 1.24. db_url example
...
@ -1053,7 +1055,7 @@ modparam("acc", "db_url", "mysql://user:password@localhost/kamailio")
Column name in accounting table to store the request's method name as
string.
Default value is "method".
Default value is “method”.
Example 1.25. acc_method_column example
...
@ -1064,7 +1066,7 @@ modparam("acc", "acc_method_column", "method")
Column name in accounting table to store the From header TAG parameter.
Default value is "from_tag".
Default value is “from_tag”.
Example 1.26. acc_from_tag_column example
...
@ -1075,7 +1077,7 @@ modparam("acc", "acc_from_tag_column", "from_tag")
Column name in accounting table to store the To header TAG parameter.
Default value is "to_tag".
Default value is “to_tag”.
Example 1.27. acc_to_tag_column example
...
@ -1086,7 +1088,7 @@ modparam("acc", "acc_to_tag_column", "to_tag")
Column name in accounting table to store the request's Callid value.
Default value is "callid".
Default value is “callid”.
Example 1.28. acc_callid_column example
...
@ -1098,7 +1100,7 @@ modparam("acc", "acc_callid_column", "callid")
Column name in accounting table to store the final reply's numric code
value in string format.
Default value is "sip_code".
Default value is “sip_code”.
Example 1.29. acc_sip_code_column example
...
@ -1110,7 +1112,7 @@ modparam("acc", "acc_sip_code_column", "sip_code")
Column name in accounting table to store the final reply's reason
phrase value.
Default value is "sip_reason".
Default value is “sip_reason”.
Example 1.30. acc_sip_reason_column example
...
@ -1122,7 +1124,7 @@ modparam("acc", "acc_sip_reason_column", "sip_reason")
Column name in accounting table to store the time stamp of the
transaction completion in date-time format.
Default value is "time".
Default value is “time”.
Example 1.31. acc_time_column example
...
@ -1132,7 +1134,7 @@ modparam("acc", "acc_time_column", "time")
6.32. db_extra (string)
Extra values to be logged into database - DB specific. See section
Section 2, "Extra accounting" for more details.
Section 2, “Extra accounting” for more details.
Default value is NULL.
@ -1189,7 +1191,7 @@ modparam("acc", "diameter_missed_flag", 3)
Hostname of the machine where the DIAMETER Client is running --
DIAMETER specific.
Default value is "localhost".
Default value is “localhost”.
Example 1.36. diameter_client_host example
...
@ -1211,7 +1213,7 @@ modparam("acc", "diameter_client_port", 3000)
6.38. diameter_extra (string)
Extra values to be logged via DIAMETER - DIAMETER specific. See section
Section 2, "Extra accounting" for more details.
Section 2, “Extra accounting” for more details.
Default value is NULL.
@ -1270,7 +1272,7 @@ modparam("acc", "cdr_facility", "LOG_DAEMON")
6.43. cdr_extra (string)
Set of pseudo-variables defining custom CDR fields. See Section 4.2,
"CDR Extra" for more details.
“CDR Extra” for more details.
Default value is NULL.
@ -1446,7 +1448,7 @@ modparam("acc", "cdr_on_failed", 0)
7.3. acc_rad_request(comment)
7.4. acc_diam_request(comment)
7.1. acc_log_request(comment)
7.1. acc_log_request(comment)
acc_request reports on a request, for example, it can be used to report
on missed calls to off-line users who are replied 404 - Not Found. To
@ -1467,10 +1469,10 @@ $avp(reason) = "Not found";
acc_log_request("$var(code) Error: $avp(reason)");
...
7.2. acc_db_request(comment, table)
7.2. acc_db_request(comment, table)
Like acc_log_request, acc_db_request reports on a request. The report
is sent to database at "db_url", in the table referred to in the second
is sent to database at “db_url”, in the table referred to in the second
action parameter.
Meaning of the parameters is as follows:
@ -1488,10 +1490,10 @@ acc_db_request("Some comment", "acc_$time(year)_$time(mon)");
acc_db_request("$var(code) Error: $avp(reason)", "SomeTable");
...
7.3. acc_rad_request(comment)
7.3. acc_rad_request(comment)
Like acc_log_request, acc_rad_request reports on a request. It reports
to radius server as configured in "radius_config".
to radius server as configured in “radius_config”.
Meaning of the parameters is as follows:
* comment - Comment to be appended. The string can contain any number
@ -1505,7 +1507,7 @@ acc_rad_request("Some comment");
acc_rad_request("$var(code) Error: $avp(reason)");
...
7.4. acc_diam_request(comment)
7.4. acc_diam_request(comment)
Like acc_log_request, acc_diam_request reports on a request. It reports
to the configured Diameter server.
@ -1533,55 +1535,55 @@ Chapter 2. Frequently Asked Questions
2.1.
What happend with old log_fmt parameter
What happend with old log_fmt parameter
The parameter became obsolete with the restructure of the data logged
by ACC module (refer to the Overview chapter). For similar behaviour
you can use the extra accouting (see the coresponding chapter).
The parameter became obsolete with the restructure of the data logged
by ACC module (refer to the Overview chapter). For similar behaviour
you can use the extra accouting (see the coresponding chapter).
2.2.
What happend with old multi_leg_enabled parameter
What happend with old multi_leg_enabled parameter
The parameter becaome obsolete by the addition of the new
multi_leg_info parameter. The multi-leg accouting is automatically
enabled when multi_leg_info is defined.
The parameter becaome obsolete by the addition of the new
multi_leg_info parameter. The multi-leg accouting is automatically
enabled when multi_leg_info is defined.
2.3.
What happend with old src_leg_avp_id and dst_leg_avp_id parameters
What happend with old src_leg_avp_id and dst_leg_avp_id parameters
The parameter was replaced by the more generic new parameter
multi_leg_info. This allows logging (per-leg) of more information than
just dst and src.
The parameter was replaced by the more generic new parameter
multi_leg_info. This allows logging (per-leg) of more information than
just dst and src.
2.4.
Where can I find more about Kamailio?
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
Take a look at http://www.kamailio.org/.
2.5.
Where can I post a question about this module?
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
2.6.
How can I report a bug?
How can I report a bug?
Please follow the guidelines provided at:
http://sip-router.org/tracker.
Please follow the guidelines provided at:
https://github.com/kamailio/kamailio/issues.

@ -232,6 +232,7 @@ int acc_log_request( struct sip_msg *rq)
int o;
int i;
struct tm *t;
double dtime;
/* get default values */
m = core2strar( rq, val_arr, int_arr, type_arr);
@ -290,12 +291,11 @@ int acc_log_request( struct sip_msg *rq)
acc_time_exten.s, (unsigned int)acc_env.tv.tv_usec,
log_msg);
} else if(acc_time_mode==2) {
dtime = (double)acc_env.tv.tv_usec;
dtime = (dtime / 1000000) + (double)acc_env.tv.tv_sec;
LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%.3f%s",
acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts,
acc_time_attr.s,
(((double)(acc_env.tv.tv_sec * 1000)
+ (acc_env.tv.tv_usec / 1000)) / 1000),
log_msg);
acc_time_attr.s, dtime, log_msg);
} else if(acc_time_mode==3 || acc_time_mode==4) {
if(acc_time_mode==3) {
t = localtime(&acc_env.ts);
@ -443,6 +443,7 @@ int acc_db_request( struct sip_msg *rq)
int i;
int o;
struct tm *t;
double dtime;
/* formated database columns */
m = core2strar( rq, val_arr, int_arr, type_arr );
@ -458,8 +459,9 @@ int acc_db_request( struct sip_msg *rq)
VAL_INT(db_vals+(m++)) = (int)acc_env.tv.tv_usec;
i++;
} else if(acc_time_mode==2) {
VAL_DOUBLE(db_vals+(m++)) = ((double)(acc_env.tv.tv_sec * 1000)
+ (acc_env.tv.tv_usec / 1000)) / 1000;
dtime = (double)acc_env.tv.tv_usec;
dtime = (dtime / 1000000) + (double)acc_env.tv.tv_sec;
VAL_DOUBLE(db_vals+(m++)) = dtime;
i++;
} else if(acc_time_mode==3 || acc_time_mode==4) {
if(acc_time_mode==3) {

@ -16,7 +16,7 @@ Daniel-Constantin Mierla
asipto.com
<miconda@gmail.com>
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2002, 2003 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -128,7 +128,7 @@ Chapter 1. Admin Guide
If the parameter is set to empty string, the RADIUS accounting support
will be disabled (even if compiled).
Default value is "NULL".
Default value is “NULL”.
Example 1.1. radius_config example
...
@ -204,11 +204,11 @@ modparam("acc_radius", "rad_time_mode", 1)
4.1. acc_rad_request(comment)
4.1. acc_rad_request(comment)
4.1. acc_rad_request(comment)
Like acc_log_request of acc module, acc_rad_request reports on a SIP
request event. It reports to radius server as configured in
"radius_config".
“radius_config”.
Meaning of the parameters is as follows:
* comment - Comment to be appended.

@ -1,5 +1,5 @@
/*
* Accounting module
* Radius Accounting module
*
* Copyright (C) 2001-2003 FhG Fokus
*

@ -1,6 +1,4 @@
/*
* $Id$
*
* RADIUS Accounting module
*
* Copyright (C) 2001-2003 FhG Fokus
@ -21,8 +19,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* History:
* ---------
*/
/*! \file

@ -11,20 +11,20 @@
<!-- Acc Module User's Guide -->
<chapter>
<title>&adminguide;</title>
<section>
<title>Overview</title>
<para>
ACC_RADIUS module is used to account transaction information to
ACC_RADIUS module is used to account transaction information to
<acronym>RADIUS</acronym> server. It binds to ACC module API and uses the
same accounting mechanisms as for other backends.
</para>
<para>
Therefore you need this module just to send accounting data to a
RADIUS server - for more documentation regarding accounting, see the ACC
readme.
readme.
</para>
</section>
@ -33,7 +33,7 @@
<section>
<title>&kamailio; Modules</title>
<para>
The module depends on the following modules (in the other words
The module depends on the following modules (in the other words
the listed modules must be loaded before this module):
<itemizedlist>
<listitem>
@ -45,7 +45,7 @@
<section>
<title>External Libraries or Applications</title>
<para>
The following libraries or applications must be installed
The following libraries or applications must be installed
before running &kamailio; with this module loaded:
</para>
<itemizedlist>
@ -61,8 +61,8 @@
</listitem>
<listitem>
<para>
<emphasis>freeradius-client</emphasis> library can be used after
setting FREERADIUS variable in source code with
<emphasis>freeradius-client</emphasis> library can be used after
setting FREERADIUS variable in source code with
<emphasis>'export FREERADIUS=1'</emphasis> before compile.
</para>
</listitem>
@ -79,14 +79,14 @@
<section id="ACC-param-id">
<title>Parameters</title>
<section>
<section id="acc_radius.p.radius_config">
<title><varname>radius_config</varname> (string)</title>
<para>
<emphasis>This parameter is radius specific.</emphasis> Path to
radius client configuration file, set the referred config file
correctly and specify there address of server, shared secret
<emphasis>This parameter is radius specific.</emphasis> Path to
radius client configuration file, set the referred config file
correctly and specify there address of server, shared secret
(should equal that in /usr/local/etc/raddb/clients for
freeRadius servers) and dictionary, see etc for an example of
freeRadius servers) and dictionary, see etc for an example of
config file and dictionary.
</para>
<para>
@ -105,10 +105,10 @@ modparam("acc_radius", "radius_config", "/etc/radiusclient/radiusclient.conf")
</programlisting>
</example>
</section>
<section>
<section id="acc_radius.p.radius_flag">
<title><varname>radius_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account a
Request flag which needs to be set to account a
transaction -- RADIUS specific.
</para>
<para>
@ -123,10 +123,10 @@ modparam("acc_radius", "radius_flag", 2)
</programlisting>
</example>
</section>
<section>
<section id="acc_radius.p.radius_missed_flag">
<title><varname>radius_missed_flag</varname> (integer)</title>
<para>
Request flag which needs to be set to account missed
Request flag which needs to be set to account missed
calls -- RADIUS specific.
</para>
<para>
@ -141,7 +141,7 @@ modparam("acc_radius", "radius_missed_flag", 3)
</programlisting>
</example>
</section>
<section>
<section id="acc_radius.p.service_type">
<title><varname>service_type</varname> (integer)</title>
<para>
Radius service type used for accounting.
@ -158,7 +158,7 @@ modparam("acc_radius", "service_type", 16)
</programlisting>
</example>
</section>
<section>
<section id="acc_radius.p.radius_extra">
<title><varname>radius_extra</varname> (string)</title>
<para>
Extra values to be logged via RADIUS - RADIUS specific.
@ -175,10 +175,10 @@ modparam("acc_radius", "radius_extra", "via=$hdr(Via[*]); email=$avp(s:email)")
</programlisting>
</example>
</section>
<section>
<section id="acc_radius.p.rad_time_mod">
<title><varname>rad_time_mode</varname>(integer)</title>
<para>
Radius Event-Timestamp for accounting.
Radius Event-Timestamp for accounting.
</para>
<para>
Values can be:
@ -194,8 +194,8 @@ modparam("acc_radius", "radius_extra", "via=$hdr(Via[*]); email=$avp(s:email)")
both radius server and client
(For example: 1445590624.377372) </para>
</listitem>
</itemizedlist>
</itemizedlist>
<para>
Default value is 0 (Unix timestamp).
</para>
@ -212,14 +212,14 @@ modparam("acc_radius", "rad_time_mode", 1)
<section>
<title>Functions</title>
<section>
<section id="acc_radius.f.acc_rad_request">
<title>
<function moreinfo="none">acc_rad_request(comment)</function>
</title>
<para>
Like <function moreinfo="none">acc_log_request</function> of acc module,
<function moreinfo="none">acc_rad_request</function> reports on
a SIP request event. It reports to radius server as configured in
Like <function moreinfo="none">acc_log_request</function> of acc module,
<function moreinfo="none">acc_rad_request</function> reports on
a SIP request event. It reports to radius server as configured in
<quote>radius_config</quote>.
</para>
<para>

@ -14,9 +14,9 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2005 Voice Sistem SRL
Copyright © 2005 Voice Sistem SRL
Copyright © 2008 asipto.com
Copyright © 2008 asipto.com
__________________________________________________________________
Table of Contents
@ -126,7 +126,7 @@ Chapter 1. Admin Guide
Database URL.
Default value is "mysql://openserro:openserro@localhost/openser".
Default value is “mysql://kamailioro:kamailioro@localhost/kamailio”.
Example 1.1. Set db_url parameter
...
@ -137,7 +137,7 @@ modparam("alias_db", "db_url", "dbdriver://username:password@dbhost/dbname")
Name of the column storing username.
Default value is "username".
Default value is “username”.
Example 1.2. Set user_column parameter
...
@ -148,7 +148,7 @@ modparam("alias_db", "user_column", "susername")
Name of the column storing user's domain.
Default value is "domain".
Default value is “domain”.
Example 1.3. Set domain_column parameter
...
@ -159,7 +159,7 @@ modparam("alias_db", "domain_column", "sdomain")
Name of the column storing alias username.
Default value is "alias_username".
Default value is “alias_username”.
Example 1.4. Set alias_user_column parameter
...
@ -170,7 +170,7 @@ modparam("alias_db", "alias_user_column", "auser")
Name of the column storing alias domain.
Default value is "alias_domain".
Default value is “alias_domain”.
Example 1.5. Set alias_domain_column parameter
...
@ -183,7 +183,7 @@ modparam("alias_db", "alias_domain_column", "adomain")
for alias. If set to 0, the domain from R-URI is not used, if set to 1
the domain from R-URI is used.
Default value is "0".
Default value is “0”.
Example 1.6. Set use_domain parameter
...
@ -195,7 +195,7 @@ modparam("alias_db", "use_domain", 1)
Specifies the prefix to be stripped from the domain in R-URI before
doing the search.
Default value is "NULL".
Default value is “NULL”.
Example 1.7. Set domain_prefix parameter
...
@ -207,7 +207,7 @@ modparam("alias_db", "domain_prefix", "sip.")
If the alias resolves to many SIP IDs, the first is replacing the
R-URI, the rest are added as branches.
Default value is "0" (0 - don't add branches; 1 - add branches).
Default value is “0” (0 - don't add branches; 1 - add branches).
Example 1.8. Set append_branches parameter
...
@ -218,7 +218,7 @@ modparam("alias_db", "append_branches", 1)
4.1. alias_db_lookup(table_name)
4.1. alias_db_lookup(table_name)
4.1. alias_db_lookup(table_name)
The function takes the R-URI and search to see whether it is an alias
or not. If it is an alias for a local user, the R-URI is replaced with

@ -1,6 +1,8 @@
#
#
# WARNING: do not run this directly, it should be run by the master Makefile
# to generate readme file on a system without java, use DOCBUILD=yes in make command
include ../../Makefile.defs
auto_gen=
NAME=app_java.so
@ -24,7 +26,9 @@ LIBS += $(shell pkg-config libgcj --libs) -L$(JAVA_HOME)/lib -ljvm
# At this point I don't see any universal method as explicit setting this variable at the compile phase.
# -- ez
ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h" -a -f "$(JAVA_HOME)/lib/libjvm.so" ] && echo 1 || echo 0),0)
$(error Can't locate Java Development Kit. You have to specify environment JAVA_HOME to build app_java)
ifneq ($(DOCBUILD),yes)
$(error Cannot locate Java Development Kit. You have to specify environment JAVA_HOME to build app_java)
endif
endif
ifeq ($(OS), freebsd)

@ -6,7 +6,7 @@ Edited by
Konstantin Mosesov
Copyright © 2013, 2014 Konstantin Mosesov
Copyright © 2013, 2014 Konstantin Mosesov
__________________________________________________________________
Table of Contents
@ -174,7 +174,7 @@ Chapter 1. Admin Guide
The class name should have the same compiled file name. If the value is
"Kamailio", then the compiled file should be named as "Kamailio.class".
Default value is "Kamailio".
Default value is “Kamailio”.
Example 1.1. Set class_name parameter
...
@ -185,7 +185,7 @@ modparam("app_java", "class_name", "Kamailio")
TBD.
Default value is "child_init".
Default value is “child_init”.
Example 1.2. Set child_init_method parameter
...
@ -196,7 +196,7 @@ modparam("app_java", "child_init_method", "my_mod_init")
Java options for Java Virtual Machine. For more info read java docs
Default value is "-Djava.compiler=NONE".
Default value is “-Djava.compiler=NONE”.
Example 1.3. Set java_options parameter
...
@ -230,10 +230,10 @@ modparam("app_java", "java_options", "-Xdebug -verbose:gc,class,jni
4.4. force_cmd_exec (int)
This parameter forces execution a kamailio comnmand with java native
method "KamExec". # Note: this is an untested yet feature, may cause
method “KamExec”. # Note: this is an untested yet feature, may cause
(but may not) a memory leaks if used from embedded languages.
Default value is "0 (off)".
Default value is “0 (off)”.
Example 1.7. Set force_cmd_exec parameter
...
@ -255,9 +255,9 @@ modparam("app_java", "force_cmd_exec", 1)
5.5. java_s_staticmethod_exec(method, method_signature, [param1[,
param2[, ...]]])
5.1. Common requirements
5.1. Common requirements
Each function has a required parameter "method_signature". For more
Each function has a required parameter “method_signature”. For more
info see Determine the signature of a method. Signature represents the
variable type. The mapping between the Java type and C type is
Type Chararacter

@ -230,7 +230,7 @@ jobject *fill_sipmsg_object(JNIEnv *env, struct sip_msg *msg)
LM_ERR("%s: Can't find symbol org.siprouter.SipMsg.add_to_branch_s\n", APP_NAME);
return NULL;
}
jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0 || msg->add_to_branch_s == NULL) ? "" : strdup(msg->add_to_branch_s));
jStrParam = (*env)->NewStringUTF(env, (msg->add_to_branch_len <= 0) ? "" : strdup(msg->add_to_branch_s));
(*env)->SetObjectField(env, SipMsgInstance, fid, jStrParam);
if ((*env)->ExceptionCheck(env))
{

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
__________________________________________________________________
Table of Contents
@ -130,7 +130,7 @@ Chapter 1. Admin Guide
use lua_run(function, params) to execute a function from the script at
runtime.
Default value is "null".
Default value is “null”.
Example 1.1. Set load parameter
...
@ -174,7 +174,7 @@ modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/myscript.lua")
Note that 'sr', 'sr.hdr' and 'sr.pv' modules are always registered to
Lua.
Default value is "null".
Default value is “null”.
Example 1.2. Set register parameter
...
@ -186,7 +186,7 @@ modparam("app_lua", "register", "sl")
If reload is 1 enables the ability to reload the scripts using the RPC
app_lua.reload command.
Default value is "0 (off)".
Default value is “0 (off)”.
Example 1.3. Set reload parameter
...
@ -200,7 +200,7 @@ modparam("app_lua", "reload", 1)
4.3. lua_run(function, params)
4.4. lua_runstring(script)
4.1. lua_dofile(path)
4.1. lua_dofile(path)
Execute the Lua script stored in 'path'. The parameter can be a string
with pseudo-variables evaluated at runtime.
@ -210,7 +210,7 @@ modparam("app_lua", "reload", 1)
lua_dofile("/usr/local/etc/kamailio/lua/myscript.lua");
...
4.2. lua_dostring(script)
4.2. lua_dostring(script)
Execute the Lua script stored in parameter. The parameter can be a
string with pseudo-variables.
@ -223,7 +223,7 @@ if(!lua_dostring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
}
...
4.3. lua_run(function, params)
4.3. lua_run(function, params)
Execute the Lua function 'func' giving params as parameters. There can
be up to 3 string parameters. The function must exist in the script
@ -240,7 +240,7 @@ if(!lua_run("sr_append_fu_to_reply"))
lua_run("lua_funcx", "$rU", "2");
...
4.4. lua_runstring(script)
4.4. lua_runstring(script)
Execute the Lua script stored in parameter. The parameter can be a
string with pseudo-variables. The script is executed in Lua context
@ -259,7 +259,7 @@ if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
5.1. app_lua.list
5.2. app_lua.reload
5.1. app_lua.list
5.1. app_lua.list
Lists the id and path for every script loaded by the load parameter.
@ -270,7 +270,7 @@ if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
Example:
kamcmd app_lua.lists
5.2. app_lua.reload
5.2. app_lua.reload
Marks the need to reload the selected script. The actual reload is done
by every working process when the next call to lua_run function is

@ -16,7 +16,7 @@ Alex Balashov
<abalashov@evaristesys.com>
Copyright © 2012 Daniel-Constantin Mierla (asipto.com)
Copyright © 2012 Daniel-Constantin Mierla (asipto.com)
__________________________________________________________________
Table of Contents
@ -113,7 +113,7 @@ Chapter 1. Admin Guide
Set the path to the Mono assembly to be loaded at startup. You can use
mono_run(param) to execute the assembly at runtime.
Default value is "null".
Default value is “null”.
Example 1.1. Set load parameter
...
@ -125,7 +125,7 @@ modparam("app_mono", "load", "/usr/local/etc/kamailio/mono/myscript.exe")
4.1. mono_exec(path [, param])
4.2. mono_run([param])
4.1. mono_exec(path [, param])
4.1. mono_exec(path [, param])
Execute the managed code assembly stored in 'path'. The path can be a
string with pseudo-variables evaluated at runtime. A second parameter
@ -140,7 +140,7 @@ modparam("app_mono", "load", "/usr/local/etc/kamailio/mono/myscript.exe")
mono_exec("/usr/local/etc/kamailio/mono/myscript.exe");
...
4.2. mono_run([param])
4.2. mono_run([param])
Execute the assembly specified by 'load' module parameter. The assembly
is loaded at startup, so changes to it will be effective only after

@ -8,7 +8,7 @@ Edited by
Bastian Friedrich
Copyright © 2007 Collax GmbH
Copyright © 2007 Collax GmbH
__________________________________________________________________
Table of Contents
@ -330,7 +330,7 @@ if (perl_exec("ldap_alias")) {
* IPC::Shareable perl module from CPAN
Although SuSE delivers a lot of perl modules, others may have to be
fetched from CPAN. Consider using the program "cpan2rpm" - which, in
fetched from CPAN. Consider using the program “cpan2rpm” - which, in
turn, is available on CPAN. It creates RPM files from CPAN.
5. Parameters
@ -343,7 +343,7 @@ if (perl_exec("ldap_alias")) {
5.1. filename (string)
This is the file name of your script. This may be set once only, but it
may include an arbitary number of functions and "use" as many Perl
may include an arbitary number of functions and “use” as many Perl
module as necessary.
Must not be empty!
@ -357,9 +357,9 @@ modparam("app_perl", "filename", "/home/test/kamailio/myperl.pl")
The path to the Perl modules included (Kamailio.pm et.al). It is not
absolutely crucial to set this path, as you may install the Modules in
Perl's standard path, or update the "%INC" variable from within your
Perl's standard path, or update the “%INC” variable from within your
script. Using this module parameter is the standard behavior, though.
Multiple paths may be specified by separating them with a ":"
Multiple paths may be specified by separating them with a “:”
character. The maximum is 10 paths.
Example 1.2. Set modpath parameter
@ -404,7 +404,7 @@ modparam("app_perl", "perl_destroy_func", "my_perl_destroy")
6.1. perl_exec_simple(func, [param])
6.2. perl_exec(func, [param])
6.1. perl_exec_simple(func, [param])
6.1. perl_exec_simple(func, [param])
Calls a perl function without passing it the current SIP message. May
be used for very simple simple requests that do not have to fiddle with
@ -424,7 +424,7 @@ if (method=="INVITE") {
};
...
6.2. perl_exec(func, [param])
6.2. perl_exec(func, [param])
Calls a perl function with passing it the current SIP message. The SIP
message is reflected by a Perl module that gives you access to the
@ -448,7 +448,7 @@ if (perl_exec("ldapalias")) {
7.1. app_perl.set_reset_cycles
7.2. app_perl.get_reset_cycles
7.1. app_perl.set_reset_cycles
7.1. app_perl.set_reset_cycles
Set the value of the reset_cycle. The command has one integer
parameter.
@ -458,7 +458,7 @@ if (perl_exec("ldapalias")) {
kamcmd app_perl.set_reset_cycles 20000
...
7.2. app_perl.get_reset_cycles
7.2. app_perl.get_reset_cycles
Return the value of the reset_cycle.
@ -678,7 +678,7 @@ Kamailio::log(L_INFO, "foobar");
my $ruri = $m->getRURI();
getRURI returns a string. See "getParsedRURI()" below how to receive a
getRURI returns a string. See “getParsedRURI()” below how to receive a
parsed structure.
This function is valid in request messages only.
@ -1521,11 +1521,11 @@ Chapter 3. Perl samples
1.1.9. phonenumbers.pl
1.1.10. pseudovars.pl
There are a number of example scripts in the "samples/". They are
There are a number of example scripts in the “samples/”. They are
documented well. Read them, it will explain a lot to you :)
If you want to use any of these scripts directly in your
implementation, you can use Perl's "require" mechanism to import them
implementation, you can use Perl's “require” mechanism to import them
(just remember that you need to use quotes when require'ing .pl files).
1.1. Script descriptions
@ -1562,7 +1562,7 @@ Chapter 3. Perl samples
functions from within perl, and the different types of functions you
can offer for Kamailio access.
"exportedfuncs" simply demonstrates that you can use the moduleFunction
“exportedfuncs” simply demonstrates that you can use the moduleFunction
method to call functions offered by other modules. The results are
equivalent to calling these functions from your config file. In the
demonstrated case, telephone calls with a destination number beginning
@ -1572,13 +1572,13 @@ Chapter 3. Perl samples
Please note that the moduleFunction method is not fully available in
Kamailio 1.2. See the method's documentation for details.
"paramfunc" shows that you can pass arbitrary strings to perl
“paramfunc” shows that you can pass arbitrary strings to perl
functions. Do with them whatever you want :)
"autotest" demonstrates that unknown functions in Kamailio::Message
“autotest” demonstrates that unknown functions in Kamailio::Message
objects are automatically transformed into calls to module functions.
The "diefunc"s show that dying perl scripts - by "manual" dying, or
The “diefunc”s show that dying perl scripts - by "manual" dying, or
because of script errors - are handled by the Kamailio package. The
error message is logged through Kamailio's logging mechanism. Please
note that this only works correctly if you do NOT overwrite the default
@ -1590,22 +1590,22 @@ Chapter 3. Perl samples
processing SIP messages. This sample script demonstrates access to
header names and values within two sample functions.
"headernames" extracts all header names and logs their names.
“headernames” extracts all header names and logs their names.
"someheaders" logs the contents of the two headers, "To" and
"WWW-Contact". As you can see, headers that occur more than once are
“someheaders” logs the contents of the two headers, “To” and
“WWW-Contact”. As you can see, headers that occur more than once are
retrieved as an array, which may be accessed by Perl's array accessing
methods.
1.1.6. logging.pl
For debugging purposes, you probably want to write messages to the
syslog. The "logdemo" shows three ways to access the Kamailio log
syslog. The “logdemo” shows three ways to access the Kamailio log
function: it is available through the Kamailio class as well as through
the Kamailio::Message class.
Remember that you can use exported functions from other modules. You
may thus as well use the "xlog" module and it's xlog function.
may thus as well use the “xlog” module and it's xlog function.
The L_INFO, L_DBG, L_ERR, L_CRIT... constants are available through the
Kamailio::Constants package.
@ -1634,7 +1634,7 @@ Chapter 3. Perl samples
1.1.10. pseudovars.pl
This script demonstrates the Perl module's "pseudoVar" method. It may
This script demonstrates the Perl module's “pseudoVar” method. It may
be used to retrieve the values of current pseudo variables.
You might notice that there is no particular function for setting
@ -1650,48 +1650,48 @@ Chapter 4. Frequently Asked Questions
4.1.
Are there known bugs in the Perl module?
The Perl module does have a few shortcomings that may be regarded as
bugs.
* Missing module functions. Not all functions of other modules are
available for Perl access. The reason for this is a design property
of Kamailio. Making available more functions is work in progress.
* Perl and threads. Perl itself is, when compiled with the correct
parameters, thread safe; unfortunately, not all Perl modules are.
The DBI modules, especially (but not restricted to) DBI::ODBC are
known NOT to be thread safe.
Using DBI::ODBC -- and possibly other non-thread-safe Perl
extensions -- may result in erroneous behavior of Kamailio,
including (but not restricted to) server crashes and wrong routing.
Are there known bugs in the Perl module?
The Perl module does have a few shortcomings that may be regarded as
bugs.
* Missing module functions. Not all functions of other modules are
available for Perl access. The reason for this is a design property
of Kamailio. Making available more functions is work in progress.
* Perl and threads. Perl itself is, when compiled with the correct
parameters, thread safe; unfortunately, not all Perl modules are.
The DBI modules, especially (but not restricted to) DBI::ODBC are
known NOT to be thread safe.
Using DBI::ODBC -- and possibly other non-thread-safe Perl
extensions -- may result in erroneous behavior of Kamailio,
including (but not restricted to) server crashes and wrong routing.
4.2.
Where can I find more about Kamailio?
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
Take a look at http://www.kamailio.org/.
4.3.
Where can I post a question about this module?
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
4.4.
How can I report a bug?
How can I report a bug?
Please follow the guidelines provided at:
http://sip-router.org/tracker.
Please follow the guidelines provided at:
https://github.com/kamailio/kamailio/issues.

@ -6,7 +6,7 @@ Edited by
Maxim Sobolev
Copyright © 2010 Maxim Sobolev
Copyright © 2010 Maxim Sobolev
__________________________________________________________________
Table of Contents
@ -92,7 +92,7 @@ Chapter 1. Admin Guide
The path to the fiel with Python code to be executed from configuration
file.
Default value is "/usr/local/etc/kamailio/handler.py".
Default value is “/usr/local/etc/kamailio/handler.py”.
Example 1.1. Set script_name parameter
...
@ -104,7 +104,7 @@ modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py")
The Python function to be executed by this module when it is initialied
by Kamailio.
Default value is "mod_init".
Default value is “mod_init”.
Example 1.2. Set mod_init_function parameter
...
@ -116,7 +116,7 @@ modparam("app_python", "mod_init_function", "my_mod_init")
The Python function to be executed by this module when a new worker
process (child) is initialied by Kamailio.
Default value is "child_init".
Default value is “child_init”.
Example 1.3. Set child_init_method parameter
...
@ -127,7 +127,7 @@ modparam("app_python", "child_init_method", "my_child_init")
4.1. python_exec(method [, args])
4.1. python_exec(method [, args])
4.1. python_exec(method [, args])
Execute the Python function with the name given by the parameter
'method'. Optionally can be provided a second string with parameters to

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2011 asipto.com
Copyright © 2011-2016 asipto.com
__________________________________________________________________
Table of Contents
@ -113,7 +113,7 @@ modparam("async", "workers", 2)
4.2. async_sleep(seconds)
4.3. async_task_route(routename)
4.1. async_route(routename, seconds)
4.1. async_route(routename, seconds)
Simulate a sleep of 'seconds' and then continue the processing of the
SIP request with the route[routename]. In case of internal errors, the
@ -144,7 +144,7 @@ route[RESUME] {
}
...
4.2. async_sleep(seconds)
4.2. async_sleep(seconds)
Simulate a sleep of 'seconds' and then continue the processing of SIP
request with the next action. In case of internal errors, the function
@ -163,7 +163,7 @@ send_reply("404", "Not found");
exit;
...
4.3. async_task_route(routename)
4.3. async_task_route(routename)
Continue the processing of the SIP request with the route[routename] in
one of the processes from core asynchronous framework. The core

@ -25,7 +25,7 @@
</editor>
</authorgroup>
<copyright>
<year>2011</year>
<year>2011-2016</year>
<holder>asipto.com</holder>
</copyright>
</bookinfo>

@ -15,7 +15,7 @@ Daniel-Constantin Mierla
asipto.com
<miconda@gmail.com>
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2002, 2003 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -612,7 +612,7 @@ modparam("auth", "force_stateless_reply", 1)
to SRV records (not all SIP clients support SRV lookup), a subdomain of
the master domain can be defined for SIP purposes (like
sip.mydomain.net pointing to same IP address as the SRV record for
mydomain.net). By ignoring the realm_prefix "sip.", at authentication,
mydomain.net). By ignoring the realm_prefix “sip.”, at authentication,
sip.example.com will be equivalent to example.com .
Default value is empty string.
@ -672,7 +672,7 @@ if (has_credentials("myrealm")) {
}
...
4.3. www_challenge(realm, flags)
4.3. www_challenge(realm, flags)
The function challenges a user agent. It will generate a WWW-Authorize
header field containing a digest challenge, it will put the header
@ -686,7 +686,7 @@ if (has_credentials("myrealm")) {
* realm - Realm is a opaque string that the user agent should present
to the user so he can decide what username and password to use.
Usually this is domain of the host the server is running on.
It must not be empty string "". In case of REGISTER requests, the
It must not be empty string “”. In case of REGISTER requests, the
To header field domain (e.g., variable $td) can be used (because
this header field represents the user being registered), for all
other messages From header field domain can be used (e.g., variable
@ -709,7 +709,7 @@ if (!www_authenticate("$td", "subscriber")) {
}
...
4.4. proxy_challenge(realm, flags)
4.4. proxy_challenge(realm, flags)
The function challenges a user agent. It will generate a
Proxy-Authorize header field containing a digest challenge, it will put
@ -731,7 +731,7 @@ if (!proxy_authenticate("$fd", "subscriber")) {
};
...
4.5. auth_challenge(realm, flags)
4.5. auth_challenge(realm, flags)
The function challenges a user agent for authentication. It combines
the functions www_challenge() and proxy_challenge(), by calling
@ -750,7 +750,7 @@ if (!auth_check("$fd", "subscriber", "1")) {
};
...
4.6. pv_www_authenticate(realm, passwd, flags [, method])
4.6. pv_www_authenticate(realm, passwd, flags [, method])
The function verifies credentials according to RFC2617. If the
credentials are verified successfully then the function will succeed
@ -773,7 +773,7 @@ if (!auth_check("$fd", "subscriber", "1")) {
* realm - Realm is a opaque string that the user agent should present
to the user so he can decide what username and password to use.
Usually this is domain of the host the server is running on.
It must not be empty string "". In case of REGISTER requests To
It must not be empty string “”. In case of REGISTER requests To
header field domain (e.g., varibale $td) can be used (because this
header field represents a user being registered), for all other
messages From header field domain can be used (e.g., varibale $fd).
@ -802,7 +802,7 @@ if (!pv_www_authenticate("$td", "123abc", "0")) {
};
...
4.7. pv_proxy_authenticate(realm, passwd, flags)
4.7. pv_proxy_authenticate(realm, passwd, flags)
The function verifies credentials according to RFC2617. If the
credentials are verified successfully then the function will succeed
@ -825,7 +825,7 @@ if (!pv_proxy_authenticate("$fd", "$avp(password)", "0")) {
};
...
4.8. pv_auth_check(realm, passwd, flags, checks)
4.8. pv_auth_check(realm, passwd, flags, checks)
The function combines the functionalities of pv_www_authenticate and
pv_proxy_authenticate, first being exectuted if the SIP request is a
@ -856,7 +856,7 @@ if (!pv_auth_check("$fd", "$avp(password)", "0", "1")) {
};
...
4.9. auth_get_www_authenticate(realm, flags, pvdest)
4.9. auth_get_www_authenticate(realm, flags, pvdest)
Build WWW-Authentication header and set the resulting value in 'pvdest'
pseudo-variable parameter.

@ -24,9 +24,9 @@ Jan Janak
<jan@iptel.org>
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2005 Voice Sistem SRL
Copyright © 2005 Voice Sistem SRL
__________________________________________________________________
Table of Contents
@ -154,7 +154,7 @@ Chapter 1. Admin Guide
For dbtext module (which stores data in plaintext files) it is
directory in which the database resides.
Default value is "mysql://kamailioro:kamailioro@localhost/kamailio".
Default value is “mysql://kamailioro:kamailioro@localhost/kamailio”.
Example 1.1. db_url parameter usage
...
@ -166,7 +166,7 @@ modparam("auth_db", "db_url", "dbdriver://username:password@dbhost/dbname")
This is the name of the column holding usernames. Default value is fine
for most people. Use the parameter if you really need to change it.
Default value is "username".
Default value is “username”.
Example 1.2. user_column parameter usage
...
@ -179,7 +179,7 @@ modparam("auth_db", "user_column", "user")
is fine for most people. Use the parameter if you really need to change
it.
Default value is "domain".
Default value is “domain”.
Example 1.3. domain_column parameter usage
...
@ -194,7 +194,7 @@ modparam("auth_db", "domain_column", "domain")
safe because the server doesn't need to know plaintext passwords and
they cannot be obtained from HA1 strings.
Default value is "ha1".
Default value is “ha1”.
Example 1.4. password_column parameter usage
...
@ -222,16 +222,16 @@ modparam("auth_db", "password_column_2", "ha1_2")
HA1 string or plaintext passwords for authentification.
If the parameter is set to 0 and the username parameter of credentials
contains also "@domain" (some user agents append the domain to the
contains also “@domain” (some user agents append the domain to the
username parameter), then the server will use the HA1 values from the
column specified in the "password_column_2" parameter. If the username
column specified in the “password_column_2” parameter. If the username
parameter doesn't contain a domain, the server will use the HA1 values
from the column given in the "password_column"parameter.
from the column given in the “password_column”parameter.
If the parameter is set to 1 then the HA1 value will be calculated from
the column specified in the "password_column" parameter.
the column specified in the “password_column” parameter.
The "password_column_2"column contain also HA1 strings but they should
The “password_column_2”column contain also HA1 strings but they should
be calculated including the domain in the username parameter (as
opposed to password_column which (when containing HA1 strings) should
always contains HA1 strings calculated without domain in username.
@ -257,7 +257,7 @@ modparam("auth_db", "calculate_ha1", 1)
IMPORTANT: before turning on this parameter, be sure that the domain
column in subscriber table is properly populated.
Default value is "0 (false)".
Default value is “0 (false)”.
Example 1.7. use_domain parameter usage
...
@ -276,7 +276,7 @@ modparam("auth_db", "use_domain", 1)
* credential = (avp_specification '=' column_name) | (column_name)
* avp_specification = '$avp(' + 'i:'ID | 's:'NAME | alias + ')'
Default value of this parameter is "NULL" (no credientials loaded).
Default value of this parameter is “NULL” (no credientials loaded).
Example 1.8. load_credentials parameter usage
...
@ -290,7 +290,7 @@ modparam("auth_db", "load_credentials", "$avp(i:123)=rpid;email_address")
If set to 0, the module will skip checking the version for subscriber
table.
Default value is "1 (check for table version)".
Default value is “1 (check for table version)”.
Example 1.9. version_table parameter usage
...
@ -306,7 +306,7 @@ modparam("auth_db", "version_table", 0)
4.5. auth_check(realm, table, flags)
4.6. is_subscriber(uri, dbtable, flags)
4.1. www_authenticate(realm, table [, method])
4.1. www_authenticate(realm, table [, method])
Name alias: www_authorize(realm, table)
@ -335,7 +335,7 @@ modparam("auth_db", "version_table", 0)
* realm - Realm is a opaque string that the user agent should present
to the user so he can decide what username and password to use.
Usually this is domain of the host the server is running on.
It must not be empty string "". In case of REGISTER requests To
It must not be empty string “”. In case of REGISTER requests To
header field domain (e.g., variable $td) can be used (because this
header field represents the user being registered), for all other
messages From header field domain can be used (e.g., variable $fd).
@ -354,13 +354,13 @@ if (!www_authorize("kamailio.org", "subscriber")) {
};
...
4.2. www_authorize(realm, table)
4.2. www_authorize(realm, table)
It is same function as www_authenticate(realm, table). This name is
kept for backward compatibility, since it was named this way first time
by it actually does user authentication.
4.3. proxy_authenticate(realm, table)
4.3. proxy_authenticate(realm, table)
Name alias: proxy_authorize(realm, table)
@ -377,9 +377,9 @@ if (!www_authorize("kamailio.org", "subscriber")) {
* realm - Realm is a opaque string that the user agent should present
to the user so he can decide what username and password to use.
Usually this is domain of the host the server is running on.
It must not be empty string "". Apart of a static string, typical
It must not be empty string “”. Apart of a static string, typical
value is From header field domain (e.g., variable $fd).
If an empty string "" is used then the server will generate it from
If an empty string “” is used then the server will generate it from
the request. From header field domain will be used as realm.
The string may contain pseudo variables.
* table - Table to be used to lookup usernames and passwords (usually
@ -394,13 +394,13 @@ if (!proxy_authorize("$fd", "subscriber)) {
};
...
4.4. proxy_authorize(realm, table)
4.4. proxy_authorize(realm, table)
It is same function as proxy_authenticate(realm, table). This name is
kept for backward compatibility, since it was named this way first time
but it actually does user authentication.
4.5. auth_check(realm, table, flags)
4.5. auth_check(realm, table, flags)
The function combines the functionalities of www_authenticate and
proxy_authenticate, first being exectuted if the SIP request is a
@ -416,7 +416,7 @@ if (!proxy_authorize("$fd", "subscriber)) {
* realm - Realm is a opaque string that the user agent should present
to the user so he can decide what username and password to use.
Usually this is domain of the host the server is running on.
It must not be empty string "". Apart of a static string, typical
It must not be empty string “”. Apart of a static string, typical
value is From header field domain (e.g., variable $fd).
The string may contain pseudo variables.
* table - Table to be used to lookup usernames and passwords (usually
@ -446,7 +446,7 @@ if (!auth_check("$fd", "subscriber", "1")) {
}
...
4.6. is_subscriber(uri, dbtable, flags)
4.6. is_subscriber(uri, dbtable, flags)
The function checks if there is a subscriber corresponding to the AoR
in uri parameter. It uses same database connection as for

@ -8,7 +8,7 @@ Edited by
Elena-Ramona Modroiu
Copyright © 2003, 2004 FhG FOKUS
Copyright © 2003, 2004 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -137,7 +137,7 @@ Chapter 1. Admin Guide
Hostname of the machine where the DIAMETER Client is running.
Default value is "localhost".
Default value is “localhost”.
Example 1.2. Set diameter_client_host parameter
...
@ -148,7 +148,7 @@ modparam("auth_diameter", "diameter_client_host", "10.10.10.10")
Port number where the DIAMETER Client is listening.
Default value is "3000".
Default value is “3000”.
Example 1.3. Set diameter_client_port parameter
...
@ -160,7 +160,7 @@ modparam("auth_diameter", "diameter_client_port", 3000)
Specifies whether the domain name part of URI is used when checking the
user's privileges.
Default value is "0 (0==false and 1==true )".
Default value is “0 (0==false and 1==true )”.
Example 1.4. Set use_domain parameter
...
@ -173,12 +173,12 @@ modparam("auth_diameter", "use_domain", 1)
4.2. diameter_proxy_authorize(realm)
4.3. diameter_is_user_in(who, group)
4.1. diameter_www_authorize(realm)
4.1. diameter_www_authorize(realm)
SIP Server checks for authorization having a DIAMETER server in
backend. If no credentials are provided inside the SIP request then a
challenge is sent back to UAC. If the credentials don't match the ones
computed by DISC then "403 Forbidden" is sent back.
computed by DISC then “403 Forbidden” is sent back.
Negative codes may be interpreted as follows:
* -5 (generic error) - some generic error occurred and no reply was
@ -199,12 +199,12 @@ if(!diameter_www_authorize("siphub.net"))
};
...
4.2. diameter_proxy_authorize(realm)
4.2. diameter_proxy_authorize(realm)
SIP Proxy checks for authorization having a DIAMETER server in backend.
If no credentials are provided inside the SIP request then a challenge
is sent back to UAC. If the credentials don't match the ones computed
by DISC then "403 Forbidden" is sent back. For more about the negative
by DISC then “403 Forbidden” is sent back. For more about the negative
return codes, see the above function.
Meaning of the parameters is as follows:
@ -221,14 +221,14 @@ if(!diameter_proxy_authorize("siphub.net"))
};
...
4.3. diameter_is_user_in(who, group)
4.3. diameter_is_user_in(who, group)
The method performs group membership checking with DISC.
Meaning of the parameters is as follows:
* who - what header to be used to get the SIP URI that is wanted to
be checked being member in a certain group. It can be:
"Request-URI", "From", "To" or "Credentials".
“Request-URI”, “From”, “To” or “Credentials”.
* group - the group name where to check if the user is part of.
This function can be used from REQUEST_ROUTE.

@ -1,12 +1,11 @@
SIP Authenticated Identity Module
Gergely Kovacs
Iptel.org
Copyright © 2007 Iptel.org
_________________________________________________________________
Copyright © 2007 Iptel.org
__________________________________________________________________
Table of Contents
@ -30,31 +29,31 @@ Gergely Kovacs
6. Functions
6.1. auth_date_proc()
6.1. auth_date_proc()
6.1.1. Dependencies
6.2. auth_add_identity()
6.2. auth_add_identity()
6.2.1. Dependencies
6.3. vrfy_check_date()
6.3. vrfy_check_date()
6.3.1. Dependencies
6.4. vrfy_get_certificate()
6.4. vrfy_get_certificate()
6.4.1. Dependencies
6.5. vrfy_check_certificate()
6.5. vrfy_check_certificate()
6.5.1. Dependencies
6.6. vrfy_check_msgvalidity()
6.6. vrfy_check_msgvalidity()
6.6.1. Dependencies
6.7. vrfy_check_callid()
6.7. vrfy_check_callid()
6.7.1. Dependencies
@ -64,14 +63,14 @@ Gergely Kovacs
List of Examples
1.1. Set privatekey_path parameter
1.2. Set certificate_path parameter
1.3. Set certificate_url parameter
1.4. Set msg_timeout parameter
1.5. Set auth_validity_time parameter
1.6. Set auth_validity_time parameter
1.7. Set certificate_cache_limit parameter
1.8. Set cainfo_path parameter
1.9. Set accept_pem_certs parameter
1.2. Set certificate_path parameter
1.3. Set certificate_url parameter
1.4. Set msg_timeout parameter
1.5. Set auth_validity_time parameter
1.6. Set auth_validity_time parameter
1.7. Set certificate_cache_limit parameter
1.8. Set cainfo_path parameter
1.9. Set accept_pem_certs parameter
Chapter 1. Admin Guide
@ -95,31 +94,31 @@ Chapter 1. Admin Guide
6. Functions
6.1. auth_date_proc()
6.1. auth_date_proc()
6.1.1. Dependencies
6.2. auth_add_identity()
6.2. auth_add_identity()
6.2.1. Dependencies
6.3. vrfy_check_date()
6.3. vrfy_check_date()
6.3.1. Dependencies
6.4. vrfy_get_certificate()
6.4. vrfy_get_certificate()
6.4.1. Dependencies
6.5. vrfy_check_certificate()
6.5. vrfy_check_certificate()
6.5.1. Dependencies
6.6. vrfy_check_msgvalidity()
6.6. vrfy_check_msgvalidity()
6.6.1. Dependencies
6.7. vrfy_check_callid()
6.7. vrfy_check_callid()
6.7.1. Dependencies
@ -129,17 +128,17 @@ Chapter 1. Admin Guide
1. Overview
Auth Identity module provides functionalities for securely identifying
originators of SIP messages. It implements the SIP Identity standard
where a SIP proxy signs messages that is sent to other domains. This
originators of SIP messages. It implements the SIP Identity standard
where a SIP proxy signs messages that is sent to other domains. This
module has two basic services:
* authorizer - authorizes a message and adds Identity and
* authorizer - authorizes a message and adds Identity and
Identity-Info headers
* verifier - verifies an authorized message
Known limitations in this version:
* authorizer and verifier support all SIP requests except for CANCEL
and REGISTER
* verifier does not support the subjectAltName extension of
* verifier does not support the subjectAltName extension of
certificates
2. Dependencies
@ -152,16 +151,16 @@ Chapter 1. Admin Guide
* OpenSSL (version 0.9.8 or higher) for cryptographic functions
* libcurl for HTTP, HTTPS functions
If you'd like to use TLS module too then use the corresponding LIB
line in auth_identity's Makefile
If you'd like to use TLS module too then use the corresponding LIB line
in auth_identity's Makefile
4. Installation And Running
the Authorizer service needs to make the public key, which conveyed in
a certificate, available over HTTPS or HTTP for verifiers. The domain
the authorizer is responsible for and the domain part of the URL of
the certificate must be the same. This service needs access to the
private key too.
a certificate, available over HTTPS or HTTP for verifiers. The domain
the authorizer is responsible for and the domain part of the URL of the
certificate must be the same. This service needs access to the private
key too.
5. Parameters
@ -198,7 +197,7 @@ modparam("auth_identity","privatekey_path","/etc/ssl/private/key.pem")
This parameter is required by authentication service.
Example 1.2. Set certificate_path parameter
Example 1.2. Set certificate_path parameter
...
modparam("auth_identity","certificate_path","/var/www/ssl/mycert.pem")
...
@ -207,13 +206,13 @@ modparam("auth_identity","certificate_path","/var/www/ssl/mycert.pem")
Note: this parameter is for authorizer service.
The url where certificate is available for other verifier services.
(value of Identity-info header) The certificate should be in DER
The url where certificate is available for other verifier services.
(value of Identity-info header) The certificate should be in DER
format.
This parameter is required by authentication service.
Example 1.3. Set certificate_url parameter
Example 1.3. Set certificate_url parameter
...
modparam("auth_identity","certificate_url","https://foo.bar/mycert.der")
...
@ -222,13 +221,13 @@ modparam("auth_identity","certificate_url","https://foo.bar/mycert.der")
Note: this parameter is for authorizer service.
If the Date header of message which is needed to be authenticated
contains a time different by more than this seconds from the current
If the Date header of message which is needed to be authenticated
contains a time different by more than this seconds from the current
time noted by the authentication service then it rejects the message.
This parameter is optional. The default value is "600".
Example 1.4. Set msg_timeout parameter
Example 1.4. Set msg_timeout parameter
...
modparam("auth_identity","msg_timeout",600)
...
@ -237,13 +236,13 @@ modparam("auth_identity","msg_timeout",600)
Note: this parameter is for verifier service.
The validity time of an authenticated message. The message will be
The validity time of an authenticated message. The message will be
refused if it contains a time different by more than this seconds from
the current time noted by the verification service.
This parameter is optional. The default value is "3600".
Example 1.5. Set auth_validity_time parameter
Example 1.5. Set auth_validity_time parameter
...
modparam("auth_identity","auth_validity_time",3600)
...
@ -252,15 +251,15 @@ modparam("auth_identity","auth_validity_time",3600)
Note: this parameter is for verifier service.
The number of Call-IDs stored in order to recognize call replay
attacks. A Call-ID is stored auth_validity_time long and uses
The number of Call-IDs stored in order to recognize call replay
attacks. A Call-ID is stored auth_validity_time long and uses
approximately 100 bytes memory.
This parameter is optional. The default value is "32768". (you should
increase the size of shared memory with -m command line switch if you
This parameter is optional. The default value is "32768". (you should
increase the size of shared memory with -m command line switch if you
liked to store more callid than 10000)
Example 1.6. Set auth_validity_time parameter
Example 1.6. Set auth_validity_time parameter
...
modparam("auth_identity","callid_cache_limit",32768)
...
@ -270,12 +269,12 @@ modparam("auth_identity","callid_cache_limit",32768)
Note: this parameter is for verifier service.
The number of certificates stored in order to avoid needless download.
A certificate is stored until its expiration date and uses
A certificate is stored until its expiration date and uses
approximately 600 bytes memory.
This parameter is optional. The default value is "4096".
Example 1.7. Set certificate_cache_limit parameter
Example 1.7. Set certificate_cache_limit parameter
...
modparam("auth_identity","certificate_cache_limit",4096)
...
@ -284,13 +283,13 @@ modparam("auth_identity","certificate_cache_limit",4096)
Note: this parameter is for verifier service.
A file of trusted certificates. The file should contain multiple
certificates in PEM format concatenated together. It could be useful
A file of trusted certificates. The file should contain multiple
certificates in PEM format concatenated together. It could be useful
for verifying a certificate signed by a private CA.
This parameter is optional. It has not got default value.
Example 1.8. Set cainfo_path parameter
Example 1.8. Set cainfo_path parameter
...
modparam("auth_identity","cainfo_path","/etc/ssl/certs/ca-certificates.crt")
...
@ -303,38 +302,38 @@ modparam("auth_identity","cainfo_path","/etc/ssl/certs/ca-certificates.crt")
This parameter is optional. The default value is "0".
Example 1.9. Set accept_pem_certs parameter
Example 1.9. Set accept_pem_certs parameter
...
modparam("auth_identity","accept_pem_certs",1)
...
6. Functions
6.1. auth_date_proc()
6.1. auth_date_proc()
6.1.1. Dependencies
6.2. auth_add_identity()
6.2. auth_add_identity()
6.2.1. Dependencies
6.3. vrfy_check_date()
6.3. vrfy_check_date()
6.3.1. Dependencies
6.4. vrfy_get_certificate()
6.4. vrfy_get_certificate()
6.4.1. Dependencies
6.5. vrfy_check_certificate()
6.5. vrfy_check_certificate()
6.5.1. Dependencies
6.6. vrfy_check_msgvalidity()
6.6. vrfy_check_msgvalidity()
6.6.1. Dependencies
6.7. vrfy_check_callid()
6.7. vrfy_check_callid()
6.7.1. Dependencies
@ -342,12 +341,12 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for authorizer service.
If a message, the auth service should authorize, contains Date header
then this function checks whether it falls in message timeout (set by
msg_timeout parameter). If there is not any Date header then the
module adds one. This function also checks whether the certificate of
the authentication service (set by certificate_path parameter) has
been expired.
If a message, the auth service should authorize, contains Date header
then this function checks whether it falls in message timeout (set by
msg_timeout parameter). If there is not any Date header then the module
adds one. This function also checks whether the certificate of the
authentication service (set by certificate_path parameter) has been
expired.
6.1.1. Dependencies
@ -357,17 +356,17 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for authorizer service.
Assembles digest-string from the message, calculates its SHA1 hash,
Assembles digest-string from the message, calculates its SHA1 hash,
encrypts it with the private key (set by privatekey_path parameter) of
the authorizer service, base64 encodes it and adds to the outgoing
message as the value of Identity header. This function also adds
Identity-Info header which contains an URI (set by certificate_url
the authorizer service, base64 encodes it and adds to the outgoing
message as the value of Identity header. This function also adds
Identity-Info header which contains an URI (set by certificate_url
parameter) from which the certificate of auth service can be acquired.
Note: this function needs the final outgoing message for
authorization, so no module may modify any digest string related
headers (From, To, Call-ID, CSeq, Date, Contact) and body after
auth_add_identity()'s been called
Note: this function needs the final outgoing message for authorization,
so no module may modify any digest string related headers (From, To,
Call-ID, CSeq, Date, Contact) and body after auth_add_identity()'s been
called
6.2.1. Dependencies
@ -377,7 +376,7 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for verifier service.
Checks Date header of the incoming message whether falls in validity
Checks Date header of the incoming message whether falls in validity
time (set by auth_validity_time parameter)
6.3.1. Dependencies
@ -388,9 +387,9 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for verifier service.
Tries to get certificate defined by the value of Identity-info header
from certificate table (which size is set by certificate_cache_limit
parameter). If the required certificate is not found there then this
Tries to get certificate defined by the value of Identity-info header
from certificate table (which size is set by certificate_cache_limit
parameter). If the required certificate is not found there then this
function downloads it.
6.4.1. Dependencies
@ -401,9 +400,9 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for verifier service.
Checks whether the downloaded certificate is valid (is not expired,
its subject and the domain part of the URL are the same) and adds it
to certificate table.
Checks whether the downloaded certificate is valid (is not expired, its
subject and the domain part of the URL are the same) and adds it to
certificate table.
6.5.1. Dependencies
@ -413,22 +412,22 @@ modparam("auth_identity","accept_pem_certs",1)
Note: this function is for verifier service.
Assembles digest-string from the message, create SHA1 hash and
compares it with the decrypted value of Identity header.
Assembles digest-string from the message, create SHA1 hash and compares
it with the decrypted value of Identity header.
6.6.1. Dependencies
vrfy_get_certificate() must be called before and
vrfy_get_certificate() must be called before and
vrfy_check_certificate() should be called before
6.7. vrfy_check_callid()
Note: this function is for verifier service.
Checks whether the current call's been already processed in validity
time (set by auth_validity_time) to recognize call replay attacks. If
Checks whether the current call's been already processed in validity
time (set by auth_validity_time) to recognize call replay attacks. If
this call (identified by Call-id, Cseq, and tag of From header triple)
has not been replayed then adds it to callid table (which size is set
has not been replayed then adds it to callid table (which size is set
by callid_cache_limit parameter).
6.7.1. Dependencies

@ -37,6 +37,7 @@
#include <openssl/sha.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/x509_vfy.h>
#include "../../mem/mem.h"
#include "../../parser/parse_uri.h"

@ -28,11 +28,11 @@ Phil Lavin
<phil.lavin@synety.com>
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2002, 2003 FhG FOKUS
Copyright © 2005 Voice Sistem SRL
Copyright © 2005 Voice Sistem SRL
Copyright © 2008-2010 Juha Heinanen
Copyright © 2008-2010 Juha Heinanen
__________________________________________________________________
Table of Contents
@ -62,7 +62,7 @@ Phil Lavin
List of Examples
1.1. "SIP-AVP" RADIUS AVP exmaples
1.1. “SIP-AVP” RADIUS AVP exmaples
1.2. radius_config parameter usage
1.3. service_type parameter usage
1.4. auth_extra parameter usage
@ -120,7 +120,7 @@ Chapter 1. Admin Guide
making extra queries.
The additional credentials are embedded in the RADIUS reply as AVPs
"SIP-AVP". The syntax of the value is:
“SIP-AVP”. The syntax of the value is:
* value = SIP_AVP_NAME SIP_AVP_VALUE
* SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER
* SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE
@ -130,7 +130,7 @@ Chapter 1. Admin Guide
The RPID value may be fetch via this mechanism.
Example 1.1. "SIP-AVP" RADIUS AVP exmaples
Example 1.1. “SIP-AVP” RADIUS AVP exmaples
....
"email:joe@yahoo.com"
- STRING NAME AVP (email) with STRING VALUE (joe@yahoo.com)
@ -179,7 +179,7 @@ Chapter 1. Admin Guide
This is the location of the configuration file of radius client
libraries.
Default value is "/usr/local/etc/radiusclient-ng/radiusclient.conf".
Default value is “/usr/local/etc/radiusclient-ng/radiusclient.conf”.
Example 1.2. radius_config parameter usage
modparam("auth_radius", "radius_config", "/etc/radiusclient.conf")
@ -190,7 +190,7 @@ modparam("auth_radius", "radius_config", "/etc/radiusclient.conf")
default should be fine for most people. See your radius client include
files for numbers to be put in this parameter if you need to change it.
Default value is "15".
Default value is “15”.
Example 1.3. service_type parameter usage
modparam("auth_radius", "service_type", 15)
@ -219,7 +219,7 @@ modparam("auth_radius", "auth_extra", "Acct-Session-Id=$ci")
authentication. At the time of this writing, certain versions of
Linksys WRT54GL are known to do that.
Default value is "-1".
Default value is “-1”.
Example 1.5. use_ruri_flag parameter usage
modparam("auth_radius", "use_ruri_flag", 22)

@ -80,7 +80,7 @@ static inline int authorize(struct sip_msg* _msg, pv_elem_t* _realm,
pv_spec_t * _uri_user, hdr_types_t _hftype)
{
int res;
auth_result_t ret;
auth_cfg_result_t ret;
struct hdr_field* h;
auth_body_t* cred;
str *uri_user;

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2015 asipto.com
Copyright © 2015 asipto.com
__________________________________________________________________
Table of Contents
@ -141,7 +141,7 @@ modparam("auth_xkeys", "xkey", "id=abc;name=xyz;value=secret;expires=72000")
4.1. auth_xkeys_add(hdr, kid, alg, data)
4.2. auth_xkeys_check(hdr, kid, alg, data)
4.1. auth_xkeys_add(hdr, kid, alg, data)
4.1. auth_xkeys_add(hdr, kid, alg, data)
Add a header computed with the first key in the group kid, hasing with
algorithm alg over the content of parameter data. The parameters can
@ -156,7 +156,7 @@ modparam("auth_xkeys", "xkey", "id=abc;name=xyz;value=secret;expires=72000")
auth_xkeys_add("X-My-Key", "abc", "sha256", "$Ri:$fu:$ru:$hdr(CSeq)");
...
4.2. auth_xkeys_check(hdr, kid, alg, data)
4.2. auth_xkeys_check(hdr, kid, alg, data)
Check if the value of header hdr matches the value computed with the
first key in the group kid, hasing with algorithm alg over the content

@ -10,7 +10,7 @@ Michal Matyska
iptel
<michal@iptel.org>
Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
__________________________________________________________________
Table of Contents

@ -10,7 +10,7 @@ Ramona-Elena Modroiu
<ramona@rosdev.ro>
Copyright © 2004, 2005 Voice Sistem SRL
Copyright © 2004, 2005 Voice Sistem SRL
__________________________________________________________________
Table of Contents
@ -242,7 +242,7 @@ modparam("avpops","use_domain",1)
Name of column containing the uuid (unique user id).
Default value is "uuid".
Default value is “uuid”.
Example 1.5. Set uuid_column parameter
...
@ -253,7 +253,7 @@ modparam("avpops","uuid_column","uuid")
Name of column containing the username.
Default value is "username".
Default value is “username”.
Example 1.6. Set username_column parameter
...
@ -264,7 +264,7 @@ modparam("avpops","username_column","username")
Name of column containing the domain name.
Default value is "domain".
Default value is “domain”.
Example 1.7. Set domain_column parameter
...
@ -275,7 +275,7 @@ modparam("avpops","domain_column","domain")
Name of column containing the attribute name (AVP name).
Default value is "attribute".
Default value is “attribute”.
Example 1.8. Set attribute_column parameter
...
@ -286,7 +286,7 @@ modparam("avpops","attribute_column","attribute")
Name of column containing the AVP value.
Default value is "value".
Default value is “value”.
Example 1.9. Set value_column parameter
...
@ -297,7 +297,7 @@ modparam("avpops","value_column","value")
Name of integer column containing the AVP type.
Default value is "type".
Default value is “type”.
Possible column values are
* 0 - AVP with string name and string value
@ -325,7 +325,7 @@ modparam("avpops","type_column","type")
+ 'value_type='('integer'|'string')
+ 'table='string
Default value is "NULL".
Default value is “NULL”.
Example 1.11. Set db_scheme parameter
...
@ -349,7 +349,7 @@ modparam("avpops","db_scheme",
5.12. is_avp_set(name)
5.13. avp_print()
5.1. avp_db_load(source,name)
5.1. avp_db_load(source,name)
Loads from DB into memory the AVPs corresponding to the given source.
If given, it sets the script flags for loaded AVPs. It returns true if
@ -387,7 +387,7 @@ avp_db_load("$uuid","$avp(s:404fwd)/fwd_table");
avp_db_load("$ru","$avp(i1:123)/$some_scheme");
...
5.2. avp_db_store(source,name)
5.2. avp_db_store(source,name)
Stores to DB the AVPs corresponding to the given source.
@ -403,7 +403,7 @@ avp_db_store("$tu","$avp(i:678)");
avp_db_store("$ru/username","$avp(email)");
...
5.3. avp_db_delete(source,name)
5.3. avp_db_delete(source,name)
Deletes from DB the AVPs corresponding to the given source.
@ -420,7 +420,7 @@ avp_db_delete("$ru/username","$avp(email)");
avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
...
5.4. avp_db_query(query[,dest])
5.4. avp_db_query(query[,dest])
Make a database query and store the result in AVPs. This command is
deprecated, please use the more flexible and advanced sqlops module
@ -436,8 +436,8 @@ avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
used in the query makes you vulnerable to SQL injection, e.g. make
it possible for an outside attacker to alter your database content.
* dest - a list with AVP names where to store the result. The format
is "$avp(name1);$avp(name2);...". If this parameter is ommited, the
result is stored in "$avp(i:1);$avp(i:2);...". If the result gives
is “$avp(name1);$avp(name2);...”. If this parameter is ommited, the
result is stored in “$avp(i:1);$avp(i:2);...”. If the result gives
many rows, then multiple AVPs with corresponding name will be
added. The value type of the AVP (string or integer) will be
derived from the type of the columns. Please note that only this
@ -460,7 +460,7 @@ avp_db_query("select password, ha1 from subscriber where username='$tu'",
avp_db_query("delete from subscriber");
...
5.5. avp_delete(name)
5.5. avp_delete(name)
Deletes from memory the AVPs with name or, if empty, all AVPs.
@ -482,7 +482,7 @@ avp_delete("i");
avp_delete("a3");
...
5.6. avp_pushto(destination,name)
5.6. avp_pushto(destination,name)
Pushes the value of AVP(s) into the SIP message.
@ -512,7 +512,7 @@ avp_pushto("$du","$avp(i:679)");
avp_pushto("$br","$avp(i:680)");
...
5.7. avp_check(name,op_value)
5.7. avp_check(name,op_value)
Checks the value of the AVP(s) against an operator and value.
@ -567,7 +567,7 @@ $var(id)=2;
avp_check("$xavp(op=>foo[*])","fm/$xavp(op=>fm[$var(id)])/g");
...
5.8. avp_copy(old_name,new_name)
5.8. avp_copy(old_name,new_name)
Copy / move an avp under a new name.
@ -588,7 +588,7 @@ avp_copy("$avp(i:678)", "$avp(s:345)/g");
avp_copy("$avp(old)","$avp(new)/gd");
...
5.9. avp_printf(dest, format)
5.9. avp_printf(dest, format)
NOTE: since Kamailio 1.3.0 the function has been moved to core and it
is an alias to pv_printf().
@ -612,7 +612,7 @@ avp_copy("$avp(old)","$avp(new)/gd");
avp_printf("$avp(i:20)", "This is a $rm request with call-id $hdr(call-id)");
...
5.10. avp_subst(avps, subst)
5.10. avp_subst(avps, subst)
Perl/sed-like subst applied to AVPs having string value.
@ -654,7 +654,7 @@ avp_subst("$avp(i:678)/$avp(i:679)/g", "/(.*)@(.*)/\1@$rd/");
after the first src_avp is processed, it will be added in avp list and
next processing will use it.
5.11. avp_op(name,op_value)
5.11. avp_op(name,op_value)
Different integer operations with avps.
@ -686,7 +686,7 @@ avp_op("$avp(i:678)", "add/i:345/g");
avp_op("$avp(number)","sub/$avp(number2)/d");
...
5.12. is_avp_set(name)
5.12. is_avp_set(name)
Check if any AVP with name is set.
@ -705,7 +705,7 @@ if(is_avp_set("$avp(i:678)"))
log("AVP with integer id 678 exists\n");
...
5.13. avp_print()
5.13. avp_print()
Prints the list with all the AVPs from memory. This is only a
helper/debug function.

@ -15,9 +15,9 @@ Bastian Friedrich
<bastian.friedrich@collax.com>
Copyright © 2007 Collax GmbH
Copyright © 2007 Collax GmbH
Copyright © 2007 Voice System SRL
Copyright © 2007 Voice System SRL
__________________________________________________________________
Table of Contents
@ -151,7 +151,7 @@ Chapter 1. Admin Guide
that feature is implemented.
* 1 - Globally enable benchmarking
Default value is "0".
Default value is “0”.
Example 1.1. Set enable parameter
...
@ -164,7 +164,7 @@ modparam("benchmark", "enable", 1)
function, but only every n'th call. n is defined through this variable.
A sensible granularity seems to be 100.
Default value is "1".
Default value is “1”.
Example 1.2. Set granularity parameter
...
@ -184,7 +184,7 @@ modparam("benchmark", "granularity", 500)
* 2 - L_INFO
* 3 - L_DBG
Default value is "3" (L_INFO).
Default value is “3” (L_INFO).
Example 1.3. Set loglevel parameter
...
@ -198,16 +198,16 @@ modparam("benchmark", "loglevel", 4)
4.1. bm_start_timer(name)
4.2. bm_log_timer(name)
4.1. bm_start_timer(name)
4.1. bm_start_timer(name)
Start timer "name". A later call to "bm_log_timer()" logs this timer..
Start timer “name”. A later call to “bm_log_timer()” logs this timer..
Example 1.4. bm_start_timer usage
...
bm_start_timer("test");
...
4.2. bm_log_timer(name)
4.2. bm_log_timer(name)
This function logs the timer with the given ID. The following data are
logged:
@ -215,7 +215,7 @@ bm_start_timer("test");
equals the granularity variable.
* Last sum is the accumulated duration in the current logging
interval (i.e. for the last "granularity" calls).
interval (i.e. for the last “granularity” calls).
* Last min is the minimum duration between start/log_timer calls
during the last interval.
@ -318,18 +318,18 @@ Chapter 2. Developer Guide
1.2. bm_start(id)
1.3. bm_log(id)
1.1. bm_register(name, mode, id)
1.1. bm_register(name, mode, id)
This function register a new timer and/or returns the internal ID
associated with the timer. mode controls the creation of new timer if
not found. id is to be used by start and log timer functions.
1.2. bm_start(id)
1.2. bm_start(id)
This function equals the user-exported function bm_start_timer. The id
is passed as an integer, though.
1.3. bm_log(id)
1.3. bm_log(id)
This function equals the user-exported function bm_log_timer. The id is
passed as an integer, though.

@ -1,12 +1,11 @@
Blst Module - Blacklist Management
Andrei Pelinescu-Onciul
iptelorg GmbH
Copyright © 2007 iptelorg GmbH
_________________________________________________________________
Copyright © 2007 iptelorg GmbH
__________________________________________________________________
Table of Contents
@ -15,14 +14,14 @@ Andrei Pelinescu-Onciul
1. Overview
2. Functions
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
List of Examples
@ -40,14 +39,14 @@ Chapter 1. Admin Guide
1. Overview
2. Functions
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
1. Overview
@ -55,19 +54,19 @@ Chapter 1. Admin Guide
2. Functions
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
2.1. blst_add([timeout])
2.2. blst_add_retry_after(min, max)
2.3. blst_del()
2.4. blst_is_blacklisted()
2.5. blst_set_ignore([flags])
2.6. blst_rpl_set_ignore([flags])
2.7. blst_clear_ignore([flags])
2.8. blst_rpl_clear_ignore([flags])
2.1. blst_add([timeout])
Adds the source of the current message to the blacklist for timeout
seconds. If timeout is missing or 0 it uses the default blacklist
Adds the source of the current message to the blacklist for timeout
seconds. If timeout is missing or 0 it uses the default blacklist
timeout (dst_blacklist_expire).
Example 1.1. blst_add usage
@ -80,11 +79,11 @@ else
2.2. blst_add_retry_after(min, max)
Adds the source of the current message to the blacklist for the time
interval specified in the Retry-After header. If the Retry-After
header is missing, it will fail (returns false). If the Retry-After
value is less than min, then min seconds will be used instead. If the
Retry-After value is greater than max, then max seconds will be used
Adds the source of the current message to the blacklist for the time
interval specified in the Retry-After header. If the Retry-After header
is missing, it will fail (returns false). If the Retry-After value is
less than min, then min seconds will be used instead. If the
Retry-After value is greater than max, then max seconds will be used
instead.
Example 1.2. blst_add_retry_after usage
@ -98,8 +97,8 @@ if (msg_status==503){ # blacklist 503 source for Retry-After seconds
2.3. blst_del()
Removes the source of the current message from the blacklist. If the
address is not present in the blacklist at the time of the call it
Removes the source of the current message from the blacklist. If the
address is not present in the blacklist at the time of the call it
returns false.
Example 1.3. blst_del usage
@ -121,24 +120,24 @@ if (msg_status==503){ # blacklist 503 source for Retry-After seconds
2.5. blst_set_ignore([flags])
Set errors that will not be taken into account when deciding whether
to blacklist a destination for the current message or a local reply to
the current message.
Set errors that will not be taken into account when deciding whether to
blacklist a destination for the current message or a local reply to the
current message.
blst_set_ignore(..) works for forwarding the current message and
blst_rpl_set_ignore(...) works for local replies to the current
blst_set_ignore(..) works for forwarding the current message and
blst_rpl_set_ignore(...) works for local replies to the current
message.
The variants of these functions with no parameters will ignore
The variants of these functions with no parameters will ignore
everything (equivalent to passing 0xff).
The flags are stored internally as a bitmask, and are applied by
The flags are stored internally as a bitmask, and are applied by
bitwise ANDing them together. The following flags are available:
* 0x02 - generic send error (send denied/ failed).
* 0x04 - connect failed (TCP, TLS or SCTP).
* 0x08 - ICMP error (not currently used).
* 0x10 - SIP transaction timeout.
* 0x20 - 503 reply (statefull mode only). For more details see
* 0x20 - 503 reply (statefull mode only). For more details see
tmblst_503.
Note
@ -156,7 +155,7 @@ Note
2.7. blst_clear_ignore([flags])
Clears blacklist ignore flags previously set by the corresponding
Clears blacklist ignore flags previously set by the corresponding
blst_set_ignore(...) or blst_rpl_set_ignore(...) functions.
See also blst_set_ignore.

@ -10,7 +10,7 @@ Dan Pascu
<dan@ag-projects.com>
Copyright (c) 2005-2008 Dan Pascu
Copyright © 2005-2008 Dan Pascu
__________________________________________________________________
Table of Contents
@ -178,7 +178,7 @@ Chapter 1. Admin Guide
return a code indicating that there is no limit associated with the
call, allowing the use of the same configuration without changes.
Default value is "0".
Default value is “0”.
Example 1.1. Setting the disable parameter
...
@ -190,7 +190,7 @@ modparam("call_control", "disable", 1)
The path to the filesystem socket where the callcontrol application
listens for commands from the module.
Default value is "/var/run/callcontrol/socket".
Default value is “/var/run/callcontrol/socket”.
Example 1.2. Setting the socket_name parameter
...
@ -202,7 +202,7 @@ modparam("call_control", "socket_name", "/var/run/callcontrol/socket")
How long time (in milliseconds) to wait for an answer from the
callcontrol application.
Default value is "500" ms.
Default value is “500” ms.
Example 1.3. Setting the socket_timeout parameter
...
@ -228,7 +228,7 @@ modparam("call_control", "socket_timeout", 500)
call based on caller's SIP URI, caller's SIP domain or caller's IP
address (whichever yields a rate forst, in this order).
Default value is "$avp(s:signaling_ip)".
Default value is “$avp(s:signaling_ip)”.
Example 1.4. Setting the signaling_ip_avp parameter
...
@ -244,7 +244,7 @@ modparam("call_control", "signaling_ip_avp", "$avp(s:signaling_ip)")
have a different, canonical form in the rating engine computation than
it has in the ruri.
Default value is "$avp(s:can_uri)".
Default value is “$avp(s:can_uri)”.
Example 1.5. Setting the canonical_uri_avp parameter
...
@ -258,7 +258,7 @@ modparam("call_control", "canonical_uri_avp", "$avp(s:can_uri)")
by the rating engine as the billing party when finding the rates to
apply to a given call, otherwise, the caller's URI taken from the From
field will be used. When set, this AVP should contain a value in the
form "user@domain" (no sip: prefix should be used).
form “user@domain” (no sip: prefix should be used).
This is useful when a destination diverts a call, thus becoming the new
caller. In this case the billing party is the diverter and this AVP
@ -268,7 +268,7 @@ modparam("call_control", "canonical_uri_avp", "$avp(s:can_uri)")
because B is the billing party in the call not A after the call was
diverted.
Default value is "805".
Default value is “805”.
Example 1.6. Setting the diverter_avp_id parameter
...

@ -985,7 +985,7 @@ __dialog_ended(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
if( !msg || msg == FAKED_REPLY)
msg = _params->req;
call_control_stop(msg, dlg->callid);
*_params->param = (void*)CCInactive;
*_params->param = NULL;
}
}

@ -35,7 +35,9 @@ Lucian Balaceanu
3.8. use_domain (int)
3.9. fallback_default (int)
3.10. fetch_rows (integer)
3.11. match_mode (integer)
3.11. db_load_description (integer)
3.12. match_mode (integer)
3.13. avoid_failed_destinations (integer)
4. Functions
@ -112,21 +114,23 @@ Lucian Balaceanu
1.8. Set use_domain parameter
1.9. Set fallback_default parameter
1.10. Set fetch_rows parameter
1.11. Set match_mode parameter
1.12. cr_replace_host usage
1.13. cr_deactivate_host usage
1.14. cr_activate_host usage
1.15. cr_add_host usage
1.16. cr_delete_host usage
1.17. Configuration example - Routing to default tree
1.18. Configuration example - Routing to user tree
1.19. Configuration example - module configuration
1.20. Example database content - carrierroute table
1.21. Example database content - simple carrierfailureroute table
1.22. Example database content - more complex carrierfailureroute table
1.23. Example database content - carrier_name table
1.24. Example database content - domain_name table
1.25. Necessary extensions for the user table
1.11. Unset db_load_description parameter
1.12. Set match_mode parameter
1.13. Set avoid_failed_destinations parameter
1.14. cr_replace_host usage
1.15. cr_deactivate_host usage
1.16. cr_activate_host usage
1.17. cr_add_host usage
1.18. cr_delete_host usage
1.19. Configuration example - Routing to default tree
1.20. Configuration example - Routing to user tree
1.21. Configuration example - module configuration
1.22. Example database content - carrierroute table
1.23. Example database content - simple carrierfailureroute table
1.24. Example database content - more complex carrierfailureroute table
1.25. Example database content - carrier_name table
1.26. Example database content - domain_name table
1.27. Necessary extensions for the user table
2.1. Set db_url parameter
2.2. Set carrierroute_table parameter
2.3. Set carrierroute_id_col parameter
@ -180,7 +184,9 @@ Chapter 1. Admin Guide
3.8. use_domain (int)
3.9. fallback_default (int)
3.10. fetch_rows (integer)
3.11. match_mode (integer)
3.11. db_load_description (integer)
3.12. match_mode (integer)
3.13. avoid_failed_destinations (integer)
4. Functions
@ -299,7 +305,9 @@ Chapter 1. Admin Guide
3.8. use_domain (int)
3.9. fallback_default (int)
3.10. fetch_rows (integer)
3.11. match_mode (integer)
3.11. db_load_description (integer)
3.12. match_mode (integer)
3.13. avoid_failed_destinations (integer)
3.1. subscriber_table (string)
@ -425,7 +433,20 @@ modparam("carrierroute", "fallback_default", 1)
modparam("carrierroute", "fetch_rows", 3000)
...
3.11. match_mode (integer)
3.11. db_load_description (integer)
Toggle on/off loading in memory the description column in the
carrierroute/carrierfailureroute database tables. This reduces the
shared memory used by the module.
Default value is “1”.
Example 1.11. Unset db_load_description parameter
...
modparam("carrierroute", "db_load_description", 0)
...
3.12. match_mode (integer)
The number of individual characters that are used for matching. Valid
values are 10 or 128. When you specifiy 10, only digits will be used
@ -436,11 +457,24 @@ modparam("carrierroute", "fetch_rows", 3000)
Default value is “10”.
Example 1.11. Set match_mode parameter
Example 1.12. Set match_mode parameter
...
modparam("carrierroute", "match_mode", 10)
...
3.13. avoid_failed_destinations (integer)
Integer parameter to toggle on/off the possibility that in the
failurerouting cases destinations that previously failed are avoided.
Possible values are 0 (off), 1 (on). Also see cr_route section.
Default value is “1”.
Example 1.13. Set avoid_failed_destinations parameter
...
modparam("carrierroute", "avoid_failed_destinations", 0)
...
4. Functions
4.1. cr_user_carrier(user, domain, dstavp)
@ -500,10 +534,12 @@ descavp)
This is useful if you need some additional informations that belongs to
each gw, like the destination or the number of channels.
The function pays special attention to the failurerouting cases, so
that any destination that has failed to provide a successful response
will not be reused in a subsequent call of cr_route. This situation can
appear when different route domains contain a set of common gateways.
Depending on the value of the avoid_failed_destinations module
parameter, the function pays special attention to the failurerouting
cases, so that any destination that has failed to provide a successful
response will not be reused in a subsequent call of cr_route. This
situation can appear when different route domains contain a set of
common gateways.
This function is only usable with rewrite_user and prefix_matching
containing a valid string. This string needs to be numerical if the
@ -648,7 +684,7 @@ dstavp)
Use the "null" prefix to specify an empty prefix.
Example 1.12. cr_replace_host usage
Example 1.14. cr_replace_host usage
...
kamctl fifo cr_replace_host "-d proxy -p 49 -h proxy1 -t proxy2"
...
@ -669,7 +705,7 @@ kamctl fifo cr_replace_host "-d proxy -p 49 -h proxy1 -t proxy2"
Use the "null" prefix to specify an empty prefix.
Example 1.13. cr_deactivate_host usage
Example 1.15. cr_deactivate_host usage
...
kamctl fifo cr_deactivate_host "-d proxy -p 49 -h proxy1"
...
@ -684,7 +720,7 @@ kamctl fifo cr_deactivate_host "-d proxy -p 49 -h proxy1"
Use the "null" prefix to specify an empty prefix.
Example 1.14. cr_activate_host usage
Example 1.16. cr_activate_host usage
...
kamctl fifo cr_activate_host "-d proxy -p 49 -h proxy1"
...
@ -704,7 +740,7 @@ kamctl fifo cr_activate_host "-d proxy -p 49 -h proxy1"
Use the "null" prefix to specify an empty prefix.
Example 1.15. cr_add_host usage
Example 1.17. cr_add_host usage
...
kamctl fifo cr_add_host "-d proxy -p 49 -h proxy1 -w 0.25"
...
@ -725,14 +761,14 @@ kamctl fifo cr_add_host "-d proxy -p 49 -h proxy1 -w 0.25"
Use the "null" prefix to specify an empty prefix.
Example 1.16. cr_delete_host usage
Example 1.18. cr_delete_host usage
...
kamctl fifo cr_delete_host "-d proxy -p 49 -h proxy1 -w 0.25"
...
6. Configuration examples
Example 1.17. Configuration example - Routing to default tree
Example 1.19. Configuration example - Routing to default tree
...
route {
# route calls based on hash over callid
@ -766,7 +802,7 @@ failure_route[2] {
# further processing
}
Example 1.18. Configuration example - Routing to user tree
Example 1.20. Configuration example - Routing to user tree
...
route[1] {
cr_user_carrier("$fU", "$fd", "$avp(s:carrier)");
@ -808,7 +844,7 @@ failure_route[1] {
}
...
Example 1.19. Configuration example - module configuration
Example 1.21. Configuration example - module configuration
The following config file specifies within the default carrier two
domains, each with an prefix that contains two hosts. It is not
@ -891,7 +927,7 @@ domain register {
7.2. Database examples
Example 1.20. Example database content - carrierroute table
Example 1.22. Example database content - carrierroute table
...
+----+---------+--------+-------------+-------+------+---------------+
| id | carrier | domain | scan_prefix | flags | prob | rewrite_host |
@ -928,7 +964,7 @@ domain register {
flags are not set, the other two rules are used. The “strip”, “mask”
and “comment” colums are omitted for brevity.
Example 1.21. Example database content - simple carrierfailureroute
Example 1.23. Example database content - simple carrierfailureroute
table
...
+----+---------+--------+---------------+------------+-------------+
@ -950,7 +986,7 @@ domain register {
entry in the carrierroute table, otherwise the module will not load the
routing data.
Example 1.22. Example database content - more complex
Example 1.24. Example database content - more complex
carrierfailureroute table
...
+----+---------+-----------+------------+--------+-----+-------------+
@ -977,7 +1013,7 @@ domain register {
that holds domain entries for this routing rules. Not all table colums
are show here for brevity.
Example 1.23. Example database content - carrier_name table
Example 1.25. Example database content - carrier_name table
...
+----+----------+
| id | carrier |
@ -990,7 +1026,7 @@ domain register {
This table contains the mapping of the carrier id to actual names.
Example 1.24. Example database content - domain_name table
Example 1.26. Example database content - domain_name table
...
+----+----------+
| id | domain |
@ -1010,7 +1046,7 @@ domain register {
specified as modul parameter) to choose the actual carrier for the
users.
Example 1.25. Necessary extensions for the user table
Example 1.27. Necessary extensions for the user table
Suggested changes:
...

@ -12,9 +12,9 @@ Edited by
Richard Good
Copyright © 2006 FhG Fokus
Copyright © 2006 FhG Fokus
Copyright © 2012 Smile Communications
Copyright © 2012 Smile Communications
__________________________________________________________________
Table of Contents
@ -32,6 +32,7 @@ Richard Good
4.1. config_file (string)
4.2. latency_threshold (int)
4.3. workerq_length_threshold_percentage (int)
5. RPC Commands
@ -121,7 +122,8 @@ Richard Good
1.1. Set config_file parameter
1.2. Set latency_threshold parameter
1.3. DiameterPeer.xml example
1.3. Set workerq_length_threshold_percentage parameter
1.4. DiameterPeer.xml example
Chapter 1. Admin Guide
@ -138,6 +140,7 @@ Chapter 1. Admin Guide
4.1. config_file (string)
4.2. latency_threshold (int)
4.3. workerq_length_threshold_percentage (int)
5. RPC Commands
@ -203,12 +206,13 @@ Chapter 1. Admin Guide
4.1. config_file (string)
4.2. latency_threshold (int)
4.3. workerq_length_threshold_percentage (int)
4.1. config_file (string)
This is the location of the XML configuration file.
Default value is "DiameterPeer.xml".
Default value is “DiameterPeer.xml”.
Example 1.1. Set config_file parameter
...
@ -220,13 +224,26 @@ modparam("cdp", "config_file", "/etc/kamailio/diametercfg.xml")
The time in ms above which a log error is wrtten to log file for long
CDP transactions.
Default value is "500".
Default value is “500”.
Example 1.2. Set latency_threshold parameter
...
modparam("cdp", "latency_threshold", 1000)
...
4.3. workerq_length_threshold_percentage (int)
The threshold of the length of the worker queue as a percentage of the
maximum queue size - when exceeded a warning is written to the log
file. 0 means disabled
Default value is “0”.
Example 1.3. Set workerq_length_threshold_percentage parameter
...
modparam("cdp", "workerq_length_threshold_percentage", 25)
...
5. RPC Commands
5.1. cdp.disable_peer
@ -252,7 +269,7 @@ modparam("cdp", "latency_threshold", 1000)
This is an example CDP configuration file. The location of this file is
configured as a CDP parameter (config_file) - See section 4.1 Above
Example 1.3. DiameterPeer.xml example
Example 1.4. DiameterPeer.xml example
<?xml version="1.0" encoding="UTF-8"?>
<!--
@ -825,31 +842,31 @@ Chapter 3. Frequently Asked Questions
3.1.
Where can I find more about Kamailio?
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
Take a look at http://www.kamailio.org/.
3.2.
Where can I post a question about this module?
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
3.3.
How can I report a bug?
How can I report a bug?
Please follow the guidelines provided at:
http://sip-router.org/tracker.
Please follow the guidelines provided at:
https://github.com/kamailio/kamailio/issues.

@ -277,7 +277,7 @@ int peer_timer(time_t now,void *ptr)
}
if (p->activity+config->tc<=now){
LM_INFO("peer_timer(): Peer %.*s \tState %d \n",p->fqdn.len,p->fqdn.s,p->state);
LM_DBG("peer_timer(): Peer %.*s \tState %d \n",p->fqdn.len,p->fqdn.s,p->state);
switch (p->state){
/* initiating connection */
case Closed:

@ -520,7 +520,7 @@ error:
* @param p - peer to send to
* @returns the new state for the peer
*/
peer_state_t I_Snd_Conn_Req(peer *p)
peer_event_t I_Snd_Conn_Req(peer *p)
{
LM_INFO("I_Snd_Conn_Req(): Peer %.*s \n",
p->fqdn.len,p->fqdn.s);

@ -52,7 +52,7 @@
int sm_process(peer *p,peer_event_t event,AAAMessage *msg,int peer_locked,int sock);
peer_state_t I_Snd_Conn_Req(peer *p);
peer_event_t I_Snd_Conn_Req(peer *p);
void Cleanup(peer *p,int sock);
void Error(peer *p, int sock);
void I_Snd_CER(peer *p);

@ -75,7 +75,7 @@ unsigned int *session_id2; /**< counter for second part of the session id */
inline void AAASessionsLock(unsigned int hash)
{
if(destroy_modules_phase()) return;
if ( hash >=0 && hash < sessions_hash_size ){
if ( hash < sessions_hash_size ){
lock_get(sessions[hash].lock);
}
else {
@ -90,7 +90,7 @@ inline void AAASessionsUnlock(unsigned int hash)
{
if(destroy_modules_phase()) return;
if ( hash >=0 && hash < sessions_hash_size ){
if ( hash < sessions_hash_size ){
lock_release(sessions[hash].lock);
}
else {
@ -332,7 +332,7 @@ void del_session(cdp_session_t *x)
if (!x) return;
hash = x->hash;
if (hash < 0 || hash >= sessions_hash_size) {
if (hash >= sessions_hash_size) {
LM_ERR("del_session: x->hash :%d out of range of sessions_hash_size: %d !\n",hash, sessions_hash_size);
return;
}

@ -12,9 +12,9 @@ Edited by
Richard Good
Copyright © 2006 FhG Fokus
Copyright © 2006 FhG Fokus
Copyright © 2012 Smile Communications
Copyright © 2012 Smile Communications
__________________________________________________________________
Table of Contents
@ -1658,31 +1658,31 @@ Chapter 3. Frequently Asked Questions
3.1.
Where can I find more about Kamailio?
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
Take a look at http://www.kamailio.org/.
3.2.
Where can I post a question about this module?
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
3.3.
How can I report a bug?
How can I report a bug?
Please follow the guidelines provided at:
http://sip-router.org/tracker.
Please follow the guidelines provided at:
https://github.com/kamailio/kamailio/issues.

@ -4,7 +4,7 @@ Tomas Mandys
Iptel.org
Copyright © 2008 Tomas Mandys
Copyright © 2008 Tomas Mandys
__________________________________________________________________
Table of Contents

@ -4,7 +4,7 @@ Miklos Tirpak
<miklos@iptel.org>
Copyright © 2007 iptelorg GmbH
Copyright © 2007 iptelorg GmbH
__________________________________________________________________
Table of Contents
@ -84,7 +84,7 @@ Chapter 1. Admin Guide
For example, it can be used to fine-tune values for global parameters
such as debug, tcp/sctp/dns attributes, without the need of restart.
RPC connector modules, such as "ctl" or "xmlrpc", although not a
RPC connector modules, such as “ctl” or “xmlrpc”, although not a
dependecy, should be loaded in order to execute the RPC commands
exported by this module. When the ctl module is loaded, the tool
'kamcmd' can be used to execute the RPC commands implemented in this

@ -542,7 +542,8 @@ unlock("$rU");
4.17. check_route_exists(route)
Check if a route block exists
Check if a route block exists. It returns true (1) on found and false
on not found or error.
Parameters:
@ -553,7 +554,7 @@ unlock("$rU");
Example 1.21. check_route_exists() usage
...
if(check_route_exists("FROGJUMP") {
if(check_route_exists("JUMP") {
$var(jumping_frogs) = 1;
};
...
@ -563,6 +564,9 @@ if(check_route_exists("FROGJUMP") {
Execute a routing block only if it is defined. If it's not defined,
silently move to the next action in the configuration script.
It returns the code of last action in the route block, if that exists,
or false if the route doesn't exists or was an error executing it.
Parameters:
"name" of a route block in the config file, like "route[FROGJUMP]"
@ -572,7 +576,9 @@ if(check_route_exists("FROGJUMP") {
Example 1.22. route_if_exists() usage
...
route_if_exists("PRESENCE_SANTA_CLAUS");
if(route_if_exists("JUMP")) {
exit;
}
...
4.19. core_hash(string1, string2, size)

@ -94,8 +94,8 @@ static int dbg_pkg_status(struct sip_msg*, char*,char*);
static int dbg_shm_status(struct sip_msg*, char*,char*);
static int dbg_pkg_summary(struct sip_msg*, char*,char*);
static int dbg_shm_summary(struct sip_msg*, char*,char*);
static int route_exists(struct sip_msg*, char*);
static int check_route_exists(struct sip_msg*, char*);
static int w_route_exists(struct sip_msg*, char*);
static int w_check_route_exists(struct sip_msg*, char*);
static int set_gflag(struct sip_msg*, char *, char *);
static int reset_gflag(struct sip_msg*, char *, char *);
@ -183,9 +183,9 @@ static cmd_export_t cmds[]={
ANY_ROUTE},
{"core_hash", (cmd_function)w_core_hash, 3, fixup_core_hash, 0,
ANY_ROUTE},
{"check_route_exists", (cmd_function)check_route_exists, 1, 0, 0,
{"check_route_exists", (cmd_function)w_check_route_exists, 1, 0, 0,
ANY_ROUTE},
{"route_if_exists", (cmd_function)route_exists, 1, 0, 0,
{"route_if_exists", (cmd_function)w_route_exists, 1, 0, 0,
ANY_ROUTE},
{"bind_cfgutils", (cmd_function)bind_cfgutils, 0,
0, 0, 0},
@ -860,29 +860,32 @@ static int cfg_unlock(struct sip_msg *msg, char *key, char *s2)
/*! Check if a route block exists - only request routes
*/
static int check_route_exists(struct sip_msg *msg, char *route)
static int w_check_route_exists(struct sip_msg *msg, char *route)
{
if (route_lookup(&main_rt, route))
return 1;
return 0;
if (route_lookup(&main_rt, route)<0) {
/* not found */
return -1;
}
return 1;
}
/*! Run a request route block if it exists
*/
static int route_exists(struct sip_msg *msg, char *route)
static int w_route_exists(struct sip_msg *msg, char *route)
{
struct run_act_ctx ctx;
int newroute, backup_rt;
int newroute, backup_rt, ret;
if (!(newroute = route_lookup(&main_rt, route))) {
return 0;
newroute = route_lookup(&main_rt, route);
if (newroute<0) {
return -1;
}
backup_rt = get_route_type();
set_route_type(REQUEST_ROUTE);
init_run_actions_ctx(&ctx);
run_top_route(main_rt.rlist[newroute], msg, 0);
ret = run_top_route(main_rt.rlist[newroute], msg, &ctx);
set_route_type(backup_rt);
return 0;
return ret;
}
static int mod_init(void)

@ -529,7 +529,8 @@ unlock("$rU");
<section id="cfgutils.f.check_route_exists">
<title><function moreinfo="none">check_route_exists(route)</function></title>
<para>
Check if a route block exists
Check if a route block exists. It returns true (1) on found and false on
not found or error.
</para>
<para>Parameters:</para>
<para>
@ -543,7 +544,7 @@ unlock("$rU");
<title><function moreinfo="none">check_route_exists()</function> usage</title>
<programlisting format="linespecific">
...
if(check_route_exists("FROGJUMP") {
if(check_route_exists("JUMP") {
$var(jumping_frogs) = 1;
};
...
@ -556,6 +557,10 @@ if(check_route_exists("FROGJUMP") {
Execute a routing block only if it is defined. If it's not defined, silently
move to the next action in the configuration script.
</para>
<para>
It returns the code of last action in the route block, if that exists, or
false if the route doesn't exists or was an error executing it.
</para>
<para>Parameters:</para>
<para>
<quote>name</quote> of a route block in the config file, like <quote>route[FROGJUMP]</quote>
@ -568,7 +573,9 @@ if(check_route_exists("FROGJUMP") {
<title><function moreinfo="none">route_if_exists()</function> usage</title>
<programlisting format="linespecific">
...
route_if_exists("PRESENCE_SANTA_CLAUS");
if(route_if_exists("JUMP")) {
exit;
}
...
</programlisting>
</example>

@ -265,6 +265,13 @@ static int __mod_init(void) {
_data.channel.credit_data_by_client = shm_malloc(sizeof(struct str_hash_table));
_data.channel.call_data_by_cid = shm_malloc(sizeof(struct str_hash_table));
memset(_data.time.credit_data_by_client, 0, sizeof(struct str_hash_table));
memset(_data.time.call_data_by_cid, 0, sizeof(struct str_hash_table));
memset(_data.money.credit_data_by_client, 0, sizeof(struct str_hash_table));
memset(_data.money.call_data_by_cid, 0, sizeof(struct str_hash_table));
memset(_data.channel.credit_data_by_client, 0, sizeof(struct str_hash_table));
memset(_data.channel.call_data_by_cid, 0, sizeof(struct str_hash_table));
_data.stats = (stats_t *) shm_malloc(sizeof(stats_t));
if (!_data.stats) {
@ -655,17 +662,19 @@ static void __stop_billing(str *callid) {
* Remove (and free) the call from the list of calls of the current credit_data
*/
clist_rm(call, next, prev);
/*
* don't free the call if all the credit data is being deallocated,
* it will be freed by terminate_all_calls()
/* return if credit_data is being deallocated.
* the call and the credit data will be freed by terminate_all_calls()
*/
if (!credit_data->deallocating) {
__free_call(call);
if (credit_data->deallocating) {
return;
}
__free_call(call);
/*
* In case there are no active calls for a certain client, we remove the client-id from the hash table.
* This way, we can save memory for useful clients.
*
*/
if (credit_data->number_of_calls == 0) {
LM_DBG("Removing client [%.*s] and its calls from the list\n", credit_data->call_list->client_id.len, credit_data->call_list->client_id.s);
@ -882,9 +891,29 @@ exit:
}
// must be called with lock held on credit_data
/* terminate all calls and remove credit_data */
void terminate_all_calls(credit_data_t *credit_data) {
call_t *call = NULL,
*tmp = NULL;
struct str_hash_entry *cd_entry = NULL;
hash_tables_t *hts = NULL;
switch(credit_data->type) {
case CREDIT_MONEY:
hts = &_data.money;
break;
case CREDIT_TIME:
hts = &_data.time;
break;
case CREDIT_CHANNEL:
hts = &_data.channel;
break;
default:
LM_ERR("BUG: Something went terribly wrong\n");
return;
}
cd_entry = str_hash_get(hts->credit_data_by_client, credit_data->call_list->client_id.s, credit_data->call_list->client_id.len);
credit_data->deallocating = 1;
@ -902,6 +931,36 @@ void terminate_all_calls(credit_data_t *credit_data) {
LM_WARN("invalid call structure %p\n", call);
}
}
cnxcc_lock(hts->lock);
if (_data.redis) {
redis_clean_up_if_last(credit_data);
shm_free(credit_data->str_id);
}
/*
* Remove the credit_data_t from the hash table
*/
str_hash_del(cd_entry);
cnxcc_unlock(hts->lock);
/*
* Free client_id in list's root
*/
shm_free(credit_data->call_list->client_id.s);
shm_free(credit_data->call_list);
/*
* Release the lock since we are going to free the entry down below
*/
cnxcc_unlock(credit_data->lock);
/*
* Free the whole entry
*/
__free_credit_data_hash_entry(cd_entry);
}
/*
@ -1099,6 +1158,11 @@ no_memory:
static credit_data_t *__alloc_new_credit_data(str *client_id, credit_type_t type) {
credit_data_t *credit_data = shm_malloc(sizeof(credit_data_t));;
if (credit_data == NULL)
goto no_memory;
memset(credit_data, 0, sizeof(credit_data_t));
cnxcc_lock_init(credit_data->lock);
credit_data->call_list = shm_malloc(sizeof(call_t));

@ -10,11 +10,13 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Edited by
Muhammad Shahzad Shafi
<shahzad@voip-demos.com>
Copyright © 2012 asipto.com
Copyright © 2012 asipto.com
__________________________________________________________________
Table of Contents
@ -170,12 +172,12 @@ Chapter 1. Admin Guide
3.1. alias_subdomains (string)
Register a domain and all its sub-domains to match the "myself"
Register a domain and all its sub-domains to match the “myself”
condition. It can be set many times. Its full format is:
'proto:domain:port', allowing to set restrictions on protocol and port
as well. Protocol and port are optional.
Default value is "NULL".
Default value is “NULL”.
Example 1.1. Set alias_subdomains parameter
...
@ -237,7 +239,7 @@ modparam("corex", "msg_avp", "$avp(msg)")
4.9. file_read(fpath, var)
4.10. file_write(fpath, content)
4.1. append_branch([ uri, [ q ] ])
4.1. append_branch([ uri, [ q ] ])
Append a new branch to the destination set, useful to build the set of
destination addresses for parallel forking or redirect replies.
@ -259,7 +261,7 @@ modparam("corex", "msg_avp", "$avp(msg)")
append_branch("$avp(uri)", "0.5");
...
4.2. send([ host [ :port ] ])
4.2. send([ host [ :port ] ])
Send the original SIP message to a specific destination in stateless
mode. No changes are applied to received message, no Via header is
@ -281,12 +283,12 @@ modparam("corex", "msg_avp", "$avp(msg)")
send("$var(res)");
...
4.3. send_tcp([ host [ :port ] ])
4.3. send_tcp([ host [ :port ] ])
This function is identical to send() described above, except that it
sends the SIP message using the TCP protocol instead of UDP.
4.4. send_data(uri, data)
4.4. send_data(uri, data)
Send the data to address specified by uri. Both parameters can contain
pseudo-variables. The uri parameter has to be a valid SIP URI. The data
@ -299,7 +301,7 @@ modparam("corex", "msg_avp", "$avp(msg)")
send_data("sip:example.com:5070;transport=sctp", "Message at $Ts");
...
4.5. is_incoming()
4.5. is_incoming()
Returns true if contents of message buffer $mb are the data received
from remote host, otherwise false indicating that the contents of $mb
@ -321,7 +323,7 @@ event_route[network:msg] {
}
...
4.6. msg_iflag_set(flagname)
4.6. msg_iflag_set(flagname)
Set internal SIP message flag. The parameter flagname can be:
USE_UAC_FROM, USE_UAC_TO or UAC_AUTH.
@ -338,7 +340,7 @@ event_route[network:msg] {
msg_iflag_set("UAC_AUTH");
...
4.7. msg_iflag_reset(flagname)
4.7. msg_iflag_reset(flagname)
Reset the internal flag given as parameter.
@ -349,7 +351,7 @@ event_route[network:msg] {
msg_iflag_reset("UAC_AUTH");
...
4.8. msg_iflag_is_set(flagname)
4.8. msg_iflag_is_set(flagname)
Test if the internal flag given as parameter is set.
@ -360,7 +362,7 @@ event_route[network:msg] {
if(msg_iflag_is_set("UAC_AUTH")) { ... }
...
4.9. file_read(fpath, var)
4.9. file_read(fpath, var)
Read content of a text file into a variable.
@ -371,7 +373,7 @@ event_route[network:msg] {
if(file_read("/tmp/data.txt", "$var(data)")) { ... }
...
4.10. file_write(fpath, content)
4.10. file_write(fpath, content)
Write content of parameter to a text file.
@ -390,35 +392,35 @@ if(file_write("/tmp/data.txt", "Data is: $var(data)")) { ... }
5.4. corex.shm_summary
5.5. corex.pkg_summary
5.1. corex.list_sockets
5.1. corex.list_sockets
Print the list of sockets the application is listening on.
Example:
kamcmd corex.list_sockets
5.2. corex.list_aliases
5.2. corex.list_aliases
Print the list of hostname aliases used to match the myself condition.
Example:
kamcmd corex.list_aliases
5.3. corex.shm_status
5.3. corex.shm_status
Trigger shm status dump to syslog.
Example:
kamcmd corex.shm_status
5.4. corex.shm_summary
5.4. corex.shm_summary
Trigger shm summary dump to syslog.
Example:
kamcmd corex.shm_summary
5.5. corex.pkg_summary
5.5. corex.pkg_summary
Trigger pkg summary dump to syslog for a specific pid or process index.
It has two parameters: first to specify what matching type is desired
@ -435,7 +437,7 @@ if(file_write("/tmp/data.txt", "Data is: $var(data)")) { ... }
6.1. event_route[network:msg]
6.1. event_route[network:msg]
6.1. event_route[network:msg]
Event route block to be executed when new data is received from network
or the data that is about to be sent to a remote host by a SIP worker

@ -1,12 +1,11 @@
Counters Module
Andrei Pelinescu-Onciul
iptelorg GmbH
Copyright © 2010 iptelorg GmbH
_________________________________________________________________
Copyright © 2010 iptelorg GmbH
__________________________________________________________________
Table of Contents
@ -20,9 +19,9 @@ Andrei Pelinescu-Onciul
3. Functions
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
4. counters RPC Functions
@ -35,8 +34,8 @@ Andrei Pelinescu-Onciul
List of Examples
1.1. Create a new script_counter
1.2. Set script_cnt_grp_name in the config file
1.1. Create a new script_counter
1.2. Set script_cnt_grp_name in the config file
1.3. cnt_inc usage
1.4. cnt_add usage
1.5. cnt_reset usage
@ -59,9 +58,9 @@ Chapter 1. Admin Guide
3. Functions
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
4. counters RPC Functions
@ -74,7 +73,7 @@ Chapter 1. Admin Guide
1. Overview
This module exports counters/statistics manipulating script functions
This module exports counters/statistics manipulating script functions
and RPCs.
2. Parameters
@ -85,15 +84,15 @@ Chapter 1. Admin Guide
2.1. script_counter
Define a new counter that can be used from the script. The declaration
might include a group in front of the counter name, separated with
'.'. It might also include a counter description string (help
message), separated from the name with a ' ' or ':'. If the group is
missing, the group defined in the script_cnt_grp_name module parameter
will be used (the default is "script"). If the description is missing,
the default is "custom script counter". The format of the declaration
is: [group.]name[( |:)description].
Example 1.1. Create a new script_counter
might include a group in front of the counter name, separated with '.'.
It might also include a counter description string (help message),
separated from the name with a ' ' or ':'. If the group is missing, the
group defined in the script_cnt_grp_name module parameter will be used
(the default is "script"). If the description is missing, the default
is "custom script counter". The format of the declaration is:
[group.]name[( |:)description].
Example 1.1. Create a new script_counter
modparam("counters", "script_counter", "foo") # script.foo
modparam("counters", "script_counter", "test.bar") # test.bar
modparam("counters", "script_counter", "baz example counter") # script.baz
@ -101,23 +100,23 @@ modparam("counters", "script_counter", "test.x:another example") # test.x
2.2. script_cnt_grp_name
Group name that will be used for the counters defined via the
Group name that will be used for the counters defined via the
script_counter module parameter which do not have a specified group.
Default: "script".
Example 1.2. Set script_cnt_grp_name in the config file
Example 1.2. Set script_cnt_grp_name in the config file
modparam("counters", "script_cnt_grp_name", "my_counters")
3. Functions
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
3.1. cnt_inc([group.]name)
3.2. cnt_add([group.]name, number)
3.3. cnt_reset([group.]name)
3.1. cnt_inc([group.]name)
Increments the counter group.name. The counter must be defined using
Increments the counter group.name. The counter must be defined using
the script_counter module parameter. If the group name is missing, the
group specified by the script_cnt_grp_name modparam will be used.
@ -135,7 +134,7 @@ route {
3.2. cnt_add([group.]name, number)
Adds number the counter group.name. The counter must be defined using
Adds number the counter group.name. The counter must be defined using
the script_counter module parameter. If the group name is missing, the
group specified by the script_cnt_grp_name modparam will be used.
@ -150,8 +149,8 @@ route {
3.3. cnt_reset([group.]name)
Resets the counter group.name. The counter must be defined using the
script_counter module parameter. If the group name is missing, the
Resets the counter group.name. The counter must be defined using the
script_counter module parameter. If the group name is missing, the
group specified by the script_cnt_grp_name modparam will be used.
Example 1.5. cnt_reset usage
@ -196,7 +195,7 @@ route {
4.4. cnt.var_list group
Lists all the names of all the counters belonging to the specified
Lists all the names of all the counters belonging to the specified
group.
Example 1.9. cnt.var_list group usage

@ -8,7 +8,7 @@ Edited by
Bogdan-Andrei Iancu
Copyright © 2003 FhG FOKUS
Copyright © 2003 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -180,7 +180,7 @@ Chapter 1. Admin Guide
name and password can be specified for allowing the module to connect
to the database server.
Default value is "mysql://kamailio:kamailiorw@localhost/kamailio".
Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”.
Example 1.1. Set db_url parameter
...
@ -190,11 +190,11 @@ modparam("cpl-c","db_url","dbdriver://username:password@dbhost/dbname")
3.2. db_table (string)
Indicates the name of the table that store the CPL scripts. This table
must be locate into the database specified by "db_url" parameter. For
must be locate into the database specified by “db_url” parameter. For
more about the format of the CPL table please see the
modules/cpl-c/init.mysql file.
Default value is "cpl".
Default value is “cpl”.
Example 1.2. Set db_table parameter
...
@ -205,7 +205,7 @@ modparam("cpl-c","cpl_table","cpl")
Indicates the name of the column used for storing the username.
Default value is "username".
Default value is “username”.
Example 1.3. Set username_column parameter
...
@ -216,7 +216,7 @@ modparam("cpl-c","username_column","username")
Indicates the name of the column used for storing the domain.
Default value is "domain".
Default value is “domain”.
Example 1.4. Set domain_column parameter
...
@ -228,7 +228,7 @@ modparam("cpl-c","domain_column","domain")
Indicates the name of the column used for storing the the XML version
of the cpl script.
Default value is "cpl_xml".
Default value is “cpl_xml”.
Example 1.5. Set cpl_xml_column parameter
...
@ -240,7 +240,7 @@ modparam("cpl-c","cpl_xml_column","cpl_xml")
Indicates the name of the column used for storing the the binary
version of the cpl script (compiled version).
Default value is "cpl_bin".
Default value is “cpl_bin”.
Example 1.6. Set cpl_bin_column parameter
...
@ -378,7 +378,7 @@ modparam("cpl-c","lookup_append_branches",1)
Indicates if the domain part of the URI should be used in user
identification (otherwise only username part will be used).
Default value is "0 (disabled)".
Default value is “0 (disabled)”.
Example 1.16. Set use_domain parameter
...
@ -391,7 +391,7 @@ modparam("cpl-c","use_domain",1)
4.2. cpl_process_register()
4.3. cpl_process_register_norpl()
4.1. cpl_run_script(type,mode, [uri])
4.1. cpl_run_script(type,mode, [uri])
Starts the execution of the CPL script. The user name is fetched from
new_uri or requested uri or from To header -in this order- (for
@ -448,7 +448,7 @@ modparam("cpl-c","use_domain",1)
cpl_run_script("incoming","force_stateful");
...
4.2. cpl_process_register()
4.2. cpl_process_register()
This function MUST be called only for REGISTER requests. It checks if
the current REGISTER request is related or not with CPL script
@ -476,9 +476,9 @@ if (method=="REGISTER") {
}
...
4.3. cpl_process_register_norpl()
4.3. cpl_process_register_norpl()
Same as "cpl_process_register" without internally generating the reply.
Same as “cpl_process_register” without internally generating the reply.
All information (script) is appended to the reply but without sending
it out.
@ -502,7 +502,7 @@ if (method=="REGISTER") {
5.2. REMOVE_CPL
5.3. GET_CPL
5.1. LOAD_CPL
5.1. LOAD_CPL
For the given user, loads the XML cpl file, compiles it into binary
format and stores both format into database.
@ -519,7 +519,7 @@ if (method=="REGISTER") {
cpl_filename
_empty_line_
5.2. REMOVE_CPL
5.2. REMOVE_CPL
For the given user, removes the entire database record (XML cpl and
binary cpl); user with empty cpl scripts are not accepted.
@ -534,7 +534,7 @@ if (method=="REGISTER") {
username
_empty_line_
5.3. GET_CPL
5.3. GET_CPL
For the given user, returns the CPL script in XML format.

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2016 asipto.com
Copyright © 2016 asipto.com
__________________________________________________________________
Table of Contents
@ -127,7 +127,7 @@ modparam("crypto", "register_callid", 1)
4.1. crypto_aes_encrypt(text, key, res)
4.2. crypto_aes_decrypt(text, key, res)
4.1. crypto_aes_encrypt(text, key, res)
4.1. crypto_aes_encrypt(text, key, res)
Encrypts the text with the key using AES encryption algorithm. The
result is encoded in base64 format and stored in res. The parameter res
@ -141,7 +141,7 @@ modparam("crypto", "register_callid", 1)
crypto_aes_encrypt("$rb", "my-secret-key", "$var(encrypted)");
...
4.2. crypto_aes_decrypt(text, key, res)
4.2. crypto_aes_decrypt(text, key, res)
Decrypts the text with the key using AES encryption algorithm. The text
has to be encoded in base64 format. The parameter res must be a

@ -4,7 +4,7 @@ Andrei Pelinescu-Onciul
iptelorg GmbH
Copyright Š 2009 iptelorg GmbH
Copyright © 2009 iptelorg GmbH
__________________________________________________________________
Table of Contents

@ -1,12 +1,11 @@
db2_ldap module
Jan Janak
Iptel.org
Copyright © 2008 Iptel.org GmBH
_________________________________________________________________
Copyright © 2008 Iptel.org GmBH
__________________________________________________________________
Table of Contents
@ -43,56 +42,56 @@ Chapter 1. Admin Guide
1. Overview
The LDAP module is database driver, i.e. it implements DBv2 API
functions. The goal is map database query defined by table, matching
fields and result fields to LDAP search in sub-tree defined by root,
object class, attributes and pass it to the OpenLDAP which
communicates with the LDAP server.
The LDAP module is database driver, i.e. it implements DBv2 API
functions. The goal is map database query defined by table, matching
fields and result fields to LDAP search in sub-tree defined by root,
object class, attributes and pass it to the OpenLDAP which communicates
with the LDAP server.
This procedure is sometimes tricky because the LDAP does not support
all database features or supports them in different manner. Here we
This procedure is sometimes tricky because the LDAP does not support
all database features or supports them in different manner. Here we
must express especially filtering and multi-values. The multi-value is
de facto array of single values. If the LDAP module get a multi-value
field then generates record for every single value, respectively for
de facto array of single values. If the LDAP module get a multi-value
field then generates record for every single value, respectively for
every combination in case the more fields contain multi-value.
The LDAP supports natively "AND", "OR", "NOT" logical operators and
"equal", "non-equal", "less-or-equal" and "greater-or-equal"
comparison operators. Therefore "less" and "greater" operators are
mapped as "less/greater-or-equal-AND-not-equal". It's important
realize it when the attribute which will be used for filtering may
contain multi-value. The LDAP server evaluates comparison operator on
multi-value so that the result for record is true if the condition is
satisfied for any single value. The single values not satisfying
condition are not truncated. It implies two cases for positive
comparison, e.g. "equal", the result contains values not satisfying
the condition, the case may be handled by additional filter in the
LDAP module, the negative comparison, e.g. "non-equal", does not
return record at all. Because the LDAP module cannot know if the LDAP
attribute may logically contain multi-value so there is introduced DB
API option client_side_filtering which forces filtering such fields in
the LDAP module, i.e. the LDAP server returns larger result set
because the filtering condition is not passed there.
The syntax of client_side_filtering value is comma delimited of field
names which won't be used for server-side filter if such a field
appears in a match condition. Instead records will be filtered out in
The LDAP supports natively "AND", "OR", "NOT" logical operators and
"equal", "non-equal", "less-or-equal" and "greater-or-equal" comparison
operators. Therefore "less" and "greater" operators are mapped as
"less/greater-or-equal-AND-not-equal". It's important realize it when
the attribute which will be used for filtering may contain multi-value.
The LDAP server evaluates comparison operator on multi-value so that
the result for record is true if the condition is satisfied for any
single value. The single values not satisfying condition are not
truncated. It implies two cases for positive comparison, e.g. "equal",
the result contains values not satisfying the condition, the case may
be handled by additional filter in the LDAP module, the negative
comparison, e.g. "non-equal", does not return record at all. Because
the LDAP module cannot know if the LDAP attribute may logically contain
multi-value so there is introduced DB API option client_side_filtering
which forces filtering such fields in the LDAP module, i.e. the LDAP
server returns larger result set because the filtering condition is not
passed there.
The syntax of client_side_filtering value is comma delimited of field
names which won't be used for server-side filter if such a field
appears in a match condition. Instead records will be filtered out in
module. It implies such fields MUST exist in result field list.
The necessary condition of successful filtering of particular
attribute at the LDAP server is correct attribute definition. The
"equal"/"non-equal" operator requires equality matching rule, the
The necessary condition of successful filtering of particular attribute
at the LDAP server is correct attribute definition. The
"equal"/"non-equal" operator requires equality matching rule, the
"greater"/"less" operator requires ordering matching rule. If required
matching rule is missing the LDAP server silently returns empty result
set. In case of double filtering both at the LDAP servar and the LDAP
module, e.g. multi-value and equal comparison, check the LDAP server
matching rule satisfies your needs or use client_side_filtering
set. In case of double filtering both at the LDAP servar and the LDAP
module, e.g. multi-value and equal comparison, check the LDAP server
matching rule satisfies your needs or use client_side_filtering
feature.
The LDAP server may be identified either complete specification of
host, user, password in URI or is specification reference to
connection section of config file. Note in the second case there is
only one slash.
The LDAP server may be identified either complete specification of
host, user, password in URI or is specification reference to connection
section of config file. Note in the second case there is only one
slash.
Example 1.1. URI example
...
@ -122,10 +121,10 @@ Chapter 1. Admin Guide
Default value is ldap.cfg.
The filename (relatively to ser config file) of mapping database to
The filename (relatively to ser config file) of mapping database to
LDAP definition. It is the main configuration file for the LDAP module
in SER. The configuration file maps database table names used in SER
to LDAP directory sub-trees to be searched. In addition to that the
in SER. The configuration file maps database table names used in SER to
LDAP directory sub-trees to be searched. In addition to that the
configuration file also allows to configure the LDAP search filter and
maps database field names to LDAP attribute names and vice versa.
@ -244,7 +243,7 @@ field_map = flags : (BitString) serFlags
Default value is 3.
Number of reconnect attempts when connection to the LDAP server is
Number of reconnect attempts when connection to the LDAP server is
lost.
Example 1.4. Example reconnect_attempt

@ -35,6 +35,7 @@
#define _SVID_SOURCE 1 /* timegm */
#define _BSD_SOURCE /* snprintf */
#define _DEFAULT_SOURCE 1 /* _BSD_SOURCE is deprecated */
#include "ld_fld.h"

@ -1,12 +1,11 @@
db2_ops module
Tomas Mandys
Iptel.org
Copyright © 2007 Tomas Mandys
_________________________________________________________________
Copyright © 2007 Tomas Mandys
__________________________________________________________________
Table of Contents
@ -23,21 +22,21 @@ Tomas Mandys
5. Functions
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
6. Examples
@ -78,21 +77,21 @@ Chapter 1. Admin Guide
5. Functions
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
6. Examples
@ -114,26 +113,26 @@ Chapter 1. Admin Guide
where = fields
ops = op [ "," op ... ]
order = field
type = "s" | "i" | "d" | "f" | "t" ; enables to force particular type w
hen writing to db driver (string/int/double/float/datetime), valueable especial
ly for datetime
type = "s" | "i" | "d" | "f" | "t" ; enables to force particular type wh
en writing to db driver (string/int/double/float/datetime), valueable especially
for datetime
value = [type ":"] xltext
values = value [ "," value ...]
extra_op = name "=" [type ":"] text
extra_ops = extra_op [ "," extra_op]
select = [database "/"] "select/" table "/" fields "/" where "/" ops "/
" order "/" values [ "/" extra_ops ]
insert = [database "/"] "insert/" table "/" fields "/" values [ "/" ext
ra_ops ]
update = [database "/"] "update/" table "/" fields "/" where "/" ops "/
" values [ "/" extra_ops ]
replace = [database "/"] "replace/" table "/" fields "/" values [ "/" e
xtra_ops ]
delete = [database "/"] "delete/" table "/" where "/" ops "/" values [
"/" extra_ops ]
select = [database "/"] "select/" table "/" fields "/" where "/" ops "/"
order "/" values [ "/" extra_ops ]
insert = [database "/"] "insert/" table "/" fields "/" values [ "/" extr
a_ops ]
update = [database "/"] "update/" table "/" fields "/" where "/" ops "/"
values [ "/" extra_ops ]
replace = [database "/"] "replace/" table "/" fields "/" values [ "/" ex
tra_ops ]
delete = [database "/"] "delete/" table "/" where "/" ops "/" values [ "
/" extra_ops ]
raw_query = [database "/"] "select ...." | "insert ..." [[ / "values" [
"/" extra_ops ]] # not delimited by "/"
"/" extra_ops ]] # not delimited by "/"
query = (select | insert | update | replace | delete | raw_query)
query_id = alphanum
handle = alphanum (plain text possible but alphanum recommended)
@ -161,7 +160,7 @@ xtra_ops ]
4.2. declare_query (string)
Declare query_id for @db.query_id (see select syntax) or for reference
from db_query(query_id). Queries are pre-compiled therefore volatile
from db_query(query_id). Queries are pre-compiled therefore volatile
stuff must be passed via parameters (AVP or so).
The format is:
@ -169,8 +168,8 @@ xtra_ops ]
Example 1.2. Example declare_query
...
modparam("db_ops", "declare_query", "sel1=select/location/received/uid/
//%$f.uid");
modparam("db_ops", "declare_query", "sel1=select/location/received/uid//
/%$f.uid");
...
4.3. declare_handle (string)
@ -187,27 +186,27 @@ xtra_ops ]
5. Functions
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
5.1. db_query(query | query_id [,handle] )
5.2. db_close(handle)
5.3. db_first(handle)
5.4. db_next(handle)
5.5. db_seek(handle, row_no)
5.6. db_foreach(handle, route)
5.7. db_proper()
5.8. @db.query.query_id
5.9. @db.query.query_id.count
5.10. @db.query.query_id.is_empty
5.11. @db.query.query_id.field[m]
5.12. @db.query.query_id.row[n]
5.13. @db.query.query_id.row[n].field[m]
5.14. @db.fetch.handle
5.15. @db.fetch.handle.row_no
5.1. db_query(query | query_id [,handle] )
Executes query and in case of SELECT returns result via handle, seeks
Executes query and in case of SELECT returns result via handle, seeks
the first record and returns TRUE if table is not empty. The result is
accesible using @db.fetch select. See also declare_handle. Query_id
accesible using @db.fetch select. See also declare_handle. Query_id
references to query declared using declare_query, handle references to
query declared using declare_handle.
@ -224,7 +223,7 @@ xtra_ops ]
5.2. db_close(handle)
Close table that has been opened using db_query. Note all close after
Close table that has been opened using db_query. Note all close after
script processing automatically.
Example 1.5. db_close usage
@ -234,7 +233,7 @@ xtra_ops ]
5.3. db_first(handle)
Returns TRUE if table is not empty. Note that rewind might not be
Returns TRUE if table is not empty. Note that rewind might not be
supported by particular db driver.
Example 1.6. db_first usage
@ -257,7 +256,7 @@ xtra_ops ]
5.5. db_seek(handle, row_no)
Seeks at the row no (origin is zero) and Returns TRUE in case of
Seeks at the row no (origin is zero) and Returns TRUE in case of
success. Backward seek might not be supported by db driver.
Example 1.8. db_seek usage
@ -286,7 +285,7 @@ xtra_ops ]
5.7. db_proper()
Hack which enables using db_ops queries in failure route. Call it at
Hack which enables using db_ops queries in failure route. Call it at
the beginning of failure_route block.
Example 1.10. db_proper usage
@ -325,7 +324,7 @@ xtra_ops ]
5.11. @db.query.query_id.field[m]
Returns value of the first row and the m-th field. @*.field supports
Returns value of the first row and the m-th field. @*.field supports
select_any_uri and select_any_nameaddr.
Example 1.14. db.query.query_id.field[m] usage
@ -335,7 +334,7 @@ xtra_ops ]
5.12. @db.query.query_id.row[n]
Returns value of the n-th row and the first field, negative values
Returns value of the n-th row and the first field, negative values
count from the end (-1 == last row).
Example 1.15. db.query.query_id.row[n] usage
@ -345,7 +344,7 @@ xtra_ops ]
5.13. @db.query.query_id.row[n].field[m]
Returns value of the n-th row and the m-th field. @*.field supports
Returns value of the n-th row and the m-th field. @*.field supports
select_any_uri and select_any_nameaddr.
Example 1.16. db.query.query_id.row[n].field[m] usage
@ -355,11 +354,10 @@ xtra_ops ]
5.14. @db.fetch.handle
Similar functionality as @db.query selects with exception that
Similar functionality as @db.query selects with exception that
operation is performed at query has been opened by db_query.
@db.fetch.handle.count invalidates current record, do
db_seek/db_first!
@db.fetch.handle.count invalidates current record, do db_seek/db_first!
Note all opened queries are closed in POST_SCRIPT callback not to leak
memory.
@ -391,8 +389,8 @@ xtra_ops ]
if (@db.fetch.my_handle.count == "10") {
...
}
if (@db.fetch.my_handle.row_no == "1") { # always false because
.count has invalidated current record!
if (@db.fetch.my_handle.row_no == "1") { # always false because .
count has invalidated current record!
}
db_close(my_handle);
@ -400,51 +398,50 @@ xtra_ops ]
6. Examples
Example 1.19. db_ops common example
modparam("db_ops", "declare_query", "sel1=select/location/received/uid///%$f.ui
d");
modparam("db_ops", "declare_query", "sel2=select/subscriber/email_address,greet
ing/uid,allow_find///%$uidparam,1");
modparam("db_ops", "declare_query", "sel3=select/silo/body/uid//inc_time/%$f.ui
d");
modparam("db_ops", "declare_query", "del1=delete from location where expires<no
w()"); # raw query
# @db.query.sel1 .. SELECT received FROM location WHERE uid = "%$f
.uid"
# @db.query.sel1.count .. SELECT count(*) FROM location WHERE uid = "%$f
.uid"
modparam("db_ops", "declare_query", "sel1=select/location/received/uid///%$f.uid
");
modparam("db_ops", "declare_query", "sel2=select/subscriber/email_address,greeti
ng/uid,allow_find///%$uidparam,1");
modparam("db_ops", "declare_query", "sel3=select/silo/body/uid//inc_time/%$f.uid
");
modparam("db_ops", "declare_query", "del1=delete from location where expires<now
()"); # raw query
# @db.query.sel1 .. SELECT received FROM location WHERE uid = "%$f.
uid"
# @db.query.sel1.count .. SELECT count(*) FROM location WHERE uid = "%$f.
uid"
# @db.query.sel2.field[0] .. SELECT email_address FROM subscriber WHERE uid
= "%$f.uid" AND allow_find=1
# @db.query.sel2.field[1] .. SELECT greeting FROM subscriber WHERE uid = "%
$f.uid" AND allow_find=1
# @db.query.sel3.count .. SELECT count(*) FROM silo WHERE uid = "%$f.uid
"
= "%$f.uid" AND allow_find=1
# @db.query.sel2.field[1] .. SELECT greeting FROM subscriber WHERE uid = "%$
f.uid" AND allow_find=1
# @db.query.sel3.count .. SELECT count(*) FROM silo WHERE uid = "%$f.uid"
# @db.query.sel1.is_empty
db_query("delete/silo///"); # DELETE FROM silo
db_query("delete/silo/expired/<=/%Ts"); # DELETE FROM silo WHERE expired <
= now;
db_query("insert/foo/bar,rab,abr,rbs/%$f.id,'hello world %fu',1,2"); # INSERT
INTO foo(bar,rab,abr,rbs) VALUES ("%$f.id","hello world %fu",1,2)
db_query("update/foo/rab,abr/bar//'hello world %f',1,2,%$f.id"); # UPDATE
foo SET rab="hello world %fu",rbs=45 WHERE bar="%$f.id"
db_query("delete/silo/expired/<=/%Ts"); # DELETE FROM silo WHERE expired <=
now;
db_query("insert/foo/bar,rab,abr,rbs/%$f.id,'hello world %fu',1,2"); # INSERT I
NTO foo(bar,rab,abr,rbs) VALUES ("%$f.id","hello world %fu",1,2)
db_query("update/foo/rab,abr/bar//'hello world %f',1,2,%$f.id"); # UPDATE f
oo SET rab="hello world %fu",rbs=45 WHERE bar="%$f.id"
db_query("mysql://pretorian:sandra@net/delete/fbi/identities//");
if (db_query("select/silo/body/uid//inc_time/%$f.uid", my_handle)) { # SELECT
body FROM silo WHERE uid = "%$f.uid" ORDER BY inc_time
if (db_query("select/silo/body/uid//inc_time/%$f.uid", my_handle)) { # SELECT b
ody FROM silo WHERE uid = "%$f.uid" ORDER BY inc_time
@db.fetch.my_handle .. get first raw
if (db_next(my_handle)) {
@db.fetch.my_handle .. get second raw
}
}
if (db_query("select/silo/src_addr,dest_addr,body/uid//inc_time/%$t.uid", my_ne
xt_handle)) { # SELECT src_addr,dest_addr,body FROM silo WHERE uid = "%$t.uid"
ORDER BY inc_time
@db.fetch.my_next_handle.row[-1].field[1] .. get last dest_addr, not supp
orted now!
if (db_query("select/silo/src_addr,dest_addr,body/uid//inc_time/%$t.uid", my_nex
t_handle)) { # SELECT src_addr,dest_addr,body FROM silo WHERE uid = "%$t.uid" OR
DER BY inc_time
@db.fetch.my_next_handle.row[-1].field[1] .. get last dest_addr, not suppo
rted now!
}
db_close(my_handle);
db_close(my_next_handle);
@ -479,20 +476,20 @@ modparam("timer", "declare_timer", "timer_route,1000,,enable");
modparam("db_ops", "db_url", "mysql://admin:123456789@127.0.0.1:12345/ser");
modparam("db_ops", "declare_query", "q1=select/location/uid,aor,contact,receive
d//////"); #key=location_key,key_omit=i:3");
modparam("db_ops", "declare_query", "q2=select/location/uid,aor,contact,receive
d/uid///%$f.uid/key=location_key,key_omit=i:1");
modparam("db_ops", "declare_query", "q1=select/location/uid,aor,contact,received
//////"); #key=location_key,key_omit=i:3");
modparam("db_ops", "declare_query", "q2=select/location/uid,aor,contact,received
/uid///%$f.uid/key=location_key,key_omit=i:1");
# select raw query not yet supported
modparam("db_ops", "declare_query", "q3=select uid,aor,contact,received from lo
cation where uid=?/%$f.uid");
modparam("db_ops", "declare_query", "q4=mysql://admin:123456789@127.0.0.1:12345
/ser/replace/location/uid,aor,contact,received,expires,q,callid,cseq,user_agent
,instance,path,service_route,assoc_uri,flags,nated_contact,term_toi/QWERTY,aor@
qqq,1.2.3.4:5678,1.2.3.4:5678;proto=tcp,d:1000,0.8,CAALL,6543,bubak,INSTANCE@bu
bak,sip:path_to_localhost,,,0,1,,");
modparam("db_ops", "declare_query", "q5=mysql://admin:123456789@127.0.0.1:12345
/ser/delete from location where uid=?/s:QWERTY");
modparam("db_ops", "declare_query", "q3=select uid,aor,contact,received from loc
ation where uid=?/%$f.uid");
modparam("db_ops", "declare_query", "q4=mysql://admin:123456789@127.0.0.1:12345/
ser/replace/location/uid,aor,contact,received,expires,q,callid,cseq,user_agent,i
nstance,path,service_route,assoc_uri,flags,nated_contact,term_toi/QWERTY,aor@qqq
,1.2.3.4:5678,1.2.3.4:5678;proto=tcp,d:1000,0.8,CAALL,6543,bubak,INSTANCE@bubak,
sip:path_to_localhost,,,0,1,,");
modparam("db_ops", "declare_query", "q5=mysql://admin:123456789@127.0.0.1:12345/
ser/delete from location where uid=?/s:QWERTY");
modparam("db_ops", "declare_handle", "h0");
modparam("db_ops", "declare_handle", "h1");
@ -501,18 +498,18 @@ route["print_count"] {
# testing count
xplog("L_INFO", "print count\n");
db_query("q1", "h1");
xplog("L_INFO", "fetch: row_no: %@db.fetch.h1.row_no, count: %@db.fetch
.h1.count, row_no: %@db.fetch.h1.row_no, is_empty: %@db.fetch.h1.is_empty, row_
no: %@db.fetch.h1.row_no\n");
xplog("L_INFO", "fetch: row_no: %@db.fetch.h1.row_no, count: %@db.fetch.
h1.count, row_no: %@db.fetch.h1.row_no, is_empty: %@db.fetch.h1.is_empty, row_no
: %@db.fetch.h1.row_no\n");
xplog("L_INFO", "query: is_empty: %@db.query.q1.is_empty, count: %@db.q
uery.q1.count\n");
xplog("L_INFO", "query: is_empty: %@db.query.q1.is_empty, count: %@db.qu
ery.q1.count\n");
}
route["print_record"] {
xplog("L_INFO","row_no: %@db.fetch.h0.row_no, record: %@db.fetch.h0.fie
ld[0], %@db.fetch.h0.field[1], %@db.fetch.h0.field[2], %@db.fetch.h0.field[3]
\n");
xplog("L_INFO","row_no: %@db.fetch.h0.row_no, record: %@db.fetch.h0.fiel
d[0], %@db.fetch.h0.field[1], %@db.fetch.h0.field[2], %@db.fetch.h0.field[3]\n
");
}
@ -567,12 +564,12 @@ route["db_test"] {
db_foreach("h0", "print_record");
xplog("L_INFO", "query test\n");
xplog("L_INFO", "#0: %@db.query.q1.row[0].field[0], %@db.query.q1.row[0
].field[1], %@db.query.q1.row[0].field[2], %@db.query.q1.row[0].field[3]\n");
xplog("L_INFO", "#1: %@db.query.q1.row[1].field[0], %@db.query.q1.row[1
].field[1], %@db.query.q1.row[1].field[2], %@db.query.q1.row[1].field[3]\n");
xplog("L_INFO", "#3: %@db.query.q1.row[3].field[0], %@db.query.q1.row[3
].field[1], %@db.query.q1.row[3].field[2], %@db.query.q1.row[3].field[3]\n");
xplog("L_INFO", "#0: %@db.query.q1.row[0].field[0], %@db.query.q1.row[0]
.field[1], %@db.query.q1.row[0].field[2], %@db.query.q1.row[0].field[3]\n");
xplog("L_INFO", "#1: %@db.query.q1.row[1].field[0], %@db.query.q1.row[1]
.field[1], %@db.query.q1.row[1].field[2], %@db.query.q1.row[1].field[3]\n");
xplog("L_INFO", "#3: %@db.query.q1.row[3].field[0], %@db.query.q1.row[3]
.field[1], %@db.query.q1.row[3].field[2], %@db.query.q1.row[3].field[3]\n");
}

@ -362,9 +362,10 @@ int km_bdb_query(db1_con_t* _con, db_key_t* _k, db_op_t* _op, db_val_t* _v,
table_p _tp = NULL;
char kbuf[MAX_ROW_SIZE];
char dbuf[MAX_ROW_SIZE];
u_int32_t i, len, ret;
u_int32_t i, len;
int klen=MAX_ROW_SIZE;
int *lkey=NULL, *lres=NULL;
int ret;
DBT key, data;
DB *db;
DBC *dbcp;

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2012 asipto.com
Copyright © 2012 asipto.com
__________________________________________________________________
Table of Contents

@ -5,7 +5,7 @@ Jan Janak
FhG FOKUS
<jan@iptel.org>
Copyright © 2004, 2005 FhG FOKUS
Copyright © 2004, 2005 FhG FOKUS
__________________________________________________________________
Table of Contents

@ -85,6 +85,8 @@ Chapter 1. Admin Guide
running Kamailio with this module loaded:
* mongo-c-driver - available at
https://github.com/mongodb/mongo-c-driver
Note: if you use tls module, use at least mongo-c-driver v1.2.1 -
there were reports of issues inside earlier versions of the driver.
3. Usage

@ -72,6 +72,10 @@
<emphasis>mongo-c-driver</emphasis> - available at
<ulink url="https://github.com/mongodb/mongo-c-driver">https://github.com/mongodb/mongo-c-driver</ulink>
</para>
<para>
Note: if you use tls module, use at least mongo-c-driver v1.2.1
- there were reports of issues inside earlier versions of the driver.
</para>
</listitem>
</itemizedlist>
</para>

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2006 Voice Sistem SRL
Copyright © 2006 Voice Sistem SRL
__________________________________________________________________
Table of Contents
@ -29,6 +29,7 @@ Daniel-Constantin Mierla
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)
3.5. update_affected_found (integer)
4. Functions
5. Installation
@ -40,9 +41,10 @@ Daniel-Constantin Mierla
1.2. Set timeout_interval parameter
1.3. Set auto_reconnect parameter
1.4. Set insert_delayed parameter
1.5. Set a my.cnf group in db_url parameter
1.6. Adding a kamailio group to my.cnf
1.7. Using [client] and specific group
1.5. Set update_affected_found parameter
1.6. Set a my.cnf group in db_url parameter
1.7. Adding a kamailio group to my.cnf
1.8. Using [client] and specific group
Chapter 1. Admin Guide
@ -60,6 +62,7 @@ Chapter 1. Admin Guide
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)
3.5. update_affected_found (integer)
4. Functions
5. Installation
@ -93,6 +96,7 @@ Chapter 1. Admin Guide
3.2. timeout_interval (integer)
3.3. auto_reconnect (integer)
3.4. insert_delayed (integer)
3.5. update_affected_found (integer)
3.1. ping_interval (integer)
@ -113,8 +117,8 @@ modparam("db_mysql", "ping_interval", 600)
retries are done from the driver before it gives up.
The read timeout parameter is ignored on MySQL driver versions prior to
"5.1.12", "5.0.25" and "4.1.22". The write timeout parameter is ignored
on versions prior to "5.1.12" and "5.0.25", the "4.1" release don't
“5.1.12”, “5.0.25” and “4.1.22”. The write timeout parameter is ignored
on versions prior to “5.1.12” and “5.0.25”, the “4.1” release don't
support it at all.
Default value is 2 (6 sec).
@ -148,6 +152,18 @@ modparam("db_mysql", "auto_reconnect", 0)
modparam("db_mysql", "insert_delayed", 1)
...
3.5. update_affected_found (integer)
If set to 1, all UPDATE SQL queries will return the number of matched
rows instead of the number of "updated" rows.
Default value is 0 (1 - on / 0 - off).
Example 1.5. Set update_affected_found parameter
...
modparam("db_mysql", "update_affected_found", 1)
...
4. Functions
No function exported to be used from configuration file.
@ -174,12 +190,12 @@ modparam("db_mysql", "insert_delayed", 1)
* mysql://user:pass@[group]/db
* mysql://[group]/db
Example 1.5. Set a my.cnf group in db_url parameter
Example 1.6. Set a my.cnf group in db_url parameter
...
modparam("usrloc", "db_url", "mysql://[kamailio]/kamailio)
...
Example 1.6. Adding a kamailio group to my.cnf
Example 1.7. Adding a kamailio group to my.cnf
...
[kamailio]
socket = /path/to/mysql.sock
@ -193,7 +209,7 @@ default-character-set = utf8
both your specific group and the client group, then the value is taken
from the last one.
Example 1.7. Using [client] and specific group
Example 1.8. Using [client] and specific group
...
[client]
socket = /var/run/mysql/mysqld.sock

@ -29,6 +29,7 @@
#endif
#define _XOPEN_SOURCE_EXTENDED 1 /* solaris */
#define _SVID_SOURCE 1 /* timegm */
#define _DEFAULT_SOURCE 1 /* _SVID_SOURCE is deprecated */
#include "my_cmd.h"

@ -93,23 +93,19 @@ union ull {
uint32_t ui32[2];
};
#if !defined(__OS_darwin) || (defined(__OS_darwin) && !defined(NTOHLL))
static inline uint64_t htonll(uint64_t in)
static inline uint64_t _htonll(uint64_t in)
{
union ull* p = (union ull*)&in;
return ((uint64_t)htonl(p->ui32[0]) << 32) + (uint64_t)htonl(p->ui32[1]);
}
#endif
#if !defined(__OS_darwin) || (defined(__OS_darwin) && !defined(NTOHLL))
static inline uint64_t ntohll(uint64_t in)
static inline uint64_t _ntohll(uint64_t in)
{
union ull* p = (union ull*)&in;
return ((uint64_t)ntohl(p->ui32[0]) << 32) + (uint64_t)ntohl(p->ui32[1]);
}
#endif
static inline void db_int2pg_int4(struct pg_params* dst, int i,
@ -145,7 +141,7 @@ static inline void db_int2pg_timestamp(struct pg_params* dst, int i,
} else {
pfld->v.dbl = (double)src->v.int4 - (double)PG_EPOCH_TIME;
}
pfld->v.int8 = htonll(pfld->v.int8);
pfld->v.int8 = _htonll(pfld->v.int8);
dst->fmt[i] = 1;
dst->val[i] = pfld->v.byte;
@ -208,7 +204,7 @@ static inline void db_float2pg_float8(struct pg_params* dst, int i, db_fld_t* sr
{
struct pg_fld* pfld = DB_GET_PAYLOAD(src);
pfld->v.dbl = src->v.flt;
pfld->v.int8 = htonll(pfld->v.int8);
pfld->v.int8 = _htonll(pfld->v.int8);
dst->fmt[i] = 1;
dst->val[i] = pfld->v.byte;
@ -219,7 +215,7 @@ static inline void db_float2pg_float8(struct pg_params* dst, int i, db_fld_t* sr
static inline void db_double2pg_float8(struct pg_params* dst, int i, db_fld_t* src)
{
struct pg_fld* pfld = DB_GET_PAYLOAD(src);
pfld->v.int8 = htonll(src->v.int8);
pfld->v.int8 = _htonll(src->v.int8);
dst->fmt[i] = 1;
dst->val[i] = pfld->v.byte;
@ -686,7 +682,7 @@ static inline int pg_int4_2_db_int(db_fld_t* fld, char* val, int len)
static inline int pg_int8_2_db_int(db_fld_t* fld, char* val, int len)
{
fld->v.int8 = (int64_t)ntohll(*((int64_t*)val));
fld->v.int8 = (int64_t)_ntohll(*((int64_t*)val));
return 0;
}
@ -732,10 +728,10 @@ static inline int pg_timestamp2db_int(db_fld_t* fld, char* val, int len,
{
if (flags & PG_INT8_TIMESTAMP) {
/* int8 format */
fld->v.int4 = (int64_t)ntohll(((int64_t*)val)[0]) / (int64_t)1000000 + PG_EPOCH_TIME;
fld->v.int4 = (int64_t)_ntohll(((int64_t*)val)[0]) / (int64_t)1000000 + PG_EPOCH_TIME;
} else {
/* double format */
fld->v.int4 = PG_EPOCH_TIME + ntohll(((int64_t*)val)[0]);
fld->v.int4 = PG_EPOCH_TIME + _ntohll(((int64_t*)val)[0]);
}
return 0;
}
@ -775,7 +771,7 @@ static inline int pg_float42db_double(db_fld_t* fld, char* val, int len)
static inline int pg_float82db_double(db_fld_t* fld, char* val, int len)
{
fld->v.int8 = ntohll(*(uint64_t*)val);
fld->v.int8 = _ntohll(*(uint64_t*)val);
return 0;
}

@ -1,12 +1,12 @@
SQlite Module
Timo Teräs
Timo Teräs
Edited by
Timo Teräs
Timo Teräs
Copyright © 2011 Timo Teräs
Copyright © 2011 Timo Teräs
__________________________________________________________________
Table of Contents

@ -305,17 +305,17 @@ modparam("module_name", "db_url", "text:///path/to/dbtext/database")
Example 1.8. Definition of 'subscriber' table (one line)
...
username(str) domain(str) password(str) first_name(str) last_name(str) phone(st
r) email_address(str) datetime_created(int) datetime_modified(int) confirmation
(str) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(st
r) allow_find(str) timezone(str,null) rpid(str,null)
username(str) domain(str) password(str) first_name(str) last_name(str) phone(str
) email_address(str) datetime_created(int) datetime_modified(int) confirmation(s
tr) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str)
allow_find(str) timezone(str,null) rpid(str,null)
...
Example 1.9. Definition of 'location' and 'aliases' tables (one line)
...
username(str) domain(str,null) contact(str,null) received(str) expires(int,null
) q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int)
user_agent(str) socket(str)
username(str) domain(str,null) contact(str,null) received(str) expires(int,null)
q(double,null) callid(str,null) cseq(int,null) last_modified(str) flags(int) us
er_agent(str) socket(str)
...
Example 1.10. Definition of 'version' table and sample records

@ -127,7 +127,9 @@ static int db_unixodbc_submit_query(const db1_con_t* _h, const str* _s)
}
ret=SQLExecDirect(CON_RESULT(_h), (SQLCHAR*)_s->s, _s->len);
if (!SQL_SUCCEEDED(ret))
/* Handle SQL_NO_DATA as a valid return code. DELETE and UPDATE statements may return this return code if nothing was deleted/updated. */
if (!SQL_SUCCEEDED(ret) && (ret != SQL_NO_DATA))
{
SQLCHAR sqlstate[7];
LM_ERR("rv=%d. Query= %.*s\n", ret, _s->len, _s->s);

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
__________________________________________________________________
Table of Contents
@ -49,15 +49,26 @@ Daniel-Constantin Mierla
4.2. dbg_pv_dump([mask] [, level])
4.3. dbg_sip_msg([log_level], [facility])
5. Exported RPC Functions
5. Exported MI Functions
5.1. dbg.ls
5.2. dbg.trace
5.3. dbg.bp
5.4. dbg.mod_level
5.5. dbg.reset_msgid
5.1. set_dbg_mod_level mod_name level
5.2. set_dbg_mod_facility mod_name facility
5.3. get_dbg_mod_level mod_name
5.4. get_dbg_mod_facility mod_name
6. Usage
6. Exported RPC Functions
6.1. dbg.ls
6.2. dbg.trace
6.3. dbg.bp
6.4. dbg.mod_level
6.5. dbg.reset_msgid
6.6. dbg.set_mod_level
6.7. dbg.set_mod_facility
6.8. dbg.get_mod_level
6.9. dbg.get_mod_facility
7. Usage
List of Examples
@ -81,6 +92,10 @@ Daniel-Constantin Mierla
1.18. dbg_breakpoint usage
1.19. dbg_pv_dump usage
1.20. dbg_sip_msg usage
1.21. set_dbg_mod_level usage
1.22. set_dbg_mod_facility usage
1.23. get_dbg_mod_level usage
1.24. get_dbg_mod_facility usage
Chapter 1. Admin Guide
@ -118,15 +133,26 @@ Chapter 1. Admin Guide
4.2. dbg_pv_dump([mask] [, level])
4.3. dbg_sip_msg([log_level], [facility])
5. Exported RPC Functions
5. Exported MI Functions
5.1. set_dbg_mod_level mod_name level
5.2. set_dbg_mod_facility mod_name facility
5.3. get_dbg_mod_level mod_name
5.4. get_dbg_mod_facility mod_name
5.1. dbg.ls
5.2. dbg.trace
5.3. dbg.bp
5.4. dbg.mod_level
5.5. dbg.reset_msgid
6. Exported RPC Functions
6. Usage
6.1. dbg.ls
6.2. dbg.trace
6.3. dbg.bp
6.4. dbg.mod_level
6.5. dbg.reset_msgid
6.6. dbg.set_mod_level
6.7. dbg.set_mod_facility
6.8. dbg.get_mod_level
6.9. dbg.get_mod_facility
7. Usage
1. Overview
@ -162,6 +188,11 @@ Chapter 1. Admin Guide
The following modules must be loaded before this module:
* none.
NOTE: Due to the debugger module child_init() function, one should load
the module first in the module sequence in order to initialize
_dbg_pid_list. Otherwise, another module (i.e. p_usrloc) forking a
process with rank != PROC_INIT will fail.
2.2. External Libraries or Applications
The following libraries or applications must be installed before
@ -194,7 +225,7 @@ Chapter 1. Admin Guide
startup. You can change the value at runtime without restart, globally
or per process.
Default value is "0" (disabled).
Default value is “0” (disabled).
Example 1.1. Set cfgtrace parameter
...
@ -206,7 +237,7 @@ modparam("debugger", "cfgtrace", 1)
Control whether every line (global) breakpoint is enabled or disabled
at startup.
Default value is "0" (disabled).
Default value is “0” (disabled).
Example 1.2. Set breakpoint parameter
...
@ -217,7 +248,7 @@ modparam("debugger", "breakpoint", 1)
What log level is to be used to print module-specific messages.
Default value is "-1" (L_ERR).
Default value is “-1” (L_ERR).
Example 1.3. Set log_level parameter
...
@ -228,7 +259,7 @@ modparam("debugger", "log_level", 1)
What log level name is to be used to print cfg trace messages.
Default value is "NULL" (use default log names).
Default value is “NULL” (use default log names).
Example 1.4. Set log_level_name parameter
...
@ -241,7 +272,7 @@ modparam("debugger", "log_level_name", "exec")
using this setting, you can configure syslog to send debug messages to
a separate log channel, like a specific kamailio-debug log file.
Default value is "NULL" (default from core).
Default value is “NULL” (default from core).
Example 1.5. Set log_facility parameter
...
@ -252,7 +283,7 @@ modparam("debugger", "log_facility", "LOG_DAEMON")
String to print before any module-specific messages.
Default value is "*** cfgtrace:".
Default value is “*** cfgtrace:”.
Example 1.6. Set log_prefix parameter
...
@ -264,7 +295,7 @@ modparam("debugger", "log_prefix", "from-debugger-with-love:")
Microseconds to sleep before checking for new commands when waiting at
a breakpoint.
Default value is "100000" (that is 0.1 sec).
Default value is “100000” (that is 0.1 sec).
Example 1.7. Set step_usleep parameter
...
@ -278,7 +309,7 @@ modparam("debugger", "step_usleep", 500000)
blocking RPC process forever in case the worker process 'forgets' to
write back a reply.
Default value is "200".
Default value is “200”.
Example 1.8. Set step_loops parameter
...
@ -294,7 +325,7 @@ modparam("debugger", "step_loops", 100)
configured by mod_level or mod_facility. This parameter is accesible
readonly via the Kamailio config framework.
Default value is "0" - feature disabled.
Default value is “0” - feature disabled.
Example 1.9. Set mod_hash_size parameter
...
@ -307,7 +338,7 @@ modparam("debugger", "mod_hash_size", 5)
This parameter is tunable via the Kamailio config framework. To use per
module log level you also have to set mod_hash_size.
Default value is "0".
Default value is “0”.
Example 1.10. Set mod_level_mode parameter
...
@ -333,7 +364,7 @@ modparam("debugger", "mod_level", "tm=3")
This parameter is tunable via the Kamailio config framework. To use per
module log facility you also have to set mod_hash_size.
Default value is "0".
Default value is “0”.
Example 1.12. Set mod_facility_mode parameter
...
@ -362,7 +393,7 @@ modparam("debugger", "mod_facility", "debugger=LOG_LOCAL1")
Enable or disable log assign actions on config (0 - disabled, 1 -
enabled).
Default value is "0".
Default value is “0”.
Example 1.14. Set log_assign parameter
...
@ -374,7 +405,7 @@ modparam("debugger", "log_assign", 1)
If set, before each config action is done pkg memory check, useful to
detect buffer overflows.
Default value is "0" (disabled).
Default value is “0” (disabled).
Example 1.15. Set cfgpkgcheck parameter
...
@ -386,7 +417,7 @@ modparam("debugger", "cfgpkgcheck", 1)
Used to enable or disable the ability to reset the msgid ($mi) through
the dbg.reset_msgid RPC command. (0 - disabled, 1 - enabled).
Default value is "0" - feature disabled.
Default value is “0” - feature disabled.
Example 1.16. Set reset_msgid parameter
...
@ -398,7 +429,7 @@ modparam("debugger", "reset_msgid", 1)
Control whether the cfgt module is enabled or disabled at startup.
Module cfgt needs to be loaded before.
Default value is "0" (disabled).
Default value is “0” (disabled).
Example 1.17. Set cfgtest parameter
...
@ -521,15 +552,71 @@ P-Hint: My hint
------------------------------- SIP body diffs --------------------------------
-------------------------- END OF SIP message debug ---------------------------
5. Exported RPC Functions
5. Exported MI Functions
5.1. set_dbg_mod_level mod_name level
5.2. set_dbg_mod_facility mod_name facility
5.3. get_dbg_mod_level mod_name
5.4. get_dbg_mod_facility mod_name
5.1. set_dbg_mod_level mod_name level
Set the module log level. If module does not exist in kamailio, the
entry in the level hashtable is still added for the bogus module.
Example 1.21. set_dbg_mod_level usage
...
$ kamctl fifo set_dbg_mod_level core 2
$ kamctl fifo set_dbg_mod_level debugger 3
...
5.2. set_dbg_mod_facility mod_name facility
5.1. dbg.ls
5.2. dbg.trace
5.3. dbg.bp
5.4. dbg.mod_level
5.5. dbg.reset_msgid
Set the mod_name log facility. If mod_name does not exist in kamailio,
the entry in the facility hashtable is still added for the bogus
mod_name.
5.1. dbg.ls
Example 1.22. set_dbg_mod_facility usage
...
$ kamctl fifo set_dbg_mod_facility core LOG_LOCAL1
$ kamctl fifo set_dbg_mod_facility debugger LOG_LOCAL0
...
5.3. get_dbg_mod_level mod_name
Get the mod_name log level. If mod_name does not exist in the level
hashtable, returns the config file value.
Example 1.23. get_dbg_mod_level usage
...
$ kamctl fifo get_dbg_mod_level core
$ kamctl fifo get_dbg_mod_level debugger
...
5.4. get_dbg_mod_facility mod_name
Get the mod_name log facility. If mod_name does not exist in the
facility hashtable, returns the config file value.
Example 1.24. get_dbg_mod_facility usage
...
$ kamctl fifo get_dbg_mod_facility core
$ kamctl fifo get_dbg_mod_facility debugger
...
6. Exported RPC Functions
6.1. dbg.ls
6.2. dbg.trace
6.3. dbg.bp
6.4. dbg.mod_level
6.5. dbg.reset_msgid
6.6. dbg.set_mod_level
6.7. dbg.set_mod_facility
6.8. dbg.get_mod_level
6.9. dbg.get_mod_facility
6.1. dbg.ls
List Kamailio processes with info related to interactive debugging.
@ -543,7 +630,7 @@ P-Hint: My hint
dbg.ls
dbg.ls 1234
5.2. dbg.trace
6.2. dbg.trace
Control config script running trace.
@ -560,7 +647,7 @@ P-Hint: My hint
dbg.trace off
dbg.trace on 1234
5.3. dbg.bp
6.3. dbg.bp
Control breakpoints and config execution.
@ -598,7 +685,7 @@ P-Hint: My hint
dbg.bp eval 1234 $fu
dbg.bp move 1234
5.4. dbg.mod_level
6.4. dbg.mod_level
Specify module log level.
@ -612,7 +699,7 @@ P-Hint: My hint
dbg.mod_level core 3
dbg.mod_level tm 3
5.5. dbg.reset_msgid
6.5. dbg.reset_msgid
Resets the message sequence ($mi). Internally there is no real change.
This can be useful for unit test cases in order to be able to replicate
@ -624,7 +711,47 @@ P-Hint: My hint
Examples of use with kamcmd:
dbg.reset_msgid
6. Usage
6.6. dbg.set_mod_level
Set the module log level. If module does not exist in kamailio, the
entry in the level hashtable is still added for the bogus module.
Name: dbg.set_mod_level
Examples of use with kamcmd:
dbg.set_mod_level core 1
6.7. dbg.set_mod_facility
Set the module log facility. If module does not exist in kamailio, the
entry in the facility hashtable is still added for the bogus module.
Name: dbg.set_mod_facility
Examples of use with kamcmd:
dbg.set_mod_facility core LOG_LOCAL1
6.8. dbg.get_mod_level
Get the module log level. If mod_name does not exist in the level
hashtable, returns the config file value.
Name: dbg.get_mod_level
Examples of use with kamcmd:
dbg.get_mod_level core
6.9. dbg.get_mod_facility
Get the module log facility. If mod_name does not exist in the facility
hashtable, returns the config file value.
Name: dbg.get_mod_facility
Examples of use with kamcmd:
dbg.get_mod_facility core
7. Usage
A common usage is to investigate the execution path for a specific SIP
message. Just enable cfg running trace, send the message and watch the

File diff suppressed because it is too large Load Diff

@ -57,6 +57,30 @@
dialog timeout is reset each time a sequential request is processed.
</para>
</section>
<section>
<title>Dialog states</title>
<para>
Dialogs have states that are shown in the RPC interface as well as stored
in the database.
</para>
<itemizedlist>
<listitem>
<para><emphasis>1</emphasis> : Unconfirmed dialog</para>
</listitem>
<listitem>
<para><emphasis>2</emphasis> : Early dialog (ringing)</para>
</listitem>
<listitem>
<para><emphasis>3</emphasis> : Confirmed dialog (waiting for ACK)</para>
</listitem>
<listitem>
<para><emphasis>4</emphasis> : Confirmed dialog (active call)</para>
</listitem>
<listitem>
<para><emphasis>5</emphasis> : Deleted dialog</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Dialog profiling</title>
@ -533,7 +557,7 @@ modparam("dialog", "table_name", "my_dialog")
</section>
<section>
<title><varname>callid_column</varname> (string)</title>
<title><varname>call_id_column</varname> (string)</title>
<para>
The column name in the database to store the dialogs' callid.
</para>
@ -546,7 +570,7 @@ modparam("dialog", "table_name", "my_dialog")
<title>Set <varname>callid_column</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("dialog", "callid_column", "callid_c_name")
modparam("dialog", "call_id_column", "callid_c_name")
...
</programlisting>
</example>
@ -935,7 +959,7 @@ modparam("dialog", "sflags_column", "s_flags")
</para>
<para>
<emphasis>
Default value is <quote>toroute</quote>.
Default value is <quote>toroute_name</quote>.
</emphasis>
</para>
<example>

@ -16,11 +16,11 @@ Edited by
Olle E. Johansson
Copyright © 2007-2008 Voice Sistem SRL
Copyright © 2007-2008 Voice Sistem SRL
Copyright © 2008-2010 Juha Heinanen
Copyright © 2008-2010 Juha Heinanen
Copyright © 2014 Olle E. Johansson, Edvina AB
Copyright © 2014 Olle E. Johansson, Edvina AB
__________________________________________________________________
Table of Contents
@ -222,7 +222,7 @@ Chapter 1. Admin Guide
The translation rules will be loaded using this database URL.
Default value is "mysql://kamailio:kamailiorw@localhost/kamailio".
Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”.
Example 1.1. Set db_url parameter
...
@ -233,7 +233,7 @@ modparam("dialplan", "db_url", "mysql://user:passwb@localhost/db")
The name of the database table used to load the translation rules.
Default value is "dialplan".
Default value is “dialplan”.
Example 1.2. Set table_name parameter
...
@ -244,7 +244,7 @@ modparam("dialplan", "table_name", "my_table")
The column name used to store the dialplan group ID.
Default value is "dpid".
Default value is “dpid”.
Example 1.3. Set dpid_col parameter
...
@ -256,7 +256,7 @@ modparam("dialplan", "dpid_col", "column_name")
The column name used to store the priority of the corresponding rule
from the database row.
Default value is "pr".
Default value is “pr”.
Example 1.4. Set pr_col parameter
...
@ -267,7 +267,7 @@ modparam("dialplan", "pr_col", "column_name")
The column name used to store the type of matching of the rule.
Default value is "match_op".
Default value is “match_op”.
Example 1.5. Set match_op_col parameter
...
@ -278,7 +278,7 @@ modparam("dialplan", "match_op_col", "column_name")
The column name to store the rule match expression.
Default value is "match_exp".
Default value is “match_exp”.
Example 1.6. Set match_exp_col parameter
...
@ -290,7 +290,7 @@ modparam("dialplan", "match_exp_col", "column_name")
The column name to store the length of a string matching the match
expression.
Default value is "match_len".
Default value is “match_len”.
Example 1.7. Set pr_col parameter
...
@ -301,7 +301,7 @@ modparam("dialplan", "match_len_col", "column_name")
The column name to store the rule's substitution expression.
Default value is "subst_exp".
Default value is “subst_exp”.
Example 1.8. Set pr_col parameter
...
@ -312,7 +312,7 @@ modparam("dialplan", "subst_exp_col", "column_name")
The column name to store the rule's replacement expression.
Default value is "repl_exp".
Default value is “repl_exp”.
Example 1.9. Set repl_exp_col parameter
...
@ -324,7 +324,7 @@ modparam("dialplan", "repl_exp_col", "column_name")
The column name to store the rule's attributes to be set after match
(see attrs_pvar )
Default value is "attrs".
Default value is “attrs”.
Example 1.10. Set attrs_col parameter
...
@ -335,9 +335,9 @@ modparam("dialplan", "attrs_col", "column_name")
The pseudovariable used to store the rule's attributes, after
translation (when dp_translate() succeeds). This parameter can be an
"AVP" or a script variable ("$var()")..
“AVP” or a script variable (“$var()”)..
Default value is "NULL".
Default value is “NULL”.
Example 1.11. Set attrs_pvar parameter
...
@ -348,7 +348,7 @@ modparam("dialplan", "attrs_pvar", "$avp(s:dest)")
The number of rows to be fetched at once from database
Default value is "1000".
Default value is “1000”.
Example 1.12. Set fetch_rows parameter
...
@ -366,7 +366,7 @@ modparam("dialplan", "fetch_rows", 4000)
without script variables are pre-compiled even if this parameter is
enabled.
Default value is "0" (disabled).
Default value is “0” (disabled).
Example 1.13. Set match_dynamic parameter
...
@ -377,12 +377,12 @@ modparam("dialplan", "match_dynamic", 1)
6.1. dp_translate(id, [src[/dest]])
6.1. dp_translate(id, [src[/dest]])
6.1. dp_translate(id, [src[/dest]])
Will try to translate "src" into "dest" according to the translation
rules in the dialplan identified by "id" . If src/dest is missing the
default parameter "ruri.user/ruri.user" will be used, thus translating
the request URI user part. If only "dest" is missing, only matching and
Will try to translate “src” into “dest” according to the translation
rules in the dialplan identified by “id” . If src/dest is missing the
default parameter “ruri.user/ruri.user” will be used, thus translating
the request URI user part. If only “dest” is missing, only matching and
storing of the matching rule's attributes is done.
Returns 1, if translation succeeded, -1 in case of some error occurred,

@ -10,27 +10,33 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Edited by
Carsten Bock
ng-voice GmbH
Edited by
Olle E. Johansson
Edvina AB
Edited by
Alessandro Arrichiello
Hewlett Packard
Copyright © 2004 FhG FOKUS
Copyright © 2004 FhG FOKUS
Copyright © 2005 Voice Sistem
Copyright © 2005 Voice Sistem
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
Copyright © 2010 Daniel-Constantin Mierla (asipto.com)
Copyright © 2014 Olle E. Johansson, Edvina AB
Copyright © 2014 Olle E. Johansson, Edvina AB
Copyright © 2015 Alessandro Arrichiello, Hewlett Packard
Copyright © 2015 Alessandro Arrichiello, Hewlett Packard
__________________________________________________________________
Table of Contents
@ -122,40 +128,40 @@ Alessandro Arrichiello
List of Examples
1.1. Set the "list_file" parameter
1.2. Set "db_url" parameter
1.3. Set "table_name" parameter
1.4. Set "setid_col" parameter
1.5. Set "destination_col" parameter
1.6. Set "flags_col" parameter
1.7. Set "priority_col" parameter
1.8. Set the "force_dst" parameter
1.9. Set the "flags" parameter
1.10. Set the "use_default" parameter
1.11. Set the "dst_avp" parameter
1.12. Set the "grp_avp" parameter
1.13. Set the "cnt_avp" parameter
1.14. Set the "dstid_avp" parameter
1.15. Set the "attrs_avp" parameter
1.16. Set the "sock_avp" parameter
1.1. Set the “list_file” parameter
1.2. Set “db_url” parameter
1.3. Set “table_name” parameter
1.4. Set “setid_col” parameter
1.5. Set “destination_col” parameter
1.6. Set “flags_col” parameter
1.7. Set “priority_col” parameter
1.8. Set the “force_dst” parameter
1.9. Set the “flags” parameter
1.10. Set the “use_default” parameter
1.11. Set the “dst_avp” parameter
1.12. Set the “grp_avp” parameter
1.13. Set the “cnt_avp” parameter
1.14. Set the “dstid_avp” parameter
1.15. Set the “attrs_avp” parameter
1.16. Set the “sock_avp” parameter
1.17. Use $avp(i:273) for hashing:
1.18. Use combination of PVs for hashing:
1.19. Set the "setid_pvname" parameter
1.20. Set the "attrs_pvname" parameter
1.21. Set the "ds_ping_method" parameter
1.22. Set the "ds_ping_from" parameter
1.23. Set the "ds_ping_interval" parameter
1.24. Set the "ds_probing_threshold" parameter
1.25. Set the "ds_inactive_threshold" parameter
1.26. Set the "ds_ping_reply_codes" parameter
1.27. Set the "ds_probing_mode" parameter
1.28. Set the "ds_hash_size" parameter
1.29. Set the "ds_hash_expire" parameter
1.30. Set the "ds_hash_initexpire" parameter
1.31. Set the "ds_hash_check_interval" parameter
1.32. Set the "outbound_proxy" parameter
1.33. Set the "ds_default_socket" parameter
1.34. Set the "ds_timer_mode" parameter
1.19. Set the “setid_pvname” parameter
1.20. Set the “attrs_pvname” parameter
1.21. Set the “ds_ping_method” parameter
1.22. Set the “ds_ping_from” parameter
1.23. Set the “ds_ping_interval” parameter
1.24. Set the “ds_probing_threshold” parameter
1.25. Set the “ds_inactive_threshold” parameter
1.26. Set the “ds_ping_reply_codes” parameter
1.27. Set the “ds_probing_mode” parameter
1.28. Set the “ds_hash_size” parameter
1.29. Set the “ds_hash_expire” parameter
1.30. Set the “ds_hash_initexpire” parameter
1.31. Set the “ds_hash_check_interval” parameter
1.32. Set the “outbound_proxy” parameter
1.33. Set the “ds_default_socket” parameter
1.34. Set the “ds_timer_mode” parameter
1.35. ds_select_dst usage
1.36. ds_mark_dst usage
1.37. ds_list_exist usage
@ -324,10 +330,10 @@ Chapter 1. Admin Guide
Path to the file with destination sets.
Default value is "/etc/kamailio/dispatcher.list" or
"/usr/local/etc/kamailio/dispatcher.list".
Default value is “/etc/kamailio/dispatcher.list” or
“/usr/local/etc/kamailio/dispatcher.list”.
Example 1.1. Set the "list_file" parameter
Example 1.1. Set the “list_file” parameter
...
modparam("dispatcher", "list_file", "/var/run/kamailio/dispatcher.list")
...
@ -337,9 +343,9 @@ modparam("dispatcher", "list_file", "/var/run/kamailio/dispatcher.list")
If you want to load the sets of gateways from the database you must set
this parameter.
Default value is "NULL" (disable DB support).
Default value is “NULL” (disable DB support).
Example 1.2. Set "db_url" parameter
Example 1.2. Set “db_url” parameter
...
modparam("dispatcher", "db_url", "mysql://user:passwb@localhost/database")
...
@ -349,9 +355,9 @@ modparam("dispatcher", "db_url", "mysql://user:passwb@localhost/database")
If you want to load the sets of gateways from the database you must set
this parameter as the database name.
Default value is "dispatcher".
Default value is “dispatcher”.
Example 1.3. Set "table_name" parameter
Example 1.3. Set “table_name” parameter
...
modparam("dispatcher", "table_name", "my_dispatcher")
...
@ -360,9 +366,9 @@ modparam("dispatcher", "table_name", "my_dispatcher")
The column's name in the database storing the gateway's group id.
Default value is "setid".
Default value is “setid”.
Example 1.4. Set "setid_col" parameter
Example 1.4. Set “setid_col” parameter
...
modparam("dispatcher", "setid_col", "groupid")
...
@ -371,9 +377,9 @@ modparam("dispatcher", "setid_col", "groupid")
The column's name in the database storing the destination sip URI.
Default value is "destination".
Default value is “destination”.
Example 1.5. Set "destination_col" parameter
Example 1.5. Set “destination_col” parameter
...
modparam("dispatcher", "destination_col", "uri")
...
@ -383,9 +389,9 @@ modparam("dispatcher", "destination_col", "uri")
The column's name in the database storing the flags for the destination
URI.
Default value is "flags".
Default value is “flags”.
Example 1.6. Set "flags_col" parameter
Example 1.6. Set “flags_col” parameter
...
modparam("dispatcher", "flags_col", "dstflags")
...
@ -395,9 +401,9 @@ modparam("dispatcher", "flags_col", "dstflags")
The column's name in the database storing the priority for destination
URI.
Default value is "priority".
Default value is “priority”.
Example 1.7. Set "priority_col" parameter
Example 1.7. Set “priority_col” parameter
...
modparam("dispatcher", "priority_col", "dstpriority")
...
@ -408,9 +414,9 @@ modparam("dispatcher", "priority_col", "dstpriority")
when that is already set. If set to 0, will return error when the
destination address is already set.
Default value is "1".
Default value is “1”.
Example 1.8. Set the "force_dst" parameter
Example 1.8. Set the “force_dst” parameter
...
modparam("dispatcher", "force_dst", 1)
...
@ -429,9 +435,9 @@ modparam("dispatcher", "force_dst", 1)
destination set in the AVP, and use these AVPs to contact next address
if the current-tried destination fails.
Default value is "0".
Default value is “0”.
Example 1.9. Set the "flags" parameter
Example 1.9. Set the “flags” parameter
...
modparam("dispatcher", "flags", 3)
...
@ -443,9 +449,9 @@ modparam("dispatcher", "force_dst", 1)
useful when wanting to send the call to an anouncement server saying:
"the gateways are full, try later".
Default value is "0".
Default value is “0”.
Example 1.10. Set the "use_default" parameter
Example 1.10. Set the “use_default” parameter
...
modparam("dispatcher", "use_default", 1)
...
@ -463,9 +469,9 @@ Note
You must set this parameter if you want to do load balancing fail over.
Default value is "null" - don't add AVPs.
Default value is “null” - don't add AVPs.
Example 1.11. Set the "dst_avp" parameter
Example 1.11. Set the “dst_avp” parameter
...
modparam("dispatcher", "dst_avp", "$avp(dsdst)")
...
@ -479,9 +485,9 @@ Note
You must set this parameter if you want to do load balancing fail over.
Default value is "null" - don't add AVP.
Default value is “null” - don't add AVP.
Example 1.12. Set the "grp_avp" parameter
Example 1.12. Set the “grp_avp” parameter
...
modparam("dispatcher", "grp_avp", "$avp(dsgrp)")
...
@ -495,9 +501,9 @@ Note
You must set this parameter if you want to do load balancing fail over.
Default value is "null" - don't add AVP.
Default value is “null” - don't add AVP.
Example 1.13. Set the "cnt_avp" parameter
Example 1.13. Set the “cnt_avp” parameter
...
modparam("dispatcher", "cnt_avp", "$avp(dscnt)")
...
@ -512,9 +518,9 @@ Note
You must set this parameter if you want to do load balancing on call
load (alg 10).
Default value is "null" - don't add AVP.
Default value is “null” - don't add AVP.
Example 1.14. Set the "dstid_avp" parameter
Example 1.14. Set the “dstid_avp” parameter
...
modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")
...
@ -525,9 +531,9 @@ Note
Note
Default value is "null" - don't add AVP.
Default value is “null” - don't add AVP.
Example 1.15. Set the "attrs_avp" parameter
Example 1.15. Set the “attrs_avp” parameter
...
modparam("dispatcher", "attrs_avp", "$avp(dsattrs)")
...
@ -542,9 +548,9 @@ Note
If you want to do load balancing fail over, you have to set this
parameter to use the correct socket for each gateway.
Default value is "null" - don't add AVPs.
Default value is “null” - don't add AVPs.
Example 1.16. Set the "sock_avp" parameter
Example 1.16. Set the “sock_avp” parameter
...
modparam("dispatcher", "sock_avp", "$avp(dssocket)")
...
@ -558,7 +564,7 @@ Note
You must set this parameter if you want do hashing over custom message
parts.
Default value is "null" - disabled.
Default value is “null” - disabled.
Example 1.17. Use $avp(i:273) for hashing:
...
@ -575,9 +581,9 @@ Note
The name of the PV where to store the set ID (group ID) when calling
ds_is_from_list() with no parameter.
Default value is "null" - don't set PV.
Default value is “null” - don't set PV.
Example 1.19. Set the "setid_pvname" parameter
Example 1.19. Set the “setid_pvname” parameter
...
modparam("dispatcher", "setid_pvname", "$var(setid)")
...
@ -587,9 +593,9 @@ Note
The name of the PV where to store the attributes of matching address
when calling ds_is_from_list().
Default value is "null" - don't set PV.
Default value is “null” - don't set PV.
Example 1.20. Set the "attrs_pvname" parameter
Example 1.20. Set the “attrs_pvname” parameter
...
modparam("dispatcher", "attrs_pvname", "$var(attrs)")
...
@ -600,9 +606,9 @@ Note
the gateways. Pinging gateways feature depends on ds_ping_interval
parameter.
Default value is "OPTIONS".
Default value is “OPTIONS”.
Example 1.21. Set the "ds_ping_method" parameter
Example 1.21. Set the “ds_ping_method” parameter
...
modparam("dispatcher", "ds_ping_method", "INFO")
...
@ -613,9 +619,9 @@ Note
to the failed gateways. This method is only available, if compiled with
the probing of failed gateways enabled.
Default value is "sip:dispatcher@localhost".
Default value is “sip:dispatcher@localhost”.
Example 1.22. Set the "ds_ping_from" parameter
Example 1.22. Set the “ds_ping_from” parameter
...
modparam("dispatcher", "ds_ping_from", "sip:proxy@sip.somehost.com")
...
@ -625,11 +631,11 @@ Note
With this parameter you can define the interval for sending a request
to a gateway marked as inactive upon a failed request routing to it.
This parameter is only used, when the TM-Module is loaded. If set to
"0", the pinging of inactive gateway is disabled.
“0”, the pinging of inactive gateway is disabled.
Default value is "0".
Default value is “0”.
Example 1.23. Set the "ds_ping_interval" parameter
Example 1.23. Set the “ds_ping_interval” parameter
...
modparam("dispatcher", "ds_ping_interval", 30)
...
@ -643,9 +649,9 @@ Note
The number of attempts can be set with this parameter. This parameter
can be modified via ser config framework.
Default value is "1" (set inactive with first failure).
Default value is “1” (set inactive with first failure).
Example 1.24. Set the "ds_probing_threshold" parameter
Example 1.24. Set the “ds_probing_threshold” parameter
...
modparam("dispatcher", "ds_probing_threshold", 10)
...
@ -658,9 +664,9 @@ Note
with this parameter. This parameter can be modified via ser config
framework.
Default value is "1" (set active with first success).
Default value is “1” (set active with first success).
Example 1.25. Set the "ds_inactive_threshold" parameter
Example 1.25. Set the “ds_inactive_threshold” parameter
...
modparam("dispatcher", "ds_inactive_threshold", 10)
...
@ -683,9 +689,9 @@ Note
the case of no response from the remote server, and this internal code
408 is accepted as vaild value.
Default value is "" (only 200 OK is accepted).
Default value is “” (only 200 OK is accepted).
Example 1.26. Set the "ds_ping_reply_codes" parameter
Example 1.26. Set the “ds_ping_reply_codes” parameter
...
modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=403;code=488;class=
3")
@ -707,9 +713,9 @@ Note
selected gateways to be probed continually, regardless of state
changes.
Default value is "0".
Default value is “0”.
Example 1.27. Set the "ds_probing_mode" parameter
Example 1.27. Set the “ds_probing_mode” parameter
...
modparam("dispatcher", "ds_probing_mode", 1)
...
@ -721,9 +727,9 @@ Note
a hash table with 256 slots). It must be greater than 0 to enable call
load dispatching feature (alg 10).
Default value is "0".
Default value is “0”.
Example 1.28. Set the "ds_hash_size" parameter
Example 1.28. Set the “ds_hash_size” parameter
...
modparam("dispatcher", "ds_hash_size", 9)
...
@ -733,9 +739,9 @@ Note
Expiration time in seconds to remove the load on a destination if no
BYE was received meanwhile.
Default value is "7200".
Default value is “7200”.
Example 1.29. Set the "ds_hash_expire" parameter
Example 1.29. Set the “ds_hash_expire” parameter
...
modparam("dispatcher", "ds_hash_expire", 3600)
...
@ -746,9 +752,9 @@ Note
200 for INVITE was received meanwhile and state updated with
ds_load_update().
Default value is "7200".
Default value is “7200”.
Example 1.30. Set the "ds_hash_initexpire" parameter
Example 1.30. Set the “ds_hash_initexpire” parameter
...
modparam("dispatcher", "ds_hash_initexpire", 60)
...
@ -758,9 +764,9 @@ Note
Time interval in seconds to scan internal hash table with call load
dispatching data for expired items.
Default value is "30".
Default value is “30”.
Example 1.31. Set the "ds_hash_check_interval" parameter
Example 1.31. Set the “ds_hash_check_interval” parameter
...
modparam("dispatcher", "ds_hash_check_interval", 60)
...
@ -771,7 +777,7 @@ Note
By default no outbound proxy is defined.
Example 1.32. Set the "outbound_proxy" parameter
Example 1.32. Set the “outbound_proxy” parameter
...
modparam("dispatcher", "outbound_proxy", "sip:outbound.example.com")
...
@ -784,7 +790,7 @@ Note
By default no default socket is defined, the first configuration script
listen directive is used.
Example 1.33. Set the "ds_default_socket" parameter
Example 1.33. Set the “ds_default_socket” parameter
...
modparam("dispatcher", "ds_default_socket", "udp:192.168.0.125:5060")
...
@ -802,9 +808,9 @@ Note
performances, because the main timer can be overloaded by taking care
of transactions retransmissions and expirations of items in memory.
Default value is "0".
Default value is “0”.
Example 1.34. Set the "ds_timer_mode" parameter
Example 1.34. Set the “ds_timer_mode” parameter
...
modparam("dispatcher", "ds_timer_mode", 1)
...
@ -821,7 +827,7 @@ Note
4.8. ds_load_update()
4.9. ds_load_unset()
4.1. ds_select_dst(set, alg[, limit])
4.1. ds_select_dst(set, alg[, limit])
The method selects a destination from addresses set. It returns true if
a new destination is set. The selected address is set to dst_uri field
@ -840,22 +846,22 @@ Note
be an integer or a variable holding an integer.
* alg - the algorithm used to select the destination address. The
parameter can be an integer or a variable holding an interger.
+ "0" - hash over callid
+ "1" - hash over from URI.
+ "2" - hash over to URI.
+ "3" - hash over request-URI.
+ "4" - round-robin (next destination).
+ "5" - hash over authorization-username (Proxy-Authorization or
+ “0” - hash over callid
+ “1” - hash over from URI.
+ “2” - hash over to URI.
+ “3” - hash over request-URI.
+ “4” - round-robin (next destination).
+ “5” - hash over authorization-username (Proxy-Authorization or
"normal" authorization). If no username is found, round robin
is used.
+ "6" - random destination (using rand()).
+ "7" - hash over the content of PVs string. Note: This works
+ “6” - random destination (using rand()).
+ “7” - hash over the content of PVs string. Note: This works
only when the parameter hash_pvar is set.
+ "8" - select destination sorted by priority attribute value
+ “8” - select destination sorted by priority attribute value
(serial forking ordered by priority).
+ "9" - use weight based load distribution. You have to set the
+ “9” - use weight based load distribution. You have to set the
attribute 'weight' per each address in destination set.
+ "10" - use call load distribution. You have to set the
+ “10” - use call load distribution. You have to set the
attribute 'duid' (as an unique string id) per each address in
destination set. Also, you must set parameters 'dstid_avp' and
'ds_hash_size'.
@ -870,7 +876,7 @@ Note
on each address can change.
This algorithm can be used only for dispatching INVITE
requests as it is the only SIP method creating a SIP call.
+ "11" - use relative weight based load distribution. You have
+ “11” - use relative weight based load distribution. You have
to set the attribute 'rweight' per each address in destination
set. Active host usage probability is rweight/(SUM of all
active host rweights in destination group).
@ -880,7 +886,7 @@ Note
For example, 100 calls in 3-hosts group with rweight params
1/2/1 will be distributed as 25/50/25. After third host
failing distribution will be changed to 33/67/0.
+ "X" - if the algorithm is not implemented, the first entry in
+ “X” - if the algorithm is not implemented, the first entry in
set is chosen.
* limit - the maximum number of items to be stored in AVP list for
further failovers (the first selected destination and default
@ -903,7 +909,7 @@ ds_select_dst("1", "$var(a)");
ds_select_dst("1", "4", "3");
...
4.2. ds_select_domain(set, alg[, limit])
4.2. ds_select_domain(set, alg[, limit])
The method selects a destination from addresses set and rewrites the
host and port from R-URI. The parameters have same meaning as for
@ -916,21 +922,21 @@ ds_select_dst("1", "4", "3");
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
4.3. ds_next_dst()
4.3. ds_next_dst()
Takes the next destination address from the AVPs with id 'dst_avp_id'
and sets the dst_uri (outbound proxy address).
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
4.4. ds_next_domain()
4.4. ds_next_domain()
Takes the next destination address from the AVPs with id 'dst_avp_id'
and sets the domain part of the request URI.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
4.5. ds_mark_dst([state])
4.5. ds_mark_dst([state])
Mark the last used address from destination set as inactive ("i"/"I"),
active ("a"/"A"), disabled ("d"/"D") or trying ("t"/"T"). Apart of
@ -967,7 +973,7 @@ failure_route[tryagain] {
}
...
4.6. ds_list_exist(groupid)
4.6. ds_list_exist(groupid)
Check if a specific group is defined in dispatcher list or database.
* groupid - A group ID to check.
@ -981,7 +987,7 @@ if(ds_list_exist("10")) {
}
...
4.7. ds_is_from_list([groupid [, mode [, uri] ] ])
4.7. ds_is_from_list([groupid [, mode [, uri] ] ])
This function returns true, if there is a match of source address or
uri with an address in the given group of the dispatcher-list;
@ -1033,7 +1039,7 @@ if(ds_is_from_list("10", "3", "sip:127.0.0.1:5080")) {
}
...
4.8. ds_load_update()
4.8. ds_load_update()
Updates the load state:
* if it is a BYE or CANCEL - remove the load from destination address
@ -1044,7 +1050,7 @@ if(ds_is_from_list("10", "3", "sip:127.0.0.1:5080")) {
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE and ONREPLY_ROUTE.
4.9. ds_load_unset()
4.9. ds_load_unset()
Remove the call load for the destination that routed the call.
@ -1081,7 +1087,7 @@ onreply_route {
5.2. ds_list
5.3. ds_reload
5.1. ds_set_state
5.1. ds_set_state
Sets the status for a destination address (can be use to mark the
destination as active or inactive).
@ -1090,11 +1096,11 @@ onreply_route {
Parameters:
* _state_ : state of the destination address
+ "a": active
+ "i": inactive
+ "t": trying
+ "d": disabled
The states "a", "i" or "t" can be followed by "p" to set probing
+ “a”: active
+ “i”: inactive
+ “t”: trying
+ “d”: disabled
The states “a”, “i” or “t” can be followed by “p” to set probing
mode (e.g. 'ap', 'ip' or 'tp').
* _group_: destination group id
* _address_: address of the destination in the _group_
@ -1106,7 +1112,7 @@ onreply_route {
_address_
_empty_line_
5.2. ds_list
5.2. ds_list
It lists the groups and included destinations.
@ -1118,7 +1124,7 @@ onreply_route {
:ds_list:_reply_fifo_file_
_empty_line_
5.3. ds_reload
5.3. ds_reload
It reloads the groups and included destinations. For algorithm 10 (call
load distribution), old internal list of active calls is destroyed
@ -1139,7 +1145,7 @@ onreply_route {
6.3. dispatcher.reload
6.4. dispatcher.ping_active
6.1. dispatcher.set_state
6.1. dispatcher.set_state
Sets the state for a destination address (can be use to mark the
destination as active or inactive).
@ -1148,11 +1154,11 @@ onreply_route {
Parameters:
* _state_ : state of the destination address
+ "a": active
+ "i": inactive
+ "t": trying
+ "d": disabled
The states "a", "i" or "t" can be followed by "p" to set probing
+ “a”: active
+ “i”: inactive
+ “t”: trying
+ “d”: disabled
The states “a”, “i” or “t” can be followed by “p” to set probing
mode (e.g. 'ap', 'ip' or 'tp').
* _group_: destination group id
* _address_: address of the destination in the _group_
@ -1163,7 +1169,7 @@ onreply_route {
kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080
...
6.2. dispatcher.list
6.2. dispatcher.list
Lists the groups and included destinations.
@ -1174,7 +1180,7 @@ kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080
Example:
kamcmd dispatcher.list
6.3. dispatcher.reload
6.3. dispatcher.reload
Reloads the groups and included destinations. The command is disabled
for call load based dispatching (algorithm 10) since removal of
@ -1187,7 +1193,7 @@ kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080
Example
kamcmd dispatcher.reload
6.4. dispatcher.ping_active
6.4. dispatcher.ping_active
Sets the global state for sending keepalive requests to destinations.
@ -1195,8 +1201,8 @@ kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080
Parameters:
* _state_ : state of sending keepalives
+ "0": inactive (don't send)
+ "1": active (send)
+ “0”: inactive (don't send)
+ “1”: active (send)
If the state parameter is missing, the current state is returned. When
state is changed, new and old values of the state are returned. Default
@ -1587,7 +1593,7 @@ failure_route[RTF_DISPATCH] {
8.1. dispatcher:dst-down
8.2. dispatcher:dst-up
8.1. dispatcher:dst-down
8.1. dispatcher:dst-down
When defined, the module calls event_route[dispatcher:ds-down] when a
destination goes down (becomes probing). A typical use case is to
@ -1598,7 +1604,7 @@ event_route[dispatcher:dst-down] {
}
...
8.2. dispatcher:dst-up
8.2. dispatcher:dst-up
When defined, the module calls event_route[dispatcher:ds-up] when a
destination that was previously down (probing) comes up. A typical use
@ -1619,51 +1625,52 @@ Chapter 2. Frequently Asked Questions
2.1.
Does dispatcher provide a fair distribution?
Does dispatcher provide a fair distribution?
The algoritms doing hashing over parts of SIP message don't guarantee a
fair distribution. You should do some measurements to decide what
hashing algorithm fits better in your environment.
The algoritms doing hashing over parts of SIP message don't guarantee a
fair distribution. You should do some measurements to decide what
hashing algorithm fits better in your environment.
Other distribution algorithms such as round robin or call load
dispatching do a fair distribution in terms of delivered calls to
gateways.
Other distribution algorithms such as round robin or call load
dispatching do a fair distribution in terms of delivered calls to
gateways.
2.2.
Is dispatcher dialog stateful?
Is dispatcher dialog stateful?
No. Dispatcher is stateless, although some distribution algorithms are
designed to select same destination for subsequent requests of the same
dialog (e.g., hashing the call-id).
No. Dispatcher is stateless, although some distribution algorithms are
designed to select same destination for subsequent requests of the same
dialog (e.g., hashing the call-id).
2.3.
Where can I find more about Kamailio?
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
Take a look at http://www.kamailio.org/.
2.4.
Where can I post a question about this module?
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable version should be sent to
<sr-users@lists.sip-router.org> and e-mail regarding development
versions or GIT snapshots should be send to
<sr-dev@lists.sip-router.org>.
E-mails regarding any stable version should be sent to
<sr-users@lists.sip-router.org> and e-mail regarding development
versions or GIT snapshots should be send to
<sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
2.5.
How can I report a bug?
How can I report a bug?
Please follow the guidelines provided at: http://sip-router.org/tracker
Please follow the guidelines provided at:
https://github.com/kamailio/kamailio/issues

@ -225,6 +225,7 @@ int ds_set_attrs(ds_dest_t *dest, str *attrs)
param_hooks_t phooks;
param_t *pit=NULL;
str param;
int tmp_rweight = 0;
if(attrs==NULL || attrs->len<=0)
return 0;
@ -260,7 +261,7 @@ int ds_set_attrs(ds_dest_t *dest, str *attrs)
dest->attrs.socket = pit->body;
}else if(pit->name.len==7
&& strncasecmp(pit->name.s, "rweight", 7)==0) {
int tmp_rweight;
tmp_rweight = 0;
str2sint(&pit->body, &tmp_rweight);
if ( tmp_rweight>=1 && tmp_rweight<=100 ) {
dest->attrs.rweight = tmp_rweight;
@ -1884,7 +1885,6 @@ int ds_select_dst_limit(sip_msg_t *msg, int set, int alg, unsigned int limit, in
default:
LM_ERR("can't get authorization hash\n");
return -1;
break;
}
break;
case 6: /* random selection */

@ -8,7 +8,7 @@ Edited by
Jan Janak
Copyright © 2004 FhG FOKUS
Copyright © 2004 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -95,7 +95,7 @@ Warning
the parameter to specify additional parameters to be added to the
header field, see the example.
Default value is "" (empty string).
Default value is “” (empty string).
Example 1.1. suffix usage
modparam("diversion", "suffix", ";privacy=full")
@ -158,7 +158,7 @@ Content-Length: 0
Chapter 2. Developer Guide
According to the specification a new "Diversion" header field should be
According to the specification a new “Diversion” header field should be
inserted as the topmost Diversion header field in the message, that
means before any other existing Diversion header field in the message.
In addition to that, the add_diversion function can be called several

@ -12,7 +12,7 @@ Andrey Rybkin
bks.tv
<rybkin.a@bks.tv>
Copyright © 2014
Copyright © 2014
__________________________________________________________________
Table of Contents

@ -301,6 +301,8 @@ int usrloc_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t*
int action, expires, cseq, flags, cflags, q, last_modified, methods, reg_id;
str aor, ruid, c, received, path, callid, user_agent, instance;
action = expires = cseq = flags = cflags = q = last_modified = methods = reg_id = 0;
parse_from_header(msg);
body = ((struct to_body*)msg->from->parsed)->uri;

@ -2,7 +2,7 @@ Dnssec Module
Marius Zbihlei
Copyright © 2013
Copyright © 2013
__________________________________________________________________
Table of Contents
@ -120,5 +120,6 @@ Chapter 1. Admin Guide
...
modparam("dnssec", "general_query_flags", 1) # QUERY_DONT_VALIDATE disable vali
dation
modparam("dnssec", "general_query_flags", 10) # QUERY_IGNORE_SKEW | QUERY_NO_DLV
modparam("dnssec", "general_query_flags", 10) # QUERY_IGNORE_SKEW | QUERY_NO_DL
V
...

@ -10,7 +10,7 @@ Juha Heinanen
<jh@tutpro.com>
Copyright © 2002-2012 Juha Heinanen
Copyright © 2002-2012 Juha Heinanen
__________________________________________________________________
Table of Contents
@ -112,18 +112,18 @@ Chapter 1. Admin Guide
1. Overview
Domain module implements checks that based on domain table determine if
a domain is "local". A "local" domain is one that the proxy is
a domain is “local”. A “local” domain is one that the proxy is
responsible for. SIP URIs of local users must have hostpart that is
equal to one of these domains.
Domain module reads the contents of domain and domain_attrs tables into
cache memory when the module is loaded. Any changes in domain or
domain_attrs tables must thus be followed by "domain.reload" rpc
domain_attrs tables must thus be followed by “domain.reload” rpc
command in order to reflect them in module behavior.
Caching is implemented using a hash table. The size of the hash table
is given by HASH_SIZE constant defined in domain_mod.h. Its "factory
default" value is 128.
is given by HASH_SIZE constant defined in domain_mod.h. Its factory
default value is 128.
2. Dependencies
@ -147,7 +147,7 @@ Chapter 1. Admin Guide
This is URL of the database to be used.
Default value is "mysql://kamailioro:kamailioro@localhost/kamailio"
Default value is “mysql://kamailioro:kamailioro@localhost/kamailio”
Example 1.1. Setting db_url parameter
modparam("domain", "db_url", "mysql://ser:pass@db_host/ser")
@ -157,7 +157,7 @@ modparam("domain", "db_url", "mysql://ser:pass@db_host/ser")
Name of table containing names of local domains that the proxy is
responsible for.
Default value is "domain".
Default value is “domain”.
Example 1.2. Setting domain_table parameter
modparam("domain", "domain_table", "new_name")
@ -166,7 +166,7 @@ modparam("domain", "domain_table", "new_name")
Name of table containing attributes of local domains.
Default value is "domain_attrs".
Default value is “domain_attrs”.
Example 1.3. Setting domain_attrs_table parameter
modparam("domain", "domain_attrs_table", "local_domain_attributes")
@ -177,7 +177,7 @@ modparam("domain", "domain_attrs_table", "local_domain_attributes")
domain_attrs tables. In domain table, a did column value may be NULL,
which means that it has same value as domain column.
Default value is "did".
Default value is “did”.
Example 1.4. Setting did_col parameter
modparam("domain", "did_col", "domain_did")
@ -186,7 +186,7 @@ modparam("domain", "did_col", "domain_did")
Name of column containing domain name in domain table.
Default value is "domain".
Default value is “domain”.
Example 1.5. Setting domain_col parameter
modparam("domain", "domain_col", "domain_name")
@ -195,7 +195,7 @@ modparam("domain", "domain_col", "domain_name")
Name of column containing attribute name in domain_attrs table.
Default value is "name".
Default value is “name”.
Example 1.6. Setting name_col parameter
modparam("domain", "name_col", "attr_name")
@ -205,7 +205,7 @@ modparam("domain", "name_col", "attr_name")
Name of column containing attribute type in domain_attrs table. Type
value 0 is integer and type value 2 is string.
Default value is "type".
Default value is “type”.
Example 1.7. Setting name_col parameter
modparam("domain", "type_col", "attr_type")
@ -214,7 +214,7 @@ modparam("domain", "type_col", "attr_type")
Name of column containing attribute value in domain_attrs table.
Default value is "value".
Default value is “value”.
Example 1.8. Setting value_col parameter
modparam("domain", "value_col", "attr_value")

@ -20,7 +20,7 @@ Klaus Darilion
<klaus.darilion@enum.at>
Copyright © 2002, 2003, 2006 Juha Heinanen, Otmar Lendl, Klaus Darilion
Copyright © 2002, 2003, 2006 Juha Heinanen, Otmar Lendl, Klaus Darilion
__________________________________________________________________
Table of Contents
@ -151,7 +151,7 @@ Chapter 1. Admin Guide
This is URL of the database to be used.
Default value is "mysql://openser:openserrw@localhost/openser"
Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”
Example 1.1. Setting db_url parameter
modparam("domainpolicy", "db_url", "postgres://proxy:frog23@db.sip-router.org/si
@ -161,7 +161,7 @@ pdb")
Name of table containing the local support domain policy setup.
Default value is "domainpolicy".
Default value is “domainpolicy”.
Example 1.2. Setting dp_table parameter
modparam("domainpolicy", "dp_table", "supportedpolicies")
@ -171,7 +171,7 @@ modparam("domainpolicy", "dp_table", "supportedpolicies")
Name of column containing the domain policy rule name which is equal to
the URI as published in the domain policy NAPTRs.
Default value is "rule".
Default value is “rule”.
Example 1.3. Setting dp_col_rule parameter
modparam("domainpolicy", "dp_col_rule", "rules")
@ -183,7 +183,7 @@ modparam("domainpolicy", "dp_col_rule", "rules")
draft-lendl-speermint-technical-policy-00, this is "std". For direct
domain lookups, this is "dom".
Default value is "type".
Default value is “type”.
Example 1.4. Setting dp_col_rule parameter
modparam("domainpolicy", "dp_col_type", "type")
@ -193,7 +193,7 @@ modparam("domainpolicy", "dp_col_type", "type")
Name of column containing the AVP's name. If the rule stored in this
row triggers, than dp_can_connect() will add an AVP with that name.
Default value is "att".
Default value is “att”.
Example 1.5. Setting dp_col_att parameter
modparam("domainpolicy", "dp_col_att", "attribute")
@ -203,7 +203,7 @@ modparam("domainpolicy", "dp_col_att", "attribute")
Name of column containing the value for AVPs created by
dp_can_connect().
Default value is "val".
Default value is “val”.
Example 1.6. Setting dp_col_val parameter
modparam("domainpolicy", "dp_col_val", "values")
@ -213,7 +213,7 @@ modparam("domainpolicy", "dp_col_val", "values")
This parameter defines the name of the AVP where dp_apply_policy() will
look for an override port number.
Default value is "portoverride".
Default value is “portoverride”.
Example 1.7. Setting port_override_avp parameter
# string named AVP
@ -223,7 +223,7 @@ modparam("domainpolicy", "port_override_avp", "portoverride")
Name of the AVP which contains the override transport setting.
Default value is "transportoverride".
Default value is “transportoverride”.
Example 1.8. Setting transport_override_avp parameter
# string named AVP
@ -233,7 +233,7 @@ modparam("domainpolicy", "transport_override_avp", "transportoverride")
Name of the AVP which contains a domain replacement.
Default value is "domainreplacement".
Default value is “domainreplacement”.
Example 1.9. Setting domain_replacement_avp parameter
# string named AVP
@ -243,7 +243,7 @@ modparam("domainpolicy", "domain_replacement_avp", "domainreplacement")
Name of the AVP which contains a domain prefix.
Default value is "domainprefix".
Default value is “domainprefix”.
Example 1.10. Setting domain_prefix_avp parameter
# string named AVP
@ -253,7 +253,7 @@ modparam("domainpolicy", "domain_prefix_avp", "domainprefix")
Name of the AVP which contains a domain suffix.
Default value is "domainsuffix".
Default value is “domainsuffix”.
Example 1.11. Setting domain_suffix_avp parameter
# string named AVP
@ -267,7 +267,7 @@ modparam("domainpolicy", "domain_suffix_avp", "domainsuffix")
this AVP and if defined, it will force the send socket to its value
(similar to the force_send_socket core function).
Default value is "sendsocket".
Default value is “sendsocket”.
Example 1.12. Setting send_socket_avp parameter
# string named AVP

@ -10,7 +10,7 @@ Edited by
Anca-Maria Vamanu
Copyright © 2005-2008 Voice Sistem SRL
Copyright © 2005-2008 Voice Sistem SRL
__________________________________________________________________
Table of Contents
@ -234,7 +234,7 @@ Chapter 1. Admin Guide
1.4.1. Gateway Addresses
Default name for the table storing gateway addresses is "dr_gateways".
Default name for the table storing gateway addresses is “dr_gateways”.
Gateway addresses are stored in a separate table because of need to
access them independent of Dynamic Routing processing (e.g., adding/
removing gateway PRI prefix before/after performing other operation --
@ -270,12 +270,12 @@ Chapter 1. Admin Guide
group of destinations is delimited by semi-colon char. inside the whole
destination list ( like: 2,4;5,78,23;4;7;2 ). The destinations from
within a group may be act differently (like load-balancing, random
selection, etc), depending of the "sort_order" module parameter - more
selection, etc), depending of the “sort_order” module parameter - more
about this is available under the module paramters section.
1.4.3. Routing Rules
Default name for the table storing rule definitions is "dr_rules".
Default name for the table storing rule definitions is “dr_rules”.
Table 1.3. Definition of dr_rules table
Column name Type Default Description
@ -304,18 +304,18 @@ Chapter 1. Admin Guide
draft 09):
Table 1.4. Time recurrence attributes
Attribute Description
dastard Start of interval (RFC 2445 DATE-TIME)
duration Length of interval (RFC 2445 DURATION)
freq Frequency of recurrence (secondly,minutely,hourly, daily,weekly,
monthly, or yearly).
until bound of recurrence (RFC 2445 DATE-TIME)
interval How often the recurrence repeats
byday List of days of the week
bymonthday List of days of the month
byyearday List of days of the year
byweekno List of weeks of the year
bymonth List of months of the year
Attribute Description
dastard Start of interval (RFC 2445 DATE-TIME)
duration Length of interval (RFC 2445 DURATION)
freq Frequency of recurrence (secondly,minutely,hourly, daily,weekly,
monthly, or yearly).
until bound of recurrence (RFC 2445 DATE-TIME)
interval How often the recurrence repeats
byday List of days of the week
bymonthday List of days of the month
byyearday List of days of the year
byweekno List of weeks of the year
bymonth List of months of the year
The value stored in database has the format of:
<dtstart>|<duration>|<freq>|<until>|<interval>|<byday>|<bymonthday>
|<byyearday>|<byweekno>|<bymonth>
@ -325,52 +325,52 @@ Chapter 1. Admin Guide
Detailed description of time recurrence attributes:
+ dtstart - specifies the beginning of the first period.
+ duration - specifies the duration of the period. For a
recurring interval, the "duration" parameter MUST be small
recurring interval, the “duration” parameter MUST be small
enough such that subsequent intervals do not overlap. For
non-recurring intervals, durations of any positive length are
permitted, zero-length duration means "forever".
permitted, zero-length duration means “forever”.
Negative-length durations are not allowed. In the common case
of a duration less than one day, the value starts with 'PT'
followed by number of hours, minutes and seconds, e.g., a
duration of 8 hours and 30 minutes is written 'PT8H30M'. See
RFC 2445 DURATION specifications for full format.
+ freq - takes one of the following values: "daily", to specify
+ freq - takes one of the following values: “daily”, to specify
repeating periods based on an interval of a day or more;
"weekly", to specify repeating periods based on an interval of
a week or more; "monthly", to specify repeating periods based
on an interval of a month or more; and "yearly", to specify
“weekly”, to specify repeating periods based on an interval of
a week or more; “monthly”, to specify repeating periods based
on an interval of a month or more; and “yearly”, to specify
repeating periods based on an interval of a year or more.
These values are not case-sensitive.
+ until - defines an iCalendar COS DATE or DATE-TIME value which
bounds the recurrence rule in an inclusive manner. If the
value specified by "until" is synchronized with the specified
value specified by “until” is synchronized with the specified
recurrence, this date or date-time becomes the last instance
of the recurrence. If not present, the recurrence is
considered to repeat forever.
+ interval - contains a positive integer representing how often
the recurrence rule repeats. The default value is "1", meaning
every day for a "daily" rule, every week for a "weekly" rule,
every month for a "monthly" rule and every year for a "yearly"
the recurrence rule repeats. The default value is “1”, meaning
every day for a “daily” rule, every week for a “weekly” rule,
every month for a “monthly” rule and every year for a “yearly”
rule.
+ interval - contains a positive integer representing how often
the recurrence rule repeats. The default value is "1", meaning
every day for a "daily" rule, every week for a "weekly" rule,
every month for a "monthly" rule and every year for a "yearly"
the recurrence rule repeats. The default value is “1”, meaning
every day for a “daily” rule, every week for a “weekly” rule,
every month for a “monthly” rule and every year for a “yearly”
rule.
+ byday - specifies a comma-separated list of days of the week.
"MO" indicates Monday; "TU" indicates Tuesday; "WE" indicates
Wednesday; "TH" indicates Thursday; "FR" indicates Friday;
"SA" indicates Saturday; "SU" indicates Sunday. These values
“MO” indicates Monday; “TU” indicates Tuesday; “WE” indicates
Wednesday; “TH” indicates Thursday; “FR” indicates Friday;
“SA” indicates Saturday; “SU” indicates Sunday. These values
are not case-sensitive.
Each "byday" value can also be preceded by a positive (+n) or
Each “byday” value can also be preceded by a positive (+n) or
negative (-n) integer. If present, this indicates the nth
occurrence of the specific day within the "monthly" or
"yearly" recurrence. For example, within a "monthly" rule,
occurrence of the specific day within the “monthly” or
“yearly” recurrence. For example, within a “monthly” rule,
+1MO (or simply 1MO) represents the first Monday within the
month, whereas -1MO represents the last Monday of the month.
If an integer modifier is not present, it means all days of
this type within the specified frequency. For example, within
a "monthly" rule, MO represents all Mondays within the month.
a “monthly” rule, MO represents all Mondays within the month.
+ bymonthday - parameter specifies a comma-separated list of
days of the month. Valid values are 1 to 31 or -31 to -1. For
example, -10 represents the tenth to the last day of the
@ -384,37 +384,37 @@ Chapter 1. Admin Guide
to -1.
+ bymonth - parameter specifies a comma-separated list of months
of the year. Valid values are 1 to 12.
A recurrence is specified by including the "freq" parameter, which
A recurrence is specified by including the “freq” parameter, which
indicates the type of recurrence rule. Parameters other than
"dtstart" and "duration" SHOULD NOT be specified unless "freq" is
“dtstart” and “duration” SHOULD NOT be specified unless “freq” is
present.
If byxxx parameter values are found which are beyond the available
scope (ie, bymonthday="30" in February), they are simply ignored.
scope (ie, bymonthday=“30” in February), they are simply ignored.
Byxxx parameters modify the recurrence in some manner. Byxxx rule
parts for a period of time which is the same or greater than the
frequency generally reduce or limit the number of occurrences of
the recurrence generated. For example, freq="daily" bymonth="1"
the recurrence generated. For example, freq=“daily” bymonth=“1”
reduces the number of recurrence instances from all days (if the
"bymonth" parameter is not present) to all days in January. Byxxx
“bymonth” parameter is not present) to all days in January. Byxxx
parameters for a period of time less than the frequency generally
increase or expand the number of occurrences of the recurrence. For
example, freq="yearly" bymonth="1,2" increases the number of days
within the yearly recurrence set from 1 (if "bymonth" parameter is
example, freq=“yearly” bymonth=“1,2” increases the number of days
within the yearly recurrence set from 1 (if “bymonth” parameter is
not present) to 2.
If multiple Byxxx parameters are specified, then after evaluating
the specified "freq" and "interval" parameters, the Byxxx
the specified “freq” and “interval” parameters, the Byxxx
parameters are applied to the current set of evaluated occurrences
in the following order: "bymonth", "byweekno", "byyearday",
"bymonthday", "byday"; then "until" is evaluated.
in the following order: “bymonth”, “byweekno”, “byyearday”,
“bymonthday”, “byday”; then “until” is evaluated.
Here is an example of evaluating multiple Byxxx parameters.
dtstart="19970105T083000" duration="PT10M" freq="yearly"
interval="2" bymonth="1" byday="SU"
First, the interval="2" would be applied to freq="yearly" to arrive
at "every other year" . Then, bymonth="1" would be applied to
arrive at "every January, every other year". Then, byday="SU" would
be applied to arrive at "every Sunday in January, every other year,
from 8:30 to 8:40 ". The appropriate minutes and hours have been
retrieved from the "dtstart" and "duration" parameters.
dtstart=“19970105T083000” duration=“PT10M” freq=“yearly”
interval=“2” bymonth=“1” byday=“SU”
First, the interval=“2” would be applied to freq=“yearly” to arrive
at “every other year” . Then, bymonth=“1” would be applied to
arrive at “every January, every other year”. Then, byday=“SU” would
be applied to arrive at every Sunday in January, every other year,
from 8:30 to 8:40 . The appropriate minutes and hours have been
retrieved from the “dtstart” and “duration” parameters.
d. priority column
If many rules are eligible, choose the one with highest priority.
e. routeid column
@ -424,8 +424,8 @@ Chapter 1. Admin Guide
level.
f. gwlist column
A comma separated list of gateway identifiers corresponding to a
row in table "dr_gateways". You can use a predefined list from the
table "dr_gw_lists" preceded by the character "#". The first
row in table “dr_gateways”. You can use a predefined list from the
table “dr_gw_lists” preceded by the character “#”. The first
gateway is tried first and if routing to it fails, then the second
one, and so one. If no gateway is left a negative response is sent
back to caller.
@ -437,7 +437,7 @@ Chapter 1. Admin Guide
2 8 0049 20040101T083000 0 0 1,2 Rule 2
3 7,8,9 0049 20040101T083000 0 0 3 Rule 3
(The time recurrence for first rule is:
"20040101T083000|10H|weekly|||MO,TU,WE,TH,FR")
“20040101T083000|10H|weekly|||MO,TU,WE,TH,FR”)
1.5. Routing Rule Processing
@ -505,7 +505,7 @@ Chapter 1. Admin Guide
The database url.
Default value is "NULL".
Default value is “NULL”.
Example 1.1. Set db_url parameter
...
@ -517,7 +517,7 @@ modparam("drouting", "db_url",
The name of the db table storing gateway addresses.
Default value is "dr_gateways".
Default value is “dr_gateways”.
Example 1.2. Set drd_table parameter
...
@ -528,7 +528,7 @@ modparam("drouting", "drd_table", "dr_gateways")
The name of the db table storing routing rules.
Default value is "dr_rules".
Default value is “dr_rules”.
Example 1.3. Set drr_table parameter
...
@ -539,7 +539,7 @@ modparam("drouting", "drr_table", "rules")
The name of the db table storing groups.
Default value is "dr_groups".
Default value is “dr_groups”.
Example 1.4. Set drg_table parameter
...
@ -554,7 +554,7 @@ modparam("drouting", "drg_table", "groups")
individual elements. Very useful to reuse a list of gateways in
different places.
Default value is "dr_gw_lists".
Default value is “dr_gw_lists”.
Example 1.5. Set drl_table parameter
...
@ -585,7 +585,7 @@ modparam("drouting", "drl_table", "my_gw_lists")
case there are 2 failures, all the three gateways (1,2,3) will be
tried in a random order.
Default value is "0".
Default value is “0”.
Example 1.6. Set sort_order parameter
...
@ -597,7 +597,7 @@ modparam("drouting", "sort_order", 2)
The name of the avp for storing Request URIs to be later used
(alternative destiantions for the current one).
Default value is "NULL".
Default value is “NULL”.
Example 1.7. Set ruri_avp parameter
...
@ -612,7 +612,7 @@ modparam("drouting", "ruri_avp", '$avp(i:33)')
function), the AVP will be updated with the attrs of the new used
destination.
Default value is "NULL".
Default value is “NULL”.
Example 1.8. Set attrs_avp parameter
...
@ -625,7 +625,7 @@ modparam("drouting", "atrrs_avp", '$avp(i:67)')
Flag to configure whether to use domain match when querying database
for user's routing group.
Default value is "1".
Default value is “1”.
Example 1.9. Set use_domain parameter
...
@ -636,7 +636,7 @@ modparam("drouting", "use_domain", 0)
The name of the column in group db table where the username is stored.
Default value is "username".
Default value is “username”.
Example 1.10. Set drg_user_col parameter
...
@ -647,7 +647,7 @@ modparam("drouting", "drg_user_col", "user")
The name of the column in group db table where the domain is stored.
Default value is "domain".
Default value is “domain”.
Example 1.11. Set drg_domain_col parameter
...
@ -658,7 +658,7 @@ modparam("drouting", "drg_domain_col", "host")
The name of the column in group db table where the group id is stored.
Default value is "groupid".
Default value is “groupid”.
Example 1.12. Set drg_grpid_col parameter
...
@ -670,7 +670,7 @@ modparam("drouting", "drg_grpid_col", "grpid")
The number of rows that should be fetched from the result of a query in
rules db table.
Default value is "2000".
Default value is “2000”.
Example 1.13. Set fetch_rows parameter
...
@ -683,7 +683,7 @@ modparam("drouting", "fetch_rows", 1500)
startup. If not enabled, the GW name will be blindly used during
routing.
Default value is "1 (enabled)".
Default value is “1 (enabled)”.
Example 1.14. Set force_dns parameter
...
@ -698,7 +698,7 @@ modparam("drouting", "force_dns", 0)
4.4. is_from_gw([type])
4.5. is_from_gw( type, [flag])
4.1. do_routing("[groupID]")
4.1. do_routing("[groupID]")
Function to trigger routing of the message according to the rules in
the database table and the configured parameters.
@ -718,7 +718,7 @@ do_routing("0");
...
do_routing("$avp(i:10)");
4.2. use_next_gw()/next_routing()
4.2. use_next_gw()/next_routing()
The function takes the next available destination (set by do_routing,
as alternative destinations) and push it into RURI. Note that the
@ -741,7 +741,7 @@ if (use_next_gw()) {
}
...
4.3. goes_to_gw([type])
4.3. goes_to_gw([type])
Function returns true if the destination of the current request
(destination URI or Request URI) points (as IP) to one of the gateways.
@ -762,7 +762,7 @@ if (goes_to_gw("1")) {
}
...
4.4. is_from_gw([type])
4.4. is_from_gw([type])
The function checks if the sender of the message is a gateway from a
certain group.
@ -781,7 +781,7 @@ if (is_from_gw("1") {
}
...
4.5. is_from_gw( type, [flag])
4.5. is_from_gw( type, [flag])
The function checks if the sender of the message is a gateway from a
certain group.
@ -803,7 +803,7 @@ if (is_from_gw("3","1") {
5.1. drouting.reload
5.1. drouting.reload
5.1. drouting.reload
Command to reload routing rules from database.

@ -8,7 +8,7 @@ Otmar Lendl
<lendl@nic.at>
Copyright © 2002, 2003 Juha Heinanen
Copyright © 2002, 2003 Juha Heinanen
__________________________________________________________________
Table of Contents
@ -74,9 +74,9 @@ Chapter 1. Admin Guide
phone number of the form +decimal-digits, where the number of digits is
at least 2 and at most 20. Out of this number enum_query forms a domain
name, where the digits are in reverse order and separated by dots
followed by domain suffix that by default is "e164.arpa.". For example,
followed by domain suffix that by default is “e164.arpa.”. For example,
if the user part is +35831234567, the domain name will be
"7.6.5.4.3.2.1.3.8.5.3.e164.arpa.". i_enum_query operates in a similar
“7.6.5.4.3.2.1.3.8.5.3.e164.arpa.”. i_enum_query operates in a similar
fashion. The only difference is that it adds a label (default "i") to
branch off from the default, user-ENUM tree to an infrastructure ENUM
tree.
@ -143,7 +143,7 @@ Chapter 1. Admin Guide
digits of an E164 number. Can be overridden by a parameter to
enum_query.
Default value is "e164.arpa."
Default value is “e164.arpa.”
Example 1.1. Setting domain_suffix module parameter
modparam("enum", "domain_suffix", "e1234.arpa.")
@ -158,7 +158,7 @@ Note
Currently SIP Router does not support tel URIs. This means that at
present tel_uri_params is appended as URI parameters to every URI.
Default value is ""
Default value is “”
Example 1.2. Setting tel_uri_params module parameter
modparam("enum", "tel_uri_params", ";npdi")
@ -168,7 +168,7 @@ modparam("enum", "tel_uri_params", ";npdi")
The domain suffix to be used for i_enum_query() lookups. Can be
overridden by a parameter to i_enum_query.
Default value is "e164.arpa."
Default value is “e164.arpa.”
Example 1.3. Setting i_enum_suffix module parameter
modparam("enum", "i_enum_suffix", "e1234.arpa.")
@ -178,7 +178,7 @@ modparam("enum", "i_enum_suffix", "e1234.arpa.")
This parameter determines which label i_enum_query() will use to branch
off to the infrastructure ENUM tree.
Default value is ""i""
Default value is “"i"”
Example 1.4. Setting brachlabel module parameter
modparam("enum", "branchlabel", "i")
@ -217,7 +217,7 @@ i.1.e164.arpa. TYPE65300 \# 14 (
; )
9.9.9.8.7.6.5.i.4.3.2.1.e164.arpa. IN NAPTR "NAPTR content for +1 234 5678 999"
Default value is "cc"
Default value is “cc”
Example 1.7. Setting the bl_algorithm module parameter
modparam("enum", "bl_algorithm", "txt")
@ -229,10 +229,10 @@ modparam("enum", "bl_algorithm", "txt")
4.3. i_enum_query(["suffix"[,"service"]])
4.4. is_from_user_enum()
4.1. enum_query(["suffix"[,"service"]])
4.1. enum_query(["suffix"[,"service"]])
The function performs an enum query and rewrites the Request-URI with
the result of the query. See Section 1, "Overview" for more
the result of the query. See Section 1, “Overview” for more
information.
Meaning of the parameters is as follows:
@ -265,11 +265,11 @@ enum_query("e164.arpa.","voice");
enum_query("e164.arpa.","+sip+voice:sip");
...
4.2. enum_pv_query("pvar"[,"suffix"[,"service"]])
4.2. enum_pv_query("pvar"[,"suffix"[,"service"]])
The function performs an enum query on E.164 number stored in its
pseudo variable argument and rewrites the Request-URI with the result
of the query. See Section 1, "Overview" for more information.
of the query. See Section 1, “Overview” for more information.
Meaning of the parameters is as follows:
* pvar - Pseudo variable that holds an E.164 number on which enum
@ -301,7 +301,7 @@ enum_pv_query("$avp(i:100)","e164.arpa.","voice");
enum_pv_query("$avp(i:100)","e164.arpa.","+sip+voice:sip");
...
4.3. i_enum_query(["suffix"[,"service"]])
4.3. i_enum_query(["suffix"[,"service"]])
The function performs an enum query and rewrites the Request-URI with
the result of the query. This the Infrastructure-ENUM version of

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2014 asipto.com
Copyright © 2014 asipto.com
__________________________________________________________________
Table of Contents
@ -158,7 +158,7 @@ modparam("evapi", "netstring_format", 0)
4.2. evapi_async_relay(evdata)
4.3. evapi_close()
4.1. evapi_relay(evdata)
4.1. evapi_relay(evdata)
Relay the event data given as parameter to connected applications.
@ -188,7 +188,7 @@ evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
},
...
4.2. evapi_async_relay(evdata)
4.2. evapi_async_relay(evdata)
Relay the event data given as parameter to connected applications.
Before evaluating the parameter, the request processing is suspended
@ -210,7 +210,7 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
...
4.3. evapi_close()
4.3. evapi_close()
Close evapi current client connection.
@ -232,7 +232,7 @@ event_route[evapi:connection-new] {
5.2. evapi:connection-closed
5.3. evapi:message-received
5.1. evapi:connection-new
5.1. evapi:connection-new
If defined, the module calls event_route[evapi:connection-new] when a
new client is connected.
@ -242,7 +242,7 @@ event_route[evapi:connection-new] {
}
...
5.2. evapi:connection-closed
5.2. evapi:connection-closed
If defined, the module calls event_route[evapi:connection-closed] when
a client connection is closed.
@ -252,7 +252,7 @@ event_route[evapi:connection-closed] {
}
...
5.3. evapi:message-received
5.3. evapi:message-received
If defined, the module calls event_route[evapi:message-received] when a
message is received from a client.

@ -168,7 +168,7 @@ static int child_init(int rank)
return 0;
}
pid=fork_process(PROC_NOCHLDINIT, "EvAPI Dispatcher", 1);
pid=fork_process(PROC_RPC, "EvAPI Dispatcher", 1);
if (pid<0)
return -1; /* error */
if(pid==0) {

@ -12,7 +12,7 @@ Edited by
Jan Janak
Copyright © 2003 FhG FOKUS
Copyright © 2003 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -40,8 +40,8 @@ Jan Janak
List of Examples
1.1. Set "setvars" parameter
1.2. Set "time_to_kill" parameter
1.1. Set “setvars” parameter
1.2. Set “time_to_kill” parameter
1.3. exec_dset usage
1.4. exec_msg usage
1.5. exec_avp usage
@ -73,7 +73,7 @@ Chapter 1. Admin Guide
The exec module allows external commands to be executed from a Kamailio
script. The commands may be any valid shell commands--the command
string is passed to the shell using "popen" command. Kamailio passes
string is passed to the shell using “popen” command. Kamailio passes
additional information about the request in environment variables:
* SIP_HF_<hf_name> contains value of each header field in request. If
a header field occurred multiple times, values are concatenated and
@ -122,19 +122,19 @@ Chapter 1. Admin Guide
Default value is 1.
Example 1.1. Set "setvars" parameter
Example 1.1. Set “setvars” parameter
...
modparam("exec", "setvars", 1)
...
3.2. time_to_kill (integer)
3.2. time_to_kill (integer)
Specifies the longest time a program is allowed to execute. If the time
is exceeded, the program is killed.
Default value is 0.
Example 1.2. Set "time_to_kill" parameter
Example 1.2. Set “time_to_kill” parameter
...
modparam("exec", "time_to_kill", 20)
...
@ -145,7 +145,7 @@ modparam("exec", "time_to_kill", 20)
4.2. exec_msg(command)
4.3. exec_avp(command [, avplist])
4.1. exec_dset(command)
4.1. exec_dset(command)
Executes an external command. Current URI is passed to the command as
parameter. Output of the command is considered URI set (separated by
@ -166,13 +166,13 @@ exec_dset("echo TEST > /tmp/test.txt");
exec_dset("echo TEST > /tmp/$rU.txt");
...
4.2. exec_msg(command)
4.2. exec_msg(command)
Executes an external command. The whole message is passed to it in
input, no command-line parameters are added, output of the command is
not processed.
The "examples" directory in the source tarball contains several
The “examples” directory in the source tarball contains several
examples that shows how to use this function.
Meaning of the parameters is as follows:
@ -190,7 +190,7 @@ exec_msg("echo TEST > /tmp/test.txt");
exec_msg("echo TEST > /tmp/$rU.txt");
...
4.3. exec_avp(command [, avplist])
4.3. exec_avp(command [, avplist])
Executes an external command. Each line from output of the command is
saved in an AVP from 'avplist'. If 'avplist' is missing, the AVPs are

@ -12,7 +12,7 @@ Edited by
Jan Janak
Copyright © 2003 FhG FOKUS
Copyright © 2003 FhG FOKUS
__________________________________________________________________
Table of Contents
@ -155,7 +155,7 @@ Chapter 1. Admin Guide
URL of the database table to be used.
Default value is "mysql://kamailioro:kamailioro@localhost/kamailio".
Default value is “mysql://kamailioro:kamailioro@localhost/kamailio”.
Example 1.1. Set db_url parameter
...
@ -167,7 +167,7 @@ modparam("group", "db_url", "dbdriver://username:password@dbhost/dbname")
Name of the table holding strict definitions of groups and their
members.
Default value is "grp".
Default value is “grp”.
Example 1.2. Set table parameter
...
@ -176,9 +176,9 @@ modparam("group", "table", "grp_table")
3.3. user_column (string)
Name of the "table" column holding usernames.
Name of the “table” column holding usernames.
Default value is "username".
Default value is “username”.
Example 1.3. Set user_column parameter
...
@ -187,9 +187,9 @@ modparam("group", "user_column", "user")
3.4. domain_column (string)
Name of the "table" column holding domains.
Name of the “table” column holding domains.
Default value is "domain".
Default value is “domain”.
Example 1.4. Set domain_column parameter
...
@ -198,9 +198,9 @@ modparam("group", "domain_column", "realm")
3.5. group_column (string)
Name of the "table" column holding group names.
Name of the “table” column holding group names.
Default value is "grp".
Default value is “grp”.
Example 1.5. Set group_column parameter
...
@ -226,7 +226,7 @@ modparam("group", "use_domain", 1)
groups. If no table is defined, the regular-expression support is
disabled.
Default value is "NULL".
Default value is “NULL”.
Example 1.7. Set re_table parameter
...
@ -235,10 +235,10 @@ modparam("group", "re_table", "re_grp")
3.8. re_exp_column (string)
Name of the "re_table" column holding the regular expression used for
Name of the “re_table” column holding the regular expression used for
user matching.
Default value is "reg_exp".
Default value is “reg_exp”.
Example 1.8. Set re_exp_column parameter
...
@ -247,9 +247,9 @@ modparam("group", "re_exp_column", "re")
3.9. re_gid_column (string)
Name of the "re_table" column holding the group IDs.
Name of the “re_table” column holding the group IDs.
Default value is "group_id".
Default value is “group_id”.
Example 1.9. Set re_gid_column parameter
...
@ -262,7 +262,7 @@ modparam("group", "re_gid_column", "grp_id")
all group IDs that match the user; otherwise only the first will be
returned.
Default value is "1" (enabled).
Default value is “1” (enabled).
Example 1.10. Set multiple_gid parameter
...
@ -274,7 +274,7 @@ modparam("group", "multiple_gid", 0)
4.1. is_user_in(URI, group)
4.2. get_user_group(URI, AVP)
4.1. is_user_in(URI, group)
4.1. is_user_in(URI, group)
This function is to be used for script group membership. The function
returns true if username in the given URI is a member of the given
@ -301,7 +301,7 @@ if (is_user_in("Request-URI", "ld")) {
};
...
4.2. get_user_group(URI, AVP)
4.2. get_user_group(URI, AVP)
This function is to be used for regular expression based group
membership. The function returns true if username in the given URI

@ -10,7 +10,7 @@ Daniel-Constantin Mierla
<miconda@gmail.com>
Copyright © 2013 asipto.com
Copyright © 2013 asipto.com
__________________________________________________________________
Table of Contents

@ -11,15 +11,19 @@ Elena-Ramona Modroiu
<ramona@rosdev.ro>
Edited by
Alex Balashov
<abalashov@evaristesys.com>
Edited by
Ovidiu Sas
<osas@voipembedded.com>
Copyright © 2008-2011 http://www.asipto.com
Copyright © 2008-2011 http://www.asipto.com
__________________________________________________________________
Table of Contents
@ -195,7 +199,7 @@ Chapter 1. Admin Guide
You can read more about hash tables at:
http://en.wikipedia.org/wiki/Hash_table.
The "name" can be a static string or can include pseudo- variables that
The “name” can be a static string or can include pseudo- variables that
will be replaced at runtime.
Example 1.1. Accessing $sht(htname=>key)
@ -209,7 +213,7 @@ $sht(a=>$ci::srcip) = $si;
Next example shows a way to protect against dictionary attacks. If
someone fails to authenticate 3 times, it is forbidden for 15min.
Authenticatiion against database is expensive as it does a select on
the "subscriberthe" table. By disabling the DB auth for 15min,
the “subscriberthe” table. By disabling the DB auth for 15min,
resources on the server are saved and time to discover the password is
increased substantially. Additional alerting can be done by writing a
message to syslog or sending email, etc.
@ -218,7 +222,7 @@ $sht(a=>$ci::srcip) = $si;
the failed authentications per user and one for storing the time of
last authentication attempt. To ensure a unique name per user, the hash
table uses a combination of authentication username and text
"::auth_count" and "::last_auth".
“::auth_count” and “::last_auth”.
Example 1.2. Dictionary attack limitation
...
@ -454,7 +458,7 @@ $ kamcmd htable.dump htable
however, in which case this attribute can be set to 0.
* dmqreplicate - if set to 1, any actions (set, update, delete etc.)
performed upon entries in this table will be replicated to other
nodes (htable peers). Please note, module parameter "enable_dmq"
nodes (htable peers). Please note, module parameter “enable_dmq”
must also be set in order for this to apply (see below). Default is
0 (no replication).
@ -631,7 +635,7 @@ modparam("htable", "timer_procs", 4)
4.8. sht_iterator_end(iname)
4.9. sht_iterator_next(iname)
4.1. sht_print()
4.1. sht_print()
Dump content of hash table to L_ERR log level. Intended for debug
purposes.
@ -644,7 +648,7 @@ modparam("htable", "timer_procs", 4)
sht_print();
...
4.2. sht_rm_name_re(htable=>regexp)
4.2. sht_rm_name_re(htable=>regexp)
Delete all entries in the htable that match the name against regular
expression.
@ -657,7 +661,7 @@ sht_print();
sht_rm_name_re("ha=>.*");
...
4.3. sht_rm_value_re(htable=>regexp)
4.3. sht_rm_value_re(htable=>regexp)
Delete all entries in the htable that match the value against regular
expression.
@ -670,7 +674,7 @@ sht_rm_name_re("ha=>.*");
sht_rm_value_re("ha=>.*");
...
4.4. sht_reset(htable)
4.4. sht_reset(htable)
Delete all entries in the htable. The name of the hash table can be a
dynamic string with variables.
@ -682,7 +686,7 @@ sht_rm_value_re("ha=>.*");
sht_reset("ha$var(x)");
...
4.5. sht_lock(htable=>key)
4.5. sht_lock(htable=>key)
Lock the slot in htable corespoding to the key item. Note that the
locking is re-entrant for the process, therefore the lock and unlock
@ -695,7 +699,7 @@ sht_reset("ha$var(x)");
sht_lock("ha=>test");
...
4.6. sht_unlock(htable=>key)
4.6. sht_unlock(htable=>key)
Unlock the slot in htable corespoding to the key item. Note that the
locking is re-entrant for the process, therefore the lock and unlock
@ -710,7 +714,7 @@ $sht(ha=>test) = $sht(ha=>test) + 10;
sht_unlock("ha=>test");
...
4.7. sht_iterator_start(iname, hname)
4.7. sht_iterator_start(iname, hname)
Start an iterator for hash table named by the value of parameter hname.
The parameter iname is used to identify the iterator. There can be up
@ -730,7 +734,7 @@ sht_unlock("ha=>test");
sht_iterator_start("i1", "h1");
...
4.8. sht_iterator_end(iname)
4.8. sht_iterator_end(iname)
Close the iterator identified by iname parameter and release the hash
table slot aquired by the iterator. The iname value must be the same
@ -745,7 +749,7 @@ sht_iterator_start("i1", "h1");
sht_iterator_end("i1");
...
4.9. sht_iterator_next(iname)
4.9. sht_iterator_next(iname)
Move the iterator to the next item in hash table. It must be called
also after sht_iterator_start() to get the first item in the hash
@ -791,7 +795,7 @@ sht_iterator_end("i1");
6.2. sht_dump
6.3. sht_delete
6.1. sht_reload
6.1. sht_reload
Reload a hash table from database.
@ -804,7 +808,7 @@ sht_iterator_end("i1");
_hash_table_name_
_empty_line_
6.2. sht_dump
6.2. sht_dump
Dump content of a hash table via MI.
@ -817,7 +821,7 @@ sht_iterator_end("i1");
_hash_table_name_
_empty_line_
6.3. sht_delete
6.3. sht_delete
Delete a key from a hash table via MI.
@ -847,7 +851,7 @@ sht_iterator_end("i1");
7.7. htable.listTables
7.8. htable.stats
7.1. htable.get htable key
7.1. htable.get htable key
Lists one value in a hash table
@ -866,7 +870,7 @@ kamcmd htable.get students daniel
kamcmd htable.get students course[0]
...
7.2. htable.delete htable key
7.2. htable.delete htable key
Delete one value in a hash table
@ -885,7 +889,7 @@ kamcmd htable.delete students anna
kamcmd htable.delete students course[0]
...
7.3. htable.sets htable key value
7.3. htable.sets htable key value
Set an item in hash table to string value.
@ -905,7 +909,7 @@ kamcmd htable.sets test x abc
kamcmd htable.sets test x[0] abc
...
7.4. htable.seti htable key value
7.4. htable.seti htable key value
Set an item in hash table to integer value.
@ -925,7 +929,7 @@ kamcmd htable.seti test x 123
kamcmd htable.sets test x[0] 123
...
7.5. htable.dump htable
7.5. htable.dump htable
Lists all the values in a hash table
@ -939,7 +943,7 @@ kamcmd htable.sets test x[0] 123
kamcmd htable.dump ipban
...
7.6. htable.reload htable
7.6. htable.reload htable
Reload hash table from database.
@ -953,7 +957,7 @@ kamcmd htable.dump ipban
kamcmd htable.reload ipban
...
7.7. htable.listTables
7.7. htable.listTables
Lists all defined tables
@ -967,7 +971,7 @@ kamcmd htable.reload ipban
kamcmd htable.listTables
...
7.8. htable.stats
7.8. htable.stats
Get statistics for hash tables - name, number of slots, number of
items, max number of items per slot, min number of items per slot.
@ -987,7 +991,7 @@ kamcmd htable.stats
8.1. htable:mod-init
8.2. htable:expired:<table>
8.1. htable:mod-init
8.1. htable:mod-init
When defined, the module calls event_route[htable:mod-init] after all
modules have been initialized. A typical use case is to initialise
@ -1000,7 +1004,7 @@ event_route[htable:mod-init] {
}
...
8.2. htable:expired:<table>
8.2. htable:expired:<table>
When defined, the module calls event_route[htable:expired:<table>] when
an entry in the given table expires. In this event route, the key and

@ -94,6 +94,26 @@ int async_http_init_sockets(async_http_worker_t *worker)
return 0;
}
static inline char *strfindcasestrz(str *haystack, char *needlez)
{
int i,j;
str needle;
needle.s = needlez;
needle.len = strlen(needlez);
for(i=0;i<haystack->len-needle.len;i++) {
for(j=0;j<needle.len;j++) {
if ( !((haystack->s[i+j]==needle.s[j]) ||
( isalpha((int)haystack->s[i+j])
&& ((haystack->s[i+j])^(needle.s[j]))==0x20 )) )
break;
}
if (j==needle.len)
return haystack->s+i;
}
return 0;
}
void async_http_cb(struct http_m_reply *reply, void *param)
{
async_query_t *aq;
@ -101,6 +121,7 @@ void async_http_cb(struct http_m_reply *reply, void *param)
unsigned int tindex;
unsigned int tlabel;
struct cell *t = NULL;
char *p;
sip_msg_t *fmsg;
if (reply->result != NULL) {
@ -119,6 +140,18 @@ void async_http_cb(struct http_m_reply *reply, void *param)
ah_error.len = strlen(ah_error.s);
} else {
/* success */
/* check for HTTP Via header
* - HTTP Via format is different that SIP Via
* - workaround: replace with Hia to be ignored by SIP parser
*/
if((p=strfindcasestrz(reply->result, "\nVia:"))!=NULL)
{
p++;
*p = 'H';
LM_DBG("replaced HTTP Via with Hia [[\n%.*s]]\n", reply->result->len, reply->result->s);
}
ah_reply->buf = reply->result->s;
ah_reply->len = reply->result->len;

@ -16,13 +16,13 @@ Hugh Waite
Xura Inc
Copyright © 2008-2009 Juha Heinanen
Copyright © 2008-2009 Juha Heinanen
Copyright © 2013 Carsten Bock, ng-voice GmbH
Copyright © 2013 Carsten Bock, ng-voice GmbH
Copyright © 2015 Olle E. Johansson, Edvina AB
Copyright © 2015 Olle E. Johansson, Edvina AB
Copyright © 2016 Hugh Waite, Xura Inc
Copyright © 2016 Hugh Waite, Xura Inc
__________________________________________________________________
Table of Contents
@ -512,7 +512,7 @@ http_follow_redirect = no
4.1. http_connect(connection, url, [content_type, data,] result)
4.2. http_client_query(url, [post-data], result)
4.1. http_connect(connection, url, [content_type, data,] result)
4.1. http_connect(connection, url, [content_type, data,] result)
Sends HTTP GET or POST request to a given connection. For a POST
request, content-type can be specified.
@ -550,16 +550,16 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
);
...
4.2. http_client_query(url, [post-data], result)
4.2. http_client_query(url, [post-data], result)
Sends HTTP GET or POST request according to URL given in "url"
Sends HTTP GET or POST request according to URL given in “url”
parameter, which is a string that may contain pseudo variables.
If you want to make a POST-Request, you have to define the "post"-data,
If you want to make a POST-Request, you have to define the “post”-data,
that should be submitted in that request as the second parameter.
If HTTP server returns a class 2xx, 3xx or 4xx reply, the first line of
the reply's body (if any) is stored in "result" parameter, which must
the reply's body (if any) is stored in “result” parameter, which must
be a writable pseudo variable.
Function returns reply code of HTTP reply or -1 if something went
@ -596,7 +596,7 @@ switch ($retcode) {
5.1. $curlerror(error)
5.1. $curlerror(error)
5.1. $curlerror(error)
The cURL library returns error codes from the protocol used. If an
error happens, a cURL specific error code below 100 is returned. The
@ -621,15 +621,15 @@ switch ($retcode) {
7.2. httpclient.connok
7.3. httpclient.connfail
7.1. httpclient.connections
7.1. httpclient.connections
The number of connection definitions that are in-memory.
7.2. httpclient.connok
7.2. httpclient.connok
The number of successful connections since Kamailio start
7.3. httpclient.connfail
7.3. httpclient.connfail
The number of failed connections since Kamailio start
@ -646,7 +646,7 @@ Chapter 2. Developer Guide
1.1. http_connect(msg, connection, url, result, content_type, post)
1.1. http_connect(msg, connection, url, result, content_type, post)
1.1. http_connect(msg, connection, url, result, content_type, post)
Sends HTTP GET or POST request to a given connection.

@ -434,8 +434,12 @@ int http_query(struct sip_msg* _m, char* _url, str* _dst, char* _post)
query_params.http_follow_redirect = default_http_follow_redirect;
query_params.oneline = 1;
query_params.maxdatasize = 0;
query_params.http_proxy = as_asciiz(&default_http_proxy);
query_params.http_proxy_port = default_http_proxy_port;
if(default_http_proxy.s!=NULL && default_http_proxy.len>0) {
query_params.http_proxy = default_http_proxy.s;
if(default_http_proxy_port>0) {
query_params.http_proxy_port = default_http_proxy_port;
}
}
res = curL_query_url(_m, _url, _dst, &query_params);

@ -213,7 +213,7 @@ static void curl_counter_init()
/* Module initialization function */
static int mod_init(void)
{
LM_DBG("init curl module\n");
/* Initialize curl */
@ -293,7 +293,7 @@ int curl_support_ipv6()
/* Child initialization function */
static int child_init(int rank)
{
{
if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN) {
return 0; /* do nothing for the main process */
}
@ -367,7 +367,7 @@ static int fixup_free_http_query_get(void** param, int param_no)
if (param_no == 2) {
return fixup_free_pvar_null(param, 1);
}
LM_ERR("invalid parameter number <%d>\n", param_no);
return -1;
}
@ -405,8 +405,8 @@ static int fixup_curl_connect(void** param, int param_no)
}
/*
* Fix curl_connect params when posting (5 parameters):
* connection (string/pvar), url (string with pvars), content-type,
* Fix curl_connect params when posting (5 parameters):
* connection (string/pvar), url (string with pvars), content-type,
* data (string/pvar, pvar)
*/
static int fixup_curl_connect_post(void** param, int param_no)
@ -453,7 +453,7 @@ static int fixup_free_curl_connect_post(void** param, int param_no)
if (param_no == 5) {
return fixup_free_pvar_null(param, 1);
}
LM_ERR("invalid parameter number <%d>\n", param_no);
return -1;
}
@ -474,7 +474,7 @@ static int fixup_free_curl_connect(void** param, int param_no)
if (param_no == 3) {
return fixup_free_pvar_null(param, 1);
}
LM_ERR("invalid parameter number <%d>\n", param_no);
return -1;
}
@ -515,7 +515,7 @@ static int w_curl_connect(struct sip_msg* _m, char* _con, char * _url, char* _re
if (result.s != NULL)
pkg_free(result.s);
return ret;
return (ret==0)?-1:ret;
}
/*
@ -557,7 +557,7 @@ static int w_curl_connect_post(struct sip_msg* _m, char* _con, char * _url, char
if (result.s != NULL)
pkg_free(result.s);
return ret;
return (ret==0)?-1:ret;
}
@ -599,7 +599,7 @@ static int fixup_free_http_query_post(void** param, int param_no)
if (param_no == 3) {
return fixup_free_pvar_null(param, 1);
}
LM_ERR("invalid parameter number <%d>\n", param_no);
return -1;
}
@ -628,7 +628,7 @@ static int w_http_query(struct sip_msg* _m, char* _url, char* _result) {
if (result.s != NULL)
pkg_free(result.s);
return ret;
return (ret==0)?-1:ret;
}
@ -660,7 +660,7 @@ static int w_http_query_post(struct sip_msg* _m, char* _url, char* _post, char*
if (result.s != NULL)
pkg_free(result.s);
return ret;
return (ret==0)?-1:ret;
}
/*!
@ -672,7 +672,7 @@ static int pv_parse_curlerror(pv_spec_p sp, str *in)
if(sp==NULL || in==NULL || in->len<=0)
return -1;
cerr = atoi(in->s);
LM_DBG(" =====> CURL ERROR %d \n", cerr);
sp->pvp.pvn.u.isname.name.n = cerr;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save