Update upstream source from tag 'upstream/6.0.2'

Update to upstream version '6.0.2'
with Debian dir 947aecfbcf
pull/12/head
Donat Zenichev 10 months ago
commit 354097cd23

@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.10)
# Set the project name
project(
kamailio
VERSION 6.0.0
VERSION 6.0.2
DESCRIPTION "Kamailio SIP Server"
HOMEPAGE_URL "https://www.kamailio.org")

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@ Kamailio - Doc Folder
=====================
The doc/ folder contains various resource used for generating documentation,
as well as several tutotirals and info files from old times.
as well as several tutorials and info files from old times.
Most of documentation for Kamailio can be found on the website:

@ -256,8 +256,9 @@ struct module_exports exports = {
<note><para>
This mode works only with modules using the SER flavour module
interface. It does not work for &kamailio; modules and it
will probably not work for future sip-router modules. It is
safer and recommended to use instead the
will probably not work for future sip-router modules.
<emphasis>It is now completely obselete.</emphasis>
The correct way is to use instead the
<function>rpc_register_array()</function> function.
</para></note>
</para></listitem>
@ -367,6 +368,36 @@ add("sd", string_param, int_param);
<entry>d</entry>
<entry>int</entry>
</row>
<row>
<entry>Unsigned Integer</entry>
<entry>u</entry>
<entry>int</entry>
</row>
<row>
<entry>Boolean</entry>
<entry>b</entry>
<entry>int</entry>
</row>
<row>
<entry>Long</entry>
<entry>l</entry>
<entry>long</entry>
</row>
<row>
<entry>Unsigned Long</entry>
<entry>j</entry>
<entry>unsigned long</entry>
</row>
<row>
<entry>Long Long</entry>
<entry>L</entry>
<entry>long long</entry>
</row>
<row>
<entry>Unsigned Long Long</entry>
<entry>J</entry>
<entry>unsigned long long</entry>
</row>
<row>
<entry>Float</entry>
<entry>f</entry>
@ -382,6 +413,16 @@ add("sd", string_param, int_param);
<entry>S</entry>
<entry>str*</entry>
</row>
<row>
<entry>time</entry>
<entry>t</entry>
<entry>int</entry>
</row>
<row>
<entry>Struct</entry>
<entry>{</entry>
<entry>struct rpc_struct_l </entry>
</row>
<row>
<entry>Optional modifier</entry>
<entry>*</entry>
@ -395,6 +436,12 @@ add("sd", string_param, int_param);
</tbody>
</tgroup>
</table>
<note>
<para>
The <emphasis>time</emphasis> parameter is of type <emphasis>int</emphasis>. Recent OS use 64-bit time_t (typedef long), so if you are using a 64-bit OS, you should use <emphasis>l</emphasis> or <emphasis>LL</emphasis> instead of <emphasis>t</emphasis> when trying to add/read a time_t value to avoid overflowing.
</para>
</note>
</section>
<section id="rpc.getting_parameters">
@ -867,8 +914,8 @@ static void rpc_register(rpc_t* rpc, void *ctx)
module).
</para></listitem>
<listitem><para>
<emphasis>serweb</emphasis> (php application that can use
the <emphasis>XML-RPC</emphasis> interface to call ser
<emphasis>siremis</emphasis> (php application that can use
the <emphasis>XML-RPC</emphasis> interface to call &kamailioname;
functions).
</para></listitem>
</itemizedlist>

@ -50,7 +50,7 @@
<section id="prerequisities">
<title>Prerequisites</title>
<simpara>
To setup RADIUS support in SIP-router you will need the following:
To set up RADIUS support in SIP-router you will need the following:
</simpara>
<itemizedlist>
<listitem>
@ -620,4 +620,3 @@ libradiusclient.so.0: cannot open shared object file: No such file or directory
</section>
</section>

@ -877,7 +877,7 @@ failure_route[SBC_failure] {
route[NOTIFY]
{
xlog("L_DBG", "IMS: INSIDE NOTIFY\n");
if (reginfo_handle_notify("location")) {
if (reginfo_handle_notify("pcscf_location")) {
send_reply("200", "OK - P-CSCF processed notification");
break;
} else {
@ -931,9 +931,9 @@ event_route[uac:reply] {
xlog(" Unregistering $uac_req(ruri);$var(alias)\n");
setdebug("9");
#!ifdef WITH_IPSEC
ipsec_destroy_by_contact("location", "$uac_req(ruri);$var(alias)", "$(uac_req(ouri){uri.host})", "$(uac_req(ouri){uri.port})");
ipsec_destroy_by_contact("pcscf_location", "$uac_req(ruri);$var(alias)", "$(uac_req(ouri){uri.host})", "$(uac_req(ouri){uri.port})");
#!endif
pcscf_unregister("location", "$uac_req(ruri);$var(alias)", "$(uac_req(ouri){uri.host})", "$(uac_req(ouri){uri.port})");
pcscf_unregister("pcscf_location", "$uac_req(ruri);$var(alias)", "$(uac_req(ouri){uri.host})", "$(uac_req(ouri){uri.port})");
resetdebug();
sht_lock("natping=>natpinglock");
$sht(natping=>$uac_req(ouri)) = $null;
@ -962,7 +962,7 @@ route[preload_pcscf] {
if ($shv(preload_pcscf) == 1) return;
$shv(preload_pcscf) = 1;
sql_query("pcscf", "select aor, received, received_port, received_proto from location;", "resultset");
sql_query("pcscf", "select aor, received, received_port, received_proto from pcscf_location;", "resultset");
xlog("Preloading NAT-PING. Rows: $dbr(resultset=>rows)\n");
if($dbr(resultset=>rows)>0) {
$var(i) = 0;

@ -32,8 +32,8 @@ apk:
sed -e "s/^_gitcommit=.*/_gitcommit=${GIT_TAG}/" \
-e "s/^pkgver=.*/pkgver=${APK_VERSION}/" \
-i alpine/APKBUILD
cd alpine && abuild snapshot
@echo \"abuild\" cannot be started from Makefile please start manually \"cd alpine \&\& abuild -r\"
abuild -C alpine snapshot
@echo \"abuild\" cannot be started from Makefile please start manually \"abuild -C alpine -r\"
# build source rpm package
.PHONY: src.rpm

@ -4,7 +4,7 @@
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=kamailio
pkgver=6.0.1
pkgver=6.0.2
pkgrel=0
# If building from a git snapshot, specify the gitcommit
@ -32,7 +32,7 @@ makedepends="bison db-dev flex freeradius-client-dev expat-dev
net-snmp-dev libuuid libev-dev jansson-dev json-c-dev libevent-dev
linux-headers libmemcached-dev rabbitmq-c-dev hiredis-dev
ruby-dev libmaxminddb-dev libunistring-dev mongo-c-driver-dev
libwebsockets-dev mosquitto-dev librdkafka-dev nghttp2-dev"
libwebsockets-dev mosquitto-dev librdkafka-dev nghttp2-dev libjwt-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

@ -1,3 +1,9 @@
kamailio (6.0.2) unstable; urgency=medium
* version set 6.0.2
-- Victor Seva <vseva@debian.org> Wed, 25 Jun 2025 08:51:11 +0200
kamailio (6.0.1) unstable; urgency=medium
* version set 6.0.1

@ -17,7 +17,7 @@ as a conffile.
* Kamailio setup
----------------
To setup Kamailio, you need to:
To set Kamailio up, you need to:
- configure Kamailio properly to suit your needs
- edit /etc/default/kamailio, adjust the MEMORY parameter and set
RUN_KAMAILIO to "yes"

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

@ -1,5 +1,5 @@
%define name kamailio
%define ver 6.0.1
%define ver 6.0.2
%define rel dev1.0%{dist}
%if 0%{?fedora}
@ -31,42 +31,6 @@
%bcond_without wolfssl
%endif
%if 0%{?rhel} == 7
%if 0%{?centos_ver}
%define dist_name centos
%define dist_version %{?centos}
%define dist .el7.centos
%endif
%if 0%{?centos_ver} == 0
%define dist_name rhel
%define dist_version %{?rhel}
%endif
%bcond_without cnxcc
%bcond_with dnssec
%bcond_without evapi
%bcond_without http_async_client
%bcond_without ims
%bcond_without jansson
%bcond_without json
%bcond_without lua
%bcond_without lwsc
%bcond_without kazoo
%bcond_without memcached
%bcond_without mongodb
%bcond_with nats
%bcond_without perl
%bcond_without phonenum
%bcond_without python2
%bcond_without python3
%bcond_without rabbitmq
%bcond_without redis
%bcond_without ruby
%bcond_without sctp
%bcond_without websocket
%bcond_without xmlrpc
%bcond_without wolfssl
%endif
%if 0%{?rhel} == 8
%if 0%{?centos_ver}
%define dist_name centos
@ -188,11 +152,6 @@
%bcond_without wolfssl
%endif
# build with openssl 1.1.1 on RHEL 7 based dists
%if 0%{?rhel} == 7
%bcond_with openssl11
%endif
# redefine buggy openSUSE Leap _sharedstatedir macro. More info at https://bugzilla.redhat.com/show_bug.cgi?id=183370
%if 0%{?suse_version} == 1315
%define _sharedstatedir /var/lib
@ -252,10 +211,8 @@ Conflicts: kamailio-xhttp-pi < %ver, kamailio-xmlops < %ver
Conflicts: kamailio-xmlrpc < %ver, kamailio-xmpp < %ver
Conflicts: kamailio-uuid < %ver
BuildRequires: bison, flex, which, make, gcc, gcc-c++, pkgconfig, readline-devel
%if 0%{?rhel} != 6
Requires: systemd
BuildRequires: systemd-devel
%endif
%if 0%{?suse_version} == 1315 || 0%{?suse_version} == 1330
Requires: filesystem
@ -281,13 +238,8 @@ like Asterisk™, FreeSWITCH™ or SEMS.
Summary: Account transaction information in a JSON dictionary
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?rhel} == 6
Requires: libevent2
BuildRequires: libevent2-devel
%else
Requires: libevent
BuildRequires: libevent-devel
%endif
%if 0%{?suse_version}
Requires: libjansson
BuildRequires: libjansson-devel
@ -303,14 +255,8 @@ Account transaction information in a JSON dictionary.
%package auth-ephemeral
Summary: Functions for authentication using ephemeral credentials
Group: %{PKGGROUP}
%if 0%{?rhel} == 7 && %{with openssl11}
Requires: openssl11, kamailio = %ver
BuildRequires: openssl11-devel
%else
Requires: openssl, kamailio = %ver
BuildRequires: openssl-devel
%endif
%description auth-ephemeral
Functions for authentication using ephemeral credentials.
@ -333,14 +279,9 @@ Requires: kamailio = %ver
Requires: libdb-4_8
BuildRequires: libdb-4_8-devel
%else
%if 0%{?rhel} == 6
Requires: db4
BuildRequires: db4-devel
%else
Requires: libdb
BuildRequires: libdb-devel
%endif
%endif
%description bdb
Berkeley database connectivity for Kamailio.
@ -390,20 +331,7 @@ CPL (Call Processing Language) interpreter for Kamailio.
Summary: Module to support cryptographic extensions
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?rhel} == 6
Requires: openssl
BuildRequires: openssl-devel
%endif
%if 0%{?rhel} == 7
%if %{with openssl11}
Requires: openssl11-libs
BuildRequires: openssl11-devel
%else
Requires: openssl-libs
BuildRequires: openssl-devel
%endif
%endif
%if 0%{?fedora}
%if 0%{?rhel} || 0%{?fedora}
Requires: openssl-libs
BuildRequires: openssl-devel
%endif
@ -487,13 +415,8 @@ Compressed body (SIP and HTTP) handling for kamailio.
Summary: Async HTTP client module for Kamailio
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?rhel} == 6
Requires: libevent2
BuildRequires: libevent2-devel
%else
Requires: libevent
BuildRequires: libevent-devel
%endif
%if 0%{?suse_version}
Requires: libcurl4
BuildRequires: libcurl-devel
@ -539,13 +462,8 @@ IMS modules and extensions module for Kamailio.
Summary: JSON string handling and RPC modules for Kamailio using JANSSON library
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?rhel} == 6
Requires: libevent2
BuildRequires: libevent2-devel
%else
Requires: libevent
BuildRequires: libevent-devel
%endif
%if 0%{?suse_version}
Requires: libjson-c2
BuildRequires: libjansson-devel
@ -564,13 +482,8 @@ JSON string handling and RPC modules for Kamailio using JANSSON library.
Summary: JSON string handling and RPC modules for Kamailio
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?rhel} == 6
Requires: libevent2
BuildRequires: libevent2-devel
%else
Requires: libevent
BuildRequires: libevent-devel
%endif
%if 0%{?suse_version}
Requires: libjson-c2
BuildRequires: libjson-c-devel
@ -601,13 +514,8 @@ Summary: Kazoo middle layer connector support for Kamailio
Group: %{PKGGROUP}
Requires: libuuid, librabbitmq, json-c, kamailio = %ver
BuildRequires: libuuid-devel, librabbitmq-devel, json-c-devel
%if 0%{?rhel} == 6
Requires: libevent2
BuildRequires: libevent2-devel
%else
Requires: libevent
BuildRequires: libevent-devel
%endif
%description kazoo
Kazoo module for Kamailio.
@ -706,12 +614,8 @@ BuildRequires: zlib-devel
Requires: libmysqlclient18
BuildRequires: libmysqlclient-devel
%else
%if 0%{?rhel} == 6
BuildRequires: mysql-devel
%else
BuildRequires: mariadb-devel
%endif
%endif
%description mysql
MySQL database connectivity for Kamailio.
@ -732,13 +636,8 @@ The module provides an NATS consumer for Kamailio. NATS is a real time distribut
%package outbound
Summary: Outbound (RFC 5626) support for Kamailio
Group: %{PKGGROUP}
%if 0%{?rhel} == 7 && %{with openssl11}
Requires: openssl11, kamailio = %ver
BuildRequires: openssl11-devel
%else
Requires: openssl, kamailio = %ver
BuildRequires: openssl-devel
%endif
%description outbound
RFC 5626, "Managing Client-Initiated Connections in the Session Initiation
@ -846,9 +745,9 @@ RabbitMQ module for Kamailio.
Summary: RADIUS modules for Kamailio
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
Requires: freeradius-client
BuildRequires: freeradius-client-devel
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
Requires: radcli
BuildRequires: radcli-devel
%else
Requires: radiusclient-ng
BuildRequires: radiusclient-ng-devel
@ -922,18 +821,6 @@ Requires: kamailio = %ver
Additional layer of security over our communications.
%package sipcapture-daemon-config
Summary: Reference config for sipcapture daemon
Group: %{PKGGROUP}
Requires: kamailio = %ver
%if 0%{?suse_version}
Requires: filesystem
%endif
%description sipcapture-daemon-config
reference config for sipcapture daemon.
%package sipdump
Summary: This module writes SIP traffic and some associated details into local files
Group: %{PKGGROUP}
@ -1035,13 +922,8 @@ SQLite database connectivity for Kamailio.
%package tls
Summary: TLS transport for Kamailio
Group: %{PKGGROUP}
%if 0%{?rhel} == 7 && %{with openssl11}
Requires: openssl11, kamailio = %ver
BuildRequires: openssl11-devel
%else
Requires: openssl, kamailio = %ver
BuildRequires: openssl-devel
%endif
%description tls
TLS transport for Kamailio.
@ -1107,13 +989,8 @@ Non-SIP utitility functions for Kamailio.
%package websocket
Summary: WebSocket transport for Kamailio
Group: %{PKGGROUP}
%if 0%{?rhel} == 7 && %{with openssl11}
Requires: libunistring, openssl11, kamailio = %ver
BuildRequires: libunistring-devel, openssl11-devel
%else
Requires: libunistring, openssl, kamailio = %ver
BuildRequires: libunistring-devel, openssl-devel
%endif
%description websocket
WebSocket transport for Kamailio.
@ -1185,21 +1062,17 @@ UUID module for Kamailio.
%prep
%setup -n %{name}-%{ver}
# python3 does not exist in RHEL 6 and similar dist.
%if 0%{?rhel} == 6
sed -i -e 's/python3/python2/' utils/kamctl/dbtextdb/dbtextdb.py
%endif
# 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
rm -f misc/examples/pkg/sipcapture.cfg
%build
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
export FREERADIUS=1
export RADCLI=1
%endif
make cfg prefix=/usr \
basedir=%{buildroot} \
@ -1210,11 +1083,8 @@ make cfg prefix=/usr \
make
make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \
jabber ndb_cassandra osp" \
%if %{with openssl11}
SSL_BUILDER="pkg-config libssl11" \
%endif
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
FREERADIUS=1 \
RADCLI=1 \
%endif
%if 0%{?rhel} >= 8
PYTHON3=python3.12 \
@ -1321,11 +1191,8 @@ rm -rf %{buildroot}
make install
make install-modules-all skip_modules="app_mono db_cassandra db_oracle \
iptrtpproxy jabber osp" \
%if %{with openssl11}
SSL_BUILDER="pkg-config libssl11" \
%endif
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
FREERADIUS=1 \
RADCLI=1 \
%endif
%if 0%{?rhel} >= 8
PYTHON3=python3.12 \
@ -1426,34 +1293,19 @@ make install-cfg-pkg
install -d %{buildroot}%{_sharedstatedir}/kamailio
%if "%{?_unitdir}" == ""
# On RedHat 6 like
install -d %{buildroot}%{_var}/run/kamailio
install -d %{buildroot}%{_sysconfdir}/rc.d/init.d
install -m755 pkg/kamailio/obs/kamailio.init \
%{buildroot}%{_sysconfdir}/rc.d/init.d/kamailio
%else
# systemd
install -d %{buildroot}%{_unitdir}
install -Dpm 0644 pkg/kamailio/obs/kamailio.service %{buildroot}%{_unitdir}/kamailio.service
install -Dpm 0644 pkg/kamailio/obs/kamailio@.service %{buildroot}%{_unitdir}/kamailio@.service
install -Dpm 0644 pkg/kamailio/obs/sipcapture.service %{buildroot}%{_unitdir}/sipcapture.service
install -Dpm 0644 pkg/kamailio/obs/kamailio.tmpfiles %{buildroot}%{_tmpfilesdir}/kamailio.conf
install -Dpm 0644 pkg/kamailio/obs/sipcapture.tmpfiles %{buildroot}%{_tmpfilesdir}/sipcapture.conf
%endif
%if 0%{?suse_version}
install -d %{buildroot}%{_fillupdir}
install -m644 pkg/kamailio/obs/kamailio.sysconfig \
%{buildroot}%{_fillupdir}/sysconfig.kamailio
install -m644 pkg/kamailio/obs/sipcapture.sysconfig \
%{buildroot}%{_fillupdir}/sysconfig.sipcapture
%else
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -m644 pkg/kamailio/obs/kamailio.sysconfig \
%{buildroot}%{_sysconfdir}/sysconfig/kamailio
install -m644 pkg/kamailio/obs/sipcapture.sysconfig \
%{buildroot}%{_sysconfdir}/sysconfig/sipcapture
%endif
%if 0%{?suse_version}
@ -1489,13 +1341,6 @@ rm -rf %{buildroot}
%endif
%if "%{?_unitdir}" != ""
%post sipcapture-daemon-config
%tmpfiles_create sipcapture.conf
/usr/bin/systemctl -q enable sipcapture.service
%endif
%preun
if [ $1 = 0 ]; then
%if "%{?_unitdir}" == ""
@ -1829,10 +1674,6 @@ fi
%dir %{_libdir}/kamailio/kamctl/dbtextdb/__pycache__
%{_libdir}/kamailio/kamctl/dbtextdb/__pycache__/*.pyc
%endif
%if 0%{?rhel} == 6 || 0%{?rhel} == 7
%{_libdir}/kamailio/kamctl/dbtextdb/dbtextdb.pyc
%{_libdir}/kamailio/kamctl/dbtextdb/dbtextdb.pyo
%endif
%{_mandir}/man5/*
%{_mandir}/man8/*
@ -2259,20 +2100,6 @@ fi
%{_libdir}/kamailio/modules/rtjson.so
%files sipcapture-daemon-config
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/kamailio/kamailio-sipcapture.cfg
%if 0%{?suse_version}
%{_fillupdir}/sysconfig.sipcapture
%else
%config(noreplace) %{_sysconfdir}/sysconfig/sipcapture
%endif
%if "%{?_unitdir}" != ""
%{_unitdir}/sipcapture.service
%{_tmpfilesdir}/sipcapture.conf
%endif
%if %{with ruby}
%files ruby
%defattr(-,root,root)

@ -1,26 +0,0 @@
[Unit]
Description=Kamailio SIP router server daemon for sipcapture
Wants=network-online.target
After=network-online.target
After=syslog.target
After=auditd.service
After=mysqld.service
[Service]
Type=simple
User=kamailio
Group=kamailio
WorkingDirectory=/run/sipcapture
Environment='CFGFILE=/etc/kamailio/kamailio-sipcapture.cfg'
Environment='SHM_MEMORY=32'
Environment='PKG_MEMORY=4'
EnvironmentFile=-/etc/sysconfig/sipcapture
# PIDFile requires a full absolute path
PIDFile=/run/sipcapture/sipcapture.pid
# ExecStart requires a full absolute path
ExecStart=/usr/sbin/kamailio -DD -P /run/sipcapture/sipcapture.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Restart=on-failure
[Install]
WantedBy=multi-user.target

@ -1,12 +0,0 @@
#
# sipcapture startup options
#
# Amount of shared memory to allocate for the running Kamailio server (in Mb)
#SHM_MEMORY=64
# Amount of per-process (package) memory to allocate for Kamailio (in Mb)
#PKG_MEMORY=4
# sipcapture config file
#CFGFILE=/etc/kamailio/kamailio-sipcapture.cfg

@ -1 +0,0 @@
D /run/sipcapture 0700 kamailio kamailio -

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

@ -42,7 +42,7 @@
#define membar_depends() \
do { \
} while(0) /* really empty, not even a cc bar. */
/* lock barrriers: empty, not needed for NOSMP; the lock/unlock should already
/* lock barriers: empty, not needed for NOSMP; the lock/unlock should already
* contain gcc barriers*/
#define membar_enter_lock() \
do { \

@ -58,7 +58,7 @@
/* memory barriers for lock & unlock where lock & unlock are inline asm
* functions that use atomic ops (and both of them use at least a store to
* the lock). membar_enter_lock() is at most a StoreStore|StoreLoad barrier
* and membar_leave_lock() is at most a LoadStore|StoreStore barries
* and membar_leave_lock() is at most a LoadStore|StoreStore barriers
* (if the atomic ops on the specific architecture imply these barriers
* => these macros will be empty)
* Warning: these barriers don't force LoadLoad ordering between code

@ -374,7 +374,7 @@ inline static long mb_atomic_get_long(volatile long *var)
#endif /* NOSMP */
/* on x86 atomic intructions act also as barriers */
/* on x86 atomic instructions act also as barriers */
#define mb_atomic_inc_int(v) atomic_inc_int(v)
#define mb_atomic_dec_int(v) atomic_dec_int(v)
#define mb_atomic_or_int(v, m) atomic_or_int(v, m)

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

@ -2886,6 +2886,7 @@ fcmd:
case MODULE5_T:
case MODULE6_T:
case MODULEX_T:
case ROUTE_T:
case SET_FWD_NO_CONNECT_T:
case SET_RPL_NO_CONNECT_T:
case SET_FWD_CLOSE_T:

@ -56,7 +56,7 @@
typedef int (*cfg_on_change)(void *, str *, str *, void **);
typedef void (*cfg_on_set_child)(str *, str *);
/*! \brief structrure to be used by the module interface */
/*! \brief structure to be used by the module interface */
typedef struct _cfg_def
{
char *name;

@ -333,7 +333,7 @@ error:
return -1;
}
/* destory a dynamically allocated group definition */
/* destroy a dynamically allocated group definition */
void cfg_script_destroy(cfg_group_t *group)
{
int i;

@ -63,7 +63,7 @@ int cfg_set_script_var(
/* fix-up the dynamically declared group */
int cfg_script_fixup(cfg_group_t *group, unsigned char *block);
/* destory a dynamically allocated group definition */
/* destroy a dynamically allocated group definition */
void cfg_script_destroy(cfg_group_t *group);
#endif /* _CFG_SCRIPT_H */

@ -136,7 +136,7 @@ int cfg_fixup_selects()
*(sel->group_p) = (void *)group;
}
}
/* the select list is not needed anymore */
/* the select list is not needed any more */
cfg_free_selects();
return 0;
}

@ -296,7 +296,7 @@ static void cfg_destory_groups(unsigned char *block)
mapping = group->mapping;
def = mapping ? mapping->def : NULL;
/* destory the shmized strings in the block */
/* destroy the shmized strings in the block */
if(block && def)
for(i = 0; i < group->num; i++)
if(((CFG_VAR_TYPE(&mapping[i]) == CFG_VAR_STRING)
@ -378,7 +378,7 @@ int sr_cfg_init(void)
*cfg_child_cb_last = NULL;
/* A new cfg_child_cb struct must be created with a NULL callback function.
* This stucture will be the entry point for the child processes, and
* This structure will be the entry point for the child processes, and
* will be freed later, when none of the processes refers to it */
*cfg_child_cb_first = *cfg_child_cb_last =
cfg_child_cb_new(NULL, NULL, NULL, 0);
@ -536,7 +536,7 @@ void cfg_child_destroy(void)
cfg_child_cb = cfg_child_cb->next;
atomic_inc(&cfg_child_cb->refcnt);
if(atomic_dec_and_test(&prev_cb->refcnt)) {
/* No more pocess refers to this callback.
/* No more process refers to this callback.
* Did this process block the deletion,
* or is there any other process that has not
* reached prev_cb yet? */

@ -71,7 +71,7 @@ typedef struct _cfg_mapping
/* additional information about the cfg variable */
int pos; /*!< position of the variable within the group starting from 0 */
int offset; /*!< offest within the memory block */
int offset; /*!< offset within the memory block */
unsigned int flag; /*!< flag indicating the state of the variable */
} cfg_mapping_t;
@ -87,7 +87,7 @@ enum
#pragma pack(push, 1)
typedef struct _cfg_group
{
cfg_mapping_t *mapping; /*!< describes the mapping betweeen
cfg_mapping_t *mapping; /*!< describes the mapping between
the cfg variable definition and the memory block */
char *vars; /*!< pointer to the memory block where the values
are stored -- used only before the config is
@ -126,7 +126,7 @@ typedef struct _cfg_group_inst
{
unsigned int id; /*!< identifier of the group instance */
unsigned int set[CFG_MAX_VAR_NUM / (sizeof(int) * 8)];
/*!< Bitmap indicating whether or not a value is explicitely set
/*!< Bitmap indicating whether or not a value is explicitly set
within this instance. If the value is not set,
then the default value is used, and copied into this instance. */
unsigned char vars[1]; /*!< block for the values */
@ -159,7 +159,7 @@ typedef struct _cfg_block
/*! \brief Linked list of per-child process callbacks.
* Each child process has a local pointer, and executes the callbacks
* when the pointer is not pointing to the end of the list.
* Items from the begginning of the list are deleted when the starter
* Items from the beginning of the list are deleted when the starter
* pointer is moved, and no more child process uses them.
*/
typedef struct _cfg_child_cb
@ -211,19 +211,19 @@ extern int cfg_ginst_count;
#define CFG_GROUP_DATA(block, group) \
((unsigned char *)((block)->vars + (group)->var_offset))
/* Test whether a variable is explicitely set in the group instance,
/* Test whether a variable is explicitly set in the group instance,
* or it uses the default value */
#define CFG_VAR_TEST(group_inst, var) \
bit_test((var)->pos % (sizeof(int) * 8), \
(group_inst)->set + (var)->pos / (sizeof(int) * 8))
/* Test whether a variable is explicitely set in the group instance,
/* Test whether a variable is explicitly set in the group instance,
* or it uses the default value, and set the flag. */
#define CFG_VAR_TEST_AND_SET(group_inst, var) \
bit_test_and_set((var)->pos % (sizeof(int) * 8), \
(group_inst)->set + (var)->pos / (sizeof(int) * 8))
/* Test whether a variable is explicitely set in the group instance,
/* Test whether a variable is explicitly set in the group instance,
* or it uses the default value, and reset the flag. */
#define CFG_VAR_TEST_AND_RESET(group_inst, var) \
bit_test_and_reset((var)->pos % (sizeof(int) * 8), \
@ -382,7 +382,7 @@ static inline void cfg_update_local(int no_cbs)
cfg_child_cb = cfg_child_cb->next;
atomic_inc(&cfg_child_cb->refcnt);
if(atomic_dec_and_test(&prev_cb->refcnt)) {
/* No more pocess refers to this callback.
/* No more process refers to this callback.
Did this process block the deletion,
or is there any other process that has not
reached prev_cb yet? */

@ -3898,6 +3898,15 @@ int dns_cache_print_entry(rpc_t *rpc, void *ctx, struct dns_hash_entry *e)
rpc->fault(ctx, 500, "Internal error adding naptr order");
return -1;
}
if(rpc->struct_add(sh, "s", "rr_skip_record",
((struct naptr_rdata *)(rr->rdata))->skip_record
? "yes"
: "no")
< 0) {
rpc->fault(ctx, 500,
"Internal error adding naptr rr_skip_record");
return -1;
}
s.s = ((struct naptr_rdata *)(rr->rdata))->flags;
s.len = ((struct naptr_rdata *)(rr->rdata))->flags_len;
if(rpc->struct_add(sh, "S", "rr_flags", &s) < 0) {
@ -3921,7 +3930,7 @@ int dns_cache_print_entry(rpc_t *rpc, void *ctx, struct dns_hash_entry *e)
}
s.s = ((struct naptr_rdata *)(rr->rdata))->repl;
s.len = ((struct naptr_rdata *)(rr->rdata))->repl_len;
if(rpc->struct_add(sh, "S", "rr_regexp", &s) < 0) {
if(rpc->struct_add(sh, "S", "rr_replacement", &s) < 0) {
rpc->fault(ctx, 500,
"Internal error adding naptre rr_replacement");
return -1;

@ -234,7 +234,7 @@ void dump_hdr_field(struct hdr_field const *const hf)
/**
* free hdr parsed structure using inner free function
* - hdr parsed struct must have as first file a free function,
* so it can be caseted to hf_parsed_t
* so it can be cast to hf_parsed_t
*/
void hdr_free_parsed(void **h_parsed)
{

@ -266,7 +266,7 @@ void dump_hdr_field(struct hdr_field const *const hf);
/**
* free hdr parsed structure using inner free function
* - hdr parsed struct must have as first file a free function,
* so it can be caseted to hf_parsed_t
* so it can be cast to hf_parsed_t
*/
void hdr_free_parsed(void **h_parsed);

@ -52,10 +52,10 @@ int parse_diversion_body(char *buf, int len, diversion_body_t **body)
{
static to_body_t uri_b[NUM_DIVERSION_BODIES]; /* Temporary storage */
int num_uri = 0;
int body_len = 0;
char *tmp;
int i;
to_param_t *params;
to_param_t *lparam;
memset(uri_b, 0, NUM_DIVERSION_BODIES * sizeof(to_body_t));
@ -66,17 +66,27 @@ int parse_diversion_body(char *buf, int len, diversion_body_t **body)
}
/* id.body should contain all info including uri and params */
body_len = uri_b[num_uri].body.len;
/* Loop over all params */
params = uri_b[num_uri].param_lst;
lparam = NULL;
while(params) {
body_len +=
params->name.len + params->value.len + 2; // 2 for '=' and ';'
lparam = params;
params = params->next;
}
uri_b[num_uri].body.len = body_len;
if(lparam) {
if(lparam->value.len > 0) {
uri_b[num_uri].body.len =
lparam->value.s + lparam->value.len - uri_b[num_uri].body.s;
if(*(lparam->value.s - 1) == '"'
|| *(lparam->value.s - 1) == '\'') {
uri_b[num_uri].body.len++;
}
} else {
uri_b[num_uri].body.len =
lparam->name.s + lparam->name.len - uri_b[num_uri].body.s;
}
}
num_uri++;
while(*tmp == ',' && (num_uri < NUM_DIVERSION_BODIES)) {
@ -132,17 +142,25 @@ int parse_diversion_body(char *buf, int len, diversion_body_t **body)
}
/* id.body should contain all info including uri and params */
body_len = uri_b[num_uri].body.len;
/* Loop over all params */
params = uri_b[num_uri].param_lst;
while(params) {
body_len += params->name.len + params->value.len
+ 2; /* 2 for '=' and ';' */
lparam = params;
params = params->next;
}
uri_b[num_uri].body.len = body_len;
if(lparam) {
if(lparam->value.len > 0) {
uri_b[num_uri].body.len = lparam->value.s + lparam->value.len
- uri_b[num_uri].body.s;
if(*(lparam->value.s - 1) == '"'
|| *(lparam->value.s - 1) == '\'') {
uri_b[num_uri].body.len++;
}
} else {
uri_b[num_uri].body.len = lparam->name.s + lparam->name.len
- uri_b[num_uri].body.s;
}
}
num_uri++;
}

@ -330,12 +330,9 @@ int extract_candidate(str *body, sdp_stream_cell_t *stream)
fl = space - start;
start = space + 1;
len = len - (space - start + 1);
if(start + len > body->s + body->len) {
LM_ERR("no component in `a=candidate'\n");
return -1;
}
start = space + 1;
space = memchr(start, 32, len);
if(space == NULL) {
LM_ERR("no component in `a=candidate'\n");
@ -735,7 +732,12 @@ int extract_sess_version(str *oline, str *sess_version)
}
i++;
} while(len < oline->len && i < 3);
} while((cp < oline->s + oline->len) && i < 3);
if(cp == NULL || cp0 == NULL || cp >= oline->s + oline->len) {
LM_ERR("broken o= line - version field not found\n");
return -1;
}
len = cp - cp0 - 1;
LM_DBG("end %d: >%.*s<\n", len, len, cp0);

@ -168,6 +168,7 @@ static int pv_get_defn(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
}
}
/* clang-format off */
/**
*
*/
@ -185,7 +186,9 @@ static pv_export_t core_pvs[] = {
{STR_STATIC_INIT("defn"), PVT_OTHER, pv_get_defn, 0, pv_parse_defn_name,
0, 0, 0},
{{0, 0}, 0, 0, 0, 0, 0, 0, 0}};
{{0, 0}, 0, 0, 0, 0, 0, 0, 0}
};
/* clang-format on */
/**
* register built-in core pvars.

@ -154,7 +154,7 @@ void ksr_module_set_flag(unsigned int flag);
-127 /**< special rank, the context is the main kamailio
process, but this is guaranteed to be executed
before any process is forked, so it can be used
to setup shared variables that depend on some
to set up shared variables that depend on some
after mod_init available information (e.g.
total number of processes).
@warning child_init(PROC_MAIN) is again called
@ -310,7 +310,7 @@ typedef struct module_exports
} module_exports_t;
/** kamailio module exports version coverted for core operations */
/** kamailio module exports version converted for core operations */
typedef struct ksr_module_exports
{
/**< null terminated module name */
@ -347,7 +347,7 @@ typedef struct sr_module
extern sr_module_t *modules; /**< global module list*/
extern response_function *mod_response_cbks; /**< response callback array */
extern int mod_response_cbk_no; /**< size of reponse callbacks array */
extern int mod_response_cbk_no; /**< size of response callbacks array */
int register_builtin_modules(void);
int ksr_load_module(char *path, char *opts);

@ -19,7 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "dprint.h"
#include "route.h"
#include "srapi.h"
@ -69,3 +71,98 @@ sr_cfgenv_t *sr_cfgenv_get(void)
{
return &_sr_cfgenv;
}
/**
*
*/
#define KSR_MSG_ENV_STACK_SIZE 8
static ksr_msg_env_data_t _ksr_msg_env_stack[KSR_MSG_ENV_STACK_SIZE];
static int _ksr_msg_env_stack_idx = 0;
/**
*
*/
int ksr_msg_env_data_destroy(ksr_msg_env_data_t *denv)
{
if(denv == NULL) {
return -1;
}
destroy_avp_list(&denv->avps_uri_from);
destroy_avp_list(&denv->avps_uri_to);
destroy_avp_list(&denv->avps_user_from);
destroy_avp_list(&denv->avps_user_to);
destroy_avp_list(&denv->avps_domain_from);
destroy_avp_list(&denv->avps_domain_to);
xavp_destroy_list(&denv->xavps);
xavp_destroy_list(&denv->xavus);
xavp_destroy_list(&denv->xavis);
return 0;
}
/**
*
*/
int ksr_msg_env_push(ksr_msg_env_links_t *oenv)
{
ksr_msg_env_data_t *senv = NULL;
if(_ksr_msg_env_stack_idx >= KSR_MSG_ENV_STACK_SIZE) {
LM_ERR("msg env stack size exceeded\n");
return -1;
}
senv = &_ksr_msg_env_stack[_ksr_msg_env_stack_idx];
memset(&_ksr_msg_env_stack[_ksr_msg_env_stack_idx], 0,
sizeof(ksr_msg_env_data_t));
oenv->route_type = get_route_type();
oenv->avps_uri_from =
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &senv->avps_uri_from);
oenv->avps_uri_to =
set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &senv->avps_uri_to);
oenv->avps_user_from = set_avp_list(
AVP_TRACK_FROM | AVP_CLASS_USER, &senv->avps_user_from);
oenv->avps_user_to =
set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &senv->avps_user_to);
oenv->avps_domain_from = set_avp_list(
AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &senv->avps_domain_from);
oenv->avps_domain_to = set_avp_list(
AVP_TRACK_TO | AVP_CLASS_DOMAIN, &senv->avps_domain_to);
oenv->xavps = xavp_set_list(&senv->xavps);
oenv->xavus = xavu_set_list(&senv->xavus);
oenv->xavis = xavi_set_list(&senv->xavis);
_ksr_msg_env_stack_idx++;
return 0;
}
/**
*
*/
int ksr_msg_env_pop(ksr_msg_env_links_t *menv)
{
if(_ksr_msg_env_stack_idx <= 0) {
LM_ERR("invalid msg env stack index\n");
return -1;
}
ksr_msg_env_data_destroy(&_ksr_msg_env_stack[_ksr_msg_env_stack_idx - 1]);
set_route_type(menv->route_type);
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, menv->avps_uri_from);
set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, menv->avps_uri_to);
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, menv->avps_user_from);
set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, menv->avps_user_to);
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, menv->avps_domain_from);
set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, menv->avps_domain_to);
xavp_set_list(menv->xavps);
xavu_set_list(menv->xavus);
xavi_set_list(menv->xavis);
_ksr_msg_env_stack_idx--;
return 0;
}

