New upstream version 5.1.7

changes/52/26952/2 upstream/5.1.7
Marco Capetta 7 years ago
parent 2d00cf7d3b
commit 87b30e26b7

File diff suppressed because it is too large Load Diff

@ -299,7 +299,7 @@ function ksr_route_natmanage()
KSR.rtpproxy.rtpproxy_manage("co"); KSR.rtpproxy.rtpproxy_manage("co");
if KSR.siputils.is_request()>0 then if KSR.siputils.is_request()>0 then
if not KSR.siputils.has_totag() then if KSR.siputils.has_totag()<0 then
if KSR.tmx.t_is_branch_route()>0 then if KSR.tmx.t_is_branch_route()>0 then
KSR.rr.add_rr_param(";nat=yes"); KSR.rr.add_rr_param(";nat=yes");
end end

@ -62,7 +62,7 @@ class kamailio:
# CANCEL processing # CANCEL processing
if KSR.pv.get("$rm") == "CANCEL" : if KSR.pv.get("$rm") == "CANCEL" :
if KSR.tm.t_check_trans()>0 : if KSR.tm.t_check_trans()>0 :
self.ksr_route_relay(); self.ksr_route_relay(msg);
return 1; return 1;
# handle requests within SIP dialogs # handle requests within SIP dialogs

@ -40,7 +40,7 @@ src.rpm: tar
mv ../../kamailio-$(RELEASE)_src.tar.gz ${RPMBUILD_TOP}/SOURCES/${DIST_ARCHIVE} mv ../../kamailio-$(RELEASE)_src.tar.gz ${RPMBUILD_TOP}/SOURCES/${DIST_ARCHIVE}
sed -i -e 's/setup -n %{name}-%{ver}/setup -n kamailio-$(RELEASE)/' obs/kamailio.spec sed -i -e 's/setup -n %{name}-%{ver}/setup -n kamailio-$(RELEASE)/' obs/kamailio.spec
rpmbuild ${RPMBUILD_OPT} -bs obs/kamailio.spec rpmbuild ${RPMBUILD_OPT} -bs obs/kamailio.spec
mv ${RPMBUILD_TOP}/SRPMS/kamailio-$(RELEASE).*.src.rpm ../.. mv ${RPMBUILD_TOP}/SRPMS/kamailio-$(RELEASE)*.src.rpm ../..
rm -Rf ${RPMBUILD_TOP} rm -Rf ${RPMBUILD_TOP}
# build rpm packages # build rpm packages

@ -4,7 +4,7 @@
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org> # Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=kamailio pkgname=kamailio
pkgver=5.1.6 pkgver=5.1.7
pkgrel=0 pkgrel=0
# If building from a git snapshot, specify the gitcommit # If building from a git snapshot, specify the gitcommit
@ -246,7 +246,6 @@ for _i in db postgres sqlite dbtext mysql \
done done
source="${pkgname}-${pkgver}${_suffix}.tar.gz::https://github.com/kamailio/$pkgname/archive/$_gitcommit.tar.gz source="${pkgname}-${pkgver}${_suffix}.tar.gz::https://github.com/kamailio/$pkgname/archive/$_gitcommit.tar.gz
0001-kamdbctl.base.patch
0004-src_core_tcp_read_c.patch 0004-src_core_tcp_read_c.patch
kamailio.initd kamailio.initd
" "
@ -546,6 +545,5 @@ sipdump() {
} }
sha512sums="51ea5fccd27a9d3d1783cfc5596eb28ab27e34faeec3268600363f43c48a3634c3c584c479ba874fdb53b85766a0ce8fe7df0e20954c9c6514b1d9d41d9237e6 kamailio-5.1.0.20171125-991fe9b.tar.gz sha512sums="51ea5fccd27a9d3d1783cfc5596eb28ab27e34faeec3268600363f43c48a3634c3c584c479ba874fdb53b85766a0ce8fe7df0e20954c9c6514b1d9d41d9237e6 kamailio-5.1.0.20171125-991fe9b.tar.gz
6badfb611c02ffcb4c2e9937731162ea1a4b737f042ed52120e2f96ebb80b5b7d240b5612c9ca565e693eec9b8c52c1ee5db04dfc47d204501021f984b4b11db 0001-kamdbctl.base.patch
af8362201957eae6b66baf7368c9ca884024209a396d77c5c52180c9aabe13772e9c6513e59721d39503e5bb7a8c1030f5c10301ea9055bddafb7f01ee2f3076 0004-src_core_tcp_read_c.patch af8362201957eae6b66baf7368c9ca884024209a396d77c5c52180c9aabe13772e9c6513e59721d39503e5bb7a8c1030f5c10301ea9055bddafb7f01ee2f3076 0004-src_core_tcp_read_c.patch
cd6e3b677d803cd78561ad14d9b2589fd35ad0096f48047fdcb4ddc7d9103871357efba3b350946844cb53dbb081210746421fc420c22ac845b90251168a628e kamailio.initd" cd6e3b677d803cd78561ad14d9b2589fd35ad0096f48047fdcb4ddc7d9103871357efba3b350946844cb53dbb081210746421fc420c22ac845b90251168a628e kamailio.initd"

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0%{dist} %define rel 0%{dist}

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel dev6%{dist} %define rel dev6%{dist}
%bcond_with dnssec %bcond_with dnssec

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,3 +1,9 @@
kamailio (5.1.7) unstable; urgency=medium
* version set to 5.1.7
-- Victor Seva <vseva@debian.org> Thu, 31 Jan 2019 10:15:30 +0100
kamailio (5.1.6) unstable; urgency=medium kamailio (5.1.6) unstable; urgency=medium
* version set to 5.1.6 * version set to 5.1.6

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0%{dist} %define rel 0%{dist}

@ -6,7 +6,7 @@
# #
PORTNAME= kamailio PORTNAME= kamailio
PORTVERSION= 5.1.6 PORTVERSION= 5.1.7
CATEGORIES= net CATEGORIES= net
MASTER_SITES= http://kamailio.org/pub/kamailio/${PORTVERSION}/src/ MASTER_SITES= http://kamailio.org/pub/kamailio/${PORTVERSION}/src/
DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src

@ -5,7 +5,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User=kamailio User=kamailio
Group=daemon Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio.cfg' Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
Environment='SHM_MEMORY=64' Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=4' Environment='PKG_MEMORY=4'

@ -1,47 +1,7 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0%{dist} %define rel 0%{dist}
%if 0%{?fedora} == 25
%define dist_name fedora
%define dist_version %{?fedora}
%bcond_without cnxcc
%bcond_with dnssec
%bcond_without geoip
%bcond_without http_async_client
%bcond_without jansson
%bcond_without json
%bcond_without lua
%bcond_without kazoo
%bcond_without memcached
%bcond_without perl
%bcond_without rebbitmq
%bcond_without redis
%bcond_without sctp
%bcond_without websocket
%bcond_without xmlrpc
%endif
%if 0%{?fedora} == 26
%define dist_name fedora
%define dist_version %{?fedora}
%bcond_without cnxcc
%bcond_with dnssec
%bcond_without geoip
%bcond_without http_async_client
%bcond_without jansson
%bcond_without json
%bcond_without lua
%bcond_without kazoo
%bcond_without memcached
%bcond_without perl
%bcond_without rebbitmq
%bcond_without redis
%bcond_without sctp
%bcond_without websocket
%bcond_without xmlrpc
%endif
%if 0%{?fedora} == 27 %if 0%{?fedora} == 27
%define dist_name fedora %define dist_name fedora
%define dist_version %{?fedora} %define dist_version %{?fedora}
@ -54,6 +14,7 @@
%bcond_without lua %bcond_without lua
%bcond_without kazoo %bcond_without kazoo
%bcond_without memcached %bcond_without memcached
%bcond_without mongodb
%bcond_without perl %bcond_without perl
%bcond_without rebbitmq %bcond_without rebbitmq
%bcond_without redis %bcond_without redis
@ -74,6 +35,7 @@
%bcond_without lua %bcond_without lua
%bcond_without kazoo %bcond_without kazoo
%bcond_without memcached %bcond_without memcached
%bcond_without mongodb
%bcond_without perl %bcond_without perl
%bcond_without rabbitmq %bcond_without rabbitmq
%bcond_without redis %bcond_without redis
@ -94,6 +56,7 @@
%bcond_without lua %bcond_without lua
%bcond_without kazoo %bcond_without kazoo
%bcond_without memcached %bcond_without memcached
%bcond_without mongodb
%bcond_without perl %bcond_without perl
%bcond_without rabbitmq %bcond_without rabbitmq
%bcond_without redis %bcond_without redis
@ -114,6 +77,7 @@
%bcond_without lua %bcond_without lua
%bcond_with kazoo %bcond_with kazoo
%bcond_without memcached %bcond_without memcached
%bcond_with mongodb
%bcond_without perl %bcond_without perl
%bcond_with rebbitmq %bcond_with rebbitmq
%bcond_with redis %bcond_with redis
@ -135,6 +99,7 @@
%bcond_without lua %bcond_without lua
%bcond_without kazoo %bcond_without kazoo
%bcond_without memcached %bcond_without memcached
%bcond_without mongodb
%bcond_without perl %bcond_without perl
%bcond_without rebbitmq %bcond_without rebbitmq
%bcond_without redis %bcond_without redis
@ -155,6 +120,7 @@
%bcond_without lua %bcond_without lua
%bcond_with kazoo %bcond_with kazoo
%bcond_without memcached %bcond_without memcached
%bcond_with mongodb
%bcond_without perl %bcond_without perl
%bcond_with rebbitmq %bcond_with rebbitmq
%bcond_without redis %bcond_without redis
@ -175,6 +141,7 @@
%bcond_with lua %bcond_with lua
%bcond_with kazoo %bcond_with kazoo
%bcond_with memcached %bcond_with memcached
%bcond_with mongodb
%bcond_with perl %bcond_with perl
%bcond_with rebbitmq %bcond_with rebbitmq
%bcond_with redis %bcond_with redis
@ -195,6 +162,7 @@
%bcond_with lua %bcond_with lua
%bcond_with kazoo %bcond_with kazoo
%bcond_with memcached %bcond_with memcached
%bcond_without mongodb
%bcond_without perl %bcond_without perl
%bcond_without rebbitmq %bcond_without rebbitmq
%bcond_without redis %bcond_without redis
@ -227,7 +195,7 @@ Conflicts: kamailio-ims < %ver, kamailio-java < %ver, kamailio-json < %ver
Conflicts: kamailio-lcr < %ver, kamailio-ldap < %ver, kamailio-lua < %ver Conflicts: kamailio-lcr < %ver, kamailio-ldap < %ver, kamailio-lua < %ver
Conflicts: kamailio-kazoo < %ver Conflicts: kamailio-kazoo < %ver
Conflicts: kamailio-rabbitmq < %ver Conflicts: kamailio-rabbitmq < %ver
Conflicts: kamailio-memcached < %ver, kamailio-mysql < %ver Conflicts: kamailio-memcached < %ver, kamailio-mongodb < %ver, kamailio-mysql < %ver
Conflicts: kamailio-outbound < %ver, kamailio-perl < %ver Conflicts: kamailio-outbound < %ver, kamailio-perl < %ver
Conflicts: kamailio-postgresql < %ver, kamailio-presence < %ver Conflicts: kamailio-postgresql < %ver, kamailio-presence < %ver
Conflicts: kamailio-python < %ver Conflicts: kamailio-python < %ver
@ -244,6 +212,12 @@ BuildRequires: bison, flex
%if 0%{?suse_version} %if 0%{?suse_version}
BuildRequires: systemd-mini, shadow BuildRequires: systemd-mini, shadow
%endif %endif
%if 0%{?fedora} == 27
BuildRequires: python3-devel
%endif
%if 0%{?fedora} == 28
BuildRequires: python3-devel
%endif
%description %description
Kamailio (former OpenSER) is an Open Source SIP Server released under GPL, able Kamailio (former OpenSER) is an Open Source SIP Server released under GPL, able
@ -285,8 +259,13 @@ Requires: kamailio = %ver
Requires: libdb-4_8 Requires: libdb-4_8
BuildRequires: libdb-4_8-devel BuildRequires: libdb-4_8-devel
%else %else
%if 0%{?rhel} == 6
Requires: db4 Requires: db4
BuildRequires: db4-devel BuildRequires: db4-devel
%else
Requires: libdb
BuildRequires: libdb-devel
%endif
%endif %endif
%description bdb %description bdb
@ -570,6 +549,19 @@ Memcached configuration file support for Kamailio.
%endif %endif
%if %{with mongodb}
%package mongodb
Summary: MongoDB database connectivity for Kamailio
Group: System Environment/Daemons
Requires: kamailio = %ver
Requires: mongo-c-driver
BuildRequires: mongo-c-driver-devel
%description mongodb
MongoDB database connectivity for Kamailio.
%endif
%package mysql %package mysql
Summary: MySQL database connectivity for Kamailio Summary: MySQL database connectivity for Kamailio
Group: System Environment/Daemons Group: System Environment/Daemons
@ -944,19 +936,14 @@ UUID module for Kamailio.
%prep %prep
%setup -n %{name}-%{ver} %setup -n %{name}-%{ver}
ln -s ../obs pkg/kamailio/fedora/24
ln -s ../obs pkg/kamailio/fedora/25
ln -s ../obs pkg/kamailio/fedora/26
ln -s ../obs pkg/kamailio/fedora/27 ln -s ../obs pkg/kamailio/fedora/27
ln -s ../obs pkg/kamailio/fedora/28 ln -s ../obs pkg/kamailio/fedora/28
ln -s ../obs pkg/kamailio/fedora/29 ln -s ../obs pkg/kamailio/fedora/29
mkdir -p pkg/kamailio/rhel
ln -s ../obs pkg/kamailio/rhel/6 ln -s ../obs pkg/kamailio/rhel/6
ln -s ../obs pkg/kamailio/rhel/7 ln -s ../obs pkg/kamailio/rhel/7
mkdir -p pkg/kamailio/opensuse
ln -s ../obs pkg/kamailio/opensuse/1315 ln -s ../obs pkg/kamailio/opensuse/1315
ln -s ../obs pkg/kamailio/opensuse/1330 ln -s ../obs pkg/kamailio/opensuse/1330
mkdir -p pkg/kamailio/centos ln -s ../obs pkg/kamailio/opensuse/1550
ln -s ../obs pkg/kamailio/centos/6 ln -s ../obs pkg/kamailio/centos/6
ln -s ../obs pkg/kamailio/centos/7 ln -s ../obs pkg/kamailio/centos/7
@ -965,7 +952,11 @@ ln -s ../obs pkg/kamailio/centos/7
%if 0%{?fedora} || 0%{?suse_version} %if 0%{?fedora} || 0%{?suse_version}
export FREERADIUS=1 export FREERADIUS=1
%endif %endif
make cfg prefix=/usr basedir=%{buildroot} cfg_prefix=%{buildroot} doc_prefix=%{buildroot} \ make cfg prefix=/usr \
basedir=%{buildroot} \
cfg_prefix=%{buildroot} \
doc_prefix=%{buildroot} \
share_prefix=%{_prefix} \
doc_dir=%{_docdir}/kamailio/ \ doc_dir=%{_docdir}/kamailio/ \
cfg_target=%{_sysconfdir}/kamailio/ modules_dirs="modules" cfg_target=%{_sysconfdir}/kamailio/ modules_dirs="modules"
make make
@ -1012,6 +1003,9 @@ make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \
%endif %endif
%if %{with xmlrpc} %if %{with xmlrpc}
kmi_xmlrpc \ kmi_xmlrpc \
%endif
%if %{with mongodb}
kmongodb \
%endif %endif
kmysql koutbound \ kmysql koutbound \
%if %{with perl} %if %{with perl}
@ -1081,6 +1075,9 @@ make install-modules-all skip_modules="app_mono db_cassandra db_oracle \
%endif %endif
%if %{with xmlrpc} %if %{with xmlrpc}
kmi_xmlrpc \ kmi_xmlrpc \
%endif
%if %{with mongodb}
kmongodb \
%endif %endif
kmysql koutbound \ kmysql koutbound \
%if %{with perl} %if %{with perl}
@ -1135,18 +1132,20 @@ install -m644 pkg/kamailio/%{dist_name}/%{dist_version}/sipcapture.sysconfig \
%if 0%{?suse_version} %if 0%{?suse_version}
%py_compile -O %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb %py_compile -O %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb
%endif %endif
%if 0%{?fedora}
%py_byte_compile %{__python2} %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb
%endif
# Removing devel files # Removing devel files
rm -f %{buildroot}%{_libdir}/kamailio/lib*.so rm -f %{buildroot}%{_libdir}/kamailio/lib*.so
%pre %pre
%if 0%{?suse_version} == 1330
if ! /usr/bin/getent group daemon &>/dev/null; then
/usr/sbin/groupadd --gid 2 daemon &> /dev/null
fi
%endif
if ! /usr/bin/id kamailio &>/dev/null; then if ! /usr/bin/id kamailio &>/dev/null; then
/usr/sbin/useradd -r -g daemon -s /bin/false -c "Kamailio daemon" -d %{_libdir}/kamailio kamailio || \ /usr/sbin/useradd --system \
--user-group \
--shell /bin/false \
--comment "Kamailio SIP Server" \
--home-dir %{_rundir}/kamailio kamailio || \
%logmsg "Unexpected error adding user \"kamailio\". Aborting installation." %logmsg "Unexpected error adding user \"kamailio\". Aborting installation."
fi fi
@ -1679,6 +1678,16 @@ fi
%endif %endif
%if %{with mongodb}
%files mongodb
%defattr(-,root,root)
%doc %{_docdir}/kamailio/modules/README.db_mongodb
%doc %{_docdir}/kamailio/modules/README.ndb_mongodb
%{_libdir}/kamailio/modules/db_mongodb.so
%{_libdir}/kamailio/modules/ndb_mongodb.so
%endif
%files mysql %files mysql
%defattr(-,root,root) %defattr(-,root,root)
%doc %{_docdir}/kamailio/modules/README.db_mysql %doc %{_docdir}/kamailio/modules/README.db_mysql
@ -1955,6 +1964,8 @@ fi
%changelog %changelog
* Sun Nov 04 2018 Sergey Safarov <s.safarov@gmail.com>
- removed packaging for Fedora 25, 26 as End Of Life
* Sat Sep 02 2017 Sergey Safarov <s.safarov@gmail.com> * Sat Sep 02 2017 Sergey Safarov <s.safarov@gmail.com>
- added packaging for Fedora 26 and openSUSE Leap 42.3 - added packaging for Fedora 26 and openSUSE Leap 42.3
- removed packaging for Fedora 24 and openSUSE Leap 42.1 as End Of Life - removed packaging for Fedora 24 and openSUSE Leap 42.1 as End Of Life

