New upstream version 5.8.5

mr13.2.1 upstream/5.8.5
Victor Seva 2 years ago
parent 03d9b6c654
commit 4de99b7fd5

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@ kamailio \- a very fast and configurable SIP server
.SH SYNOPSIS
.B kamailio
[
.B \-hfcmMdVIhEeblLnvKrRDTNWwtugPGSQOaAxXY
.B \-hfcmMdVIhEebBlLnvKrRDTNWwtugPGSQOaAxXY
] [
.BI \-a " auto\-aliases\-mode"
] [
@ -16,6 +16,8 @@ kamailio \- a very fast and configurable SIP server
] [
.BI \-b " max_rcv_buf_size"
] [
.BI \-B " max_snd_buf_size"
] [
.BI \-f " config\-file"
] [
.BI \-g " gid"
@ -68,7 +70,10 @@ default is yes.
Add config pre-processor define (e.g., -A WITH_AUTH, -A N=1, -A X='"Y"')
.TP
.BI \-b " max_rcv_buf_size"
Maximum receive buffer size which will not be exceeded by the auto-probing procedure even if the OS allows.
Maximum OS UDP receive buffer size which will not be exceeded by auto-probing-and-increase procedure even if OS allows.
.TP
.BI \-B " max_snd_buf_size"
Maximum OS UDP send buffer size which will not be exceeded by auto-probing-and-increase procedure even if OS allows.
.TP
.BI \-c
Checks the config file and displays the aliases and listen interface list.

@ -561,7 +561,7 @@ request_route {
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE")) {
if (is_method("INVITE|SUBSCRIBE|REFER")) {
record_route();
}
@ -678,8 +678,8 @@ route[WITHINDLG] {
} else if ( is_method("ACK") ) {
# ACK is forwarded statelessly
route(NATMANAGE);
} else if ( is_method("NOTIFY") ) {
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
} else if ( is_method("NOTIFY|REFER") ) {
# Add Record-Route for in-dialog NOTIFY and REFER (RFC6665, RFC3515)
record_route();
}
route(RELAY);

@ -12,6 +12,6 @@ The following tables (or files) are required:
* ims_charging_create.sql
* ims_dialog-create.sql
* ms_usrloc_scscf-create.sql
* ims_usrloc_scscf-create.sql
* presence-create.sql
* standard-create.sql

@ -4,7 +4,7 @@
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=kamailio
pkgver=5.8.4
pkgver=5.8.5
pkgrel=0
# If building from a git snapshot, specify the gitcommit

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,3 +1,9 @@
kamailio (5.8.5) unstable; urgency=medium
* version set 5.8.5
-- Victor Seva <vseva@debian.org> Thu, 23 Jan 2025 08:31:22 +0100
kamailio (5.8.4) unstable; urgency=medium
* version set 5.8.4

@ -0,0 +1,26 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/default/kamailio-%i
EnvironmentFile=-/etc/default/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -P /run/kamailio-%i/kamailio.pid -Y /run/kamailio-%i -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -1,5 +1,6 @@
[Unit]
Description=Kamailio - the Open Source SIP Server
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target

@ -1,5 +1,5 @@
%define name kamailio
%define ver 5.8.4
%define ver 5.8.5
%define rel dev1.0%{dist}
%if 0%{?fedora}
@ -237,6 +237,7 @@ Conflicts: kamailio-dialplan < %ver, kamailio-dnssec < %ver
Conflicts: kamailio-geoip < %ver, kamailio-gzcompress < %ver
Conflicts: kamailio-http_client < %ver
Conflicts: kamailio-ims < %ver, kamailio-java < %ver, kamailio-json < %ver
Conflicts: kamailio-jwt < %ver
Conflicts: kamailio-kazoo < %ver
Conflicts: kamailio-lcr < %ver, kamailio-ldap < %ver, kamailio-lost < %ver, kamailio-lua < %ver
Conflicts: kamailio-nats < %ver
@ -590,6 +591,17 @@ JSON string handling and RPC modules for Kamailio.
%endif
%package jwt
Summary: JWT (JSON Web Token) functions module for Kamailio
Group: %{PKGGROUP}
Requires: libjwt, kamailio = %ver
BuildRequires: libjwt-devel
%description jwt
This module provides JWT (JSON Web Token) functions to be used in Kamailio configuration file.
It relies on libjwt (at least v1.12.0) library (https://github.com/benmcollins/libjwt).
%if %{with kazoo}
%package kazoo
Summary: Kazoo middle layer connector support for Kamailio
@ -1188,6 +1200,7 @@ sed -i -e 's/python3/python2/' utils/kamctl/dbtextdb/dbtextdb.py
# on latest dist need to add --atexit=no for Kamailio options. More details GH #2616
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
sed -i -e 's|/usr/sbin/kamailio|/usr/sbin/kamailio --atexit=no|' pkg/kamailio/obs/kamailio.service
sed -i -e 's|/usr/sbin/kamailio|/usr/sbin/kamailio --atexit=no|' pkg/kamailio/obs/kamailio@.service
%endif
@ -1245,6 +1258,7 @@ make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \
kjson \
%endif
kjsonrpcs \
kjwt \
%if %{with kazoo}
kkazoo \
%endif
@ -1358,6 +1372,7 @@ make install-modules-all skip_modules="app_mono db_cassandra db_oracle \
kjson \
%endif
kjsonrpcs \
kjwt \
%if %{with kazoo}
kkazoo \
%endif
@ -1435,6 +1450,7 @@ install -m755 pkg/kamailio/%{dist_name}/%{dist_version}/kamailio.init \
# systemd
install -d %{buildroot}%{_unitdir}
install -Dpm 0644 pkg/kamailio/%{dist_name}/%{dist_version}/kamailio.service %{buildroot}%{_unitdir}/kamailio.service
install -Dpm 0644 pkg/kamailio/%{dist_name}/%{dist_version}/kamailio@.service %{buildroot}%{_unitdir}/kamailio@.service
install -Dpm 0644 pkg/kamailio/%{dist_name}/%{dist_version}/sipcapture.service %{buildroot}%{_unitdir}/sipcapture.service
install -Dpm 0644 pkg/kamailio/%{dist_name}/%{dist_version}/kamailio.tmpfiles %{buildroot}%{_tmpfilesdir}/kamailio.conf
install -Dpm 0644 pkg/kamailio/%{dist_name}/%{dist_version}/sipcapture.tmpfiles %{buildroot}%{_tmpfilesdir}/sipcapture.conf
@ -1666,6 +1682,7 @@ fi
%dir %attr(-,kamailio,kamailio) %{_var}/run/kamailio
%else
%{_unitdir}/kamailio.service
%{_unitdir}/kamailio@.service
%{_tmpfilesdir}/kamailio.conf
%endif
@ -2020,6 +2037,12 @@ fi
%endif
%files jwt
%defattr(-,root,root)
%doc %{_docdir}/kamailio/modules/README.jwt
%{_libdir}/kamailio/modules/jwt.so
%if %{with kazoo}
%files kazoo
%defattr(-,root,root)

@ -0,0 +1,28 @@
[Unit]
Description=Kamailio - the Open Source SIP Server (instance %i)
Documentation=man:kamailio(8)
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=kamailio
Group=kamailio
Environment='CFGFILE=/etc/kamailio/kamailio-%i.cfg'
Environment='SHM_MEMORY=64'
Environment='PKG_MEMORY=8'
EnvironmentFile=-/etc/sysconfig/kamailio-%i
EnvironmentFile=-/etc/sysconfig/kamailio-%i.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio-%i/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -DD -P /run/kamailio-%i/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -Y /run/kamailio-%i
Restart=on-failure
# necessary for chown of control files e.g. for jsonrpcs and ctl modules
AmbientCapabilities=CAP_CHOWN
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio-%i
RuntimeDirectoryMode=0770
[Install]
WantedBy=multi-user.target

@ -106,7 +106,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
# version number
VERSION = 5
PATCHLEVEL = 8
SUBLEVEL = 4
SUBLEVEL = 5
EXTRAVERSION =
# memory manager switcher
@ -492,7 +492,7 @@ endif
ifeq ($(OS), freebsd)
doc_dir = share/doc/$(MAIN_NAME)/
man_dir = man/
man_dir = share/man/
data_dir = share/$(MAIN_NAME)/
LOCALBASE ?= /usr/local
endif

@ -2,6 +2,6 @@
* DO NOT EDIT IT
*/
#define REPO_VER "f1d83d"
#define REPO_HASH "f1d83d"
#define REPO_VER "b035a8"
#define REPO_HASH "b035a8"
#define REPO_STATE ""

@ -687,8 +687,8 @@ char *print_dset(struct sip_msg *msg, int *len, int options)
}
if(cnt == 0) {
LM_WARN("no r-uri or branches\n");
goto error;
LM_INFO("no new r-uri or branches\n");
goto notfound;
}
if(p + CRLF_LEN + 1 > end) {
@ -701,7 +701,7 @@ char *print_dset(struct sip_msg *msg, int *len, int options)
memfail:
LM_ERR("redirection buffer length exceed\n");
error:
notfound:
*len = 0;
set_branch_iterator(crt_branch);
return 0;

@ -109,6 +109,9 @@ extern int ksr_tcp_script_mode;
#ifdef USE_TLS
extern int tls_disable;
extern unsigned short tls_port_no;
#define KSR_TLS_THREADS_MNONE 0 /* no set of set thread-local variables */
#define KSR_TLS_THREADS_MTEMP 1 /* set thread-local variables in temp thread */
#define KSR_TLS_THREADS_MFORK 2 /* set thread-local variables in at-fork */
extern int ksr_tls_threads_mode;
#endif
#ifdef USE_SCTP

@ -298,6 +298,52 @@ char *ip_addr2strz(struct ip_addr *ip)
return buff;
}
#define IP_ADDR_BUF_NR 8
static char _ksr_addr2x_buff[IP_ADDR_BUF_NR][IP_ADDR_MAX_STR_SIZE];
static int _ksr_addr2x_idx = 0;
/* fast ip_addr -> string converter;
* it uses an internal buffer
*/
char *ip_addr2xa(struct ip_addr *ip)
{
int len;
char *buff;
buff = _ksr_addr2x_buff[_ksr_addr2x_idx];
_ksr_addr2x_idx = (_ksr_addr2x_idx + 1) % IP_ADDR_BUF_NR;
len = ip_addr2sbuf(ip, buff, sizeof(buff) - 1);
buff[len] = 0;
return buff;
}
/* full address in text representation, including [] for ipv6 */
char *ip_addr2xstrz(struct ip_addr *ip)
{
char *p;
int len;
char *buff;
buff = _ksr_addr2x_buff[_ksr_addr2x_idx];
_ksr_addr2x_idx = (_ksr_addr2x_idx + 1) % IP_ADDR_BUF_NR;
p = buff;
if(ip->af == AF_INET6) {
*p++ = '[';
}
len = ip_addr2sbuf(ip, p, sizeof(buff) - 3);
p += len;
if(ip->af == AF_INET6) {
*p++ = ']';
}
*p = 0;
return buff;
}
/* returns an asciiz string containing the ip and the port
* (<ip_addr>:port or [<ipv6_addr>]:port)

@ -603,14 +603,18 @@ int ip_addr2sbufz(struct ip_addr *ip, char *buff, int len);
#define IP_ADDR_MAX_STR_SIZE (IP6_MAX_STR_SIZE + 1) /* ip62ascii + \0*/
#define IP_ADDR_MAX_STRZ_SIZE (IP6_MAX_STR_SIZE + 3) /* ip62ascii + [ + ] + \0*/
/* fast ip_addr -> string converter;
* it uses an internal buffer
*/
/* ip addr to string converter; it uses an internal static buffer */
char *ip_addr2a(struct ip_addr *ip);
/* ip addr to string converter; it uses a pool of internal static buffers */
char *ip_addr2xa(struct ip_addr *ip);
/* full address in text representation, including [] for ipv6 */
/* full address in text representation, including [] for ipv6
* - it uses an internal static buffer */
char *ip_addr2strz(struct ip_addr *ip);
/* full address in text representation, including [] for ipv6
* - it uses a pool of internal static buffers */
char *ip_addr2xstrz(struct ip_addr *ip);
#define SU2A_MAX_STR_SIZE \

@ -151,7 +151,7 @@ int set_mod_param_regex(char *regex, char *name, modparam_t type, void *val)
pkg_free(reg);
return -1;
}
strncpy(*((char **)ptr), (char *)val2, len_param);
memcpy(*((char **)ptr), (char *)val2, len_param);
(*((char **)ptr))[len_param] = '\0';
break;

@ -1029,7 +1029,8 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
offset++; \
} \
} else { \
LM_CRIT("null bind_address\n"); \
LM_CRIT("null bind_address (SUBST_RCV_IP/%p/%p)\n", \
msg->rcv.bind_address, recv_address_str); \
}; \
break; \
case SUBST_RCV_PORT: \
@ -1038,7 +1039,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
recv_port_str->len); \
offset += recv_port_str->len; \
} else { \
LM_CRIT("null bind_address\n"); \
LM_CRIT("null recv port str (SUBST_RCV_PORT)\n"); \
}; \
break; \
case SUBST_RCV_ALL: \
@ -1130,7 +1131,8 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
} \
RCVCOMP_PARAM_ADD \
} else { \
LM_CRIT("null bind_address\n"); \
LM_CRIT("null bind_address (SUBST_RCV_ALL/%p/%p)\n", \
msg->rcv.bind_address, recv_address_str); \
}; \
break; \
case SUBST_SND_IP: \
@ -1147,7 +1149,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
offset++; \
} \
} else { \
LM_CRIT("null send_sock\n"); \
LM_CRIT("null send_sock (SUBST_SND_IP)\n"); \
}; \
break; \
case SUBST_SND_PORT: \
@ -1156,7 +1158,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
send_port_str->len); \
offset += send_port_str->len; \
} else { \
LM_CRIT("null send sock port\n"); \
LM_CRIT("null send sock port (SUBST_SND_PORT)\n"); \
}; \
break; \
case SUBST_SND_ALL: \
@ -1246,7 +1248,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
} \
SENDCOMP_PARAM_ADD \
} else { \
LM_CRIT("null bind_address\n"); \
LM_CRIT("null send_sock (SUBST_SND_ALL)\n"); \
}; \
break; \
case SUBST_RCV_PROTO: \
@ -1285,7 +1287,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
msg->rcv.bind_address->proto); \
} \
} else { \
LM_CRIT("null send_sock\n"); \
LM_CRIT("null bind address (SUBST_RCV_PROTO)\n"); \
}; \
break; \
case SUBST_SND_PROTO: \
@ -1323,7 +1325,7 @@ void process_lumps(struct sip_msg *msg, struct lump *lumps, char *new_buf,
LM_CRIT("unknown proto %d\n", send_sock->proto); \
} \
} else { \
LM_CRIT("null send_sock\n"); \
LM_CRIT("null send_sock (SUBST_SND_PROTO)\n"); \
}; \
break; \
default: \
@ -2647,45 +2649,55 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag,
if(unlikely(httpreq))
pvia = p;
if(hdr == msg->h_via1) {
if(rport_buf) {
if(msg->via1->rport) { /* delete the old one */
/* copy until rport */
append_str_trans(p, hdr->name.s,
msg->via1->rport->start - hdr->name.s - 1,
msg);
/* copy new rport */
append_str(p, rport_buf, rport_len);
/* copy the rest of the via */
append_str_trans(p,
msg->via1->rport->start
+ msg->via1->rport->size,
hdr->body.s + hdr->body.len
- msg->via1->rport->start
- msg->via1->rport->size,
msg);
} else { /* just append the new one */
/* normal whole via copy */
append_str_trans(p, hdr->name.s,
(hdr->body.s + hdr->body.len) - hdr->name.s,
msg);
append_str(p, rport_buf, rport_len);
}
} else {
/* normal whole via copy */
if(rport_buf && msg->via1->rport) { /* replace old rport */
/* copy until rport */
append_str_trans(p, hdr->name.s,
msg->via1->rport->start - hdr->name.s - 1, msg);
} else if(msg->via1->branch) { /* add after branch */
append_str_trans(p, hdr->name.s,
msg->via1->branch->start - hdr->name.s
+ msg->via1->branch->size,
msg);
} else { /* append after header */
append_str_trans(p, hdr->name.s,
(hdr->body.s + hdr->body.len) - hdr->name.s,
msg);
}
if(received_buf)
if(rport_buf) {
/* add rport */
append_str(p, rport_buf, rport_len);
}
if(received_buf) {
/* add received */
append_str(p, received_buf, received_len);
}
if(xparams.len > 0) {
/* add extra parameters */
append_str(p, xparams.s, xparams.len);
}
/* copy the rest of the via */
if(rport_buf && msg->via1->rport) {
append_str_trans(p,
msg->via1->rport->start
+ msg->via1->rport->size,
hdr->body.s + hdr->body.len
- msg->via1->rport->start
- msg->via1->rport->size,
msg);
} else if(msg->via1->branch) {
append_str_trans(p,
msg->via1->branch->start
+ msg->via1->branch->size,
hdr->body.s + hdr->body.len
- msg->via1->branch->start
- msg->via1->branch->size,
msg);
}
} else {
/* normal whole via copy */
append_str_trans(p, hdr->name.s,
(hdr->body.s + hdr->body.len) - hdr->name.s, msg);
}
if(xparams.len > 0) {
append_str(p, xparams.s, xparams.len);
}
append_str(p, CRLF, CRLF_LEN);
/* if is HTTP, replace Via with Sia
* - HTTP Via format is different than SIP Via

@ -1275,7 +1275,7 @@ int parse_uri(char *buf, int len, struct sip_uri *uri)
uri->sip_params = uri->params;
if((phone2tel) && (uri->user_param_val.len == 5)
&& (strncmp(uri->user_param_val.s, "phone", 5) == 0)) {
uri->type = TEL_URI_T;
uri->type = uri->type == SIPS_URI_T ? TELS_URI_T : TEL_URI_T;
uri->flags |= URI_SIP_USER_PHONE;
/* move params from user into uri->params */
p = q_memchr(uri->user.s, ';', uri->user.len);

@ -233,7 +233,13 @@ void set_sdp_payload_attr(sdp_payload_attr_t *payload_attr, str *rtp_enc,
void set_sdp_payload_fmtp(sdp_payload_attr_t *payload_attr, str *fmtp_string)
{
if(payload_attr == NULL) {
LM_ERR("Invalid payload location\n");
if(fmtp_string != NULL && fmtp_string->s != NULL
&& fmtp_string->len > 0) {
LM_ERR("Invalid payload location - fmtp: %.*s\n", fmtp_string->len,
fmtp_string->s);
} else {
LM_ERR("Invalid payload location\n");
}
return;
}
payload_attr->fmtp_string.s = fmtp_string->s;
@ -354,6 +360,8 @@ sdp_payload_attr_t *get_sdp_payload4payload(
}
}
LM_DBG("payload not found: %.*s\n", rtp_payload->len, rtp_payload->s);
return NULL;
}

@ -413,7 +413,7 @@ int extract_ice_option(str *body, sdp_stream_cell_t *stream)
trim_len(ice_opt->option.len, ice_opt->option.s, ice_opt->option);
length = 0;
if(*ptr_src == 32)
if(ptr_src < end && *ptr_src == 32)
ptr_src++; /* skip space */
}