@ -20,6 +20,8 @@
#define __SRAPI_H__
#include "str.h"
#include "usr_avp.h"
#include "xavp.h"
#include "parser/msg_parser.h"
typedef void (*sr_generate_callid_f)(str *);
@ -39,4 +41,36 @@ typedef struct sr_cfgenv
void sr_cfgenv_init(void);
sr_cfgenv_t *sr_cfgenv_get(void);
typedef struct ksr_msg_env_data
{
int route_type;
avp_list_t avps_user_from;
avp_list_t avps_user_to;
avp_list_t avps_domain_from;
avp_list_t avps_domain_to;
avp_list_t avps_uri_from;
avp_list_t avps_uri_to;
sr_xavp_t *xavps;
sr_xavp_t *xavus;
sr_xavp_t *xavis;
} ksr_msg_env_data_t;
typedef struct ksr_msg_env_links
{
int route_type;
avp_list_t *avps_user_from;
avp_list_t *avps_user_to;
avp_list_t *avps_domain_from;
avp_list_t *avps_domain_to;
avp_list_t *avps_uri_from;
avp_list_t *avps_uri_to;
sr_xavp_t **xavps;
sr_xavp_t **xavus;
sr_xavp_t **xavis;
} ksr_msg_env_links_t;
int ksr_msg_env_push(ksr_msg_env_links_t *menv);
int ksr_msg_env_pop(ksr_msg_env_links_t *menv);
int ksr_msg_env_data_destroy(ksr_msg_env_data_t *denv);
#endif