@ -1 +1 @@
D /run/kamailio 0700 kamailio daemon - D /run/kamailio 0700 kamailio kamailio -

@ -1,6 +1,6 @@
<project name="home:kamailio:v5.0.x-rpms"> <project name="home:kamailio:v5.1.x-rpms">
<title>RPM Packages for Kamailio v5.0.x</title> <title>RPM Packages for Kamailio v5.1.x</title>
<description>RPM Packages for Kamailio v5.0.x</description> <description>RPM Packages for Kamailio v5.1.x</description>
<person userid="kamailio" role="maintainer"/> <person userid="kamailio" role="maintainer"/>
<repository name="openSUSE_Tumbleweed"> <repository name="openSUSE_Tumbleweed">
<path project="openSUSE:Factory" repository="snapshot"/> <path project="openSUSE:Factory" repository="snapshot"/>
@ -24,20 +24,19 @@
<path project="Fedora:EPEL:6" repository="RHEL"/> <path project="Fedora:EPEL:6" repository="RHEL"/>
<arch>x86_64</arch> <arch>x86_64</arch>
</repository> </repository>
<repository name="Fedora_27"> <repository name="Fedora_29">
<path project="Fedora:27" repository="update"/> <path project="Fedora:29" repository="update"/>
<path project="Fedora:27" repository="standard"/> <path project="Fedora:29" repository="standard"/>
<arch>x86_64</arch> <arch>x86_64</arch>
</repository> </repository>
<repository name="Fedora_26"> <repository name="Fedora_28">
<path project="Fedora:26" repository="update"/> <path project="Fedora:28" repository="update"/>
<path project="Fedora:26" repository="standard"/> <path project="Fedora:28" repository="standard"/>
<arch>x86_64</arch> <arch>x86_64</arch>
</repository> </repository>
<repository name="Fedora_25"> <repository name="Fedora_27">
<path project="Fedora:25" repository="update"/> <path project="Fedora:27" repository="update"/>
<path project="Fedora:25" repository="standard"/> <path project="Fedora:27" repository="standard"/>
<arch>i586</arch>
<arch>x86_64</arch> <arch>x86_64</arch>
</repository> </repository>
<repository name="CentOS_7"> <repository name="CentOS_7">

@ -12,7 +12,7 @@ COMMENT-carrierroute = kamailio carrierroute module
COMMENT-snmpstats = kamailio snmpstats module COMMENT-snmpstats = kamailio snmpstats module
COMMENT-perl = kamailio perl modules COMMENT-perl = kamailio perl modules
VERSION = 5.1.6 VERSION = 5.1.7
DISTNAME = kamailio-${VERSION} DISTNAME = kamailio-${VERSION}
PKGNAME-main = kamailio-${VERSION} PKGNAME-main = kamailio-${VERSION}
PKGNAME-mysql = kamailio-mysql-${VERSION} PKGNAME-mysql = kamailio-mysql-${VERSION}

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0 %define rel 0
%define _sharedir %{_prefix}/share %define _sharedir %{_prefix}/share

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0 %define rel 0
%define _sharedir %{_prefix}/share %define _sharedir %{_prefix}/share

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0 %define rel 0
%define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc %define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0 %define rel 0
%define _sharedir %{_prefix}/share %define _sharedir %{_prefix}/share

@ -1,5 +1,5 @@
%define name kamailio %define name kamailio
%define ver 5.1.6 %define ver 5.1.7
%define rel 0 %define rel 0
%define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops %define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops

@ -1,6 +1,6 @@
PKG=Kamailio PKG=Kamailio
ARCH=sparc ARCH=sparc
VERSION=5.1.6 VERSION=5.1.7
CATEGORY=application CATEGORY=application
EMAIL=miconda@gmail.com EMAIL=miconda@gmail.com
NAME=Kamailio is a very fast and flexible SIP (RFC3261) proxy server NAME=Kamailio is a very fast and flexible SIP (RFC3261) proxy server

@ -106,7 +106,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
# version number # version number
VERSION = 5 VERSION = 5
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 6 SUBLEVEL = 7
EXTRAVERSION = EXTRAVERSION =
# memory manager switcher # memory manager switcher