@ -289,7 +289,8 @@ void pp_ifdef_level_error(void)
*/
void pp_define_core(void)
{
char defval[64];
#define PP_DEFINE_COREVAL_SIZE 64
char defval[PP_DEFINE_COREVAL_SIZE];
char *p;
int n;
str_list_t *sb;
@ -301,8 +302,9 @@ void pp_define_core(void)
p++;
}
n = snprintf(p, 64 - (int)(p - defval), "_%u", VERSIONVAL / 1000000);
if(n < 0 || n >= 64 - (int)(p - defval)) {
n = snprintf(p, PP_DEFINE_COREVAL_SIZE - (int)(p - defval), "_%u",
VERSIONVAL / 1000000);
if(n < 0 || n >= PP_DEFINE_COREVAL_SIZE - (int)(p - defval)) {
LM_ERR("failed to build define token\n");
return;
}
@ -312,9 +314,9 @@ void pp_define_core(void)
return;
}
n = snprintf(p, 64 - (int)(p - defval), "_%u_%u", VERSIONVAL / 1000000,
(VERSIONVAL % 1000000) / 1000);
if(n < 0 || n >= 64 - (int)(p - defval)) {
n = snprintf(p, PP_DEFINE_COREVAL_SIZE - (int)(p - defval), "_%u_%u",
VERSIONVAL / 1000000, (VERSIONVAL % 1000000) / 1000);
if(n < 0 || n >= PP_DEFINE_COREVAL_SIZE - (int)(p - defval)) {
LM_ERR("failed to build define token\n");
return;
}
@ -324,9 +326,10 @@ void pp_define_core(void)
return;
}
n = snprintf(p, 64 - (int)(p - defval), "_%u_%u_%u", VERSIONVAL / 1000000,
(VERSIONVAL % 1000000) / 1000, VERSIONVAL % 1000);
if(n < 0 || n >= 64 - (int)(p - defval)) {
n = snprintf(p, PP_DEFINE_COREVAL_SIZE - (int)(p - defval), "_%u_%u_%u",
VERSIONVAL / 1000000, (VERSIONVAL % 1000000) / 1000,
VERSIONVAL % 1000);
if(n < 0 || n >= PP_DEFINE_COREVAL_SIZE - (int)(p - defval)) {
LM_ERR("failed to build define token\n");
return;
}
@ -343,8 +346,8 @@ void pp_define_core(void)
return;
}
n = snprintf(defval, 64, "%u", VERSIONVAL);
if(n < 0 || n >= 64) {
n = snprintf(defval, PP_DEFINE_COREVAL_SIZE, "%u", VERSIONVAL);
if(n < 0 || n >= PP_DEFINE_COREVAL_SIZE) {
LM_ERR("failed to build version define value\n");
return;
}

@ -40,8 +40,10 @@ static void *run_threadP(_thread_proto fn, void *arg)
pthread_t tid;
void *ret = NULL;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
return fn(arg);
}
@ -77,8 +79,10 @@ static void *run_threadPI(_thread_protoPI fn, void *arg1, int arg2)
pthread_t tid;
void *ret = NULL;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
return fn(arg1, arg2);
}
@ -113,8 +117,10 @@ static void run_threadV(_thread_protoV fn)
#ifdef USE_TLS
pthread_t tid;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
fn();
return;
}
@ -152,8 +158,10 @@ static int run_thread4PP(_thread_proto4PP fn, void *arg1, void *arg2)
pthread_t tid;
int ret = 0;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
return fn(arg1, arg2);
}
pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4PP,
@ -188,8 +196,10 @@ static void run_thread0P(_thread_proto0P fn, void *arg1)
#ifdef USE_TLS
pthread_t tid;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
fn(arg1);
return;
}
@ -240,8 +250,10 @@ static int run_thread4P5I2P2(_thread_proto4P5I2P2 fn, void *arg1, void *arg2,
pthread_t tid;
int ret = 0;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
return fn(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4P5I2P2,
@ -278,8 +290,10 @@ static int run_thread4L(_thread_proto4L fn, long arg1)
pthread_t tid;
int ret = 0;
if(likely(ksr_tls_threads_mode == 0 || ksr_tls_threads_mode == 2
|| (ksr_tls_threads_mode == 1 && process_no > 0))) {
if(likely(ksr_tls_threads_mode == KSR_TLS_THREADS_MNONE
|| ksr_tls_threads_mode == KSR_TLS_THREADS_MFORK
|| (ksr_tls_threads_mode == KSR_TLS_THREADS_MTEMP
&& process_no > 0))) {
return fn(arg1);
}
pthread_create(&tid, NULL, (_thread_proto)run_thread_wrap4L,

@ -1332,6 +1332,7 @@ static int nl_bound_sock(void)
{
int sock = -1;
struct sockaddr_nl la;
struct timeval recvtimeout;
sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if(sock < 0) {
@ -1343,13 +1344,22 @@ static int nl_bound_sock(void)
bzero(&la, sizeof(la));
la.nl_family = AF_NETLINK;
la.nl_pad = 0;
la.nl_pid = getpid();
la.nl_pid = 0;
la.nl_groups = 0;
if(bind(sock, (struct sockaddr *)&la, sizeof(la)) < 0) {
LM_ERR("could not bind NETLINK sock to sockaddr_nl\n");
goto error;
}
recvtimeout.tv_sec = 4;
recvtimeout.tv_usec = 0;
if(setsockopt(
sock, SOL_SOCKET, SO_RCVTIMEO, &recvtimeout, sizeof(recvtimeout))
< 0) {
LM_ERR("failed to set receive timeout\n");
goto error;
}
return sock;
error:
if(sock >= 0)
@ -1402,6 +1412,10 @@ static int get_flags(int family)
goto error;
}
rtn = recv(nl_sock, p, sizeof(buf) - nll, 0);
if(rtn <= 0) {
LM_ERR("failed to receive data (%d/%d)\n", rtn, errno);
goto error;
}
nlp = (struct nlmsghdr *)p;
if(nlp->nlmsg_type == NLMSG_DONE) {
LM_DBG("done\n");
@ -1504,6 +1518,10 @@ static int build_iface_list(void)
goto error;
}
rtn = recv(nl_sock, p, sizeof(buf) - nll, 0);
if(rtn <= 0) {
LM_ERR("failed to receive data (%d/%d)\n", rtn, errno);
goto error;
}
LM_DBG("received %d byles \n", rtn);
nlp = (struct nlmsghdr *)p;
if(nlp->nlmsg_type == NLMSG_DONE) {
@ -1740,6 +1758,8 @@ int add_interfaces(char *if_name, int family, unsigned short port,
continue;
if(family && family != ifa->ifa_addr->sa_family)
continue;
sockaddr2ip_addr(&addr, (struct sockaddr *)ifa->ifa_addr);
tmp = ip_addr2a(&addr);
if(ifa->ifa_addr->sa_family == AF_INET6) {
struct sockaddr_in6 *caddr = (struct sockaddr_in6 *)ifa->ifa_addr;
if((sr_bind_ipv6_link_local & KSR_IPV6_LINK_LOCAL_SKIP)
@ -1750,8 +1770,6 @@ int add_interfaces(char *if_name, int family, unsigned short port,
continue;
}
}
sockaddr2ip_addr(&addr, (struct sockaddr *)ifa->ifa_addr);
tmp = ip_addr2a(&addr);
if(ifa->ifa_flags & IFF_LOOPBACK)
flags = SI_IS_LO;
else

@ -408,12 +408,14 @@ int ksr_locate_module(char *mod_path, char **new_path)
int mdir_len;
int path_type;
int len;
int mod_path_len;
*new_path = NULL;
mod_path_len = strlen(mod_path);
path = mod_path;
path_type = 0;
modfile.s = path;
modfile.len = strlen(mod_path);
modfile.len = mod_path_len;
modname.s = modfile.s;
if(modfile.len > 3 && strcmp(modfile.s + modfile.len - 3, ".so") == 0) {
path_type = 1;
@ -500,7 +502,7 @@ int ksr_locate_module(char *mod_path, char **new_path)
if(path == 0) {
/* try path <MODS_DIR>/mod_path - K compat */
path = (char *)pkg_malloc(
mdir_len + 1 /* "/" */ + strlen(mod_path) + 1);
mdir_len + 1 /* "/" */ + mod_path_len + 1);
if(path == 0) {
PKG_MEM_ERROR;
goto error;
@ -511,8 +513,8 @@ int ksr_locate_module(char *mod_path, char **new_path)
path[len] = '/';
len++;
}
path[len] = 0;
strncat(path, mod_path, strlen(mod_path));
memcpy(path + len, mod_path, mod_path_len);
path[len + mod_path_len] = 0;
if(stat(path, &stat_buf) == -1) {
LM_DBG("module file not found <%s>\n", path);

@ -265,10 +265,10 @@ again:
}
}
LOG(cfg_get(core, core_cfg, corelog),
"error reading: %s (%d) ([%s]:%u ->", strerror(errno),
errno, ip_addr2a(&c->rcv.src_ip), c->rcv.src_port);
LOG(cfg_get(core, core_cfg, corelog), "-> [%s]:%u)\n",
ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);
"error reading: %s (%d) ([%s]:%u -> [%s]:%u)\n",
strerror(errno), errno, ip_addr2xa(&c->rcv.src_ip),
c->rcv.src_port, ip_addr2xa(&c->rcv.dst_ip),
c->rcv.dst_port);
if(errno == ETIMEDOUT) {
c->event = TCP_CLOSED_TIMEOUT;
} else if(errno == ECONNRESET) {
@ -280,8 +280,8 @@ again:
LM_DBG("EOF on connection %p (state: %u, flags: %x) - FD %d,"
" bytes %d, rd-flags %x ([%s]:%u -> [%s]:%u)",
c, c->state, c->flags, fd, bytes_read, *flags,
ip_addr2a(&c->rcv.src_ip), c->rcv.src_port,
ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);
ip_addr2xa(&c->rcv.src_ip), c->rcv.src_port,
ip_addr2xa(&c->rcv.dst_ip), c->rcv.dst_port);
c->state = S_CONN_EOF;
*flags |= RD_CONN_EOF;
c->event = TCP_CLOSED_EOF;
@ -1522,8 +1522,7 @@ again:
if(unlikely(bytes < 0)) {
LOG(cfg_get(core, core_cfg, corelog),
"ERROR: tcp_read_req: error reading - c: %p r: %p (%d)\n",
con, req, bytes);
"error reading - c: %p r: %p (%d)\n", con, req, bytes);
resp = CONN_ERROR;
goto end_req;
}

@ -8,30 +8,8 @@ NAME:=kamailio_ims
MAJOR_VER=0
MINOR_VER=1
BUGFIX_VER=0
DEFS+=-DSER
LIBS=
ifeq ($(CROSS_COMPILE),)
XML2CFG=$(shell which xml2-config)
ifeq ($(XML2CFG),)
XML2CFG=$(shell \
if pkg-config --exists libxml-2.0; then \
echo 'pkg-config libxml-2.0'; \
fi)
endif
endif
ifneq ($(XML2CFG),)
libxml2_includes = $(shell $(XML2CFG) --cflags)
libxml2_libs = $(shell $(XML2CFG) --libs)
else
libxml2_includes = -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include
libxml2_libs = -L$(LOCALBASE)/lib -lxml2
endif
INCLUDES= -I$(CURDIR)/.. -I$(CURDIR)/../.. $(libxml2_includes)
LIBS=$(libxml2_libs)
#SERLIBPATH=..
#SER_LIBS=$(SERLIBPATH)/cds/ser_cds
INCLUDES= -I$(CURDIR)/.. -I$(CURDIR)/../..
include ../../Makefile.libs

@ -270,7 +270,7 @@ error:
* Initialize database module
* \note No function should be called before this
*/
db1_con_t *db_do_init(const str *url, void *(*new_connection)())
db1_con_t *db_do_init(const str *url, void *(*new_connection)(struct db_id *))
{
return db_do_init2(url, *new_connection, DB_POOLING_PERMITTED);
}
@ -280,8 +280,8 @@ db1_con_t *db_do_init(const str *url, void *(*new_connection)())
* Initialize database module
* \note No function should be called before this
*/
db1_con_t *db_do_init2(
const str *url, void *(*new_connection)(), db_pooling_t pooling)
db1_con_t *db_do_init2(const str *url, void *(*new_connection)(struct db_id *),
db_pooling_t pooling)
{
struct db_id *id;
void *con;
@ -347,7 +347,7 @@ err:
* Shut down database module
* \note No function should be called after this
*/
void db_do_close(db1_con_t *_h, void (*free_connection)())
void db_do_close(db1_con_t *_h, void (*free_connection)(struct pool_con *))
{
struct pool_con *con;

@ -48,6 +48,8 @@
#include "db_cap.h"
#include "db_con.h"
#include "db_row.h"
#include "db_id.h"
#include "db_pool.h"
#include "db_pooling.h"
#include "db_locking.h"
@ -464,7 +466,7 @@ int db_bind_mod(const str *mod, db_func_t *dbf);
* \return returns a pointer to the db1_con_t representing the connection if it was
successful, otherwise 0 is returned.
*/
db1_con_t *db_do_init(const str *url, void *(*new_connection)());
db1_con_t *db_do_init(const str *url, void *(*new_connection)(struct db_id *));
/**
@ -478,8 +480,8 @@ db1_con_t *db_do_init(const str *url, void *(*new_connection)());
* \return returns a pointer to the db1_con_t representing the connection if it was
successful, otherwise 0 is returned.
*/
db1_con_t *db_do_init2(
const str *url, void *(*new_connection)(), db_pooling_t pooling);
db1_con_t *db_do_init2(const str *url, void *(*new_connection)(struct db_id *),
db_pooling_t pooling);
/**
@ -490,7 +492,7 @@ db1_con_t *db_do_init2(
* \param _h database connection handle
* \param (*free_connection) Pointer to the db specific free_connection method
*/
void db_do_close(db1_con_t *_h, void (*free_connection)());
void db_do_close(db1_con_t *_h, void (*free_connection)(struct pool_con *));
/**

@ -237,14 +237,33 @@ static int parse_db_url(struct db_id *id, const str *url)
break;
case '/':
id->host = prev_token;
prev_token = 0;
id->port = str2s(begin, url->s + i - begin, 0);
if(dupl_string_name(
&id->database, url->s + i + 1, url->s + len)
< 0)
goto err;
return 0;
/* go to last '@' when '/' is part of a password */
a = 0;
for(j = i + 1; j < len; j++) {
if(url->s[j] == '@') {
a = j;
}
}
if(a != 0) {
st = ST_HOST;
id->username = prev_token;
prev_token = 0;
i = a;
if(dupl_string(&id->password, begin, url->s + i)
< 0)
goto err;
begin = url->s + i + 1;
break;
} else {
id->host = prev_token;
prev_token = 0;
id->port = str2s(begin, url->s + i - begin, 0);
if(dupl_string_name(&id->database, url->s + i + 1,
url->s + len)
< 0)
goto err;
return 0;
}
}
break;

@ -338,9 +338,10 @@ int tcp_disable = 0; /* 1 if tcp is disabled */
int tls_disable = 0; /* tls enabled by default */
#else
int tls_disable = 1; /* tls disabled by default */
#endif /* CORE_TLS */
int ksr_tls_threads_mode = 0; /* threads execution mode for tls with libssl */
#endif /* USE_TLS */
#endif /* CORE_TLS */
/* threads execution mode for tls with libssl */
int ksr_tls_threads_mode = KSR_TLS_THREADS_MNONE;
#endif /* USE_TLS */
#ifdef USE_SCTP
int sctp_children_no = 0;
int sctp_disable = 2; /* 1 if sctp is disabled, 2 if auto mode, 0 enabled */

@ -281,7 +281,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(pobj == NULL) {
LM_ERR("null parameter - func: %.*s idx: %d argc: %d\n", fname.len,
fname.s, i, (int)alen);
return sr_kemi_apy_return_false();
return NULL;
}
if(ket->ptypes[i] == SR_KEMIP_STR) {
if(!PyUnicode_Check(pobj)) {
@ -293,7 +293,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(vps[i].v.s.s == NULL) {
LM_ERR("null-string parameter - func: %.*s idx: %d argc: %d\n",
fname.len, fname.s, i, (int)alen);
return sr_kemi_apy_return_false();
return NULL;
}
vps[i].v.s.len = (int)slen;
vps[i].vtype = SR_KEMIP_STR;

@ -401,7 +401,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(pobj == NULL) {
LM_ERR("null parameter - func: %.*s idx: %d argc: %d\n", fname.len,
fname.s, i, (int)alen);
return sr_kemi_apy_return_false();
return NULL;
}
if(ket->ptypes[i] == SR_KEMIP_STR) {
if(!PyUnicode_Check(pobj)) {
@ -413,7 +413,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(vps[i].v.s.s == NULL) {
LM_ERR("null-string parameter - func: %.*s idx: %d argc: %d\n",
fname.len, fname.s, i, (int)alen);
return sr_kemi_apy_return_false();
return NULL;
}
vps[i].v.s.len = (int)slen;
vps[i].vtype = SR_KEMIP_STR;

@ -123,7 +123,7 @@ static int mod_init(void)
{
/* init faked sip msg */
if(faked_msg_init() < 0) {
LM_ERR("failed to iit local sip msg\n");
LM_ERR("failed to init local sip msg\n");
return -1;
}

@ -622,6 +622,16 @@ end:
return ret;
}
/**
*
*/
static int ki_pv_proxy_authenticate(
sip_msg_t *msg, str *realm, str *passwd, int flags)
{
return pv_authenticate(msg, realm, passwd, flags, HDR_PROXYAUTH_T,
&msg->first_line.u.request.method);
}
/**
*
*/
@ -663,6 +673,26 @@ error:
return AUTH_ERROR;
}
/**
*
*/
static int ki_pv_www_authenticate(
sip_msg_t *msg, str *realm, str *passwd, int flags)
{
return pv_authenticate(msg, realm, passwd, flags, HDR_AUTHORIZATION_T,
&msg->first_line.u.request.method);
}
/**
*
*/
static int ki_pv_www_authenticate_method(
sip_msg_t *msg, str *realm, str *passwd, int flags, str *method)
{
return pv_authenticate(
msg, realm, passwd, flags, HDR_AUTHORIZATION_T, method);
}
/**
*
*/
@ -1339,6 +1369,21 @@ static sr_kemi_t sr_kemi_auth_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("auth"), str_init("pv_proxy_authenticate"),
SR_KEMIP_INT, ki_pv_proxy_authenticate,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("auth"), str_init("pv_www_authenticate"),
SR_KEMIP_INT, ki_pv_www_authenticate,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("auth"), str_init("pv_www_authenticate_method"),
SR_KEMIP_INT, ki_pv_www_authenticate_method,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("auth"), str_init("has_credentials"),
SR_KEMIP_INT, ki_has_credentials,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,

@ -114,7 +114,7 @@ void update_auth_session_timers(cdp_auth_session_t *x, AAAMessage *msg)
} else {
if(!avp) {
LM_DBG("using timers from our request as there is nothing in the "
"response (lifetime) - last requested lifetime was [%d]\n",
"response (lifetime) - last requested lifetime was [%ld]\n",
x->last_requested_lifetime);
if(x->last_requested_lifetime > 0) {
update_lifetime = 1;

@ -20,7 +20,7 @@ int get_accounting_record_type(AAAMessage *msg)
int get_result_code(AAAMessage *msg)
{
AAA_AVP *avp;
AAA_AVP *avp, *avp2;
AAA_AVP_LIST list;
list.head = 0;
list.tail = 0;
@ -36,9 +36,9 @@ int get_result_code(AAAMessage *msg)
goto finish;
} else if(avp->code == AVP_Experimental_Result) {
list = AAAUngroupAVPS(avp->data);
for(avp = list.head; avp; avp = avp->next) {
if(avp->code == AVP_IMS_Experimental_Result_Code) {
rc = get_4bytes(avp->data.s);
for(avp2 = list.head; avp2; avp2 = avp2->next) {
if(avp2->code == AVP_IMS_Experimental_Result_Code) {
rc = get_4bytes(avp2->data.s);
AAAFreeAVPList(&list);
goto finish;
}

@ -233,10 +233,8 @@ int diameter_peer_start(int blocking)
{
int pid;
int k = 0;
int seed;
peer *p;
seed = random();
/* fork workers */
for(k = 0; k < config->workers; k++) {
pid = fork_process(1001 + k, "cdp_worker", 1);
@ -245,7 +243,6 @@ int diameter_peer_start(int blocking)
return 0;
}
if(pid == 0) {
srandom(seed * k);
snprintf(
pt[process_no].desc, MAX_PT_DESC, "cdp worker child=%d", k);
if(cfg_child_init())
@ -266,7 +263,6 @@ int diameter_peer_start(int blocking)
/* fork receiver for unknown peers */
seed = random();
pid = fork_process(1001 + k, "cdp_receiver_peer_unknown", 1);
if(pid == -1) {
@ -275,7 +271,6 @@ int diameter_peer_start(int blocking)
return 0;
}
if(pid == 0) {
srandom(seed * k);
snprintf(pt[process_no].desc, MAX_PT_DESC, "cdp receiver peer unknown");
if(cfg_child_init())
return 0;
@ -288,7 +283,6 @@ int diameter_peer_start(int blocking)
}
/* fork receivers for each pre-configured peers */
seed = random();
lock_get(peer_list_lock);
for(p = peer_list->head, k = -1; p; p = p->next, k--) {
pid = fork_process(1001 + k, "cdp_receiver_peer", 1);
@ -298,7 +292,6 @@ int diameter_peer_start(int blocking)
return 0;
}
if(pid == 0) {
srandom(seed * k);
snprintf(pt[process_no].desc, MAX_PT_DESC, "cdp_receiver_peer=%.*s",
p->fqdn.len, p->fqdn.s);
if(cfg_child_init())

@ -830,7 +830,7 @@ int receive_loop(peer *original_peer)
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
if(enable_tls) {
to_ssl(&sp2->tls_ctx, &sp2->tls_conn,
sp->tcp_socket, method);
sp2->tcp_socket, method);
}
#endif
} else {
@ -843,7 +843,7 @@ int receive_loop(peer *original_peer)
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
if(enable_tls) {
to_ssl(&sp2->tls_ctx, &sp2->tls_conn,
sp->tcp_socket, method);
sp2->tcp_socket, method);
}
#endif
}

@ -428,7 +428,7 @@ void cdp_sessions_log()
x->u.auth.generic_data, x->u.auth.class);
break;
case ACCT_CC_CLIENT:
LM_DBG("CCAcct State [%d] Charging Active [%c (%d)s] "
LM_DBG("CCAcct State [%d] Charging Active [%c (%ld)s] "
"Reserved Units(valid=%ds) [%d] Generic [%p]\n",
x->u.cc_acc.state,
(x->u.cc_acc.charging_start_time
@ -436,11 +436,11 @@ void cdp_sessions_log()
!= ACC_CC_ST_DISCON)
? 'Y'
: 'N',
x->u.cc_acc.charging_start_time
? (int)((int)time(0)
- (int)x->u.cc_acc
x->u.cc_acc.charging_start_time ? (
time_t)(time(0)
- (time_t)x->u.cc_acc
.charging_start_time)
: -1,
: -1,
x->u.cc_acc.reserved_units
? (int)((int)x->u.cc_acc
.last_reservation_request_time
@ -482,7 +482,7 @@ int cdp_sessions_timer(time_t now, void *ptr)
x, ACC_CC_EV_SESSION_STALE, 0);
}
//check reservation timers - again here we are assuming CC-Time applications
int last_res_timestamp =
time_t last_res_timestamp =
x->u.cc_acc.last_reservation_request_time;
int res_valid_for =
x->u.cc_acc.reserved_units_validity_time;

@ -130,12 +130,13 @@ typedef struct _cdp_auth_session_t
time_t timeout; /**< absolute time for session timeout -1 means forever */
time_t lifetime; /**< absolute time for auth lifetime -1 means forever */
time_t grace_period; /**< grace_period in seconds */
unsigned int
last_requested_lifetime; /**< the following 3 timers are used to store what we are */
unsigned int
last_requested_timeout; /**<requesting in a request, if the answer does not have anything */
unsigned int
last_requested_grace; /**<different then we will use these values */
/** the following 3 timers are used to store what we are */
time_t last_requested_lifetime;
/** requesting in a request, if the answer does not have anything */
time_t last_requested_timeout;
/** different then we will use these values */
time_t last_requested_grace;
void *generic_data;
} cdp_auth_session_t;

@ -120,6 +120,7 @@ static call_t *__alloc_new_call_by_money(credit_data_t *credit_data,
struct sip_msg *msg, double credit, double connect_cost,
double cost_per_second, int initial_pulse, int final_pulse);
static void __notify_call_termination(sip_msg_t *msg);
static void __free_call_t(call_t *call);
static void __free_call(call_t *call);
static void __delete_call(call_t *call, credit_data_t *credit_data);
static int __has_to_tag(struct sip_msg *msg);
@ -903,7 +904,8 @@ static void __free_credit_data(credit_data_t *credit_data, hash_tables_t *hts,
// Free client_id in list's root
shm_free(credit_data->call_list->client_id.s);
shm_free(credit_data->call_list);
__free_call_t(credit_data->call_list);
credit_data->call_list = NULL;
// Release the lock since we are going to free the entry down below
cnxcc_unlock(credit_data->lock);
@ -981,6 +983,17 @@ void terminate_all_calls(credit_data_t *credit_data)
}
}
static void __free_call_t(call_t *call)
{
str_shm_free_if_not_null(call->sip_data.callid);
str_shm_free_if_not_null(call->sip_data.to_uri);
str_shm_free_if_not_null(call->sip_data.to_tag);
str_shm_free_if_not_null(call->sip_data.from_uri);
str_shm_free_if_not_null(call->sip_data.from_tag);
shm_free(call);
}
/*
* WARNING: When calling this function, the proper lock should have been acquired
*/
@ -1018,13 +1031,7 @@ static void __free_call(call_t *call)
shm_free(e->key.s);
shm_free(e);
str_shm_free_if_not_null(call->sip_data.callid);
str_shm_free_if_not_null(call->sip_data.to_uri);
str_shm_free_if_not_null(call->sip_data.to_tag);
str_shm_free_if_not_null(call->sip_data.from_uri);
str_shm_free_if_not_null(call->sip_data.from_tag);
shm_free(call);
__free_call_t(call);
}
/*
@ -1132,14 +1139,18 @@ static credit_data_t *__get_or_create_credit_data_entry(
if(e == NULL)
goto no_memory;
if(shm_str_dup(&e->key, client_id) != 0)
if(shm_str_dup(&e->key, client_id) != 0) {
shm_free(e);
goto no_memory;
}
e->u.p = credit_data = __alloc_new_credit_data(client_id, type);
e->flags = 0;
if(credit_data == NULL)
if(credit_data == NULL) {
shm_free(e);
goto no_memory;
}
cnxcc_lock(ht->lock);
str_hash_add(sht, e);
@ -1168,7 +1179,7 @@ static credit_data_t *__alloc_new_credit_data(
credit_data->call_list = shm_malloc(sizeof(call_t));
if(credit_data->call_list == NULL)
goto no_memory;
memset(credit_data->call_list, 0, sizeof(data_t));
clist_init(credit_data->call_list, next, prev);
/*
@ -1201,6 +1212,13 @@ static credit_data_t *__alloc_new_credit_data(
no_memory:
SHM_MEM_ERROR;
error:
if(credit_data) {
if(credit_data->call_list) {
str_shm_free_if_not_null(credit_data->call_list->client_id);
__free_call_t(credit_data->call_list);
}
shm_free(credit_data);
}
return NULL;
}
@ -1269,6 +1287,8 @@ static call_t *__alloc_new_call_by_money(credit_data_t *credit_data,
error:
cnxcc_unlock(credit_data->lock);
if(call)
__free_call_t(call);
return NULL;
}
@ -1330,6 +1350,8 @@ static call_t *__alloc_new_call_by_time(
error:
cnxcc_unlock(credit_data->lock);
if(call)
__free_call_t(call);
return NULL;
}
@ -1392,6 +1414,8 @@ static call_t *alloc_new_call_by_channel(
error:
cnxcc_unlock(credit_data->lock);
if(call)
__free_call_t(call);
return NULL;
}
@ -1449,9 +1473,10 @@ static int __add_call_by_cid(str *cid, call_t *call, credit_type_t type)
SHM_MEM_ERROR;
return -1;
}
memset(e, 0, sizeof(struct str_hash_entry));
if(shm_str_dup(&e->key, cid) != 0) {
SHM_MEM_ERROR;
shm_free(e);
return -1;
}

@ -1274,6 +1274,16 @@ static int corex_sip_reply_out(sr_event_param_t *evp)
str evname = str_init("corex:reply-out");
memset(&sndinfo, 0, sizeof(onsend_info_t));
sndinfo.dst = evp->dst;
if(evp->rpl != NULL) {
sndinfo.msg = evp->rpl;
sndinfo.buf = evp->rpl->buf;
sndinfo.len = evp->rpl->len;
} else {
sndinfo.msg = evp->req;
sndinfo.buf = evp->req->buf;
sndinfo.len = evp->req->len;
}
if(corex_evrt_reply_out_no >= 0 || corex_evcb_reply_out.len > 0) {
run_onsend_evroute(&sndinfo, corex_evrt_reply_out_no,

@ -29,6 +29,12 @@
#define DB_MONGODB_ROWS_STEP 1000
#if MONGOC_CHECK_VERSION(1, 29, 0)
#define _ksr_bson_as_json bson_as_legacy_extended_json
#else
#define _ksr_bson_as_json bson_as_json
#endif
typedef struct db_mongodb_result
{
mongoc_collection_t *collection; /*!< Collection link */
@ -773,7 +779,7 @@ static int db_mongodb_convert_result(const db1_con_t *_h, db1_res_t *_r)
mgres->maxrows = RES_ROW_N(_r);
}
if(is_printable(L_DBG)) {
jstr = bson_as_json(itdoc, NULL);
jstr = _ksr_bson_as_json(itdoc, NULL);
LM_DBG("selected document: %s\n", jstr);
bson_free(jstr);
}
@ -1000,7 +1006,7 @@ int db_mongodb_query(const db1_con_t *_h, const db_key_t *_k,
}
if(is_printable(L_DBG)) {
jstr = bson_as_json(seldoc, NULL);
jstr = _ksr_bson_as_json(seldoc, NULL);
LM_DBG("query filter: %s\n", jstr);
bson_free(jstr);
}
@ -1036,7 +1042,7 @@ int db_mongodb_query(const db1_con_t *_h, const db_key_t *_k,
}
#endif
if(is_printable(L_DBG)) {
jstr = bson_as_json(mgcon->colsdoc, NULL);
jstr = _ksr_bson_as_json(mgcon->colsdoc, NULL);
LM_DBG("columns filter: %s\n", jstr);
bson_free(jstr);
}
@ -1174,7 +1180,7 @@ int db_mongodb_insert(const db1_con_t *_h, const db_key_t *_k,
goto error;
}
if(is_printable(L_DBG)) {
jstr = bson_as_json(doc, NULL);
jstr = _ksr_bson_as_json(doc, NULL);
LM_DBG("insert document: %s\n", jstr);
bson_free(jstr);
}
@ -1268,7 +1274,7 @@ int db_mongodb_delete(const db1_con_t *_h, const db_key_t *_k,
}
if(is_printable(L_DBG)) {
jstr = bson_as_json(doc, NULL);
jstr = _ksr_bson_as_json(doc, NULL);
LM_DBG("delete filter document: %s\n", jstr);
bson_free(jstr);
}

@ -64,9 +64,9 @@ ifneq ($(HIREDIS_CLUSTER_BUILDER),)
HIREDISCLUSTERDEFS = $(shell $(HIREDIS_CLUSTER_BUILDER) --cflags)
HIREDISCLUSTERLIBS = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs)
HIREDISCLUSTERLIBSPATH = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs-only-L | cut -c 3-)
ifneq ($(shell ls $(HIREDISCLUSTERLIBSPATH) | grep libhiredis_ssl.so),)
ifneq ($(shell ls $(HIREDISCLUSTERLIBSPATH) | grep libhiredis_cluster_ssl.so),)
HIREDISCLUSTERDEFS += -DWITH_SSL
HIREDISCLUSTERLIBS += -lhiredis_ssl
HIREDISCLUSTERLIBS += -lhiredis_cluster_ssl
endif
DEFS+=-DWITH_HIREDIS_CLUSTER
DEFS+=$(HIREDISCLUSTERDEFS)

@ -25,6 +25,9 @@
#ifdef WITH_HIREDIS_CLUSTER
#include <hircluster.h>
#ifdef WITH_SSL
#include <hircluster_ssl.h>
#endif
#else
#ifdef WITH_HIREDIS_PATH
#include <hiredis/hiredis.h>

@ -794,6 +794,7 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
type->type.s);
}
keyname.s = NULL;
break;
} else if(keyname.s) {
pkg_free(keyname.s);
keyname.s = NULL;
@ -1020,43 +1021,51 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
#endif
#ifdef WITH_HIREDIS_CLUSTER
return 0;
err:
if(reply)
db_redis_free_reply(&reply);
return -1;
}
#endif
#else
// for full table scans, we have to manually match all given keys
// but only do this once for repeated invocations
if(!*manual_keys) {
*manual_keys_count = _n;
*manual_keys = (int *)pkg_malloc(*manual_keys_count * sizeof(int));
if(!*manual_keys) {
LM_ERR("Failed to allocate memory for manual keys\n");
goto err;
}
memset(*manual_keys, 0, *manual_keys_count * sizeof(int));
for(l = 0; l < _n; ++l) {
(*manual_keys)[l] = l;
}
}
// for full table scans, we have to manually match all given keys
// but only do this once for repeated invocations
if(!*manual_keys) {
*manual_keys_count = _n;
*manual_keys = (int *)pkg_malloc(*manual_keys_count * sizeof(int));
if(!*manual_keys) {
LM_ERR("Failed to allocate memory for manual keys\n");
goto err;
}
memset(*manual_keys, 0, *manual_keys_count * sizeof(int));
for(l = 0; l < _n; ++l) {
(*manual_keys)[l] = l;
}
}
if(reply) {
db_redis_free_reply(&reply);
}
if(reply) {
db_redis_free_reply(&reply);
}
db_redis_key_free(&query_v);
db_redis_key_free(&query_v);
LM_DBG("got %lu entries by scan\n", (unsigned long)i);
return 0;
LM_DBG("got %lu entries by scan\n", (unsigned long)i);
return 0;
err : if(reply) db_redis_free_reply(&reply);
db_redis_key_free(&query_v);
db_redis_key_free(query_keys);
*query_keys_count = 0;
if(*manual_keys) {
pkg_free(*manual_keys);
*manual_keys = NULL;
}
return -1;
}
err:
if(reply)
db_redis_free_reply(&reply);
db_redis_key_free(&query_v);
db_redis_key_free(query_keys);
*query_keys_count = 0;
if(*manual_keys) {
pkg_free(*manual_keys);
*manual_keys = NULL;
}
return -1;
}
#endif
static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
const int _n, redis_key_t **query_keys, int *query_keys_count,

@ -738,6 +738,10 @@ ht_cell_t *ht_cell_value_add(ht_t *ht, str *name, int val, ht_cell_t *old)
if(now > 0 && it->expire != 0 && it->expire < now) {
/* entry has expired */
it->expire = ht->htexpire;
if(it->expire) {
it->expire += now;
}
if(ht->flags == PV_VAL_INT) {
/* initval is integer, use it to create a fresh entry */
it->flags &= ~AVP_VAL_STR;
@ -1537,6 +1541,7 @@ int ht_count_cells_re(str *sre, ht_t *ht, int mode)
str sval;
str tval;
int ival = 0;
time_t tnow = 0;
if(sre == NULL || sre->len <= 0 || ht == NULL)
return 0;
@ -1616,11 +1621,17 @@ int ht_count_cells_re(str *sre, ht_t *ht, int mode)
}
}
tnow = time(NULL);
for(i = 0; i < ht->htsize; i++) {
/* free entries */
ht_slot_lock(ht, i);
it = ht->entries[i].first;
while(it) {
if(ht->htexpire > 0 && it->expire != 0 && it->expire < tnow) {
/* entry has expired, continue */
it = it->next;
continue;
}
it0 = it->next;
if(op == 5) {
if(!(it->flags & AVP_VAL_STR))

@ -522,7 +522,7 @@ int async_send_query(sip_msg_t *msg, str *query, str *cbname)
q_idx++;
snprintf(q_id, MAX_ID_LEN + 1, "%u-%u", (unsigned int)getpid(), q_idx);
strncpy(aq->id, q_id, strlen(q_id));
strcpy(aq->id, q_id);
aq->query_params.tls_client_cert = NULL;
if(ah_params.tls_client_cert) {

@ -100,7 +100,7 @@ void event_cb(int fd, short kind, void *userp)
update_stat(timeouts, 1);
const char *error = "TIMEOUT";
strncpy(cell->error, error, strlen(error) + 1);
strcpy(cell->error, error);
reply_error(cell);
@ -157,10 +157,12 @@ void event_cb(int fd, short kind, void *userp)
/* CURLMOPT_SOCKETFUNCTION */
int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
struct http_m_cell *cell;
struct http_m_global *g = (struct http_m_global *)cbp;
struct http_m_cell *cell = (struct http_m_cell *)sockp;
const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
cell = http_m_cell_lookup(e);
LM_DBG("socket callback: s=%d e=%p what=%s\n", s, e, whatstr[what]);
if(what == CURL_POLL_REMOVE) {
/* if cell is NULL the handle has been removed by the event callback for timeout */
@ -218,7 +220,7 @@ int check_mcode(CURLMcode code, char *error)
break;
}
LM_ERR("ERROR: %s\n", s);
strncpy(error, s, strlen(s) + 1);
strcpy(error, s);
return -1;
}
return 0;

@ -46,7 +46,6 @@
// ID of current message
static unsigned int current_msg_id = 0;
static unsigned int current_msg_id_repl = 0;
cJSON *avp2json(AAA_AVP *avp_t)
{
@ -486,7 +485,7 @@ int pv_get_application(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
int pv_get_response(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
{
if((msg->id != current_msg_id_repl) || (responsejson.len < 0)) {
if(responsejson.len < 0) {
return pv_get_null(msg, param, res);
}
return pv_get_strval(msg, param, res, &responsejson);
@ -502,7 +501,6 @@ int pv_set_response(
val->rs.s);
responsejson.s = val->rs.s;
responsejson.len = val->rs.len;
current_msg_id_repl = msg->id;
return 0;
}
return 0;

@ -809,6 +809,7 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int _cflags)
pcontact_t *pcontact = NULL;
struct pcontact_info ci;
int ret = IPSEC_CMD_FAIL; // FAIL by default
int fun_ret_c; // Used to store return codes of some functions
tm_cell_t *t = NULL;
sip_msg_t *req = NULL;
security_t *req_sec_params = NULL;
@ -893,10 +894,13 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int _cflags)
}
if(update_contact_ipsec_params(s, m, old_s) != 0) {
LM_ERR("Could not update ipsec params in contact.\n");
goto cleanup;
}
if(create_ipsec_tunnel(&req->rcv.src_ip, s) != 0) {
fun_ret_c = create_ipsec_tunnel(&req->rcv.src_ip, s);
if(fun_ret_c != 0) {
LM_ERR("IPSEC tunnel creation failed.\n");
goto cleanup;
}
@ -917,11 +921,16 @@ int ipsec_create(struct sip_msg *m, udomain_t *d, int _cflags)
goto cleanup;
}
if(add_supported_secagree_header(m) != 0) {
fun_ret_c = add_supported_secagree_header(m);
if(fun_ret_c != 0) {
LM_ERR("Could not add secagree header. Failed with code: %d\n",
fun_ret_c);
goto cleanup;
}
if(add_security_server_header(m, s) != 0) {
fun_ret_c = add_security_server_header(m, s);
if(fun_ret_c != 0) {
LM_ERR("Could not add security server header. Code: %d\n", fun_ret_c);
goto cleanup;
}

@ -336,6 +336,7 @@ static int ipsec_add_listen_ifaces()
static int mod_init(void)
{
bind_usrloc_t bind_usrloc;
int ret;
bind_usrloc = (bind_usrloc_t)find_export("ul_bind_ims_usrloc_pcscf", 1, 0);
if(!bind_usrloc) {
@ -343,7 +344,9 @@ static int mod_init(void)
return -1;
}
if(bind_usrloc(&ul) < 0) {
ret = bind_usrloc(&ul);
if(ret < 0) {
LM_ERR("bind_userloc() has failed with code %d", ret);
return -1;
}
LM_INFO("Successfully bound to PCSCF Usrloc module\n");
@ -355,7 +358,9 @@ static int mod_init(void)
}
LM_INFO("Successfully bound to TM module\n");
if(ipsec_add_listen_ifaces() != 0) {
ret = ipsec_add_listen_ifaces();
if(ret != 0) {
LM_ERR("Failed to add ipsec listen interface. Code: %d", ret);
return -1;
}

@ -242,12 +242,10 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
//sometimes s is populated by an ims_getter method cscf_get_terminating_user that alloc memory that must be free-ed at the end
int free_s = 0;
//the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag
int firstflag = 0;
enum isc_mark_status status = 0;
int ret = ISC_RETURN_FALSE;
isc_mark new_mark, old_mark;
isc_mark new_mark, old_mark, dummy_mark;
enum dialog_direction dir = get_dialog_direction(str1);
@ -262,16 +260,27 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
/* starting or resuming? */
memset(&old_mark, 0, sizeof(isc_mark));
memset(&new_mark, 0, sizeof(isc_mark));
memset(&dummy_mark, 0, sizeof(isc_mark));
if(is_route_type(FAILURE_ROUTE)) {
status |= ISCMARK_FAILURE;
}
if(isc_mark_get_from_msg(msg, &old_mark)) {
LM_DBG("Message returned s=%d;h=%d;d=%d;a=%.*s\n", old_mark.skip,
old_mark.handling, old_mark.direction, old_mark.aor.len,
old_mark.aor.s);
} else if(is_route_type(FAILURE_ROUTE)
&& isc_mark_get_from_lumps(msg, &dummy_mark)) {
LM_DBG("Message lumps returned s=%d;h=%d;d=%d;a=%.*s\n",
dummy_mark.skip, dummy_mark.handling, dummy_mark.direction,
dummy_mark.aor.len, dummy_mark.aor.s);
} else {
LM_DBG("Starting triggering\n");
firstflag = 1;
status |= ISCMARK_MISSING;
}
if(is_route_type(FAILURE_ROUTE) && !firstflag) {
if(status == ISCMARK_FOUND_LUMPS) {
/* need to find the handling for the failed trigger */
if(dir == DLG_MOBILE_ORIGINATING) {
k = cscf_get_originating_user(msg, &s);
@ -305,7 +314,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
}
}
struct cell *t = isc_tmb.t_gett();
LM_CRIT("SKIP: %d\n", old_mark.skip);
LM_CRIT("SKIP after AS failure: %d\n", old_mark.skip);
int index = old_mark.skip;
for(k = 0; k < t->nr_of_outgoings; k++) {
m = isc_checker_find(s, new_mark.direction, index, msg,
@ -374,7 +383,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
new_mark.skip = m->index + 1;
new_mark.handling = m->default_handling;
new_mark.aor = s;
ret = isc_forward(msg, m, &new_mark, firstflag);
ret = isc_forward(msg, m, &new_mark, status);
isc_free_match(m);
goto done;
}
@ -415,7 +424,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t *d)
new_mark.skip = m->index + 1;
new_mark.handling = m->default_handling;
new_mark.aor = s;
ret = isc_forward(msg, m, &new_mark, firstflag);
ret = isc_forward(msg, m, &new_mark, status);
isc_free_match(m);
goto done;
}
@ -430,6 +439,10 @@ done:
if(old_mark.aor.s)
pkg_free(old_mark.aor.s);
if(dummy_mark.aor.s)
pkg_free(dummy_mark.aor.s);
return ret;
}
@ -541,7 +554,8 @@ int isc_from_as(struct sip_msg *msg, char *str1, char *str2)
cscf_get_terminating_user(msg, &s);
//sometimes s is populated by an ims_getter method cscf_get_terminating_user that alloc memory that must be free-ed at the end
free_s = 1;
if(memcmp(old_mark.aor.s, s.s, s.len) != 0) {
if(!old_mark.aor.s || !s.len
|| memcmp(old_mark.aor.s, s.s, s.len) != 0) {
LM_DBG("This is a new call....... RURI has been retargeted\n");
return ISC_RETURN_RETARGET;
}

@ -77,6 +77,29 @@ enum dialog_direction
/** Unknown */
};
/* Method of obtaining isc_mark
First bit -> 0=REQUEST_ROUTE/1=FAILURE_ROUTE
Second bit -> 0=Found/1=Missing
*/
enum isc_mark_status
{
ISCMARK_FOUND_ROUTE_HEADER =
0, /*Request has been received from AS, old ISCMARK found in Route header field*/
ISCMARK_FOUND_LUMPS =
1, /*Request to AS has been rejected or timed out, old ISCMARK found in lumps*/
ISCMARK_MISSING_START_TRIGGERING =
2, /*Request has been received without old ISCMARK in Route header field*/
ISCMARK_MISSING_START_TRIGGERING_SAR =
3 /*SAR/SAA has happened with HSS, due to terminating request (no old ISCMARK)*/
};
/* ISCMARK Status bits*/
/* ISCMARK is obtained in failure route*/
#define ISCMARK_FAILURE (1 << 0)
/* ISCMARK could not be found */
#define ISCMARK_MISSING (1 << 1)
/* Various constants */
/** User Not Registered */
#define IMS_USER_NOT_REGISTERED 0

@ -54,10 +54,11 @@
* @param msg - the SIP message
* @param m - the isc_match that matched with info about where to forward it
* @param mark - the isc_mark that should be used to mark the message
* @param status - the state of the isc_mark
* @returns #ISC_RETURN_TRUE if OK, #ISC_RETURN_ERROR if not
*/
int isc_forward(
struct sip_msg *msg, isc_match *m, isc_mark *mark, int firstflag)
int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark,
enum isc_mark_status status)
{
struct cell *t;
unsigned int hash, label;
@ -78,7 +79,7 @@ int isc_forward(
msg->dst_uri.s[msg->dst_uri.len] = '\0';
/* append branch if last trigger failed */
if(is_route_type(FAILURE_ROUTE) && !firstflag)
if(status == ISCMARK_FOUND_LUMPS)
append_branch(msg, &(msg->first_line.u.request.uri), &(msg->dst_uri), 0,
Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0);

@ -68,8 +68,8 @@ extern int isc_fr_inv_timeout; /**< default ISC INVITE response timeout in ms */
/** SIP Status Code to send to client on Session Termination because AS did not respond */
int isc_forward(
struct sip_msg *msg, isc_match *m, isc_mark *mark, int firstflag);
int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark,
enum isc_mark_status status);
#endif

@ -128,6 +128,45 @@ int isc_mark_get_from_msg(struct sip_msg *msg, isc_mark *mark)
return 0;
}
/**
* Retrieves the mark from the lumps of a message (failure route).
* - the marking should be in a header like described before
* @param msg - SIP mesage to mark
* @param mark - mark to load into
* @returns 1 if found, 0 if not
*/
int isc_mark_get_from_lumps(struct sip_msg *msg, isc_mark *mark)
{
struct lump *lmp, *tmp;
str found = {0, 0};
LM_DBG("isc_mark_get_from_lumps: Trying to get the mark from the add_rm "
"lumps \n");
memset(mark, 0, sizeof(isc_mark));
parse_headers(msg, HDR_EOH_F, 0);
anchor_lump(msg, msg->headers->name.s - msg->buf, 0, 0);
lmp = msg->add_rm;
while(lmp) {
tmp = lmp->before;
if(tmp && tmp->op == LUMP_ADD && tmp->u.value
&& (found.s = strstr(tmp->u.value, ISC_MARK_USERNAME))) {
LM_DBG("ifc_get_from_lumps: Found lump %s\n", tmp->u.value);
found.len = tmp->len - (found.s - tmp->u.value);
LM_DBG("ifc_get_from_lumps: take fraction of lump ...%.*s\n",
found.len, found.s);
isc_mark_get(found, mark);
return 1;
}
lmp = lmp->next;
}
return 0;
}
/**
* Load the mark from a string.
* @param x - string with the mark, as found in the Route header
@ -140,12 +179,12 @@ void isc_mark_get(str x, isc_mark *mark)
if(mark->aor.s)
pkg_free(mark->aor.s);
mark->aor = aor_hex;
for(i = 0; i < x.len && x.s[i] != ';'; i++)
for(i = 0; i < x.len && x.s[i] != ';' && x.s[i] != '>'; i++)
;
while(i < x.len) {
while(i < x.len && x.s[i] != '>') {
if(x.s[i + 1] == '=') {
k = 0;
for(j = i + 2; j < x.len && x.s[j] != ';'; j++)
for(j = i + 2; j < x.len && x.s[j] != ';' && x.s[j] != '>'; j++)
k = k * 10 + (x.s[j] - '0');
switch(x.s[i]) {
case 's':
@ -160,7 +199,8 @@ void isc_mark_get(str x, isc_mark *mark)
case 'a':
aor_hex.s = x.s + i + 2;
aor_hex.len = 0;
for(j = i + 2; j < x.len && x.s[j] != ';'; j++)
for(j = i + 2; j < x.len && x.s[j] != ';' && x.s[j] != '>';
j++)
aor_hex.len++;
mark->aor.len = aor_hex.len / 2;
mark->aor.s = pkg_malloc(mark->aor.len);
@ -177,6 +217,9 @@ void isc_mark_get(str x, isc_mark *mark)
LM_ERR("isc_mark_get: unknown parameter found: %c !\n",
x.s[i]);
}
if(x.s[j] == '>')
break;
i = j + 1;
} else
i++;

@ -72,6 +72,7 @@ typedef struct _isc_mark
int isc_mark_get_from_msg(struct sip_msg *msg, isc_mark *mark);
int isc_mark_get_from_lumps(struct sip_msg *msg, isc_mark *mark);
void isc_mark_get(str x, isc_mark *mark);
int base16_to_bin(char *from, int len, char *to);
int isc_mark_drop_route(struct sip_msg *msg);

@ -26,6 +26,7 @@
#include <string.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

@ -421,6 +421,8 @@ event_route[xhttp:request] {
...
jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}');
xlog("jsonrpc response code: $jsonrpl(code) - the body is: $jsonrpl(body)\n");
jsonrpc_exec('{"jsonrpc": "2.0", "method": "corex.debug", "params": [ 2 ], "id":
1}');
...
6. JSONRPC Commands

@ -495,6 +495,7 @@ event_route[xhttp:request] {
...
jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}');
xlog("jsonrpc response code: $jsonrpl(code) - the body is: $jsonrpl(body)\n");
jsonrpc_exec('{"jsonrpc": "2.0", "method": "corex.debug", "params": [ 2 ], "id": 1}');
...
</programlisting>
</example>

@ -437,6 +437,7 @@ static int ki_jwt_verify_key(
jwt_valid_t *jwt_valid = NULL;
str sparams = STR_NULL;
long lval = 0;
unsigned int jwtret = 0;
if(key == NULL || key->s == NULL || alg == NULL || alg->s == NULL
|| claims == NULL || claims->s == NULL || claims->len <= 0
@ -501,9 +502,10 @@ static int ki_jwt_verify_key(
LM_ERR("failed to decode jwt value (ret: %d jwt: %p)\n", ret, jwt);
goto error;
}
if(jwt_validate(jwt, jwt_valid) != 0) {
if((jwtret = jwt_validate(jwt, jwt_valid)) != JWT_VALIDATION_SUCCESS) {
_jwt_verify_status = jwt_valid_get_status(jwt_valid);
LM_ERR("failed to validate jwt: %08x\n", _jwt_verify_status);
LM_ERR("failed to validate jwt: %08x (ret: %08x)\n", _jwt_verify_status,
jwtret);
goto error;
}

@ -150,12 +150,14 @@ static cmd_export_t cmds[] = {
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_publish", (cmd_function)kz_amqp_publish_ex, 4, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_query", (cmd_function)kz_amqp_query, 4, fixup_kz_amqp,
{"kazoo_query", (cmd_function)kz_amqp_query_3, 3, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_query", (cmd_function)kz_amqp_query, 5, fixup_kz_amqp,
{"kazoo_query", (cmd_function)kz_amqp_query_4, 4, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_query", (cmd_function)kz_amqp_query_ex, 3, fixup_kz_amqp,
{"kazoo_query", (cmd_function)kz_amqp_query_5, 5, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_pua_publish", (cmd_function)kz_pua_publish, 1, 0, 0, ANY_ROUTE},
{"kazoo_pua_publish_mwi", (cmd_function)kz_pua_publish_mwi, 1, 0, 0,
ANY_ROUTE},
@ -168,8 +170,6 @@ static cmd_export_t cmds[] = {
fixup_kz_amqp4_free, ANY_ROUTE},
{"kazoo_subscribe", (cmd_function)kz_amqp_subscribe_simple, 4,
fixup_kz_amqp4, fixup_kz_amqp4_free, ANY_ROUTE},
{"kazoo_json", (cmd_function)kz_json_get_field, 3, fixup_kz_json,
fixup_kz_json_free, ANY_ROUTE},
{"kazoo_json_keys", (cmd_function)kz_json_get_keys, 3, fixup_kz_json,
@ -368,7 +368,7 @@ static int mod_init(void)
}
kz_worker_pipes_fds =
(int *)shm_malloc(sizeof(int) * (dbk_consumer_workers)*2);
(int *)shm_malloc(sizeof(int) * (dbk_consumer_workers) * 2);
kz_worker_pipes = (int *)shm_malloc(sizeof(int) * dbk_consumer_workers);
for(i = 0; i < dbk_consumer_workers; i++) {
kz_worker_pipes_fds[i * 2] = kz_worker_pipes_fds[i * 2 + 1] = -1;

@ -1246,6 +1246,7 @@ int kz_amqp_pipe_send_receive(str *str_exchange, str *str_routing_key,
cmd->headers = kz_amqp_str_dup(str_headers);
}
cmd->timeout = *kz_timeout;
if(cmd->payload == NULL || cmd->routing_key == NULL
@ -1637,18 +1638,60 @@ int kz_amqp_query_ex(struct sip_msg *msg, char *exchange, char *routing_key,
return 1;
};
int kz_amqp_query(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, char *dst, char *headers)
int kz_amqp_query_3(
struct sip_msg *msg, char *exchange, char *routing_key, char *payload)
{
/* This is a wrapper around the executer function, just for the sake of clarity*/
int result = kz_amqp_query_ex(msg, exchange, routing_key, payload, NULL);
return result;
};
pv_spec_t *dst_pv;
pv_value_t dst_val;
int kz_amqp_query_4(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, str *dst)
{
int result = kz_amqp_query_ex(msg, exchange, routing_key, payload, NULL);
if(result == -1)
return result;
kz_set_pseudo_var(msg, dst);
return 1;
};
int kz_amqp_query_5(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, str *dst, char *headers)
{
int result = kz_amqp_query_ex(msg, exchange, routing_key, payload, headers);
if(result == -1)
return result;
dst_pv = (pv_spec_t *)dst;
kz_set_pseudo_var(msg, dst);
return 1;
};
void kz_set_pseudo_var(struct sip_msg *msg, str *dst)
{
pv_spec_t *pvresult = NULL;
pv_value_t dst_val;
if(dst == NULL || dst->s == NULL || dst->len <= 0) {
LM_ERR("Destination pseudo-variable is empty \n");
return;
}
pvresult = pv_cache_get(dst);
if(pvresult == NULL) {
LM_ERR("Failed to malloc destination pseudo-variable \n");
return;
}
if(pvresult->setf == NULL) {
LM_ERR("destination pseudo-variable is not writable: %.*s \n", dst->len,
dst->s);
return;
}
memset(&dst_val, 0, sizeof(pv_value_t));
if(last_payload_result != NULL) {
dst_val.rs.s = last_payload_result;
dst_val.rs.len = strlen(last_payload_result);
@ -1659,10 +1702,8 @@ int kz_amqp_query(struct sip_msg *msg, char *exchange, char *routing_key,
dst_val.ri = 0;
dst_val.flags = PV_VAL_NULL;
}
dst_pv->setf(msg, &dst_pv->pvp, (int)EQ_T, &dst_val);
return 1;
};
pvresult->setf(msg, &pvresult->pvp, (int)EQ_T, &dst_val);
}
void kz_amqp_queue_free(kz_amqp_queue_ptr queue)
{

@ -310,10 +310,12 @@ int ki_kz_amqp_publish(
sip_msg_t *msg, str *exchange, str *routing_key, str *payload);
int ki_kz_amqp_publish_hdrs(sip_msg_t *msg, str *exchange, str *routing_key,
str *payload, str *headers);
int kz_amqp_query(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, char *dst, char *headers);
int kz_amqp_query_ex(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, char *headers);
int kz_amqp_query_3(
struct sip_msg *msg, char *exchange, char *routing_key, char *payload);
int kz_amqp_query_4(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, str *dst);
int kz_amqp_query_5(struct sip_msg *msg, char *exchange, char *routing_key,
char *payload, str *dst, char *headers);
int kz_amqp_subscribe(struct sip_msg *msg, char *payload);
int ki_kz_amqp_subscribe(sip_msg_t *msg, str *payload);
int kz_amqp_subscribe_simple(struct sip_msg *msg, char *exchange,
@ -327,6 +329,8 @@ int kz_amqp_async_query_ex(struct sip_msg *msg, char *_exchange,
char *_routing_key, char *_payload, char *_cb_route, char *_err_route,
char *_pub_flags);
void kz_set_pseudo_var(struct sip_msg *msg, str *dst);
//void kz_amqp_generic_consumer_loop(int child_no);
void kz_amqp_manager_loop(int child_no);

@ -210,9 +210,10 @@ int ka_str_copy(str *src, str *dest, char *prefix)
return -1;
}
if(prefix)
strncpy(dest->s, prefix, lp);
strncpy(dest->s + lp, src->s, src->len);
if(prefix) {
memcpy(dest->s, prefix, lp);
}
memcpy(dest->s + lp, src->s, src->len);
dest->s[src->len + lp] = '\0';
dest->len = src->len + lp;

@ -382,8 +382,8 @@ int lost_held_function(struct sip_msg *_m, char *_con, char *_pidf, char *_url,
if(doc == NULL) {
LM_WARN("invalid xml document: [%.*s]\n", res.len, res.s);
doc = xmlReadMemory(res.s, res.len, 0, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_NONET |
XML_PARSE_NOCDATA | XML_PARSE_RECOVER);
XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NOCDATA
| XML_PARSE_RECOVER);
if(doc == NULL) {
LM_ERR("xml document recovery failed on: [%.*s]\n", res.len, res.s);
goto err;
@ -705,8 +705,8 @@ int lost_held_dereference(struct sip_msg *_m, char *_url, char *_pidf,
if(doc == NULL) {
LM_WARN("invalid xml document: [%.*s]\n", res.len, res.s);
doc = xmlReadMemory(res.s, res.len, 0, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_NONET |
XML_PARSE_NOCDATA | XML_PARSE_RECOVER);
XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NOCDATA
| XML_PARSE_RECOVER);
if(doc == NULL) {
LM_ERR("xml document recovery failed on: [%.*s]\n", res.len, res.s);
goto err;

@ -54,7 +54,7 @@
#include "utilities.h"
#include "response.h"
/*
/*
* is_http_laquot(search)
* return 1 if true else 0
*/
@ -77,7 +77,7 @@ int is_http_laquot(char *search)
return 0;
}
/*
/*
* is_https_laquot(search)
* return 1 if true else 0
*/
@ -101,7 +101,7 @@ int is_https_laquot(char *search)
return 0;
}
/*
/*
* is_http(search)
* return 1 if true else 0
*/
@ -123,7 +123,7 @@ int is_http(char *search)
return 0;
}
/*
/*
* is_https(search)
* return 1 if true else 0
*/
@ -146,7 +146,7 @@ int is_https(char *search)
return 0;
}
/*
/*
* is_cid_laquot(search)
* return 1 if true else 0
*/
@ -168,7 +168,7 @@ int is_cid_laquot(char *search)
return 0;
}
/*
/*
* is_cid(search)
* return 1 if true else 0
*/
@ -189,7 +189,7 @@ int is_cid(char *search)
return 0;
}
/*
/*
* is_urn(search)
* return 1 if true else 0
*/
@ -612,7 +612,7 @@ void lost_free_findServiceResponse(p_lost_fsr_t *res)
/*
* lost_get_response_issue(node)
* parses response issue (errors, warnings) and writes
* parses response issue (errors, warnings) and writes
* results to issue object
*/
p_lost_issue_t lost_get_response_issues(xmlNodePtr node)
@ -964,8 +964,8 @@ p_lost_fsr_t lost_parse_findServiceResponse(str ret)
if(doc == NULL) {
LM_ERR("invalid xml document: [%.*s]\n", ret.len, ret.s);
doc = xmlReadMemory(ret.s, ret.len, 0, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_NONET |
XML_PARSE_NOCDATA | XML_PARSE_RECOVER);
XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NOCDATA
| XML_PARSE_RECOVER);
if(doc == NULL) {
LM_ERR("xml document recovery failed on: [%.*s]\n", ret.len, ret.s);
return NULL;
@ -1095,4 +1095,4 @@ int lost_check_HeldResponse(xmlNodePtr node)
xmlFree(tmp); /* clean up */
return ret;
}
}

@ -906,9 +906,9 @@ p_lost_loc_t lost_parse_pidf(str pidf, str urn)
if(doc == NULL) {
LM_WARN("invalid xml (pidf-lo): [%.*s]\n", pidf.len, pidf.s);
doc = xmlReadMemory(pidf.s, pidf.len, 0, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_NONET |
XML_PARSE_NOCDATA | XML_PARSE_RECOVER);
doc = xmlReadMemory(pidf.s, pidf.len, 0, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NOCDATA
| XML_PARSE_RECOVER);
if(doc == NULL) {
LM_ERR("xml (pidf-lo) recovery failed on: [%.*s]\n", pidf.len,
pidf.s);
@ -1007,7 +1007,7 @@ int lost_check_3d(xmlNodePtr node)
/*
* lost_parse_geo(node, loc)
* parses locationResponse (pos|circle) and writes
* parses locationResponse (pos|circle) and writes
* results to location object
*/
int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc)
@ -1047,7 +1047,7 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc)
if(loc->latitude == NULL)
goto err;
snprintf(loc->latitude, len, "%s", (char *)bufLat);
snprintf(loc->latitude, len + 1, "%s", (char *)bufLat);
/* logitude */
len = strlen((char *)bufLon);
@ -1057,7 +1057,7 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc)
goto err;
}
snprintf(loc->longitude, len, "%s", (char *)bufLon);
snprintf(loc->longitude, len + 1, "%s", (char *)bufLon);
/* altitude */
if(scan == 3) {
@ -1070,14 +1070,14 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc)
pkg_free(loc->longitude);
goto err;
}
snprintf(loc->altitude, len, "%s", (char *)bufAlt);
snprintf(loc->altitude, len + 1, "%s", (char *)bufAlt);
}
/* geolocation */
len = strlen((char *)bufLat) + strlen((char *)bufLon) + 1;
if((scan == 3) && (lost_geoloc_3d == 1)) {
len += strlen((char *)bufAlt);
len += strlen((char *)bufAlt) + 1;
}
loc->geodetic = (char *)pkg_malloc(len + 1);
if(loc->geodetic == NULL) {
@ -1089,9 +1089,11 @@ int lost_parse_geo(xmlNodePtr node, p_lost_loc_t loc)
}
if((scan == 3) && (lost_geoloc_3d == 1)) {
s_profile = LOST_PRO_GEO3D;
snprintf(loc->geodetic, len, "%s %s %s", (char *)bufLat, (char *)bufLon, (char *)bufAlt);
snprintf(loc->geodetic, len + 1, "%s %s %s", (char *)bufLat,
(char *)bufLon, (char *)bufAlt);
} else {
snprintf(loc->geodetic, len, "%s %s", (char *)bufLat, (char *)bufLon);
snprintf(loc->geodetic, len + 1, "%s %s", (char *)bufLat,
(char *)bufLon);
}
/* find <radius> element */
@ -1115,7 +1117,7 @@ err:
/*
* lost_xpath_location(doc, path, loc)
* performs xpath expression on locationResponse and writes
* performs xpath expression on locationResponse and writes
* results (location-info child element) to location object
*/
int lost_xpath_location(xmlDocPtr doc, char *path, p_lost_loc_t loc)
@ -1185,7 +1187,7 @@ int lost_xpath_location(xmlDocPtr doc, char *path, p_lost_loc_t loc)
cname = BAD_CAST cur->name;
if(xmlStrcasecmp(cname, s_point) == 0) {
if((lost_check_3d(cur) == 1)
&& (lost_geoloc_3d == 1)) {
&& (lost_geoloc_3d == 1)) {
s_profile = LOST_PRO_GEO3D;
selgeo = i;
break;
@ -1202,15 +1204,15 @@ int lost_xpath_location(xmlDocPtr doc, char *path, p_lost_loc_t loc)
break;
}
if((xmlStrcasecmp(cname, s_polygon) == 0)
|| (xmlStrcasecmp(cname, s_ellipse) == 0)
|| (xmlStrcasecmp(cname, s_arcband) == 0)) {
|| (xmlStrcasecmp(cname, s_ellipse) == 0)
|| (xmlStrcasecmp(cname, s_arcband) == 0)) {
s_profile = LOST_PRO_GEO2D;
selgeo = i;
break;
}
if((xmlStrcasecmp(cname, s_sphere) == 0)
|| (xmlStrcasecmp(cname, s_ellipsoid) == 0)
|| (xmlStrcasecmp(cname, s_prism) == 0)) {
|| (xmlStrcasecmp(cname, s_ellipsoid) == 0)
|| (xmlStrcasecmp(cname, s_prism) == 0)) {
if(lost_geoloc_3d == 1) {
s_profile = LOST_PRO_GEO3D;
selgeo = i;
@ -1417,7 +1419,6 @@ char *lost_held_post_request(int *lgth, long rtime, char *type)
xmlNodePtr ptrLocationRequest = NULL;
xmlNodePtr ptrLocationType = NULL;
xmlKeepBlanksDefault(1);
*lgth = 0;
/*
@ -1515,7 +1516,6 @@ char *lost_held_location_request(p_lost_held_t held, int *lgth)
xmlNodePtr ptrLocationType = NULL;
xmlNodePtr ptrDevice = NULL;
xmlKeepBlanksDefault(1);
*lgth = 0;
/*
@ -1668,8 +1668,6 @@ char *lost_find_service_request(p_lost_loc_t loc, p_lost_list_t path, int *lgth)
xmlNodePtr ptrNode = NULL;
xmlNodePtr ptrPath = NULL;
xmlKeepBlanksDefault(1);
*lgth = 0;
/*

@ -97,7 +97,7 @@ typedef struct lost_loc
char *geodetic; /* geodetic location (findServiceRequest) */
char *longitude; /* geo longitude */
char *latitude; /* geo latitude */
char *altitude; /* geo altitude */
char *altitude; /* geo altitude */
char *profile; /* location profile (findServiceRequest) */
int radius; /* geo radius (findServiceRequest) */
int recursive; /* recursion true|false (findServiceRequest)*/

@ -34,6 +34,12 @@
#include "mongodb_client.h"
#include "api.h"
#if MONGOC_CHECK_VERSION(1, 29, 0)
#define _ksr_bson_as_json bson_as_legacy_extended_json
#else
#define _ksr_bson_as_json bson_as_json
#endif
static mongodbc_server_t *_mongodbc_srv_list = NULL;
static mongodbc_reply_t *_mongodbc_rpl_list = NULL;
@ -246,14 +252,13 @@ int mongodbc_exec_cmd(
mongoc_client_get_collection(rsrv->client, dname->s, cname->s);
LM_DBG("trying to execute: [[%.*s]]\n", cmd->len, cmd->s);
c = cmd->s[cmd->len];
cmd->s[cmd->len] = '\0';
STR_VTOZ(cmd->s[cmd->len], c);
if(!bson_init_from_json(&command, cmd->s, cmd->len, &error)) {
cmd->s[cmd->len] = c;
LM_ERR("Failed to run command: %s\n", error.message);
goto error_exec;
}
cmd->s[cmd->len] = c;
STR_ZTOV(cmd->s[cmd->len], c);
if(emode == 0) {
ret = mongoc_collection_command_simple(
rpl->collection, &command, NULL, &reply, &error);
@ -263,13 +268,29 @@ int mongodbc_exec_cmd(
goto error_exec;
}
bson_destroy(&command);
rpl->jsonrpl.s = bson_as_json(&reply, NULL);
rpl->jsonrpl.s = _ksr_bson_as_json(&reply, NULL);
rpl->jsonrpl.len = (rpl->jsonrpl.s) ? strlen(rpl->jsonrpl.s) : 0;
bson_destroy(&reply);
} else {
if(emode == 1) {
#if MONGOC_CHECK_VERSION(1, 29, 0)
opts = bson_new();
ret = mongoc_collection_command_with_opts(
rpl->collection, &command, NULL, opts, &reply, &error);
bson_free(opts);
if(!ret) {
LM_ERR("Failed to run command: %s\n", error.message);
bson_destroy(&command);
goto error_exec;
}
rpl->jsonrpl.s = _ksr_bson_as_json(&reply, NULL);
rpl->jsonrpl.len = (rpl->jsonrpl.s) ? strlen(rpl->jsonrpl.s) : 0;
bson_destroy(&reply);
goto done;
#else
rpl->cursor = mongoc_collection_command(rpl->collection,
MONGOC_QUERY_NONE, 0, 0, 0, &command, NULL, 0);
#endif
} else {
#if MONGOC_CHECK_VERSION(1, 5, 0)
if(emode == 3)
@ -303,10 +324,14 @@ int mongodbc_exec_cmd(
}
goto error_exec;
}
rpl->jsonrpl.s = bson_as_json(cdoc, NULL);
rpl->jsonrpl.s = _ksr_bson_as_json(cdoc, NULL);
rpl->jsonrpl.len = (rpl->jsonrpl.s) ? strlen(rpl->jsonrpl.s) : 0;
}
#if MONGOC_CHECK_VERSION(1, 29, 0)
done:
#endif
LM_DBG("command result: [[%s]]\n",
(rpl->jsonrpl.s) ? rpl->jsonrpl.s : "<null>");
@ -479,7 +504,7 @@ int mongodbc_next_reply(str *name)
rpl->jsonrpl.s = NULL;
rpl->jsonrpl.len = 0;
}
rpl->jsonrpl.s = bson_as_json(cdoc, NULL);
rpl->jsonrpl.s = _ksr_bson_as_json(cdoc, NULL);
rpl->jsonrpl.len = (rpl->jsonrpl.s) ? strlen(rpl->jsonrpl.s) : 0;
LM_DBG("next cursor result: [[%s]]\n",
(rpl->jsonrpl.s) ? rpl->jsonrpl.s : "<null>");

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

Loading…
Cancel
Save