@ -352,6 +352,17 @@ static int init_sock_opt(int s, int af)
}
}
#endif
#ifdef HAVE_TCP_USER_TIMEOUT
if((optval = TICKS_TO_S(cfg_get(tcp, tcp_cfg, send_timeout)))) {
optval *= 1000;
if(setsockopt(s, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval, sizeof(optval))
< 0) {
LM_WARN("failed to set TCP_USER_TIMEOUT: %s\n", strerror(errno));
} else {
LM_DBG("Set TCP_USER_TIMEOUT=%d ms\n", optval);
}
}
#endif
#ifdef HAVE_TCP_QUICKACK
if(cfg_get(tcp, tcp_cfg, delayed_ack)) {
optval = 0; /* reset quick ack => delayed ack */
@ -5564,7 +5575,7 @@ void tcp_timer_check_connections(unsigned int ticks, void *param)
if(n > 0) {
for(i = 0; i < n; i++) {
if((con = tcpconn_get(tcpidlist[i], 0, 0, 0, 0))) {
LM_CRIT("message processing timeout on connection id: %d "
LM_DBG("message processing timeout on connection id: %d "
"(state: %d) - "
"closing\n",
tcpidlist[i], con->state);

@ -348,7 +348,7 @@ int probe_max_send_buffer(int udp_sock)
#ifdef USE_MCAST
/*
* Setup multicast receiver
* Set up multicast receiver
*/
static int setup_mcast_rcvr(
int sock, union sockaddr_union *addr, char *interface)

@ -1030,7 +1030,7 @@ int check_freq_interval(tmrec_t *_trp, ac_tm_t *_atp)
? REC_MATCH
: REC_NOMATCH;
case FREQ_MONTHLY:
_t0 = (_atp->t.tm_year - _trp->ts.tm_year) * 12 + _atp->t.tm_mon
_t0 = 12ULL * (_atp->t.tm_year - _trp->ts.tm_year) + _atp->t.tm_mon
- _trp->ts.tm_mon;
return (_t0 % _trp->interval == 0) ? REC_MATCH : REC_NOMATCH;
case FREQ_YEARLY:
@ -1104,6 +1104,7 @@ int check_min_unit(tmrec_t *_trp, ac_tm_t *_atp, tr_res_t *_tsw)
int check_byxxx(tmrec_t *_trp, ac_tm_t *_atp)
{
int i;
int v;
ac_maxval_t *_amp = NULL;
if(!_trp || !_atp)
return REC_ERR;
@ -1117,9 +1118,12 @@ int check_byxxx(tmrec_t *_trp, ac_tm_t *_atp)
if(_trp->bymonth) {
for(i = 0; i < _trp->bymonth->nr; i++) {
if(_atp->t.tm_mon
== (_trp->bymonth->xxx[i] * _trp->bymonth->req[i] + 12)
% 12)
if(_trp->bymonth->req[i] < 0) {
v = 12 - _trp->bymonth->xxx[i];
} else {
v = _trp->bymonth->xxx[i] - 1;
}
if(_atp->t.tm_mon == v)
break;
}
if(i >= _trp->bymonth->nr)

@ -1310,6 +1310,7 @@ int cscf_get_p_charging_vector(
p = strtok(header_body.s, " ;:\r\t\n\"=");
loop:
if(p == NULL || p > (header_body.s + header_body.len)) {
ims_str_free(header_body, pkg);
return 1;
}

@ -48,7 +48,7 @@
* \brief Helper function for db queries
*
* This method evaluates the actual arguments for the database query and
* setups the string that is used for the query in the db module.
* sets up the string that is used for the query in the db module.
* Then it submits the query and stores the result if necessary. It uses for
* its work the implementation in the concrete database module.
*
@ -59,7 +59,7 @@
* \param _c column names that should be returned
* \param _n number of key/value pairs that are compared, if zero then no comparison is done
* \param _nc number of columns that should be returned
* \param _o order by the specificied column, optional
* \param _o order by the specified column, optional
* \param _r the result that is returned, set to NULL if you want to use fetch_result later
* \param (*val2str) function pointer to the db specific val conversion function
* \param (*submit_query) function pointer to the db specific query submit function
@ -77,7 +77,7 @@ int db_do_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
* \brief Helper function for db queries with update lock
*
* This method evaluates the actual arguments for the database query and
* setups the string that is used for the query in the db module.
* sets up the string that is used for the query in the db module.
* Then it submits the query and stores the result if necessary. It uses for
* its work the implementation in the concrete database module.
*
@ -88,7 +88,7 @@ int db_do_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
* \param _c column names that should be returned
* \param _n number of key/value pairs that are compared, if zero then no comparison is done
* \param _nc number of columns that should be returned
* \param _o order by the specificied column, optional
* \param _o order by the specified column, optional
* \param _r the result that is returned, set to NULL if you want to use fetch_result later
* \param (*val2str) function pointer to the db specific val conversion function
* \param (*submit_query) function pointer to the db specific query submit function
@ -106,7 +106,7 @@ int db_do_query_lock(const db1_con_t *_h, const db_key_t *_k,
* \brief Helper function for raw db queries
*
* This method evaluates the actual arguments for the database raw query
* and setups the string that is used for the query in the db module.
* and sets up the string that is used for the query in the db module.
* Then it submits the query and stores the result if necessary.
* It uses for its work the implementation in the concrete database module.
*
@ -126,7 +126,7 @@ int db_do_raw_query(const db1_con_t *_h, const str *_s, db1_res_t **_r,
* \brief Helper function for db insert operations
*
* This method evaluates the actual arguments for the database operation
* and setups the string that is used for the insert operation in the db
* and sets up the string that is used for the insert operation in the db
* module. Then it submits the query for the operation. It uses for its work
* the implementation in the concrete database module.
*
@ -148,7 +148,7 @@ int db_do_insert(const db1_con_t *_h, const db_key_t *_k, const db_val_t *_v,
* \brief Helper function for db delete operations
*
* This method evaluates the actual arguments for the database operation
* and setups the string that is used for the delete operation in the db
* and sets up the string that is used for the delete operation in the db
* module. Then it submits the query for the operation. It uses for its work
* the implementation in the concrete database module.
*
@ -171,7 +171,7 @@ int db_do_delete(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_o,
* \brief Helper function for db update operations
*
* This method evaluates the actual arguments for the database operation
* and setups the string that is used for the update operation in the db
* and sets up the string that is used for the update operation in the db
* module. Then it submits the query for the operation. It uses for its work
* the implementation in the concrete database module.
*
@ -198,7 +198,7 @@ int db_do_update(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_o,
* \brief Helper function for db delete operations
*
* This helper method evaluates the actual arguments for the database operation
* and setups the string that is used for the replace operation in the db
* and sets up the string that is used for the replace operation in the db
* module. Then it submits the query for the operation. It uses for its work the
* implementation in the concrete database module.
*
@ -220,7 +220,7 @@ int db_do_replace(const db1_con_t *_h, const db_key_t *_k, const db_val_t *_v,
* \brief Helper function for db insert delayed operations
*
* This method evaluates the actual arguments for the database operation
* and setups the string that is used for the insert delayed operation in the db
* and sets up the string that is used for the insert delayed operation in the db
* module. Then it submits the query for the operation. It uses for its work
* the implementation in the concrete database module.
*

@ -288,6 +288,7 @@ void print_internals(void)
printf(" Version: %s\n", full_version);
printf(" Default config: %s\n", CFG_FILE);
printf(" Default paths to modules: %s\n", MODS_DIR);
printf(" Default path to runtime dir: %s\n", RUN_DIR);
printf(" Compile flags: %s\n", ver_flags);
printf(" MAX_RECV_BUFFER_SIZE=%d\n", MAX_RECV_BUFFER_SIZE);
printf(" MAX_SEND_BUFFER_SIZE=%d\n", MAX_SEND_BUFFER_SIZE);

@ -177,6 +177,10 @@ modparam("app_python3", "child_init_method", "my_child_init")
If set to 0, use PyGILState_Ensure()/PyGILState_Release() (the mode
implemented initially).
If set to 1, Python threading Thread objects created in the KEMI script
will be scheduled. Otherwise, additional Python threads will not be
scheduled (no release of GIL).
Default value is “0”.
Example 1.4. Set threads_mode parameter

@ -59,7 +59,7 @@ int _apy_process_rank = 0;
int _ksr_apy3_threads_mode = 0;
PyThreadState *myThreadState = NULL;
__thread PyThreadState *_save = NULL;
PyThreadState *_save = NULL;
/* clang-format off */
/** module parameters */

@ -168,6 +168,10 @@ modparam("app_python3", "child_init_method", "my_child_init")
v6.0.x). If set to 0, use PyGILState_Ensure()/PyGILState_Release()
(the mode implemented initially).
</para>
<para>
If set to 1, Python threading Thread objects created in the KEMI script will be scheduled. Otherwise,
additional Python threads will not be scheduled (no release of GIL).
</para>
<para>
<emphasis>
Default value is <quote>0</quote>.

@ -49,7 +49,7 @@ sr_apy_env_t *sr_apy_env_get()
return &_sr_apy_env;
}
extern __thread PyThreadState *_save;
extern PyThreadState *_save;
extern int _ksr_apy3_threads_mode;
#define LOCK_RELEASE \

@ -174,6 +174,10 @@ def ksr_script_child_init():
If set to 0, use PyGILState_Ensure()/PyGILState_Release() (the mode
implemented initially).
If set to 1, Python threading Thread objects created in the KEMI script
will be scheduled. Otherwise, additional Python threads will not be
scheduled (no release of GIL).
Default value is “0”.
Example 1.4. Set threads_mode parameter

@ -60,7 +60,7 @@ int _apy3s_process_rank = 0;
int _ksr_apy3s_threads_mode = 0;
PyThreadState *myThreadState = NULL;
__thread PyThreadState *_save = NULL;
PyThreadState *_save = NULL;
static int apy3s_script_init_exec(PyObject *pModule, str *fname, int *vparam);

@ -52,7 +52,7 @@ extern str _sr_python_load_file;
extern int _apy3s_process_rank;
extern int _ksr_apy3s_threads_mode;
extern __thread PyThreadState *_save;
extern PyThreadState *_save;
int apy_reload_script(void);
@ -69,8 +69,6 @@ sr_apy_env_t *sr_apy_env_get()
/**
*
*/
extern __thread PyThreadState *_save;
int apy3s_exec_func(sip_msg_t *_msg, char *fname, char *fparam, int emode)
{
PyObject *pFunc, *pArgs, *pValue;

@ -160,6 +160,10 @@ def ksr_script_child_init():
v6.0.x). If set to 0, use PyGILState_Ensure()/PyGILState_Release()
(the mode implemented initially).
</para>
<para>
If set to 1, Python threading Thread objects created in the KEMI script will be scheduled. Otherwise,
additional Python threads will not be scheduled (no release of GIL).
</para>
<para>
<emphasis>
Default value is <quote>0</quote>.

@ -107,7 +107,7 @@ static int update_route_data_recursor(
if(rr->host.s) {
shm_free(rr->host.s);
}
if(opts->new_host.len) {
if(opts->new_host.s && opts->new_host.len) {
if((rr->host.s = shm_malloc(opts->new_host.len + 1))
== NULL) {
SHM_MEM_ERROR;
@ -132,12 +132,10 @@ static int update_route_data_recursor(
FIFO_ERR(E_RESET);
return -1;
}
if(opts->new_host.len > 0) {
if(opts->new_host.s && opts->new_host.len > 0) {
LM_INFO("deactivating host %.*s\n", rr->host.len,
rr->host.s);
if(opts->new_host.s
&& (strcmp(opts->new_host.s, rr->host.s)
== 0)) {
if(strcmp(opts->new_host.s, rr->host.s) == 0) {
LM_ERR("Backup host the same as initial host "
"%.*s",
rr->host.len, rr->host.s);

@ -3,5 +3,6 @@ file(GLOB MODULE_SOURCES "*.c")
add_library(${module_name} SHARED ${MODULE_SOURCES})
find_package(LibXml2 REQUIRED)
find_package(OpenSSL REQUIRED)
target_link_libraries(${module_name} PRIVATE LibXml2::LibXml2)
target_link_libraries(${module_name} PRIVATE LibXml2::LibXml2 OpenSSL::SSL)

@ -52,13 +52,14 @@ Carsten Bock
6. RPC Commands
6.1. cdp.disable_peer
6.2. cdp.enable_peer
6.1. States
6.2. cdp.disable_peer
6.3. cdp.enable_peer
6.4. cdp.list_peers
7. Configuration Examples
7.1. DiameterPeer.xml example
7.2.
2. Developer Guide
@ -147,8 +148,8 @@ Carsten Bock
1.9. Set certificate parameter
1.10. Set ca_list parameter
1.11. cdp_check_peer usage
1.12. cdp_check_peer usage
1.13. cdp_check_peer usage
1.12. cdp_has_app usage
1.13. cdp_has_app usage
1.14. DiameterPeer.xml example
Chapter 1. Admin Guide
@ -182,13 +183,14 @@ Chapter 1. Admin Guide
6. RPC Commands
6.1. cdp.disable_peer
6.2. cdp.enable_peer
6.1. States
6.2. cdp.disable_peer
6.3. cdp.enable_peer
6.4. cdp.list_peers
7. Configuration Examples
7.1. DiameterPeer.xml example
7.2.
1. Overview
@ -238,7 +240,8 @@ Chapter 1. Admin Guide
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* None.
* libxml,
* openssl.
4. Parameters
@ -421,7 +424,7 @@ if(!cdp_check_peer("hss.mnc001.mcc001.3gppnetwork.org")) {
* vendorid - The Vendor ID of the App
application - The Application ID
Example 1.12. cdp_check_peer usage
Example 1.12. cdp_has_app usage
...
if(!cdp_has_app("10415", "4")) {
send_reply("503", "Charging Server not ready");
@ -429,7 +432,7 @@ if(!cdp_has_app("10415", "4")) {
}
...
Example 1.13. cdp_check_peer usage
Example 1.13. cdp_has_app usage
...
if(!cdp_has_app("16777216")) {
send_reply("503", "Cx/Dx Interface not ready");
@ -439,23 +442,43 @@ if(!cdp_has_app("16777216")) {
6. RPC Commands
6.1. cdp.disable_peer
6.2. cdp.enable_peer
6.1. States
6.2. cdp.disable_peer
6.3. cdp.enable_peer
6.4. cdp.list_peers
6.1. States
* Closed (0) - Not connected
* Wait_Conn_Ack (1) - Connecting - waiting for Ack
* Wait_I_CEA (2) - Connecting - waiting for Capabilities Exchange
Answer
* Wait_Conn_Ack_Elect (3) - Connecting - Acknowledged and going for
Election
* Wait_Returns (4) - Connecting - done
* R_Open (5) - Connected as receiver
* I_Open (6) - Connected as initiator
* Closing (7) - Closing the connection
exported RPC commands.
Exported RPC commands.
6.1. cdp.disable_peer
6.2. cdp.disable_peer
instantly disable a particular diameter peer.
6.2. cdp.enable_peer
6.3. cdp.enable_peer
enable/re-enable a diameter peer
6.4. cdp.list_peers
list all configured diameter peers
State details can be found in the list above (Section 6.1, “States”)
7. Configuration Examples
7.1. DiameterPeer.xml example
7.2.
7.1. DiameterPeer.xml example

@ -101,10 +101,10 @@ static void cdp_rpc_list_peers(rpc_t *rpc, void *ctx)
lock_release(i->lock);
return;
}
if(rpc->struct_add(peerdetail_container, "ssd", "State",
if(rpc->struct_add(peerdetail_container, "ssL", "State",
dp_states[(int)i->state], "Disabled",
i->disabled ? "True" : "False", "Last used",
i->last_selected)
TIME_T_CAST(i->last_selected))
< 0) {
rpc->fault(ctx, 500,
"Internal error creating peer detail container struct");

@ -149,16 +149,20 @@ int load_certificates(SSL_CTX *ctx, str *cert, str *key)
}
if(pkg_str_dup(&key_fixed, key) < 0) {
LM_ERR("Failed to copy key parameter\n");
pkg_free(cert_fixed.s);
return -1;
}
if(!SSL_CTX_use_certificate_chain_file(ctx, cert_fixed.s)) {
LM_ERR("Unable to load certificate file\n");
TLS_LM_ERR("load_cert:", ctx);
pkg_free(key_fixed.s);
pkg_free(cert_fixed.s);
return -1;
}
if(SSL_CTX_use_PrivateKey_file(ctx, key_fixed.s, SSL_FILETYPE_PEM) <= 0) {
LM_ERR("Unable to load private key file\n");
TLS_LM_ERR("load_private_key:", ctx);
pkg_free(key_fixed.s);
return -1;
}
if(!SSL_CTX_check_private_key(ctx)) {

@ -82,7 +82,10 @@
<para>The following libraries or applications must be installed before
running &kamailio; with this module loaded: <itemizedlist>
<listitem>
<para><emphasis>None</emphasis>.</para>
<para><emphasis>libxml</emphasis>,</para>
</listitem>
<listitem>
<para><emphasis>openssl</emphasis>.</para>
</listitem>
</itemizedlist></para>
</section>
@ -362,7 +365,7 @@ if(!cdp_check_peer("hss.mnc001.mcc001.3gppnetwork.org")) {
</listitem>
</itemizedlist>
<example>
<title><function>cdp_check_peer</function> usage</title>
<title><function>cdp_has_app</function> usage</title>
<programlisting format="linespecific">
...
if(!cdp_has_app("10415", "4")) {
@ -373,7 +376,7 @@ if(!cdp_has_app("10415", "4")) {
</programlisting>
</example>
<example>
<title><function>cdp_check_peer</function> usage</title>
<title><function>cdp_has_app</function> usage</title>
<programlisting format="linespecific">
...
if(!cdp_has_app("16777216")) {
@ -389,7 +392,20 @@ if(!cdp_has_app("16777216")) {
<section>
<title>RPC Commands</title>
<para>exported RPC commands.</para>
<section id="cdp.states">
<title>States</title>
<itemizedlist id="cdp.cdp_states" title="States">
<listitem><para>Closed (0) - Not connected</para></listitem>
<listitem><para>Wait_Conn_Ack (1) - Connecting - waiting for Ack</para></listitem>
<listitem><para>Wait_I_CEA (2) - Connecting - waiting for Capabilities Exchange Answer</para></listitem>
<listitem><para>Wait_Conn_Ack_Elect (3) - Connecting - Acknowledged and going for Election</para></listitem>
<listitem><para>Wait_Returns (4) - Connecting - done</para></listitem>
<listitem><para>R_Open (5) - Connected as receiver</para></listitem>
<listitem><para>I_Open (6) - Connected as initiator</para></listitem>
<listitem><para>Closing (7) - Closing the connection</para></listitem>
</itemizedlist>
</section>
<para>Exported RPC commands.</para>
<section>
<title>cdp.disable_peer</title>
@ -402,6 +418,14 @@ if(!cdp_has_app("16777216")) {
<para>enable/re-enable a diameter peer</para>
</section>
<section>
<title>cdp.list_peers</title>
<para>list all configured diameter peers</para>
<para>
State details can be found in the list above (<xref linkend="cdp.states" />)
</para>
</section>
</section>
<section>
@ -535,7 +559,5 @@ if(!cdp_has_app("16777216")) {
</programlisting>
</example>
</section>
<section/>
</section>
</chapter>

@ -1050,7 +1050,7 @@ static sr_kemi_t sr_kemi_cfgutils_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("cfgutils"), str_init("lock"),
{ str_init("cfgutils"), str_init("lock_key2"),
SR_KEMIP_INT, cfg_lock_key2,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
@ -1060,7 +1060,7 @@ static sr_kemi_t sr_kemi_cfgutils_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("cfgutils"), str_init("unlock"),
{ str_init("cfgutils"), str_init("unlock_key2"),
SR_KEMIP_INT, cfg_unlock_key2,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
@ -1070,7 +1070,7 @@ static sr_kemi_t sr_kemi_cfgutils_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("cfgutils"), str_init("trylock"),
{ str_init("cfgutils"), str_init("trylock_key2"),
SR_KEMIP_INT, cfg_trylock_key2,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }

@ -2211,6 +2211,7 @@ kamcmd dlg.list_ctx
greater comparison; 'lt' - match using integer lesser comparison.
Integer comparison can be used only with 'start_ts' key.
* mval - matching value.
* limit (optional) - limit of matched dialogs.
RPC Command Format:
...

@ -376,7 +376,8 @@ error:
* DLG_CALLER_LEG (0): caller
* DLG_CALLEE_LEG (1): callee
*/
static inline int send_bye(struct dlg_cell *cell, int dir, str *hdrs)
static inline int send_bye(
struct dlg_cell *cell, int dir, str *hdrs, int enforce)
{
uac_req_t uac_r;
dlg_t *dialog_info;
@ -386,16 +387,15 @@ static inline int send_bye(struct dlg_cell *cell, int dir, str *hdrs)
str lhdrs;
/* dialog is already in deleted state, nothing to do */
if(cell->state == DLG_STATE_DELETED) {
if(cell->state == DLG_STATE_DELETED && enforce == 0) {
LM_WARN("dlg [%u:%u] with callid %.*s already in deleted state, BYE "
"not sent.\n",
cell->h_entry, cell->h_id, cell->callid.len, cell->callid.s);
return 0;
return 1;
}
/* Send Cancel or final response for non-confirmed dialogs */
if(cell->state != DLG_STATE_CONFIRMED_NA
&& cell->state != DLG_STATE_CONFIRMED) {
if(cell->state < DLG_STATE_CONFIRMED_NA) {
if(cell->t) {
if(dir == DLG_CALLER_LEG) {
if(d_tmb.t_reply(cell->t->uas.request, bye_early_code,
@ -407,7 +407,7 @@ static inline int send_bye(struct dlg_cell *cell, int dir, str *hdrs)
LM_DBG("\"%d %.*s\" sent to caller\n", bye_early_code,
bye_early_reason.len, bye_early_reason.s);
} else {
d_tmb.cancel_all_uacs(cell->t, 0);
d_tmb.cancel_all_uacs(cell->t, F_CANCEL_LOCAL);
LM_DBG("CANCEL sent to callee(s)\n");
}
return 0;
@ -425,10 +425,9 @@ static inline int send_bye(struct dlg_cell *cell, int dir, str *hdrs)
goto err;
}
/* safety bump of cseq if prack was involved in call setup */
if(cell->iflags & DLG_IFLAG_PRACK) {
dialog_info->loc_seq.value += 80;
}
/* safety bump of cseq for callee side if prack was involved in call setup
* or keepalives were sent to caller side */
dialog_info->loc_seq.value += 100;
LM_DBG("sending BYE to %s\n",
(dir == DLG_CALLER_LEG) ? "caller" : "callee");
@ -494,7 +493,12 @@ dlg_t *build_dlg_t_early(
goto error;
}
if(msg == NULL || msg->first_line.type != SIP_REPLY) {
if(msg == NULL) {
LM_ERR("no sip message\n");
goto error;
}
if(msg->first_line.type != SIP_REPLY) {
if(!cell->t) {
LM_ERR("no transaction associated\n");
goto error;
@ -784,10 +788,13 @@ int dlg_send_ka(dlg_cell_t *dlg, int dir)
/* tm increases cseq value, decrease it no to make it invalid
* - dialog is ended on timeout (408) or C/L does not exist (481) */
if(di->loc_seq.value > 1)
if(di->loc_seq.value > 1) {
di->loc_seq.value -= 2;
else
di->loc_seq.is_set = DLG_SEQ_VALSET;
} else {
di->loc_seq.value = 0;
di->loc_seq.is_set = DLG_SEQ_VALNEW;
}
LM_DBG("sending OPTIONS to %s\n",
(dir == DLG_CALLER_LEG) ? "caller" : "callee");
@ -843,7 +850,7 @@ int dlg_bye(struct dlg_cell *dlg, str *hdrs, int side)
LM_ERR("failed to build dlg headers\n");
return -1;
}
ret = send_bye(dlg, side, &all_hdrs);
ret = send_bye(dlg, side, &all_hdrs, 0);
pkg_free(all_hdrs.s);
dlg_run_event_route(dlg, NULL, dlg->state, DLG_STATE_DELETED);
@ -864,8 +871,10 @@ int dlg_bye_all(struct dlg_cell *dlg, str *hdrs)
return -1;
}
ret = send_bye(dlg, DLG_CALLER_LEG, &all_hdrs);
ret |= send_bye(dlg, DLG_CALLEE_LEG, &all_hdrs);
ret = send_bye(dlg, DLG_CALLER_LEG, &all_hdrs, 0);
if(ret == 0) {
ret |= send_bye(dlg, DLG_CALLEE_LEG, &all_hdrs, 1);
}
pkg_free(all_hdrs.s);

@ -2848,6 +2848,9 @@ dlg_set_state("early");
<listitem><para>
<emphasis>mval</emphasis> - matching value.
</para></listitem>
<listitem><para>
<emphasis>limit</emphasis> (optional) - limit of matched dialogs.
</para></listitem>
</itemizedlist>
<para>RPC Command Format:</para>
<programlisting format="linespecific">

@ -1,3 +1,14 @@
file(GLOB MODULE_SOURCES "*.c")
add_library(${module_name} SHARED ${MODULE_SOURCES})
find_package(pcre2 QUIET)
if(NOT pcre2_FOUND)
message(STATUS "PCRE2 library not found... looking with pkg-config")
find_package(PkgConfig REQUIRED)
# TODO: verify we want 8-bit libpcre2
pkg_check_modules(pcre2 REQUIRED IMPORTED_TARGET libpcre2-8)
add_library(PCRE2::8BIT ALIAS PkgConfig::pcre2)
endif()
target_link_libraries(${module_name} PRIVATE PCRE2::8BIT)

@ -135,8 +135,8 @@ static int *ds_crt_idx = NULL;
static int *ds_next_idx = NULL;
static ds_set_t *ds_strictest_node = NULL;
static int ds_strictest_idx;
static int ds_strictness;
static int ds_strictest_idx = 0;
static int ds_strictest_match = 0;
#define _ds_list (ds_lists[*ds_crt_idx])
#define _ds_list_nr (*ds_list_nr)
@ -3796,33 +3796,34 @@ int ds_is_addr_from_set(sip_msg_t *_m, struct ip_addr *pipaddr,
if(mode & DS_MATCH_MIXSOCKPRPORT) {
node_strictness = DS_MATCHED_ADDR;
if(node->dlist[j].port) {
if(tport != node->dlist[j].port)
continue;
else
if(tport == node->dlist[j].port) {
node_strictness |= DS_MATCHED_PORT;
}
}
if(node->dlist[j].proto) {
if(tproto != node->dlist[j].proto)
continue;
else
if(tproto == node->dlist[j].proto) {
node_strictness |= DS_MATCHED_PROTO;
}
}
if(node->dlist[j].sock) {
if(node->dlist[j].sock != _m->rcv.bind_address)
continue;
else
if(node->dlist[j].sock == _m->rcv.bind_address) {
node_strictness |= DS_MATCHED_SOCK;
}
}
if(node_strictness
== (DS_MATCHED_ADDR | DS_MATCHED_PORT | DS_MATCHED_PROTO
| DS_MATCHED_SOCK))
| DS_MATCHED_SOCK)) {
ds_strictest_match = node_strictness;
ds_strictest_node = node;
ds_strictest_idx = j;
return ds_set_vars(_m, node, j, export_set_pv);
}
if(ds_strictness < node_strictness) {
ds_strictness = node_strictness;
if(ds_strictest_match < node_strictness) {
ds_strictest_match = node_strictness;
ds_strictest_node = node;
ds_strictest_idx = j;
}
@ -3917,7 +3918,7 @@ int ds_is_addr_from_list(sip_msg_t *_m, int group, str *uri, int mode)
if(mode & DS_MATCH_MIXSOCKPRPORT) {
ds_strictness = 0;
ds_strictest_match = 0;
ds_strictest_node = NULL;
}

@ -692,7 +692,7 @@ void dlgs_update_stats(dlgs_stats_t *stats, int state, int val)
stats->c_confirmed += val;
return;
case DLGS_STATE_TERMINATED:
stats->c_terminted += val;
stats->c_terminated += val;
return;
case DLGS_STATE_NOTANSWERED:
stats->c_notanswered += val;
@ -1046,7 +1046,7 @@ static void dlgs_rpc_stats(rpc_t *rpc, void *ctx)
sta.c_progress += _dlgs_htb->slots[i].astats.c_progress;
sta.c_answered += _dlgs_htb->slots[i].astats.c_answered;
sta.c_confirmed += _dlgs_htb->slots[i].astats.c_confirmed;
sta.c_terminted += _dlgs_htb->slots[i].astats.c_terminted;
sta.c_terminated += _dlgs_htb->slots[i].astats.c_terminated;
sta.c_notanswered += _dlgs_htb->slots[i].astats.c_notanswered;
}
sti = &sta;
@ -1058,7 +1058,7 @@ static void dlgs_rpc_stats(rpc_t *rpc, void *ctx)
}
if(rpc->struct_add(ti, "uuuuuu", "init", sti->c_init, "progress",
sti->c_progress, "answered", sti->c_answered, "confirmed",
sti->c_confirmed, "terminted", sti->c_terminted,
sti->c_confirmed, "terminated", sti->c_terminated,
"notanswered", sti->c_notanswered)
< 0) {
rpc->fault(ctx, 500, "Internal error creating values");
@ -1149,7 +1149,7 @@ static void dlgs_rpc_briefing(rpc_t *rpc, void *ctx)
rpc->fault(ctx, 500, "Internal error creating rpc");
return;
}
if(rpc->struct_add(th, "dSSSuu", "count", ++n, "src", &it->src,
if(rpc->struct_add(th, "dSSSu", "count", ++n, "src", &it->src,
"dst", &it->dst, "callid", &it->callid, "state",
it->state)
< 0) {

@ -43,7 +43,7 @@ typedef struct _dlgs_stats {
unsigned int c_progress;
unsigned int c_answered;
unsigned int c_confirmed;
unsigned int c_terminted;
unsigned int c_terminated;
unsigned int c_notanswered;
} dlgs_stats_t;

@ -964,7 +964,7 @@ int dr_check_freq_interval(dr_tmrec_p _trp, dr_ac_tm_p _atp)
? REC_MATCH
: REC_NOMATCH;
case FREQ_MONTHLY:
_t0 = (_atp->t.tm_year - _trp->ts.tm_year) * 12 + _atp->t.tm_mon
_t0 = 12ULL * (_atp->t.tm_year - _trp->ts.tm_year) + _atp->t.tm_mon
- _trp->ts.tm_mon;
return (_t0 % _trp->interval == 0) ? REC_MATCH : REC_NOMATCH;
case FREQ_YEARLY:

@ -1406,7 +1406,7 @@ static int ki_ht_setxi(
return -1;
}
return 0;
return 1;
}
/**

@ -272,7 +272,7 @@ static int fill_contact(
if((srcip = pkg_malloc(50)) == NULL) {
LM_ERR("Error allocating memory for source IP address\n");
return -1;
goto error;
}
memcpy(srcip, alias_s.s, ci->received_host.len);

@ -348,7 +348,7 @@ int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark)
{
struct hdr_field *first;
struct lump *anchor;
str route;
str route = STR_NULL;
parse_headers(msg, HDR_EOH_F, 0);
first = msg->headers;
@ -367,6 +367,7 @@ int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark)
anchor = anchor_lump(msg, first->name.s - msg->buf, 0, HDR_ROUTE_T);
if(anchor == NULL) {
LM_ERR("isc_mark_write_route: anchor_lump failed\n");
pkg_free(route.s);
return 0;
}

@ -682,7 +682,7 @@ switch ($retcode) {
4.8. reg_fetch_contacts(domain, uri, profile)
The function fetches the contacts for 'uri' from table 'domain' to
pseudo-variable $imssulc(profile) [imssulc = ims scscf ulc].
pseudo-variable $ulc(profile) [ulc = ims scscf ulc].
Meaning of the parameters is as follows:
* domain - Name of table that should be used for the lookup of
@ -690,8 +690,8 @@ switch ($retcode) {
* uri - The SIP URI address of the user which to fetch the contact
addresses for. It can contain pseudo-variables that are evaluated
at runtime.
* profile - Name of $imssulc pseudo-variable profile that will store
the fetched contacts. It is a static string.
* profile - Name of $ulc pseudo-variable profile that will store the
fetched contacts. It is a static string.
This function can be used in REQUEST_ROUTE, FAILURE_ROUTE
@ -709,7 +709,7 @@ reg_fetch_contacts("location", "sip:user@kamailio.org", "caller");
data in that profile.
Meaning of the parameters is as follows:
* profile - Name of $imssulc pseudo-variable profile that stores the
* profile - Name of $ulc pseudo-variable profile that stores the
contacts. It is a static string.
This function can be used in REQUEST_ROUTE, FAILURE_ROUTE

@ -744,7 +744,7 @@ switch ($retcode) {
profile)</function></title>
<para>The function fetches the contacts for 'uri' from table 'domain' to
pseudo-variable $imssulc(profile) [imssulc = ims scscf ulc].</para>
pseudo-variable $ulc(profile) [ulc = ims scscf ulc].</para>
<para>Meaning of the parameters is as follows:</para>
@ -761,7 +761,7 @@ switch ($retcode) {
</listitem>
<listitem>
<para><emphasis>profile</emphasis> - Name of $imssulc
<para><emphasis>profile</emphasis> - Name of $ulc
pseudo-variable profile that will store the fetched contacts. It is
a static string.</para>
</listitem>
@ -793,7 +793,7 @@ reg_fetch_contacts("location", "sip:user@kamailio.org", "caller");
<itemizedlist>
<listitem>
<para><emphasis>profile</emphasis> - Name of $imssulc
<para><emphasis>profile</emphasis> - Name of $ulc
pseudo-variable profile that stores the contacts. It is a static
string.</para>
</listitem>

@ -45,6 +45,7 @@ typedef struct _regpv_profile
str pname;
str domain;
str aor;
str impi;
int flags;
unsigned int aorhash;
int nrc;
@ -121,6 +122,11 @@ static void regpv_free_profile(regpv_profile_t *rpp)
rpp->aor.s = 0;
rpp->aor.len = 0;
}
if(rpp->impi.s != NULL) {
pkg_free(rpp->impi.s);
rpp->impi.s = 0;
rpp->impi.len = 0;
}
rpp->flags = 0;
rpp->aorhash = 0;
@ -245,6 +251,9 @@ int pv_get_ulc(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
case 17: /* count */
return pv_get_sintval(msg, param, res, rpp->nrc);
break;
case 18: /* impi */
return pv_get_strval(msg, param, res, &rpp->impi);
break;
}
return pv_get_null(msg, param, res);
@ -323,6 +332,8 @@ int pv_parse_ulc_name(pv_spec_p sp, str *in)
rp->attr = 4;
else if(strncmp(pa.s, "cseq", 4) == 0)
rp->attr = 9;
else if(strncmp(pa.s, "impi", 4) == 0)
rp->attr = 18;
else
goto error;
break;
@ -437,10 +448,18 @@ int pv_fetch_contacts(
if(res != 0) {
LM_DBG("'%.*s' Not found in usrloc\n", aor.len, ZSW(aor.s));
ul.unlock_udomain((udomain_t *)table, &aor);
return -1;
goto error;
}
rpp->impi.s = (char *)pkg_malloc(r->private_identity.len * sizeof(char));
if(rpp->impi.s == NULL) {
LM_ERR("no mem for impi\n");
goto error;
}
memcpy(rpp->impi.s, r->private_identity.s, r->private_identity.len);
rpp->impi.len = r->private_identity.len;
ptr = 0; //r->contacts;TODO
ptr = r->linked_contacts.head ? r->linked_contacts.head->contact : NULL;
ptr0 = NULL;
n = 0;
while(ptr) {
@ -455,8 +474,8 @@ int pv_fetch_contacts(
goto error;
}
memcpy(c0, ptr, ilen);
//c0->domain = {0,0};//NULL;TODO
//c0->aor = {0,0};//NULL;
c0->domain = (str){NULL, 0};
c0->aor = (str){NULL, 0};
c0->next = NULL;
c0->prev = NULL;

@ -134,7 +134,7 @@ if(!jansson_get("inner.deep.list[3]", "$var(myjson)", "$var(n)")) {
}
xlog("L_INFO", "foo is $var(n)");
...
jansson_get("test", "{\"test\":\"abc\",\"idx\":20}", "$var(n)")
jansson_get("test", "{\"test\":\"abc\",\"idx\":20}", "$var(n)");
...
3.2. jansson_pv_get(key/path, srcvar, dst)

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

Loading…
Cancel
Save