@ -1671,6 +1671,9 @@ int run_child_one_init_route(void)
rt = route_get(&event_rt, "core:worker-one-init"); rt = route_get(&event_rt, "core:worker-one-init");
if(rt>=0 && event_rt.rlist[rt]!=NULL) { if(rt>=0 && event_rt.rlist[rt]!=NULL) {
LM_DBG("executing event_route[core:worker-one-init] (%d)\n", rt); LM_DBG("executing event_route[core:worker-one-init] (%d)\n", rt);
if (cfg_child_init()) {
return -1;
}
if(faked_msg_init()<0) if(faked_msg_init()<0)
return -1; return -1;
fmsg = faked_msg_next(); fmsg = faked_msg_next();

@ -2,6 +2,6 @@
* DO NOT EDIT IT * DO NOT EDIT IT
*/ */
#define REPO_VER "7d1964" #define REPO_VER "567df3"
#define REPO_HASH "7d1964" #define REPO_HASH "567df3"
#define REPO_STATE "" #define REPO_STATE ""

@ -562,23 +562,23 @@ IMPORTFILE "import_file"
<INITIAL>{ISAVPFLAGSET} { count(); yylval.strval=yytext; return ISAVPFLAGSET; } <INITIAL>{ISAVPFLAGSET} { count(); yylval.strval=yytext; return ISAVPFLAGSET; }
<INITIAL>{AVPFLAGS_DECL} { count(); yylval.strval=yytext; return AVPFLAGS_DECL; } <INITIAL>{AVPFLAGS_DECL} { count(); yylval.strval=yytext; return AVPFLAGS_DECL; }
<INITIAL>{MSGLEN} { count(); yylval.strval=yytext; return MSGLEN; } <INITIAL>{MSGLEN} { count(); yylval.strval=yytext; return MSGLEN; }
<INITIAL>{ROUTE} { count(); routename=0; default_routename="DEFAULT_ROUTE"; <INITIAL>{ROUTE} { count(); default_routename="DEFAULT_ROUTE";
yylval.strval=yytext; return ROUTE; } yylval.strval=yytext; return ROUTE; }
<INITIAL>{ROUTE_REQUEST} { count(); routename=0; default_routename="DEFAULT_ROUTE"; <INITIAL>{ROUTE_REQUEST} { count(); default_routename="DEFAULT_ROUTE";
yylval.strval=yytext; return ROUTE_REQUEST; } yylval.strval=yytext; return ROUTE_REQUEST; }
<INITIAL>{ROUTE_ONREPLY} { count(); routename=0; default_routename="DEFAULT_ONREPLY"; <INITIAL>{ROUTE_ONREPLY} { count(); default_routename="DEFAULT_ONREPLY";
yylval.strval=yytext; yylval.strval=yytext;
return ROUTE_ONREPLY; } return ROUTE_ONREPLY; }
<INITIAL>{ROUTE_REPLY} { count(); routename=0; default_routename="DEFAULT_ONREPLY"; <INITIAL>{ROUTE_REPLY} { count(); default_routename="DEFAULT_ONREPLY";
yylval.strval=yytext; return ROUTE_REPLY; } yylval.strval=yytext; return ROUTE_REPLY; }
<INITIAL>{ROUTE_FAILURE} { count(); routename=0; default_routename="DEFAULT_FAILURE"; <INITIAL>{ROUTE_FAILURE} { count(); default_routename="DEFAULT_FAILURE";
yylval.strval=yytext; yylval.strval=yytext;
return ROUTE_FAILURE; } return ROUTE_FAILURE; }
<INITIAL>{ROUTE_BRANCH} { count(); routename=0; default_routename="DEFAULT_BRANCH"; <INITIAL>{ROUTE_BRANCH} { count(); default_routename="DEFAULT_BRANCH";
yylval.strval=yytext; return ROUTE_BRANCH; } yylval.strval=yytext; return ROUTE_BRANCH; }
<INITIAL>{ROUTE_SEND} { count(); routename=0; default_routename="DEFAULT_SEND"; <INITIAL>{ROUTE_SEND} { count(); default_routename="DEFAULT_SEND";
yylval.strval=yytext; return ROUTE_SEND; } yylval.strval=yytext; return ROUTE_SEND; }
<INITIAL>{ROUTE_EVENT} { count(); routename=0; default_routename="DEFAULT_EVENT"; <INITIAL>{ROUTE_EVENT} { count(); default_routename="DEFAULT_EVENT";
yylval.strval=yytext; yylval.strval=yytext;
state=EVRT_NAME_S; BEGIN(EVRTNAME); state=EVRT_NAME_S; BEGIN(EVRTNAME);
return ROUTE_EVENT; } return ROUTE_EVENT; }

@ -1828,8 +1828,11 @@ route_stm:
| ROUTE error { yyerror("invalid route statement"); } | ROUTE error { yyerror("invalid route statement"); }
| ROUTE_REQUEST error { yyerror("invalid request_route statement"); } | ROUTE_REQUEST error { yyerror("invalid request_route statement"); }
; ;
failure_route_main: ROUTE_FAILURE { routename=NULL; }
;
failure_route_stm: failure_route_stm:
ROUTE_FAILURE LBRACE actions RBRACE { failure_route_main LBRACE actions RBRACE {
#ifdef SHM_MEM #ifdef SHM_MEM
if (!shm_initialized() && init_shm()<0) { if (!shm_initialized() && init_shm()<0) {
yyerror("Can't initialize shared memory"); yyerror("Can't initialize shared memory");
@ -1906,8 +1909,11 @@ onreply_route_stm:
yyerror("invalid onreply_route statement"); yyerror("invalid onreply_route statement");
} }
; ;
branch_route_main: ROUTE_BRANCH { routename=NULL; }
;
branch_route_stm: branch_route_stm:
ROUTE_BRANCH LBRACE actions RBRACE { branch_route_main LBRACE actions RBRACE {
#ifdef SHM_MEM #ifdef SHM_MEM
if (!shm_initialized() && init_shm()<0) { if (!shm_initialized() && init_shm()<0) {
yyerror("Can't initialize shared memory"); yyerror("Can't initialize shared memory");
@ -1936,7 +1942,11 @@ branch_route_stm:
} }
| ROUTE_BRANCH error { yyerror("invalid branch_route statement"); } | ROUTE_BRANCH error { yyerror("invalid branch_route statement"); }
; ;
send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
send_route_main: ROUTE_SEND { routename=NULL; }
;
send_route_stm:
send_route_main LBRACE actions RBRACE {
#ifdef SHM_MEM #ifdef SHM_MEM
if (!shm_initialized() && init_shm()<0) { if (!shm_initialized() && init_shm()<0) {
yyerror("Can't initialize shared memory"); yyerror("Can't initialize shared memory");
@ -1965,7 +1975,11 @@ send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
} }
| ROUTE_SEND error { yyerror("invalid onsend_route statement"); } | ROUTE_SEND error { yyerror("invalid onsend_route statement"); }
; ;
event_route_stm: ROUTE_EVENT LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE {
event_route_main: ROUTE_EVENT { routename=NULL; }
;
event_route_stm:
event_route_main LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE {
#ifdef SHM_MEM #ifdef SHM_MEM
if (!shm_initialized() && init_shm()<0) { if (!shm_initialized() && init_shm()<0) {
yyerror("Can't initialize shared memory"); yyerror("Can't initialize shared memory");

@ -35,7 +35,7 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type
char *descr) char *descr)
{ {
cfg_group_t *group; cfg_group_t *group;
cfg_script_var_t *var; cfg_script_var_t *var, **last_var;
int gname_len, vname_len, descr_len; int gname_len, vname_len, descr_len;
LM_DBG("declaring %s.%s\n", gname, vname); LM_DBG("declaring %s.%s\n", gname, vname);
@ -112,9 +112,15 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type
memset(var, 0, sizeof(cfg_script_var_t)); memset(var, 0, sizeof(cfg_script_var_t));
var->type = type; var->type = type;
/* add the variable to the group */ /* Add the variable to the end of the group.
var->next = (cfg_script_var_t *)(void *)group->vars; * The order is important because the padding depends on that.
group->vars = (char *)(void *)var; * The list will be travelled later again, which must be done in
* the same order. */
last_var = (cfg_script_var_t **)(void **)&group->vars;
while ((*last_var))
last_var = &((*last_var)->next);
*last_var = var;
var->next = NULL;
/* clone the name of the variable */ /* clone the name of the variable */
var->name = (char *)pkg_malloc(sizeof(char) * (vname_len + 1)); var->name = (char *)pkg_malloc(sizeof(char) * (vname_len + 1));
@ -282,6 +288,14 @@ int cfg_script_fixup(cfg_group_t *group, unsigned char *block)
} }
} }
/* Sanity check for the group size, make sure that the
* newly calculated size equals the already calculated
* group size. */
if (offset != group->size) {
LM_ERR("BUG: incorrect group size: %d; previously calculated value: %d \n", offset, group->size);
goto error;
}
/* allocate a handle even if it will not be used to /* allocate a handle even if it will not be used to
directly access the variable, like handle->variable directly access the variable, like handle->variable
cfg_get_* functions access the memory block via the handle cfg_get_* functions access the memory block via the handle

@ -220,7 +220,12 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg *msg)
break; break;
case CFG_VAR_STR: case CFG_VAR_STR:
memcpy(res, p, sizeof(str)); if(p) {
memcpy(res, p, sizeof(str));
} else {
res->s = 0;
res->len = 0;
}
break; break;
default: default:

@ -3882,7 +3882,7 @@ int dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
} }
break; break;
case T_NAPTR: case T_NAPTR:
if(rpc->struct_add(sh, "ds", if(rpc->struct_add(sh, "dd",
"rr_order", ((struct naptr_rdata*)(rr->rdata))->order, "rr_order", ((struct naptr_rdata*)(rr->rdata))->order,
"rr_preference", ((struct naptr_rdata*)(rr->rdata))->pref) "rr_preference", ((struct naptr_rdata*)(rr->rdata))->pref)
<0) { <0) {

@ -51,6 +51,11 @@ int resetflag( struct sip_msg* msg, flag_t flag ) {
return 1; return 1;
} }
int resetflags( struct sip_msg* msg, flag_t flags ) {
msg->flags &= ~ flags;
return 1;
}
int isflagset( struct sip_msg* msg, flag_t flag ) { int isflagset( struct sip_msg* msg, flag_t flag ) {
return (msg->flags & (1<<flag)) ? 1 : -1; return (msg->flags & (1<<flag)) ? 1 : -1;
} }

@ -40,6 +40,7 @@ struct sip_msg;
int setflag( struct sip_msg* msg, flag_t flag ); int setflag( struct sip_msg* msg, flag_t flag );
int resetflag( struct sip_msg* msg, flag_t flag ); int resetflag( struct sip_msg* msg, flag_t flag );
int resetflags( struct sip_msg* msg, flag_t flags );
int isflagset( struct sip_msg* msg, flag_t flag ); int isflagset( struct sip_msg* msg, flag_t flag );

@ -28,7 +28,7 @@
#include "fmsg.h" #include "fmsg.h"
#define FAKED_SIP_MSG "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: <you@kamailio.org>;tag=123\r\nTo: <you@kamailio.org>\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n" #define FAKED_SIP_MSG "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: <sip:you@kamailio.org>;tag=123\r\nTo: <sip:you@kamailio.org>\r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n"
#define FAKED_SIP_MSG_LEN (sizeof(FAKED_SIP_MSG)-1) #define FAKED_SIP_MSG_LEN (sizeof(FAKED_SIP_MSG)-1)
static char _faked_sip_buf[FAKED_SIP_MSG_LEN+1]; static char _faked_sip_buf[FAKED_SIP_MSG_LEN+1];
static struct sip_msg _faked_msg; static struct sip_msg _faked_msg;
@ -103,3 +103,8 @@ sip_msg_t* faked_msg_get_next_clear(void)
} }
return faked_msg_next_clear(); return faked_msg_next_clear();
} }
int faked_msg_match(sip_msg_t *tmsg)
{
return ( tmsg == &_faked_msg ) ? 1 : 0;
}

@ -29,5 +29,6 @@ sip_msg_t* faked_msg_next(void);
sip_msg_t* faked_msg_get_next(void); sip_msg_t* faked_msg_get_next(void);
sip_msg_t* faked_msg_next_clear(void); sip_msg_t* faked_msg_next_clear(void);
sip_msg_t* faked_msg_get_next_clear(void); sip_msg_t* faked_msg_get_next_clear(void);
int faked_msg_match(sip_msg_t *tmsg);
#endif #endif

@ -176,7 +176,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
LM_CRIT("invalid Via host name\n"); LM_CRIT("invalid Via host name\n");
return -1; return -1;
} }
if (strncmp(name->s, s, name->len)==0) if (len==name->len&&(strncmp(name->s, s, name->len)==0))
return 0; return 0;
} }
}else{ }else{
@ -1710,7 +1710,7 @@ int get_boundary(struct sip_msg* msg, str* boundary)
msg->content_type->body.len); msg->content_type->body.len);
if (params.s == NULL) if (params.s == NULL)
{ {
LM_INFO("Content-Type hdr has no params <%.*s>\n", LM_INFO("Content-Type hdr has no boundary params <%.*s>\n",
msg->content_type->body.len, msg->content_type->body.s); msg->content_type->body.len, msg->content_type->body.s);
return -1; return -1;
} }
@ -1835,10 +1835,10 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info)
tmp.len = get_line(lb_t->s); tmp.len = get_line(lb_t->s);
if(tmp.len!=b.len || strncmp(b.s, tmp.s, b.len)!=0) if(tmp.len!=b.len || strncmp(b.s, tmp.s, b.len)!=0)
{ {
LM_DBG("malformed bondary in the middle\n"); LM_DBG("malformed boundary in the middle\n");
memcpy(pb, b.s, b.len); body.len = body.len + b.len; memcpy(pb, b.s, b.len); body.len = body.len + b.len;
pb = pb + b.len; pb = pb + b.len;
t = lb_t->s.s - (lb_t->s.s + tmp.len); t = lb_t->next->s.s - (lb_t->s.s + tmp.len);
memcpy(pb, lb_t->s.s+tmp.len, t); pb = pb + t; memcpy(pb, lb_t->s.s+tmp.len, t); pb = pb + t;
/*LM_DBG("new chunk[%d][%.*s]\n", t, t, pb-t);*/ /*LM_DBG("new chunk[%d][%.*s]\n", t, t, pb-t);*/
} }

@ -510,7 +510,11 @@ int part_multipart_headers_cmp (char *buffer,
} }
if (error < 0) { if (error < 0) {
LM_ERR("part_multipart_headers_cmp. error. \"%i\". \"%s\".\n", error, error_msg); if(error == -2) {
LM_DBG("result code: \"%i\" text: \"%s\".\n", error, error_msg);
} else {
LM_ERR("error code: \"%i\" error text: \"%s\".\n", error, error_msg);
}
return 0; return 0;
} else { } else {
return found; return found;

@ -163,6 +163,12 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
LM_CRIT("null dbf parameter\n"); LM_CRIT("null dbf parameter\n");
return -1; return -1;
} }
/* for safety we initialize mydbf with 0 (this will cause
* a segfault immediately if someone tries to call a function
* from it without checking the return code from bind_dbmod */
memset((void*)mydbf, 0, sizeof(db_func_t));
if (mod->len > MAX_URL_LENGTH) if (mod->len > MAX_URL_LENGTH)
{ {
LM_ERR("SQL URL too long\n"); LM_ERR("SQL URL too long\n");
@ -178,11 +184,6 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
memcpy(name+3, mod->s, mod->len); memcpy(name+3, mod->s, mod->len);
name[mod->len+3] = 0; name[mod->len+3] = 0;
/* for safety we initialize mydbf with 0 (this will cause
* a segfault immediately if someone tries to call a function
* from it without checking the return code from bind_dbmod */
memset((void*)mydbf, 0, sizeof(db_func_t));
p = strchr(name, ':'); p = strchr(name, ':');
if (p) { if (p) {
len = p - name; len = p - name;

@ -1887,6 +1887,10 @@ int main(int argc, char** argv)
log_color=1; log_color=1;
break; break;
case 'M': case 'M':
if (optarg == NULL) {
fprintf(stderr, "bad private mem size\n");
goto error;
}
pkg_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024; pkg_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024;
if (tmp &&(*tmp)){ if (tmp &&(*tmp)){
fprintf(stderr, "bad private mem size number: -M %s\n", fprintf(stderr, "bad private mem size number: -M %s\n",
@ -2608,8 +2612,8 @@ try_again:
* function being called before this point may rely on the * function being called before this point may rely on the
* number of processes ! * number of processes !
*/ */
LM_DBG("Expect (at least) %d kamailio processes in your process list\n", LM_INFO("processes (at least): %d - shm size: %lu - pkg size: %lu\n",
get_max_procs()); get_max_procs(), shm_mem_size, pkg_mem_size);
#if defined USE_DNS_CACHE && defined USE_DNS_CACHE_STATS #if defined USE_DNS_CACHE && defined USE_DNS_CACHE_STATS
if (init_dns_cache_stats(get_max_procs())<0){ if (init_dns_cache_stats(get_max_procs())<0){

@ -1246,9 +1246,9 @@ modparam("acc", "cdrs_table", "acc_cdrs")
* 1 - save seconds in time_attr and microseconds in time_exten. * 1 - save seconds in time_attr and microseconds in time_exten.
* 2 - save seconds.milliseconds in time_attr. * 2 - save seconds.milliseconds in time_attr.
* 3 - save formatted time according to time_format parameter, using * 3 - save formatted time according to time_format parameter, using
the output of localtime(). the output of localtime(). Used for cdr entries too.
* 4 - save formatted time according to time_format parameter, using * 4 - save formatted time according to time_format parameter, using
the output of gmtime(). the output of gmtime(). Used for cdr entries too.
Example 1.44. time_mode example Example 1.44. time_mode example
... ...

@ -526,7 +526,7 @@ int is_eng_acc_on(sip_msg_t *msg)
} }
while(e) { while(e) {
if(e->flags & 1) { if(e->flags & 1) {
if(msg->flags & e->acc_flag) { if(isflagset(msg, e->acc_flag) == 1) {
return 1; return 1;
} }
} }
@ -549,7 +549,7 @@ int is_eng_mc_on(sip_msg_t *msg)
} }
while(e) { while(e) {
if(e->flags & 1) { if(e->flags & 1) {
if(msg->flags & e->missed_flag) { if(isflagset(msg, e->missed_flag) == 1) {
return 1; return 1;
} }
} }
@ -579,15 +579,15 @@ int acc_run_engines(struct sip_msg *msg, int type, int *reset)
inf.leg_info = leg_info; inf.leg_info = leg_info;
while(e) { while(e) {
if(e->flags & 1) { if(e->flags & 1) {
if((type==0) && (msg->flags&(e->acc_flag))) { if((type==0) && isflagset(msg, e->acc_flag) == 1) {
LM_DBG("acc event for engine: %s\n", e->name); LM_DBG("acc event for engine: %s\n", e->name);
e->acc_req(msg, &inf); e->acc_req(msg, &inf);
if(reset) *reset |= e->acc_flag; if(reset) *reset |= 1 << e->acc_flag;
} }
if((type==1) && (msg->flags&(e->missed_flag))) { if((type==1) && isflagset(msg, e->missed_flag) == 1) {
LM_DBG("missed event for engine: %s\n", e->name); LM_DBG("missed event for engine: %s\n", e->name);
e->acc_req(msg, &inf); e->acc_req(msg, &inf);
if(reset) *reset |= e->missed_flag; if(reset) *reset |= 1 << e->missed_flag;
} }
} }
e = e->next; e = e->next;

@ -55,7 +55,6 @@ struct acc_enviroment acc_env;
#define is_acc_flag_set(_rq,_flag) (((_flag) != -1) && (isflagset((_rq), (_flag)) == 1)) #define is_acc_flag_set(_rq,_flag) (((_flag) != -1) && (isflagset((_rq), (_flag)) == 1))
#define reset_acc_flag(_rq,_flag) (resetflag((_rq), (_flag)))
#define is_failed_acc_on(_rq) is_acc_flag_set(_rq,failed_transaction_flag) #define is_failed_acc_on(_rq) is_acc_flag_set(_rq,failed_transaction_flag)
@ -465,7 +464,6 @@ static inline void acc_onreply_in(struct cell *t, struct sip_msg *req,
} }
/* initiate a report if we previously enabled MC accounting for this t */ /* initiate a report if we previously enabled MC accounting for this t */
static inline void on_missed(struct cell *t, struct sip_msg *req, static inline void on_missed(struct cell *t, struct sip_msg *req,
struct sip_msg *reply, int code) struct sip_msg *reply, int code)
@ -501,11 +499,10 @@ static inline void on_missed(struct cell *t, struct sip_msg *req,
* forwarding attempt fails; we do not wish to * forwarding attempt fails; we do not wish to
* report on every attempt; so we clear the flags; * report on every attempt; so we clear the flags;
*/ */
if (is_log_mc_on(req)) { if (is_log_mc_on(req)) {
env_set_text( ACC_MISSED, ACC_MISSED_LEN); env_set_text( ACC_MISSED, ACC_MISSED_LEN);
acc_log_request( req ); acc_log_request( req );
flags_to_reset |= log_missed_flag; flags_to_reset |= 1 << log_missed_flag;
} }
if (is_db_mc_on(req)) { if (is_db_mc_on(req)) {
if(acc_db_set_table_name(req, db_table_mc_data, &db_table_mc)<0) { if(acc_db_set_table_name(req, db_table_mc_data, &db_table_mc)<0) {
@ -513,7 +510,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req,
return; return;
} }
acc_db_request( req ); acc_db_request( req );
flags_to_reset |= db_missed_flag; flags_to_reset |= 1 << db_missed_flag;
} }
/* run extra acc engines */ /* run extra acc engines */
@ -523,7 +520,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req,
* These can't be reset in the blocks above, because * These can't be reset in the blocks above, because
* it would skip accounting if the flags are identical * it would skip accounting if the flags are identical
*/ */
reset_acc_flag( req, flags_to_reset ); resetflags(req, flags_to_reset);
if (new_uri_bk.len>=0) { if (new_uri_bk.len>=0) {
req->new_uri = new_uri_bk; req->new_uri = new_uri_bk;

@ -145,9 +145,9 @@ static int mod_init( void )
memset(&_acc_diameter_engine, 0, sizeof(acc_engine_t)); memset(&_acc_diameter_engine, 0, sizeof(acc_engine_t));
if(diameter_flag != -1) if(diameter_flag != -1)
_acc_diameter_engine.acc_flag = 1<<diameter_flag; _acc_diameter_engine.acc_flag = diameter_flag;
if(diameter_missed_flag != -1) if(diameter_missed_flag != -1)
_acc_diameter_engine.missed_flag = 1<<diameter_missed_flag; _acc_diameter_engine.missed_flag = diameter_missed_flag;
_acc_diameter_engine.acc_req = acc_diameter_send_request; _acc_diameter_engine.acc_req = acc_diameter_send_request;
_acc_diameter_engine.acc_init = acc_diameter_init; _acc_diameter_engine.acc_init = acc_diameter_init;
memcpy(_acc_diameter_engine.name, "diameter", 8); memcpy(_acc_diameter_engine.name, "diameter", 8);

@ -144,9 +144,9 @@ static int mod_init(void)
memset(&_acc_radius_engine, 0, sizeof(acc_engine_t)); memset(&_acc_radius_engine, 0, sizeof(acc_engine_t));
if(radius_flag != -1) if(radius_flag != -1)
_acc_radius_engine.acc_flag = 1 << radius_flag; _acc_radius_engine.acc_flag = radius_flag;
if(radius_missed_flag != -1) if(radius_missed_flag != -1)
_acc_radius_engine.missed_flag = 1 << radius_missed_flag; _acc_radius_engine.missed_flag = radius_missed_flag;
_acc_radius_engine.acc_req = acc_radius_send_request; _acc_radius_engine.acc_req = acc_radius_send_request;
_acc_radius_engine.acc_init = acc_radius_init; _acc_radius_engine.acc_init = acc_radius_init;
memcpy(_acc_radius_engine.name, "radius", 6); memcpy(_acc_radius_engine.name, "radius", 6);

@ -79,14 +79,15 @@ Chapter 1. Admin Guide
1. Overview 1. Overview
This module allows executing JavaScript scripts from config file. It This module allows executing JavaScript scripts from the Kamailio
exports all KEMI functions to JavaScript in order to access the current configuration file. It exports all KEMI functions to JavaScript in
processed SIP message. These functions are within JavaScript object order to access the currently processed SIP message. These functions
'KSR'. are named within the JavaScript object 'KSR'.
It includes the Duktape JavaScript engine (http://www.duktape.org), The module is based on the Duktape JavaScript engine
which is a fast and easy to embed JavaScript interpreter. Exported API (http://www.duktape.org), which is a fast and easy to embed JavaScript
from SIP router to JavaScript is documented in the dokuwiki. interpreter. The exported API from Kamailio to JavaScript is documented
in the wiki.
The module has two JavaScript contexts: The module has two JavaScript contexts:
* first is used for functions jsdt_dofile() and jsdt_dostring(). * first is used for functions jsdt_dofile() and jsdt_dostring().
@ -142,8 +143,8 @@ modparam("app_jsdt", "load", "/usr/local/etc/kamailio/js/myscript.js")
4.1. jsdt_dofile(path) 4.1. jsdt_dofile(path)
Execute the JS script stored in 'path'. The parameter can be a string Execute the JavaScript script stored in 'path'. The parameter can be a
with pseudo-variables evaluated at runtime. string with pseudo-variables evaluated at runtime.
Example 1.2. jsdt_dofile usage Example 1.2. jsdt_dofile usage
... ...
@ -152,8 +153,8 @@ jsdt_dofile("/usr/local/etc/kamailio/js/myscript.js");
4.2. jsdt_dostring(script) 4.2. jsdt_dostring(script)
Execute the Lua script stored in parameter. The parameter can be a Execute the JavaScript script stored in parameter. The parameter can be
string with pseudo-variables. a string with pseudo-variables.
Example 1.3. jsdt_dostring usage Example 1.3. jsdt_dostring usage
... ...
@ -229,7 +230,7 @@ kamcmd app_jsdt.api_list
6. Example of usage 6. Example of usage
Create your JS script and stored on file system, say: Create your JS script and store it on the file system, say:
'/usr/local/etc/kamailio/js/myscript.js'. '/usr/local/etc/kamailio/js/myscript.js'.
... ...
function sr_append_fu_to_reply() function sr_append_fu_to_reply()

@ -46,13 +46,14 @@ Daniel-Constantin Mierla
List of Examples List of Examples
1.1. Set load parameter 1.1. Build against LuaJIT libraries
1.2. Set register parameter 1.2. Set load parameter
1.3. Set reload parameter 1.3. Set register parameter
1.4. lua_dofile usage 1.4. Set reload parameter
1.5. lua_dostring usage 1.5. lua_dofile usage
1.6. lua_run usage 1.6. lua_dostring usage
1.7. lua_runstring usage 1.7. lua_run usage
1.8. lua_runstring usage
Chapter 1. Admin Guide Chapter 1. Admin Guide
@ -120,6 +121,18 @@ Chapter 1. Admin Guide
running Kamailio with this module loaded: running Kamailio with this module loaded:
* liblua5.1-dev - Lua devel library. * liblua5.1-dev - Lua devel library.
This module can be compiled against LuaJIT compiler (instead of
standard Lua). Then this library is needed:
* libluajit-5.1-dev - LuaJIT devel library.
To enable that, LUAJIT variable has to be set.
Example 1.1. Build against LuaJIT libraries
E.g: $ LUAJIT="yes" make modules modules=modules/app_lua
(Warning: LuaJIT version is 5.1, so scripts prepared for higher Lua
versions may not work with LuaJIT)
3. Parameters 3. Parameters
3.1. load (string) 3.1. load (string)
@ -134,7 +147,7 @@ Chapter 1. Admin Guide
Default value is “null”. Default value is “null”.
Example 1.1. Set load parameter Example 1.2. Set load parameter
... ...
modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/myscript.lua") modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/myscript.lua")
... ...
@ -178,7 +191,7 @@ modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/myscript.lua")
Default value is “null”. Default value is “null”.
Example 1.2. Set register parameter Example 1.3. Set register parameter
... ...
modparam("app_lua", "register", "sl") modparam("app_lua", "register", "sl")
... ...
@ -190,7 +203,7 @@ modparam("app_lua", "register", "sl")
Default value is “0 (off)”. Default value is “0 (off)”.
Example 1.3. Set reload parameter Example 1.4. Set reload parameter
... ...
modparam("app_lua", "reload", 1) modparam("app_lua", "reload", 1)
... ...
@ -207,7 +220,7 @@ modparam("app_lua", "reload", 1)
Execute the Lua script stored in 'path'. The parameter can be a string Execute the Lua script stored in 'path'. The parameter can be a string
with pseudo-variables evaluated at runtime. with pseudo-variables evaluated at runtime.
Example 1.4. lua_dofile usage Example 1.5. lua_dofile usage
... ...
lua_dofile("/usr/local/etc/kamailio/lua/myscript.lua"); lua_dofile("/usr/local/etc/kamailio/lua/myscript.lua");
... ...
@ -217,7 +230,7 @@ lua_dofile("/usr/local/etc/kamailio/lua/myscript.lua");
Execute the Lua script stored in parameter. The parameter can be a Execute the Lua script stored in parameter. The parameter can be a
string with pseudo-variables. string with pseudo-variables.
Example 1.5. lua_dostring usage Example 1.6. lua_dostring usage
... ...
if(!lua_dostring("sr.log([[err]], [[----------- Hello World from $fU\n]])")) if(!lua_dostring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
{ {
@ -232,7 +245,7 @@ if(!lua_dostring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
loaded at startup via parameter 'load'. Parameters can be strings with loaded at startup via parameter 'load'. Parameters can be strings with
pseudo-variables that are evaluated at runtime. pseudo-variables that are evaluated at runtime.
Example 1.6. lua_run usage Example 1.7. lua_run usage
... ...
if(!lua_run("sr_append_fu_to_reply")) if(!lua_run("sr_append_fu_to_reply"))
{ {
@ -248,7 +261,7 @@ lua_run("lua_funcx", "$rU", "2");
string with pseudo-variables. The script is executed in Lua context string with pseudo-variables. The script is executed in Lua context
specific to loaded Lua files at startup. specific to loaded Lua files at startup.
Example 1.7. lua_runstring usage Example 1.8. lua_runstring usage
... ...
if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])")) if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
{ {

@ -21,17 +21,23 @@ Maxim Sobolev
3. Parameters 3. Parameters
3.1. script_name (string) 3.1. load (string)
3.2. mod_init_function (string) 3.2. script_name (string)
3.3. child_init_method (string) 3.3. mod_init_function (string)
3.4. child_init_method (string)
4. Functions 4. Functions
4.1. python_exec(method [, args]) 4.1. python_exec(method [, args])
5. RPC Commands
5.1. app_python.reload
5.2. app_python.api_list
List of Examples List of Examples
1.1. Set script_name parameter 1.1. Set load parameter
1.2. Set mod_init_function parameter 1.2. Set mod_init_function parameter
1.3. Set child_init_method parameter 1.3. Set child_init_method parameter
1.4. python_exec usage 1.4. python_exec usage
@ -48,14 +54,20 @@ Chapter 1. Admin Guide
3. Parameters 3. Parameters
3.1. script_name (string) 3.1. load (string)
3.2. mod_init_function (string) 3.2. script_name (string)
3.3. child_init_method (string) 3.3. mod_init_function (string)
3.4. child_init_method (string)
4. Functions 4. Functions
4.1. python_exec(method [, args]) 4.1. python_exec(method [, args])
5. RPC Commands
5.1. app_python.reload
5.2. app_python.api_list
1. Overview 1. Overview
This module allows executing Python scripts from config file, exporting This module allows executing Python scripts from config file, exporting
@ -83,23 +95,29 @@ Chapter 1. Admin Guide
3. Parameters 3. Parameters
3.1. script_name (string) 3.1. load (string)
3.2. mod_init_function (string) 3.2. script_name (string)
3.3. child_init_method (string) 3.3. mod_init_function (string)
3.4. child_init_method (string)
3.1. script_name (string) 3.1. load (string)
The path to the fiel with Python code to be executed from configuration The path to the file with Python code to be executed from configuration
file. 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 Example 1.1. Set load parameter
... ...
modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py") modparam("app_python", "load", "/usr/local/etc/kamailio/myscript.py")
... ...
3.2. mod_init_function (string) 3.2. script_name (string)
This is same as "load" parameter, kept for backward compatibility with
the older versions of the module.
3.3. mod_init_function (string)
The Python function to be executed by this module when it is initialied The Python function to be executed by this module when it is initialied
by Kamailio. by Kamailio.
@ -111,7 +129,7 @@ modparam("app_python", "script_name", "/usr/local/etc/kamailio/myscript.py")
modparam("app_python", "mod_init_function", "my_mod_init") modparam("app_python", "mod_init_function", "my_mod_init")
... ...
3.3. child_init_method (string) 3.4. child_init_method (string)
The Python function to be executed by this module when a new worker The Python function to be executed by this module when a new worker
process (child) is initialied by Kamailio. process (child) is initialied by Kamailio.
@ -141,3 +159,38 @@ python_exec("my_python_function");
python_exec("my_python_function", "my_params"); python_exec("my_python_function", "my_params");
python_exec("my_python_function", "$rU"); python_exec("my_python_function", "$rU");
... ...
5. RPC Commands
5.1. app_python.reload
5.2. app_python.api_list
5.1. app_python.reload
IMPORTANT: not functional yet (can crash a running instance, use it
only for testing).
Marks the need to reload the js script. The actual reload is done by
every working process when the next call to KEMI config is executed.
Name: app_python.reload
Parameters: none
Example:
...
kamcmd app_python.reload
...
5.2. app_python.api_list
List the functions available via Kemi framework.
Name: app_python.api_list
Parameters: none
Example:
...
kamcmd app_python.api_list
...

@ -136,8 +136,11 @@ modparam("async", "workers", 2)
Example 1.2. async_route usage Example 1.2. async_route usage
... ...
async_route("RESUME", "4"); request_route {
... ...
async_route("RESUME", "4");
...
}
route[RESUME] { route[RESUME] {
send_reply("404", "Not found"); send_reply("404", "Not found");
exit; exit;
@ -177,7 +180,7 @@ exit;
Example 1.4. async_workers usage Example 1.4. async_workers usage
... ...
; Enable 8 worker processes used by async and other modules # Enable 8 worker processes used by async and other modules
async_workers=8 async_workers=8
... ...
@ -197,8 +200,11 @@ async_workers=8
Example 1.5. async_task_route usage Example 1.5. async_task_route usage
... ...
async_task_route("RESUME"); request_route {
... ...
async_task_route("RESUME");
...
}
route[RESUME] { route[RESUME] {
t_relay(); t_relay();
exit; exit;

@ -28,6 +28,7 @@
#include "../../core/sr_module.h" #include "../../core/sr_module.h"
#include "../../core/dprint.h" #include "../../core/dprint.h"
#include "../../core/ut.h" #include "../../core/ut.h"
#include "../../core/fmsg.h"
#include "../../core/pvar.h" #include "../../core/pvar.h"
#include "../../core/timer_proc.h" #include "../../core/timer_proc.h"
#include "../../core/route_struct.h" #include "../../core/route_struct.h"
@ -155,6 +156,11 @@ static int w_async_sleep(sip_msg_t *msg, char *sec, char *str2)
if(msg == NULL) if(msg == NULL)
return -1; return -1;
if(faked_msg_match(msg)) {
LM_ERR("invalid usage for faked message\n");
return -1;
}
if(async_workers <= 0) { if(async_workers <= 0) {
LM_ERR("no async mod timer workers (modparam missing?)\n"); LM_ERR("no async mod timer workers (modparam missing?)\n");
return -1; return -1;
@ -212,6 +218,11 @@ int ki_async_route(sip_msg_t *msg, str *rn, int s)
int ri; int ri;
sr_kemi_eng_t *keng = NULL; sr_kemi_eng_t *keng = NULL;
if(faked_msg_match(msg)) {
LM_ERR("invalid usage for faked message\n");
return -1;
}
keng = sr_kemi_eng_get(); keng = sr_kemi_eng_get();
if(keng == NULL) { if(keng == NULL) {
ri = route_lookup(&main_rt, rn->s); ri = route_lookup(&main_rt, rn->s);
@ -287,6 +298,11 @@ int ki_async_task_route(sip_msg_t *msg, str *rn)
int ri; int ri;
sr_kemi_eng_t *keng = NULL; sr_kemi_eng_t *keng = NULL;
if(faked_msg_match(msg)) {
LM_ERR("invalid usage for faked message\n");
return -1;
}
keng = sr_kemi_eng_get(); keng = sr_kemi_eng_get();
if(keng == NULL) { if(keng == NULL) {
ri = route_lookup(&main_rt, rn->s); ri = route_lookup(&main_rt, rn->s);

@ -305,7 +305,8 @@ static int auth_fixup(void** param, int param_no)
if(version_table_check!=0 if(version_table_check!=0
&& db_check_table_version(&auth_dbf, dbh, &name, && db_check_table_version(&auth_dbf, dbh, &name,
TABLE_VERSION) < 0) { TABLE_VERSION) < 0) {
LM_ERR("error during table version check.\n"); LM_ERR("error during version check for db table: %.*s.\n",
name.len, name.s);
auth_dbf.close(dbh); auth_dbf.close(dbh);
return -1; return -1;
} }

@ -171,7 +171,7 @@ auth_xkeys_add("X-My-Key", "abc", "sha256", "$Ri:$fu:$ru:$hdr(CSeq)");
Example 1.3. auth_xkeys_check usage Example 1.3. auth_xkeys_check usage
... ...
if(!auth_xkeys_add("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) { if(!auth_xkeys_check("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) {
send_reply("403", "Forbidden"); send_reply("403", "Forbidden");
exit; exit;
} }

@ -202,6 +202,7 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key,
auth_xkey_t *itc; auth_xkey_t *itc;
char xout[SHA512_DIGEST_STRING_LENGTH]; char xout[SHA512_DIGEST_STRING_LENGTH];
struct lump* anchor; struct lump* anchor;
char *p;
if(_auth_xkeys_list==NULL || *_auth_xkeys_list==NULL) { if(_auth_xkeys_list==NULL || *_auth_xkeys_list==NULL) {
LM_ERR("no stored keys\n"); LM_ERR("no stored keys\n");
@ -266,8 +267,16 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key,
LM_ERR("can't get anchor\n"); LM_ERR("can't get anchor\n");
return -1; return -1;
} }
if (insert_new_lump_before(anchor, xdata.s, xdata.len, 0) == 0) { p = (char*)pkg_malloc(xdata.len+1);
if(p==NULL) {
LM_ERR("no more pkg memory\n");
return -2;
}
memcpy(p, xdata.s, xdata.len);
p[xdata.len] = '\0';
if (insert_new_lump_before(anchor, p, xdata.len, 0) == 0) {
LM_ERR("cannot insert the new header [%.*s]\n", hdr->len, hdr->s); LM_ERR("cannot insert the new header [%.*s]\n", hdr->len, hdr->s);
pkg_free(p);
return -1; return -1;
} }
return 0; return 0;

@ -35,6 +35,7 @@ Bastian Friedrich
3.1. enable (int) 3.1. enable (int)
3.2. granularity (int) 3.2. granularity (int)
3.3. loglevel (int) 3.3. loglevel (int)
3.4. register (str)
4. Functions 4. Functions
@ -69,10 +70,11 @@ Bastian Friedrich
1.1. Set enable parameter 1.1. Set enable parameter
1.2. Set granularity parameter 1.2. Set granularity parameter
1.3. Set loglevel parameter 1.3. Set loglevel parameter
1.4. bm_start_timer usage 1.4. Set register parameter
1.5. bm_log_timer usage 1.5. bm_start_timer usage
1.6. Enabling a timer 1.6. bm_log_timer usage
1.7. benchmark usage 1.7. Enabling a timer
1.8. benchmark usage
2.1. Using the benchmark module's API from another module 2.1. Using the benchmark module's API from another module
Chapter 1. Admin Guide Chapter 1. Admin Guide
@ -90,6 +92,7 @@ Chapter 1. Admin Guide
3.1. enable (int) 3.1. enable (int)
3.2. granularity (int) 3.2. granularity (int)
3.3. loglevel (int) 3.3. loglevel (int)
3.4. register (str)
4. Functions 4. Functions
@ -140,6 +143,7 @@ Chapter 1. Admin Guide
3.1. enable (int) 3.1. enable (int)
3.2. granularity (int) 3.2. granularity (int)
3.3. loglevel (int) 3.3. loglevel (int)
3.4. register (str)
3.1. enable (int) 3.1. enable (int)
@ -193,6 +197,20 @@ modparam("benchmark", "loglevel", 4)
This will set the logging level to L_DBG. This will set the logging level to L_DBG.
3.4. register (str)
Register a timer id at startup. Required when using the start/log
functions via Kemi framework. This parameter can be set many times to
register several timer ids.
Default value is “NONE”.
Example 1.4. Set register parameter
...
modparam("benchmark", "register", "test")
modparam("benchmark", "register", "auth")
...
4. Functions 4. Functions
4.1. bm_start_timer(name) 4.1. bm_start_timer(name)
@ -202,7 +220,7 @@ modparam("benchmark", "loglevel", 4)
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 Example 1.5. bm_start_timer usage
... ...
bm_start_timer("test"); bm_start_timer("test");
... ...
@ -235,7 +253,7 @@ bm_start_timer("test");
* Global avg possibly the most interesting value. * Global avg possibly the most interesting value.
Example 1.5. bm_log_timer usage Example 1.6. bm_log_timer usage
... ...
bm_log_timer("test"); bm_log_timer("test");
... ...
@ -269,7 +287,7 @@ bm_log_timer("test");
Enable or disable a single timer. The following example enables timer Enable or disable a single timer. The following example enables timer
"test" (the second parameter must be 0 to disable): "test" (the second parameter must be 0 to disable):
Example 1.6. Enabling a timer Example 1.7. Enabling a timer
... ...
kamcmd benchmark.enable_timer test 1 kamcmd benchmark.enable_timer test 1
... ...
@ -286,7 +304,7 @@ kamcmd benchmark.enable_timer test 1
Measure the duration of user location lookup. Measure the duration of user location lookup.
Example 1.7. benchmark usage Example 1.8. benchmark usage
... ...
bm_start_timer("usrloc-lookup"); bm_start_timer("usrloc-lookup");
lookup("location"); lookup("location");

@ -147,7 +147,9 @@ Note
the message that caused the connection establishment. the message that caused the connection establishment.
Example 1.5. blst_set_ignore usage Example 1.5. blst_set_ignore usage
...
blst_set_ignore(6); # ignore send and connect errors blst_set_ignore(6); # ignore send and connect errors
...
2.6. blst_rpl_set_ignore([flags]) 2.6. blst_rpl_set_ignore([flags])
@ -161,7 +163,9 @@ Note
See also blst_set_ignore. See also blst_set_ignore.
Example 1.6. blst_clear_ignore usage Example 1.6. blst_clear_ignore usage
...
blst_clear_ignore(4); # ignore connect errors blst_clear_ignore(4); # ignore connect errors
...
2.8. blst_rpl_clear_ignore([flags]) 2.8. blst_rpl_clear_ignore([flags])

@ -56,22 +56,12 @@ Lucian Balaceanu
5.1. cr.reload_routes 5.1. cr.reload_routes
5.2. cr.dump_routes 5.2. cr.dump_routes
6. MI Commands 6. Configuration examples
7. Installation and Running
6.1. cr_reload_routes 7.1. Database setup
6.2. cr_dump_routes 7.2. Database examples
6.3. cr_replace_host 7.3. User specific routing
6.4. cr_deactivate_host
6.5. cr_activate_host
6.6. cr_add_host
6.7. cr_delete_host
7. Configuration examples
8. Installation and Running
8.1. Database setup
8.2. Database examples
8.3. User specific routing
2. Module parameter for database access. 2. Module parameter for database access.
@ -122,20 +112,15 @@ Lucian Balaceanu
1.11. Unset db_load_description parameter 1.11. Unset db_load_description parameter
1.12. Set match_mode parameter 1.12. Set match_mode parameter
1.13. Set avoid_failed_destinations parameter 1.13. Set avoid_failed_destinations parameter
1.14. cr_replace_host usage 1.14. Configuration example - Routing to default tree
1.15. cr_deactivate_host usage 1.15. Configuration example - Routing to user tree
1.16. cr_activate_host usage 1.16. Configuration example - module configuration
1.17. cr_add_host usage 1.17. Example database content - carrierroute table
1.18. cr_delete_host usage 1.18. Example database content - simple carrierfailureroute table
1.19. Configuration example - Routing to default tree 1.19. Example database content - more complex carrierfailureroute table
1.20. Configuration example - Routing to user tree 1.20. Example database content - carrier_name table
1.21. Configuration example - module configuration 1.21. Example database content - domain_name table
1.22. Example database content - carrierroute table 1.22. Necessary extensions for the user 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.1. Set db_url parameter
2.2. Set carrierroute_table parameter 2.2. Set carrierroute_table parameter
2.3. Set carrierroute_id_col parameter 2.3. Set carrierroute_id_col parameter
@ -210,22 +195,12 @@ Chapter 1. Admin Guide
5.1. cr.reload_routes 5.1. cr.reload_routes
5.2. cr.dump_routes 5.2. cr.dump_routes
6. MI Commands 6. Configuration examples
7. Installation and Running
6.1. cr_reload_routes
6.2. cr_dump_routes
6.3. cr_replace_host
6.4. cr_deactivate_host
6.5. cr_activate_host
6.6. cr_add_host
6.7. cr_delete_host
7. Configuration examples 7.1. Database setup
8. Installation and Running 7.2. Database examples
7.3. User specific routing
8.1. Database setup
8.2. Database examples
8.3. User specific routing
1. Overview 1. Overview
@ -683,121 +658,9 @@ dstavp)
Parameters: Parameters:
* none * none
6. MI Commands 6. Configuration examples
6.1. cr_reload_routes
6.2. cr_dump_routes
6.3. cr_replace_host
6.4. cr_deactivate_host
6.5. cr_activate_host
6.6. cr_add_host
6.7. cr_delete_host
All commands understand the "-?" parameter to print a short help
message. The options have to be quoted as one string to be passed to MI
interface. Each option except host and new host can be wildcarded by *
(but only * and not things like "-d prox*").
6.1. cr_reload_routes
6.2. cr_dump_routes
6.3. cr_replace_host
This command can replace the rewrite_host of a route rule, it is only
usable in file mode. Following options are possible:
* -d - the domain containing the host
* -p - the prefix containing the host
* -h - the host to be replaced
* -t - the new host
Use the "null" prefix to specify an empty prefix.
Example 1.14. cr_replace_host usage
...
kamctl fifo cr_replace_host "-d proxy -p 49 -h proxy1 -t proxy2"
...
6.4. cr_deactivate_host
This command deactivates the specified host, i.e. it sets its status to
0. It is only usable in file mode. Following options are possible:
* -d - the domain containing the host
* -p - the prefix containing the host
* -h - the host to be deactivated
* -t - the new host used as backup
When -t (new_host) is specified, the portion of traffic for the
deactivated host is routed to the host given by -t. This is indicated
in the output of dump_routes. The backup route is deactivated if the
host is activated again.
Use the "null" prefix to specify an empty prefix.
Example 1.15. cr_deactivate_host usage
...
kamctl fifo cr_deactivate_host "-d proxy -p 49 -h proxy1"
...
6.5. cr_activate_host
This command activates the specified host, i.e. it sets its status to
1. It is only usable in file mode. Following options are possible:
* -d - the domain containing the host
* -p - the prefix containing the host
* -h - the host to be activated
Use the "null" prefix to specify an empty prefix.
Example 1.16. cr_activate_host usage
...
kamctl fifo cr_activate_host "-d proxy -p 49 -h proxy1"
...
6.6. cr_add_host
This command adds a route rule, it is only usable in file mode.
Following options are possible:
* -d - the domain containing the host
* -p - the prefix containing the host
* -h - the host to be added
* -w - the weight of the rule
* -P - an optional rewrite prefix
* -S - an optional rewrite suffix
* -i - an optional hash index
* -s - an optional strip value
Use the "null" prefix to specify an empty prefix.
Example 1.17. cr_add_host usage
...
kamctl fifo cr_add_host "-d proxy -p 49 -h proxy1 -w 0.25"
...
6.7. cr_delete_host
This command delete the specified hosts or rules, i.e. remove them from
the route tree. It is only usable in file mode. Following options are
possible:
* -d - the domain containing the host
* -p - the prefix containing the host
* -h - the host to be added
* -w - the weight of the rule
* -P - an optional rewrite prefix
* -S - an optional rewrite suffix
* -i - an optional hash index
* -s - an optional strip value
Use the "null" prefix to specify an empty prefix.
Example 1.18. cr_delete_host usage
...
kamctl fifo cr_delete_host "-d proxy -p 49 -h proxy1 -w 0.25"
...
7. Configuration examples
Example 1.19. Configuration example - Routing to default tree Example 1.14. Configuration example - Routing to default tree
... ...
route { route {
# route calls based on hash over callid # route calls based on hash over callid
@ -831,7 +694,7 @@ failure_route[2] {
# further processing # further processing
} }
Example 1.20. Configuration example - Routing to user tree Example 1.15. Configuration example - Routing to user tree
... ...
route[1] { route[1] {
cr_user_carrier("$fU", "$fd", "$avp(s:carrier)"); cr_user_carrier("$fU", "$fd", "$avp(s:carrier)");
@ -873,7 +736,7 @@ failure_route[1] {
} }
... ...
Example 1.21. Configuration example - module configuration Example 1.16. Configuration example - module configuration
The following config file specifies within the default carrier two The following config file specifies within the default carrier two
domains, each with an prefix that contains two hosts. It is not domains, each with an prefix that contains two hosts. It is not
@ -929,13 +792,13 @@ domain register {
} }
... ...
8. Installation and Running 7. Installation and Running
8.1. Database setup 7.1. Database setup
8.2. Database examples 7.2. Database examples
8.3. User specific routing 7.3. User specific routing
8.1. Database setup 7.1. Database setup
Before running Kamailio with carrierroute, you have to setup the Before running Kamailio with carrierroute, you have to setup the
database table where the module will store the routing data. For that, database table where the module will store the routing data. For that,
@ -954,9 +817,9 @@ domain register {
For a minimal configuration either use the config file given above, or For a minimal configuration either use the config file given above, or
insert some data into the tables of the module. insert some data into the tables of the module.
8.2. Database examples 7.2. Database examples
Example 1.22. Example database content - carrierroute table Example 1.17. Example database content - carrierroute table
... ...
+----+---------+--------+-------------+-------+------+---------------+ +----+---------+--------+-------------+-------+------+---------------+
| id | carrier | domain | scan_prefix | flags | prob | rewrite_host | | id | carrier | domain | scan_prefix | flags | prob | rewrite_host |
@ -993,7 +856,7 @@ domain register {
flags are not set, the other two rules are used. The “strip”, “mask” flags are not set, the other two rules are used. The “strip”, “mask”
and “comment” colums are omitted for brevity. and “comment” colums are omitted for brevity.
Example 1.23. Example database content - simple carrierfailureroute Example 1.18. Example database content - simple carrierfailureroute
table table
... ...
+----+---------+--------+---------------+------------+-------------+ +----+---------+--------+---------------+------------+-------------+
@ -1015,7 +878,7 @@ domain register {
entry in the carrierroute table, otherwise the module will not load the entry in the carrierroute table, otherwise the module will not load the
routing data. routing data.
Example 1.24. Example database content - more complex Example 1.19. Example database content - more complex
carrierfailureroute table carrierfailureroute table
... ...
+----+---------+-----------+------------+--------+-----+-------------+ +----+---------+-----------+------------+--------+-----+-------------+
@ -1042,7 +905,7 @@ domain register {
that holds domain entries for this routing rules. Not all table colums that holds domain entries for this routing rules. Not all table colums
are show here for brevity. are show here for brevity.
Example 1.25. Example database content - carrier_name table Example 1.20. Example database content - carrier_name table
... ...
+----+----------+ +----+----------+
| id | carrier | | id | carrier |
@ -1055,7 +918,7 @@ domain register {
This table contains the mapping of the carrier id to actual names. This table contains the mapping of the carrier id to actual names.
Example 1.26. Example database content - domain_name table Example 1.21. Example database content - domain_name table
... ...
+----+----------+ +----+----------+
| id | domain | | id | domain |
@ -1068,14 +931,14 @@ domain register {
This table contains the mapping of the domain id to actual names. This table contains the mapping of the domain id to actual names.
8.3. User specific routing 7.3. User specific routing
For a functional routing the “cr_preferred_carrier” column must be For a functional routing the “cr_preferred_carrier” column must be
added to the subscriber table (or to the table and column that you added to the subscriber table (or to the table and column that you
specified as modul parameter) to choose the actual carrier for the specified as modul parameter) to choose the actual carrier for the
users. users.
Example 1.27. Necessary extensions for the user table Example 1.22. Necessary extensions for the user table
Suggested changes: Suggested changes:
... ...

@ -459,7 +459,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
int attach_buf) int attach_buf)
{ {
unsigned char *ptr; unsigned char *ptr;
AAAMessage *msg; AAAMessage *msg = 0;
unsigned char version; unsigned char version;
unsigned int msg_len; unsigned int msg_len;
AAA_AVP *avp; AAA_AVP *avp;

@ -157,10 +157,14 @@ static int make_send_pipe(serviced_peer_t *sp)
*/ */
static void close_send_pipe(serviced_peer_t *sp) static void close_send_pipe(serviced_peer_t *sp)
{ {
int tmp;
if (sp->send_pipe_name.s) { if (sp->send_pipe_name.s) {
close(sp->send_pipe_fd); close(sp->send_pipe_fd);
close(sp->send_pipe_fd_out); close(sp->send_pipe_fd_out);
remove(sp->send_pipe_name.s); tmp = remove(sp->send_pipe_name.s);
if (tmp == -1) {
LM_ERR("could not remove send pipe\n");
}
shm_free(sp->send_pipe_name.s); shm_free(sp->send_pipe_name.s);
sp->send_pipe_name.s=0; sp->send_pipe_name.s=0;
sp->send_pipe_name.len=0; sp->send_pipe_name.len=0;
@ -269,6 +273,7 @@ static int send_fd(int pipe_fd,int fd, peer *p)
struct iovec iov[1]; struct iovec iov[1];
int ret; int ret;
int *tmp = NULL; int *tmp = NULL;
memset(&msg, 0, sizeof(struct msghdr));
#ifdef HAVE_MSGHDR_MSG_CONTROL #ifdef HAVE_MSGHDR_MSG_CONTROL
struct cmsghdr* cmsg; struct cmsghdr* cmsg;
@ -839,6 +844,7 @@ drop_peer:
int peer_connect(peer *p) int peer_connect(peer *p)
{ {
int sock; int sock;
int tmp = 0;
unsigned int option = 1; unsigned int option = 1;
struct addrinfo *ainfo=0,*res=0,*sainfo=0,hints; struct addrinfo *ainfo=0,*res=0,*sainfo=0,hints;
@ -930,10 +936,21 @@ int peer_connect(peer *p)
} }
x=fcntl(sock,F_GETFL,0); x=fcntl(sock,F_GETFL,0);
fcntl(sock,F_SETFL,x & (~O_NONBLOCK)); if (x == -1) {
LM_ERR("error during first fcntl operation\n");
goto error;
}
tmp = fcntl(sock,F_SETFL,x & (~O_NONBLOCK));
if (tmp == -1) {
LM_ERR("error during second fcntl operation\n");
goto error;
}
}
tmp = setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option));
if (tmp == -1) {
LM_ERR("could not set socket options\n");
goto error;
} }
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option));
LM_INFO("peer_connect(): Peer %.*s:%d connected\n",p->fqdn.len,p->fqdn.s,p->port); LM_INFO("peer_connect(): Peer %.*s:%d connected\n",p->fqdn.len,p->fqdn.s,p->port);
if (!send_fd(p->fd_exchange_pipe,sock,p)){ if (!send_fd(p->fd_exchange_pipe,sock,p)){
@ -943,10 +960,12 @@ int peer_connect(peer *p)
} }
if (res) freeaddrinfo(res); if (res) freeaddrinfo(res);
if (sainfo) freeaddrinfo(sainfo);
return sock; return sock;
} }
error: error:
if (res) freeaddrinfo(res); if (res) freeaddrinfo(res);
if (sainfo) freeaddrinfo(sainfo);
return -1; return -1;
} }

@ -74,7 +74,7 @@ Chapter 1. Admin Guide
2.1. Kamailio Modules 2.1. Kamailio Modules
The following modules must be loaded before this module: The following modules must be loaded before this module:
* None. * pv.
2.2. External Libraries or Applications 2.2. External Libraries or Applications

@ -705,7 +705,8 @@ static int cfg_lock_helper(str *lkey, int mode)
unsigned int pos; unsigned int pos;
if(_cfg_lock_set==NULL) { if(_cfg_lock_set==NULL) {
LM_ERR("lock set not initialized (attempt to do op: %d on: %.*s)\n", LM_ERR("lock set not initialized (attempt to do op: %d on: %.*s) -"
" see param lock_set_size\n",
mode, lkey->len, lkey->s); mode, lkey->len, lkey->s);
return -1; return -1;
} }
@ -900,6 +901,7 @@ static void mod_destroy(void)
{ {
lock_set_destroy(_cfg_lock_set); lock_set_destroy(_cfg_lock_set);
lock_set_dealloc(_cfg_lock_set); lock_set_dealloc(_cfg_lock_set);
_cfg_lock_set = NULL;
} }
} }

@ -26,11 +26,13 @@ Carlos Ruiz Díaz
4. Functions 4. Functions
4.1. cnxcc_set_max_credit() 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse,
4.2. cnxcc_set_max_time() fpulse)
4.3. cnxcc_update_max_time()
4.4. cnxcc_set_max_channel() 4.2. cnxcc_set_max_time(customer, maxtime)
4.5. cnxcc_terminate_all() 4.3. cnxcc_update_max_time(customer, maxtime)
4.4. cnxcc_set_max_channel(customer, maxchan)
4.5. cnxcc_terminate_all(customer)
5. RPC Commands 5. RPC Commands
@ -45,8 +47,8 @@ Carlos Ruiz Díaz
List of Examples List of Examples
1.1. 1.1. redis parameter
1.2. credit_check_period 1.2. credit_check_period parameter
1.3. cnxcc_set_max_credit() 1.3. cnxcc_set_max_credit()
1.4. cnxcc_set_max_time() 1.4. cnxcc_set_max_time()
1.5. cnxcc_update_max_time() 1.5. cnxcc_update_max_time()
@ -71,11 +73,13 @@ Chapter 1. Admin Guide
4. Functions 4. Functions
4.1. cnxcc_set_max_credit() 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse,
4.2. cnxcc_set_max_time() fpulse)
4.3. cnxcc_update_max_time()
4.4. cnxcc_set_max_channel() 4.2. cnxcc_set_max_time(customer, maxtime)
4.5. cnxcc_terminate_all() 4.3. cnxcc_update_max_time(customer, maxtime)
4.4. cnxcc_set_max_channel(customer, maxchan)
4.5. cnxcc_terminate_all(customer)
5. RPC Commands 5. RPC Commands
@ -142,7 +146,7 @@ Chapter 1. Admin Guide
Redis datasource connection information Redis datasource connection information
Example 1.1. Example 1.1. redis parameter
... ...
modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1") modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1")
... ...
@ -156,24 +160,34 @@ modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1")
Values greater than 1 leads to precision lost but less CPU consumption. Values greater than 1 leads to precision lost but less CPU consumption.
Example 1.2. credit_check_period Example 1.2. credit_check_period parameter
... ...
modparam("cnxcc", "credit_check_period", 1) modparam("cnxcc", "credit_check_period", 1)
... ...
4. Functions 4. Functions
4.1. cnxcc_set_max_credit() 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse)
4.2. cnxcc_set_max_time() 4.2. cnxcc_set_max_time(customer, maxtime)
4.3. cnxcc_update_max_time() 4.3. cnxcc_update_max_time(customer, maxtime)
4.4. cnxcc_set_max_channel() 4.4. cnxcc_set_max_channel(customer, maxchan)
4.5. cnxcc_terminate_all() 4.5. cnxcc_terminate_all(customer)
4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse)
Associates the call with a customer id and sets the max credit, cost
per second, initial pulse and final pulse. The discount is calculated
in pulses (30/6, 1/1, etc) and sustracted from the pool of credit.
4.1. cnxcc_set_max_credit() The customer value can be provided as a string or a variable holding a
string.
Specifies the initial pulse, final pulse, max credit and cost per The maxcredit and cps can be double (float) or integer values, they
second of a call. The discount is calculated in pulses (30/6, 1/1, etc) have to be provided as static string values of variables holding string
and sustracted from the pool of credit. values.
The ipulse and fpulse values are integer values, they can be also given
via variables holding integers.
Return code: Return code:
* 1 - successful * 1 - successful
@ -182,59 +196,75 @@ modparam("cnxcc", "credit_check_period", 1)
Example 1.3. cnxcc_set_max_credit() Example 1.3. cnxcc_set_max_credit()
... ...
$var(customer) = "john-doe-123-premium"; cnxcc_set_max_credit("john-doe", "100.5", "0.5", "20", "10");
$var(credit) = "100"; ...
$var(cps) = "2.00"; # cost per second $var(customer) = "john-doe-premium"; # customer id
$var(initial_p) = "030"; # intial pulse $var(credit) = "100"; # max credit
$var(final_p) = "006"; # final pulse $var(cps) = "2.00"; # cost per second
$var(initial_p) = 30; # intial pulse
cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)", "$var(initia $var(final_p) = 6; # final pulse
l_p)", "$var(final_p)"); cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)",
"$var(initial_p)", "$var(final_p)");
... ...
4.2. cnxcc_set_max_time() 4.2. cnxcc_set_max_time(customer, maxtime)
Specifies the amount of time the call should last at most. Specifies the amount of time the call should last at most.
The customer value can be provided as a string or a variable holding a
string.
The maxtime value is an integer values, it can be also given via a
variable holding an integer.
Return code: Return code:
* 1 - successful * 1 - successful
* -1 - failed, error logged * -1 - failed, error logged
Example 1.4. cnxcc_set_max_time() Example 1.4. cnxcc_set_max_time()
... ...
$var(customer) = "john-doe-123-basic"; $var(customer) = "john-doe-basic";
$var(max_time) = 120; $var(max_time) = 120;
cnxcc_set_max_time("$var(customer)", "$var(max_time)"); cnxcc_set_max_time("$var(customer)", "$var(max_time)");
... ...
4.3. cnxcc_update_max_time() 4.3. cnxcc_update_max_time(customer, maxtime)
Updates max-time of an established and monitored call. This can be used Updates max-time of an established and monitored call. This can be used
to grant minimum values and to update them every short periods on time to grant minimum values and to update them every short periods on time
as a mean to prevent frauds and/or to mimic requested/granted units of as a mean to prevent frauds and/or to mimic requested/granted units of
time of Credit Control Application behavior. time of Credit Control Application behavior.
The customer value can be provided as a string or a variable holding a
string.
The maxtime value is an integer values, it can be also given via a
variable holding an integer.
Return code: Return code:
* 1 - successful * 1 - successful
* -1 - failed, error logged * -1 - failed, error logged
Example 1.5. cnxcc_update_max_time() Example 1.5. cnxcc_update_max_time()
... ...
$var(update_time) = 5; $var(client) = "john-doe-basic";
$var(client) = "john-doe-123-basic"; $var(update_time) = 5;
if (!cnxcc_update_max_time("$var(client)", if (!cnxcc_update_max_time("$var(client)", "$var(update_time)")) {
"$var(update_time)")) { xlog("Error updating max-time");
xlog("Error updating max-time"); return;
return;
} }
... ...
4.4. cnxcc_set_max_channel() 4.4. cnxcc_set_max_channel(customer, maxchan)
Specifies a limit for the number of simultaneous calls Specifies a limit for the number of simultaneous calls.
The customer value can be provided as a string or a variable holding a
string.
The maxchan value is an integer values, it can be also given via a
variable holding an integer.
Return code: Return code:
* 1 - successful * 1 - successful
@ -265,12 +295,14 @@ if ($var(retcode) < -1) {
exit; exit;
} }
... ...
4.5. cnxcc_terminate_all() 4.5. cnxcc_terminate_all(customer)
Terminates all calls of the specified customer/profile.
Terminates all calls of the specified customer/profile The customer value can be provided as a string or a variable holding a
string.
Return code: Return code:
* 1 - successful * 1 - successful
@ -299,7 +331,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
Parameters: none Parameters: none
Example: Example:
kamcmd cnxcc.active_clients ...
kamcmd cnxcc.active_clients
...
5.2. cnxcc.check_client 5.2. cnxcc.check_client
@ -308,7 +342,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
Parameters: client/customer identifier Parameters: client/customer identifier
Example: Example:
kamcmd cnxcc.check_client john-doe-123-premium ...
kamcmd cnxcc.check_client john-doe-premium
...
5.3. cnxcc.kill_call 5.3. cnxcc.kill_call
@ -317,7 +353,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
Parameters: Call-ID Parameters: Call-ID
Example: Example:
kamcmd cnxcc.kill_call qumojlaahitafih@carlosrdcnx-laptop.site ....
kamcmd cnxcc.kill_call test@carlosrdcnx-laptop.site
...
5.4. cnxcc.stats 5.4. cnxcc.stats
@ -326,7 +364,9 @@ if (!cnxcc_terminate_all("$var(customer)")) {
Parameters: none Parameters: none
Example: Example:
kamcmd cnxcc.stats ...
kamcmd cnxcc.stats
...
6. Events 6. Events
@ -360,25 +400,23 @@ event_route[cnxcc:call-shutdown]
... ...
route[CNXCC] route[CNXCC]
{ {
$var(client) = "test-client-0-123-01"; $var(client) = "test-client";
$var(credit) = "50"; $var(credit) = "50";
$var(cost_per_sec) = "0.5"; $var(cost_per_sec) = "0.5";
$var(i_pulse) = "30"; $var(i_pulse) = 30;
$var(f_pulse) = "6"; $var(f_pulse) = 6;
if (!cnxcc_set_max_credit("$var(client)", if (!cnxcc_set_max_credit("$var(client)",
"$var(credit)", "$var(credit)",
"$var(cost_per_sec)", "$var(cost_per_sec)",
"$var(i_pulse)", "$var(i_pulse)",
"$var(f_pulse)")) { "$var(f_pulse)")) {
xlog("Error setting up credit control"); xlog("Error setting up credit control");
} }
} }
event_route[cnxcc:call-shutdown] event_route[cnxcc:call-shutdown]
{ {
xlog("L_INFO", "[$ci]: call killed"); xlog("L_INFO", "[$ci]: call killed");
} }
... ...

@ -233,7 +233,7 @@ static int __redis_select_db(redisContext *ctxt, int db)
if(!rpl) if(!rpl)
LM_ERR("%s\n", ctxt->errstr); LM_ERR("%s\n", ctxt->errstr);
else { else {
LM_ERR("%.*s\n", rpl->len, rpl->str); LM_ERR("%.*s\n", (int)rpl->len, rpl->str);
freeReplyObject(rpl); freeReplyObject(rpl);
} }
return -1; return -1;
@ -254,7 +254,7 @@ static int __redis_exec(
if(!*rpl) if(!*rpl)
LM_ERR("%s\n", _data.redis->ctxt->errstr); LM_ERR("%s\n", _data.redis->ctxt->errstr);
else { else {
LM_ERR("%.*s\n", (*rpl)->len, (*rpl)->str); LM_ERR("%.*s\n", (int)(*rpl)->len, (*rpl)->str);
freeReplyObject(*rpl); freeReplyObject(*rpl);
} }
@ -384,7 +384,7 @@ int redis_get_str(credit_data_t *credit_data, const char *instruction,
} }
if(rpl->len <= 0) { if(rpl->len <= 0) {
LM_ERR("RPL len is equal to %d\n", rpl->len); LM_ERR("RPL len is equal to %d\n", (int)rpl->len);
goto done; goto done;
} }

@ -413,7 +413,7 @@ static inline char *run_remove_location( struct cpl_interpreter *intr )
unsigned short attr_name; unsigned short attr_name;
unsigned short n; unsigned short n;
char *p; char *p;
str url; str url = STR_NULL;
int i; int i;
url.s = (char*)UNDEF_CHAR; url.s = (char*)UNDEF_CHAR;

@ -874,7 +874,7 @@ int _bdb_delete_cursor(
int ret, klen = MAX_ROW_SIZE; int ret, klen = MAX_ROW_SIZE;
DBT key, data; DBT key, data;
DB *db; DB *db;
DBC *dbcp; DBC *dbcp = NULL;
int *lkey = NULL; int *lkey = NULL;
ret = 0; ret = 0;

@ -69,12 +69,12 @@ Chapter 1. Admin Guide
database access. Relaying of insert, update, query and delete database access. Relaying of insert, update, query and delete
operations is supported. operations is supported.
Modules can be configured to use the perlvdb module as database backend Modules can be configured to use the db_perlvdb module as database
using the db_url_parameter: backend using the db_url_parameter:
modparam("acc", "db_url", "perlvdb:Kamailio::VDB::Adapter::AccountingSIPtrace") modparam("acc", "db_url", "perlvdb:Kamailio::VDB::Adapter::AccountingSIPtrace")
This configuration options tells acc module that it should use the This configuration options tells acc module that it should use the
perlvdb module which will in turn use the Perl class db_perlvdb module which will in turn use the Perl class
Kamailio::VDB::Adapter::AccountingSIPtrace to relay the database Kamailio::VDB::Adapter::AccountingSIPtrace to relay the database
requests. requests.
@ -86,13 +86,14 @@ modparam("acc", "db_url", "perlvdb:Kamailio::VDB::Adapter::AccountingSIPtrace")
2.1. Kamailio Modules 2.1. Kamailio Modules
The following modules must be loaded before this module: The following modules must be loaded before this module:
* perl -- Perl module * app_perl -- Perl Application module
2.2. External Libraries or Applications 2.2. External Libraries or Applications
The following libraries or applications must be installed before The following libraries or applications must be installed before
running Kamailio with this module loaded: running Kamailio with this module loaded:
* None (Besides the ones mentioned in the perl module documentation). * None (Besides the ones mentioned in the app_perl module
documentation).
3. Parameters 3. Parameters
@ -136,7 +137,7 @@ Chapter 2. Developer Guide
2. Base class Kamailio::VDB 2. Base class Kamailio::VDB
A client module has to be configured to use the perlvdb module in A client module has to be configured to use the db_perlvdb module in
conjunction with a Perl class to provide the functions. The configured conjunction with a Perl class to provide the functions. The configured
class needs to inherit from the base class Kamailio::VDB. class needs to inherit from the base class Kamailio::VDB.

@ -27,6 +27,7 @@ Greg Fausak
3.2. timeout (integer) 3.2. timeout (integer)
3.3. tcp_keepalive (integer) 3.3. tcp_keepalive (integer)
3.4. lockset (integer) 3.4. lockset (integer)
3.5. bytea_output_escape (integer)
4. Functions 4. Functions
@ -36,6 +37,7 @@ Greg Fausak
1.2. Set timeout parameter 1.2. Set timeout parameter
1.3. Set tcp_keepalive parameter 1.3. Set tcp_keepalive parameter
1.4. Set lockset parameter 1.4. Set lockset parameter
1.5. Set bytea_output_escape parameter
Chapter 1. Admin Guide Chapter 1. Admin Guide
@ -53,6 +55,7 @@ Chapter 1. Admin Guide
3.2. timeout (integer) 3.2. timeout (integer)
3.3. tcp_keepalive (integer) 3.3. tcp_keepalive (integer)
3.4. lockset (integer) 3.4. lockset (integer)
3.5. bytea_output_escape (integer)
4. Functions 4. Functions
@ -85,6 +88,7 @@ Chapter 1. Admin Guide
3.2. timeout (integer) 3.2. timeout (integer)
3.3. tcp_keepalive (integer) 3.3. tcp_keepalive (integer)
3.4. lockset (integer) 3.4. lockset (integer)
3.5. bytea_output_escape (integer)
3.1. retries (integer) 3.1. retries (integer)
@ -143,6 +147,18 @@ modparam("db_postgres", "tcp_keepalive", 600)
modparam("db_postgres", "lockset", 6) modparam("db_postgres", "lockset", 6)
... ...
3.5. bytea_output_escape (integer)
Control if the module should request escaping the output for bytea
fields.
Default value is 1 (do the escape).
Example 1.5. Set bytea_output_escape parameter
...
modparam("db_postgres", "bytea_output_escape", 0)
...
4. Functions 4. Functions
NONE NONE

@ -151,6 +151,25 @@ modparam("db_postgres", "lockset", 6)
</example> </example>
</section> </section>
<section id="db_postgres.p.bytea_output_escape">
<title><varname>bytea_output_escape</varname> (integer)</title>
<para>
Control if the module should request escaping the output for
bytea fields.
</para>
<para>
Default value is 1 (do the escape).
</para>
<example>
<title>Set <varname>bytea_output_escape</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("db_postgres", "bytea_output_escape", 0)
...
</programlisting>
</example>
</section>
</section> </section>
<section> <section>

@ -37,6 +37,8 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
extern int pg_bytea_output_escape;
/*! /*!
* \brief Create a new connection * \brief Create a new connection
* *
@ -52,6 +54,7 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
int i = 0; int i = 0;
const char *keywords[10], *values[10]; const char *keywords[10], *values[10];
char to[16]; char to[16];
PGresult *res = NULL;
LM_DBG("db_id = %p\n", id); LM_DBG("db_id = %p\n", id);
@ -141,6 +144,16 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
} }
#endif #endif
if(pg_bytea_output_escape!=0) {
res = PQexec(ptr->con, "SET bytea_output=escape");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
LM_ERR("cannot set blob output escaping format\n");
PQclear(res);
goto err;
}
PQclear(res);
}
return ptr; return ptr;
err: err:

@ -58,6 +58,7 @@ int pg_retries =
int pg_lockset = 4; int pg_lockset = 4;
int pg_timeout = 0; /* default = no timeout */ int pg_timeout = 0; /* default = no timeout */
int pg_keepalive = 0; int pg_keepalive = 0;
int pg_bytea_output_escape = 1;
/* /*
* Postgres module interface * Postgres module interface
@ -91,6 +92,7 @@ static param_export_t params[] = {
{"lockset", PARAM_INT, &pg_lockset}, {"lockset", PARAM_INT, &pg_lockset},
{"timeout", PARAM_INT, &pg_timeout}, {"timeout", PARAM_INT, &pg_timeout},
{"tcp_keepalive", PARAM_INT, &pg_keepalive}, {"tcp_keepalive", PARAM_INT, &pg_keepalive},
{"bytea_output_escape", PARAM_INT, &pg_bytea_output_escape},
{0, 0, 0} {0, 0, 0}
}; };

@ -186,7 +186,7 @@ modparam("db_unixodbc", "quote_char", "`")
5.2. Configuring and Running 5.2. Configuring and Running
In the openser.conf file, add the line: In the Kamailio.cfg file, add the line:
.... ....
loadmodule "/usr/local/lib/kamailio/modules/db_unixodbc.so" loadmodule "/usr/local/lib/kamailio/modules/db_unixodbc.so"
.... ....
@ -204,7 +204,7 @@ modparam("auth_db", "password_column", "password")
url adding this line: url adding this line:
.... ....
modparam("usrloc|auth_db", "db_url", modparam("usrloc|auth_db", "db_url",
"unixodbc://openser:openserrw@localhost/my_dsn") "unixodbc://kamailio:kamailiorw@localhost/my_dsn")
.... ....
replacing my_dsn with the correct value. replacing my_dsn with the correct value.

File diff suppressed because it is too large Load Diff

@ -494,8 +494,8 @@ static int mod_init(void)
return -1; return -1;
/* param checkings */ /* param checkings */
if (dlg_flag>MAX_FLAG) { if (dlg_flag!=-1 && dlg_flag>MAX_FLAG) {
LM_ERR("invalid dlg flag %d!!\n",dlg_flag); LM_ERR("invalid dlg flag %d!!\n", dlg_flag);
return -1; return -1;
} }

@ -565,11 +565,11 @@ static int load_dialog_vars_from_db(int fetch_num_rows)
} }
dlg = dlg->next; dlg = dlg->next;
if (!dlg) { if (!dlg) {
LM_WARN("insonsistent data: the dialog h_entry/h_id does not exist!\n"); LM_WARN("inconsistent data: the dialog h_entry/h_id does not exist!\n");
} }
} }
} else { } else {
LM_WARN("insonsistent data: the h_entry in the DB does not exist!\n"); LM_WARN("inconsistent data: the h_entry in the DB does not exist!\n");
} }
} }

@ -200,7 +200,7 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
if (leg==DLG_CALLER_LEG) { if (leg==DLG_CALLER_LEG) {
if((!msg->cseq && (parse_headers(msg,HDR_CSEQ_F,0)<0 || !msg->cseq)) if((!msg->cseq && (parse_headers(msg,HDR_CSEQ_F,0)<0 || !msg->cseq))
|| !msg->cseq->parsed){ || !msg->cseq->parsed){
LM_ERR("bad sip message or missing CSeq hdr :-/\n"); LM_ERR("bad sip message or missing CSeq hdr\n");
goto error0; goto error0;
} }
cseq = (get_cseq(msg))->number; cseq = (get_cseq(msg))->number;
@ -208,6 +208,9 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
/* use the same as in request */ /* use the same as in request */
cseq = dlg->cseq[DLG_CALLEE_LEG]; cseq = dlg->cseq[DLG_CALLEE_LEG];
} }
if ((leg==DLG_CALLER_LEG) && (cseq.s==NULL || cseq.len<=0)) {
LM_DBG("empty CSeq number (leg: %d)\n", leg);
}
/* extract the contact address */ /* extract the contact address */
if (!msg->contact&&(parse_headers(msg,HDR_CONTACT_F,0)<0||!msg->contact)){ if (!msg->contact&&(parse_headers(msg,HDR_CONTACT_F,0)<0||!msg->contact)){
@ -221,6 +224,9 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
goto error0; goto error0;
} }
contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri; contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri;
if(contact.s==NULL || contact.len<=0) {
LM_DBG("empty contact uri (leg: %d)\n", leg);
}
/* extract the record-route addresses */ /* extract the record-route addresses */
if (leg==DLG_CALLER_LEG) { if (leg==DLG_CALLER_LEG) {
@ -250,10 +256,10 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg,
LM_DBG("leg(%d) route_set [%.*s], contact [%.*s], cseq [%.*s]" LM_DBG("leg(%d) route_set [%.*s], contact [%.*s], cseq [%.*s]"
" and bind_addr [%.*s]\n", " and bind_addr [%.*s]\n",
leg, rr_set.len, rr_set.s, contact.len, contact.s, leg, rr_set.len, ZSW(rr_set.s), contact.len, ZSW(contact.s),
cseq.len, cseq.s, cseq.len, ZSW(cseq.s),
msg->rcv.bind_address->sock_str.len, msg->rcv.bind_address->sock_str.len,
msg->rcv.bind_address->sock_str.s); ZSW(msg->rcv.bind_address->sock_str.s));
if (dlg_set_leg_info( dlg, tag, &rr_set, &contact, &cseq, leg)!=0) { if (dlg_set_leg_info( dlg, tag, &rr_set, &contact, &cseq, leg)!=0) {
LM_ERR("dlg_set_leg_info failed (leg %d)\n", leg); LM_ERR("dlg_set_leg_info failed (leg %d)\n", leg);
@ -755,8 +761,10 @@ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param)
} }
} }
if (dlg==NULL) { if (dlg==NULL) {
if((req->flags&dlg_flag_mask)!=dlg_flag_mask) if((dlg_flag_mask==0) || (req->flags&dlg_flag_mask)!=dlg_flag_mask) {
LM_DBG("flag not set for creating a new dialog\n");
return; return;
}
LM_DBG("dialog creation on config flag\n"); LM_DBG("dialog creation on config flag\n");
dlg_new_dialog(req, t, 1); dlg_new_dialog(req, t, 1);
dlg = dlg_get_ctx_dialog(); dlg = dlg_get_ctx_dialog();

@ -450,15 +450,16 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri,
int len; int len;
char *p; char *p;
len = sizeof(struct dlg_cell) + callid->len + from_uri->len + /* space for dialog structure and values with 0-ending char */
to_uri->len + req_uri->len; len = sizeof(struct dlg_cell) + callid->len + 1 + from_uri->len + 1
+ to_uri->len + 1 + req_uri->len + 1;
dlg = (struct dlg_cell*)shm_malloc( len ); dlg = (struct dlg_cell*)shm_malloc( len );
if (dlg==0) { if (dlg==0) {
LM_ERR("no more shm mem (%d)\n",len); LM_ERR("no more shm mem (%d)\n",len);
return 0; return 0;
} }
memset( dlg, 0, len); memset(dlg, 0, len);
dlg->state = DLG_STATE_UNCONFIRMED; dlg->state = DLG_STATE_UNCONFIRMED;
dlg->init_ts = (unsigned int)time(NULL); dlg->init_ts = (unsigned int)time(NULL);
@ -469,23 +470,23 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri,
dlg->callid.s = p; dlg->callid.s = p;
dlg->callid.len = callid->len; dlg->callid.len = callid->len;
memcpy( p, callid->s, callid->len); memcpy(p, callid->s, callid->len);
p += callid->len; p += callid->len + 1;
dlg->from_uri.s = p; dlg->from_uri.s = p;
dlg->from_uri.len = from_uri->len; dlg->from_uri.len = from_uri->len;
memcpy( p, from_uri->s, from_uri->len); memcpy(p, from_uri->s, from_uri->len);
p += from_uri->len; p += from_uri->len + 1;
dlg->to_uri.s = p; dlg->to_uri.s = p;
dlg->to_uri.len = to_uri->len; dlg->to_uri.len = to_uri->len;
memcpy( p, to_uri->s, to_uri->len); memcpy(p, to_uri->s, to_uri->len);
p += to_uri->len; p += to_uri->len + 1;
dlg->req_uri.s = p; dlg->req_uri.s = p;
dlg->req_uri.len = req_uri->len; dlg->req_uri.len = req_uri->len;
memcpy( p, req_uri->s, req_uri->len); memcpy(p, req_uri->s, req_uri->len);
p += req_uri->len; p += req_uri->len + 1;
if ( p!=(((char*)dlg)+len) ) { if ( p!=(((char*)dlg)+len) ) {
LM_CRIT("buffer overflow\n"); LM_CRIT("buffer overflow\n");

@ -77,8 +77,8 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){
unsigned int loc_seq; unsigned int loc_seq;
char nbuf[MAX_URI_SIZE]; char nbuf[MAX_URI_SIZE];
char dbuf[80]; char dbuf[80];
str nuri; str nuri = STR_NULL;
str duri; str duri = STR_NULL;
size_t sz; size_t sz;
char *p; char *p;
@ -87,14 +87,16 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){
LM_ERR("no contact available\n"); LM_ERR("no contact available\n");
goto error; goto error;
} }
/*restore alias parameter*/ if(cell->route_set[dir].s==NULL || cell->route_set[dir].len<=0){
nuri.s = nbuf; /*try to restore alias parameter if no route set */
nuri.len = MAX_URI_SIZE; nuri.s = nbuf;
duri.s = dbuf; nuri.len = MAX_URI_SIZE;
duri.len = 80; duri.s = dbuf;
if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) { duri.len = 80;
nuri.len = 0; if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) {
duri.len = 0; nuri.len = 0;
duri.len = 0;
}
} }
if(nuri.len>0 && duri.len>0) { if(nuri.len>0 && duri.len>0) {
sz = sizeof(dlg_t) + (nuri.len+duri.len+2)*sizeof(char); sz = sizeof(dlg_t) + (nuri.len+duri.len+2)*sizeof(char);
@ -103,7 +105,6 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){
} }
td = (dlg_t*)pkg_malloc(sz); td = (dlg_t*)pkg_malloc(sz);
if(!td){ if(!td){
LM_ERR("out of pkg memory\n"); LM_ERR("out of pkg memory\n");
return NULL; return NULL;
} }
@ -122,13 +123,12 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){
/*route set*/ /*route set*/
if( cell->route_set[dir].s && cell->route_set[dir].len){ if( cell->route_set[dir].s && cell->route_set[dir].len){
if( parse_rr_body(cell->route_set[dir].s, cell->route_set[dir].len,
if( parse_rr_body(cell->route_set[dir].s, cell->route_set[dir].len,
&td->route_set) !=0){ &td->route_set) !=0){
LM_ERR("failed to parse route set\n"); LM_ERR("failed to parse route set\n");
goto error; goto error;
} }
} }
if(nuri.len>0 && duri.len>0) { if(nuri.len>0 && duri.len>0) {
/* req uri */ /* req uri */
@ -153,7 +153,7 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){
td->id.rem_tag = cell->tag[dir]; td->id.rem_tag = cell->tag[dir];
td->id.loc_tag = (dir == DLG_CALLER_LEG) ? cell->tag[DLG_CALLEE_LEG]: td->id.loc_tag = (dir == DLG_CALLER_LEG) ? cell->tag[DLG_CALLEE_LEG]:
cell->tag[DLG_CALLER_LEG]; cell->tag[DLG_CALLER_LEG];
td->state= DLG_CONFIRMED; td->state= DLG_CONFIRMED;
td->send_sock = cell->bind_addr[dir]; td->send_sock = cell->bind_addr[dir];

@ -45,9 +45,10 @@
<section> <section>
<title>How it works</title> <title>How it works</title>
<para> <para>
To create the dialog associated with an initial request, the flag To create the dialog associated with an initial INVITE request, execute
<quote>dlg_flag</quote> (<xref linkend="dialog.p.flag"/>) must be set before the function <quote>dlg_manage()</quote> or set the flag specified by
creating the corresponding transaction. parameter <quote>dlg_flag</quote> (<xref linkend="dialog.p.flag"/>)
before creating the corresponding transaction.
</para> </para>
<para> <para>
The dialog is automatically destroyed when a <quote>BYE</quote> is The dialog is automatically destroyed when a <quote>BYE</quote> is
@ -256,6 +257,12 @@ modparam("dialog", "rr_param", "xyz")
current request (this make sense only for initial requests). current request (this make sense only for initial requests).
</para> </para>
<para> <para>
Note: it is not needed to set this parameter and its corresponding flag
for initial request in case the <quote>dlg_manage()</quote> function
is used. In other words, using <quote>dlg_manage()</quote> alone is
enough.
</para>
<para>
<emphasis> <emphasis>
Default value is <quote>none</quote>. Default value is <quote>none</quote>.
</emphasis> </emphasis>

@ -550,11 +550,14 @@ xlog("translated to var $var(y) \n");
Name: dialplan.translate Name: dialplan.translate
Parameters: 2 Parameters: 2
* Dial plan ID * Dial plan ID (number)
* Input String * Input string (string) - it can be prefixed with 's:' to avoid
auto-conversion when the command is executed with CLI apps such as
kamcmd.
Example: Example:
kamcmd dialplan.translate 1 "abcdxyz" kamcmd dialplan.translate 1 "abcdxyz"
kamcmd dialplan.translate 1 s:123456789
8. Installation 8. Installation

@ -115,7 +115,7 @@ static cmd_export_t cmds[]={
ANY_ROUTE}, ANY_ROUTE},
{"dp_match",(cmd_function)w_dp_match, 2, fixup_igp_spve, {"dp_match",(cmd_function)w_dp_match, 2, fixup_igp_spve,
fixup_free_igp_spve, ANY_ROUTE}, fixup_free_igp_spve, ANY_ROUTE},
{"dp_replace",(cmd_function)w_dp_replace, 2, dp_replace_fixup, {"dp_replace",(cmd_function)w_dp_replace, 3, dp_replace_fixup,
dp_replace_fixup_free, ANY_ROUTE}, dp_replace_fixup_free, ANY_ROUTE},
{0,0,0,0,0,0} {0,0,0,0,0,0}
}; };

@ -682,10 +682,12 @@ xlog("translated to var $var(y) \n");
<para>Parameters: <emphasis>2</emphasis></para> <para>Parameters: <emphasis>2</emphasis></para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para><emphasis>Dial plan ID</emphasis></para> <para><emphasis>Dial plan ID</emphasis> (number)</para>
</listitem> </listitem>
<listitem> <listitem>
<para><emphasis>Input String</emphasis></para> <para><emphasis>Input string</emphasis> (string) - it
can be prefixed with 's:' to avoid auto-conversion when
the command is executed with CLI apps such as &kamcmd;.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<para> <para>
@ -693,6 +695,7 @@ xlog("translated to var $var(y) \n");
</para> </para>
<programlisting format="linespecific"> <programlisting format="linespecific">
&kamcmd; dialplan.translate 1 "abcdxyz" &kamcmd; dialplan.translate 1 "abcdxyz"
&kamcmd; dialplan.translate 1 s:123456789
</programlisting> </programlisting>
</section> </section>
</section> </section>

@ -55,11 +55,11 @@ Anca-Maria Vamanu
4. Functions 4. Functions
4.1. do_routing("[groupID]") 4.1. do_routing([groupID])
4.2. use_next_gw()/next_routing() 4.2. next_routing()
4.3. goes_to_gw([type]) 4.3. use_next_gw()
4.4. is_from_gw([type]) 4.4. goes_to_gw([type])
4.5. is_from_gw( type, [flag]) 4.5. is_from_gw([ type, [flag] ])
5. RPC Commands 5. RPC Commands
@ -95,10 +95,9 @@ Anca-Maria Vamanu
1.14. Set force_dns parameter 1.14. Set force_dns parameter
1.15. Set enable_keepalive parameter 1.15. Set enable_keepalive parameter
1.16. do_routing usage 1.16. do_routing usage
1.17. use_next_gw usage 1.17. next_routing usage
1.18. goes_to_gw usage 1.18. goes_to_gw usage
1.19. is_from_gw usage 1.19. is_from_gw usage
1.20. is_from_gw usage
Chapter 1. Admin Guide Chapter 1. Admin Guide
@ -142,11 +141,11 @@ Chapter 1. Admin Guide
4. Functions 4. Functions
4.1. do_routing("[groupID]") 4.1. do_routing([groupID])
4.2. use_next_gw()/next_routing() 4.2. next_routing()
4.3. goes_to_gw([type]) 4.3. use_next_gw()
4.4. is_from_gw([type]) 4.4. goes_to_gw([type])
4.5. is_from_gw( type, [flag]) 4.5. is_from_gw([ type, [flag] ])
5. RPC Commands 5. RPC Commands
@ -295,7 +294,8 @@ Chapter 1. Admin Guide
Each user must be member of only one routing group. It must be Each user must be member of only one routing group. It must be
specified in user's profile. specified in user's profile.
b. prefix column b. prefix column
Destination URI must start with prefix value to match the rule. Destination URI must start with prefix value to match the rule. The
prefix value can contain only digits (0..9), '+', '*' or '#'.
c. time rec column c. time rec column
A date-time expression that defines the time recurrence to match A date-time expression that defines the time recurrence to match
for current rule. Time recurrences are based closely on the for current rule. Time recurrences are based closely on the
@ -709,13 +709,13 @@ modparam("drouting", "enable_keepalive", 1)
4. Functions 4. Functions
4.1. do_routing("[groupID]") 4.1. do_routing([groupID])
4.2. use_next_gw()/next_routing() 4.2. next_routing()
4.3. goes_to_gw([type]) 4.3. use_next_gw()
4.4. is_from_gw([type]) 4.4. goes_to_gw([type])
4.5. is_from_gw( type, [flag]) 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 Function to trigger routing of the message according to the rules in
the database table and the configured parameters. the database table and the configured parameters.
@ -723,9 +723,10 @@ modparam("drouting", "enable_keepalive", 1)
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
The module can take one optional parameter: the routing group the The module can take one optional parameter: the routing group the
caller belongs to - this may be a static numerical value or an AVP caller belongs to - this may be a static int value or a variable
specification. If none specified, the function will automatically try holding an int. If none specified, the function will automatically try
to query the dr_group table to get this information. to query the dr_group table to get the group id associated with the
user in From URI.
Example 1.16. do_routing usage Example 1.16. do_routing usage
... ...
@ -735,7 +736,7 @@ do_routing("0");
... ...
do_routing("$avp(i:10)"); do_routing("$avp(i:10)");
4.2. use_next_gw()/next_routing() 4.2. next_routing()
The function takes the next available destination (set by do_routing, The function takes the next available destination (set by do_routing,
as alternative destinations) and push it into RURI. Note that the as alternative destinations) and push it into RURI. Note that the
@ -750,26 +751,32 @@ do_routing("$avp(i:10)");
is no other alternative destinations are found or in case of internal is no other alternative destinations are found or in case of internal
processing error. processing error.
Example 1.17. use_next_gw usage Example 1.17. next_routing usage
... ...
if (use_next_gw()) { if (next_routing()) {
t_relay(); t_relay();
exit; exit;
} }
... ...
4.3. goes_to_gw([type]) 4.3. use_next_gw()
Same as next_routing().
4.4. goes_to_gw([type])
Function returns true if the destination of the current request Function returns true if the destination of the current request
(destination URI or Request URI) points (as IP) to one of the gateways. (destination URI or Request URI) points (as IP) to one of the gateways.
There no DNS lookups done if the domain part of the URI is not an IP. There is no DNS lookups done if the domain part of the URI is not an
IP.
This function does not change anything in the message. This function does not change anything in the message.
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and
ONREPLY_ROUTE.
The function can take one optional parameter: The function can take two optional parameters:
* type (optional) - GW/destination type to be checked * type - GW/destination type to be checked
Example 1.18. goes_to_gw usage Example 1.18. goes_to_gw usage
... ...
@ -779,38 +786,23 @@ if (goes_to_gw("1")) {
} }
... ...
4.4. is_from_gw([type]) 4.5. is_from_gw([ type, [flag] ])
The function checks if the sender of the message is a gateway from a The function checks if the sender of the message is a gateway from a
certain group. group in drouting rules.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and
ONREPLY_ROUTE ONREPLY_ROUTE.
The function can take one optional parameter:
* type (optional) - GW/destination type to be checked
* flags - if message is a request and the GW has a STRIP defined,
then apply it if GW is source.
Example 1.19. is_from_gw usage
...
if (is_from_gw("1") {
}
...
4.5. is_from_gw( type, [flag])
The function checks if the sender of the message is a gateway from a
certain group.
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
The function can take two parameters: The function can take two parameters:
* type (mandatory) - GW/destination type to be checked * type (mandatory) - GW/destination type to be checked
* flags (optional) - if message is a request and the GW has a STRIP * flags (optional) - if message is a request and the GW has a STRIP
defined, then apply it if GW is source. defined, then apply it if GW is source.
Example 1.20. is_from_gw usage Example 1.19. is_from_gw usage
...
if (is_from_gw("1") {
}
... ...
if (is_from_gw("3","1") { if (is_from_gw("3","1") {
} }

@ -289,7 +289,7 @@ int evapi_dispatch_notify(evapi_msg_t *emsg)
n = 0; n = 0;
for(i=0; i<EVAPI_MAX_CLIENTS; i++) { for(i=0; i<EVAPI_MAX_CLIENTS; i++) {
if(_evapi_clients[i].connected==1 && _evapi_clients[i].sock>=0) { if(_evapi_clients[i].connected==1 && _evapi_clients[i].sock>=0) {
if(emsg->tag.s==NULL || (emsg->tag.len = _evapi_clients[i].stag.len if(emsg->tag.s==NULL || (emsg->tag.len == _evapi_clients[i].stag.len
&& strncmp(_evapi_clients[i].stag.s, && strncmp(_evapi_clients[i].stag.s,
emsg->tag.s, emsg->tag.len)==0)) { emsg->tag.s, emsg->tag.len)==0)) {
wlen = write(_evapi_clients[i].sock, emsg->data.s, wlen = write(_evapi_clients[i].sock, emsg->data.s,

@ -53,6 +53,7 @@ Ovidiu Sas
3.12. enable_dmq (integer) 3.12. enable_dmq (integer)
3.13. timer_procs (integer) 3.13. timer_procs (integer)
3.14. event_callback (str) 3.14. event_callback (str)
3.15. event_callback_mode (int)
4. Functions 4. Functions
@ -104,17 +105,18 @@ Ovidiu Sas
1.15. Set enable_dmq parameter 1.15. Set enable_dmq parameter
1.16. Set timer_procs parameter 1.16. Set timer_procs parameter
1.17. Set event_callback parameter 1.17. Set event_callback parameter
1.18. sht_print usage 1.18. Set event_callback_mode parameter
1.19. sht_rm_name_re usage 1.19. sht_print usage
1.20. sht_rm_value_re usage 1.20. sht_rm_name_re usage
1.21. sht_rm_name usage 1.21. sht_rm_value_re usage
1.22. sht_rm_value usage 1.22. sht_rm_name usage
1.23. sht_reset usage 1.23. sht_rm_value usage
1.24. sht_lock usage 1.24. sht_reset usage
1.25. sht_unlock usage 1.25. sht_lock usage
1.26. sht_iterator_start usage 1.26. sht_unlock usage
1.27. sht_iterator_end usage 1.27. sht_iterator_start usage
1.28. sht_iterator_next usage 1.28. sht_iterator_end usage
1.29. sht_iterator_next usage
Chapter 1. Admin Guide Chapter 1. Admin Guide
@ -143,6 +145,7 @@ Chapter 1. Admin Guide
3.12. enable_dmq (integer) 3.12. enable_dmq (integer)
3.13. timer_procs (integer) 3.13. timer_procs (integer)
3.14. event_callback (str) 3.14. event_callback (str)
3.15. event_callback_mode (int)
4. Functions 4. Functions
@ -412,6 +415,7 @@ $ kamcmd htable.dump htable
3.12. enable_dmq (integer) 3.12. enable_dmq (integer)
3.13. timer_procs (integer) 3.13. timer_procs (integer)
3.14. event_callback (str) 3.14. event_callback (str)
3.15. event_callback_mode (int)
3.1. htable (str) 3.1. htable (str)
@ -643,6 +647,21 @@ function ksr_htable_event(evname)
end end
... ...
3.15. event_callback_mode (int)
Control when event_route[htable:init] is executed: 0 - after all
modules were initialized; 1 - in first worker process.
Set it to 1 if used in a KEMI script or when needing to use database
(e.g., via sqlops) inside event_route[htable:init].
Default value is 0.
Example 1.18. Set event_callback_mode parameter
...
modparam("htable", "event_callback_mode", 1)
...
4. Functions 4. Functions
4.1. sht_print() 4.1. sht_print()
@ -665,7 +684,7 @@ end
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
ONREPLY_ROUTE, BRANCH_ROUTE. ONREPLY_ROUTE, BRANCH_ROUTE.
Example 1.18. sht_print usage Example 1.19. sht_print usage
... ...
sht_print(); sht_print();
... ...
@ -678,7 +697,7 @@ sht_print();
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
ONREPLY_ROUTE, BRANCH_ROUTE. ONREPLY_ROUTE, BRANCH_ROUTE.
Example 1.19. sht_rm_name_re usage Example 1.20. sht_rm_name_re usage
... ...
sht_rm_name_re("ha=>.*"); sht_rm_name_re("ha=>.*");
... ...
@ -691,7 +710,7 @@ sht_rm_name_re("ha=>.*");
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
ONREPLY_ROUTE, BRANCH_ROUTE. ONREPLY_ROUTE, BRANCH_ROUTE.
Example 1.20. sht_rm_value_re usage Example 1.21. sht_rm_value_re usage
... ...
sht_rm_value_re("ha=>.*"); sht_rm_value_re("ha=>.*");
... ...
@ -709,7 +728,7 @@ sht_rm_value_re("ha=>.*");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.21. sht_rm_name usage Example 1.22. sht_rm_name usage
... ...
sht_rm_name("ha", "re", ".*"); sht_rm_name("ha", "re", ".*");
... ...
@ -727,7 +746,7 @@ sht_rm_name("ha", "re", ".*");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.22. sht_rm_value usage Example 1.23. sht_rm_value usage
... ...
sht_rm_value("ha", "re", ".*"); sht_rm_value("ha", "re", ".*");
... ...
@ -739,7 +758,7 @@ sht_rm_value("ha", "re", ".*");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.23. sht_reset usage Example 1.24. sht_reset usage
... ...
sht_reset("ha$var(x)"); sht_reset("ha$var(x)");
... ...
@ -752,7 +771,7 @@ sht_reset("ha$var(x)");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.24. sht_lock usage Example 1.25. sht_lock usage
... ...
sht_lock("ha=>test"); sht_lock("ha=>test");
... ...
@ -765,7 +784,7 @@ sht_lock("ha=>test");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.25. sht_unlock usage Example 1.26. sht_unlock usage
... ...
sht_lock("ha=>test"); sht_lock("ha=>test");
$sht(ha=>test) = $sht(ha=>test) + 10; $sht(ha=>test) = $sht(ha=>test) + 10;
@ -787,7 +806,7 @@ sht_unlock("ha=>test");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.26. sht_iterator_start usage Example 1.27. sht_iterator_start usage
... ...
sht_iterator_start("i1", "h1"); sht_iterator_start("i1", "h1");
... ...
@ -802,7 +821,7 @@ sht_iterator_start("i1", "h1");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.27. sht_iterator_end usage Example 1.28. sht_iterator_end usage
... ...
sht_iterator_end("i1"); sht_iterator_end("i1");
... ...
@ -824,7 +843,7 @@ sht_iterator_end("i1");
This function can be used from ANY_ROUTE. This function can be used from ANY_ROUTE.
Example 1.28. sht_iterator_next usage Example 1.29. sht_iterator_next usage
... ...
sht_iterator_start("i1", "h1"); sht_iterator_start("i1", "h1");
while(sht_iterator_next("i1")) { while(sht_iterator_next("i1")) {

@ -358,10 +358,10 @@ $http_req(suspend) = 0;
http_async_query("https://example.com/test.php", "HTTP_REPLY"); http_async_query("https://example.com/test.php", "HTTP_REPLY");
xlog("L_INFO", "Query id: $http_query_id"); xlog("L_INFO", "Query id: $http_req_id");
... ...
route[HTTP_REPLY] { route[HTTP_REPLY] {
xlog("L_INFO", "received reply for query $http_query_id\n"); xlog("L_INFO", "received reply for query $http_req_id\n");
} }
... ...

@ -66,7 +66,7 @@ Carlos Ruiz Diaz
5. Functions 5. Functions
5.1. Ro_CCR(route_name, direction, reservation_units, 5.1. Ro_CCR(route_name, direction, reservation_units,
domain, incoming_trunk_id, outgoing_trunk_id incoming_trunk_id, outgoing_trunk_id)
5.2. Ro_set_session_id_avp() 5.2. Ro_set_session_id_avp()
@ -163,8 +163,8 @@ Chapter 1. Admin Guide
5. Functions 5. Functions
5.1. Ro_CCR(route_name, direction, reservation_units, domain, 5.1. Ro_CCR(route_name, direction, reservation_units,
incoming_trunk_id, outgoing_trunk_id incoming_trunk_id, outgoing_trunk_id)
5.2. Ro_set_session_id_avp() 5.2. Ro_set_session_id_avp()
@ -689,13 +689,13 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
5. Functions 5. Functions
5.1. Ro_CCR(route_name, direction, reservation_units, domain, 5.1. Ro_CCR(route_name, direction, reservation_units,
incoming_trunk_id, outgoing_trunk_id incoming_trunk_id, outgoing_trunk_id)
5.2. Ro_set_session_id_avp() 5.2. Ro_set_session_id_avp()
5.1. Ro_CCR(route_name, direction, reservation_units, domain, 5.1. Ro_CCR(route_name, direction, reservation_units, incoming_trunk_id,
incoming_trunk_id, outgoing_trunk_id outgoing_trunk_id)
Perform a CCR on Diameter Ro interface for Charging Perform a CCR on Diameter Ro interface for Charging
@ -704,7 +704,6 @@ incoming_trunk_id, outgoing_trunk_id
* direction "orig"inating or "term"inating * direction "orig"inating or "term"inating
* reservation_units how many units (at the moment seconds) should be * reservation_units how many units (at the moment seconds) should be
reservated at the moment. reservated at the moment.
* domain Logical domain within registrar.
* incoming_trunk_id Identifies the trunk group from which this * incoming_trunk_id Identifies the trunk group from which this
originates. originates.
* outgoing_trunk_id Identifies the trunk group where this will be * outgoing_trunk_id Identifies the trunk group where this will be

@ -762,7 +762,7 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
<section> <section>
<title><function moreinfo="none">Ro_CCR(route_name, direction, <title><function moreinfo="none">Ro_CCR(route_name, direction,
reservation_units, domain, incoming_trunk_id, outgoing_trunk_id</function> reservation_units, incoming_trunk_id, outgoing_trunk_id)</function>
</title> </title>
<para>Perform a CCR on Diameter Ro interface for Charging</para> <para>Perform a CCR on Diameter Ro interface for Charging</para>
@ -784,11 +784,6 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
<para><emphasis>reservation_units</emphasis> how many units (at the <para><emphasis>reservation_units</emphasis> how many units (at the
moment seconds) should be reservated at the moment.</para> moment seconds) should be reservated at the moment.</para>
</listitem> </listitem>
<listitem>
<para><emphasis>domain</emphasis> Logical domain within
registrar.</para>
</listitem>
<listitem> <listitem>
<para><emphasis>incoming_trunk_id</emphasis> Identifies the trunk group <para><emphasis>incoming_trunk_id</emphasis> Identifies the trunk group

@ -369,6 +369,7 @@ static inline isc_match* isc_new_match(ims_filter_criteria *fc, int index) {
if (!r->server_name.s) { if (!r->server_name.s) {
LM_ERR("isc_new_match(): error allocating %d bytes\n", LM_ERR("isc_new_match(): error allocating %d bytes\n",
fc->application_server.server_name.len); fc->application_server.server_name.len);
pkg_free(r);
return 0; return 0;
} }
r->server_name.len = fc->application_server.server_name.len; r->server_name.len = fc->application_server.server_name.len;
@ -381,6 +382,10 @@ static inline isc_match* isc_new_match(ims_filter_criteria *fc, int index) {
if (!r->service_info.s) { if (!r->service_info.s) {
LM_ERR("isc_new_match(): error allocating %d bytes\n", LM_ERR("isc_new_match(): error allocating %d bytes\n",
fc->application_server.service_info.len); fc->application_server.service_info.len);
if (r->server_name.s) {
pkg_free(r->server_name.s);
}
pkg_free(r);
return 0; return 0;
} }
r->service_info.len = fc->application_server.service_info.len; r->service_info.len = fc->application_server.service_info.len;

@ -77,6 +77,12 @@ Chapter 1. Admin Guide
Copy field 'field_name' from json object 'json_string' and store it in Copy field 'field_name' from json object 'json_string' and store it in
pvar 'destination'. pvar 'destination'.
Note that the result is the string representation of that JSON filed.
For example, if you want to retrieve a field that has a string value,
then the result is the value enclosed in quotes. If the field value is
a structure, then the result is the string-formatted representation of
that structure.
Example 1.1. json_get_field usage Example 1.1. json_get_field usage
... ...
json_get_field("{'foo':'bar'}", "foo", "$var(foo)"); json_get_field("{'foo':'bar'}", "foo", "$var(foo)");

@ -397,6 +397,7 @@ event_route[xhttp:request] {
Example 1.15. jsonrpc_exec usage Example 1.15. jsonrpc_exec usage
... ...
jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}');
xlog("jsonrpc response code: $jsonrpl(code) - the body is: $jsonrpl(body)\n");
... ...
6. JSONRPC Commands 6. JSONRPC Commands

@ -1802,10 +1802,10 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload)
str* event_key = NULL; str* event_key = NULL;
str* event_subkey = NULL; str* event_subkey = NULL;
json_obj_ptr json_obj = NULL; json_obj_ptr json_obj = NULL;
struct json_object* tmpObj = NULL; struct json_object* tmpObj = NULL;
kz_amqp_bind_ptr bind = NULL;
kz_amqp_binding_ptr binding = NULL;
if (fixup_get_svalue(msg, (gparam_p)payload, &payload_s) != 0) { if (fixup_get_svalue(msg, (gparam_p)payload, &payload_s) != 0) {
LM_ERR("cannot get payload value\n"); LM_ERR("cannot get payload value\n");
@ -1880,7 +1880,7 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload)
} }
queue = kz_amqp_queue_from_json(&queue_s, tmpObj); queue = kz_amqp_queue_from_json(&queue_s, tmpObj);
kz_amqp_bind_ptr bind = kz_amqp_bind_alloc(exchange, exchange_binding, queue, routing, event_key, event_subkey); bind = kz_amqp_bind_alloc(exchange, exchange_binding, queue, routing, event_key, event_subkey);
if(bind == NULL) { if(bind == NULL) {
LM_ERR("Could not allocate bind struct\n"); LM_ERR("Could not allocate bind struct\n");
goto error; goto error;
@ -1893,7 +1893,7 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload)
bind->consistent_worker_key = consistent_worker_key; bind->consistent_worker_key = consistent_worker_key;
kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); binding = shm_malloc(sizeof(kz_amqp_binding));
if(binding == NULL) { if(binding == NULL) {
LM_ERR("Could not allocate binding struct\n"); LM_ERR("Could not allocate binding struct\n");
goto error; goto error;
@ -1935,7 +1935,8 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange
kz_amqp_exchange_ptr exchange_ptr = NULL; kz_amqp_exchange_ptr exchange_ptr = NULL;
kz_amqp_queue_ptr queue_ptr = NULL; kz_amqp_queue_ptr queue_ptr = NULL;
kz_amqp_routings_ptr routing_ptr = NULL; kz_amqp_routings_ptr routing_ptr = NULL;
kz_amqp_bind_ptr bind = NULL;
kz_amqp_binding_ptr binding = NULL;
if (fixup_get_svalue(msg, (gparam_p)exchange, &exchange_s) != 0) { if (fixup_get_svalue(msg, (gparam_p)exchange, &exchange_s) != 0) {
LM_ERR("cannot get exchange string value\n"); LM_ERR("cannot get exchange string value\n");
@ -1961,7 +1962,7 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange
queue_ptr = kz_amqp_queue_new(&queue_s); queue_ptr = kz_amqp_queue_new(&queue_s);
routing_ptr = kz_amqp_routing_new(routing_key_s.s); routing_ptr = kz_amqp_routing_new(routing_key_s.s);
kz_amqp_bind_ptr bind = kz_amqp_bind_alloc(exchange_ptr, NULL, queue_ptr, routing_ptr, NULL, NULL); bind = kz_amqp_bind_alloc(exchange_ptr, NULL, queue_ptr, routing_ptr, NULL, NULL);
if(bind == NULL) { if(bind == NULL) {
LM_ERR("Could not allocate bind struct\n"); LM_ERR("Could not allocate bind struct\n");
goto error; goto error;
@ -1969,7 +1970,7 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange
bind->no_ack = 1; bind->no_ack = 1;
kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); binding = shm_malloc(sizeof(kz_amqp_binding));
if(binding == NULL) { if(binding == NULL) {
LM_ERR("Could not allocate binding struct\n"); LM_ERR("Could not allocate binding struct\n");
goto error; goto error;
@ -2870,6 +2871,7 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body)
char* server_id_str = NULL; char* server_id_str = NULL;
kz_amqp_cmd_ptr cmd = NULL; kz_amqp_cmd_ptr cmd = NULL;
json_object* JObj = NULL; json_object* JObj = NULL;
json_obj_ptr json_obj = NULL;
char* payload = kz_local_amqp_bytes_dup(body); char* payload = kz_local_amqp_bytes_dup(body);
if(payload == NULL) { if(payload == NULL) {
@ -2877,7 +2879,7 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body)
goto error; goto error;
} }
json_obj_ptr json_obj = kz_json_parse(payload ); json_obj = kz_json_parse(payload );
if (json_obj == NULL) { if (json_obj == NULL) {
LM_ERR("error parsing json payload\n"); LM_ERR("error parsing json payload\n");
goto error; goto error;

@ -49,7 +49,7 @@ enum json_type kz_json_get_type(struct json_object *jso)
typedef str* json_key; typedef str* json_key;
typedef json_key* json_keys; typedef json_key* json_keys;
json_keys str_split(char* a_str, const char a_delim, int* c) json_keys kz_str_split(char* a_str, const char a_delim, int* c)
{ {
json_keys result = 0; json_keys result = 0;
int count = 0; int count = 0;
@ -145,7 +145,7 @@ struct json_object * kz_json_get_field_object(str* json, str* field)
dup = pkg_malloc(field->len+1); dup = pkg_malloc(field->len+1);
memcpy(dup, field->s, field->len); memcpy(dup, field->s, field->len);
dup[field->len] = '\0'; dup[field->len] = '\0';
keys = str_split(dup, '.', &parts); keys = kz_str_split(dup, '.', &parts);
pkg_free(dup); pkg_free(dup);
if (keys) if (keys)

@ -376,7 +376,9 @@ pv_printf("$avp(x)", "From: $fU - To: $tU");
3.11. is_myself(uri) 3.11. is_myself(uri)
Check if the parameter matches the 'myself' condition (i.e., is a local Check if the parameter matches the 'myself' condition (i.e., is a local
IP or domain). IP or domain). Note that if the port is missing in the URI, then no
port matching is done (in other words, port matching is skipped -- it
does not use default SIP ports 5060 or 5061 for matching).
Meaning of the parameters is as follows: Meaning of the parameters is as follows:
* uri - Valid SIP URI or IP address to check against the list of * uri - Valid SIP URI or IP address to check against the list of

@ -200,7 +200,7 @@ xlog("L_INFO", "Size of queue is: $var(q_size)\n");
5. Exported Variables 5. Exported Variables
* $mqv(mqueue) - the most recent item key fetched from the specified * $mqk(mqueue) - the most recent item key fetched from the specified
mqueue mqueue
* $mqv(mqueue) - the most recent item value fetched from the * $mqv(mqueue) - the most recent item value fetched from the
specified mqueue specified mqueue

@ -775,12 +775,6 @@ n")
modparam("msilo","content_type_hdr","Content-Type: text/plain\r\n") modparam("msilo","content_type_hdr","Content-Type: text/plain\r\n")
modparam("msilo","offline_message","*** User $rU is offline!") modparam("msilo","offline_message","*** User $rU is offline!")
# -- tm params --
modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "wt_timer", 10 )
route{ route{
if ( !mf_process_maxfwd_header("10") ) if ( !mf_process_maxfwd_header("10") )

@ -613,7 +613,8 @@ if(is_rfc1918("$rd")) {
Adds an “;alias=ip~port~transport” parameter to the contact URI Adds an “;alias=ip~port~transport” parameter to the contact URI
containing either received ip, port, and transport protocol or those containing either received ip, port, and transport protocol or those
given as parameters. If called without parameters, “;alias” parameter given as parameters. If called without parameters, “;alias” parameter
is only added if received ip and port differ from those in contact URI. is only added if received ip, port, or transport protocol differs from
that in contact URI.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
BRANCH_ROUTE, and LOCAL_ROUTE. BRANCH_ROUTE, and LOCAL_ROUTE.

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

Loading…
Cancel
Save