From 70d280148d508b151308b4a7142d14a18ab873db Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Mon, 5 Aug 2013 16:27:43 +0200 Subject: [PATCH 001/159] updated version to 1.10 --- Makefile.defs | 2 +- packaging/debian-lenny/changelog | 48 ++++++++++ packaging/debian/changelog | 7 ++ packaging/fedora/opensips.spec | 2 +- packaging/freebsd/Makefile | 2 +- packaging/gentoo/opensips-1.9.0.ebuild | 126 ------------------------- packaging/netbsd/Makefile | 4 +- packaging/openbsd/Makefile | 2 +- packaging/rpm/opensips.spec.SuSE | 2 +- packaging/solaris/base-pkginfo | 4 +- packaging/solaris/berkeley-pkginfo | 4 +- packaging/solaris/carrierroute-pkginfo | 4 +- packaging/solaris/identity-pkginfo | 4 +- packaging/solaris/ldap-pkginfo | 4 +- packaging/solaris/mmgeoip-pkginfo | 4 +- packaging/solaris/mysql-pkginfo | 4 +- packaging/solaris/perl-pkginfo | 4 +- packaging/solaris/pgsql-pkginfo | 4 +- packaging/solaris/regex-pkginfo | 4 +- packaging/solaris/snmp-pkginfo | 4 +- packaging/solaris/tls-pkginfo | 4 +- packaging/solaris/xmlrpc-pkginfo | 4 +- 22 files changed, 88 insertions(+), 159 deletions(-) delete mode 100644 packaging/gentoo/opensips-1.9.0.ebuild diff --git a/Makefile.defs b/Makefile.defs index 4e7af9057c4..93d51021c6d 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -64,7 +64,7 @@ MAIN_NAME=opensips VERSION = 1 PATCHLEVEL = 10 SUBLEVEL = 0 -EXTRAVERSION = dev +EXTRAVERSION = beta RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) ifneq ($(OPENSIPS_RELEASE),) # allow override thru environment diff --git a/packaging/debian-lenny/changelog b/packaging/debian-lenny/changelog index e311a377c20..029cdca6492 100644 --- a/packaging/debian-lenny/changelog +++ b/packaging/debian-lenny/changelog @@ -1,3 +1,51 @@ +opensips (1.10.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 05 Aug 2013 16:26:40 +0200 + + +opensips (1.9.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Tue, 29 Jan 2013 15:39:34 +0200 + + +opensips (1.8.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 22 Mar 2012 09:00:00 +0200 + + +opensips (1.7.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 12 Jul 2011 09:00:00 +0200 + + +opensips (1.6.0-1) unstable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 15 Oct 2009 09:00:00 +0200 + + +opensips (1.5.0-1) unstable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 21 Mar 2009 09:00:00 +0200 + + +opensips (1.4.0-1) unstable; urgency=low + + * First Public Release. + + -- Bogdan-Andrei Iancu Mon, 21 Jul 2008 09:00:00 +0200 + opensips (1.9.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/debian/changelog b/packaging/debian/changelog index af0c75a99e1..f08324c786b 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,10 @@ +opensips (1.10.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 05 Aug 2013 16:26:40 +0200 + + opensips (1.9.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index 8c3a260aba9..53f4d561944 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -9,7 +9,7 @@ Summary: Open Source SIP Server Name: opensips -Version: 1.9.0 +Version: 1.10.0 Release: 4%{?dist} License: GPLv2+ Group: System Environment/Daemons diff --git a/packaging/freebsd/Makefile b/packaging/freebsd/Makefile index bb58c61ee89..245fe775e68 100644 --- a/packaging/freebsd/Makefile +++ b/packaging/freebsd/Makefile @@ -6,7 +6,7 @@ # PORTNAME= opensips -PORTVERSION= 1.9.0 +PORTVERSION= 1.10.0 CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/${PORTVERSION}/src/ DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src diff --git a/packaging/gentoo/opensips-1.9.0.ebuild b/packaging/gentoo/opensips-1.9.0.ebuild deleted file mode 100644 index 917c9d7e498..00000000000 --- a/packaging/gentoo/opensips-1.9.0.ebuild +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header$ - -inherit eutils - -DESCRIPTION="OpenSIPS - flexible and robust SIP (RFC3261) server" -HOMEPAGE="http://www.opensips.org/" -MY_P="${P}_src" -SRC_URI="http://opensips.org/pub/opensips/${PV}/src/${MY_P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~x86" -IUSE="debug ipv6 mysql postgres radius jabber ssl cpl unixodbc" - -RDEPEND=" - mysql? ( >=dev-db/mysql-4.1.20 ) - radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) - postgres? ( >=dev-db/postgresql-8.0.8 ) - jabber? ( dev-libs/expat ) - ssl? ( dev-libs/openssl ) - cpl? ( dev-libs/libxml2 ) - b2bua? ( dev-libs/libxml2 ) - presence? ( dev-libs/libxml2 ) - unixodbc? ( dev-libs/unixodbc-2.2.6 )" - -inc_mod="" -make_options="" - -pkg_setup() { - use mysql && \ - inc_mod="${inc_mod} db_mysql" - - use postgres && \ - inc_mod="${inc_mod} db_postgres" - - use radius && \ - inc_mod="${inc_mod} aaa_radius peering" - - use jabber && \ - inc_mod="${inc_mod} jabber" - - use cpl && \ - inc_mod="${inc_mod} cpl-c" - - use b2bua && \ - inc_mod="${inc_mod} b2b_entities b2bua_logic" - - use presence && \ - inc_mod="${inc_mod} presence presence_dialoginfo presence_mwi presence_xcapdiff presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp rls xcap xcap_client" - - use unixodbc && \ - inc_mod="${inc_mod} db_unixodbc" - - export inc_mod -} - -src_unpack() { - unpack ${MY_P}.tar.gz - - cd ${S} - use ipv6 || \ - sed -i -e "s/-DUSE_IPV6//g" Makefile.defs -} - -src_compile() { - local compile_options - - pkg_setup - - # optimization can result in strange debuging symbols so omit it in case - if use debug; then - compile_options="${compile_options} mode=debug" - else - compile_options="${compile_options} CFLAGS=${CFLAGS}" - fi - - if use ssl; then - compile_options="TLS=1 ${compile_options}" - fi - - emake all "${compile_options}" \ - prefix=${ROOT}/ \ - include_modules="${inc_mod}" \ - cfg-prefix=${ROOT}/ \ - cfg-target=${ROOT}/etc/opensips/ || die -} - -src_install () { - local install_options - - emake install \ - prefix=${D}/ \ - include_modules="${inc_mod}" \ - bin-prefix=${D}/usr/sbin \ - bin-dir="" \ - cfg-prefix=${D}/etc \ - cfg-dir=opensips/ \ - cfg-target=${D}/etc/opensips \ - modules-prefix=${D}/usr/lib/opensips \ - modules-dir=modules \ - modules-target=${D}/usr/lib/opensips/modules/ \ - man-prefix=${D}/usr/share/man \ - man-dir="" \ - doc-prefix=${D}/usr/share/doc \ - doc-dir=${PF} || die - exeinto /etc/init.d - newexe ${FILESDIR}/opensips.init opensips - - # fix what the Makefile don't do - use mysql || \ - rm ${D}/usr/sbin/opensips_mysql.sh -} - -pkg_postinst() { - einfo "WARNING: If you upgraded from a previous OpenSIPS version" - einfo "please read the README, NEWS and INSTALL files in the" - einfo "documentation directory because the database and the" - einfo "configuration file of old OpenSIPS versions are incompatible" - einfo "with the current version." -} - -pkg_prerm () { - ${D}/etc/init.d/opensips stop >/dev/null -} diff --git a/packaging/netbsd/Makefile b/packaging/netbsd/Makefile index 5fcb512ed56..4155db2dc0b 100644 --- a/packaging/netbsd/Makefile +++ b/packaging/netbsd/Makefile @@ -8,9 +8,9 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.9.0-notls +PORTVERSION= 1.10.0-notls CATEGORIES= net -MASTER_SITES= http://opensips.org/pub/opensips/1.9.0/src/ +MASTER_SITES= http://opensips.org/pub/opensips/1.10.0/src/ MAINTAINER= bogdan@opensips.org diff --git a/packaging/openbsd/Makefile b/packaging/openbsd/Makefile index 6a6c6744eab..a339449ed92 100644 --- a/packaging/openbsd/Makefile +++ b/packaging/openbsd/Makefile @@ -8,7 +8,7 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.9.0-notls +PORTVERSION= 1.10.0-notls CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/1.6.0/src/ diff --git a/packaging/rpm/opensips.spec.SuSE b/packaging/rpm/opensips.spec.SuSE index a696ed80949..8a8e8deafda 100644 --- a/packaging/rpm/opensips.spec.SuSE +++ b/packaging/rpm/opensips.spec.SuSE @@ -1,5 +1,5 @@ %define name opensips -%define ver 1.9.0 +%define ver 1.10.0 %define rel 0 %define EXCLUDED_MODULES aaa_radius b2b_entities b2b_logic db_http json memcached jabber cpl-c xmpp rls mi_xmlrpc xcap_client db_mysql db_postgres db_unixodbc db_oracle db_berkeley osp perl snmpstats db_perlvdb peering carrierroute mmgeoip presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap xcap_client ldap h350 identity regex diff --git a/packaging/solaris/base-pkginfo b/packaging/solaris/base-pkginfo index 118ad79fe4f..11d9b5dfca6 100644 --- a/packaging/solaris/base-pkginfo +++ b/packaging/solaris/base-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-dbg" NAME="Programmable SIP Server Base Install - Debugging Symbols" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="bogdan@opensips.org" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/berkeley-pkginfo b/packaging/solaris/berkeley-pkginfo index b9d2ca0de0b..23811808cdb 100644 --- a/packaging/solaris/berkeley-pkginfo +++ b/packaging/solaris/berkeley-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-berkeley-dbg" NAME="Programmable SIP Server Berkeley Database Support - Debugging Symbols" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/carrierroute-pkginfo b/packaging/solaris/carrierroute-pkginfo index 238715d89fc..6de1b51d38e 100644 --- a/packaging/solaris/carrierroute-pkginfo +++ b/packaging/solaris/carrierroute-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-carrierroute" NAME="Programmable SIP Server carrierroute Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/identity-pkginfo b/packaging/solaris/identity-pkginfo index 29d5c537627..ec12bc24bab 100644 --- a/packaging/solaris/identity-pkginfo +++ b/packaging/solaris/identity-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-identity" NAME="Programmable SIP Server Identity Module" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/ldap-pkginfo b/packaging/solaris/ldap-pkginfo index 4bf5300966d..54ae26f6282 100644 --- a/packaging/solaris/ldap-pkginfo +++ b/packaging/solaris/ldap-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-ldap" NAME="Programmable SIP Server LDAP Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mmgeoip-pkginfo b/packaging/solaris/mmgeoip-pkginfo index 89d68acabe6..9e6b1b42977 100644 --- a/packaging/solaris/mmgeoip-pkginfo +++ b/packaging/solaris/mmgeoip-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-geoip" NAME="Programmable SIP Server Address Location Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mysql-pkginfo b/packaging/solaris/mysql-pkginfo index b7b2fd47527..6334b38b9ee 100644 --- a/packaging/solaris/mysql-pkginfo +++ b/packaging/solaris/mysql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-mysql" NAME="Programmable SIP Server MySQL Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/perl-pkginfo b/packaging/solaris/perl-pkginfo index 1bc03424a75..8f33bf434d2 100644 --- a/packaging/solaris/perl-pkginfo +++ b/packaging/solaris/perl-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-perl" NAME="Programmable SIP Server PERL Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/pgsql-pkginfo b/packaging/solaris/pgsql-pkginfo index 644b1b68b04..e60e9e78bea 100644 --- a/packaging/solaris/pgsql-pkginfo +++ b/packaging/solaris/pgsql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-pgsql" NAME="Programmable SIP Server PostgreSQL Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/regex-pkginfo b/packaging/solaris/regex-pkginfo index 91466faca7e..5aa45b34b3c 100644 --- a/packaging/solaris/regex-pkginfo +++ b/packaging/solaris/regex-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-regex" NAME="Programmable SIP Server Regex Module" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/snmp-pkginfo b/packaging/solaris/snmp-pkginfo index 4de0cd09acb..6f25bb0ce9c 100644 --- a/packaging/solaris/snmp-pkginfo +++ b/packaging/solaris/snmp-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-snmp" NAME="Programmable SIP Server SNMP Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/tls-pkginfo b/packaging/solaris/tls-pkginfo index 33efd9f0598..c5374336847 100644 --- a/packaging/solaris/tls-pkginfo +++ b/packaging/solaris/tls-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-TLS" NAME="Programmable SIP Server Base Install with TLS" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/xmlrpc-pkginfo b/packaging/solaris/xmlrpc-pkginfo index f58c52b2e3f..2834a4ba290 100644 --- a/packaging/solaris/xmlrpc-pkginfo +++ b/packaging/solaris/xmlrpc-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-xmlrpc" NAME="Programmable SIP Server MI XMLRPC Support" -VERSION="1.9.0-notls" +VERSION="1.10.0-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="05thAug13" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" From a0310140a614c71c96a0e3cc9edf5d815a4b0999 Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Tue, 6 Aug 2013 01:02:45 +0200 Subject: [PATCH 002/159] wrong mpath folder (detected by rpmbuild) --- modules/osp/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/osp/Makefile b/modules/osp/Makefile index ce11371f44f..b1a2c3b313c 100644 --- a/modules/osp/Makefile +++ b/modules/osp/Makefile @@ -1,4 +1,3 @@ - # osp module makefile # WARNING: do not run this directly, it should be run by the master Makefile @@ -33,7 +32,7 @@ include ../../Makefile.modules install_module_custom: echo "OSP module overwrites the default configuration file" sed \ - -e "s#/usr/local/lib/opensips#$(modules-prefix)/$(lib-dir)#g" \ + -e "s#/usr/local/lib/opensips#$(modules-target)/$(lib-dir)#g" \ < etc/sample-osp-opensips.cfg \ > $(cfg-prefix)/$(cfg-dir)/opensips.cfg From 5af905eb5abc5593671aacde90a808ab5d5758de Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Tue, 6 Aug 2013 01:12:56 +0200 Subject: [PATCH 003/159] Update to 1.10 Some new rpm optional modules are added: mi_xmlrpc_ng,sngtc,db_cachedb,mathops,rest_client --- packaging/rpm/opensips.spec.CentOS | 50 ++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/packaging/rpm/opensips.spec.CentOS b/packaging/rpm/opensips.spec.CentOS index b51f633f5c7..bdf3a5a0a1b 100644 --- a/packaging/rpm/opensips.spec.CentOS +++ b/packaging/rpm/opensips.spec.CentOS @@ -1,6 +1,6 @@ %define name opensips -%define ver 1.9.1 -%define rel 5 +%define ver 1.10.0 +%define rel 1 %define _sharedir %{_prefix}/share Summary: OpenSIPS, very fast and flexible SIP Server @@ -270,6 +270,17 @@ This module implements a xmlrpc server that handles xmlrpc requests and generate When a xmlrpc message is received a default method is executed. +%package mi_xmlrpc_ng +Summary: opensips mi_xmlrpc_ng implementation. +Group: System Environment/Daemons +Requires: opensips = %ver +BuildRequires: xmlrpc-c-devel + +%description mi_xmlrpc_ng +This module implements a xmlrpc_ng server that handles xmlrpc_ng requests and generates xmlrpc_ng responses. +When a xmlrpc_ng message is received a default method is executed. + + %package db_http Summary: opensips db_http implementation. Group: System Environment/Daemons @@ -337,6 +348,15 @@ The Perl Virtual Database (VDB) provides a virtualization framework for OpenSIPS's database access. It does not handle a particular database engine itself but lets the user relay database requests to arbitrary Perl functions. +%package sngtc +Summary: Sangoma media transcoding interface for the OpenSIPS +Group: System Environment/Daemons +Requires: opensips = %ver + +%description sngtc +The sngtc package implements interface to Sangoma media transcoding. + + %package tlsops Summary: TLS-relating functions for the OpenSIPS Group: System Environment/Daemons @@ -353,7 +373,7 @@ parameters. %setup -n %{name}-%{ver}-tls %build -make all exclude_modules="" ORAVERSION=11.2/client cfg-target=/%{_sysconfdir}/opensips/ +make all exclude_modules="" ORAVERSION=11.2/client cfg-target=%{_sysconfdir}/opensips/ %install @@ -410,6 +430,7 @@ fi %doc %{_docdir}/opensips/README.cfgutils %doc %{_docdir}/opensips/README.closeddial %doc %{_docdir}/opensips/README.db_flatstore +%doc %{_docdir}/opensips/README.db_cachedb %doc %{_docdir}/opensips/README.db_text %doc %{_docdir}/opensips/README.db_virtual %doc %{_docdir}/opensips/README.dialog @@ -430,6 +451,7 @@ fi %doc %{_docdir}/opensips/README.load_balancer %doc %{_docdir}/opensips/README.lua %doc %{_docdir}/opensips/README.mangler +%doc %{_docdir}/opensips/README.mathops %doc %{_docdir}/opensips/README.maxfwd %doc %{_docdir}/opensips/README.mediaproxy %doc %{_docdir}/opensips/README.mi_datagram @@ -449,6 +471,7 @@ fi %doc %{_docdir}/opensips/README.qos %doc %{_docdir}/opensips/README.ratelimit %doc %{_docdir}/opensips/README.registrar +%doc %{_docdir}/opensips/README.rest_client %doc %{_docdir}/opensips/README.rr %doc %{_docdir}/opensips/README.rtpproxy %doc %{_docdir}/opensips/README.seas @@ -494,6 +517,7 @@ fi %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/cfgutils.so %{_libdir}/opensips/modules/closeddial.so +%{_libdir}/opensips/modules/db_cachedb.so %{_libdir}/opensips/modules/db_flatstore.so %{_libdir}/opensips/modules/db_text.so %{_libdir}/opensips/modules/db_virtual.so @@ -515,6 +539,7 @@ fi %{_libdir}/opensips/modules/load_balancer.so %{_libdir}/opensips/modules/lua.so %{_libdir}/opensips/modules/mangler.so +%{_libdir}/opensips/modules/mathops.so %{_libdir}/opensips/modules/maxfwd.so %{_libdir}/opensips/modules/mediaproxy.so %{_libdir}/opensips/modules/mi_datagram.so @@ -535,6 +560,7 @@ fi %{_libdir}/opensips/modules/qos.so %{_libdir}/opensips/modules/ratelimit.so %{_libdir}/opensips/modules/registrar.so +%{_libdir}/opensips/modules/rest_client.so %{_libdir}/opensips/modules/rr.so %{_libdir}/opensips/modules/rtpproxy.so %{_libdir}/opensips/modules/seas.so @@ -790,6 +816,13 @@ fi %{_libdir}/opensips/modules/mi_xmlrpc.so +%files mi_xmlrpc_ng +%defattr(-,root,root) +%doc %{_docdir}/opensips/README.mi_xmlrpc_ng + +%{_libdir}/opensips/modules/mi_xmlrpc_ng.so + + %files db_http %defattr(-,root,root) %doc %{_docdir}/opensips/README.db_http @@ -856,6 +889,13 @@ fi %{_libdir}/opensips/perl/OpenSIPS/VDB/VTab.pm %{_libdir}/opensips/perl/OpenSIPS/VDB/Value.pm +%files sngtc +%defattr(-,root,root,-) +%doc %{_docdir}/opensips/README.sngtc + +%{_libdir}/opensips/modules/sngtc.so + + %files tlsops %defattr(-,root,root,-) %doc %{_docdir}/opensips/README.tlsops @@ -863,6 +903,10 @@ fi %{_libdir}/opensips/modules/tlsops.so +%changelog +* Tue Aug 06 2013 Fabrizio Picconi +- Some new rpm optional modules are added: + mi_xmlrpc_ng,sngtc,db_cachedb,mathops,rest_client %changelog * Sun Jul 21 2013 Fabrizio Picconi - Some new rpm optional modules are added: From 4bce0cbab19d18d321b5a7b0a8dcaf2bdad8a7ad Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Tue, 6 Aug 2013 13:59:28 -0500 Subject: [PATCH 004/159] Fixed goes_to_gw, is_from_gw and dr_is_gw so that they accept negative gateway types ( to match all gw types) (cherry picked from commit 3bfd505b72d46ea31930efe31b52e3bd5ea477de) --- mod_fix.c | 4 ++-- mod_fix.h | 3 ++- modules/drouting/drouting.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mod_fix.c b/mod_fix.c index 22bbdb5dd70..e118f21723a 100644 --- a/mod_fix.c +++ b/mod_fix.c @@ -203,7 +203,6 @@ int fixup_uint_uint(void** param, int param_no) return fixup_uint(param); } -#if 0 /*! \brief * - helper function * Convert char* parameter to signed int @@ -220,7 +219,7 @@ int fixup_sint( void** param) if(str2sint(&s, &si)==0) { pkg_free(*param); - *param=(void *)si; + *param=(void *)(unsigned long)si; return 0; } LM_ERR("bad number <%s>\n", (char *)(*param)); @@ -256,6 +255,7 @@ int fixup_sint_sint(void** param, int param_no) return fixup_sint(param); } +#if 0 /*! \brief * fixup for functions that get two parameters * - first parameter is converted to signed int diff --git a/mod_fix.h b/mod_fix.h index 4b28ac983dc..e9e6512ddb3 100644 --- a/mod_fix.h +++ b/mod_fix.h @@ -58,9 +58,9 @@ int fixup_free_str_str(void** param, int param_no); int fixup_uint_null(void** param, int param_no); int fixup_uint_uint(void** param, int param_no); -#if 0 int fixup_sint_null(void** param, int param_no); int fixup_sint_sint(void** param, int param_no); +#if 0 int fixup_sint_uint(void** param, int param_no); int fixup_uint_sint(void** param, int param_no); #endif @@ -102,6 +102,7 @@ int fixup_spve(void** param); int fixup_pvar(void **param); int fixup_str(void **param); int fixup_uint(void** param); +int fixup_sint(void** param); int fixup_igp(void** param); int fixup_sgp(void** param); diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c index 01b365021ba..612b8a70267 100644 --- a/modules/drouting/drouting.c +++ b/modules/drouting/drouting.c @@ -1956,7 +1956,7 @@ static int fixup_from_gw( void** param, int param_no) { if (param_no == 1) { /* GW type*/ - return fixup_uint(param); + return fixup_sint(param); } else if (param_no == 2) { /* GW ops */ return fixup_spve(param); @@ -1971,7 +1971,7 @@ static int fixup_is_gw( void** param, int param_no) return fixup_pvar(param); } else if (param_no == 2) { /* GW type*/ - return fixup_uint(param); + return fixup_sint(param); } else if (param_no == 3) { /* GW ops */ return fixup_spve(param); From 3509fc970af9d8dd1eb48e775bf16339cc6a2a8b Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Tue, 6 Aug 2013 15:02:00 -0500 Subject: [PATCH 005/159] =?UTF-8?q?Properly=20mentioned=20Steve=20Fr=C3=A9?= =?UTF-8?q?cinaux=20from=20Be=20IP=20as=20the=20module=20creator=20(cherry?= =?UTF-8?q?=20picked=20from=20commit=208f642bab2a47f29c2984f286279f5be4d0d?= =?UTF-8?q?5815a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/cachedb_sql/cachedb_sql.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/cachedb_sql/cachedb_sql.c b/modules/cachedb_sql/cachedb_sql.c index afb76efc6c3..e077ea5eea5 100644 --- a/modules/cachedb_sql/cachedb_sql.c +++ b/modules/cachedb_sql/cachedb_sql.c @@ -1,5 +1,7 @@ /* - * Copyright (C) 2011 OpenSIPS Solutions + * Copyright (C) 2013 Steve Frécinaux + * Be IP s.a. http://www.beip.be + * Copyright (C) 2013 OpenSIPS Solutions * * This file is part of opensips, a free SIP server. * @@ -20,7 +22,8 @@ * * history: * --------- - * 2013-01-xx created (vlad-paiu) + * 2013-01-xx created (Steve Frécinaux) + * 2013-01-xx improved implementation of cachedb (vlad-paiu) */ @@ -293,7 +296,9 @@ static int dbcache_add(cachedb_con *con, str *attr, int val, int expires, int *n else expires = 0; - i = snprintf(query_buf, sizeof(query_buf), "insert into %.*s (%.*s, %.*s, %.*s) values ('%.*s', %d, %d) on duplicate key update %.*s=%.*s %c %d, %.*s=%d", + i = snprintf(query_buf, sizeof(query_buf), + "insert into %.*s (%.*s, %.*s, %.*s) values ('%.*s', %d, %d)" + "on duplicate key update %.*s=%.*s %c %d, %.*s=%d", db_table.len, db_table.s, key_column.len, key_column.s, counter_column.len, counter_column.s, From 4626525912baea2942fdaa40f737baae5fcd73ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 7 Aug 2013 11:25:57 +0200 Subject: [PATCH 006/159] Fixed crash if send_subscribe fails early In that case presentity is still NULL, check for it (cherry picked from commit 6e3b16ec6d3fe59b5a1b415b548394be401e69af) --- modules/pua/send_subscribe.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/pua/send_subscribe.c b/modules/pua/send_subscribe.c index a886ccfba3b..b0a1f53dbc3 100644 --- a/modules/pua/send_subscribe.c +++ b/modules/pua/send_subscribe.c @@ -564,8 +564,13 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) error: if(hentity) { - if(presentity->extra_headers.s) shm_free(presentity->extra_headers.s); - if(presentity->remote_contact.s) shm_free(presentity->remote_contact.s); + if(presentity) + { + if(presentity->extra_headers.s) + shm_free(presentity->extra_headers.s); + if(presentity->remote_contact.s) + shm_free(presentity->remote_contact.s); + } shm_free(hentity); hentity= NULL; } From 09757cef7b21b39ab6b97cdc9cd79c39f4f5a840 Mon Sep 17 00:00:00 2001 From: saghul Date: Wed, 7 Aug 2013 17:59:20 +0200 Subject: [PATCH 007/159] Cleanup menucnfig files when doing make proper (cherry picked from commit 4d4d3dbefc084db00c122e499b9299240ed6e0d5) --- Makefile.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.rules b/Makefile.rules index f06de41e319..c21b53590f9 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -100,6 +100,7 @@ proper realclean distclean: clean $(MAKE) -C $$r proper ; \ fi ; \ done + -@if [ -d menuconfig ]; then $(MAKE) -C menuconfig proper; fi -@if [ -d utils/opensipsunix ]; then $(MAKE) -C utils/opensipsunix proper; fi -@if [ -d utils/db_berkeley ]; then $(MAKE) -C utils/db_berkeley proper; fi -@if [ -d utils/db_oracle ]; then $(MAKE) -C utils/db_oracle proper; fi From 314537bf44fc4d4be99f628e476a68f676c3419b Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Thu, 8 Aug 2013 15:35:03 +0200 Subject: [PATCH 008/159] remove warning compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove warning: ‘ret’ may be used uninitialized in this function --- tcp_read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp_read.c b/tcp_read.c index ad968374dc6..641529cd6e8 100644 --- a/tcp_read.c +++ b/tcp_read.c @@ -935,7 +935,7 @@ void tcp_receive_loop(int unix_sock) */ inline static int handle_io(struct fd_map* fm, int idx,int event_type) { - int ret; + int ret=0; int n; struct tcp_connection* con; int s,rw; From 5d253f87babedfddd85834cb27dafde71bcb75b7 Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Thu, 8 Aug 2013 17:21:28 +0200 Subject: [PATCH 009/159] parallel compilation speeduo compilation on multicore/multicpu machines --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e6e167327f3..5c87f675a02 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ modules: if [ -d "$$r" ]; then \ echo "" ; \ echo "" ; \ - $(MAKE) -C $$r ; \ + $(MAKE) -j -C $$r ; \ fi ; \ fi ; \ done From 33134feaa38a9fb376dea97eb7711cdd5aced758 Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Thu, 8 Aug 2013 17:33:09 +0200 Subject: [PATCH 010/159] parallel compilation speedup compilation on multicore/multicpu machines --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e6e167327f3..5c87f675a02 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ modules: if [ -d "$$r" ]; then \ echo "" ; \ echo "" ; \ - $(MAKE) -C $$r ; \ + $(MAKE) -j -C $$r ; \ fi ; \ fi ; \ done From 50b3436afeb7885a7d07356fe3de371482f3d600 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Tue, 6 Aug 2013 17:11:24 -0500 Subject: [PATCH 011/159] Fixed warning Fixed compilation error for libcurl < 7.16.2 ( due to CURLOPT_TIMEOUT_MS ) (cherry picked from commit 1ee176a5fadb872cc5015141a118f0398bcb1f8f) --- modules/db_http/http_dbase.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/db_http/http_dbase.c b/modules/db_http/http_dbase.c index d416d777406..ebab7abbe11 100644 --- a/modules/db_http/http_dbase.c +++ b/modules/db_http/http_dbase.c @@ -456,7 +456,7 @@ int form_result(var_str buff, db_res_t** r) db_res_t * res; char * cur, * dest, * start, * end; int col_count, cur_col, line_count, cur_line, delim_count, len; - int state, next, first_line, consume; + int state, next, consume; LM_DBG("Called with : %.*s\n",buff.len,buff.s); @@ -559,7 +559,6 @@ int form_result(var_str buff, db_res_t** r) cur_col = 0; cur_line = -1; - first_line = 1; start = dest; while( cur < end ) @@ -1035,9 +1034,10 @@ db_con_t* db_http_init(const str* url) curl_easy_setopt(curl->handle,CURLOPT_HTTPAUTH,CURLAUTH_ANY); curl_easy_setopt(curl->handle,CURLOPT_ERRORBUFFER,error_buffer); +#if LIBCURL_VERSION_NUM >= 0x071002 LM_DBG("timeout set to %d", db_http_timeout); curl_easy_setopt(curl->handle,CURLOPT_TIMEOUT_MS,db_http_timeout); - +#endif strcat(path,"http"); if ( use_ssl ) From 4b6531e9df4a598c51c4f20079ca873933c280ba Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Fri, 9 Aug 2013 18:39:30 +0300 Subject: [PATCH 012/159] Fix: mathops internal parsing bug Credits to Jayesh Nambiar for reporting (cherry picked from commit aeddd311d29c9d5cae5017bd59674031089b5574) --- modules/mathops/math_funcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mathops/math_funcs.c b/modules/mathops/math_funcs.c index 783831e0227..2ad393e869a 100644 --- a/modules/mathops/math_funcs.c +++ b/modules/mathops/math_funcs.c @@ -179,7 +179,7 @@ static int convert_to_rpn(str *exp) while (s.len) { - if (*s.s > '0' && *s.s < '9') { + if (*s.s >= '0' && *s.s <= '9') { errno = 0; d = strtod(s.s, &p); From 51c5504842d8a9975f1dec0fd8e834b8d6a37be8 Mon Sep 17 00:00:00 2001 From: saghul Date: Thu, 8 Aug 2013 10:15:49 +0200 Subject: [PATCH 013/159] Fixed compilation in systems without EPOLL (cherry picked from 7d727aafa93f79421304121d95f2a038bdbf887c) --- io_wait.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/io_wait.h b/io_wait.h index 704c51598a8..eef60a420c1 100644 --- a/io_wait.h +++ b/io_wait.h @@ -86,6 +86,7 @@ #include #include "dprint.h" +#include "globals.h" /* tcp_async */ #include "poll_types.h" /* poll_types*/ #ifdef HAVE_SIGIO_RT @@ -318,6 +319,7 @@ inline static int io_watch_add( io_wait_h* h, struct fd_map* e; + int already; #ifdef HAVE_EPOLL struct epoll_event ep_event; #endif @@ -329,7 +331,6 @@ inline static int io_watch_add( io_wait_h* h, int idx; int check_io; struct pollfd pf; - int already; check_io=0; /* set to 1 if we need to check for pre-existing queued io/data on the fd */ From e8c3c8260e4246aae5ba36d400637234fd11d981 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Sun, 11 Aug 2013 14:15:08 +0300 Subject: [PATCH 014/159] Increased menuconfig parsing buffer to 1024 (Reported by Richard Revels) Removed mi_http from the excluded modules list - has no external dependencies (cherry picked from commit 41157e7b911bfb896f4f0a9cb2dc1049a0c2b0c4) --- Makefile.conf | 3 +-- menuconfig/parser.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.conf b/Makefile.conf index c1393e0a920..7788e6b8f9d 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -24,13 +24,12 @@ #ldap= Implements an LDAP search interface for OpenSIPS | OpenLDAP library & development files, tipically libldap and libldap-dev #lua= Easily implement your own OpenSIPS extensions in Lua | liblua5.1-0-dev, libmemcache-dev and libmysqlclient-dev #httpd= Provides an HTTP transport layer implementation for OpenSIPS. | libmicrohttpd -#mi_http= Provides a simple web interface for running MI comands -#pi_http= Provides a simple web database provisioning interface | XML parsing & building library, tipically libxml-dev #mi_xmlrpc_ng= Implements a xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml #mi_xmlrpc= libxmlrpc-c3 version 0.9.10 - 0.9.42. (using other versions may be dangerous and lead to opensips blocking) #mmgeoip= Lightweight wrapper for the MaxMind GeoIP API | libGeoIP #osp= Enables OpenSIPS to support secure, multi-lateral peering using the OSP standard | OSP development kit, tipically osptoolkit #perl= Easily implement your own OpenSIPS extensions in Perl | Perl library development files, tipically libperl-dev +#pi_http= Provides a simple web database provisioning interface | XML parsing & building library, tipically libxml-dev #presence= Handles PUBLISH and SUBSCRIBE messages and generates NOTIFY messages in a general, event independent way | XML parsing & Building library, tipically libxml-dev #presence_dialoginfo= Enables the handling of "Event: dialog" (as defined in RFC 4235) | XML parsing & building library, tipically libxml-dev #presence_mwi= Does specific handling for notify-subscribe message-summary (message waiting indication) events as specified in RFC 3842 | XML parsing & building library, tipically libxml-dev diff --git a/menuconfig/parser.c b/menuconfig/parser.c index 2a3b37f162b..53bf0b5f45d 100644 --- a/menuconfig/parser.c +++ b/menuconfig/parser.c @@ -245,7 +245,7 @@ int parse_prefix_line(char *line,select_menu *menu) } /* Parse an m4 defs line for a cfg entry */ -#define READ_BUF_SIZE 512 +#define READ_BUF_SIZE 1024 static char read_buf[READ_BUF_SIZE]; int parse_defs_m4_line(char *line,select_menu *menu) { From 6b13b19a5eb420a9a434173d338c9fe655530ba9 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 12 Aug 2013 16:28:14 +0300 Subject: [PATCH 015/159] Fixed double free issue when reading multiple SIP messages in one TCP chunk Do proper zero-ing out of the tcp_req structure (cherry picked from commit db24ec00b0d1c48ea109c9609bed81d1f8efa014) --- tcp_conn.h | 3 +++ tcp_read.c | 26 +++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tcp_conn.h b/tcp_conn.h index ca6e9999386..b87cd92b61d 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -193,6 +193,9 @@ struct tcp_connection{ (r)->parsed=(r)->pos=(r)->start=(r)->buf; \ (r)->error=TCP_REQ_OK;\ (r)->state=H_SKIP_EMPTY; \ + (r)->body=0; \ + (r)->complete=(r)->content_len=(r)->has_content_len=0; \ + (r)->bytes_to_go=0; \ }while(0) diff --git a/tcp_read.c b/tcp_read.c index ad968374dc6..fa4e1b8ae15 100644 --- a/tcp_read.c +++ b/tcp_read.c @@ -439,8 +439,10 @@ void release_tcpconn(struct tcp_connection* c, long state, int unix_sock) c, state, c->fd, c->id); LM_DBG(" extra_data %p\n", c->extra_data); - if (c->con_req) + if (c->con_req) { pkg_free(c->con_req); + c->con_req = NULL; + } /* release req & signal the parent */ if (c->fd!=-1) close(c->fd); @@ -696,8 +698,11 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) &local_rcv) <0) LM_ERR("receive_msg failed \n"); - if (req != ¤t_req) + if (!size && req != ¤t_req) { + /* if we no longer need this tcp_req + * we can free it now */ pkg_free(req); + } } *req->parsed=c; @@ -743,11 +748,6 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) goto end_req; } - con->con_req->content_len = req->content_len; - con->con_req->bytes_to_go = req->bytes_to_go; - con->con_req->error = req->error; - con->con_req->state = req->state; - if (req->pos != req->buf) { /* we have read some bytes */ memcpy(con->con_req->buf,req->buf,req->pos-req->buf); @@ -766,6 +766,18 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) else con->con_req->parsed = con->con_req->buf; + if (req->body != 0) { + con->con_req->body = con->con_req->buf + (req->body-req->buf); + } else + con->con_req->body = 0; + + con->con_req->complete=req->complete; + con->con_req->has_content_len=req->has_content_len; + con->con_req->content_len=req->content_len; + con->con_req->bytes_to_go=req->bytes_to_go; + con->con_req->error = req->error; + con->con_req->state = req->state; + /* zero out the per process req for the future SIP msg */ init_tcp_req(¤t_req); } From 8a1c5d91d86455505e064ddff08aa0840d79c9b1 Mon Sep 17 00:00:00 2001 From: Nick Altmann Date: Wed, 31 Jul 2013 11:47:05 +0400 Subject: [PATCH 016/159] porting of 8ed2ed: spec file for el/fedora synced with build server spec file for el/fedora synced with build server --- packaging/fedora/opensips.spec | 715 +++++++++++++++++++++++++-------- 1 file changed, 550 insertions(+), 165 deletions(-) diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index 53f4d561944..0314958bc59 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -1,11 +1,11 @@ %if 0%{?rhel} # copied from lm_sensors exclusive arch %ifnarch alpha i386 i486 i586 i686 pentium3 pentium4 athlon x86_64 -%define disable_snmpstats snmpstats +%global disable_snmpstats snmpstats %endif %endif -%define EXCLUDE_MODULES mi_xmlrpc osp json %{?disable_snmpstats} %{!?_with_oracle:db_oracle} +%global EXCLUDE_MODULES osp cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?disable_snmpstats} %{?el5:db_perlvdb} %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua Summary: Open Source SIP Server Name: opensips @@ -14,16 +14,14 @@ Release: 4%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: http://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}-tls_src.tar.gz -Source1: %{name}.sysconfig -Patch1: opensips--init.patch -Patch2: opensips--openssl10.patch URL: http://opensips.org BuildRequires: expat-devel BuildRequires: libxml2-devel BuildRequires: bison BuildRequires: flex -#BuildRequires: subversion +BuildRequires: subversion +BuildRequires: which # needed by snmpstats BuildRequires: radiusclient-ng-devel BuildRequires: mysql-devel @@ -37,20 +35,38 @@ BuildRequires: net-snmp-devel BuildRequires: unixODBC-devel BuildRequires: openssl-devel BuildRequires: expat-devel -#BuildRequires: xmlrpc-c-devel +BuildRequires: xmlrpc-c-devel BuildRequires: libconfuse-devel +%if 0%{?rhel} BuildRequires: db4-devel +%else +BuildRequires: libdb-devel +%endif BuildRequires: openldap-devel BuildRequires: curl-devel -BuildRequires: libmemcached-devel BuildRequires: GeoIP-devel BuildRequires: pcre-devel - - +BuildRequires: python-devel +%if 0%{?fedora} > 16 +BuildRequires: systemd-units +%endif +BuildRequires: libxslt +BuildRequires: lynx +BuildRequires: ncurses-devel +BuildRequireS: json-c-devel + +#Initscripts +%if 0%{?fedora} > 16 +# Users and groups +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else Requires(post): chkconfig Requires(preun):chkconfig -# for /sbin/service Requires(preun):initscripts +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -118,7 +134,7 @@ Summary: Routing extension suitable for carriers Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -%description carrierroute +%description carrierroute A module which provides routing, balancing and blacklisting capabilities. %package cpl-c @@ -132,7 +148,7 @@ Support for uploading/downloading/removing scripts via SIP REGISTER method is present. %package db_berkeley -Summary: Berkley DB backend support +Summary: Berkeley DB backend support Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} @@ -149,6 +165,64 @@ Requires: %{name} = %{version}-%{release} This module provides access to a database that is implemented as a HTTP server. +%if %{undefined el5} +%package db_perlvdb +Summary: Perl virtual database engine +Group: System Environment/Daemons +# require perl-devel for >F7 and perl for <=F6 +BuildRequires: perl(ExtUtils::MakeMaker) +Requires: %{name} = %{version}-%{release} +Requires: %{name}-perl +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description db_perlvdb +The Perl Virtual Database (VDB) provides a virtualization framework for +OpenSIPS's database access. It does not handle a particular database engine +itself but lets the user relay database requests to arbitrary Perl functions. +%endif + +%package event_datagram +Summary: Event datagram module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_datagram +This is a module which provides a UNIX/UDP SOCKET transport layer +implementation for the Event Interface. + +%package event_rabbitmq +Summary: Event RabbitMQ module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: librabbitmq-devel + +%description event_rabbitmq +This module provides the implementation of a RabbitMQ client for the Event Interface. +It is used to send AMQP messages to a RabbitMQ server each time the Event Interface +triggers an event subscribed for. + +%package event_route +Summary: Route triggering based on events +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_route +This module provides a simple way for handling different events, triggered through +the OpenSIPS Event Interface, directly from the OpenSIPS script. For a specific event, +a special route (event_route) has to be declared in the script, and should contain +the code that handles the event. The route is executed by the module when the +corresponding event is raised by the OpenSIPS Event Interface. + +%package event_xmlrpc +Summary: Event XMLRPC client module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_xmlrpc +This module is an implementation of an XMLRPC client used to notify XMLRPC servers +whenever certain notifications are raised by OpenSIPS. It acts as a transport layer +for the Event Notification Interface. + %package h350 Summary: H350 implementation Group: System Environment/Daemons @@ -159,6 +233,15 @@ The OpenSIPS H350 module enables an OpenSIPS SIP proxy server to access SIP account data stored in an LDAP [RFC4510] directory containing H.350 [H.350] commObjects. +%package httpd +Summary: HTTP transport layer implementation +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: libmicrohttpd-devel + +%description httpd +This module provides an HTTP transport layer for OpenSIPS. + %package jabber Summary: Gateway between OpenSIPS and a jabber server Group: System Environment/Daemons @@ -167,6 +250,15 @@ Requires: %{name} = %{version}-%{release} %description jabber Jabber module that integrates XODE XML parser for parsing Jabber messages. +%package json +Summary: A JSON variables within the script +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description json +This module introduces a new type of variable that provides both serialization and +de-serialization from JSON format. + %package ldap Summary: LDAP connector Group: System Environment/Daemons @@ -179,6 +271,7 @@ The LDAP module implements an LDAP search interface for OpenSIPS. Summary: Memcached connector Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +BuildRequires: libmemcached-devel %description memcached Memcached module is an implementation of a cache system designed to @@ -193,26 +286,36 @@ Requires: %{name} = %{version}-%{release} Mmgeoip is a lightweight wrapper for the MaxMind GeoIP API. It adds IP address-to-location lookup capability to OpenSIPS scripts. -%if %{defined db_oracle} +%package mysql +Summary: MySQL Storage Support for the OpenSIPS +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description mysql +The %{name}-mysql package contains the MySQL plugin for %{name}, which allows +a MySQL-Database to be used for persistent storage. + +%if 0%{?_with_oracle} %package oracle Summary: Oracle Storage Support for the OpenSIPS Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +BuildRequires: oracle-instantclient-devel -%description oracle +%description oracle The %{name}-oracle package contains the Oracle plugin for %{name}, which allows a Oracle-Database to be used for persistent storage. %endif -%package mysql -Summary: MySQL Storage Support for the OpenSIPS +%package peering +Summary: Radius peering Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} - -%description mysql -The %{name}-mysql package contains the MySQL plugin for %{name}, which allows -a MySQL-Database to be used for persistent storage. +%description peering +Peering module allows SIP providers (operators or organizations) +to verify from a broker if source or destination of a SIP request +is a trusted peer. %package perl Summary: Helps implement your own OpenSIPS extensions in Perl @@ -222,7 +325,11 @@ BuildRequires: perl(ExtUtils::MakeMaker) %if 0%{?rhel} BuildRequires: perl(ExtUtils::Embed) %else +%if 0%{?redhat} == 5 BuildRequires: perl(ExtUtils::Embed), perl-devel +%else +BuildRequires: perl(ExtUtils::Embed) +%endif %endif Requires: %{name} = %{version}-%{release} Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) @@ -236,29 +343,15 @@ simple access to the full world of CPAN modules. SIP URI rewriting could be implemented based on regular expressions; accessing arbitrary data backends, e.g. LDAP or Berkeley DB files, is now extremely simple. -%package perlvdb -Summary: Perl virtual database engine -Group: System Environment/Daemons -# require perl-devel for >F7 and perl for <=F6 -BuildRequires: perl(ExtUtils::MakeMaker) -Requires: %{name} = %{version}-%{release} -Requires: %{name}-perl -Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) - -%description perlvdb -The Perl Virtual Database (VDB) provides a virtualization framework for -OpenSIPS's database access. It does not handle a particular database engine -itself but lets the user relay database requests to arbitrary Perl functions. - -%package peering -Summary: Radius peering +%package pi_http +Summary: Provisioning Interface module Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -%description peering -Peering module allows SIP providers (operators or organizations) -to verify from a broker if source or destination of a SIP request -is a trusted peer. +%description pi_http +This module provides an HTTP provisioning interface for OpenSIPS. It is using the +OpenSIPS's internal database API to provide a simple way of manipulating records +inside OpenSIPS's tables. %package postgresql Summary: PostgreSQL Storage Support for the OpenSIPS @@ -281,6 +374,19 @@ of published presence information for the same presentity using more devices. It can also filter the information provided to watchers according to privacy rules. +%package presence_callinfo +Summary: SIMPLE Presence extension +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +Requires: %{name}-presence + +%description presence_callinfo +The module enables the handling of "call-info" and "line-seize" events inside +the presence module. It is used with the general event handling module: +presence and it constructs and adds "Call-Info" headers to notification events. +To send "call-info" notification to watchers, a third-party application must +publish "call-info" events to the presence server. + %package presence_dialoginfo Summary: Extension to Presence server for Dialog-Info Group: System Environment/Daemons @@ -320,7 +426,6 @@ Summary: SIMPLE Presence extension Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Requires: %{name}-presence -Requires: %{name}-xcap Requires: %{name}-xcap_client %description presence_xml @@ -336,6 +441,17 @@ Requires: %{name} = %{version}-%{release} This module offer the functionality of a presence user agent client, sending Subscribe and Publish messages. +%package pua_bla +Summary: BLA extension for PUA +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +Requires: %{name}-pua +Requires: %{name}-presence + +%description pua_bla +The pua_bla module enables Bridged Line Appearances support according to the +specifications in draft-anil-sipping-bla-03.txt. + %package pua_dialoginfo Summary: Dialog-Info extension for PUA Group: System Environment/Daemons @@ -349,17 +465,6 @@ pua module. Thus, in combination with the presence_xml module this can be used to derive dialog-info from the dialog module and NOTIFY the subscribed watchers about dialog-info changes. -%package pua_bla -Summary: BLA extension for PUA -Group: System Environment/Daemons -Requires: %{name} = %{version}-%{release} -Requires: %{name}-pua -Requires: %{name}-presence - -%description pua_bla -The pua_bla module enables Bridged Line Appearances support according to the -specifications in draft-anil-sipping-bla-03.txt. - %package pua_mi Summary: Connector between usrloc and MI interface Group: System Environment/Daemons @@ -399,6 +504,26 @@ This module is a gateway for presence between SIP and XMPP. It translates one format into another and uses xmpp, pua and presence modules to manage the transmition of presence state information. +%package python +Summary: Python scripting support +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description python +Helps implement your own OpenSIPS extensions in Python + +%if %{undefined el5} +%package redis +Summary: Redis connector +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: hiredis-devel + +%description redis +This module is an implementation of a cache system designed to work +with a Redis server. +%endif + %package regex Summary: RegExp via PCRE library Group: System Environment/Daemons @@ -412,8 +537,9 @@ expressions using the powerful PCRE library. Summary: Resource List Server Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -Requires: %{name}-pua -Requires: %{name}-presence +Requires: %{name}-pua +Requires: %{name}-presence +Requires: %{name}-xcap %description rls The modules is a Resource List Server implementation following the @@ -481,17 +607,18 @@ The %{name}-unixodbc package contains the unixODBC plugin for %{name}, which allows a unixODBC to be used for persistent storage %package xcap -Summary: XCAP utilities +Summary: XCAP API provider Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} %description xcap -The modules contains XCAP related utilities for OpenSIPS +The module contains several parameters and functions common to all modules using XCAP capabilities. %package xcap_client Summary: XCAP client Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +Requires: %{name}-xcap %description xcap_client The modules is an XCAP client for OpenSIPS that can be used by other modules. @@ -499,6 +626,15 @@ It fetches XCAP elements, either documents or part of them, by sending HTTP GET requests. It also offers support for conditional queries. It uses libcurl library as a client-side HTTP transfer library. +%package xmlrpc +Summary: A xmlrpc server +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description xmlrpc +This module implements a xmlrpc server that handles xmlrpc requests and generates +xmlrpc responses. When a xmlrpc message is received a default method is executed. + %package xmpp Summary: Gateway between OpenSIPS and a jabber server Group: System Environment/Daemons @@ -511,14 +647,12 @@ clients. %prep %setup -q -n %{name}-%{version}-tls -%patch1 -p1 -%patch2 -p1 %build -LOCALBASE=/usr CFLAGS="%{optflags}" %{__make} all %{?_smp_mflags} TLS=1 \ +LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ exclude_modules="%EXCLUDE_MODULES" \ cfg-target=%{_sysconfdir}/opensips/ \ - modules-prefix=%{buildroot}/%{_prefix} \ + modules-prefix=%{buildroot}%{_prefix} \ modules-dir=%{_lib}/%{name}/modules %install @@ -532,6 +666,9 @@ rm -rf $RPM_BUILD_ROOT DBTEXTON=yes # fixed dbtext documentation installation # clean some things +%if 0%{?el5} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/opensips/perl/OpenSIPS/VDB* +%endif mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib} if [ -d "$RPM_BUILD_ROOT/%{_prefix}/perl" ]; then # for fedora>=11 @@ -554,54 +691,102 @@ for i in docdir/*; do rm -f $i.old done -mkdir -p $RPM_BUILD_ROOT%{_initrddir} -%{__install} -p -D -m 755 packaging/fedora/opensips.init \ - $RPM_BUILD_ROOT%{_initrddir}/opensips +%if 0%{?fedora} > 16 +# install systemd files +install -D -m 0644 -p packaging/fedora/%{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service +install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name} +%else +install -p -D -m 755 packaging/fedora/opensips.init $RPM_BUILD_ROOT%{_initrddir}/opensips +%endif echo -e "\nETCDIR=\"%{_sysconfdir}/opensips\"\n" \ >> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/opensipsctlrc #install sysconfig file -install -D -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} +install -D -p -m 644 packaging/fedora/%{name}.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} %clean rm -rf $RPM_BUILD_ROOT + +%pre +getent group %{name} >/dev/null || groupadd -r %{name} +getent passwd %{name} >/dev/null || \ +useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ +-c "OpenSIPS SIP Server" %{name} 2>/dev/null || : + %post -/sbin/chkconfig --add opensips +%if 0%{?fedora} > 16 +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%else +/sbin/chkconfig --add %{name} +%endif %preun +%if 0%{?fedora} > 16 +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : + /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : +fi +%else if [ $1 = 0 ]; then - /sbin/service opensips stop > /dev/null 2>&1 - /sbin/chkconfig --del opensips + /sbin/service %{name} stop > /dev/null 2>&1 + /sbin/chkconfig --del %{name} fi +%endif + +%if 0%{?fedora} > 16 +%triggerun -- %{name} < 1.7.2-1 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply opensips +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : +/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : + +%triggerun -- opensips < 1.7.2-4 +chown -R %{name}:%{name} %{_sysconfdir}/%{name} +%endif %files -%defattr(-,root,root,-) %{_sbindir}/opensips %{_sbindir}/opensipsctl %{_sbindir}/opensipsdbctl %{_sbindir}/opensipsunix +%{_sbindir}/osipsconfig %{_sbindir}/osipsconsole -%attr(750,root,root) %dir %{_sysconfdir}/opensips -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA/certs -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA/private -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/user +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA/certs +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA/private +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/user %dir %{_libdir}/opensips/ %dir %{_libdir}/opensips/modules/ %dir %{_libdir}/opensips/opensipsctl/ -%dir %{_libdir}/opensips/opensipsctl/dbtextdb +%dir %{_libdir}/opensips/opensipsctl/dbtextdb/ +%if 0%{?fedora} > 16 +%{_unitdir}/%{name}.service +%{_sysconfdir}/tmpfiles.d/%{name}.conf +%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name} +%else %attr(755,root,root) %{_initrddir}/opensips +%endif %config(noreplace) %{_sysconfdir}/opensips/dictionary.opensips %config(noreplace) %{_sysconfdir}/sysconfig/%{name} -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/opensips.cfg -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/opensipsctlrc -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/osipsconsolerc -# these files are just an example so no need to restrict access to them +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/opensips.cfg +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/opensipsctlrc +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/osipsconsolerc +# these files are just an examples so no need to restrict access to them %config(noreplace) %{_sysconfdir}/opensips/tls/ca.conf %config(noreplace) %{_sysconfdir}/opensips/tls/request.conf %config(noreplace) %{_sysconfdir}/opensips/tls/rootCA/cacert.pem @@ -615,15 +800,24 @@ fi %config(noreplace) %{_sysconfdir}/opensips/tls/user/user-cert_req.pem %config(noreplace) %{_sysconfdir}/opensips/tls/user/user-privkey.pem -%{_libdir}/opensips/opensipsctl/opensipsctl.* +%{_libdir}/opensips/opensipsctl/opensipsctl.base +%{_libdir}/opensips/opensipsctl/opensipsctl.ctlbase +%{_libdir}/opensips/opensipsctl/opensipsctl.dbtext +%{_libdir}/opensips/opensipsctl/opensipsctl.fifo +%{_libdir}/opensips/opensipsctl/opensipsctl.sqlbase +%{_libdir}/opensips/opensipsctl/opensipsctl.unixsock + %{_libdir}/opensips/opensipsctl/opensipsdbctl.base %{_libdir}/opensips/opensipsctl/opensipsdbctl.dbtext %{_libdir}/opensips/opensipsctl/dbtextdb/dbtextdb.py* -%dir %{_datadir}/opensips -%dir %{_datadir}/opensips/dbtext -%dir %{_datadir}/opensips/dbtext/opensips +%dir %{_datadir}/opensips/ +%dir %{_datadir}/opensips/dbtext/ +%dir %{_datadir}/opensips/dbtext/opensips/ +%dir %{_datadir}/opensips/menuconfig_templates/ + %{_datadir}/opensips/dbtext/opensips/* +%{_datadir}/opensips/menuconfig_templates/*.m4 %{_mandir}/man5/opensips.cfg.5* %{_mandir}/man8/opensips.8* @@ -634,7 +828,6 @@ fi %doc docdir/NEWS %doc docdir/README %doc docdir/README-MODULES -%doc docdir/README.tls %doc COPYING %{_libdir}/opensips/modules/acc.so @@ -643,12 +836,15 @@ fi %{_libdir}/opensips/modules/auth_db.so %{_libdir}/opensips/modules/avpops.so %{_libdir}/opensips/modules/benchmark.so +%{_libdir}/opensips/modules/cachedb_local.so +%{_libdir}/opensips/modules/cachedb_sql.so %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/closeddial.so %{_libdir}/opensips/modules/cfgutils.so %{_libdir}/opensips/modules/db_flatstore.so %{_libdir}/opensips/modules/db_virtual.so %{_libdir}/opensips/modules/db_text.so +%{_libdir}/opensips/modules/dns_cache.so %{_libdir}/opensips/modules/dialog.so %{_libdir}/opensips/modules/dialplan.so %{_libdir}/opensips/modules/dispatcher.so @@ -663,15 +859,16 @@ fi %{_libdir}/opensips/modules/identity.so %{_libdir}/opensips/modules/imc.so %{_libdir}/opensips/modules/load_balancer.so -%{_libdir}/opensips/modules/localcache.so %{_libdir}/opensips/modules/mangler.so %{_libdir}/opensips/modules/maxfwd.so %{_libdir}/opensips/modules/mediaproxy.so %{_libdir}/opensips/modules/mi_fifo.so %{_libdir}/opensips/modules/mi_datagram.so +%{_libdir}/opensips/modules/mi_http.so %{_libdir}/opensips/modules/msilo.so %{_libdir}/opensips/modules/nathelper.so %{_libdir}/opensips/modules/nat_traversal.so +%{_libdir}/opensips/modules/rtpproxy.so %{_libdir}/opensips/modules/options.so %{_libdir}/opensips/modules/path.so %{_libdir}/opensips/modules/pdt.so @@ -682,6 +879,8 @@ fi %{_libdir}/opensips/modules/registrar.so %{_libdir}/opensips/modules/rr.so %{_libdir}/opensips/modules/signaling.so +%{_libdir}/opensips/modules/sipcapture.so +%{_libdir}/opensips/modules/sipmsgops.so %{_libdir}/opensips/modules/siptrace.so %{_libdir}/opensips/modules/sl.so %{_libdir}/opensips/modules/speeddial.so @@ -695,7 +894,8 @@ fi %{_libdir}/opensips/modules/userblacklist.so %{_libdir}/opensips/modules/uri.so %{_libdir}/opensips/modules/usrloc.so -%{_libdir}/opensips/modules/xlog.so +%{_libdir}/opensips/modules/uac_auth.so +%{_libdir}/opensips/modules/uac_registrant.so %doc docdir/README.acc %doc docdir/README.alias_db @@ -703,89 +903,102 @@ fi %doc docdir/README.auth_db %doc docdir/README.avpops %doc docdir/README.benchmark +%doc docdir/README.cachedb_local +%doc docdir/README.cachedb_sql +%doc docdir/README.call_control %doc docdir/README.cfgutils +%doc docdir/README.closeddial +%doc docdir/README.db_flatstore %doc docdir/README.db_text +%doc docdir/README.db_virtual %doc docdir/README.dialog %doc docdir/README.dialplan %doc docdir/README.dispatcher %doc docdir/README.diversion +%doc docdir/README.dns_cache %doc docdir/README.domain %doc docdir/README.domainpolicy %doc docdir/README.drouting %doc docdir/README.enum %doc docdir/README.exec -#%doc docdir/README.flatstore %doc docdir/README.gflags %doc docdir/README.group +%doc docdir/README.identity %doc docdir/README.imc +%doc docdir/README.load_balancer %doc docdir/README.mangler %doc docdir/README.maxfwd %doc docdir/README.mediaproxy -%doc docdir/README.mi_fifo %doc docdir/README.mi_datagram +%doc docdir/README.mi_fifo +%doc docdir/README.mi_http %doc docdir/README.msilo +%doc docdir/README.nat_traversal %doc docdir/README.nathelper %doc docdir/README.options %doc docdir/README.path %doc docdir/README.pdt %doc docdir/README.permissions %doc docdir/README.pike +%doc docdir/README.qos +%doc docdir/README.ratelimit %doc docdir/README.registrar %doc docdir/README.rr +%doc docdir/README.rtpproxy +%doc docdir/README.signaling +%doc docdir/README.sipcapture +%doc docdir/README.sipmsgops %doc docdir/README.siptrace %doc docdir/README.sl %doc docdir/README.speeddial %doc docdir/README.sst %doc docdir/README.statistics -#%doc docdir/README.textops +%doc docdir/README.stun +%doc docdir/README.textops +%doc docdir/README.tls %doc docdir/README.tm %doc docdir/README.uac +%doc docdir/README.uac_auth %doc docdir/README.uac_redirect +%doc docdir/README.uac_registrant %doc docdir/README.uri +%doc docdir/README.userblacklist %doc docdir/README.usrloc -%doc docdir/README.xlog %files aaa_radius -%defattr(-,root,root,-) %{_libdir}/opensips/modules/aaa_radius.so %doc docdir/README.aaa_radius %files acc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/acc.so %doc docdir/README.acc %files auth_aaa -%defattr(-,root,root,-) %{_libdir}/opensips/modules/auth_aaa.so %doc docdir/README.auth_aaa %files auth_diameter -%defattr(-,root,root,-) %{_libdir}/opensips/modules/auth_diameter.so %doc docdir/README.auth_diameter %files b2bua -%defattr(-,root,root,-) %{_libdir}/opensips/modules/b2b_entities.so %{_libdir}/opensips/modules/b2b_logic.so %doc docdir/README.b2b_entities %doc docdir/README.b2b_logic %files carrierroute -%defattr(-,root,root,-) %{_libdir}/opensips/modules/carrierroute.so %doc docdir/README.carrierroute %files cpl-c -%defattr(-,root,root,-) %{_libdir}/opensips/modules/cpl-c.so %doc docdir/README.cpl-c %files db_berkeley -%defattr(-,root,root,-) %{_sbindir}/bdb_recover %{_libdir}/opensips/modules/db_berkeley.so +%{_libdir}/opensips/opensipsctl/opensipsctl.db_berkeley %{_libdir}/opensips/opensipsctl/opensipsdbctl.db_berkeley %dir %{_datadir}/opensips/db_berkeley %dir %{_datadir}/opensips/db_berkeley/opensips @@ -793,55 +1006,99 @@ fi %doc docdir/README.db_berkeley %files db_http -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_http.so %doc docdir/README.db_http +%if %{undefined el5} +%files db_perlvdb +%dir %{perl_vendorlib}/OpenSIPS/VDB +%dir %{perl_vendorlib}/OpenSIPS/VDB/Adapter +%{_libdir}/opensips/modules/db_perlvdb.so +%{perl_vendorlib}/OpenSIPS/VDB.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/AccountingSIPtrace.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Alias.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Auth.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Describe.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Speeddial.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/TableVersions.pm +%{perl_vendorlib}/OpenSIPS/VDB/Column.pm +%{perl_vendorlib}/OpenSIPS/VDB/Pair.pm +%{perl_vendorlib}/OpenSIPS/VDB/ReqCond.pm +%{perl_vendorlib}/OpenSIPS/VDB/Result.pm +%{perl_vendorlib}/OpenSIPS/VDB/VTab.pm +%{perl_vendorlib}/OpenSIPS/VDB/Value.pm +%doc docdir/README.db_perlvdb +%endif + +%files event_datagram +%{_libdir}/opensips/modules/event_datagram.so +%doc docdir/README.event_datagram + +%files event_rabbitmq +%{_libdir}/opensips/modules/event_rabbitmq.so +%doc docdir/README.event_rabbitmq + +%files event_route +%{_libdir}/opensips/modules/event_route.so +%doc docdir/README.event_route + +%files event_xmlrpc +%{_libdir}/opensips/modules/event_xmlrpc.so +%doc docdir/README.event_xmlrpc + %files h350 -%defattr(-,root,root,-) %{_libdir}/opensips/modules/h350.so %doc docdir/README.h350 +%files httpd +%{_libdir}/opensips/modules/httpd.so +%doc docdir/README.httpd + %files jabber -%defattr(-,root,root,-) %{_libdir}/opensips/modules/jabber.so %doc docdir/README.jabber +%files json +%{_libdir}/opensips/modules/json.so +%doc docdir/README.json + %files ldap -%defattr(-,root,root,-) %{_libdir}/opensips/modules/ldap.so %doc docdir/README.ldap %files memcached -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/memcached.so -%doc docdir/README.memcached +%{_libdir}/opensips/modules/cachedb_memcached.so +%doc docdir/README.cachedb_memcached %files mmgeoip -%defattr(-,root,root,-) %{_libdir}/opensips/modules/mmgeoip.so %doc docdir/README.mmgeoip %files mysql -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_mysql.so +%{_libdir}/opensips/opensipsctl/opensipsctl.mysql %{_libdir}/opensips/opensipsctl/opensipsdbctl.mysql %dir %{_datadir}/opensips/mysql %{_datadir}/opensips/mysql/*.sql %doc docdir/README.db_mysql -%if %{defined db_oracle} +%if 0%{?_with_oracle} %files oracle -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/db_oracle.db +%{_sbindir}/opensips_orasel +%{_libdir}/opensips/modules/db_oracle.so +%{_libdir}/opensips/opensipsctl/opensipsctl.oracle %{_libdir}/opensips/opensipsctl/opensipsdbctl.oracle +%{_libdir}/opensips/opensipsctl/opensipsdbfunc.oracle %dir %{_datadir}/opensips/oracle %{_datadir}/opensips/oracle/* %doc docdir/README.db_oracle %endif +%files peering +%{_libdir}/opensips/modules/peering.so +%doc docdir/README.peering + %files perl -%defattr(-,root,root,-) %dir %{perl_vendorlib}/OpenSIPS %dir %{perl_vendorlib}/OpenSIPS/LDAPUtils %dir %{perl_vendorlib}/OpenSIPS/Utils @@ -855,116 +1112,94 @@ fi %{perl_vendorlib}/OpenSIPS/Utils/Debug.pm %doc docdir/README.perl -%files perlvdb -%defattr(-,root,root,-) -%dir %{perl_vendorlib}/OpenSIPS/VDB -%dir %{perl_vendorlib}/OpenSIPS/VDB/Adapter -%{_libdir}/opensips/modules/db_perlvdb.so -%{perl_vendorlib}/OpenSIPS/VDB.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/AccountingSIPtrace.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Alias.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Auth.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Describe.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Speeddial.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/TableVersions.pm -%{perl_vendorlib}/OpenSIPS/VDB/Column.pm -%{perl_vendorlib}/OpenSIPS/VDB/Pair.pm -%{perl_vendorlib}/OpenSIPS/VDB/ReqCond.pm -%{perl_vendorlib}/OpenSIPS/VDB/Result.pm -%{perl_vendorlib}/OpenSIPS/VDB/VTab.pm -%{perl_vendorlib}/OpenSIPS/VDB/Value.pm -%doc docdir/README.perlvdb - -%files peering -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/peering.so -%doc docdir/README.peering +%files pi_http +%{_libdir}/opensips/modules/pi_http.so +%{_datadir}/opensips/pi_http/* +%doc docdir/README.pi_http %files postgresql -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_postgres.so +%{_libdir}/opensips/opensipsctl/opensipsctl.pgsql %{_libdir}/opensips/opensipsctl/opensipsdbctl.pgsql %dir %{_datadir}/opensips/postgres %{_datadir}/opensips/postgres/*.sql %doc docdir/README.db_postgres %files presence -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence.so %doc docdir/README.presence +%files presence_callinfo +%{_libdir}/opensips/modules/presence_callinfo.so +%doc docdir/README.presence_callinfo + %files presence_dialoginfo -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_dialoginfo.so %doc docdir/README.presence_dialoginfo %files presence_mwi -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_mwi.so %doc docdir/README.presence_mwi %files presence_xcapdiff -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_xcapdiff.so +%doc docdir/README.presence_xcapdiff %files presence_xml -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_xml.so %doc docdir/README.presence_xml %files pua -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua.so %doc docdir/README.pua -%files pua_dialoginfo -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/pua_dialoginfo.so -%doc docdir/README.pua_dialoginfo - %files pua_bla -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_bla.so %doc docdir/README.pua_bla +%files pua_dialoginfo +%{_libdir}/opensips/modules/pua_dialoginfo.so +%doc docdir/README.pua_dialoginfo + %files pua_mi -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_mi.so %doc docdir/README.pua_mi %files pua_usrloc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_usrloc.so %doc docdir/README.pua_usrloc %files pua_xmpp -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_xmpp.so %doc docdir/README.pua_xmpp +%files python +%{_libdir}/opensips/modules/python.so + +%if %{undefined el5} +%files redis +%{_libdir}/opensips/modules/cachedb_redis.so +%doc docdir/README.cachedb_redis +%endif + %files regex -%defattr(-,root,root,-) %{_libdir}/opensips/modules/regex.so %doc docdir/README.regex %files rls -%defattr(-,root,root,-) %{_libdir}/opensips/modules/rls.so %doc docdir/README.rls %files seas -%defattr(-,root,root,-) %{_libdir}/opensips/modules/seas.so %doc docdir/README.seas %files sms -%defattr(-,root,root,-) %{_libdir}/opensips/modules/sms.so %doc docdir/README.sms %if %{undefined disable_snmpstats} %files snmpstats -%defattr(-,root,root,-) %{_libdir}/opensips/modules/snmpstats.so %doc docdir/README.snmpstats %dir %{_datadir}/snmp @@ -977,35 +1212,184 @@ fi %endif %files tlsops -%defattr(-,root,root,-) %{_libdir}/opensips/modules/tlsops.so %doc docdir/README.tlsops %files unixodbc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_unixodbc.so %doc docdir/README.db_unixodbc %files xcap -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xcap.so %doc docdir/README.xcap %files xcap_client -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xcap_client.so %doc docdir/README.xcap_client +%files xmlrpc +%{_libdir}/opensips/modules/mi_xmlrpc.so +%doc docdir/README.mi_xmlrpc + %files xmpp -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xmpp.so %doc docdir/README.xmpp %changelog -* Wed Nov 04 2009 John Khvatov - 1.6.0-4: +* Wed May 22 2013 Nick Altmann - 1.9.1-1 +- Rebuild specification, add new modules and dependencies + +* Tue Jan 22 2013 Peter Lemenkov - 1.8.2-3 +- Revert systemd macros + +* Thu Jan 10 2013 Peter Lemenkov - 1.8.2-2 +- Allow rtpproxy module to accept avps +- Few bugfixes + +* Tue Nov 06 2012 Peter Lemenkov - 1.8.2-1 +- Ver. 1.8.2 (Bugfix release) + +* Sat Sep 22 2012 Remi Collet - 1.8.1-3 +- rebuild against libmemcached.so.11 without SASL + +* Fri Aug 17 2012 Peter Lemenkov - 1.8.1-2 +- Enabled json module +- Enabled xmlrpc module +- Enabled cachedb_memcached module on EL5, EL6 +- Enabled cachedb_redis module on EL6 + +* Wed Aug 15 2012 Peter Lemenkov - 1.8.1-1 +- Ver. 1.8.1 +- Dropped all upstreamed patches + +* Fri Jul 20 2012 Fedora Release Engineering - 1.8.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 09 2012 Petr Pisar - 1.8.0-2 +- Perl 5.16 rebuild + +* Tue Jul 03 2012 Peter Lemenkov - 1.8.0-1 +- update to 1.8.0 + +* Fri Jun 08 2012 Petr Pisar - 1.7.2-8 +- Perl 5.16 rebuild + +* Sat May 12 2012 Peter Lemenkov - 1.7.2-7 +- Change %%define to %%global + +* Sat May 12 2012 Peter Lemenkov - 1.7.2-6 +- Added missing docs + +* Fri May 11 2012 Peter Lemenkov - 1.7.2-5 +- Fixed conditional building with Oracle DB + +* Sat Apr 28 2012 Peter Lemenkov - 1.7.2-4 +- Fixes for systemd unit + +* Sun Apr 22 2012 Remi Collet - 1.7.2-3 +- rebuild against libmemcached.so.10 + +* Thu Apr 19 2012 Peter Lemenkov - 1.7.2-2 +- Fix building on EPEL + +* Thu Apr 19 2012 Peter Lemenkov - 1.7.2-1 +- update to 1.7.2 (bugfix release). +- enable systemd support where possible + +* Fri Apr 13 2012 Jindrich Novy - 1.7.1-6 +- rebuild against new librpm and libdb + +* Sat Mar 03 2012 Remi Collet - 1.7.1-5 +- rebuild against libmemcached.so.9 + +* Fri Feb 10 2012 Petr Pisar - 1.7.1-4 +- Rebuild against PCRE 8.30 + +* Fri Jan 13 2012 Fedora Release Engineering - 1.7.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Dec 01 2011 John Khvatov - 1.7.1-2 +- upstream tarball rebuild + +* Thu Nov 24 2011 John Khvatov - 1.7.1-1 +- update to 1.7.1 (bugfix release). + +* Mon Nov 07 2011 John Khvatov - 1.7.0-1 +- update to 1.7.0 +- dropped upstreamed patches +- added new modules: event_datagram and python +- removed lcr module + +* Sat Sep 17 2011 Remi Collet - 1.6.4-13 +- rebuild against libmemcached.so.8 + +* Mon Aug 22 2011 John Khvatov - 1.6.4-12 +- rebuild against new libnetsnmp + +* Thu Jul 21 2011 Petr Sabata - 1.6.4-11 +- Perl mass rebuild + +* Wed Jul 20 2011 Petr Sabata - 1.6.4-10 +- Perl mass rebuild + +* Mon Jul 11 2011 Peter Lemenkov - 1.6.4-9 +- Updated init-script + +* Mon Jul 11 2011 Peter Lemenkov - 1.6.4-8 +- Upstream re-released traball with several new patches (API compatible) + +* Fri Jun 17 2011 Marcela Mašláňová - 1.6.4-7 +- Perl mass rebuild + +* Wed Mar 23 2011 Dan Horák - 1.6.4-6 +- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.6.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Dec 22 2010 John Khvatov - 1.6.4-1 +- dropped upstreamed patch (opensips-build.patch) +- update to 1.6.4 +- added new module: presence_callinfo + +* Sat Oct 30 2010 John Khvatov - 1.6.3-4 +- rebuild against new libnetsnmp + +* Wed Oct 06 2010 Remi Collet - 1.6.3-3 +- rebuilt against new libmemcached + +* Wed Sep 08 2010 Dan Horák - 1.6.3-2 +- fix a build issue + +* Thu Aug 12 2010 John Khvatov - 1.6.3-1 +- update to 1.6.3 + +* Wed Aug 11 2010 David Malcolm - 1.6.2-5 +- recompiling .py files against Python 2.7 (rhbz#623343) + +* Tue Jun 01 2010 Marcela Maslanova - 1.6.2-4 +- Mass rebuild with perl-5.12.0 + +* Wed May 05 2010 Remi Collet - 1.6.2-3 +- rebuilt against new libmemcached + +* Thu Apr 15 2010 John Khvatov - 1.6.2-2 +- Disabled build of the memcached subpackage for EPEL + +* Thu Apr 15 2010 John Khvatov - 1.6.2-1 +- Updated to 1.6.2 + +* Sun Feb 07 2010 Remi Collet - 1.6.1-2 +- rebuilt against new libmemcached + +* Tue Dec 22 2009 John Khvatov - 1.6.1-1 +- Updated to 1.6.1 +- Dropped upstreamed patches + +* Wed Nov 04 2009 John Khvatov - 1.6.0-4 - Fixed typo: pia_mi to pua_mi in presence_xcapdiff dependencies -* Thu Nov 03 2009 John Khvatov - 1.6.0-3 +* Tue Nov 03 2009 John Khvatov - 1.6.0-3 - Added patch for compatibility with new openssl * Thu Oct 29 2009 John Khvatov - 1.6.0-2 @@ -1141,7 +1525,7 @@ fi * Thu Sep 6 2007 Peter Lemenkov 1.2.2-8 - Added another one missing BR - which (needs by snmpstats module) - Cosmetic: dropped commented out 'Requires' - + * Thu Sep 06 2007 Jan ONDREJ (SAL) 1.2.2-7 - added attr macro for init script - added -p to install arguments to preserve timestamp @@ -1173,3 +1557,4 @@ fi * Tue Jul 24 2007 Peter Lemenkov 1.2.1-1 - Initial spec. + From 9d4bc281678ffdc95194782d46eceed494da18c2 Mon Sep 17 00:00:00 2001 From: Damien Sandras Date: Mon, 5 Aug 2013 15:56:41 +0200 Subject: [PATCH 017/159] PUBLISH requests are now handled in the same order than received. That is specifically useful for pua dialoginfo which was generating dialog info notifications that were handled in the wrong order with that patch. PUBLISH with older documents were sometimes treated after PUBLISH requests with newer documents, leading to incoherent states. --- modules/presence/hash.c | 27 ++++++++++++++++++--- modules/presence/hash.h | 7 +++++- modules/presence/presentity.c | 44 +++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/modules/presence/hash.c b/modules/presence/hash.c index e520029a14d..93b285b3b2c 100644 --- a/modules/presence/hash.c +++ b/modules/presence/hash.c @@ -506,7 +506,7 @@ void update_pres_etag(pres_entry_t* p, str* etag) p->etag_count++; } -int insert_phtable(str* pres_uri, int event, str* etag, char* sphere) +pres_entry_t* insert_phtable(str* pres_uri, int event, str* etag, char* sphere, int init_turn) { unsigned int hash_code; pres_entry_t* p= NULL; @@ -543,14 +543,16 @@ int insert_phtable(str* pres_uri, int event, str* etag, char* sphere) p->next= pres_htable[hash_code].entries->next; pres_htable[hash_code].entries->next= p; + p->last_turn = init_turn; + lock_release(&pres_htable[hash_code].lock); - return 0; + return p; error: if(p) shm_free(p); - return -1; + return NULL; } int delete_phtable_query(str *pres_uri, int event, str* etag) @@ -572,6 +574,25 @@ int delete_phtable_query(str *pres_uri, int event, str* etag) return 0; } + +void next_turn_phtable(pres_entry_t* p_p, unsigned int hash_code) +{ + pres_entry_t* p; + + lock_get(&pres_htable[hash_code].lock); + for ( p=pres_htable[hash_code].entries->next ; p ; p=p->next ) { + if(p==p_p) { + p->current_turn++; + LM_DBG("xXx - new current turn is %d\n",p->current_turn); + break; + } + } + + lock_release(&pres_htable[hash_code].lock); + return; +} + + int delete_phtable(pres_entry_t* p, unsigned int hash_code) { pres_entry_t* prev_p= NULL; diff --git a/modules/presence/hash.h b/modules/presence/hash.h index d09df1a244e..0f120c4e2c1 100644 --- a/modules/presence/hash.h +++ b/modules/presence/hash.h @@ -127,6 +127,9 @@ typedef struct pres_entry char* sphere; char etag[ETAG_LEN]; int etag_len; + /* ordering */ + unsigned int current_turn; + unsigned int last_turn; struct pres_entry* next; }pres_entry_t; @@ -144,10 +147,12 @@ pres_entry_t* search_phtable_etag(str* pres_uri, int event, void update_pres_etag(pres_entry_t* p, str* etag); -int insert_phtable(str* pres_uri, int event, str* etag, char* sphere); +pres_entry_t* insert_phtable(str* pres_uri, int event, str* etag, char* sphere, int init_turn); int update_phtable(struct presentity* presentity, str pres_uri, str body); +void next_turn_phtable(pres_entry_t* p_p, unsigned int hash_code); + int delete_phtable(pres_entry_t* p, unsigned int hash_code); int delete_phtable_query(str *pres_uri, int event, str* etag); diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index 1417c68a6f7..13acca9ffaa 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -411,6 +411,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r str pres_uri= {NULL, 0}; pres_entry_t* p= NULL; unsigned int hash_code; + unsigned int turn; str body = presentity->body; str *extra_hdrs = presentity->extra_hdrs; db_res_t *result= NULL; @@ -462,6 +463,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r n_query_cols++; result_cols[0] = &str_etag_col; + hash_code= core_hash(&pres_uri, NULL, phtable_size); if(presentity->etag_new) { @@ -473,8 +475,9 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r *sent_reply= 1; /* insert new record in hash_table */ - if(insert_phtable(&pres_uri, presentity->event->evp->parsed, - &presentity->etag, presentity->sphere)< 0) + p = insert_phtable(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, presentity->sphere, 1); + if (p==NULL) { LM_ERR("inserting record in hash table\n"); goto error; @@ -542,14 +545,27 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r } else { - hash_code= core_hash(&pres_uri, NULL, phtable_size); lock_get(&pres_htable[hash_code].lock); - p = search_phtable_etag(&pres_uri, presentity->event->evp->parsed, &presentity->etag, hash_code); + if (p) { + + turn = p->last_turn++; + LM_DBG("xXx - my turn is %d, current turn is %d\n",turn, p->current_turn); + + /* wait to get our turn as order of handling pubishs + (need to wait the ongoing published to terminate + before starting */ + while (p && turn!=p->current_turn) { + lock_release(&pres_htable[hash_code].lock); + sleep_us(100); + lock_get(&pres_htable[hash_code].lock); + p = search_phtable_etag(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, hash_code); + } + + } else { - if(!p) - { lock_release(&pres_htable[hash_code].lock); /* search also in db */ if (pa_dbf.use_table(pa_db, &presentity_table) < 0) @@ -580,7 +596,6 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r goto done; } - pa_dbf.free_result(pa_db, result); LM_INFO("*** found in db but not in htable [%.*s]\n", presentity->etag.len, presentity->etag.s); @@ -652,8 +667,9 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r else { lock_release(&pres_htable[hash_code].lock); - if(insert_phtable(&pres_uri, presentity->event->evp->parsed, - &presentity->etag, presentity->sphere)< 0) + p = insert_phtable(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, presentity->sphere, 1); + if ( p==NULL ) { LM_ERR("inserting record in hash table\n"); goto error; @@ -814,6 +830,10 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r } done: + /* allow next publish to be handled */ + if (p) + next_turn_phtable( p, hash_code); + if (notify_body.s) xmlFree(notify_body.s); @@ -828,6 +848,10 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r return 0; error: + /* allow next publish to be handled */ + if (p) + next_turn_phtable( p, hash_code); + if(result) pa_dbf.free_result(pa_db, result); if(etag.s) @@ -982,7 +1006,7 @@ int pres_htable_restore(void) sphere= extract_sphere(body); } - if(insert_phtable(&uri, event, &etag, sphere)< 0) + if(insert_phtable(&uri, event, &etag, sphere, 0)< 0) { LM_ERR("inserting record in presentity hash table"); pkg_free(uri.s); From c13a50d932e24e517cb8136436fe3e8aaac663dd Mon Sep 17 00:00:00 2001 From: Damien Sandras Date: Mon, 5 Aug 2013 16:44:29 +0200 Subject: [PATCH 018/159] Added documentation for recent changes. --- .../doc/pua_dialoginfo_admin.xml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml index e847fb83327..4715a198ee5 100644 --- a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml +++ b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml @@ -293,6 +293,51 @@ modparam("pua_dialoginfo", "caller_confirmed", 1) +
+ <varname>publish_on_trying</varname> (int) + + Usually the dialog-info of the caller will be + "trying -> early -> confirmed". "trying" will be triggered as soon + as you call dialoginfo_set on the caller, while "early" is triggered + as soon as the callee is ringing. + Sometimes, it is advisable to be notified only when the callee reaches + the early state and not before. In other cases, it is advisable to + notify the early state. This setting allows controlling the behavior. + + + Default value is 0. + + + Set <varname>publish_on_trying</varname> parameter + +... +modparam("pua_dialoginfo", "publish_on_trying", 1) +... + + +
+ +
+ <varname>nopublish_flag</varname> (int) + + By default, reINVITEs will trigger a PUBLISH. They are actually + the only in-dialog request for which it makes sense. + In some cases, it does not make sense to republish a dialog state. + (e.g. when handling a B2BUA reINVITE). + This setting defines the flag that needs to be set in the request + route to prevent the generation of a PUBLISH request in case of a + specific reINVITE. + + + Set <varname>nopublish_flag</varname> parameter + +... +modparam("pua_dialoginfo", "nopublish_flag", 5) +... + + +
+
<varname>presence_server</varname> (string) From 4597948d357c6288a5333d945e0eb0a76cc4bd73 Mon Sep 17 00:00:00 2001 From: Nick Altmann Date: Tue, 13 Aug 2013 15:17:32 +0400 Subject: [PATCH 019/159] add m4 config support for debian distros --- packaging/debian-lenny/opensips.init | 27 ++++++++++++++++++++++++++- packaging/debian/opensips.init | 27 ++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/packaging/debian-lenny/opensips.init b/packaging/debian-lenny/opensips.init index 173e2b9d57a..5aecf2003d9 100644 --- a/packaging/debian-lenny/opensips.init +++ b/packaging/debian-lenny/opensips.init @@ -19,6 +19,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/opensips NAME=opensips DESC=opensips +CFGFILE=/etc/opensips/opensips.cfg +M4CFGFILE=/etc/opensips/opensips.m4 +M4ARCHIVEDIR=/etc/opensips/archive HOMEDIR=/var/run/opensips PIDFILE=$HOMEDIR/$NAME.pid DEFAULTS=/etc/default/opensips @@ -28,7 +31,7 @@ RUN_OPENSIPS=no # otherwise the boot process will just stop check_fork () { - if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/opensips/opensips.cfg; then + if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/opensips debug instead" exit 1 fi @@ -112,6 +115,28 @@ case "$1" in check_fork fi + # Generate config from M4 + if [ -f $M4CFGFILE ]; then + m4 -Q $M4CFGFILE >$CFGFILE.tmp + if [ $? != 0 ]; then + echo "Cannot process m4 macro" + rm "$CFGFILE.tmp" + exit 1 + fi + + [ -e $CFGFILE ] || touch $CFGFILE + + # compare configs + if [ `md5sum $CFGFILE|awk '{print $1}'` != `md5sum $CFGFILE.tmp|awk '{print $1}'` ]; then + mkdir -p "$M4ARCHIVEDIR" + mv "$CFGFILE" "$M4ARCHIVEDIR/$NAME.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$CFGFILE.tmp" "$CFGFILE" + chown $USER:$GROUP $CFGFILE + chmod 640 $CFGFILE + fi + echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $OPTIONS || echo -n " already running" diff --git a/packaging/debian/opensips.init b/packaging/debian/opensips.init index 6a5d3cc8a18..d9c35718d63 100644 --- a/packaging/debian/opensips.init +++ b/packaging/debian/opensips.init @@ -19,6 +19,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/opensips NAME=opensips DESC=opensips +CFGFILE=/etc/opensips/opensips.cfg +M4CFGFILE=/etc/opensips/opensips.m4 +M4ARCHIVEDIR=/etc/opensips/archive HOMEDIR=/var/run/opensips PIDFILE=$HOMEDIR/$NAME.pid DEFAULTS=/etc/default/opensips @@ -28,7 +31,7 @@ RUN_OPENSIPS=no # otherwise the boot process will just stop check_fork () { - if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/opensips/opensips.cfg; then + if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/opensips debug instead" exit 1 fi @@ -119,6 +122,28 @@ case "$1" in chmod 775 "$HOMEDIR" chown "$USER:$GROUP" "$HOMEDIR" >/dev/null 2>&1 || true + # Generate config from M4 + if [ -f $M4CFGFILE ]; then + m4 -Q $M4CFGFILE >$CFGFILE.tmp + if [ $? != 0 ]; then + echo "Cannot process m4 macro" + rm "$CFGFILE.tmp" + exit 1 + fi + + [ -e $CFGFILE ] || touch $CFGFILE + + # compare configs + if [ `md5sum $CFGFILE|awk '{print $1}'` != `md5sum $CFGFILE.tmp|awk '{print $1}'` ]; then + mkdir -p "$M4ARCHIVEDIR" + mv "$CFGFILE" "$M4ARCHIVEDIR/$NAME.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$CFGFILE.tmp" "$CFGFILE" + chown $USER:$GROUP $CFGFILE + chmod 640 $CFGFILE + fi + echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $OPTIONS || echo -n " already running" From 30fb94bd864fc3f60e099ecb903cfc82771d66a0 Mon Sep 17 00:00:00 2001 From: Nick Altmann Date: Tue, 13 Aug 2013 15:20:09 +0400 Subject: [PATCH 020/159] add m4 config support for el/fedora distros, spec file synced with build server --- packaging/fedora/opensips.init | 26 +++++++++++++++++++++++++- packaging/fedora/opensips.service | 1 + packaging/fedora/opensips.spec | 28 ++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/packaging/fedora/opensips.init b/packaging/fedora/opensips.init index 7e8ac40fcd7..5bf50cde603 100644 --- a/packaging/fedora/opensips.init +++ b/packaging/fedora/opensips.init @@ -25,6 +25,8 @@ oser=/usr/sbin/$prog pidfile="/var/run/$prog.pid" lockfile="/var/lock/subsys/$prog" configfile="/etc/$prog/$prog.cfg" +m4configfile="/etc/$prog/$prog.m4" +m4archivedir="/etc/$prog/archive" OPTIONS="" RETVAL=0 @@ -39,9 +41,31 @@ start() { return 0 fi + # Generate config from M4 + if [ -f $m4configfile ]; then + m4 -Q $m4configfile >$configfile.tmp + if [ $? != 0 ]; then + log "cannot process m4 macro" + rm "$configfile.tmp" + return 1 + fi + + [ -e $configfile ] || touch $configfile + + # compare configs + if [ `md5sum $configfile|awk '{print $1}'` != `md5sum $configfile.tmp|awk '{print $1}'` ]; then + mkdir -p "$m4archivedir" + mv "$configfile" "$m4archivedir/$prog.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$configfile.tmp" "$configfile" + chown $prog:$prog $configfile + chmod 640 $configfile + fi + # there is something at end of this output which is needed to # report proper [ OK ] status in Fedora scripts - daemon $oser -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 + daemon $oser -u $prog -g $prog -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile diff --git a/packaging/fedora/opensips.service b/packaging/fedora/opensips.service index c69f1643792..7b0ea3a4b9b 100644 --- a/packaging/fedora/opensips.service +++ b/packaging/fedora/opensips.service @@ -9,6 +9,7 @@ Group=opensips EnvironmentFile=-/etc/sysconfig/opensips PIDFile=/var/run/opensips/opensips.pid ExecStart=/usr/sbin/opensips -P /var/run/opensips/opensips.pid -f /etc/opensips/opensips.cfg $OPTIONS +ExecStartPre=/usr/sbin/opensips-m4cfg [Install] WantedBy=multi-user.target diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index 0314958bc59..ba4e5fee45c 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -5,12 +5,12 @@ %endif %endif -%global EXCLUDE_MODULES osp cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?disable_snmpstats} %{?el5:db_perlvdb} %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua +%global EXCLUDE_MODULES sngtc osp cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?disable_snmpstats} %{?el5:db_perlvdb} %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua Summary: Open Source SIP Server Name: opensips Version: 1.10.0 -Release: 4%{?dist} +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: http://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}-tls_src.tar.gz @@ -533,6 +533,15 @@ Requires: %{name} = %{version}-%{release} This module offers matching operations against regular expressions using the powerful PCRE library. +%package rest_client +Summary: Implementation of an HTTP client +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description rest_client +The rest_client module provides a means of interacting with an HTTP server +by doing RESTful queries, such as GET and POST. + %package rls Summary: Resource List Server Group: System Environment/Daemons @@ -695,6 +704,7 @@ done # install systemd files install -D -m 0644 -p packaging/fedora/%{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf +install -D -m 0755 -p packaging/fedora/%{name}.m4cfg $RPM_BUILD_ROOT%{_sbindir}/%{name}-m4cfg mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name} %else install -p -D -m 755 packaging/fedora/opensips.init $RPM_BUILD_ROOT%{_initrddir}/opensips @@ -776,6 +786,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %if 0%{?fedora} > 16 %{_unitdir}/%{name}.service %{_sysconfdir}/tmpfiles.d/%{name}.conf +%{_sbindir}/opensips-m4cfg %dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name} %else %attr(755,root,root) %{_initrddir}/opensips @@ -841,6 +852,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/closeddial.so %{_libdir}/opensips/modules/cfgutils.so +%{_libdir}/opensips/modules/db_cachedb.so %{_libdir}/opensips/modules/db_flatstore.so %{_libdir}/opensips/modules/db_virtual.so %{_libdir}/opensips/modules/db_text.so @@ -860,6 +872,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/imc.so %{_libdir}/opensips/modules/load_balancer.so %{_libdir}/opensips/modules/mangler.so +%{_libdir}/opensips/modules/mathops.so %{_libdir}/opensips/modules/maxfwd.so %{_libdir}/opensips/modules/mediaproxy.so %{_libdir}/opensips/modules/mi_fifo.so @@ -908,6 +921,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %doc docdir/README.call_control %doc docdir/README.cfgutils %doc docdir/README.closeddial +%doc docdir/README.db_cachedb %doc docdir/README.db_flatstore %doc docdir/README.db_text %doc docdir/README.db_virtual @@ -927,6 +941,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %doc docdir/README.imc %doc docdir/README.load_balancer %doc docdir/README.mangler +%doc docdir/README.mathops %doc docdir/README.maxfwd %doc docdir/README.mediaproxy %doc docdir/README.mi_datagram @@ -1186,6 +1201,10 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/regex.so %doc docdir/README.regex +%files rest_client +%{_libdir}/opensips/modules/rest_client.so +%doc docdir/README.rest_client + %files rls %{_libdir}/opensips/modules/rls.so %doc docdir/README.rls @@ -1229,13 +1248,18 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %files xmlrpc %{_libdir}/opensips/modules/mi_xmlrpc.so +%{_libdir}/opensips/modules/mi_xmlrpc_ng.so %doc docdir/README.mi_xmlrpc +%doc docdir/README.mi_xmlrpc_ng %files xmpp %{_libdir}/opensips/modules/xmpp.so %doc docdir/README.xmpp %changelog +* Tue Jul 30 2013 Nick Altmann - 1.10.0-1 +- Update to 1.10.0 + * Wed May 22 2013 Nick Altmann - 1.9.1-1 - Rebuild specification, add new modules and dependencies From 5392af6d4809727e62c3aaaedf69bee2bb405efd Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 13 Aug 2013 14:29:51 +0300 Subject: [PATCH 021/159] fixed setting the default min_expires and max_expires module parameters. Credits go to MayamaTakeshi. --- modules/registrar/save.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/registrar/save.c b/modules/registrar/save.c index 4e30f0d4fa4..f58baa77071 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -749,6 +749,8 @@ int save_aux(struct sip_msg* _m, str* forced_binding, char* _d, char* _f, char* sctx.max_contacts = -1; sctx.flags = 0; + sctx.min_expires = min_expires; + sctx.max_expires = max_expires; if ( _f ) { if (fixup_get_svalue( _m, (gparam_p)_f, &flags_s)!=0) { LM_ERR("invalid flags parameter"); From a9c462db30c4796773cf95cd2617e9f7ca3c03df Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Wed, 14 Aug 2013 13:11:17 +0300 Subject: [PATCH 022/159] Fix: sdp_free() bug introduced in commit bde8c0a045 Credits to csollet for reporting. (cherry picked from commit a5e9f4bc818a94b282e7ccd10f44dec2d74a794e) --- parser/sdp/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser/sdp/sdp.c b/parser/sdp/sdp.c index dd4a6d64e34..cbbeb979c1f 100644 --- a/parser/sdp/sdp.c +++ b/parser/sdp/sdp.c @@ -752,7 +752,7 @@ int parse_sdp(struct sip_msg* _m) void free_sdp(sdp_info_t** sdp) { __free_sdp(*sdp); - pkg_free(sdp); + pkg_free(*sdp); *sdp = NULL; } From 34fe50129b38df30dbd67250495333e164d3b26c Mon Sep 17 00:00:00 2001 From: Norm Brandinger Date: Wed, 14 Aug 2013 08:12:11 -0400 Subject: [PATCH 023/159] pike: correct spelling (cherry picked from commit 879eacbb5e2f90f1dba2f9b23165e725a5c754d4) --- modules/pike/README | 2 +- modules/pike/doc/pike_admin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/pike/README b/modules/pike/README index 19b338c548c..9ee529d987d 100644 --- a/modules/pike/README +++ b/modules/pike/README @@ -112,7 +112,7 @@ Chapter 1. Admin Guide Time period used for sampling (or the sampling accuracy ;-) ). The smaller the better, but slower. If you want to detect - peeks, use a small one. To limit the access (like total number + peaks, use a small one. To limit the access (like total number of requests on a long period of time) to a proxy resource (a gateway for ex), use a bigger value of this parameter. diff --git a/modules/pike/doc/pike_admin.xml b/modules/pike/doc/pike_admin.xml index 9c2caed3d50..e992b91b6fd 100644 --- a/modules/pike/doc/pike_admin.xml +++ b/modules/pike/doc/pike_admin.xml @@ -90,7 +90,7 @@ <varname>sampling_time_unit</varname> (integer) Time period used for sampling (or the sampling accuracy ;-) ). The - smaller the better, but slower. If you want to detect peeks, use a + smaller the better, but slower. If you want to detect peaks, use a small one. To limit the access (like total number of requests on a long period of time) to a proxy resource (a gateway for ex), use a bigger value of this parameter. From 5341c98273a96055cf4ec428332eefaf4dd4b9f7 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Mon, 26 Aug 2013 19:33:37 +0300 Subject: [PATCH 024/159] - BYE requests received in confirmed state should terminate the dialog only if they match the TO-tag from 200 OK INVITE. This affects parallel forking scenarios where rejected branches are terminated via BYE by caller. Thanks for reporting and testing to Marco Hierl. --- modules/dialog/dlg_hash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 986604134a1..0737d677d2d 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -856,6 +856,10 @@ void next_state_dlg(struct dlg_cell *dlg, int event, switch (dlg->state) { case DLG_STATE_CONFIRMED_NA: case DLG_STATE_CONFIRMED: + if ( last_dst_leg!=dlg->legs_no[DLG_LEG_200OK] ) + /* to end the call, the BYE must be received + * on the same leg as the 200 OK for INVITE */ + break; dlg->flags |= DLG_FLAG_HASBYE; dlg->state = DLG_STATE_DELETED; *unref = 1; /* unref from hash -> dialog ended */ From 0d38a5a81ede99a83e3323c517ca4342e31882e8 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Tue, 27 Aug 2013 17:40:54 +0300 Subject: [PATCH 025/159] Fix: also run child_init for bin listeners - bin listeners are now identified by the PROC_BIN rank - this way, only the UDP listeners receive positive ranks (cherry picked from commit 389de529cc7865a475823365cdba90f1a920c1a5) --- bin_interface.c | 9 +++++++++ sr_module.c | 1 + sr_module.h | 1 + 3 files changed, 11 insertions(+) diff --git a/bin_interface.c b/bin_interface.c index dc68bcdfa23..7da75bdf822 100644 --- a/bin_interface.c +++ b/bin_interface.c @@ -25,6 +25,7 @@ #include "bin_interface.h" #include "udp_server.h" #include "config.h" +#include "daemonize.h" #include "pt.h" struct socket_info *bin; @@ -434,6 +435,14 @@ int start_bin_receivers(void) bin->sock_str.s); bind_address = bin; + if (init_child(PROC_BIN) < 0) { + LM_ERR("init_child failed for BIN listener\n"); + if (send_status_code(-1) < 0) + LM_ERR("failed to send status code\n"); + clean_write_pipeend(); + exit(-1); + } + bin_receive_loop(); exit(-1); } else diff --git a/sr_module.c b/sr_module.c index 15bec0598d4..9ddedb47972 100644 --- a/sr_module.c +++ b/sr_module.c @@ -425,6 +425,7 @@ int init_child(int rank) case PROC_TIMER: type = "PROC_TIMER"; break; case PROC_MODULE: type = "PROC_MODULE"; break; case PROC_TCP_MAIN: type = "PROC_TCP_MAIN"; break; + case PROC_BIN: type = "PROC_BIN"; break; } if (!type) { diff --git a/sr_module.h b/sr_module.h index 4a7f88634d8..5152eeba088 100644 --- a/sr_module.h +++ b/sr_module.h @@ -82,6 +82,7 @@ typedef int (*mod_proc_wrapper)(); #define PROC_TIMER -1 /* Timer attendant process */ #define PROC_MODULE -2 /* Extra process requested by modules */ #define PROC_TCP_MAIN -4 /* TCP main process */ +#define PROC_BIN -8 /* Any binary interface listener */ #define DEFAULT_DLFLAGS 0 /* value that signals to module loader to use default dlopen flags in opensips */ From 8a45cd6944edf17801c5f19f4ad17668c31cce65 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 28 Aug 2013 11:27:35 +0300 Subject: [PATCH 026/159] - proper backport of all changes from 1.8 branch --- modules/sst/sst_handlers.c | 50 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/modules/sst/sst_handlers.c b/modules/sst/sst_handlers.c index 84bf0f5680c..04c506c81c3 100644 --- a/modules/sst/sst_handlers.c +++ b/modules/sst/sst_handlers.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: sst_handlers.c 7046 2010-07-22 14:07:23Z bogdan_iancu $ * * Copyright (C) 2006 SOMA Networks, Inc. * Written by Ron Winacott (karwin) @@ -342,7 +342,8 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type, } } setup_dialog_callbacks(did, info); - set_timeout_avp(msg, info->interval); + /* Early setup of default timeout */ + set_timeout_avp(msg, info->interval); return; } @@ -420,6 +421,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, sst_info_t *info = (sst_info_t *)*(params->param); sst_msg_info_t minfo = {0,0,0,0}; struct sip_msg* msg = params->msg; + int *param; if (msg->first_line.type == SIP_REQUEST) { if ((msg->first_line.u.request.method_value == METHOD_INVITE || @@ -432,28 +434,26 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, // FIXME: need an error message here return; } - /* Early resetting of the value here */ + /* Early resetting of the value here */ if (minfo.se > 0) { if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else info->interval = MAX(minfo.se, sst_min_se); } info->supported = (minfo.supported?SST_UAC:SST_UNDF); - set_timeout_avp(msg, info->interval); - } else if (msg->first_line.u.request.method_value == METHOD_PRACK) { + set_timeout_avp(msg, info->interval); + } + else if (msg->first_line.u.request.method_value == METHOD_PRACK + || msg->first_line.u.request.method_value == METHOD_ACK) { /* Special case here. The PRACK will cause the dialog * module to reset the timeout value to the ldg->lifetime * value and look for the new AVP value bound to the * 1XX/PRACK/200OK/ACK transaction and not to the * INVITE/200OK avp value. So we need to set the AVP - * again! I think this is a bug in the dialog module, - * either it should ignore PRACK like it ignored ACK, or - * the setting of the timeout value when returning to the - * confiremed callback code should look for the new AVP - * value, which is does not. + * again! */ - LM_DBG("PRACK workaround applied!\n"); + LM_DBG("ACK/PRACK workaround applied!%d\n", info->interval); set_timeout_avp(msg, info->interval); } } @@ -473,7 +473,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, return; } set_timeout_avp(msg, minfo.se); - info->supported = (minfo.supported?SST_UAC:SST_UNDF); + info->supported = (minfo.supported?SST_UAC:SST_UNDF); info->interval = minfo.se; } } @@ -492,6 +492,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params) { struct sip_msg* msg = params->msg; + int *param; /* * This test to see if the message is a response sould ALWAYS be @@ -542,13 +543,13 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, } LM_DBG("parsing 200 OK response %d / %d\n", minfo.supported, minfo.se); if (info->supported != SST_UAC) { - info->supported = (minfo.supported?SST_UAS:SST_UNDF); + info->supported = (minfo.supported?SST_UAS:SST_UNDF); } if (minfo.se != 0) { if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else - info->interval = MAX(minfo.se, sst_min_se); + info->interval = MAX(minfo.se, sst_min_se); LM_DBG("UAS supports timer\n"); if (set_timeout_avp(msg, info->interval)) { // FIXME: need an error message here @@ -560,7 +561,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, if (info->supported == SST_UAC) { char se_buf[80]; - LM_DBG("UAC supports timer\n"); + LM_DBG("UAC supports timer\n"); LM_DBG("appending the Session-Expires: header to the 2XX reply." " UAC will deal with it.\n"); /* @@ -569,9 +570,9 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, * deal with refreshing the session. */ if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else - info->interval = MAX(minfo.se, sst_min_se); + info->interval = MAX(minfo.se, sst_min_se); snprintf(se_buf, 80, "Session-Expires: %d;refresher=uac\r\n", info->interval); if (append_header(msg, se_buf)) { @@ -588,8 +589,9 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, * does not support it */ LM_DBG("UAC and UAS do not support timers!" " No session timers for this session.\n"); - /* Disable the dialog timeout HERE */ - if (set_timeout_avp(msg, 0)) { + param = find_param_export("dialog", "default_timeout", INT_PARAM); + info->interval = param?*param:12*3600; + if (set_timeout_avp(msg, info->interval)) { return; } } @@ -847,7 +849,7 @@ static int set_timeout_avp(struct sip_msg *msg, unsigned int value) if (pv_set_value(msg,timeout_avp,EQ_T,&pv_val)!=0) { LM_ERR("failed to set new dialog timeout value\n"); } else { - LM_DBG("set dialog timeout value to %d\n", value); + LM_DBG("set dialog timeout value to %d\n", value); rtn = 0; } } @@ -893,8 +895,8 @@ static int parse_msg_for_sst_info(struct sip_msg *msg, sst_msg_info_t *minfo) * if not found or an error parsing the one it did find! So assume * it is not found if unsuccessfull. */ - if (msg->supported && parse_supported(msg) == 0 && - (get_supported(msg) & F_SUPPORTED_TIMER)) + if (msg->supported && parse_supported(msg) == 0 && + (get_supported(msg) & F_SUPPORTED_TIMER)) minfo->supported = 1; /* From 86a6b3ce45c258dd89263eba0d60356149660304 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 28 Aug 2013 12:46:14 +0300 Subject: [PATCH 027/159] Fixed bug introduced by previous commit : - downstream BYEs should go to 200OK leg in order to trigger dialog termination - upstream BYEs have no such limitation ( there's only one caller leg :) ) (cherry picked from commit 18257f33e71061828493f4232b9dbd8dd7fa6729) --- modules/dialog/dlg_handlers.c | 10 ++++++---- modules/dialog/dlg_hash.c | 4 ++-- modules/dialog/dlg_hash.h | 2 +- modules/dialog/dlg_replication.c | 6 +++++- modules/dialog/dlg_req_within.c | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 2c1f4dcc61f..b67549b8054 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -469,7 +469,8 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) else event = DLG_EVENT_RPL3xx; - next_state_dlg( dlg, event, &old_state, &new_state, &unref); + last_dst_leg = DLG_CALLER_LEG; + next_state_dlg(dlg, event, DLG_DIR_UPSTREAM, &old_state, &new_state, &unref); if (new_state==DLG_STATE_EARLY && old_state!=DLG_STATE_EARLY) { run_dlg_callbacks(DLGCB_EARLY, dlg, rpl, DLG_DIR_UPSTREAM, 0); @@ -1123,8 +1124,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) /* save last_dst_leg before running state machine * helpful for logging various bogus cases according to the RFC */ last_dst_leg = dst_leg; - - next_state_dlg( dlg, event, &old_state, &new_state, &unref); + next_state_dlg( dlg, event, dir, &old_state, &new_state, &unref); /* set current dialog - it will keep a ref! */ set_current_dialog(dlg); @@ -1428,7 +1428,9 @@ void dlg_ontimeout( struct dlg_tl *tl) return ; } - next_state_dlg( dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref); + /* act like as if we've received a BYE from caller */ + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg( dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) { LM_DBG("timeout for dlg with CallID '%.*s' and tags '%.*s' '%.*s'\n", diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 0737d677d2d..7cf1bf0419b 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -764,7 +764,7 @@ static inline void log_next_state_dlg(const int event, void next_state_dlg(struct dlg_cell *dlg, int event, - int *old_state, int *new_state, int *unref) + int dir, int *old_state, int *new_state, int *unref) { struct dlg_entry *d_entry; @@ -856,7 +856,7 @@ void next_state_dlg(struct dlg_cell *dlg, int event, switch (dlg->state) { case DLG_STATE_CONFIRMED_NA: case DLG_STATE_CONFIRMED: - if ( last_dst_leg!=dlg->legs_no[DLG_LEG_200OK] ) + if (dir == DLG_DIR_DOWNSTREAM && last_dst_leg!=dlg->legs_no[DLG_LEG_200OK] ) /* to end the call, the BYE must be received * on the same leg as the 200 OK for INVITE */ break; diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index e3c7d9a88b9..69cb9184eb3 100644 --- a/modules/dialog/dlg_hash.h +++ b/modules/dialog/dlg_hash.h @@ -275,7 +275,7 @@ void unref_dlg(struct dlg_cell *dlg, unsigned int cnt); void ref_dlg(struct dlg_cell *dlg, unsigned int cnt); void next_state_dlg(struct dlg_cell *dlg, int event, - int *old_state, int *new_state, int *unref); + int dir, int *old_state, int *new_state, int *unref); struct mi_root * mi_print_dlgs(struct mi_root *cmd, void *param ); struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd, void *param ); diff --git a/modules/dialog/dlg_replication.c b/modules/dialog/dlg_replication.c index b6a91b3a77e..e5608552a6c 100644 --- a/modules/dialog/dlg_replication.c +++ b/modules/dialog/dlg_replication.c @@ -33,6 +33,8 @@ extern int active_dlgs_cnt; extern int early_dlgs_cnt; +extern int last_dst_leg; + extern int dlg_enable_stats; extern stat_var *active_dlgs; @@ -380,7 +382,9 @@ int dlg_replicated_delete(void) destroy_linkers(dlg->profile_links); dlg->profile_links = NULL; - next_state_dlg(dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref); + /* simulate BYE received from caller */ + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg(dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); if (old_state == new_state) { LM_ERR("duplicate dialog delete request (callid: |%.*s|" diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 8545a470e48..675fe8c01cf 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -212,7 +212,8 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ int event, old_state, new_state, unref, ret; event = DLG_EVENT_REQBYE; - next_state_dlg(dlg, event, &old_state, &new_state, &unref); + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg(dlg, event, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); unref += extra_unref; if(new_state == DLG_STATE_DELETED && old_state != DLG_STATE_DELETED){ From fa9cb4addb85033b99a0d958f36cffa5cceb72c4 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 28 Aug 2013 11:37:06 +0300 Subject: [PATCH 028/159] - removed unused variable --- modules/sst/sst_handlers.c | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/sst/sst_handlers.c b/modules/sst/sst_handlers.c index 04c506c81c3..4d551b56d31 100644 --- a/modules/sst/sst_handlers.c +++ b/modules/sst/sst_handlers.c @@ -421,7 +421,6 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, sst_info_t *info = (sst_info_t *)*(params->param); sst_msg_info_t minfo = {0,0,0,0}; struct sip_msg* msg = params->msg; - int *param; if (msg->first_line.type == SIP_REQUEST) { if ((msg->first_line.u.request.method_value == METHOD_INVITE || From 062baa3561bfeebe638e65eb895db964caf5a26f Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 28 Aug 2013 16:03:56 +0300 Subject: [PATCH 029/159] - complete backport from 1.8 of pull request #15 --- modules/pua_dialoginfo/pua_dialoginfo.c | 66 +++++++++++-------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/modules/pua_dialoginfo/pua_dialoginfo.c b/modules/pua_dialoginfo/pua_dialoginfo.c index 8647da4979c..3b7a0440bf5 100644 --- a/modules/pua_dialoginfo/pua_dialoginfo.c +++ b/modules/pua_dialoginfo/pua_dialoginfo.c @@ -88,7 +88,7 @@ static pv_spec_t caller_spec; static pv_spec_t callee_spec; static int osips_ps = 1; static int publish_on_trying = 0; -static int publish_on_reinvite = 0; +static int nopublish_flag = -1; /** module functions */ @@ -110,12 +110,12 @@ static param_export_t params[]={ {"include_localremote", INT_PARAM, &include_localremote }, {"include_tags", INT_PARAM, &include_tags }, {"caller_confirmed", INT_PARAM, &caller_confirmed }, - {"publish_on_reinvite", INT_PARAM, &publish_on_reinvite }, {"publish_on_trying", INT_PARAM, &publish_on_trying }, {"presence_server", STR_PARAM, &presence_server.s }, {"caller_spec_param", STR_PARAM, &caller_spec_param.s }, {"callee_spec_param", STR_PARAM, &callee_spec_param.s }, {"osips_ps", INT_PARAM, &osips_ps }, + {"nopublish_flag", INT_PARAM, &nopublish_flag }, {0, 0, 0 } }; @@ -245,6 +245,7 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para struct to_body peer_to_body; str entity_uri= {0, 0}; int buf_len = 255; + struct sip_msg* msg = _params->msg; flag_str.s = &flag; flag_str.len = 1; @@ -312,7 +313,14 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para if(flag == DLG_PUB_AB || flag == DLG_PUB_B) dialog_publish("terminated", &peer_to_body, &from, &(dlg->callid), 0, 0, 0, 0); break; - case DLGCB_REQ_WITHIN: + case DLGCB_RESPONSE_WITHIN: + if (get_cseq(msg)->method_id==METHOD_INVITE || get_cseq(msg)->method_id==METHOD_INVITE) { + if (msg->flags & nopublish_flag) { + LM_DBG("nopublish flag was set for this INVITE\n"); + break; + } + LM_DBG("nopublish flag not set for this INVITE, will publish\n"); + } case DLGCB_CONFIRMED: LM_DBG("dialog confirmed, from=%.*s\n", dlg->from_uri.len, dlg->from_uri.s); if(flag == DLG_PUB_AB || flag == DLG_PUB_A) @@ -393,23 +401,12 @@ static void __dialog_loaded(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) { /* register dialog callbacks which triggers sending PUBLISH */ - if (publish_on_reinvite) { - if (dlg_api.register_dlgcb(dlg, - DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | - DLGCB_REQ_WITHIN | DLGCB_EARLY, - __dialog_sendpublish, 0, 0) != 0) { - LM_ERR("cannot register callback for interesting dialog types\n"); - } - } - else { - if (dlg_api.register_dlgcb(dlg, - DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | - DLGCB_EARLY, - __dialog_sendpublish, 0, 0) != 0) { - LM_ERR("cannot register callback for interesting dialog types\n"); - } + if (dlg_api.register_dlgcb(dlg, + DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | + DLGCB_RESPONSE_WITHIN | DLGCB_EARLY, + __dialog_sendpublish, 0, 0) != 0) { + LM_ERR("cannot register callback for interesting dialog types\n"); } - LM_ERR("ici: LOADED DB CB\n"); } @@ -498,6 +495,12 @@ static int mod_init(void) } pua_send_publish= pua.send_publish; + if (nopublish_flag!= -1 && nopublish_flag > MAX_FLAG) { + LM_ERR("invalid nopublish flag %d!!\n", nopublish_flag); + return -1; + } + nopublish_flag = (nopublish_flag!=-1)?(1< Date: Wed, 28 Aug 2013 16:15:26 +0300 Subject: [PATCH 030/159] - complete backport from 1.8 of pull request #15 --- modules/presence_dialoginfo/notify_body.c | 29 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index b2aa2ac1f61..6d2edcb0175 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -59,12 +59,33 @@ void free_xml_body(char* body) str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n, int off_index) { str* n_body= NULL; + str *pres_uri= NULL; + char buf[MAX_URI_SIZE+1]; - LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n", - pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n); + if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { + LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); + return NULL; + } + memcpy(buf, "sip:", 4); + memcpy(buf+4, pres_user->s, pres_user->len); + buf[pres_user->len+4] = '@'; + memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); + buf[pres_user->len + 5 + pres_domain->len]= '\0'; + + pres_uri = (str*)pkg_malloc(sizeof(str)); + if(pres_uri == NULL) + { + LM_ERR("while allocating memory\n"); + return NULL; + } + memset(pres_uri, 0, sizeof(str)); + pres_uri->s = buf; + pres_uri->len = pres_user->len + 5 + pres_domain->len; + + LM_DBG("[pres_uri] %.*s, [n]=%d\n", pres_uri->len, pres_uri->s, n); if(body_array== NULL) - return build_dialoginfo(pres_user, pres_domain); + return build_empty_dialoginfo(pres_uri, NULL); n_body= agregate_xmls(pres_user, pres_domain, body_array, n); LM_DBG("[n_body]=%p\n", n_body); @@ -81,7 +102,7 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n xmlMemoryDump(); if (n_body== NULL) - n_body= build_dialoginfo(pres_user, pres_domain); + n_body= build_empty_dialoginfo(pres_uri, NULL); return n_body; } From f44264ab837d315b93f9ed24673c8b1d2fcd5f68 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 28 Aug 2013 17:44:31 +0300 Subject: [PATCH 031/159] - complete port of pull request #34 --- modules/presence/hash.c | 5 +++-- modules/presence/presentity.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/presence/hash.c b/modules/presence/hash.c index 93b285b3b2c..e7042fa9e59 100644 --- a/modules/presence/hash.c +++ b/modules/presence/hash.c @@ -355,7 +355,7 @@ int update_shtable(shtable_t htable,unsigned int hash_code, else { subs->local_cseq= s->local_cseq++; - s->version= subs->version+ 1; + subs->version= s->version++; } if(strncmp(s->contact.s, subs->contact.s, subs->contact.len)) @@ -583,7 +583,8 @@ void next_turn_phtable(pres_entry_t* p_p, unsigned int hash_code) for ( p=pres_htable[hash_code].entries->next ; p ; p=p->next ) { if(p==p_p) { p->current_turn++; - LM_DBG("xXx - new current turn is %d\n",p->current_turn); + LM_DBG("new current turn is %d for <%.*s>\n",p->current_turn, + p_p->pres_uri.len, p_p->pres_uri.s); break; } } diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index 13acca9ffaa..756da283317 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -551,7 +551,8 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r if (p) { turn = p->last_turn++; - LM_DBG("xXx - my turn is %d, current turn is %d\n",turn, p->current_turn); + LM_DBG("pres <%.*s> my turn is %d, current turn is %d\n",pres_uri.len, + pres_uri.s, turn, p->current_turn); /* wait to get our turn as order of handling pubishs (need to wait the ongoing published to terminate @@ -1006,7 +1007,7 @@ int pres_htable_restore(void) sphere= extract_sphere(body); } - if(insert_phtable(&uri, event, &etag, sphere, 0)< 0) + if(insert_phtable(&uri, event, &etag, sphere, 0)== NULL) { LM_ERR("inserting record in presentity hash table"); pkg_free(uri.s); From 017274cee799ec5adb8974886fd8a6ce254ff548 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Thu, 29 Aug 2013 05:22:18 -0700 Subject: [PATCH 032/159] Merge pull request #58 from saghul/pua_double_free Fixed double free issue in pua module --- modules/pua/hash.c | 8 ++------ modules/pua/send_subscribe.c | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/modules/pua/hash.c b/modules/pua/hash.c index c54ef527d92..0fda19bfea3 100644 --- a/modules/pua/hash.c +++ b/modules/pua/hash.c @@ -504,13 +504,11 @@ void free_htable_entry(ua_pres_t* p) pua_db_delete(p); if(p->etag.s) - { shm_free(p->etag.s); - } - else if(p->remote_contact.s) shm_free(p->remote_contact.s); - if(p->extra_headers.s) shm_free(p->extra_headers.s); + if(p->extra_headers.s) + shm_free(p->extra_headers.s); shm_free(p); } @@ -789,8 +787,6 @@ int update_contact(struct sip_msg* msg, char* str1, char* str2) return -1; } - shm_free(p->remote_contact.s); - if(!(p->remote_contact.len== contact.len && strncmp(p->remote_contact.s, contact.s, contact.len)==0)) { diff --git a/modules/pua/send_subscribe.c b/modules/pua/send_subscribe.c index b0a1f53dbc3..5696e91633e 100644 --- a/modules/pua/send_subscribe.c +++ b/modules/pua/send_subscribe.c @@ -525,7 +525,8 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) presentity->extra_headers.s= (char*)shm_malloc(hentity->extra_headers.len* sizeof(char)); if(presentity->extra_headers.s== NULL) { - ERR_MEM(SHARE_MEM); + LM_ERR("no more share memory\n"); + goto mem_error; } memcpy(presentity->extra_headers.s, hentity->extra_headers.s, hentity->extra_headers.len); presentity->extra_headers.len= hentity->extra_headers.len; @@ -535,7 +536,8 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) presentity->remote_contact.s= (char*)shm_malloc(contact.len* sizeof(char)); if(presentity->remote_contact.s== NULL) { - ERR_MEM(SHARE_MEM); + LM_ERR("no more share memory\n"); + goto mem_error; } memcpy(presentity->remote_contact.s, contact.s, contact.len); presentity->remote_contact.len= contact.len; @@ -561,20 +563,22 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) hentity->flag= flag; run_pua_callbacks( hentity, msg); } + error: - if(hentity) - { - if(presentity) - { - if(presentity->extra_headers.s) - shm_free(presentity->extra_headers.s); - if(presentity->remote_contact.s) - shm_free(presentity->remote_contact.s); - } - shm_free(hentity); - hentity= NULL; - } + if(hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); + shm_free(hentity); return; + +mem_error: + if(presentity->extra_headers.s) + shm_free(presentity->extra_headers.s); + if(presentity->remote_contact.s) + shm_free(presentity->remote_contact.s); + shm_free(presentity); + if(hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); + shm_free(hentity); } ua_pres_t* subscribe_cbparam(subs_info_t* subs, int ua_flag) @@ -885,6 +889,8 @@ int send_subscribe(subs_info_t* subs) if(result< 0) { LM_ERR("while sending request with t_request\n"); + if (hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); shm_free(hentity); goto done; } From a9fcd84cbbc0b0b112218e4d841491255844ddcb Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Thu, 29 Aug 2013 16:26:14 +0300 Subject: [PATCH 033/159] Fix replicated dialog profile management in distributed systems - replication-receiving instances must not do any profile-related DB queries (cherry picked from commit 20c92450fac2fd45506f759f7b19473a3dc657f9) --- modules/dialog/dialog.c | 4 ++-- modules/dialog/dlg_db_handler.c | 14 ++++++++------ modules/dialog/dlg_db_handler.h | 3 ++- modules/dialog/dlg_handlers.c | 6 +++--- modules/dialog/dlg_hash.c | 2 +- modules/dialog/dlg_load.h | 2 +- modules/dialog/dlg_profile.c | 14 +++++++------- modules/dialog/dlg_profile.h | 9 ++++++--- modules/dialog/dlg_replication.c | 6 +++--- modules/dialog/dlg_req_within.c | 2 +- 10 files changed, 34 insertions(+), 28 deletions(-) diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c index eca7a8b98cc..99583144703 100644 --- a/modules/dialog/dialog.c +++ b/modules/dialog/dialog.c @@ -1052,13 +1052,13 @@ static int w_set_dlg_profile(struct sip_msg *msg, char *profile, char *value) return -1; } if ( set_dlg_profile( msg, &val_s, - (struct dlg_profile_table*)profile) < 0 ) { + (struct dlg_profile_table*)profile, 0) < 0 ) { LM_ERR("failed to set profile\n"); return -1; } } else { if ( set_dlg_profile( msg, NULL, - (struct dlg_profile_table*)profile) < 0 ) { + (struct dlg_profile_table*)profile, 0) < 0 ) { LM_ERR("failed to set profile\n"); return -1; } diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index 17b4b4f6195..11f220ea408 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -387,7 +387,8 @@ void read_dialog_vars(char *b, int l, struct dlg_cell *dlg) } -void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check) +void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check, + char is_replicated) { struct dlg_profile_table *profile; struct dlg_profile_link *it; @@ -458,7 +459,8 @@ void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check) continue; } } - if (set_dlg_profile( NULL, profile->has_value?&val:NULL, profile) < 0 ) + if (set_dlg_profile( NULL, profile->has_value ? &val : NULL, profile, + is_replicated) < 0 ) LM_ERR("failed to add to profile, skipping....\n"); next: ; @@ -624,7 +626,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) /* profiles */ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), dlg,0); + strlen(VAL_STR(values+18).s), dlg, 0, 0); /* script flags */ @@ -1565,7 +1567,7 @@ static int sync_dlg_db_mem(void) /* profiles */ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), dlg,0); + strlen(VAL_STR(values+18).s), dlg, 0, 0); /* script flags */ @@ -1729,7 +1731,7 @@ static int sync_dlg_db_mem(void) * is dlg is already in that profile*/ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), known_dlg,1); + strlen(VAL_STR(values+18).s), known_dlg, 1, 0); dlg_unlock( d_table, d_entry); } else { @@ -1806,7 +1808,7 @@ static int sync_dlg_db_mem(void) * is dlg is already in that profile*/ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), known_dlg,1); + strlen(VAL_STR(values+18).s), known_dlg, 1, 0); dlg_unlock( d_table, d_entry); } diff --git a/modules/dialog/dlg_db_handler.h b/modules/dialog/dlg_db_handler.h index 227cb772d4e..973adb008d0 100644 --- a/modules/dialog/dlg_db_handler.h +++ b/modules/dialog/dlg_db_handler.h @@ -111,7 +111,8 @@ int update_dialog_dbinfo(struct dlg_cell * cell); void dialog_update_db(unsigned int ticks, void * param); void read_dialog_vars(char *b, int l, struct dlg_cell *dlg); -void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg, int double_check); +void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg, + int double_check, char is_replicated); str* write_dialog_vars(struct dlg_val *vars); str* write_dialog_profiles(struct dlg_profile_link *links); diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index b67549b8054..38a5249c2c6 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -539,7 +539,7 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) LM_DBG("dialog %p failed (negative reply)\n", dlg); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; /* dialog setup not completed (3456XX) */ @@ -1140,7 +1140,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) old_state!=DLG_STATE_DELETED) { /*destroy linkers */ - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; if (!dlg->terminate_reason.s) { @@ -1441,7 +1441,7 @@ void dlg_ontimeout( struct dlg_tl *tl) ZSW(dlg->legs[callee_idx(dlg)].tag.s)); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; /* dialog timeout */ diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 7cf1bf0419b..142209060a4 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -162,7 +162,7 @@ static inline void free_dlg_dlg(struct dlg_cell *dlg) destroy_dlg_callbacks_list(dlg->cbs.first); if (dlg->profile_links) - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); if (dlg->legs) { for( i=0 ; ilegs_no[DLG_LEGS_USED] ; i++) { diff --git a/modules/dialog/dlg_load.h b/modules/dialog/dlg_load.h index 53664bed0dd..600a42d2080 100644 --- a/modules/dialog/dlg_load.h +++ b/modules/dialog/dlg_load.h @@ -44,7 +44,7 @@ struct dlg_binds { add_profiles_f add_profiles; search_dlg_profile_f search_profile; set_dlg_profile_f set_profile; - set_dlg_profile_f unset_profile; + unset_dlg_profile_f unset_profile; get_profile_size_f get_profile_size; store_dlg_value_f store_dlg_value; fetch_dlg_value_f fetch_dlg_value; diff --git a/modules/dialog/dlg_profile.c b/modules/dialog/dlg_profile.c index 0088107a414..d0f21816f37 100644 --- a/modules/dialog/dlg_profile.c +++ b/modules/dialog/dlg_profile.c @@ -540,7 +540,7 @@ void destroy_dlg_profiles(void) -void destroy_linkers(struct dlg_profile_link *linker) +void destroy_linkers(struct dlg_profile_link *linker, char is_replicated) { map_t entry; struct dlg_profile_link *l; @@ -573,7 +573,7 @@ void destroy_linkers(struct dlg_profile_link *linker) l->profile->counts[l->hash_idx]--; lock_set_release( l->profile->locks, l->hash_idx ); - } else { + } else if (!is_replicated) { if (!cdbc) { LM_WARN("CacheDB not initialized - some information might" " not be deleted from the cachedb engine\n"); @@ -632,7 +632,7 @@ inline static unsigned int calc_hash_profile( str *value, struct dlg_cell *dlg, static void link_dlg_profile(struct dlg_profile_link *linker, - struct dlg_cell *dlg) + struct dlg_cell *dlg, char is_replicated) { unsigned int hash; map_t p_entry; @@ -674,7 +674,7 @@ static void link_dlg_profile(struct dlg_profile_link *linker, linker->profile->counts[hash]++; lock_set_release( linker->profile->locks,hash ); - } else { + } else if (!is_replicated) { if (!cdbc) { LM_WARN("Cachedb not initialized yet - cannot update profile\n"); LM_WARN("Make sure that the dialog profile information is persistent\n"); @@ -717,7 +717,7 @@ static void link_dlg_profile(struct dlg_profile_link *linker, int set_dlg_profile(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile) + struct dlg_profile_table *profile, char is_replicated) { struct dlg_cell *dlg; struct dlg_profile_link *linker; @@ -749,7 +749,7 @@ int set_dlg_profile(struct sip_msg *msg, str *value, } /* add linker to the dialog and profile */ - link_dlg_profile( linker, dlg); + link_dlg_profile( linker, dlg, is_replicated); dlg->flags |= DLG_FLAG_VP_CHANGED; return 0; @@ -804,7 +804,7 @@ int unset_dlg_profile(struct sip_msg *msg, str *value, dlg->flags |= DLG_FLAG_VP_CHANGED; dlg_unlock( d_table, d_entry); /* remove linker from profile table and free it */ - destroy_linkers(linker); + destroy_linkers(linker, 0); return 1; } diff --git a/modules/dialog/dlg_profile.h b/modules/dialog/dlg_profile.h index bf58bafddfb..d7e352e30e5 100644 --- a/modules/dialog/dlg_profile.h +++ b/modules/dialog/dlg_profile.h @@ -80,7 +80,10 @@ struct dlg_profile_table { }; typedef int (*set_dlg_profile_f)(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile); + struct dlg_profile_table *profile, char is_replicated); + +typedef int (*unset_dlg_profile_f)(struct sip_msg *msg, str *value, + struct dlg_profile_table *profile); typedef unsigned int (*get_profile_size_f)(struct dlg_profile_table *profile, str *value); @@ -102,10 +105,10 @@ void destroy_dlg_profiles(); struct dlg_profile_table* search_dlg_profile(str *name); -void destroy_linkers(struct dlg_profile_link *linker); +void destroy_linkers(struct dlg_profile_link *linker, char is_replicated); int set_dlg_profile(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile); + struct dlg_profile_table *profile, char is_replicated); int unset_dlg_profile(struct sip_msg *msg, str *value, struct dlg_profile_table *profile); diff --git a/modules/dialog/dlg_replication.c b/modules/dialog/dlg_replication.c index e5608552a6c..bb85909c6fe 100644 --- a/modules/dialog/dlg_replication.c +++ b/modules/dialog/dlg_replication.c @@ -245,7 +245,7 @@ int dlg_replicated_create(struct dlg_cell *cell, str *ftag, str *ttag, int safe) dlg_unlock(d_table, d_entry); if (profiles.s && profiles.len != 0) - read_dialog_profiles(profiles.s, profiles.len, dlg, 0); + read_dialog_profiles(profiles.s, profiles.len, dlg, 0, 1); if_update_stat(dlg_enable_stats, active_dlgs, 1); @@ -346,7 +346,7 @@ int dlg_replicated_update(void) dlg_unlock(d_table, d_entry); if (profiles.s && profiles.len != 0) - read_dialog_profiles(profiles.s, profiles.len, dlg, 1); + read_dialog_profiles(profiles.s, profiles.len, dlg, 1, 1); return 0; @@ -379,7 +379,7 @@ int dlg_replicated_delete(void) return -1; } - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 1); dlg->profile_links = NULL; /* simulate BYE received from caller */ diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 675fe8c01cf..ba3935057c3 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -222,7 +222,7 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ dlg->h_entry, dlg->h_id); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; /* remove from timer */ From 14b667ac00b79cf7b4b13d03097a9034af42045a Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Thu, 29 Aug 2013 08:13:30 -0700 Subject: [PATCH 034/159] Merge pull request #68 from wdoekes/wjd-fix_nathelper_memleak Fix memleak in nathelper natping when "failed to fetch contacts". --- modules/nathelper/nathelper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c index a7093c4611b..85963eacf7f 100644 --- a/modules/nathelper/nathelper.c +++ b/modules/nathelper/nathelper.c @@ -1151,7 +1151,8 @@ nh_timer(unsigned int ticks, void *timer_idx) { static unsigned int iteration = 0; int rval; - void *buf, *cp; + void *buf = NULL; + void *cp; str c; str opt; str path; @@ -1164,7 +1165,6 @@ nh_timer(unsigned int ticks, void *timer_idx) if((*natping_state) == 0) goto done; - buf = NULL; if (cblen > 0) { buf = pkg_malloc(cblen); if (buf == NULL) { @@ -1192,7 +1192,6 @@ nh_timer(unsigned int ticks, void *timer_idx) ((unsigned int)(unsigned long)timer_idx)*natping_interval+iteration, natping_processes*natping_interval); if (rval != 0) { - pkg_free(buf); goto done; } } @@ -1283,8 +1282,9 @@ nh_timer(unsigned int ticks, void *timer_idx) tcp_no_new_conn = 0; #endif - pkg_free(buf); done: + if (buf) + pkg_free(buf); iteration++; if (iteration==natping_interval) iteration = 0; From 6ee40a5ab47885b9bdb3e5bbe844d6f70e8dc2d6 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Fri, 30 Aug 2013 12:14:58 +0300 Subject: [PATCH 035/159] Fix compilation issue introduced in commit a9fcd84c (cherry picked from commit 6f8244921231ed837f1d54204cf6b616c33cabc4) --- modules/load_balancer/lb_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/load_balancer/lb_data.c b/modules/load_balancer/lb_data.c index fe88d3c30f2..eb400e55b17 100644 --- a/modules/load_balancer/lb_data.c +++ b/modules/load_balancer/lb_data.c @@ -550,7 +550,7 @@ int do_load_balance(struct sip_msg *req, int grp, struct lb_res_str_list *rl, /* add to the profiles */ for( i=0 ; in ; i++) { if (lb_dlg_binds.set_profile( req, &dst->profile_id, - call_res[i]->profile)!=0) + call_res[i]->profile, 0)!=0) LM_ERR("failed to add to profile\n"); } } @@ -741,7 +741,7 @@ int lb_count_call(struct lb_data *data, struct sip_msg *req, /* add to the profiles */ for( i=0 ; in ; i++) { if (lb_dlg_binds.set_profile( req, &dst->profile_id, - call_res[i]->profile)!=0) + call_res[i]->profile, 0)!=0) LM_ERR("failed to add to profile\n"); } From 21b91ad2f437b9893f927234989faf6c10c4c44b Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 30 Aug 2013 16:10:12 +0300 Subject: [PATCH 036/159] - fixed NULL sockets in external scenarios (this leads to crashing when building the contact hdr) Reported by dexteruk on IRC . --- modules/b2b_logic/logic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/b2b_logic/logic.c b/modules/b2b_logic/logic.c index ba78ce1cfca..30807b04235 100644 --- a/modules/b2b_logic/logic.c +++ b/modules/b2b_logic/logic.c @@ -584,8 +584,9 @@ b2bl_entity_id_t* b2bl_new_client(str* to_uri, str* from_uri, ci.extra_headers = tuple->extra_headers; ci.body = (tuple->sdp.s?&tuple->sdp:NULL); ci.from_tag = NULL; - ci.send_sock = msg?(msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address):NULL;; - get_local_contact( ci.send_sock, &ci.local_contact); + ci.send_sock = msg?(msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address):NULL; + if (ci.send_sock) get_local_contact( ci.send_sock, &ci.local_contact); + else ci.local_contact = server_address; if(msg) { @@ -679,7 +680,7 @@ int process_bridge_200OK(struct sip_msg* msg, str* extra_headers, ci.extra_headers = extra_headers; ci.body = body; ci.from_tag = NULL; - ci.send_sock = msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address;; + ci.send_sock = msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address; get_local_contact( ci.send_sock, &ci.local_contact); if (str2int( &(get_cseq(msg)->number), &ci.cseq)!=0 ) @@ -3525,7 +3526,7 @@ int b2bl_bridge(str* key, str* new_dst, str* new_from_dname, int entity_no) ci.extra_headers = tuple->extra_headers; ci.body = tuple->b1_sdp.s?&tuple->b1_sdp:0; ci.cseq = 1; - get_local_contact( ci.send_sock, &ci.local_contact); + ci.local_contact = tuple->local_contact; client_id = b2b_api.client_new(&ci, b2b_client_notify, b2b_add_dlginfo, tuple->key); From 444207bd88f2436d7262789ba85bda427a5f40bf Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Mon, 2 Sep 2013 18:10:53 +0300 Subject: [PATCH 037/159] Fix replication of dialog delete events - instead of sending "deleted" packets based on hash delete operations, they are now sent when a dialog changes state to "DLG_STATE_DELETED" - this prevents the receiving instance from replicating the event again (cherry picked from commit 5a63dcdf87c8d69c3dc9e5d6330f3d58953c28b5) --- modules/dialog/dlg_handlers.c | 10 ++++++---- modules/dialog/dlg_hash.c | 10 +++++----- modules/dialog/dlg_hash.h | 2 +- modules/dialog/dlg_replication.c | 3 ++- modules/dialog/dlg_req_within.c | 3 ++- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 38a5249c2c6..e30596845b7 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -470,7 +470,8 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) event = DLG_EVENT_RPL3xx; last_dst_leg = DLG_CALLER_LEG; - next_state_dlg(dlg, event, DLG_DIR_UPSTREAM, &old_state, &new_state, &unref); + next_state_dlg(dlg, event, DLG_DIR_UPSTREAM, &old_state, &new_state, + &unref, 0); if (new_state==DLG_STATE_EARLY && old_state!=DLG_STATE_EARLY) { run_dlg_callbacks(DLGCB_EARLY, dlg, rpl, DLG_DIR_UPSTREAM, 0); @@ -1124,7 +1125,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) /* save last_dst_leg before running state machine * helpful for logging various bogus cases according to the RFC */ last_dst_leg = dst_leg; - next_state_dlg( dlg, event, dir, &old_state, &new_state, &unref); + next_state_dlg( dlg, event, dir, &old_state, &new_state, &unref, 0); /* set current dialog - it will keep a ref! */ set_current_dialog(dlg); @@ -1266,7 +1267,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) dlg_lock (d_table, d_entry); if (dlg->legs[dst_leg].last_gen_cseq) { - + update_val = ++(dlg->legs[dst_leg].last_gen_cseq); dlg_unlock( d_table, d_entry ); @@ -1430,7 +1431,8 @@ void dlg_ontimeout( struct dlg_tl *tl) /* act like as if we've received a BYE from caller */ last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; - next_state_dlg( dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); + next_state_dlg( dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, + &new_state, &unref, 0); if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) { LM_DBG("timeout for dlg with CallID '%.*s' and tags '%.*s' '%.*s'\n", diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 142209060a4..75073c895fc 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -219,9 +219,6 @@ inline void destroy_dlg(struct dlg_cell *dlg) run_dlg_callbacks( DLGCB_DESTROY , dlg, 0, DLG_DIR_NONE, 0); - if (replication_dests) - replicate_dialog_deleted(dlg); - free_dlg_dlg(dlg); } @@ -763,8 +760,8 @@ static inline void log_next_state_dlg(const int event, } -void next_state_dlg(struct dlg_cell *dlg, int event, - int dir, int *old_state, int *new_state, int *unref) +void next_state_dlg(struct dlg_cell *dlg, int event, int dir, int *old_state, + int *new_state, int *unref, char is_replicated) { struct dlg_entry *d_entry; @@ -908,6 +905,9 @@ void next_state_dlg(struct dlg_cell *dlg, int event, dlg_unlock( d_table, d_entry); + if (!is_replicated && replication_dests && dlg->state == DLG_STATE_DELETED) + replicate_dialog_deleted(dlg); + LM_DBG("dialog %p changed from state %d to " "state %d, due event %d\n",dlg,*old_state,*new_state,event); } diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index 69cb9184eb3..f8176135e82 100644 --- a/modules/dialog/dlg_hash.h +++ b/modules/dialog/dlg_hash.h @@ -275,7 +275,7 @@ void unref_dlg(struct dlg_cell *dlg, unsigned int cnt); void ref_dlg(struct dlg_cell *dlg, unsigned int cnt); void next_state_dlg(struct dlg_cell *dlg, int event, - int dir, int *old_state, int *new_state, int *unref); + int dir, int *old_state, int *new_state, int *unref, char is_replicated); struct mi_root * mi_print_dlgs(struct mi_root *cmd, void *param ); struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd, void *param ); diff --git a/modules/dialog/dlg_replication.c b/modules/dialog/dlg_replication.c index bb85909c6fe..420dae2ef33 100644 --- a/modules/dialog/dlg_replication.c +++ b/modules/dialog/dlg_replication.c @@ -384,7 +384,8 @@ int dlg_replicated_delete(void) /* simulate BYE received from caller */ last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; - next_state_dlg(dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); + next_state_dlg(dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, + &new_state, &unref, 1); if (old_state == new_state) { LM_ERR("duplicate dialog delete request (callid: |%.*s|" diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index ba3935057c3..c012a85193c 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -213,7 +213,8 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ event = DLG_EVENT_REQBYE; last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; - next_state_dlg(dlg, event, DLG_DIR_DOWNSTREAM, &old_state, &new_state, &unref); + next_state_dlg(dlg, event, DLG_DIR_DOWNSTREAM, &old_state, &new_state, + &unref, 0); unref += extra_unref; if(new_state == DLG_STATE_DELETED && old_state != DLG_STATE_DELETED){ From 63b158d6f179b1c95cf6756e414b2a9973834707 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Tue, 3 Sep 2013 15:26:09 +0300 Subject: [PATCH 038/159] Fix several usrloc named flag issues - fix get_all_db_ucontacts() lookup logic to work with named flags - fix "Cflags" row of MI *ul_dump* command - fix DB contact update function to properly store the flags (cherry picked from commit b33d4b3f019c157a5e63b21a846ad9f891da559e) --- flags.c | 11 +- modules/usrloc/dlist.c | 253 +++++++++++++++++++++++--------------- modules/usrloc/ucontact.c | 5 +- modules/usrloc/ul_mi.c | 5 +- 4 files changed, 167 insertions(+), 107 deletions(-) diff --git a/flags.c b/flags.c index 077ddbd2e5f..7ec2c89855d 100644 --- a/flags.c +++ b/flags.c @@ -109,6 +109,7 @@ str bitmask_to_flag_list(enum flag_type type, int bitmask) int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) { char *p, *lim; + char *crt_flag; str name; struct flag_entry *e; int ret = 0; @@ -117,14 +118,15 @@ int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) return 0; lim = flags->s + flags->len; + crt_flag = flags->s; for (p = flags->s; p <= lim; p++) { if (p == lim || *p == delim) { - name.s = flags->s; - name.len = p - flags->s; + name.s = crt_flag; + name.len = p - crt_flag; for (e = flag_lists[type]; e; e = e->next) { - if (e->name.len == p - flags->s && + if (e->name.len == p - crt_flag && str_strcmp(&e->name, &name) == 0) { ret |= 1 << e->bit; @@ -132,7 +134,7 @@ int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) } } - flags->s = p + 1; + crt_flag = p + 1; } } @@ -190,6 +192,7 @@ int get_flag_id_by_name(int flag_type, char *flag_name) it->next = *flag_list; *flag_list = it; + LM_DBG("New flag: [ %.*s : %d ][%d]\n", fn.len, fn.s, it->bit, flag_type); return it->bit; } diff --git a/modules/usrloc/dlist.c b/modules/usrloc/dlist.c index 9a0ffe86ad2..61ccd1b9420 100644 --- a/modules/usrloc/dlist.c +++ b/modules/usrloc/dlist.c @@ -92,53 +92,61 @@ static inline int find_dlist(str* _n, dlist_t** _d) ptr = ptr->next; } - + return 1; } - - -static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags, - unsigned int part_idx, unsigned int part_max) +static int get_all_db_ucontacts(void *buf, int len, unsigned int flags, + unsigned int part_idx, unsigned int part_max) { static char query_buf[512]; static str query_str; struct socket_info *sock; - unsigned int dbflags; - db_res_t* res = NULL; + db_res_t *res = NULL; db_row_t *row; + db_val_t *val; dlist_t *dom; - char *p, *p1; - char now_s[25]; + str host, flag_list; + int i, no_rows = 10; int now_len; + char now_s[25]; + char *p, *p1; int port, proto, p_len, p1_len; - str host; - int i; - void *cp; - int shortage, needed; + unsigned int dbflags; + int needed; + int shortage = 0; - cp = buf; shortage = 0; /* Reserve space for terminating 0000 */ - len -= sizeof(p_len); + len -= sizeof p_len; /* get the current time in DB format */ now_len = 25; - if (db_time2str( time(0), now_s, &now_len)!=0) { + if (db_time2str(time(NULL), now_s, &now_len) != 0) { LM_ERR("failed to print now time\n"); return -1; } - for (dom = root; dom!=NULL ; dom=dom->next) { - /* build query */ - i = snprintf( query_buf, sizeof(query_buf), "select %.*s, %.*s, %.*s," + LM_DBG("buf: %p. flags: %d\n", buf, flags); + + /* for each table */ + for (dom = root; dom; dom = dom->next) { + if (db_check_table_version(&ul_dbf, ul_dbh, dom->d->name, UL_TABLE_VERSION)) + goto error; + + /* read the destinations */ + if (ul_dbf.use_table(ul_dbh, dom->d->name) < 0) { + LM_ERR("cannot select table \"%.*s\"\n", dom->d->name->len, + dom->d->name->s); + goto error; + } + + i = snprintf(query_buf, sizeof query_buf, "select %.*s, %.*s, %.*s," #ifdef ORACLE_USRLOC - " %.*s, %.*s from %s where %.*s > %.*s and " - "bitand(%.*s, %d) = %d and mod(id, %u) = %u", + " %.*s, %.*s from %s where %.*s > %.*s and mod(id, %u) = %u", #else - " %.*s, %.*s from %s where %.*s > %.*s and %.*s & %d = %d and " - "id %% %u = %u", + " %.*s, %.*s from %s where %.*s > %.*s and id %% %u = %u", #endif received_col.len, received_col.s, contact_col.len, contact_col.s, @@ -148,112 +156,161 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags, dom->d->name->s, expires_col.len, expires_col.s, now_len, now_s, - cflags_col.len, cflags_col.s, - flags, flags, part_max, part_idx); - if ( i>=sizeof(query_buf) ) { + part_max, part_idx); + + LM_DBG("query: %.*s\n", (int)(sizeof query_buf), query_buf); + if (i >= sizeof query_buf) { LM_ERR("DB query too long\n"); - return -1; + goto error; } + query_str.s = query_buf; query_str.len = i; - if ( ul_dbf.raw_query( ul_dbh, &query_str, &res)<0 ) { + + if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) { + if (ul_dbf.raw_query(ul_dbh, &query_str, 0) < 0) { + LM_ERR("raw_query failed\n"); + goto error; + } + + no_rows = estimate_available_rows(20+128+20+128+64, 5); + if (no_rows == 0) + no_rows = 10; + + LM_DBG("fetching %d rows\n", no_rows); + + if (ul_dbf.fetch_result(ul_dbh, &res, no_rows) < 0) { + LM_ERR("Error fetching rows\n"); + goto error; + } + } else if (ul_dbf.raw_query(ul_dbh, &query_str, &res) < 0) { LM_ERR("raw_query failed\n"); - return -1; - } - if( RES_ROW_N(res)==0 ) { - ul_dbf.free_result(ul_dbh, res); - continue; + goto error; } - for(i = 0; i < RES_ROW_N(res); i++) { - row = RES_ROWS(res) + i; + do { + for (i = 0; i < RES_ROW_N(res); i++) { + row = RES_ROWS(res) + i; + val = ROW_VALUES(row) + 3; /* cflags */ + flag_list.s = (char *)VAL_STRING(val); + flag_list.len = strlen(flag_list.s); + + LM_DBG("contact cflags: '%.*s'\n", flag_list.len, flag_list.s); + + if (flags) { + /* contact is not flagged at all */ + if (val->nul || !flag_list.s) + continue; + + LM_DBG("masks: param: %d --- %d :db\n", flags, + flag_list_to_bitmask(&flag_list,FLAG_TYPE_BRANCH,FLAG_DELIM)); + + /* check if contact flags match the given bitmask */ + if ((flag_list_to_bitmask(&flag_list, FLAG_TYPE_BRANCH, + FLAG_DELIM) & flags) != flags) + continue; + } - /* received */ - p = (char*)VAL_STRING(ROW_VALUES(row)); - if ( VAL_NULL(ROW_VALUES(row)) || p==0 || p[0]==0 ) { - /* contact */ - p = (char*)VAL_STRING(ROW_VALUES(row)+1); - if (VAL_NULL(ROW_VALUES(row)+1) || p==0 || p[0]==0) { - LM_ERR("empty contact -> skipping\n"); + /* received */ + p = (char*)VAL_STRING(ROW_VALUES(row)); + if (VAL_NULL(ROW_VALUES(row)) || !p || !p[0]) { + /* contact */ + p = (char*)VAL_STRING(ROW_VALUES(row) + 1); + if (VAL_NULL(ROW_VALUES(row) + 1) || !p || *p == '\0') { + LM_ERR("empty contact -> skipping\n"); + continue; + } + } + p_len = strlen(p); + + /* path */ + p1 = (char*)VAL_STRING(ROW_VALUES(row) + 4); + if (VAL_NULL(ROW_VALUES(row) + 4) || !p1 || *p1 == '\0') { + p1 = NULL; + p1_len = 0; + } else + p1_len = strlen(p1); + + needed = (int)(p_len + sizeof p_len + sizeof sock + + sizeof dbflags + p1_len + sizeof p1_len); + + LM_DBG("len: %d, needed: %d\n", len, needed); + + if (len < needed) { + shortage += needed; continue; } - } - p_len = strlen(p); - - /* path */ - p1 = (char*)VAL_STRING(ROW_VALUES(row)+4); - if (VAL_NULL(ROW_VALUES(row)+4) || p1==0 || p1[0]==0){ - p1 = NULL; - p1_len = 0; - } else { - p1_len = strlen(p1); - } - needed = (int)(sizeof(p_len)+p_len+sizeof(sock)+sizeof(dbflags)+ - sizeof(p1_len)+p1_len); - if (len < needed) { - shortage += needed ; - continue; - } + /* write received/contact */ + memcpy(buf, &p_len, sizeof p_len); + buf += sizeof p_len; + memcpy(buf, p, p_len); + buf += p_len; - /* write received/contact */ - memcpy(cp, &p_len, sizeof(p_len)); - cp = (char*)cp + sizeof(p_len); - memcpy(cp, p, p_len); - cp = (char*)cp + p_len; - - /* sock */ - p = (char*)VAL_STRING(ROW_VALUES(row) + 2); - if (VAL_NULL(ROW_VALUES(row)+2) || p==0 || p[0]==0){ - sock = 0; - } else { - if (parse_phostport( p, strlen(p), &host.s, &host.len, - &port, &proto)!=0) { - LM_ERR("bad socket <%s>...ignoring\n", p); - sock = 0; + /* sock */ + p = (char*)VAL_STRING(ROW_VALUES(row) + 2); + if (VAL_NULL(ROW_VALUES(row)+2) || !p || *p == '\0') { + sock = NULL; } else { - sock = grep_sock_info( &host, (unsigned short)port, proto); - if (sock==0) { - LM_DBG("non-local socket <%s>...ignoring\n", p); + if (parse_phostport(p, strlen(p), &host.s, &host.len, + &port, &proto) != 0) { + LM_ERR("bad socket <%s>...ignoring\n", p); + sock = NULL; + } else { + sock = grep_sock_info(&host, (unsigned short)port, proto); + if (!sock) + LM_DBG("non-local socket <%s>...ignoring\n", p); } } - } - /* flags */ - dbflags = VAL_BITMAP(ROW_VALUES(row) + 3); + /* flags */ + dbflags = VAL_BITMAP(ROW_VALUES(row) + 3); + + /* write sock and flags */ + memcpy(buf, &sock, sizeof sock); + buf += sizeof sock; + memcpy(buf, &dbflags, sizeof dbflags); + buf += sizeof dbflags; - /* write sock and flags */ - memcpy(cp, &sock, sizeof(sock)); - cp = (char*)cp + sizeof(sock); - memcpy(cp, &dbflags, sizeof(dbflags)); - cp = (char*)cp + sizeof(dbflags); + /* write path */ + memcpy(buf, &p1_len, sizeof p1_len); + buf += sizeof p1_len; + memcpy(buf, p1, p1_len); + buf += p1_len; - /* write path */ - memcpy(cp, &p1_len, sizeof(p1_len)); - cp = (char*)cp + sizeof(p1_len); - memcpy(cp, p1, p1_len); - cp = (char*)cp + p1_len; + len -= needed; + } + + if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) { + if (ul_dbf.fetch_result(ul_dbh, &res, no_rows) < 0) { + LM_ERR("fetching rows (1)\n"); + goto error; + } + } else + break; - len -= needed; - } /* row cycle */ + } while (RES_ROW_N(res) > 0); ul_dbf.free_result(ul_dbh, res); - } /* domain cycle */ + } - /* len < 0 is possible, if size of the buffer < sizeof(c->c.len) */ + /* len < 0 is possible, if size of the buffer < sizeof c->c.len */ if (len >= 0) - memset(cp, 0, sizeof(p_len)); + memset(buf, 0, sizeof p_len); /* Shouldn't happen */ - if (shortage > 0 && len > shortage) { + if (shortage > 0 && len > shortage) abort(); - } shortage -= len; return shortage > 0 ? shortage : 0; -} +error: + if (res) + ul_dbf.free_result(ul_dbh, res); + return -1; +} static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags, diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c index 749c788d242..f399ddc0686 100644 --- a/modules/usrloc/ucontact.c +++ b/modules/usrloc/ucontact.c @@ -461,7 +461,6 @@ int db_insert_ucontact(ucontact_t* _c,query_list_t **ins_list, int update) vals[7].type = DB_STR; vals[7].nul = 0; vals[7].val.str_val = bitmask_to_flag_list(FLAG_TYPE_BRANCH, _c->cflags); - vals[7].val.str_val.len = vals[7].val.str_val.len; vals[8].type = DB_STR; vals[8].nul = 0; @@ -633,9 +632,9 @@ int db_update_ucontact(ucontact_t* _c) vals2[3].nul = 0; vals2[3].val.bitmap_val = _c->flags; - vals2[4].type = DB_BITMAP; + vals2[4].type = DB_STR; vals2[4].nul = 0; - vals2[4].val.bitmap_val = _c->cflags; + vals2[4].val.str_val = bitmask_to_flag_list(FLAG_TYPE_BRANCH, _c->cflags); vals2[5].type = DB_STR; vals2[5].nul = 0; diff --git a/modules/usrloc/ul_mi.c b/modules/usrloc/ul_mi.c index 5d31112968c..b0a766385b2 100644 --- a/modules/usrloc/ul_mi.c +++ b/modules/usrloc/ul_mi.c @@ -95,6 +95,7 @@ static inline int mi_add_aor_node(struct mi_node *parent, urecord_t* r, time_t t struct mi_node *node; struct mi_attr *attr; ucontact_t* c; + str st; char *p; int len; @@ -189,8 +190,8 @@ static inline int mi_add_aor_node(struct mi_node *parent, urecord_t* r, time_t t return -1; /* cflags */ - p = int2str((unsigned long)c->cflags, &len); - node = add_mi_node_child( cnode, MI_DUP_VALUE, "Cflags", 5, p, len); + st = bitmask_to_flag_list(FLAG_TYPE_BRANCH, c->cflags); + node = add_mi_node_child( cnode, MI_DUP_VALUE, "Cflags", 6, st.s, st.len); if (node==0) return -1; From a039ec9f6b4cf9780ce3b1d51449f0ec29ed82b7 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Tue, 3 Sep 2013 09:16:42 -0700 Subject: [PATCH 039/159] Merge pull request #62 from dsandras/ds-dialoginfo-notifications-fixes Fixed RFC 4235 notifications compliance. --- modules/presence/notify.c | 48 +++++++++++++++++------ modules/presence/notify.h | 6 +-- modules/presence/presence.c | 4 +- modules/presence/presentity.c | 6 +-- modules/presence/publish.c | 2 +- modules/presence/subscribe.c | 6 +-- modules/presence_dialoginfo/notify_body.c | 15 +++++-- 7 files changed, 59 insertions(+), 28 deletions(-) diff --git a/modules/presence/notify.c b/modules/presence/notify.c index ee548cf281b..14fd27d2a23 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -922,7 +922,7 @@ str* get_presence_from_dialog(str* pres_uri, struct sip_uri* uri, } str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, str* publ_body, - str* contact, str* dbody, str* extra_hdrs, free_body_t** free_fct) + str* contact, str* dbody, str* extra_hdrs, free_body_t** free_fct, int from_publish) { int body_col, extra_hdrs_col, expires_col, etag_col= 0; db_res_t *result = NULL; @@ -1257,6 +1257,25 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, str* publ_body body_array[build_off_n] = publ_body; build_off_n = -1; } + + /* RFC 4235 states that a NOTIFY generated after an initial + * or refreshed SUBSCRIBE request must contain a full-state notification. + * In other cases, only the modified state should be notified using + * a partial state notification. + */ + if (event->evp->parsed == EVENT_DIALOG && from_publish && publ_body) { + + /* Presence dialoginfo knows that special n value of -2 means we publish + * a partial state. Calling the agg_nbody method is however required because + * it builds the full NOTIFY body as described in the RFC (it adds the version + * field to the body, defines if state is partial or full, ...). + */ + notify_body = event->agg_nbody(&uri.user, &uri.host, &publ_body, -2, build_off_n); + if(notify_body) { + goto done; + } + } + notify_body = event->agg_nbody(&uri.user, &uri.host, body_array, body_cnt, build_off_n); if(notify_body == NULL) { @@ -1715,7 +1734,7 @@ subs_t* get_subs_dialog(str* pres_uri, pres_ev_t* event, str* sender) } int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, - str* rules_doc, str* dialog_body) + str* rules_doc, str* dialog_body, int from_publish) { str *notify_body = NULL; str notify_extra_hdrs = {NULL, 0}; @@ -1736,7 +1755,8 @@ int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, { notify_body = get_p_notify_body(pres_uri, p->event , offline_etag, body, NULL, dialog_body, - p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, &free_fct); + p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, &free_fct, + from_publish); } s= subs_array; @@ -1745,7 +1765,7 @@ int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, s->auth_rules_doc= rules_doc; LM_INFO("notify\n"); if(notify(s, NULL, notify_body?notify_body:body, - 0, p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs)< 0 ) + 0, p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, from_publish)< 0 ) { LM_ERR("Could not send notify for %.*s\n", p->event->name.len, p->event->name.s); @@ -1793,7 +1813,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) if(event->type & PUBL_TYPE) { notify_body = get_p_notify_body(*pres_uri, event, 0, 0, 0, 0, - ¬ify_extra_hdrs, &free_fct); + ¬ify_extra_hdrs, &free_fct, 0); } s= subs_array; @@ -1801,7 +1821,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) while(s) { LM_INFO("notify\n"); - if(notify(s, watcher_subs, notify_body, 0, NULL)< 0 ) + if(notify(s, watcher_subs, notify_body, 0, NULL, 0)< 0 ) { LM_ERR("Could not send notify for [event]=%.*s\n", event->name.len, event->name.s); @@ -1836,7 +1856,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) } int send_notify_request(subs_t* subs, subs_t * watcher_subs, - str* n_body,int force_null_body, str* extra_hdrs) + str* n_body,int force_null_body, str* extra_hdrs, int from_publish) { dlg_t* td = NULL; str met = {"NOTIFY", 6}; @@ -1899,9 +1919,13 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } else { - notify_body = get_p_notify_body(subs->pres_uri, - subs->event, 0, 0, (subs->contact.s)?&subs->contact:NULL, - NULL, extra_hdrs?extra_hdrs:¬ify_extra_hdrs, &free_fct); + if (from_publish && n_body!= 0 && n_body->s!= 0) + notify_body = n_body; + else + notify_body = get_p_notify_body(subs->pres_uri, + subs->event, 0, 0, (subs->contact.s)?&subs->contact:NULL, + NULL, extra_hdrs?extra_hdrs:¬ify_extra_hdrs, + &free_fct, from_publish); if(notify_body == NULL || notify_body->s== NULL) { LM_DBG("Could not get the notify_body\n"); @@ -2058,7 +2082,7 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } -int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body, str* extra_hdrs) +int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body, str* extra_hdrs, int from_publish) { /* update first in hash table and the send Notify */ if(subs->expires!= 0 && subs->status != TERMINATED_STATUS) @@ -2086,7 +2110,7 @@ int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body force_null_body = 1; } - if(send_notify_request(subs, watcher_subs, n_body, force_null_body, extra_hdrs)< 0) + if(send_notify_request(subs, watcher_subs, n_body, force_null_body, extra_hdrs, from_publish)< 0) { LM_ERR("sending Notify not successful\n"); return -1; diff --git a/modules/presence/notify.h b/modules/presence/notify.h index 5a76564fd36..6e908f8748f 100644 --- a/modules/presence/notify.h +++ b/modules/presence/notify.h @@ -100,12 +100,12 @@ void printf_subs(subs_t* subs); int query_db_notify(str* pres_uri,pres_ev_t* event, subs_t* watcher_subs ); int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, - str* rules_doc, str* dialog_publish); + str* rules_doc, str* dialog_publish, int from_publish); -int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body, str* extra_hdrs); +int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body, str* extra_hdrs, int from_publish); int send_notify_request(subs_t* subs, subs_t * watcher_subs, - str* n_body,int force_null_body, str* extra_hdrs); + str* n_body,int force_null_body, str* extra_hdrs, int from_publish); char* get_status_str(int flag); void free_watcher_list(watcher_t* w); diff --git a/modules/presence/presence.c b/modules/presence/presence.c index 38c048448e3..92615376b84 100644 --- a/modules/presence/presence.c +++ b/modules/presence/presence.c @@ -1186,7 +1186,7 @@ int update_watchers_status(str pres_uri, pres_ev_t* ev, str* rules_doc) while(s) { - if(notify(s, NULL, NULL, 0, NULL)< 0) + if(notify(s, NULL, NULL, 0, NULL, 0)< 0) { LM_ERR( "sending Notify request\n"); goto done; @@ -1276,7 +1276,7 @@ int refresh_send_winfo_notify(watcher_t* watchers, str pres_uri, goto error; } - if(notify(s, NULL, winfo_nbody, 0, NULL)< 0 ) + if(notify(s, NULL, winfo_nbody, 0, NULL, 0)< 0 ) { LM_ERR("Could not send notify for [event]=%.*s\n", s->event->name.len, s->event->name.s); diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index 756da283317..94b899f9112 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -620,7 +620,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r *sent_reply= 1; if(publ_notify(presentity, pres_uri, body.s ? &body : 0, - &presentity->etag, rules_doc, NULL) < 0) + &presentity->etag, rules_doc, NULL, 1) < 0) { LM_ERR("while sending notify\n"); goto error; @@ -792,7 +792,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r send_notify: if (publ_notify(presentity, pres_uri, body.s?&body:0, - NULL, rules_doc, NULL)<0) + NULL, rules_doc, NULL, 1)<0) { LM_ERR("while sending Notify requests to watchers\n"); goto error; @@ -812,7 +812,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r { /* send Notify for presence */ presentity->event = *pres_event_p; - if (publ_notify(presentity, pres_uri, 0, NULL, 0, dialog_body)<0) + if (publ_notify(presentity, pres_uri, 0, NULL, 0, dialog_body, 1)<0) { LM_ERR("while sending Notify requests to watchers\n"); if(dialog_body && dialog_body!=FAKED_BODY) diff --git a/modules/presence/publish.c b/modules/presence/publish.c index 9b12f9bddee..56b905880fa 100644 --- a/modules/presence/publish.c +++ b/modules/presence/publish.c @@ -259,7 +259,7 @@ void msg_presentity_clean(unsigned int ticks,void *param) LM_ERR("getting rules doc\n"); goto error; } - if(publ_notify( p[i].p, p[i].uri, NULL, &p[i].p->etag, rules_doc, NULL)< 0) + if(publ_notify( p[i].p, p[i].uri, NULL, &p[i].p->etag, rules_doc, NULL, 0)< 0) { LM_ERR("sending Notify request\n"); goto error; diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c index 84ee81e7e21..590a0eaf8e7 100644 --- a/modules/presence/subscribe.c +++ b/modules/presence/subscribe.c @@ -448,7 +448,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int init_req) } } LM_INFO("notify\n"); - if(notify(subs, NULL, NULL, 0 , NULL)< 0) + if(notify(subs, NULL, NULL, 0 , NULL, 0)< 0) { LM_ERR("Failed to send notify request\n"); goto error; @@ -1284,7 +1284,7 @@ int handle_expired_subs(subs_t* s) s->expires= 0; LM_INFO("notify\n"); - if(send_notify_request(s, NULL, NULL, 1, NULL)< 0) + if(send_notify_request(s, NULL, NULL, 1, NULL, 0)< 0) { LM_ERR("send Notify not successful\n"); return -1; @@ -2067,7 +2067,7 @@ int refresh_watcher(str* pres_uri, str* watcher_uri, str* event, return -1; } lock_release(&subs_htable[hash_code].lock); - if(notify(s_copy, NULL, NULL, 0, NULL)< 0) + if(notify(s_copy, NULL, NULL, 0, NULL, 0)< 0) { LM_ERR("in notify function\n"); pkg_free(s_copy); diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index 6d2edcb0175..97e8852d669 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -43,7 +43,7 @@ #include "notify_body.h" #include "pidf.h" -str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n); +str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, int partial); str* build_dialoginfo(str* pres_user, str* pres_domain); extern int force_single_dialog; @@ -87,7 +87,11 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n if(body_array== NULL) return build_empty_dialoginfo(pres_uri, NULL); - n_body= agregate_xmls(pres_user, pres_domain, body_array, n); + if (n == -2) + n_body= agregate_xmls(pres_user, pres_domain, body_array, 1, 1); + else + n_body= agregate_xmls(pres_user, pres_domain, body_array, n, 0); + LM_DBG("[n_body]=%p\n", n_body); if(n_body) { LM_DBG("[*n_body]=%.*s\n", @@ -106,7 +110,7 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n return n_body; } -str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) +str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, int partial) { int i, j= 0; @@ -201,8 +205,11 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) signed int) has max. 10 characters + 1 character for the sign */ xmlNewProp(root_node, BAD_CAST "version", BAD_CAST VERSION_HOLDER); - xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "partial" ); xmlNewProp(root_node, BAD_CAST "entity", BAD_CAST buf); + if (!partial) + xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "full" ); + else + xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "partial" ); /* loop over all bodies and create the aggregated body */ for(i=0; i Date: Tue, 3 Sep 2013 19:48:00 +0300 Subject: [PATCH 040/159] - fixed incomplete function call (resulted from the merged commit 09a291e) --- modules/presence/presentity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index 94b899f9112..b2879259340 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -642,7 +642,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r /* Send another NOTIFY, this time rely on whatever is on the DB, * so in case there are no documents an empty * NOTIFY will be sent to the watchers */ - if(publ_notify(presentity, pres_uri, NULL, NULL, rules_doc, NULL) < 0) + if(publ_notify(presentity, pres_uri, NULL, NULL, rules_doc, NULL, 1) < 0) { LM_ERR("while sending notify\n"); goto error; From 25629fc3595c8d28a35fca1a460333aeec1acd32 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 3 Sep 2013 19:59:00 +0300 Subject: [PATCH 041/159] - fixed how lumps can overlap on the edge - an "add" just next to a "delete" Reported by Saul Ibarra Corretge Closes issue #59 --- msg_translator.c | 75 +++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/msg_translator.c b/msg_translator.c index 4467109324f..da8fa87ac6c 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -427,6 +427,7 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, struct socket_info* send_sock) { unsigned int s_offset, new_len; + unsigned int last_del, only_before; struct lump *t, *r; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; @@ -575,6 +576,7 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, s_offset=0; new_len=0; + last_del=0; /* init send_address_str & send_port_str */ if(send_sock && send_sock->adv_name_str.len) send_address_str=&(send_sock->adv_name_str); @@ -601,8 +603,17 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, rcv_port_str=&(msg->rcv.bind_address->port_no_str); } - for(t=lumps;t;t=t->next){ + only_before=0; + /* is this lump still valid? (it must not be anchored in a deleted area */ + if (s_offset > t->u.offset) { + LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", + t->op,s_offset, t->u.offset,last_del); + if (t->u.offset!=last_del) + continue; + /* process only the before lumps */ + only_before = 1; + } /* if a SKIP lump, go to the last in the list*/ if (t->op==LUMP_SKIP) { if (!t->next) break; @@ -635,7 +646,10 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("invalid op for data lump (%x)\n", r->op); } } + LM_DBG("new len is %d after before\n",new_len); skip_before: + if (only_before) + continue; switch(t->op){ case LUMP_ADD: new_len+=t->len; @@ -648,36 +662,17 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, * before & after */ break; case LUMP_DEL: - /* fix overlapping deleted zones */ - //if (t->u.offset < s_offset){ - // /* change len */ - // if (t->len>s_offset-t->u.offset) - // t->len-=s_offset-t->u.offset; - // else t->len=0; - // t->u.offset=s_offset; - //} - /* lump inside a deleted area ? */ - if (s_offset > t->u.offset) { - continue; - } + last_del=t->u.offset; s_offset=t->u.offset+t->len; new_len-=t->len; break; case LUMP_NOP: - /* fix offset if overlapping on a deleted zone */ - //if (t->u.offset < s_offset){ - // t->u.offset=s_offset; - //}else - // s_offset=t->u.offset; - /* lump inside a deleted area ? */ - if (s_offset > t->u.offset) { - continue; - } /* do nothing */ break; default: LM_CRIT("op for data lump (%x)\n", r->op); } + LM_DBG("new len is %d after main\n",new_len); for (r=t->after;r;r=r->after){ switch(r->op){ case LUMP_ADD: @@ -702,6 +697,7 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("invalid op for data lump (%x)\n", r->op); } } + LM_DBG("new len is %d after after\n",new_len); skip_after: ; /* to make gcc 3.* happy */ } @@ -723,6 +719,7 @@ void process_lumps( struct sip_msg* msg, struct lump *t, *r; char* orig; unsigned int size, offset, s_offset; + unsigned int last_del, only_before; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; str *rcv_port_str=NULL; @@ -959,8 +956,19 @@ void process_lumps( struct sip_msg* msg, orig=msg->buf; offset=*new_buf_offs; s_offset=*orig_offs; + last_del=0; for (t=lumps;t;t=t->next){ + only_before = 0; + /* skip this lump if the "offset" is still in a "deleted" area */ + if (s_offset > t->u.offset) { + LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", + t->op,s_offset, t->u.offset,last_del); + if (last_del!= t->u.offset) + continue; + only_before = 1; + } + switch(t->op){ case LUMP_SKIP: /* if a SKIP lump, go to the last in the list*/ @@ -1004,6 +1012,8 @@ void process_lumps( struct sip_msg* msg, } } skip_before: + if (only_before) + continue; /* copy "main" part */ switch(t->op){ case LUMP_ADD: @@ -1051,23 +1061,14 @@ void process_lumps( struct sip_msg* msg, break; case LUMP_NOP: case LUMP_DEL: - /* skip this lump if the "offset" is still in a "deleted" area */ - if (s_offset > t->u.offset) { - continue; - } - /* copy till offset */ - if (s_offset>t->u.offset){ /* this should never happen !! */ - LM_WARN("(%d) overlapped lumps offsets," - " ignoring(%x, %x)\n", t->op, s_offset,t->u.offset); - /* this should've been fixed above (when computing len) */ - /* just ignore it*/ - break; - } - size=t->u.offset-s_offset; - if (size){ + /* copy till offset (if any) */ + if (s_offsetu.offset){ + size=t->u.offset-s_offset; memcpy(new_buf+offset, orig+s_offset,size); offset+=size; s_offset+=size; + if (t->op==LUMP_DEL) + last_del=t->u.offset; } /* process before */ for(r=t->before;r;r=r->before){ @@ -1097,6 +1098,8 @@ void process_lumps( struct sip_msg* msg, } } skip_nop_before: + if (only_before) + continue; /* process main (del only) */ if (t->op==LUMP_DEL){ /* skip len bytes from orig msg */ From 4363dbcf68d89ad76d28319322dd17ecde5ab054 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 4 Sep 2013 12:36:48 +0300 Subject: [PATCH 042/159] - when starting the FR timer, it should not override any previous setting of a FR or FR_INV timers. Solves Issue #25 (reported and troubleshooted by Mayama Takeshi) when a very fast 100 reply may stop retransmissions, but brake the updating of fr timer from FR to FR_INV state. --- modules/tm/t_funcs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tm/t_funcs.h b/modules/tm/t_funcs.h index 90827ef4803..36a6a8de7b7 100644 --- a/modules/tm/t_funcs.h +++ b/modules/tm/t_funcs.h @@ -144,9 +144,9 @@ inline static void _set_fr_retr( struct retr_buf *rb, int retr ) if (!fr_avp2timer(&timer)) { LM_DBG("FR_TIMER = %llu\n", timer); - set_timer(&rb->fr_timer, FR_TIMER_LIST, &timer); + set_1timer(&rb->fr_timer, FR_TIMER_LIST, &timer); } else { - set_timer(&rb->fr_timer, FR_TIMER_LIST, 0); + set_1timer(&rb->fr_timer, FR_TIMER_LIST, 0); } } From 512aaca17ef812fdb1d821304161f56a790ef794 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 4 Sep 2013 12:48:07 +0300 Subject: [PATCH 043/159] - Gracefully detect if the uac_auth modules is available for usage in b2b_entities modules - do not through an error message but rather an info one, as find the uac_auth module is optional. --- modules/b2b_entities/b2b_entities.c | 2 +- modules/uac_auth/uac_auth.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/b2b_entities/b2b_entities.c b/modules/b2b_entities/b2b_entities.c index f07c9295b65..4d64e8c2587 100644 --- a/modules/b2b_entities/b2b_entities.c +++ b/modules/b2b_entities/b2b_entities.c @@ -167,7 +167,7 @@ static int mod_init(void) * if authentication is required */ if(load_uac_auth_api(&uac_auth_api)<0) { - LM_DBG("authentication functionality disabled:" + LM_INFO("authentication functionality disabled:" " load uac_auth first to enable it\n"); uac_auth_loaded = 0; } diff --git a/modules/uac_auth/uac_auth.h b/modules/uac_auth/uac_auth.h index b47fd8e53f9..20690578179 100644 --- a/modules/uac_auth/uac_auth.h +++ b/modules/uac_auth/uac_auth.h @@ -94,7 +94,6 @@ static inline int load_uac_auth_api( uac_auth_api_t *uac_auth_api) /* import the uac_auth auto-loading function */ if ( !(load_uac_auth=(load_uac_auth_f)find_export("load_uac_auth", 1, 0))) { - LM_ERR("can't import load_uac_auth\n"); return -1; } From 0ebb2f6df642342920d9116568a28fdd6a28ad85 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 4 Sep 2013 13:11:06 +0300 Subject: [PATCH 044/159] - fixed CANCEL matching in B2B --- modules/b2b_entities/dlg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 6b6dc698a1e..1bfd95e3771 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -636,7 +636,7 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) /* if a CANCEL request - search iteratively in the server_htable*/ if(method_value == METHOD_CANCEL) { - str ruri= msg->first_line.u.request.uri; + /*str ruri= msg->first_line.u.request.uri;*/ str reply_text={"canceling", 9}; /* This makes no sense - why not accepting a CANCEL that was generated by other b2b instance ? or ourselves ? - bogdan @@ -648,7 +648,12 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) */ hash_index = core_hash(&callid, &from_tag, server_hsize); - dlg = b2bl_search_iteratively(&callid, &from_tag, &ruri, hash_index); + /* As per RFC3261, the RURI must be used when matching the CANCEL + against the INVITE, but we should not do it here as B2B learns + a RURI that may have been changed in script (before invoking the + B2B module), while the CANCEL has the original RURI (as received) + */ + dlg = b2bl_search_iteratively(&callid, &from_tag, NULL/*&ruri*/, hash_index); if(dlg == NULL) { lock_release(&server_htable[hash_index].lock); From bc3c8e8d2835cd00b2be0f50ea85d839e87befcb Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Wed, 4 Sep 2013 14:23:58 +0300 Subject: [PATCH 045/159] Fix: allow rest_client functions in onreply_route Credits to Jayesh Nambiar for reporting (cherry picked from commit 6f048e038c4ae6e3e620d1b5f17cf1880fdef246) --- modules/rest_client/rest_client.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/rest_client/rest_client.c b/modules/rest_client/rest_client.c index 2c44575f435..a5bc36ab326 100644 --- a/modules/rest_client/rest_client.c +++ b/modules/rest_client/rest_client.c @@ -69,17 +69,23 @@ static int w_rest_post(struct sip_msg *msg, char *gp_url, char *gp_body, */ static cmd_export_t cmds[] = { { "rest_get",(cmd_function)w_rest_get, 2, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { "rest_get",(cmd_function)w_rest_get, 3, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { "rest_get",(cmd_function)w_rest_get, 4, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 4, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 5, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 6, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 4, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 5, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 6, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { 0, 0, 0, 0, 0, 0 } }; From da85c3a4f1134a02b9f6e171286b73fdac2171c6 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 4 Sep 2013 14:29:59 +0300 Subject: [PATCH 046/159] - new functions added to help a module to check if its functions are used from the script (we cannot rely on the fixup functions as we have functions without parameters or need for fixup). Such function is needed for fixing dependencies between modules (to follow up) --- route.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ route.h | 3 +++ route_struct.c | 16 ++++++++++++++++ route_struct.h | 1 + 4 files changed, 70 insertions(+) diff --git a/route.c b/route.c index d38ee69dab1..6afb7a30dd0 100644 --- a/route.c +++ b/route.c @@ -2181,6 +2181,56 @@ void print_rl(void) } } + +int is_script_func_used( char *name, int param_no) +{ + unsigned int i; + + for( i=0; itype==MODULE_T) { + /* first param is the name of the function */ + cmd = (cmd_export_t*)a->elem[0].u.data; + if (strcasecmp(cmd->name, name)==0 && + (param_no==cmd->param_no || param_no==-1) ) + return 1; + } + a = a->next; + } + + return 0; +} diff --git a/route_struct.h b/route_struct.h index e392a9c0ef7..a1333f2f440 100644 --- a/route_struct.h +++ b/route_struct.h @@ -156,6 +156,7 @@ struct action* append_action(struct action* a, struct action* b); void print_action(struct action* a); void print_expr(struct expr* exp); void print_actions(struct action* a); +int is_mod_func_used(struct action *a, char *name, int param_no); From bfd86ab25554082053167a82655e669ca1c0ea7c Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 4 Sep 2013 14:32:24 +0300 Subject: [PATCH 047/159] - UAC module does not load (no dependency) on UAC_AUTH if the uac_auth() function is not used. - UAC module does not load RR and DIALOG (with further dependencies on the params of those modules) if no FROM/TO replace ops are done. --- modules/uac/uac.c | 111 ++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 52 deletions(-) diff --git a/modules/uac/uac.c b/modules/uac/uac.c index 7f70de7638d..1fe7282c97b 100644 --- a/modules/uac/uac.c +++ b/modules/uac/uac.c @@ -109,7 +109,7 @@ static cmd_export_t cmds[]={ {"uac_restore_to", (cmd_function)w_restore_to, 0, 0, 0, REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE }, - {"uac_auth", (cmd_function)w_uac_auth, 0, + {"uac_auth", (cmd_function)w_uac_auth, 0, 0, 0, FAILURE_ROUTE }, {0,0,0,0,0,0} @@ -168,6 +168,21 @@ static int mod_init(void) { LM_INFO("initializing...\n"); + if ( is_script_func_used("uac_auth", -1) ) { + /* load the UAC_AUTH API as uac_auth() is invoked from script */ + if(load_uac_auth_api(&uac_auth_api)<0){ + LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n"); + goto error; + } + } + + /* load the TM API - FIXME it should be loaded only + * if NO_RESTORE and AUTH */ + if (load_tm_api(&uac_tmb)!=0) { + LM_ERR("can't load TM API\n"); + goto error; + } + if (restore_mode_str && *restore_mode_str) { if (strcasecmp(restore_mode_str,"none")==0) { restore_mode = UAC_NO_RESTORE; @@ -182,72 +197,64 @@ static int mod_init(void) } } - rr_from_param.len = strlen(rr_from_param.s); - rr_to_param.len = strlen(rr_to_param.s); - if ( (rr_from_param.len==0 || rr_to_param.len==0) && - restore_mode!=UAC_NO_RESTORE) - { - LM_ERR("rr_store_param cannot be empty if FROM is restoreable\n"); - goto error; - } - - uac_passwd.len = strlen(uac_passwd.s); - - /* load the TM API - FIXME it should be loaded only - * if NO_RESTORE and AUTH */ - if (load_tm_api(&uac_tmb)!=0) { - LM_ERR("can't load TM API\n"); - goto error; - } + if ( is_script_func_used("uac_replace_from", -1) || + is_script_func_used("uac_replace_to", -1) ) { - /* load the UAC_AUTH API - FIXME it should be loaded only - * if uac_auth() is invoked from script */ - if(load_uac_auth_api(&uac_auth_api)<0){ - LM_ERR("can't load UAC_AUTH API\n"); - goto error; - } + /* replace TO/FROM stuff is used, get prepared */ - if (restore_mode!=UAC_NO_RESTORE) { - /* load the RR API */ - if (load_rr_api(&uac_rrb)!=0) { - LM_ERR("can't load RR API\n"); + rr_from_param.len = strlen(rr_from_param.s); + rr_to_param.len = strlen(rr_to_param.s); + if ( (rr_from_param.len==0 || rr_to_param.len==0) && + restore_mode!=UAC_NO_RESTORE) { + LM_ERR("rr_store_param cannot be empty if FROM is restoreable\n"); goto error; } - if (restore_mode==UAC_AUTO_RESTORE) { - /* we need the append_fromtag on in RR */ - if (!force_dialog && !uac_rrb.append_fromtag) { - LM_ERR("'append_fromtag' RR param is not enabled!" - " - required by AUTO restore mode\n"); + uac_passwd.len = strlen(uac_passwd.s); + + if (restore_mode!=UAC_NO_RESTORE) { + /* load the RR API */ + if (load_rr_api(&uac_rrb)!=0) { + LM_ERR("can't load RR API\n"); goto error; } - /* trying to load dialog module */ - memset(&dlg_api, 0, sizeof(struct dlg_binds)); - if (load_dlg_api(&dlg_api)!=0) { - if (force_dialog) { - LM_ERR("cannot force dialog. dialog module not loaded\n"); + if (restore_mode==UAC_AUTO_RESTORE) { + /* we need the append_fromtag on in RR */ + if (!force_dialog && !uac_rrb.append_fromtag) { + LM_ERR("'append_fromtag' RR param is not enabled!" + " - required by AUTO restore mode\n"); goto error; } - LM_DBG("failed to find dialog API - is dialog module loaded?\n"); - } else { - if ( (parse_store_bavp(&store_to_bavp, &to_bavp_spec) || - parse_store_bavp(&store_from_bavp, &from_bavp_spec))) { - LM_ERR("cannot set correct store parameters\n"); - goto error; + + /* trying to load dialog module */ + memset(&dlg_api, 0, sizeof(struct dlg_binds)); + if (load_dlg_api(&dlg_api)!=0) { + if (force_dialog) { + LM_ERR("cannot force dialog. dialog module not loaded\n"); + goto error; + } + LM_DBG("failed to find dialog API - is dialog module loaded?\n"); + } else { + if ( (parse_store_bavp(&store_to_bavp, &to_bavp_spec) || + parse_store_bavp(&store_from_bavp, &from_bavp_spec))) { + LM_ERR("cannot set correct store parameters\n"); + goto error; + } } - } - /* get all requests doing loose route */ - if (uac_rrb.register_rrcb( rr_checker, 0, 2)!=0) { - LM_ERR("failed to install RR callback\n"); - goto error; + /* get all requests doing loose route */ + if (uac_rrb.register_rrcb( rr_checker, 0, 2)!=0) { + LM_ERR("failed to install RR callback\n"); + goto error; + } } } - } - /* init from replacer */ - init_from_replacer(); + /* init from replacer */ + init_from_replacer(); + + } return 0; error: From 8d5950c6f689b3122f26a527c0214030455ef7b5 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Tue, 10 Sep 2013 18:34:48 +0200 Subject: [PATCH 048/159] removed the beta flag --- Makefile.defs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.defs b/Makefile.defs index 93d51021c6d..74818646b37 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -64,7 +64,7 @@ MAIN_NAME=opensips VERSION = 1 PATCHLEVEL = 10 SUBLEVEL = 0 -EXTRAVERSION = beta +EXTRAVERSION = RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) ifneq ($(OPENSIPS_RELEASE),) # allow override thru environment From 85cdc6d4a3130542432c5a8a22fa106ef60bb4a9 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Mon, 16 Sep 2013 18:40:33 +0300 Subject: [PATCH 049/159] Fix evi crash when defining more than 10 events (cherry picked from commit ba04cba6d5f7bc945bbc42d2e46694639fea8b79) --- evi/event_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evi/event_interface.c b/evi/event_interface.c index 296d29c5e55..2f6ee8ec995 100644 --- a/evi/event_interface.c +++ b/evi/event_interface.c @@ -65,7 +65,7 @@ event_id_t evi_publish_event(str event_name) } } else if (events_no == max_alloc_events) { max_alloc_events *= 2; - events = shm_realloc(events, max_alloc_events); + events = shm_realloc(events, max_alloc_events * sizeof(evi_event_t)); if (!events) { LM_ERR("no more shm memory to hold %d events\n", max_alloc_events); return EVI_ERROR; From 763ea32e5ef23aa32729601491ede6ad2429de2c Mon Sep 17 00:00:00 2001 From: Damien Sandras Date: Fri, 13 Sep 2013 12:02:21 +0200 Subject: [PATCH 050/159] Fix PUA module so that it sends a final PUBLISH on expiration. A final PUBLISH with expires=0 is now generated when a publication has expired. This will trigger the transmission of a final state NOTIFY. Cherry picked from: c5a57a8d39cf568d6558332ca71ea8344a5a4f57 --- modules/pua/pua.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/pua/pua.c b/modules/pua/pua.c index 93e0182f41a..f03449e2cb3 100644 --- a/modules/pua/pua.c +++ b/modules/pua/pua.c @@ -98,7 +98,7 @@ static int mod_init(void); static int child_init(int); static void destroy(void); -static int update_pua(ua_pres_t* p, unsigned int hash_code); +static int update_pua(ua_pres_t* p, unsigned int hash_code, unsigned int final); static int db_restore(void); static void db_update(unsigned int ticks,void *param); @@ -620,7 +620,7 @@ static void hashT_clean(unsigned int ticks,void *param) "refresh PUBLISH desired_expires=%d - expires=%d\n", p->desired_expires, p->expires); - if(update_pua(p, i)< 0) + if(update_pua(p, i, 0)< 0) { LM_ERR("while updating record\n"); lock_release(&HashT->p_records[i].lock); @@ -632,6 +632,10 @@ static void hashT_clean(unsigned int ticks,void *param) LM_DBG("Found expired: uri= %.*s\n", p->pres_uri->len, p->pres_uri->s); + if(update_pua(p, i, 1)< 0) + { + LM_ERR("while updating record\n"); + } /* delete it */ q = p->next; delete_htable_safe(p, p->hash_index); @@ -644,20 +648,27 @@ static void hashT_clean(unsigned int ticks,void *param) } } -int update_pua(ua_pres_t* p, unsigned int hash_code) +int update_pua(ua_pres_t* p, unsigned int hash_code, unsigned int final) { str* str_hdr= NULL; int expires; int result; - - if(p->desired_expires== 0) - expires= 3600; - else - expires= p->desired_expires- (int)time(NULL); - if(expires < min_expires) - expires = min_expires; + if(final > 0) + { + expires= 0; + p->desired_expires= 0; + } + else + { + if(p->desired_expires== 0) + expires= 3600; + else + expires= p->desired_expires- (int)time(NULL); + if(expires < min_expires) + expires = min_expires; + } if(p->watcher_uri== NULL) { str met= {"PUBLISH", 7}; @@ -678,7 +689,7 @@ int update_pua(ua_pres_t* p, unsigned int hash_code) LM_ERR("while building extra_headers\n"); goto error; } - LM_DBG("str_hdr:\n%.*s\n ", str_hdr->len, str_hdr->s); + LM_DBG("str_hdr:\n%.*s expires:%d\n ", str_hdr->len, str_hdr->s, expires); cb_param = PRES_HASH_ID(p); From e16f7e1edb5f352907ede652f7c0441463eac6eb Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 20 Sep 2013 18:41:38 +0300 Subject: [PATCH 051/159] - fixed updating the index of the last DEL operation - this is essential for deciding which lumps must be skipped (as overlapping with delete parts of the message) Credits go to Nick Altmann for reporting and helping with troubleshooting. Closes issue #79 --- msg_translator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/msg_translator.c b/msg_translator.c index da8fa87ac6c..c4cee2d647d 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -646,7 +646,6 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("invalid op for data lump (%x)\n", r->op); } } - LM_DBG("new len is %d after before\n",new_len); skip_before: if (only_before) continue; @@ -672,7 +671,6 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, default: LM_CRIT("op for data lump (%x)\n", r->op); } - LM_DBG("new len is %d after main\n",new_len); for (r=t->after;r;r=r->after){ switch(r->op){ case LUMP_ADD: @@ -697,7 +695,6 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("invalid op for data lump (%x)\n", r->op); } } - LM_DBG("new len is %d after after\n",new_len); skip_after: ; /* to make gcc 3.* happy */ } @@ -1067,9 +1064,9 @@ void process_lumps( struct sip_msg* msg, memcpy(new_buf+offset, orig+s_offset,size); offset+=size; s_offset+=size; - if (t->op==LUMP_DEL) - last_del=t->u.offset; } + if (t->op==LUMP_DEL) + last_del=t->u.offset; /* process before */ for(r=t->before;r;r=r->before){ switch (r->op){ From 2b2227427e1b2ef72e0ce13cc5d12d1c84301be0 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Fri, 20 Sep 2013 08:56:18 -0700 Subject: [PATCH 052/159] Merge pull request #73 from wdoekes/wjd-pua_min_expires_doc pua.c sets int min_expires= 300, not 0 as documentation states. --- modules/pua/README | 4 ++-- modules/pua/doc/pua_admin.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pua/README b/modules/pua/README index 01c7c0409c4..3c8b17a162f 100644 --- a/modules/pua/README +++ b/modules/pua/README @@ -15,7 +15,7 @@ Saul Ibarra Corretge Copyright © 2006 Voice Sistem SRL Revision History Revision $Revision$ $Date: 2012-10-22 13:41:25 +0200 - (Mon, 22 Oct 2012) $ + (Mon, 22 Oct 2012) __________________________________________________________ Table of Contents @@ -147,7 +147,7 @@ modparam("pua", "db_table", "pua") The inferior expires limit for both Publish and Subscribe. - Default value is “0”. + Default value is “300”. Example 1.4. Set min_expires parameter ... diff --git a/modules/pua/doc/pua_admin.xml b/modules/pua/doc/pua_admin.xml index 7b4e159ef39..10b90fb2c99 100644 --- a/modules/pua/doc/pua_admin.xml +++ b/modules/pua/doc/pua_admin.xml @@ -130,7 +130,7 @@ modparam("pua", "db_table", "pua") The inferior expires limit for both Publish and Subscribe. - Default value is 0. + Default value is 300. From 743f48e63e6a920f7b039638fdaee7adc6b33c5d Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 25 Sep 2013 15:24:13 +0100 Subject: [PATCH 053/159] - fixed overflow in parsing the content len value Reported by franklyfox on GITHUB Closing issue #78 --- parser/parse_content.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser/parse_content.c b/parser/parse_content.c index 8b1f491c525..a54e0f8a74b 100644 --- a/parser/parse_content.c +++ b/parser/parse_content.c @@ -243,6 +243,11 @@ char* parse_content_length( char* buffer, char* end, int* length) number = 0; while (p='0' && *p<='9') { number = number*10 + (*p)-'0'; + if (number<0) { + LM_ERR("number overflow at pos %d in len number [%.*s]\n", + (int)(p-buffer),(int)(end-buffer), buffer); + return 0; + } size ++; p++; } From 7a3ef04a71c346997897445307551415d821a027 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 25 Sep 2013 19:24:12 +0100 Subject: [PATCH 054/159] - fixed double free when building insert fails (in buffered insert mode) Reported by Brett Nemeroff --- db/db_query.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/db_query.c b/db/db_query.c index 78e7a258ec9..cc762ace008 100644 --- a/db/db_query.c +++ b/db/db_query.c @@ -246,8 +246,10 @@ int db_do_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v, /* if we have a PS, leave the function handling prep stmts in the module to free the rows once it's done */ - if (!CON_HAS_PS(_h)) + if (!CON_HAS_PS(_h)) { shm_free(buffered_rows[i]); + buffered_rows[i] = NULL; + } } if (off + 1 > SQL_BUF_LEN) goto error0; From 036fea29b876a0ceb39513abcdaddf24257d909a Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Fri, 27 Sep 2013 12:07:48 +0300 Subject: [PATCH 055/159] Fix invalid pointer when fetching the usrloc extra info column (cherry picked from commit f2b283de399a58ed3f09f2b46dc9b92958558175) --- modules/usrloc/udomain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c index 5b0d0568f5d..2f092f78979 100644 --- a/modules/usrloc/udomain.c +++ b/modules/usrloc/udomain.c @@ -375,6 +375,7 @@ static inline ucontact_info_t* dbrow2info( db_val_t *vals, str *contact) } ci.instance = instance; + attr.s = (char*)VAL_STRING(vals+14); if (VAL_NULL(vals+14) || !attr.s) { attr.s = NULL; attr.len = 0; From 6f18ea994edea2db25f07d2cc6e47ea05b0305ca Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Tue, 1 Oct 2013 12:27:03 +0300 Subject: [PATCH 056/159] Fix missing GPL headers in event_xmlrpc module (cherry picked from commit 5bcab3923d0c4ed7d8d613544cc6f1a043dc78c3) --- modules/event_xmlrpc/event_xmlrpc.c | 25 +++++++++++++++++++++++++ modules/event_xmlrpc/event_xmlrpc.h | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/modules/event_xmlrpc/event_xmlrpc.c b/modules/event_xmlrpc/event_xmlrpc.c index d48b96edbcb..0898dc2516f 100644 --- a/modules/event_xmlrpc/event_xmlrpc.c +++ b/modules/event_xmlrpc/event_xmlrpc.c @@ -1,3 +1,28 @@ +/* + * Copyright (C) 2012 OpenSIPS Solutions + * + * This file is part of opensips, a free SIP server. + * + * opensips is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * opensips is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * history: + * --------- + * 2012-05-xx created (razvancrainea) + */ + #include "../../sr_module.h" #include "../../resolve.h" #include "../../evi/evi_transport.h" diff --git a/modules/event_xmlrpc/event_xmlrpc.h b/modules/event_xmlrpc/event_xmlrpc.h index c488fb0562f..007116b375c 100644 --- a/modules/event_xmlrpc/event_xmlrpc.h +++ b/modules/event_xmlrpc/event_xmlrpc.h @@ -1,3 +1,27 @@ +/* + * Copyright (C) 2012 OpenSIPS Solutions + * + * This file is part of opensips, a free SIP server. + * + * opensips is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * opensips is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * history: + * --------- + * 2012-05-xx created (razvancrainea) + */ #ifndef _EV_XMLRPC_H_ #define _EV_XMLRPC_H_ From ec236bffdf6bf7a337232d14c3e48bb44aafa6ea Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Tue, 1 Oct 2013 16:48:18 +0300 Subject: [PATCH 057/159] Fix some documentation typos (cherry picked from commit c229d98c3074e3f3c83e99918ed30f9d7e1c8dd6) --- modules/dialog/README | 14 +++++++------- modules/dialog/doc/dialog_admin.xml | 11 +++++------ modules/drouting/README | 11 ++++++----- modules/drouting/doc/drouting_admin.xml | 4 ++-- modules/json/README | 9 ++++----- modules/json/doc/json_admin.xml | 4 ++-- modules/mathops/README | 6 +++--- modules/mathops/doc/mathops_admin.xml | 4 ++-- modules/rr/README | 4 ++-- modules/rr/doc/rr_admin.xml | 2 +- modules/textops/README | 11 +++++------ modules/textops/doc/textops_admin.xml | 8 ++++---- modules/tm/README | 2 +- modules/tm/doc/tm_admin.xml | 2 +- modules/uri/README | 7 +++---- modules/uri/doc/uri_admin.xml | 5 +++-- 16 files changed, 51 insertions(+), 53 deletions(-) diff --git a/modules/dialog/README b/modules/dialog/README index 98ac959ba16..b0d575b949c 100644 --- a/modules/dialog/README +++ b/modules/dialog/README @@ -781,14 +781,14 @@ modparam("dialog", "db_flush_vals_profiles", 1) 1.6.37. own_timer_proc (int) - Whether the dialog timer should be a sepparate process or if - the tasks should be done in the global timer process. + Whether the dialog timer should be a separate process or if the + tasks should be done in the global timer process. Default value is “0”, run the timer in the global process. Example 1.37. Set own_timer_proc parameter ... -modparam("dialog", "dlg_id_column", 1) +modparam("dialog", "own_timer_proc", 1) ... 1.6.38. timer_bulk_del_no (int) @@ -1051,10 +1051,10 @@ $dlg_val(callee) = $ru; 1.7.6. set_dlg_profile(profile,[value]) - Inserts the current dialog into a profile. Note that the - profile does not supports values, this will be silently - discarded. Also, there is no check for inserting the same - dialog in the same profile for multiple times. + Inserts the current dialog into a profile. Note that if the + profile does not support values, this will be silently + discarded. A dialog may be inserted in the same profile + multiple times. NOTE: the dialog must be created before using this function (use create_dialog() function before). diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml index 8ed5ea72a2d..7cf4c5d4cc1 100644 --- a/modules/dialog/doc/dialog_admin.xml +++ b/modules/dialog/doc/dialog_admin.xml @@ -969,7 +969,7 @@ modparam("dialog", "db_flush_vals_profiles", 1) <varname>own_timer_proc</varname> (int) Whether the dialog timer should be a - sepparate process or if the tasks should be done in the + separate process or if the tasks should be done in the global timer process. @@ -982,7 +982,7 @@ modparam("dialog", "db_flush_vals_profiles", 1) Set <varname>own_timer_proc</varname> parameter ... -modparam("dialog", "dlg_id_column", 1) +modparam("dialog", "own_timer_proc", 1) ... @@ -1411,10 +1411,9 @@ $dlg_val(callee) = $ru; set_dlg_profile(profile,[value]) - Inserts the current dialog into a profile. Note that the profile does - not supports values, this will be silently discarded. Also, there is - no check for inserting the same dialog in the same profile for multiple - times. + Inserts the current dialog into a profile. Note that if the profile does + not support values, this will be silently discarded. A dialog may be + inserted in the same profile multiple times. NOTE: the dialog must be created before using this function (use diff --git a/modules/drouting/README b/modules/drouting/README index bc8baf440d1..b99acd7d0ee 100644 --- a/modules/drouting/README +++ b/modules/drouting/README @@ -16,8 +16,7 @@ Anca-Maria Vamanu Copyright © 2009-2012 www.opensips-solutions.com Revision History - Revision $Revision$ $Date: 2012-03-22 20:43:49 +0200 - (Thu, 22 Mar 2012) $ + Revision $Revision: 8834 $ $Date$ __________________________________________________________ Table of Contents @@ -68,7 +67,9 @@ Anca-Maria Vamanu 1.4. Exported Functions - 1.4.1. do_routing([[[groupID],flags],gw_whitelist]) + 1.4.1. do_routing([groupID[, flags[, + gw_whitelist]]]) + 1.4.2. route_to_carrier(carrier_id) 1.4.3. route_to_gw(gw_id) 1.4.4. use_next_gw()/next_routing() @@ -699,7 +700,7 @@ modparam("drouting", "drg_grpid_col", "grpid") 1.4. Exported Functions -1.4.1. do_routing([[[groupID],flags],gw_whitelist]) +1.4.1. do_routing([groupID[, flags[, gw_whitelist]]]) Function to trigger routing of the message according to the rules in the database table and the configured parameters. @@ -723,7 +724,7 @@ modparam("drouting", "drg_grpid_col", "grpid") flag, the enging will fallback and use rules with less priority or shorter prefix when all the destination from the current rules failed. - + L - Do strict lenght matching over the prefix - + + L - Do strict length matching over the prefix - actually DR engine will do full number maching and not prefix matching anymore. + C - Only check if the dialed number matches any diff --git a/modules/drouting/doc/drouting_admin.xml b/modules/drouting/doc/drouting_admin.xml index c6232479a41..4e33f04c3ed 100644 --- a/modules/drouting/doc/drouting_admin.xml +++ b/modules/drouting/doc/drouting_admin.xml @@ -946,7 +946,7 @@ modparam("drouting", "drg_grpid_col", "grpid") Exported Functions
- <function moreinfo="none">do_routing([[[groupID],flags],gw_whitelist])</function> + <function moreinfo="none">do_routing([groupID[, flags[, gw_whitelist]]])</function> Function to trigger routing of the message according to the @@ -983,7 +983,7 @@ modparam("drouting", "drg_grpid_col", "grpid") destination from the current rules failed. - L - Do strict lenght matching over the + L - Do strict length matching over the prefix - actually DR engine will do full number maching and not prefix matching anymore. diff --git a/modules/json/README b/modules/json/README index 80443f8ad90..25c9ff3b13d 100644 --- a/modules/json/README +++ b/modules/json/README @@ -2,7 +2,7 @@ JSON Module Andrei Dragus - Voice Sistem SRL + OpenSIPS Solutions> Edited by @@ -10,8 +10,7 @@ Andrei Dragus Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 6078 $ $Date: 2009-09-04 15:16:18 +0300 - (Fri, 04 Sep 2009) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -77,7 +76,7 @@ Chapter 1. Admin Guide 1.2.2. External Libraries or Applications - * libjson The libjson library can be downloaded from: + * libjson The libjson C library can be downloaded from: http://oss.metaparadigm.com/json-c/ 1.3. Exported Parameters @@ -89,7 +88,7 @@ Chapter 1. Admin Guide This module exports the $json(id) variable. The json variable provides methods to access fields in json - objects and to access indexes in json arrays. + objects and indexes in json arrays. 1.4.1. Variable lifetime diff --git a/modules/json/doc/json_admin.xml b/modules/json/doc/json_admin.xml index dddc41a0080..e1df0465d3a 100644 --- a/modules/json/doc/json_admin.xml +++ b/modules/json/doc/json_admin.xml @@ -44,7 +44,7 @@ libjson - The libjson library can be downloaded from: + The libjson C library can be downloaded from: http://oss.metaparadigm.com/json-c/ @@ -72,7 +72,7 @@ The json variable provides methods to access fields - in json objects and to access indexes in json arrays. + in json objects and indexes in json arrays.
diff --git a/modules/mathops/README b/modules/mathops/README index c9ce00bb3de..38118777ca4 100644 --- a/modules/mathops/README +++ b/modules/mathops/README @@ -78,7 +78,7 @@ Chapter 1. Admin Guide Default value is “6”. Example 1.1. Setting the decimal_digits module parameter -modparam("mathops", "decimal_digits", "10") +modparam("mathops", "decimal_digits", 10) 1.4. Exported Functions @@ -94,8 +94,8 @@ modparam("mathops", "decimal_digits", "10") Meaning of the parameters is as follows: * expression - String containing a mathematical expression. - It can also include pseudo variables. The string parameter - can only be given as a string. + It can also include pseudo variables. The expression + parameter can only be given as a string. * result_pvar - pseudo-variable which will hold the result of the evaluation. Specified as a quoted string. diff --git a/modules/mathops/doc/mathops_admin.xml b/modules/mathops/doc/mathops_admin.xml index 3a0f01599f7..6d38758f03f 100644 --- a/modules/mathops/doc/mathops_admin.xml +++ b/modules/mathops/doc/mathops_admin.xml @@ -59,7 +59,7 @@ Setting the decimal_digits module parameter -modparam("mathops", "decimal_digits", "10") +modparam("mathops", "decimal_digits", 10)
@@ -92,7 +92,7 @@ modparam("mathops", "decimal_digits", "10") expression - String containing a mathematical expression. It can also include pseudo variables. The - string parameter can only be given as a string. + expression parameter can only be given as a string. diff --git a/modules/rr/README b/modules/rr/README index a65edadef7f..a390c952461 100644 --- a/modules/rr/README +++ b/modules/rr/README @@ -88,8 +88,8 @@ Chapter 1. Admin Guide OpenSIPS is basically only a transaction statefull proxy, without any dialog support build in. There are many - features/services which actually requires a dialog awareness, - like storing the information in the dialog creation stage, + features/services which actually require dialog awareness, like + storing the information in the dialog creation stage, information which will be used during the whole dialog existence. diff --git a/modules/rr/doc/rr_admin.xml b/modules/rr/doc/rr_admin.xml index 8e0654f6ac6..77c0526308f 100644 --- a/modules/rr/doc/rr_admin.xml +++ b/modules/rr/doc/rr_admin.xml @@ -14,7 +14,7 @@ Dialog support &osips; is basically only a transaction statefull proxy, without any dialog support build in. There are many features/services - which actually requires a dialog awareness, like storing the information in + which actually require dialog awareness, like storing the information in the dialog creation stage, information which will be used during the whole dialog existence. diff --git a/modules/textops/README b/modules/textops/README index 00a4bb6728b..ab4aa2a78c0 100644 --- a/modules/textops/README +++ b/modules/textops/README @@ -25,8 +25,7 @@ Ovidiu Sas Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2010-12-07 19:37:12 +0200 - (Tue, 07 Dec 2010) $ + Revision $Revision: 7480 $ $Date$ __________________________________________________________ Table of Contents @@ -268,7 +267,7 @@ if(has_body() && replace_body_atonce("^.+$", "")) (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -297,7 +296,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -328,7 +327,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -356,7 +355,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, diff --git a/modules/textops/doc/textops_admin.xml b/modules/textops/doc/textops_admin.xml index 0a01324c762..c07d20dcc09 100644 --- a/modules/textops/doc/textops_admin.xml +++ b/modules/textops/doc/textops_admin.xml @@ -371,7 +371,7 @@ if(has_body() && replace_body_atonce("^.+$", "")) 're' - is regular expresion
- 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -416,7 +416,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') ) 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -463,7 +463,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\0/i')){$ 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -508,7 +508,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$ 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) diff --git a/modules/tm/README b/modules/tm/README index df7855bf1c3..8172e5a0d42 100644 --- a/modules/tm/README +++ b/modules/tm/README @@ -868,7 +868,7 @@ t_write_unix("logger/append2","/var/run/logger.sock"); Returns true if the current request is associated to a transaction. The relationship between the request and - transaction is defined as follow: + transaction is defined as follows: * non-CANCEL/non-ACK requests - if the request belongs to a transaction (it's a retransmision), the function will do a standard processing of the retransmission and will diff --git a/modules/tm/doc/tm_admin.xml b/modules/tm/doc/tm_admin.xml index 2e2de57799c..49c1582f0a3 100644 --- a/modules/tm/doc/tm_admin.xml +++ b/modules/tm/doc/tm_admin.xml @@ -1151,7 +1151,7 @@ t_write_unix("logger/append2","/var/run/logger.sock"); Returns true if the current request is associated to a transaction. The relationship between the request and transaction is defined as - follow: + follows: diff --git a/modules/uri/README b/modules/uri/README index 5157985e30e..27461a4d496 100644 --- a/modules/uri/README +++ b/modules/uri/README @@ -20,8 +20,7 @@ Irina-Maria Stanescu Copyright © 2005, 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -277,8 +276,8 @@ if (db_check_from()) { Check if username in the request URI belongs to an existing user. - As the checking is done against URI table (if use_uri_table is - set) or subscriber table. + Matching is done against the URI table (if use_uri_table is + set) or the subscriber table. This function can be used from REQUEST_ROUTE. diff --git a/modules/uri/doc/uri_admin.xml b/modules/uri/doc/uri_admin.xml index 259102f0098..7a3e50b3cb8 100644 --- a/modules/uri/doc/uri_admin.xml +++ b/modules/uri/doc/uri_admin.xml @@ -317,8 +317,9 @@ if (db_check_from()) { Check if username in the request &uri; belongs to an existing user. - As the checking is done against &uri; table (if use_uri_table is set) - or subscriber table. + Matching is done against the &uri; table (if + use_uri_table is set) + or the subscriber table. This function can be used from REQUEST_ROUTE. From 1bd459e6bd2ae5aa2dc986f0f23b9aa56b503277 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Wed, 2 Oct 2013 13:48:17 +0300 Subject: [PATCH 058/159] "registered" must also populate the 'attr' avp, if defined (cherry picked from commit 286f06f2a21c269aebdbeee81d2f5a264be2518d) --- modules/registrar/lookup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/registrar/lookup.c b/modules/registrar/lookup.c index d67c71f6ab2..18c88ac002f 100644 --- a/modules/registrar/lookup.c +++ b/modules/registrar/lookup.c @@ -291,6 +291,7 @@ int registered(struct sip_msg* _m, char* _t, char* _s, char *_c) pv_value_t val; str callid; int res; + int_str istr; /* get the AOR */ if (_s) { @@ -351,6 +352,15 @@ int registered(struct sip_msg* _m, char* _t, char* _s, char *_c) for( ; ptr ; ptr=ptr->next ) { if (callid.len==0 || (callid.len==ptr->callid.len && memcmp(callid.s,ptr->callid.s,callid.len)==0 ) ) { + + /* also populate the 'attributes' avp */ + if (attr_avp_name != -1) { + istr.s = ptr->attr; + + if (add_avp_last(AVP_VAL_STR, attr_avp_name, istr) != 0) + LM_ERR("Failed to populate attr avp!\n"); + } + ul.unlock_udomain((udomain_t*)_t, &aor); LM_DBG("'%.*s' found in usrloc\n", aor.len, ZSW(aor.s)); return 1; From c9bf445ecd7a544a442a78b77fcec48bbe57291a Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Thu, 3 Oct 2013 12:01:38 +0300 Subject: [PATCH 059/159] - doc examples fixed Reported by "miha" on IRC --- modules/acc/README | 2 +- modules/acc/doc/acc_admin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/acc/README b/modules/acc/README index 6b986495ff6..f0697c245c5 100644 --- a/modules/acc/README +++ b/modules/acc/README @@ -502,7 +502,7 @@ modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)") # for AAA-based accounting, use the names of the AAA AVPs modparam("acc", "multi_leg_info", - "AAA_LEG_SRC=$avp(src);AAA_LEG_SRC=$avp(dst)") + "AAA_LEG_SRC=$avp(src);AAA_LEG_DST=$avp(dst)") # for DIAMETER-based accounting, use the DIAMETER AVP ID (as integer) modparam("acc", "multi_leg_info", "2345=$avp(src);2346=$avp(dst)") diff --git a/modules/acc/doc/acc_admin.xml b/modules/acc/doc/acc_admin.xml index 0807badb4a1..3b66dce91c3 100644 --- a/modules/acc/doc/acc_admin.xml +++ b/modules/acc/doc/acc_admin.xml @@ -506,7 +506,7 @@ modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)") # for AAA-based accounting, use the names of the AAA AVPs modparam("acc", "multi_leg_info", - "AAA_LEG_SRC=$avp(src);AAA_LEG_SRC=$avp(dst)") + "AAA_LEG_SRC=$avp(src);AAA_LEG_DST=$avp(dst)") # for DIAMETER-based accounting, use the DIAMETER AVP ID (as integer) modparam("acc", "multi_leg_info", "2345=$avp(src);2346=$avp(dst)") From 8f7e4cb2da952f143fece21d60e3ca0a20edc920 Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Thu, 3 Oct 2013 17:34:23 +0300 Subject: [PATCH 060/159] Fix unpatched assignment in commit b33d4b3f Credits to Nick Altmann for reporting, along with an initial patch (cherry picked from commit bfcc635c4046bc94017be5166bad8867e98d4f1e) --- modules/usrloc/dlist.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/usrloc/dlist.c b/modules/usrloc/dlist.c index 61ccd1b9420..7f7ae9a9295 100644 --- a/modules/usrloc/dlist.c +++ b/modules/usrloc/dlist.c @@ -202,12 +202,13 @@ static int get_all_db_ucontacts(void *buf, int len, unsigned int flags, if (val->nul || !flag_list.s) continue; - LM_DBG("masks: param: %d --- %d :db\n", flags, - flag_list_to_bitmask(&flag_list,FLAG_TYPE_BRANCH,FLAG_DELIM)); + dbflags = flag_list_to_bitmask(&flag_list, + FLAG_TYPE_BRANCH, FLAG_DELIM); + + LM_DBG("masks: param: %d --- %d :db\n", flags, dbflags); /* check if contact flags match the given bitmask */ - if ((flag_list_to_bitmask(&flag_list, FLAG_TYPE_BRANCH, - FLAG_DELIM) & flags) != flags) + if ((dbflags & flags) != flags) continue; } @@ -263,9 +264,6 @@ static int get_all_db_ucontacts(void *buf, int len, unsigned int flags, } } - /* flags */ - dbflags = VAL_BITMAP(ROW_VALUES(row) + 3); - /* write sock and flags */ memcpy(buf, &sock, sizeof sock); buf += sizeof sock; From 184a7461e0df048807f9a7a4c5796d3ba1d5166b Mon Sep 17 00:00:00 2001 From: liviuchircu Date: Thu, 3 Oct 2013 18:03:48 +0300 Subject: [PATCH 061/159] Properly load contact flags even when NAT pinging is disabled (cherry picked from commit 39119d1dadb09f3d0999023e41736548a0e446aa) --- modules/usrloc/dlist.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/usrloc/dlist.c b/modules/usrloc/dlist.c index 7f7ae9a9295..0b6103f9b29 100644 --- a/modules/usrloc/dlist.c +++ b/modules/usrloc/dlist.c @@ -196,21 +196,18 @@ static int get_all_db_ucontacts(void *buf, int len, unsigned int flags, flag_list.len = strlen(flag_list.s); LM_DBG("contact cflags: '%.*s'\n", flag_list.len, flag_list.s); + LM_DBG("masks: param: %d --- %d :db\n", flags, dbflags); - if (flags) { - /* contact is not flagged at all */ - if (val->nul || !flag_list.s) - continue; - - dbflags = flag_list_to_bitmask(&flag_list, - FLAG_TYPE_BRANCH, FLAG_DELIM); + /* contact is not flagged at all */ + if (flags && (val->nul || !flag_list.s)) + continue; - LM_DBG("masks: param: %d --- %d :db\n", flags, dbflags); + dbflags = flag_list_to_bitmask(&flag_list, + FLAG_TYPE_BRANCH, FLAG_DELIM); - /* check if contact flags match the given bitmask */ - if ((dbflags & flags) != flags) - continue; - } + /* check if contact flags match the given bitmask */ + if ((dbflags & flags) != flags) + continue; /* received */ p = (char*)VAL_STRING(ROW_VALUES(row)); From 2c4b0d3173f10ff06609182779954988fc910b14 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Thu, 3 Oct 2013 19:29:18 +0300 Subject: [PATCH 062/159] Fixed menuconfig errors when selecting mi_xmlrpc vs mi_xmlrpc_ng (cherry picked from commit 7ad1db27dd7bea313beeb97eb276c303d8339fab) --- Makefile.conf | 10 +++++++--- menuconfig/parser.c | 32 ++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Makefile.conf b/Makefile.conf index 7788e6b8f9d..059f04a948c 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -24,8 +24,10 @@ #ldap= Implements an LDAP search interface for OpenSIPS | OpenLDAP library & development files, tipically libldap and libldap-dev #lua= Easily implement your own OpenSIPS extensions in Lua | liblua5.1-0-dev, libmemcache-dev and libmysqlclient-dev #httpd= Provides an HTTP transport layer implementation for OpenSIPS. | libmicrohttpd -#mi_xmlrpc_ng= Implements a xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml -#mi_xmlrpc= libxmlrpc-c3 version 0.9.10 - 0.9.42. (using other versions may be dangerous and lead to opensips blocking) +#mi_xmlrpc_ng= New version of the xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml +#mi_xmlrpc= Old version of the xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml +#mi_xmlrpc= libxmlrpc-c3 version 0.9.10 - 0.9.42. (using other versions may be dangerous and lead to opensips blocking) +#mi_xmlrpc= libxmlrpc-c3-dev version 0.9.10 - 0.9.42 #mmgeoip= Lightweight wrapper for the MaxMind GeoIP API | libGeoIP #osp= Enables OpenSIPS to support secure, multi-lateral peering using the OSP standard | OSP development kit, tipically osptoolkit #perl= Easily implement your own OpenSIPS extensions in Perl | Perl library development files, tipically libperl-dev @@ -49,7 +51,7 @@ #xcap_client= XCAP client for OpenSIPS.It fetches XCAP elements, either documents or part of them, by sending HTTP GET requests | libxml-dev and libcurl-dev #xmpp= Gateway between OpenSIPS and a jabber server. It enables the exchange of IMs between SIP clients and XMPP(jabber) clients. | parsing/building XML files, tipically libexpat1-devel -exclude_modules?= aaa_radius b2b_logic cachedb_couchbase cachedb_cassandra cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cpl-c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_unixodbc dialplan event_rabbitmq h350 regex identity jabber json ldap lua httpd pi_http mi_http mi_xmlrpc mi_xmlrpc_ng mmgeoip osp perl presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats xcap xcap_client xmpp +exclude_modules?= aaa_radius b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cpl-c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_unixodbc dialplan event_rabbitmq h350 regex identity jabber json ldap lua httpd mi_xmlrpc_ng mi_xmlrpc mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats xcap xcap_client xmpp include_modules?= @@ -81,3 +83,5 @@ DEFS+= -DUSE_TCP #Compiles in TCP support #DEFS+= -DNOSMP #Do not use SMP sompliant locking. Faster but won't work on SMP machines #DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code #DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC + +PREFIX=/usr/ \ No newline at end of file diff --git a/menuconfig/parser.c b/menuconfig/parser.c index 53bf0b5f45d..744d1e6a1bd 100644 --- a/menuconfig/parser.c +++ b/menuconfig/parser.c @@ -35,6 +35,7 @@ #define MENUCONFIG_CFG_PATH_LEN strlen(MENUCONFIG_CFG_PATH) static char prev_module[MAX_MODULE_NAME_SIZE]; +static int prev_module_len=0; static select_item *prev_item; /* Parses a single module dependency line */ @@ -56,7 +57,21 @@ int parse_dep_line(char *line,select_menu *parent) mod_name[name_len]=0; /* Is this still the previous module ? */ - if (memcmp(prev_module,mod_name,name_len) != 0) { + if (name_len == prev_module_len && memcmp(prev_module,mod_name,name_len) == 0) { + /* Previously found module with multiple deps. + * Just add the new dependency */ + fprintf(output,"found prev module %s with extra deps\n",mod_name); + + mod_dep = p+1; + dep_len = (line+len) - mod_dep; + mod_dep[dep_len]=0; + + if (add_dependency(prev_item,mod_dep) < 0) { + fprintf(output,"Failed to add dependency\n"); + return -1; + } + } else { + fprintf(output,"found new module %s\n",mod_name); /* nope, new module, get description */ mod_desc=p+1; @@ -90,19 +105,8 @@ int parse_dep_line(char *line,select_menu *parent) prev_item = item; strcpy(prev_module,mod_name); - } else { - /* Previously found module with multiple deps. - * Just add the new dependency */ - - mod_dep = p+1; - dep_len = (line+len) - mod_dep; - mod_dep[dep_len]=0; - - if (add_dependency(prev_item,mod_dep) < 0) { - fprintf(output,"Failed to add dependency\n"); - return -1; - } - } + prev_module_len = name_len; + } return 0; } From 8e3b9ee73afc58558ee62472b692331d66be81de Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Thu, 3 Oct 2013 19:56:59 +0300 Subject: [PATCH 063/159] Merge branch 'master' of github.com:OpenSIPS/opensips --- modules/sipmsgops/sipmsgops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/sipmsgops/sipmsgops.c b/modules/sipmsgops/sipmsgops.c index a704b5f4cbc..8ac5b00002f 100644 --- a/modules/sipmsgops/sipmsgops.c +++ b/modules/sipmsgops/sipmsgops.c @@ -1864,6 +1864,10 @@ static int w_sip_validate(struct sip_msg *msg, char *flags_s, char* pv_result) } } + /* set reason to empty (covers cases where we + * exit via CHECK_HEADER) */ + reason[0] = 0; + /* Cseq */ ret = SV_NO_CSEQ; CHECK_HEADER("", cseq); @@ -1898,9 +1902,10 @@ static int w_sip_validate(struct sip_msg *msg, char *flags_s, char* pv_result) } } /* Max-Forwards */ - if (!(flags & SIP_PARSE_NOMF)) + if (!(flags & SIP_PARSE_NOMF)) { ret = SV_NO_MF; CHECK_HEADER("", maxforwards); + } if (msg->REQ_METHOD == METHOD_INVITE) { ret = SV_NO_CONTACT; From c95e9025b976e9768490342435008874bac788f4 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Thu, 3 Oct 2013 20:57:11 +0300 Subject: [PATCH 064/159] handle the signals while waiting for the startup route to end (if not, the main proc will never know if the child running startup route crashed and it will hang for ever during startup) --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index f162657d9bb..9993c24c24a 100644 --- a/main.c +++ b/main.c @@ -920,7 +920,7 @@ static int main_loop(void) else { /* wait for first proc to finish the startup route */ if(chd_rank == 1 && startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} } } } @@ -977,7 +977,7 @@ static int main_loop(void) } else { /* wait for first proc to finish the startup route */ if( (si==sctp_listen && i==0) && startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} } } } @@ -999,7 +999,7 @@ static int main_loop(void) if (tcp_init_children(&chd_rank, startup_done)<0) goto error; /* wait for the startup route to be executed */ if( startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} /* start tcp+tls master proc */ if ( (pid=internal_fork( "TCP main"))<0 ) { LM_CRIT("cannot fork tcp main process\n"); From f6dea9fa5ab8be94aced6e1a4eba6012e9bd0404 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 4 Oct 2013 14:48:10 +0300 Subject: [PATCH 065/159] In DELAYED mode, flush vars & profile to DB at ACK time too - no timer tick between 200 OK and ACK was droping the update operation to DB. Please note that this "bug" had actually no implications, as dialog data is either used from memory cache, either from DB after a restart (and a shutdown flushes everything to DB). Related to issue #97. --- modules/dialog/dlg_db_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index 11f220ea408..bd308019ca7 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -1307,7 +1307,8 @@ void dialog_update_db(unsigned int ticks, void * param) SET_INT_VALUE(values+19, cell->legs[DLG_CALLER_LEG].last_gen_cseq); SET_INT_VALUE(values+20, cell->legs[callee_leg].last_gen_cseq); - set_final_update_cols(values+21, cell, on_shutdown); + set_final_update_cols(values+21, cell, + (on_shutdown) || (cell->flags&DLG_FLAG_CHANGED) ); SET_INT_VALUE(values+24, cell->flags & ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED)); CON_PS_REFERENCE(dialog_db_handle) = &my_ps_insert; From 606c02eb41ec092dc773040f3ea75384d44e610e Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 4 Oct 2013 15:43:56 +0300 Subject: [PATCH 066/159] Fixed is_mod_func_used() (used from is_script_func_used()) to determin if a function is used from script - we need to follow the IF / WHILE / MODULE set of instructions too. Reported by Mayama Takeshi - many thanks for the detailed report on this. Closes issue #98 --- route_struct.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/route_struct.c b/route_struct.c index d691022c467..bed0422216a 100644 --- a/route_struct.c +++ b/route_struct.c @@ -646,6 +646,20 @@ int is_mod_func_used(struct action *a, char *name, int param_no) (param_no==cmd->param_no || param_no==-1) ) return 1; } + + /* follow all leads from actions than may have sub-blocks of instructions */ + if (a->elem[0].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[0].u.data,name,param_no)==1) + return 1; + + if (a->elem[1].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[1].u.data,name,param_no)==1) + return 1; + + if (a->elem[2].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[2].u.data,name,param_no)==1) + return 1; + a = a->next; } From 52a732e46a2444c4cc1b9d1eac2a3e43aff9d35d Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 7 Oct 2013 13:25:26 +0300 Subject: [PATCH 067/159] Fixed topology_hiding("U") in case of no username in Contact header Credits for report & fix to Nick Altmann (cherry picked from commit b200e11cf0308ab12c9562c552d69b1a78c52576) --- modules/dialog/dlg_tophiding.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/dialog/dlg_tophiding.c b/modules/dialog/dlg_tophiding.c index 9d46ae90446..8ab3dc1fad5 100644 --- a/modules/dialog/dlg_tophiding.c +++ b/modules/dialog/dlg_tophiding.c @@ -113,7 +113,8 @@ int dlg_replace_contact(struct sip_msg* msg, struct dlg_cell* dlg) ct_username_len = ctu.user.len; LM_DBG("Trying to propagate username [%.*s] \n",ct_username_len, ct_username); - prefix_len += 1 + /* @ */ + ct_username_len; + if (ct_username_len > 0) + prefix_len += 1 + /* @ */ + ct_username_len; } } } From 2e6b4421b09f78d58dec7672e0eedbcd33717e1f Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 7 Oct 2013 13:40:21 +0300 Subject: [PATCH 068/159] Fixed the re-loading of dlg vars after restart Credits to Nick Altmann (cherry picked from commit ec0d05aaef41b0a4f30419bbab1295eb4bce7e49) --- modules/dialog/dlg_db_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index bd308019ca7..c27f30fffbd 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -621,7 +621,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) /* script variables */ if (!VAL_NULL(values+17)) read_dialog_vars( VAL_STR(values+17).s, - VAL_STR(values+17).len, dlg); + strlen(VAL_STR(values+17).s), dlg); /* profiles */ if (!VAL_NULL(values+18)) From 728bdefdc583b684168a4b502fd49456a99eabac Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 10 Oct 2013 21:09:00 +0300 Subject: [PATCH 069/159] Fix a particular startup crash e.g. when defining only 1 tcp interface while specifying "disable_tcp=true" (cherry picked from commit 101ee782480af07cd9d056b41b9f33d331d21951) --- socket_info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/socket_info.c b/socket_info.c index 41b106f8ba3..e4acd29c983 100644 --- a/socket_info.c +++ b/socket_info.c @@ -867,13 +867,13 @@ int fix_all_socket_lists(void) if ((udp_listen==0) #ifdef USE_TCP - && (tcp_listen==0) + && (tcp_listen==0 || tcp_disable) #ifdef USE_TLS - && (tls_listen==0) + && (tls_listen==0 || tls_disable) #endif #endif #ifdef USE_SCTP - && (sctp_listen==0) + && (sctp_listen==0 || sctp_disable) #endif ){ LM_ERR("no listening sockets\n"); From 7e0aa9a75715503eef1b86f3558c7181f203587e Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 10 Oct 2013 22:18:10 +0300 Subject: [PATCH 070/159] Allow NULL strings to be pushed into binary interface packets (cherry picked from commit 3a334c3042be2fbc5e7e6019c0f9c8ddef4f6922) --- bin_interface.c | 6 ++++-- bin_interface.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bin_interface.c b/bin_interface.c index 7da75bdf822..76e7c5e0937 100644 --- a/bin_interface.c +++ b/bin_interface.c @@ -82,15 +82,17 @@ int bin_init(str *mod_name, int cmd_type) /* * copies the given string at the 'cpos' position in the buffer + * allows null strings (NULL content or NULL param) * * @return: 0 on success */ int bin_push_str(const str *info) { - if (!cpos || (cpos - send_buffer + info->len + LEN_FIELD_SIZE) > BUF_SIZE) + if (!cpos || (cpos - send_buffer + LEN_FIELD_SIZE + (info ? info->len : 0)) + > BUF_SIZE) return -1; - if (!info || info->len == 0) { + if (!info || info->len == 0 || !info->s) { memset(cpos, 0, LEN_FIELD_SIZE); cpos += LEN_FIELD_SIZE; return 0; diff --git a/bin_interface.h b/bin_interface.h index f0e9195a0fe..c1beb2b809d 100644 --- a/bin_interface.h +++ b/bin_interface.h @@ -74,15 +74,16 @@ int bin_init(str *mod_name, int packet_type); /* * adds a new string value to the packet being currently built + * @info: may also be NULL * - * @return: 0 on success + * @return: 0 on success, otherwise buffer limit reached */ int bin_push_str(const str *info); /* * adds a new integer value to the packet being currently built * - * @return: 0 on success + * @return: 0 on success, otherwise buffer limit reached */ int bin_push_int(int info); From 9485224f023b1656be0e47cf05b5dc66e73024ee Mon Sep 17 00:00:00 2001 From: Di-Shi Sun Date: Tue, 15 Oct 2013 16:31:29 +0800 Subject: [PATCH 071/159] 1. Added support for appending parameter string in outbound URI. 2. Removed skip plus feature for called number. (cherry picked from commit 414504077dc72054ae6954f61b998df2ba6ffd53) --- modules/osp/README | 97 ++++++++++++++++--------- modules/osp/doc/osp_admin.xml | 23 ++++++ modules/osp/etc/sample-osp-opensips.cfg | 21 ++++++ modules/osp/globals.c | 2 + modules/osp/osp_mod.c | 15 ++++ modules/osp/osp_mod.h | 2 + modules/osp/sipheader.c | 40 ++++------ 7 files changed, 142 insertions(+), 58 deletions(-) diff --git a/modules/osp/README b/modules/osp/README index 04d86bc38ac..a8c3f3e51d8 100644 --- a/modules/osp/README +++ b/modules/osp/README @@ -16,7 +16,7 @@ Di-Shi Sun Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 15:45:05 +0800 + Revision $Revision: 5901 $ $Date: 2009-07-21 09:45:05 +0200 (Tue, 21 Jul 2009) $ __________________________________________________________ @@ -52,9 +52,11 @@ Di-Shi Sun 1.3.20. append_userphone 1.3.21. networkid_location 1.3.22. networkid_parameter - 1.3.23. source_device_avp - 1.3.24. source_networkid_avp - 1.3.25. custom_info_avp + 1.3.23. parameterstring_location + 1.3.24. parameterstring_value + 1.3.25. source_device_avp + 1.3.26. source_networkid_avp + 1.3.27. custom_info_avp 1.4. Exported Functions @@ -96,18 +98,20 @@ Di-Shi Sun 1.20. Append user=phone parameter 1.21. Append networkid location 1.22. Networkid parameter name - 1.23. Setting the source device IP AVP - 1.24. Setting the source network ID AVP - 1.25. Setting the custom info AVP - 1.26. checkospheader usage - 1.27. validateospheader usage - 1.28. requestosprouting usage - 1.29. checkosproute usage - 1.30. prepareosproute usage - 1.31. prepareredirectosproutes usage - 1.32. prepareallosproutes usage - 1.33. checkcallingtranslation usage - 1.34. reportospusage usage + 1.23. Append parameter string location + 1.24. Parameter string value + 1.25. Setting the source device IP AVP + 1.26. Setting the source network ID AVP + 1.27. Setting the custom info AVP + 1.28. checkospheader usage + 1.29. validateospheader usage + 1.30. requestosprouting usage + 1.31. checkosproute usage + 1.32. prepareosproute usage + 1.33. prepareredirectosproutes usage + 1.34. prepareallosproutes usage + 1.35. checkcallingtranslation usage + 1.36. reportospusage usage Chapter 1. Admin Guide @@ -187,7 +191,8 @@ modparam("osp","service_type",0) included. Example 1.3. Setting the OSP servers -modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp") +modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp" +) modparam("osp","sp2_uri","https://[1.2.3.4]:1443/osp") 1.3.4. sp1_weight, sp2_weight, ..., sp16_weight @@ -275,8 +280,8 @@ modparam("osp","token_format",2) If the default CFG_DIR value was used at compile time, the files will be loaded from: modparam("osp","private_key","/usr/local/etc/opensips/pkey.pem") -modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.pe -m") +modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.p +em") modparam("osp","ca_certificates","/usr/local/etc/opensips/cacert.pem") 1.3.9. enable_crypto_hardware_support @@ -445,7 +450,31 @@ modparam("osp","networkid_location",2) Example 1.22. Networkid parameter name modparam("osp","networkid_param","networkid") -1.3.23. source_device_avp +1.3.23. parameterstring_location + + The parameterstring_location (integer) parameter instructs the + OSP module where the parameter string should be appended. The + default value is 0 + + 0 - parameter string is not appended. + + 1 - parameter string is appended as userinfo parameter. + + 2 - parameter string is appended as URI parameter. + + Example 1.23. Append parameter string location +modparam("osp","parameterstring_location",0) + +1.3.24. parameterstring_value + + The parameterstring_value (string) parameter instructs the OSP + module to append the parameter string in outbound URIs. The + default value is "" + + Example 1.24. Parameter string value +modparam("osp","parameterstring_value","") + +1.3.25. source_device_avp The source_device_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source device IP @@ -455,10 +484,10 @@ modparam("osp","networkid_param","networkid") pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.23. Setting the source device IP AVP + Example 1.25. Setting the source device IP AVP modparam("osp","source_device_avp","$avp(srcdev)") -1.3.24. source_networkid_avp +1.3.26. source_networkid_avp The source_networkid_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source network ID @@ -468,10 +497,10 @@ modparam("osp","source_device_avp","$avp(srcdev)") variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.24. Setting the source network ID AVP + Example 1.26. Setting the source network ID AVP modparam("osp","source_networkid_avp","$avp(snid)") -1.3.25. custom_info_avp +1.3.27. custom_info_avp The custom_info_avp (string) parameter instructs the OSP module to use the defined AVP to pass the custom information values. @@ -480,7 +509,7 @@ modparam("osp","source_networkid_avp","$avp(snid)") pseudo-variables". All pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.25. Setting the custom info AVP + Example 1.27. Setting the custom info AVP modparam("osp","custom_info_avp","$avp(cinfo)") 1.4. Exported Functions @@ -492,7 +521,7 @@ modparam("osp","custom_info_avp","$avp(cinfo)") This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.26. checkospheader usage + Example 1.28. checkospheader usage ... if (checkospheader()) { log(1,"OSP header field found.\n"); @@ -511,7 +540,7 @@ if (checkospheader()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.27. validateospheader usage + Example 1.29. validateospheader usage ... if (validateospheader()) { log(1,"valid OSP header found\n"); @@ -540,7 +569,7 @@ if (validateospheader()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.28. requestosprouting usage + Example 1.30. requestosprouting usage ... if (requestosprouting()) { log(1,"successfully queried OSP server, now relaying call\n"); @@ -556,7 +585,7 @@ if (requestosprouting()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.29. checkosproute usage + Example 1.31. checkosproute usage ... if (checkosproute()) { log(1,"There is at least one route for the call\n"); @@ -579,7 +608,7 @@ if (checkosproute()) { This function can be used from BRANCH_ROUTE. - Example 1.30. prepareosproute usage + Example 1.32. prepareosproute usage ... if (prepareosproute()) { log(1,"successfully prepared the route, now relaying call\n"); @@ -598,7 +627,7 @@ if (prepareosproute()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.31. prepareredirectosproutes usage + Example 1.33. prepareredirectosproutes usage ... if (prepareredirectosproutes()) { log(1,"Routes are prepared, now redirecting the call\n"); @@ -616,7 +645,7 @@ if (prepareredirectosproutes()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.32. prepareallosproutes usage + Example 1.34. prepareallosproutes usage ... if (prepareallosproutes()) { log(1,"Routes are prepared, now forking the call\n"); @@ -638,7 +667,7 @@ if (prepareallosproutes()) { This function can be used from BRANCH_ROUTE. - Example 1.33. checkcallingtranslation usage + Example 1.35. checkcallingtranslation usage ... if (checkcallingtranslation()) { # Remove the Remote_Party-ID from the received message @@ -667,7 +696,7 @@ if (checkcallingtranslation()) { This function can be used from REQUEST_ROUTE. - Example 1.34. reportospusage usage + Example 1.36. reportospusage usage ... if (is_direction("downstream")) { log(1,"This BYE message is from SOURCE\n"); diff --git a/modules/osp/doc/osp_admin.xml b/modules/osp/doc/osp_admin.xml index 42736bc7ff3..5c29a6a7667 100644 --- a/modules/osp/doc/osp_admin.xml +++ b/modules/osp/doc/osp_admin.xml @@ -288,6 +288,29 @@ modparam("osp","networkid_param","networkid")
+
+ <varname>parameterstring_location</varname> + The parameterstring_location (integer) parameter instructs the OSP module where the parameter string should be appended. The default value is 0 + 0 - parameter string is not appended. + 1 - parameter string is appended as userinfo parameter. + 2 - parameter string is appended as URI parameter. + + Append parameter string location + +modparam("osp","parameterstring_location",0) + + +
+
+ <varname>parameterstring_value</varname> + The parameterstring_value (string) parameter instructs the OSP module to append the parameter string in outbound URIs. The default value is "" + + Parameter string value + +modparam("osp","parameterstring_value","") + + +
<varname>source_device_avp</varname> The source_device_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source device IP value in the indirect work mode. The default value is "$avp(_osp_source_device_)". Then the source device IP can be set by "$avp(_osp_source_device_) = pseudo-variables". All pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. diff --git a/modules/osp/etc/sample-osp-opensips.cfg b/modules/osp/etc/sample-osp-opensips.cfg index 5f21e947505..e313c97f4f5 100644 --- a/modules/osp/etc/sample-osp-opensips.cfg +++ b/modules/osp/etc/sample-osp-opensips.cfg @@ -229,6 +229,27 @@ modparam("osp", "sp1_uri", "http://osptestserver.transnexus.com:5045/osp") # # modparam("osp", "networkid_parameter", "networkid") +# +# Parameter String Location +# ==================================================================== +# This parameter is used to tell the OSP module where the parameter +# string should be appended in the outbound URI. The default value is +# 0. +# +# 0 - parameter string is not appended. +# 1 - parameter string is appended as userinfo parameter. +# 2 - parameter string is appended as URI parameter. +# +# modparam("osp", "parameterstring_location", 0) + +# +# Parameter String Value +# ==================================================================== +# This parameter is used to tell the OSP module the parameter string +# that is appended in outbound URI. The default value is empty. +# +# modparam("osp", "parameterstring_value", "") + # # Source Device IP AVP # ==================================================================== diff --git a/modules/osp/globals.c b/modules/osp/globals.c index abba2f9bbd2..32fd8a14694 100644 --- a/modules/osp/globals.c +++ b/modules/osp/globals.c @@ -68,6 +68,8 @@ int _osp_use_np = OSP_DEF_USENP; int _osp_append_userphone = OSP_DEF_USERPHONE; int _osp_dnid_location = OSP_DEF_DNIDLOC; char* _osp_dnid_param = OSP_DEF_DNIDPARAM; +int _osp_paramstr_location = OSP_DEF_PARAMSTRLOC; +char* _osp_paramstr_value = OSP_DEF_PARAMSTRVAL; char _osp_PRIVATE_KEY[OSP_STRBUF_SIZE]; char _osp_LOCAL_CERTIFICATE[OSP_STRBUF_SIZE]; char _osp_CA_CERTIFICATE[OSP_STRBUF_SIZE]; diff --git a/modules/osp/osp_mod.c b/modules/osp/osp_mod.c index 8ec82d4bde1..afbc0969329 100644 --- a/modules/osp/osp_mod.c +++ b/modules/osp/osp_mod.c @@ -71,6 +71,8 @@ extern int _osp_use_np; extern int _osp_append_userphone; extern int _osp_dnid_location; extern char* _osp_dnid_param; +extern int _osp_paramstr_location; +extern char* _osp_paramstr_value; extern char _osp_PRIVATE_KEY[]; extern char _osp_LOCAL_CERTIFICATE[]; extern char _osp_CA_CERTIFICATE[]; @@ -163,6 +165,8 @@ static param_export_t params[]={ { "append_userphone", INT_PARAM, &_osp_append_userphone }, { "networkid_location", INT_PARAM, &_osp_dnid_location}, { "networkid_parameter", STR_PARAM, &_osp_dnid_param }, + { "parameterstring_location", INT_PARAM, &_osp_paramstr_location}, + { "parameterstring_value", STR_PARAM, &_osp_paramstr_value }, { "source_device_avp", STR_PARAM, &_osp_srcdev_avp }, { "source_networkid_avp", STR_PARAM, &_osp_snid_avp }, { "custom_info_avp", STR_PARAM, &_osp_cinfo_avp }, @@ -342,6 +346,15 @@ static int ospVerifyParameters(void) _osp_dnid_param = OSP_DEF_DNIDPARAM; } + if ((_osp_paramstr_location < 0) || (_osp_paramstr_location > 2)) { + _osp_paramstr_location = OSP_DEF_PARAMSTRLOC; + LM_WARN("parameterstring_location is out of range, reset to %d\n", OSP_DEF_PARAMSTRLOC); + } + + if (!(_osp_paramstr_value && *_osp_paramstr_value)) { + _osp_paramstr_value = OSP_DEF_PARAMSTRVAL; + } + if ((_osp_work_mode == 1) && _osp_srcdev_avp && *_osp_srcdev_avp) { avp_str.s = _osp_srcdev_avp; avp_str.len = strlen(_osp_srcdev_avp); @@ -429,6 +442,8 @@ static void ospDumpParameters(void) LM_INFO(" append_userphone '%d' ", _osp_append_userphone); LM_INFO(" networkid_location '%d' ", _osp_dnid_location); LM_INFO(" networkid_parameter '%s' ", _osp_dnid_param); + LM_INFO(" parameterstring_location '%d' ", _osp_paramstr_location); + LM_INFO(" parameterstring_value '%s' ", _osp_paramstr_value); LM_INFO(" max_destinations '%d'\n", _osp_max_dests); LM_INFO(" report_networkid '%d'\n", _osp_report_nid); LM_INFO(" support_nonsip_protocol '%d'\n", _osp_non_sip); diff --git a/modules/osp/osp_mod.h b/modules/osp/osp_mod.h index e43430501f0..708c0510184 100644 --- a/modules/osp/osp_mod.h +++ b/modules/osp/osp_mod.h @@ -57,6 +57,8 @@ #define OSP_DEF_USERPHONE 0 #define OSP_DEF_DNIDLOC 2 #define OSP_DEF_DNIDPARAM "networkid" +#define OSP_DEF_PARAMSTRLOC 0 +#define OSP_DEF_PARAMSTRVAL "" #define OSP_DEF_SRCIPAVP "$avp(_osp_source_device_)" #define OSP_DEF_SNIDAVP "$avp(_osp_source_networkid_)" #define OSP_DEF_CINFOS 8 diff --git a/modules/osp/sipheader.c b/modules/osp/sipheader.c index 9742e6cc033..85b832759f6 100644 --- a/modules/osp/sipheader.c +++ b/modules/osp/sipheader.c @@ -49,10 +49,11 @@ extern int _osp_use_np; extern int _osp_append_userphone; extern int _osp_dnid_location; extern char* _osp_dnid_param; +extern int _osp_paramstr_location; +extern char* _osp_paramstr_value; extern int _osp_srcdev_avpid; extern unsigned short _osp_srcdev_avptype; -static void ospSkipPlus(char* e164); static void ospSkipUserParam(char* userinfo); static int ospAppendHeader(struct sip_msg* msg, str* header); @@ -83,22 +84,6 @@ void ospCopyStrToBuffer( buffer[copybytes] = '\0'; } -/* - * Remove '+' in E164 string - * param e164 E164 string - */ -static void ospSkipPlus( - char* e164) -{ - int size; - - if (*e164 == '+') { - size = strlen(e164); - memmove(e164, e164 + 1, size - 1); - e164[size - 1] = '\0'; - } -} - /* * Remove user parameters from userinfo * param userinfo User info @@ -141,7 +126,6 @@ int ospGetFromUserpart( if (parse_uri(from->uri.s, from->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, fromuser, bufsize); ospSkipUserParam(fromuser); - ospSkipPlus(fromuser); result = 0; } else { LM_ERR("failed to parse From uri\n"); @@ -183,7 +167,6 @@ int ospGetRpidUserpart( if (parse_uri(rpid->uri.s, rpid->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, rpiduser, bufsize); ospSkipUserParam(rpiduser); - ospSkipPlus(rpiduser); result = 0; } else { LM_ERR("failed to parse RPID uri\n"); @@ -226,7 +209,6 @@ int ospGetPaiUserpart( if (parse_uri(pai->uri.s, pai->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, paiuser, bufsize); ospSkipUserParam(paiuser); - ospSkipPlus(paiuser); result = 0; } else { LM_ERR("failed to parse PAI uri\n"); @@ -283,7 +265,6 @@ int ospGetPChargeInfoUserpart( if (parse_uri(pci->uri.s, pci->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, pciuser, bufsize); ospSkipUserParam(pciuser); - ospSkipPlus(pciuser); result = 0; } else { LM_ERR("failed to parse P-Charge-Info uri\n"); @@ -333,7 +314,6 @@ int ospGetToUserpart( if (parse_uri(to->uri.s, to->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, touser, bufsize); ospSkipUserParam(touser); - ospSkipPlus(touser); result = 0; } else { LM_ERR("failed to parse To uri\n"); @@ -417,7 +397,6 @@ int ospGetUriUserpart( if (parse_sip_msg_uri(msg) >= 0) { ospCopyStrToBuffer(&msg->parsed_uri.user, uriuser, bufsize); ospSkipUserParam(uriuser); - ospSkipPlus(uriuser); result = 0; } else { LM_ERR("failed to parse Request-Line URI\n"); @@ -771,6 +750,7 @@ int ospRebuildDestinationUri( int uriparamsize; int userparamsize; int dnidsize; + int paramstrsize; int count; calledsize = strlen(dest->called); @@ -797,6 +777,8 @@ int ospRebuildDestinationUri( uriparamsize = _osp_append_userphone ? USERPHONE.len : 0; /* destination network ID parameter */ dnidsize = (_osp_dnid_location && dest->dnid[0]) ? 1 + strlen(_osp_dnid_param) + 1 + strlen(dest->dnid) : 0; + /* parameter string */ + paramstrsize = (_osp_paramstr_location && _osp_paramstr_value[0]) ? 1 + strlen(_osp_paramstr_value) : 0; LM_DBG("'%s' (%d) '%s' (%d) '%s' '%s' '%d' '%s' '%s' '%s' '%s' '%s' '%s' (%d) '%s' (%d)\n", dest->called, @@ -819,7 +801,7 @@ int ospRebuildDestinationUri( /* "sip:" + called + NP + "@" + host + ";user=phone" + ";_osp_dnid_param=" + dnid + " SIP/2.0" or "sip:" + called + NP + ";_osp_dnid_param=" + dnid + "@" + host + ";user=phone" SIP/2.0" */ /* OpenSIPS will add "<>" for the Contact headers of SIP 3xx messages */ - if (newuri->len < (4 + calledsize + userparamsize + 1 + hostsize + uriparamsize + dnidsize + 1 + 7 + TRANS.len)) { + if (newuri->len < (4 + calledsize + userparamsize + 1 + hostsize + uriparamsize + dnidsize + paramstrsize + 1 + 7 + TRANS.len)) { LM_ERR("new uri buffer is too small\n"); newuri->len = 0; return -1; @@ -877,6 +859,11 @@ int ospRebuildDestinationUri( buffer += count; } + if ((_osp_paramstr_location == 1) && (_osp_paramstr_value[0] != '\0')) { + count = sprintf(buffer, ";%s", _osp_paramstr_value); + buffer += count; + } + *buffer++ = '@'; strncpy(buffer, dest->host, newuri->len - (buffer - newuri->s)); @@ -892,6 +879,11 @@ int ospRebuildDestinationUri( buffer += count; } + if ((_osp_paramstr_location == 2) && (_osp_paramstr_value[0] != '\0')) { + count = sprintf(buffer, ";%s", _osp_paramstr_value); + buffer += count; + } + /* *buffer++ = ' '; *buffer++ = 'S'; From 62e7692dbcbe10d68f8f4e7aaf82c75653ebaa5e Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 16 Oct 2013 18:25:28 +0300 Subject: [PATCH 072/159] Make pv_parse_format() more verbous on reporting the causes to fail. Reported by peppolon on IRC --- pvar.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pvar.c b/pvar.c index d04ce3cbb8d..5d878970c4f 100644 --- a/pvar.c +++ b/pvar.c @@ -3670,8 +3670,10 @@ int pv_parse_format(str *in, pv_elem_p *el) if(in->len == 0) { *el = pkg_malloc(sizeof(pv_elem_t)); - if(*el == NULL) + if(*el == NULL) { + LM_ERR("not enough pkg memory for PV element (1)\n"); goto error; + } memset(*el, 0, sizeof(pv_elem_t)); (*el)->text = *in; return 0; @@ -3685,8 +3687,10 @@ int pv_parse_format(str *in, pv_elem_p *el) { e0 = e; e = pkg_malloc(sizeof(pv_elem_t)); - if(!e) + if(!e) { + LM_ERR("not enough pkg memory for PV element (2)\n"); goto error; + } memset(e, 0, sizeof(pv_elem_t)); n++; if(*el == NULL) @@ -3705,8 +3709,10 @@ int pv_parse_format(str *in, pv_elem_p *el) s.len = in->s+in->len-p; p0 = pv_parse_spec(&s, &e->spec); - if(p0==NULL) + if(p0==NULL) { + LM_ERR("parsing PV spec failed\n"); goto error; + } if(!is_in_str(p0,in)) break; p = p0; From 46dbe2bda2ca4a7abbc13f1571e41c4a5ae7b3aa Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Tue, 15 Oct 2013 12:33:34 -0400 Subject: [PATCH 073/159] uac_auth: fix memory leak reported by Jeff Pyle - affected modules: b2b_entities, uac, uac_registrant (cherry picked from commit 868976769543970844d9001a2c68e11a3eb026b0) --- modules/b2b_entities/dlg.c | 2 ++ modules/uac/auth.c | 4 ++++ modules/uac_auth/auth.c | 25 ++++++++++++++----------- modules/uac_registrant/registrant.c | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 1bfd95e3771..7fafb08c4ee 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -2324,6 +2324,8 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps) extra_headers.len = new_hdr->len + t->uac[0].extra_headers.len; LM_DBG("[%.*s]\n", extra_headers.len, extra_headers.s); + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; b2b_send_indlg_req(dlg, B2B_CLIENT, b2b_key, &t->method, &extra_headers, &t->uac[0].body, 0); diff --git a/modules/uac/auth.c b/modules/uac/auth.c index ef27f3d8c63..6c6a9de4c60 100644 --- a/modules/uac/auth.c +++ b/modules/uac/auth.c @@ -179,9 +179,13 @@ int uac_auth( struct sip_msg *msg) if ( apply_urihdr_changes( msg, &t->uac[branch].uri, new_hdr)<0 ) { LM_ERR("failed to apply changes\n"); + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; goto error; } + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; /* increas the Cseq nr */ diff --git a/modules/uac_auth/auth.c b/modules/uac_auth/auth.c index b0a094a16ef..d8f45e9ca86 100644 --- a/modules/uac_auth/auth.c +++ b/modules/uac_auth/auth.c @@ -54,6 +54,7 @@ extern unsigned short pwd_avp_type; static str nc = {"00000001", 8}; static str cnonce = {"o", 1}; +static str auth_hdr = {NULL, 0}; static struct uac_credential *crd_list = NULL; @@ -462,7 +463,6 @@ str* build_authorization_hdr(int code, str *uri, struct uac_credential *crd, struct authenticate_body *auth, struct authenticate_nc_cnonce *auth_nc_cnonce, char *response) { - static str hdr; char *p; int len; int response_len; @@ -485,14 +485,17 @@ str* build_authorization_hdr(int code, str *uri, NC_FIELD_LEN + auth_nc_cnonce->nc->len + FIELD_SEPARATOR_UQ_LEN + CNONCE_FIELD_LEN + auth_nc_cnonce->cnonce->len + FIELD_SEPARATOR_LEN; - hdr.s = (char*)pkg_malloc( len + 1); - if (hdr.s==0) + if (auth_hdr.s || auth_hdr.len) + LM_WARN("potential memory leak at addr: %p\n", auth_hdr.s); + + auth_hdr.s = (char*)pkg_malloc( len + 1); + if (auth_hdr.s==NULL) { LM_ERR("no more pkg mem\n"); goto error; } - p = hdr.s; + p = auth_hdr.s; /* header start */ if (code==401) { @@ -543,20 +546,20 @@ str* build_authorization_hdr(int code, str *uri, add_string( p, FIELD_SEPARATOR_S ALGORITHM_FIELD_S CRLF, FIELD_SEPARATOR_LEN+ALGORITHM_FIELD_LEN+CRLF_LEN); - hdr.len = p - hdr.s; + auth_hdr.len = p - auth_hdr.s; - if (hdr.len!=len) + if (auth_hdr.len!=len) { LM_CRIT("BUG: bad buffer computation " - "(%d<>%d)\n",len,hdr.len); - pkg_free( hdr.s ); + "(%d<>%d)\n",len,auth_hdr.len); + pkg_free( auth_hdr.s ); + auth_hdr.s = NULL; auth_hdr.len = 0; goto error; } - LM_DBG("hdr is <%.*s>\n", - hdr.len,hdr.s); + LM_DBG("auth_hdr is <%.*s>\n", auth_hdr.len, auth_hdr.s); - return &hdr; + return &auth_hdr; error: return 0; } diff --git a/modules/uac_registrant/registrant.c b/modules/uac_registrant/registrant.c index 65a77bb8b7e..2e73f610397 100644 --- a/modules/uac_registrant/registrant.c +++ b/modules/uac_registrant/registrant.c @@ -438,6 +438,8 @@ int run_reg_tm_cback(void *e_data, void *data, void *r_data) } else { rec->state = INTERNAL_ERROR_STATE; } + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; break; case 423: /* Interval Too Brief */ From 09ab451b2b28e739c678a7f0d57ce9e3fb5de6d9 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Thu, 17 Oct 2013 12:03:14 +0200 Subject: [PATCH 074/159] fix ratelimit memory corruption (cherry picked from commit 19cd04ab12fe37a4fd5685e7eabde1d435f8c8b4) --- modules/ratelimit/ratelimit_helper.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/ratelimit/ratelimit_helper.c b/modules/ratelimit/ratelimit_helper.c index 6151e7d99ff..091f1c21089 100644 --- a/modules/ratelimit/ratelimit_helper.c +++ b/modules/ratelimit/ratelimit_helper.c @@ -413,6 +413,7 @@ void rl_timer(unsigned int ticks, void *param) map_iterator_t it, del; rl_pipe_t **pipe; str *key; + void *value; unsigned long now = time(0); /* get CPU load */ @@ -455,10 +456,8 @@ void rl_timer(unsigned int ticks, void *param) if ((*pipe)->last_used + rl_expire_time < now) { /* this pipe is engaged in a transaction */ del = it; - if (iterator_prev(&it) < 0) { - LM_DBG("cannot find previous iterator\n"); - goto next_pipe; - } + if (iterator_next(&it) < 0) + LM_DBG("cannot find next iterator\n"); if ((*pipe)->algo == PIPE_ALGO_NETWORK) { lock_get(rl_lock); (*rl_network_count)--; @@ -466,17 +465,16 @@ void rl_timer(unsigned int ticks, void *param) } LM_DBG("Deleting ratelimit pipe key \"%.*s\"\n", key->len, key->s); - if (*pipe != iterator_delete(&del)) { - LM_ERR("error while deleting key\n"); - } + value = iterator_delete(&del); /* free resources */ - shm_free(*pipe); + if (value) + shm_free(value); + continue; } else { /* leave the lock if a cachedb query should be done*/ if (RL_USE_CDB(*pipe)) { if (rl_get_counter(key, *pipe) < 0) { LM_ERR("cannot get pipe counter\n"); - RL_GET_LOCK(i); goto next_pipe; } } @@ -499,7 +497,6 @@ void rl_timer(unsigned int ticks, void *param) if (RL_USE_CDB(*pipe)) { if (rl_change_counter(key, *pipe, 0) < 0) { LM_ERR("cannot reset counter\n"); - RL_GET_LOCK(i); } } else { (*pipe)->counter = 0; From 403862abba99068916f6f7c8812b7507685b57ae Mon Sep 17 00:00:00 2001 From: "Earl C. Ruby III" Date: Wed, 25 Sep 2013 12:58:18 -0700 Subject: [PATCH 075/159] The latest Linux distros from OpenSUSE, Fedora, and other non-Debian based distros no longer add symlinks for libcurses.so -> libncurses.so. Trying to compile menuconfig with -lcurses will not work on these distros, so I changed -lcurses to -lncurses, since -lncurses will work on any modern Linux distro with the ncurses5 libraries installed. See http://stackoverflow.com/questions/1517756/whats-the-difference-between-lcurses-and-lncurses-when-compiling-c-using-ncur for more info. (cherry picked from commit 7ae769dac06146253ea07d8d930d73f7ccaa817a) --- menuconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menuconfig/Makefile b/menuconfig/Makefile index 9faa5f4529f..90e967311f6 100644 --- a/menuconfig/Makefile +++ b/menuconfig/Makefile @@ -5,7 +5,7 @@ MENUCONFIG_HAVE_SOURCES?=1 CFLAGS=-g -Wall -DMENUCONFIG_CFG_PATH=\"$(MENUCONFIG_CFG_PATH)\" \ -DMENUCONFIG_GEN_PATH=\"$(MENUCONFIG_GEN_PATH)\" \ -DMENUCONFIG_HAVE_SOURCES=$(MENUCONFIG_HAVE_SOURCES) $(CC_EXTRA_OPTS) -MY_LDFLAGS=-lcurses $(LD_EXTRA_OPTS) +MY_LDFLAGS=-lncurses $(LD_EXTRA_OPTS) EXEC_NAME=configure all: $(MENUCONFIG_FILES) $(CC) -o $(EXEC_NAME) $(CFLAGS) $^ $(MY_LDFLAGS) From e6f4a511cba5f3707ae909b3e31f389e52596a02 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 18 Oct 2013 12:49:36 +0300 Subject: [PATCH 076/159] Fixed accepting "after" changes in lumps attached to the beginning of a del lump Reported by NicK Altmann Solves issues with missing Route hdrs when using the dialog based TH --- msg_translator.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/msg_translator.c b/msg_translator.c index c4cee2d647d..1402ed07e19 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -427,7 +427,7 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, struct socket_info* send_sock) { unsigned int s_offset, new_len; - unsigned int last_del, only_before; + unsigned int last_del; struct lump *t, *r; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; @@ -604,15 +604,11 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, } for(t=lumps;t;t=t->next){ - only_before=0; /* is this lump still valid? (it must not be anchored in a deleted area */ - if (s_offset > t->u.offset) { + if (s_offset > t->u.offset && t->u.offset!=last_del) { LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", t->op,s_offset, t->u.offset,last_del); - if (t->u.offset!=last_del) - continue; - /* process only the before lumps */ - only_before = 1; + continue; } /* if a SKIP lump, go to the last in the list*/ if (t->op==LUMP_SKIP) { @@ -647,8 +643,6 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, } } skip_before: - if (only_before) - continue; switch(t->op){ case LUMP_ADD: new_len+=t->len; @@ -716,7 +710,7 @@ void process_lumps( struct sip_msg* msg, struct lump *t, *r; char* orig; unsigned int size, offset, s_offset; - unsigned int last_del, only_before; + unsigned int last_del; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; str *rcv_port_str=NULL; @@ -956,14 +950,11 @@ void process_lumps( struct sip_msg* msg, last_del=0; for (t=lumps;t;t=t->next){ - only_before = 0; /* skip this lump if the "offset" is still in a "deleted" area */ - if (s_offset > t->u.offset) { + if (s_offset > t->u.offset && last_del!= t->u.offset) { LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", t->op,s_offset, t->u.offset,last_del); - if (last_del!= t->u.offset) - continue; - only_before = 1; + continue; } switch(t->op){ @@ -1009,8 +1000,6 @@ void process_lumps( struct sip_msg* msg, } } skip_before: - if (only_before) - continue; /* copy "main" part */ switch(t->op){ case LUMP_ADD: @@ -1095,8 +1084,6 @@ void process_lumps( struct sip_msg* msg, } } skip_nop_before: - if (only_before) - continue; /* process main (del only) */ if (t->op==LUMP_DEL){ /* skip len bytes from orig msg */ From 784e87f579be4798a7f3f1507304e3af49b26537 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 18 Oct 2013 12:54:45 +0300 Subject: [PATCH 077/159] Fixed locking on purging profiles for terminated dialogs - in strange cases of concurancy between provisional and final replies, the profile ops for provisional reply may end up iterating on a deleted list. Reported by Trevor Francis (46labs) Closes issue #102 --- modules/dialog/dlg_handlers.c | 6 ++++++ modules/dialog/dlg_req_within.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index e30596845b7..42facd34152 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -540,8 +540,10 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) LM_DBG("dialog %p failed (negative reply)\n", dlg); /*destroy linkers */ + dlg_lock_dlg(dlg); destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* dialog setup not completed (3456XX) */ run_dlg_callbacks( DLGCB_FAILED, dlg, rpl, DLG_DIR_UPSTREAM, 0); @@ -1141,8 +1143,10 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) old_state!=DLG_STATE_DELETED) { /*destroy linkers */ + dlg_lock_dlg(dlg); destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); if (!dlg->terminate_reason.s) { if (last_dst_leg == 0) @@ -1443,8 +1447,10 @@ void dlg_ontimeout( struct dlg_tl *tl) ZSW(dlg->legs[callee_idx(dlg)].tag.s)); /*destroy linkers */ + dlg_lock_dlg(dlg); destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* dialog timeout */ run_dlg_callbacks( DLGCB_EXPIRED, dlg, 0, DLG_DIR_NONE, 0); diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index c012a85193c..d33f3b208c9 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -223,8 +223,10 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ dlg->h_entry, dlg->h_id); /*destroy linkers */ + dlg_lock_dlg(dlg); destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* remove from timer */ ret = remove_dlg_timer(&dlg->tl); From 55197a319871de600e8ecdc06f2cb09dff13c37b Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 18 Oct 2013 13:09:01 +0300 Subject: [PATCH 078/159] Fixed bad prototype for abort when compiling with TM_TIMER_DEBUG. Reported by Mayama Takeshi Closes issue #105 --- modules/tm/timer.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/tm/timer.c b/modules/tm/timer.c index 8897a48bdf8..e6c97a469d8 100644 --- a/modules/tm/timer.c +++ b/modules/tm/timer.c @@ -614,15 +614,15 @@ static void check_timer_list(enum lists list_id, char *txt ) struct timer_link *tl1 ; if (list_id<0 || list_id>=NR_OF_TIMER_LISTS) { - LM_CRIT("------- list [%d] bug [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] bug [%s]\n",list_id, txt); + abort(); } tl = timer_list->last_tl.prev_tl; while (tl!=&timer_list->first_tl) { if (tl->prev_tl==0) { - LM_CRIT("------- list [%d] prev_tl==0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] prev_tl==0 [%s]\n",list_id, txt); + abort(); } tl = tl->prev_tl; } @@ -630,8 +630,8 @@ static void check_timer_list(enum lists list_id, char *txt ) tl = timer_list->first_tl.next_tl; while (tl!=&timer_list->last_tl) { if (tl->next_tl==0) { - LM_CRIT("------- list [%d] next_tl==0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] next_tl==0 [%s]\n",list_id, txt); + abort(); } tl = tl->next_tl; } @@ -639,22 +639,22 @@ static void check_timer_list(enum lists list_id, char *txt ) tl = timer_list->first_tl.next_tl; while (tl!=&timer_list->last_tl) { if (tl->ld_tl==0) { - LM_CRIT("------- list [%d] currupted - ld=0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] currupted - ld=0 [%s]\n",list_id, txt); + abort(); } if (tl->ld_tl->ld_tl!=tl) { - LM_CRIT("------- list [%d] currupted - ld cycle broken [%s]\n", + LM_CRIT("TM TIMER list [%d] currupted - ld cycle broken [%s]\n", list_id, txt); - abort(0); + abort(); } if (tl->ld_tl!=tl) { tl1 = tl->next_tl; while(tl1!=tl->ld_tl) { if (tl1->ld_tl) { - LM_CRIT("------- list [%d] currupted - ld!=0 inside " + LM_CRIT("TM TIMER list [%d] currupted - ld!=0 inside " "cycle [%s]\n", list_id, txt); - abort(0); + abort(); } tl1 = tl1->next_tl; } From aa52721666e2e066204886f992bff25fd5d46616 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 22 Oct 2013 12:24:54 +0300 Subject: [PATCH 079/159] README files regenerated from XMLs --- modules/auth/README | 3 +- modules/auth_aaa/README | 3 +- modules/auth_db/README | 3 +- modules/auth_diameter/README | 3 +- modules/avpops/README | 4 +-- modules/b2b_entities/README | 3 +- modules/benchmark/README | 3 +- modules/cachedb_local/README | 3 +- modules/call_control/README | 3 +- modules/cfgutils/README | 3 +- modules/closeddial/README | 2 +- modules/db_flatstore/README | 3 +- modules/db_text/README | 3 +- modules/db_virtual/README | 3 +- modules/diversion/README | 3 +- modules/domain/README | 3 +- modules/domainpolicy/README | 3 +- modules/enum/README | 3 +- modules/exec/README | 3 +- modules/gflags/README | 3 +- modules/group/README | 3 +- modules/imc/README | 3 +- modules/mangler/README | 3 +- modules/maxfwd/README | 3 +- modules/mediaproxy/README | 3 +- modules/mi_fifo/README | 3 +- modules/mi_http/README | 3 +- modules/msilo/README | 3 +- modules/nat_traversal/README | 3 +- modules/options/README | 3 +- modules/path/README | 3 +- modules/peering/README | 3 +- modules/permissions/README | 3 +- modules/pike/README | 3 +- modules/presence_xcapdiff/README | 3 +- .../doc/pua_dialoginfo_admin.xml | 30 +++++++++---------- modules/qos/README | 3 +- modules/ratelimit/README | 3 +- modules/signaling/README | 3 +- modules/sipmsgops/README | 3 +- modules/siptrace/README | 3 +- modules/sl/README | 3 +- modules/sms/README | 3 +- modules/speeddial/README | 3 +- modules/sst/README | 3 +- modules/statistics/README | 3 +- modules/stun/README | 2 +- modules/uac_redirect/README | 3 +- modules/uac_registrant/README | 7 ++--- modules/userblacklist/README | 3 +- modules/usrloc/README | 3 +- 51 files changed, 68 insertions(+), 115 deletions(-) diff --git a/modules/auth/README b/modules/auth/README index 1073c974784..396de910267 100644 --- a/modules/auth/README +++ b/modules/auth/README @@ -24,8 +24,7 @@ Jan Janak Copyright © 2005 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth_aaa/README b/modules/auth_aaa/README index 0e072ccdcc6..f022886d275 100644 --- a/modules/auth_aaa/README +++ b/modules/auth_aaa/README @@ -32,8 +32,7 @@ Irina-Maria Stanescu Copyright © 2005, 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth_db/README b/modules/auth_db/README index fcc1345acca..053e510f118 100644 --- a/modules/auth_db/README +++ b/modules/auth_db/README @@ -23,8 +23,7 @@ Jan Janak Copyright © 2005 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth_diameter/README b/modules/auth_diameter/README index a2545dc021f..8f8c09f4d5e 100644 --- a/modules/auth_diameter/README +++ b/modules/auth_diameter/README @@ -10,8 +10,7 @@ Elena-Ramona Modroiu Copyright © 2003, 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/avpops/README b/modules/avpops/README index eed3c6d5e8b..e50fedc2366 100644 --- a/modules/avpops/README +++ b/modules/avpops/README @@ -12,8 +12,7 @@ Ramona-Elena Modroiu Copyright © 2004-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents @@ -323,6 +322,7 @@ avp_db_load("$fu", "$avp(678)"); avp_db_load("$ru/domain", "i/domain_preferences"); avp_db_load("$avp(uuid)", "$avp(404fwd)/fwd_table"); avp_db_load("$ru", "$avp(123)/$some_scheme"); + # use DB URL id 3 avp_db_load("$ru", "$avp(1)", "3"); diff --git a/modules/b2b_entities/README b/modules/b2b_entities/README index 0fd2ee92c2f..79bac4b643c 100644 --- a/modules/b2b_entities/README +++ b/modules/b2b_entities/README @@ -15,8 +15,7 @@ Ovidiu Sas Copyright © 2009 Anca-Maria Vamanu Revision History - Revision $Revision: 8103 $ $Date: 2011-06-30 18:48:57 +0300 - (Thu, 30 Jun 2011) $ + Revision $Revision: 8103 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/benchmark/README b/modules/benchmark/README index 1b4e47b7041..dcc164728da 100644 --- a/modules/benchmark/README +++ b/modules/benchmark/README @@ -19,8 +19,7 @@ Bastian Friedrich Copyright © 2007 Voice System SRL Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/cachedb_local/README b/modules/cachedb_local/README index baa4d626e6d..4d0a4af12d7 100644 --- a/modules/cachedb_local/README +++ b/modules/cachedb_local/README @@ -15,8 +15,7 @@ Vladut-Stefan Paiu Copyright © 2009 Anca-Maria Vamanu Revision History - Revision $Revision: 5901 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/call_control/README b/modules/call_control/README index be8fcb25245..bfa84d8f6a4 100644 --- a/modules/call_control/README +++ b/modules/call_control/README @@ -18,8 +18,7 @@ Irina-Maria Stanescu Copyright © 2005-2008 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-09-17 15:45:11 +0300 - (Thu, 17 Sep 2009) $ + Revision $Revision: 6149 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/cfgutils/README b/modules/cfgutils/README index 1af1f4d4729..d9a8b132a89 100644 --- a/modules/cfgutils/README +++ b/modules/cfgutils/README @@ -21,8 +21,7 @@ Sergio Gutierrez Copyright © 2007, 2008 1und1 Internet AG, BASIS AudioNet GmbH, Elena-Ramona Modroiu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/closeddial/README b/modules/closeddial/README index 4237049361d..1494d7be97f 100644 --- a/modules/closeddial/README +++ b/modules/closeddial/README @@ -8,7 +8,7 @@ Sergio Gutierrez Copyright © 2009 Revision History - Revision $Revision$ $Date: 2009-02-07 18:00:00 -0500$ + Revision $Revision: 5901 $ $Date: 2009-02-07 18:00:00 -0500$ __________________________________________________________ Table of Contents diff --git a/modules/db_flatstore/README b/modules/db_flatstore/README index 2a3b466d30e..148b8469f16 100644 --- a/modules/db_flatstore/README +++ b/modules/db_flatstore/README @@ -10,8 +10,7 @@ Jan Janak Copyright © 2004, 2005 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/db_text/README b/modules/db_text/README index 0db73e61a93..dfcd59d5ae2 100644 --- a/modules/db_text/README +++ b/modules/db_text/README @@ -18,8 +18,7 @@ Daniel-Constantin Mierla Copyright © 2003, 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-12-15 09:11:44 +0400 - (Sat, 15 Dec 2012) $ + Revision $Revision: 9528 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/db_virtual/README b/modules/db_virtual/README index 06c4d054945..096afbccf93 100644 --- a/modules/db_virtual/README +++ b/modules/db_virtual/README @@ -12,8 +12,7 @@ Razvan Pistolea Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 5917 $ $Date: 2009-07-29 19:12:14 +0300 - (Wed, 29 Jul 2009) $ + Revision $Revision: 5917 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/diversion/README b/modules/diversion/README index c65e1561aaa..d538e272652 100644 --- a/modules/diversion/README +++ b/modules/diversion/README @@ -14,8 +14,7 @@ Saul Ibarra Corretge Copyright © 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-05-30 20:07:17 +0300 - (Wed, 30 May 2012) $ + Revision $Revision: 9064 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/domain/README b/modules/domain/README index d350ec32d54..ab3fb0c51b1 100644 --- a/modules/domain/README +++ b/modules/domain/README @@ -12,8 +12,7 @@ Juha Heinanen Copyright © 2002-2008 Juha Heinanen Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/domainpolicy/README b/modules/domainpolicy/README index e36672e37fc..47663b12d9d 100644 --- a/modules/domainpolicy/README +++ b/modules/domainpolicy/README @@ -23,8 +23,7 @@ Klaus Darilion Copyright © 2002, 2003, 2006 Juha Heinanen, Otmar Lendl, Klaus Darilion Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/enum/README b/modules/enum/README index e983440f3bb..363e22896de 100644 --- a/modules/enum/README +++ b/modules/enum/README @@ -10,8 +10,7 @@ Otmar Lendl Copyright © 2002, 2003 Juha Heinanen Revision History - Revision $Revision$ $Date: 2010-01-18 10:45:05 +0100 - (Mon, 18 Jan 2010) $ + Revision $Revision: 5907 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/exec/README b/modules/exec/README index 63f92263d12..aca107dcc99 100644 --- a/modules/exec/README +++ b/modules/exec/README @@ -10,8 +10,7 @@ Jan Janak Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/gflags/README b/modules/gflags/README index 224a90f997b..8682aae532f 100644 --- a/modules/gflags/README +++ b/modules/gflags/README @@ -16,8 +16,7 @@ Daniel-Constantin Mierla Copyright © 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/group/README b/modules/group/README index 19eb50d1629..c343c9bfb39 100644 --- a/modules/group/README +++ b/modules/group/README @@ -20,8 +20,7 @@ Irina-Maria Stanescu Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2009-08-17 19:03:14 +0300 - (Mon, 17 Aug 2009) $ + Revision $Revision: 5969 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/imc/README b/modules/imc/README index 3e1fd5eec45..fc0a9d62aca 100644 --- a/modules/imc/README +++ b/modules/imc/README @@ -12,8 +12,7 @@ Anca-Maria Vamanu Copyright © 2006-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mangler/README b/modules/mangler/README index b8150245c2f..7ae57bee799 100644 --- a/modules/mangler/README +++ b/modules/mangler/README @@ -10,8 +10,7 @@ Gabriel Vasile Copyright © 2003 Fill in here Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/maxfwd/README b/modules/maxfwd/README index 283f459f7df..314f8806fe2 100644 --- a/modules/maxfwd/README +++ b/modules/maxfwd/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mediaproxy/README b/modules/mediaproxy/README index 4b4e77eb2c3..418510e10b0 100644 --- a/modules/mediaproxy/README +++ b/modules/mediaproxy/README @@ -12,8 +12,7 @@ Dan Pascu Copyright © 2004 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mi_fifo/README b/modules/mi_fifo/README index 0e653d5d6aa..b517fcbd385 100644 --- a/modules/mi_fifo/README +++ b/modules/mi_fifo/README @@ -10,8 +10,7 @@ Bogdan-Andrei Iancu Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mi_http/README b/modules/mi_http/README index 51e265ffeb7..a426705b5bf 100644 --- a/modules/mi_http/README +++ b/modules/mi_http/README @@ -10,8 +10,7 @@ Ovidiu Sas Copyright © 2011-2013 VoIP Embedded, Inc. Revision History - Revision $Rev: 8688 $ $Date: 2013-01-29 07:35:11 -0500 (Tue, 29 - Jan 2013) $ + Revision $Rev: 8688 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/msilo/README b/modules/msilo/README index 783d99f1968..b9832878c38 100644 --- a/modules/msilo/README +++ b/modules/msilo/README @@ -12,8 +12,7 @@ Daniel-Constantin Mierla Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/nat_traversal/README b/modules/nat_traversal/README index e1c0c22d055..94a12a42f45 100644 --- a/modules/nat_traversal/README +++ b/modules/nat_traversal/README @@ -12,8 +12,7 @@ Dan Pascu Copyright © 2008 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/options/README b/modules/options/README index 81e89565dd1..e7d84bf283d 100644 --- a/modules/options/README +++ b/modules/options/README @@ -10,8 +10,7 @@ Nils Ohlmeier Copyright © 2003 FhG Fokus Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/path/README b/modules/path/README index 5f38e2823d6..d93df5f175f 100644 --- a/modules/path/README +++ b/modules/path/README @@ -10,8 +10,7 @@ Andreas Granig Copyright © 2006 Inode GmbH Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/peering/README b/modules/peering/README index c27d5e0468c..33bf790ba6e 100644 --- a/modules/peering/README +++ b/modules/peering/README @@ -18,8 +18,7 @@ Irina-Maria Stanescu Copyright © 2008 Juha Heinanen Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5952 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/permissions/README b/modules/permissions/README index fb89eebe3da..01c797a783d 100644 --- a/modules/permissions/README +++ b/modules/permissions/README @@ -24,8 +24,7 @@ Irina-Maria Stanescu Copyright © 2009 Irina-Maria Stanescu Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/pike/README b/modules/pike/README index 9ee529d987d..2e7cffca6f7 100644 --- a/modules/pike/README +++ b/modules/pike/README @@ -10,8 +10,7 @@ Bogdan-Andrei Iancu Copyright © 2005-2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/presence_xcapdiff/README b/modules/presence_xcapdiff/README index 52e5d23e4cb..62fc67da7a3 100644 --- a/modules/presence_xcapdiff/README +++ b/modules/presence_xcapdiff/README @@ -12,8 +12,7 @@ Denis Bilenko Copyright © 2008 AG Projects Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 (Tue, 21 - Jul 2009) $ + Revision $Revision$ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml index 4715a198ee5..cfaeafafc0b 100644 --- a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml +++ b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml @@ -73,10 +73,10 @@ - The dialog element can contain optional "local" and "remote" elements which - describes the local and the remote party in more detail, for example: + The dialog element can contain optional "local" and "remote" elements which + describes the local and the remote party in more detail, for example: - + - The local and remote elements are needed to implement call pickup. For example if + The local and remote elements are needed to implement call pickup. For example if the above XML document is received by somebody who SUBSCRIBEd the dialog-info of Alice, then it can pick-up the call by sending an INVITE to Bob (actually I am not sure if it should use the URI in the identity element or the URI in the target @@ -298,11 +298,11 @@ modparam("pua_dialoginfo", "caller_confirmed", 1) Usually the dialog-info of the caller will be "trying -> early -> confirmed". "trying" will be triggered as soon - as you call dialoginfo_set on the caller, while "early" is triggered - as soon as the callee is ringing. - Sometimes, it is advisable to be notified only when the callee reaches - the early state and not before. In other cases, it is advisable to - notify the early state. This setting allows controlling the behavior. + as you call dialoginfo_set on the caller, while "early" is triggered + as soon as the callee is ringing. + Sometimes, it is advisable to be notified only when the callee reaches + the early state and not before. In other cases, it is advisable to + notify the early state. This setting allows controlling the behavior. Default value is 0. @@ -321,12 +321,12 @@ modparam("pua_dialoginfo", "publish_on_trying", 1) <varname>nopublish_flag</varname> (int) By default, reINVITEs will trigger a PUBLISH. They are actually - the only in-dialog request for which it makes sense. - In some cases, it does not make sense to republish a dialog state. - (e.g. when handling a B2BUA reINVITE). - This setting defines the flag that needs to be set in the request - route to prevent the generation of a PUBLISH request in case of a - specific reINVITE. + the only in-dialog request for which it makes sense. + In some cases, it does not make sense to republish a dialog state. + (e.g. when handling a B2BUA reINVITE). + This setting defines the flag that needs to be set in the request + route to prevent the generation of a PUBLISH request in case of a + specific reINVITE. Set <varname>nopublish_flag</varname> parameter diff --git a/modules/qos/README b/modules/qos/README index 19a2c656f0c..1e7a2583c6f 100644 --- a/modules/qos/README +++ b/modules/qos/README @@ -10,8 +10,7 @@ Ovidiu Sas Copyright © 2008 SOMA Networks, Inc. Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/ratelimit/README b/modules/ratelimit/README index cf1f19c3bc1..ad7e03f1c44 100644 --- a/modules/ratelimit/README +++ b/modules/ratelimit/README @@ -30,8 +30,7 @@ Razvan Crainea Copyright © 2011 OpenSIPS Foundation Revision History - Revision $Revision: 5901 $ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/signaling/README b/modules/signaling/README index ac9f562651b..5ea5c72d355 100644 --- a/modules/signaling/README +++ b/modules/signaling/README @@ -8,8 +8,7 @@ Anca-Maria Vamanu Copyright © 2008 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sipmsgops/README b/modules/sipmsgops/README index a21e3956328..c86d420fa24 100644 --- a/modules/sipmsgops/README +++ b/modules/sipmsgops/README @@ -31,8 +31,7 @@ Razvan Crainea Copyright © 2003 FhG FOKUS Revision History - Revision $Revision: 7480 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 7480 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/siptrace/README b/modules/siptrace/README index c41139d64a9..803417ce7af 100644 --- a/modules/siptrace/README +++ b/modules/siptrace/README @@ -12,8 +12,7 @@ Daniel-Constantin Mierla Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sl/README b/modules/sl/README index 77ce4a950fb..40e9957e966 100644 --- a/modules/sl/README +++ b/modules/sl/README @@ -8,8 +8,7 @@ Bogdan Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sms/README b/modules/sms/README index 296e143205e..9e4c166aee7 100644 --- a/modules/sms/README +++ b/modules/sms/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/speeddial/README b/modules/speeddial/README index 8fe4f801e7b..6779d630780 100644 --- a/modules/speeddial/README +++ b/modules/speeddial/README @@ -12,8 +12,7 @@ Elena-Ramona Modroiu Copyright © 2004 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sst/README b/modules/sst/README index 54fde80847d..1cacf8d67cb 100644 --- a/modules/sst/README +++ b/modules/sst/README @@ -10,8 +10,7 @@ Ron Winacott Copyright © 2006 SOMA Networks, Inc. Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/statistics/README b/modules/statistics/README index 8561dc3e722..a2c00b221ad 100644 --- a/modules/statistics/README +++ b/modules/statistics/README @@ -8,8 +8,7 @@ Bogdan Iancu Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/stun/README b/modules/stun/README index 24d21fc4a90..290d95bf03e 100644 --- a/modules/stun/README +++ b/modules/stun/README @@ -12,7 +12,7 @@ Razvan Pistolea Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision:$ $Date:$ + Revision $Revision:$ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/uac_redirect/README b/modules/uac_redirect/README index e5382df381e..fc155b969a6 100644 --- a/modules/uac_redirect/README +++ b/modules/uac_redirect/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2005 Voice Sistem Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/uac_registrant/README b/modules/uac_registrant/README index 3d8df346e86..19662c06c1d 100644 --- a/modules/uac_registrant/README +++ b/modules/uac_registrant/README @@ -12,8 +12,7 @@ Ovidiu Sas Copyright © 2011-2013 VoIP Embedded, Inc. Revision History - Revision $Revision$ $Date: 2013-01-29 07:35:11 -0500 (Tue, 29 - Jan 2013) $ + Revision $Revision$ $Date$ __________________________________________________________ Table of Contents @@ -152,8 +151,8 @@ modparam("uac_registrant", "timer_interval", 120) Example 1.3. Set “db_url” parameter ... -modparam("uac_registrant", "db_url", "mysql://user:passw@localhost/data -base") +modparam("uac_registrant", "db_url", "mysql://user:passw@localhost/datab +ase") ... 1.3.4. table_name (string) diff --git a/modules/userblacklist/README b/modules/userblacklist/README index da7c946b166..05ea48199bb 100644 --- a/modules/userblacklist/README +++ b/modules/userblacklist/README @@ -13,8 +13,7 @@ Henning Westerholt Copyright © 2008 1&1 Internet AG Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/usrloc/README b/modules/usrloc/README index be4a84376da..0c083de28aa 100644 --- a/modules/usrloc/README +++ b/modules/usrloc/README @@ -16,8 +16,7 @@ Bogdan-Andrei Iancu Copyright © 2005-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents From 6b259e6a79aab6c41430c789c9544a90bf5624cc Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 22 Oct 2013 16:32:44 +0300 Subject: [PATCH 080/159] Removed "auto" flag for the dlg_id in DB_TEXT spec file Reported by Jeff Pyle. --- db/schema/dialog.xml | 2 +- scripts/dbtext/opensips/dialog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/schema/dialog.xml b/db/schema/dialog.xml index 5aa611f72f2..45b9a79a0cc 100644 --- a/db/schema/dialog.xml +++ b/db/schema/dialog.xml @@ -22,7 +22,7 @@ unsigned long &table_id_len; - long,auto + long h_entry | h_id diff --git a/scripts/dbtext/opensips/dialog b/scripts/dbtext/opensips/dialog index 6ec42e9ed35..569f9d4f34c 100644 --- a/scripts/dbtext/opensips/dialog +++ b/scripts/dbtext/opensips/dialog @@ -1 +1 @@ -dlg_id(long,auto) callid(string) from_uri(string) from_tag(string) to_uri(string) to_tag(string) mangled_from_uri(string,null) mangled_to_uri(string,null) caller_cseq(string) callee_cseq(string) caller_ping_cseq(int) callee_ping_cseq(int) caller_route_set(string,null) callee_route_set(string,null) caller_contact(string) callee_contact(string) caller_sock(string) callee_sock(string) state(int) start_time(int) timeout(int) vars(string,null) profiles(string,null) script_flags(int) flags(int) +dlg_id(long) callid(string) from_uri(string) from_tag(string) to_uri(string) to_tag(string) mangled_from_uri(string,null) mangled_to_uri(string,null) caller_cseq(string) callee_cseq(string) caller_ping_cseq(int) callee_ping_cseq(int) caller_route_set(string,null) callee_route_set(string,null) caller_contact(string) callee_contact(string) caller_sock(string) callee_sock(string) state(int) start_time(int) timeout(int) vars(string,null) profiles(string,null) script_flags(int) flags(int) From 34d4155bb749458cbb4fc97269839e428bdf23df Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 23 Oct 2013 18:22:15 +0300 Subject: [PATCH 081/159] Proper support for BIGINT (as long) in the db_text SQL driver. Many thanks to Jeff Pyle for reporting and troubleshooting this. --- modules/db_text/dbt_file.c | 18 ++++++++++-------- modules/dialog/dlg_db_handler.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/db_text/dbt_file.c b/modules/db_text/dbt_file.c index 0c571f470c2..86c0743d7b9 100644 --- a/modules/db_text/dbt_file.c +++ b/modules/db_text/dbt_file.c @@ -318,8 +318,8 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) case DB_INT: case DB_BIGINT: case DB_DATETIME: - //LM_DBG("INT value!\n"); - dtval.val.int_val = 0; + //LM_DBG("INT/BIGINT/DATETIME value!\n"); + dtval.val.bigint_val = 0; dtval.type = dtp->colv[ccol]->type; if(c==DBT_DELIM || @@ -339,12 +339,12 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) goto clean; while(c>='0' && c<='9') { - dtval.val.int_val=dtval.val.int_val*10+c-'0'; + dtval.val.bigint_val=dtval.val.bigint_val*10+c-'0'; c = fgetc(fin); } - dtval.val.int_val *= sign; + dtval.val.bigint_val *= sign; //LM_DBG("data[%d,%d]=%d\n", crow, - // ccol, dtval.val.int_val); + // ccol, dtval.val.bigint_val); } if(c!=DBT_DELIM && c!=DBT_DELIM_R && c!=EOF) goto clean; @@ -352,8 +352,10 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) ccol)) goto clean; if(ccol == dtp->auto_col) - max_auto = (max_autoname.len, colp->name.s); break; case DB_BIGINT: - fprintf(fout, "%.*s(bigint", colp->name.len, colp->name.s); + fprintf(fout, "%.*s(long", colp->name.len, colp->name.s); break; case DB_DOUBLE: fprintf(fout, "%.*s(double", colp->name.len, colp->name.s); diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index c27f30fffbd..5207bebf6b3 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -568,7 +568,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) LM_ERR("inconsistent hash data in the dialog database: " "you may have restarted opensips using a different " "hash_size: please erase %.*s database and restart\n" - "db : %u, dlg : %u\n", + "dlg : %u, db : %u\n", dialog_table_name.len, dialog_table_name.s, dlg->h_entry,hash_entry); shm_free(dlg); From 76bcd17800fea3a0e6cfb6ef780712ef1f7cb959 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 23 Oct 2013 18:35:24 +0300 Subject: [PATCH 082/159] Fixed the weight-based balancing alg. Credits go to Rob Gagnon (rgagnon24) --- modules/drouting/drouting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c index 612b8a70267..81fe80e3bf4 100644 --- a/modules/drouting/drouting.c +++ b/modules/drouting/drouting.c @@ -1168,7 +1168,7 @@ static int sort_rt_dst(pgw_list_t *pgwl, unsigned short size, LM_DBG("random number is %d\n",rand_no); /* select the element */ for( i=first ; i=rand_no) break; + if (running_sum[i]>rand_no) break; if (i==size) { LM_CRIT("bug in weight sort\n"); return -1; From 5eeab0fc579086351fb68b50ed13e82e3322dc43 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Wed, 23 Oct 2013 08:53:27 -0700 Subject: [PATCH 083/159] Merge pull request #109 from rrb3942/shutdown_segfault Reset prepared statement between query lists on shutdown --- db/db_insertq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/db_insertq.c b/db/db_insertq.c index 16ecc262953..a36b85561ae 100644 --- a/db/db_insertq.c +++ b/db/db_insertq.c @@ -125,6 +125,10 @@ void flush_query_list(void) } it->dbf.use_table(it->conn,&it->table); + + //Reset prepared statement between query lists/connections + my_ps = NULL; + CON_PS_REFERENCE(it->conn) = &my_ps; /* and let's insert the rows */ From 82380caaf13ead075c589b035422bda8fa9beca0 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 29 Oct 2013 20:23:23 +0200 Subject: [PATCH 084/159] Re-install dlg callbacks (for restoring FROM/TO hdr) upon re-loading dialogs on startup. Reported by Jeff Pyle. --- modules/uac/replace.c | 29 +++++++++++++++++++++++++++++ modules/uac/replace.h | 1 + modules/uac/uac.c | 6 ++++++ 3 files changed, 36 insertions(+) diff --git a/modules/uac/replace.c b/modules/uac/replace.c index 07c82d6f03f..7df8d92963e 100644 --- a/modules/uac/replace.c +++ b/modules/uac/replace.c @@ -579,6 +579,35 @@ int restore_uri( struct sip_msg *msg, int to, int check_from) /************************** Dialog functions ******************************/ +void dlg_restore_callback(struct dlg_cell* dlg, int type, struct dlg_cb_params * params) +{ + str val; + + /* check if the UAC corresponding values are present */ + + if ( dlg_api.fetch_dlg_value( dlg, &rr_to_param_new, &val, 0)==0 ) { + /* TO variable found -> TO URI changed */ + LM_DBG("UAC TO related DLG vals found -> installing callback\n"); + if ( dlg_api.register_dlgcb(dlg, DLGCB_REQ_WITHIN|DLGCB_TERMINATED, + replace_callback, (void*)1/*to*/, 0) != 0) { + LM_ERR("cannot register callback\n"); + } + } + + if ( dlg_api.fetch_dlg_value( dlg, &rr_from_param_new, &val, 0)==0 ) { + /* FROM variable found -> FROM URI changed */ + LM_DBG("UAC FROM related DLG vals found -> installing callback\n"); + if ( dlg_api.register_dlgcb(dlg, DLGCB_REQ_WITHIN|DLGCB_TERMINATED, + replace_callback, (void*)0/*from*/, 0) != 0) { + LM_ERR("cannot register callback\n"); + } + } + + return; +} + + + static void replace_callback(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) { diff --git a/modules/uac/replace.h b/modules/uac/replace.h index 12cc69433b8..37c2f36243e 100644 --- a/modules/uac/replace.h +++ b/modules/uac/replace.h @@ -48,5 +48,6 @@ int restore_uri( struct sip_msg *msg, int to, int check_from); /* RR callback functions */ void rr_checker(struct sip_msg *msg, str *r_param, void *cb_param); +void dlg_restore_callback(struct dlg_cell* dlg, int type, struct dlg_cb_params * params); #endif diff --git a/modules/uac/uac.c b/modules/uac/uac.c index 1fe7282c97b..66021786040 100644 --- a/modules/uac/uac.c +++ b/modules/uac/uac.c @@ -241,6 +241,12 @@ static int mod_init(void) LM_ERR("cannot set correct store parameters\n"); goto error; } + /* install calback to catch all loaded dialogs */ + if ( dlg_api.register_dlgcb( NULL, DLGCB_LOADED, + dlg_restore_callback, NULL, NULL) != 0 ) { + LM_ERR("failed to install dialog restore callback\n"); + goto error; + } } /* get all requests doing loose route */ From f79254327865e1b28efe084217ef8684f9b22c65 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 29 Oct 2013 20:42:06 +0200 Subject: [PATCH 085/159] Use proper locking function (via the generic locking API) Reported by Max E. Reyes Vera Juarez. --- modules/load_balancer/lb_data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/load_balancer/lb_data.c b/modules/load_balancer/lb_data.c index eb400e55b17..147703570da 100644 --- a/modules/load_balancer/lb_data.c +++ b/modules/load_balancer/lb_data.c @@ -509,7 +509,7 @@ int do_load_balance(struct sip_msg *req, int grp, struct lb_res_str_list *rl, /* lock the resources */ for( i=0 ; in ; i++) - get_lock( call_res[i]->lock ); + lock_get( call_res[i]->lock ); /* do the load-balancing */ load = 0; @@ -557,7 +557,7 @@ int do_load_balance(struct sip_msg *req, int grp, struct lb_res_str_list *rl, /* unlock the resources*/ for( i=0 ; in ; i++) - release_lock( call_res[i]->lock ); + lock_release( call_res[i]->lock ); if (dst) { LM_DBG("winning destination <%.*s> selected for LB set with free=%d\n", @@ -736,7 +736,7 @@ int lb_count_call(struct lb_data *data, struct sip_msg *req, /* lock the resources */ for( i=0 ; in ; i++) - get_lock( call_res[i]->lock ); + lock_get( call_res[i]->lock ); /* add to the profiles */ for( i=0 ; in ; i++) { @@ -747,7 +747,7 @@ int lb_count_call(struct lb_data *data, struct sip_msg *req, /* unlock the resources*/ for( i=0 ; in ; i++) - release_lock( call_res[i]->lock ); + lock_release( call_res[i]->lock ); return 0; } From f1db3ddb66a0b5195e5b5e36f6dadd667d485036 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Tue, 29 Oct 2013 19:04:58 -0400 Subject: [PATCH 086/159] core: enhance error log for un-parsable msg by adding the source IP and port (cherry picked from commit 57e60928db2ba2a406026565e4569155fb811b6b) --- receive.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/receive.c b/receive.c index e78713c4a6f..bc1e53b81a9 100644 --- a/receive.c +++ b/receive.c @@ -88,6 +88,7 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info) { struct sip_msg* msg; struct timeval start; + char *tmp; msg=pkg_malloc(sizeof(struct sip_msg)); if (msg==0) { @@ -108,7 +109,8 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info) msg->set_global_port=default_global_port; if (parse_msg(buf,len, msg)!=0){ - LM_ERR("parse_msg failed\n"); + tmp=ip_addr2a(&(rcv_info->src_ip)); + LM_ERR("Unable to parse msg received from [%s:%d]\n", tmp, rcv_info->src_port); /* if a REQUEST msg was detected (first line was succesfully parsed) we should trigger the error route */ if ( msg->first_line.type==SIP_REQUEST && error_rlist.a!=NULL ) From 50463f044c5bd42eb5485cac52419a8ec45ee201 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Fri, 1 Nov 2013 13:48:46 +0200 Subject: [PATCH 087/159] Also trace the CANCEL requests in case we're doing trace_dialog() --- modules/siptrace/siptrace.c | 56 ++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c index b1274f640a3..22d16dc5c46 100644 --- a/modules/siptrace/siptrace.c +++ b/modules/siptrace/siptrace.c @@ -44,6 +44,7 @@ #include "../dialog/dlg_load.h" #include "../sl/sl_cb.h" #include "../../str.h" +#include "../../script_cb.h" #include "../sipcapture/sipcapture.h" @@ -100,6 +101,10 @@ static struct mi_root* trace_to_database_mi(struct mi_root* cmd, void* param ); static int trace_send_hep_duplicate(str *body, str *fromip, str *toip); static int pipport2su (str *pipport, union sockaddr_union *tmp_su, unsigned int *proto); +static int do_dlg_siptrace = 0; +static void siptrace_dlg_created(struct dlg_cell *did, int type,struct dlg_cb_params * params); +static int siptrace_cleanup( struct sip_msg *msg, void *param ); +static void siptrace_dlg_cancel(struct cell* t, int type, struct tmcb_params *param); static str db_url = {NULL, 0}; static str siptrace_table = str_init("sip_trace"); @@ -241,6 +246,16 @@ static int fixup_trace_dialog(void** param, int param_no) return -1; } + if (dlgb.register_dlgcb(NULL, DLGCB_CREATED, siptrace_dlg_created, NULL, NULL) < 0) { + LM_ERR("Failed to register dialog created callback \n"); + return -1; + } + + if (register_script_cb( siptrace_cleanup, POST_SCRIPT_CB|REQ_TYPE_CB,0)<0) { + LM_ERR("Failed to register postcript cleanup cb\n"); + return -1; + } + return 0; } @@ -605,7 +620,7 @@ static str* generate_val_name(unsigned char n) static void trace_transaction(struct dlg_cell* dlg, int type, - struct dlg_cb_params * params) + struct dlg_cb_params * params) { unsigned char n; static int_str avp_value; @@ -716,9 +731,48 @@ static int trace_dialog(struct sip_msg *msg) /* trace current request */ sip_trace(msg); + do_dlg_siptrace=1; return 1; } +static int siptrace_cleanup( struct sip_msg *msg, void *param ) +{ + do_dlg_siptrace=0; + return 0; +} + +static void siptrace_dlg_created(struct dlg_cell *did, int type, + struct dlg_cb_params * params) +{ + struct sip_msg *req; + struct cell *t; + + if (do_dlg_siptrace == 1) { + req = params->msg; + t = tmb.t_gett(); + + // we also want to catch the incoming cancel + if ( tmb.register_tmcb( req, t,TMCB_TRANS_CANCELLED, + siptrace_dlg_cancel, NULL, NULL)<0 ) { + LM_ERR("failed to register trans cancelled TMCB\n"); + return; + } + } +} + +static void siptrace_dlg_cancel(struct cell* t, int type, struct tmcb_params *param) +{ + struct sip_msg *req; + req = param->req; + + LM_DBG("Tracing incoming cancel due to trace_dialog() \n"); + + /* set the flag */ + req->flags |= trace_flag; + req->msg_flags |= FL_USE_SIPTRACE; + /* trace current request */ + sip_trace(req); +} static inline int siptrace_copy_proto(int proto, char *buf) { From 86cbfeef1678d059091730d7ae192b6fbb73fe87 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 4 Nov 2013 13:58:46 +0200 Subject: [PATCH 088/159] Do proper return code to script from cachedb_* functions ( treat 0 as success ) (cherry picked from commit 5635d716e0bf1ce8a23688698fe6497fadfe7f23) --- cachedb/cachedb.c | 49 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/cachedb/cachedb.c b/cachedb/cachedb.c index 691df468877..c07a3e3cc8f 100644 --- a/cachedb/cachedb.c +++ b/cachedb/cachedb.c @@ -299,6 +299,7 @@ int cachedb_remove(str* cachedb_name, str* attr) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -338,7 +339,11 @@ int cachedb_remove(str* cachedb_name, str* attr) return -1; } - return cde->cdb_func.remove(con,attr)<0?-1:1; + ret = cde->cdb_func.remove(con,attr); + if (ret == 0) + ret++; + + return ret; } int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) @@ -347,6 +352,7 @@ int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -386,7 +392,11 @@ int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) return -1; } - return cde->cdb_func.set(con,attr,val,expires)<0?-1:1; + ret = cde->cdb_func.set(con,attr,val,expires); + if (ret ==0) + ret++; + + return ret; } int cachedb_fetch(str* cachedb_name, str* attr, str* val) @@ -395,6 +405,7 @@ int cachedb_fetch(str* cachedb_name, str* attr, str* val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -434,7 +445,11 @@ int cachedb_fetch(str* cachedb_name, str* attr, str* val) return -1; } - return cde->cdb_func.get(con,attr,val)<0?-1:1; + ret = cde->cdb_func.get(con,attr,val); + if (ret == 0) + ret++; + + return ret; } int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) @@ -443,6 +458,7 @@ int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -482,7 +498,11 @@ int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) return -1; } - return cde->cdb_func.get_counter(con,attr,val)<0?-1:1; + ret = cde->cdb_func.get_counter(con,attr,val); + if (ret == 0) + ret++; + + return ret; } int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) @@ -491,6 +511,7 @@ int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -536,7 +557,11 @@ int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) return -1; } - return cde->cdb_func.add(con,attr,val,expires,new_val)<0?-1:1; + ret = cde->cdb_func.add(con,attr,val,expires,new_val); + if (ret == 0) + ret++; + + return ret; } int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) @@ -545,6 +570,7 @@ int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -590,7 +616,11 @@ int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) return -1; } - return cde->cdb_func.sub(con,attr,val,expires,new_val)<0?-1:1; + ret = cde->cdb_func.sub(con,attr,val,expires,new_val); + if (ret == 0) + ret++; + + return ret; } cachedb_con* cachedb_do_init(str *url,void* (*new_connection)(struct cachedb_id *)) @@ -672,6 +702,7 @@ int cachedb_raw_query(str* cachedb_name, str* attr, cdb_raw_entry*** reply,int e str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -716,7 +747,11 @@ int cachedb_raw_query(str* cachedb_name, str* attr, cdb_raw_entry*** reply,int e return -1; } - return cde->cdb_func.raw_query(con,attr,reply,expected_kv_no,rpl_no)<0?-1:1; + ret = cde->cdb_func.raw_query(con,attr,reply,expected_kv_no,rpl_no); + if (ret == 0) + ret++; + + return ret; } void free_raw_fetch(cdb_raw_entry **reply,int no_key,int no_val) From dde0516227e32e4b939b905b75856fd80b4e7320 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 4 Nov 2013 17:06:05 +0200 Subject: [PATCH 089/159] Allow drouting module to be used for DID matching only ( where you only have prefixes provisioned, no GWs, and call do_routing with the 'C' flag ) (cherry picked from commit 92a2c9d6061462b2c818da0963e805cbfaa62904) --- modules/drouting/drouting.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c index 81fe80e3bf4..4e6f00cb3fd 100644 --- a/modules/drouting/drouting.c +++ b/modules/drouting/drouting.c @@ -1326,7 +1326,8 @@ static int do_routing(struct sip_msg* msg, dr_group_t *drg, int flags, wl_list = NULL; rt_info = NULL; - if ( (*rdata)==0 || (*rdata)->pgw_l==0 ) { + /* allow no GWs if we're only trying to use DR for checking purposes */ + if ( (*rdata)==0 || ((flags & DR_PARAM_ONLY_CHECK) == 0 && (*rdata)->pgw_l==0 )) { LM_DBG("empty routing table\n"); goto error1; } From dcb87bca624cf6aadefc0539d2d83c60a87eac77 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Mon, 4 Nov 2013 20:07:01 +0200 Subject: [PATCH 090/159] Proper usage of build_req_buf_from_sip_req() function - socket and proto are required. Closes Bug 664 on SF. --- modules/b2b_entities/dlg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 7fafb08c4ee..67ae93de186 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -2793,10 +2793,10 @@ int b2b_apply_lumps(struct sip_msg* msg) if (msg->first_line.type==SIP_REQUEST) obuf.s = build_req_buf_from_sip_req(msg, (unsigned int*)&obuf.len, - NULL, 0, MSG_TRANS_NOVIA_FLAG ); + msg->rcv.bind_address, msg->rcv.proto, MSG_TRANS_NOVIA_FLAG ); else obuf.s = build_res_buf_from_sip_res(msg, (unsigned int*)&obuf.len, - NULL); + msg->rcv.bind_address); if (!obuf.s) { LM_ERR("no more shm mem\n"); From b4cf13ade32ffa28fe17b9fdd67942c0b91a77aa Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 6 Nov 2013 12:36:21 +0100 Subject: [PATCH 091/159] rework ratelimit distributed queries instead of adding -1 to the counter, use the cachedb_sub function exported by the cachedb module. This prevents ratelimit counters from adding extremely large values for some backends (ex: memcached). Thanks go to Brett Nemeroff for reporting and testing. (cherry picked from commit c06183325e408f47ba4e0a1e1be274fe23581e25) --- modules/ratelimit/ratelimit_helper.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/ratelimit/ratelimit_helper.c b/modules/ratelimit/ratelimit_helper.c index 091f1c21089..6a69e654368 100644 --- a/modules/ratelimit/ratelimit_helper.c +++ b/modules/ratelimit/ratelimit_helper.c @@ -105,17 +105,31 @@ static inline int rl_set_name(str * name) static int rl_change_counter(str *name, rl_pipe_t *pipe, int c) { int new_counter; + int ret; if (rl_set_name(name) < 0) return -1; - if (pipe->my_counter + c <= 0) { + if (pipe->my_counter + c < 0) { LM_DBG("Counter going negative\n"); return 1; } - if (cdbf.add(cdbc, &rl_name_buffer, c ? c : -(pipe->my_counter), - rl_expire_time, &new_counter) < 0){ + if (c) { + if (c < 0) + ret = cdbf.sub(cdbc, &rl_name_buffer, -c, rl_expire_time, &new_counter); + else + ret = cdbf.add(cdbc, &rl_name_buffer, c, rl_expire_time, &new_counter); + } else { + if (pipe->my_counter) { + ret = cdbf.sub(cdbc, &rl_name_buffer, pipe->my_counter, rl_expire_time, + &new_counter); + } else { + ret = cdbf.get_counter(cdbc, &rl_name_buffer, &new_counter); + } + } + + if (ret < 0) { LM_ERR("cannot change counter for pipe %.*s with %d\n", name->len, name->s, c); return -1; From a53265087efd4c02433ab79147b41be02770994d Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Sun, 17 Nov 2013 01:35:03 +0200 Subject: [PATCH 092/159] Mask compile-time shift/reduce conflict due to if statement ambiguity (cherry picked from commit c4b8be1cb86ba6d169ae97b221d4986f8ecad9a4) --- cfg.y | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cfg.y b/cfg.y index 856ed4c2351..c4950885922 100644 --- a/cfg.y +++ b/cfg.y @@ -482,6 +482,11 @@ extern int line; %type route_name %type route_param +/* + * since "if_cmd" is inherently ambiguous, + * skip 1 harmless shift/reduce conflict when compiling our grammar + */ +%expect 1 %% From e8661d12feb90263d57e101ed8761ec8eaadf414 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Thu, 7 Nov 2013 20:10:47 +0000 Subject: [PATCH 093/159] Fixed restoring SOCKET info from AVP during failover (cherry picked from commit cc657ffc81e13e66dfba9ffba3e5e9f380e22c1d) --- modules/dispatcher/dispatch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c index f5869199233..e0621208b49 100644 --- a/modules/dispatcher/dispatch.c +++ b/modules/dispatcher/dispatch.c @@ -1425,12 +1425,13 @@ int ds_next_dst(struct sip_msg *msg, int mode) /* get AVP with next destination socket */ tmp_avp = search_first_avp(sock_avp_type, sock_avp_name, &sock_avp_value, 0); - if (tmp_avp) { + if (!tmp_avp) { /* this shuold not happen, it is a bogus state */ sock = NULL; } else { if (sscanf( sock_avp_value.s.s, "%p", (void**)&sock ) != 1) sock = NULL; + destroy_avp(tmp_avp); } if(ds_update_dst(msg, &avp_value.s, sock, mode)!=0) From f931f0d3274bcd9383d7fe5bc29ba85a668ac5cc Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 20 Nov 2013 14:43:40 +0200 Subject: [PATCH 094/159] Reset the lump cond flags when the condition evaluates to false. In case there are multiple branches, the conditions can evaluate differently on each branch - which might lead to bad counting of the added lumps ( used by the dialog module for dlg validation ) (cherry picked from commit 24f9366858d0568a2eaa231f37d349efd2d70d96) --- msg_translator.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/msg_translator.c b/msg_translator.c index 1402ed07e19..8f51c13947e 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -389,28 +389,42 @@ static inline int lump_check_opt( struct lump *l, get_ip_port_proto; /* faster tests first */ if ((port==snd_s->port_no)&&(proto==snd_s->proto)&& - (ip_addr_cmp(ip, &snd_s->address))) + (ip_addr_cmp(ip, &snd_s->address))) { + l->flags &= ~LUMPFLAG_COND_TRUE; return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_AF: get_ip_port_proto; - if (ip->af==snd_s->address.af) return 0; + if (ip->af==snd_s->address.af) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_PROTO: get_ip_port_proto; - if (proto==snd_s->proto) return 0; + if (proto==snd_s->proto) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_PORT: get_ip_port_proto; - if (port==snd_s->port_no) return 0; + if (port==snd_s->port_no) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_IP: get_ip_port_proto; - if (ip_addr_cmp(ip, &snd_s->address)) return 0; + if (ip_addr_cmp(ip, &snd_s->address)) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; default: @@ -573,7 +587,8 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("unknown subst type %d\n", \ (subst_l)->u.subst); \ } - + + s_offset=0; new_len=0; last_del=0; @@ -916,7 +931,7 @@ void process_lumps( struct sip_msg* msg, (subst_l)->u.subst); \ } \ \ - + /* init send_address_str & send_port_str */ if(send_sock && send_sock->adv_name_str.len) send_address_str=&(send_sock->adv_name_str); From f0816e0c379ee194012328323cc51581211bc9d1 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 20 Nov 2013 19:39:19 +0200 Subject: [PATCH 095/159] Fixed keeping turns on handling PUBLISHes for the same presentity - when presentity is deleted (due a unPUBLISH) do not do any turn related ops anymore Reported by Damien Sanders --- modules/presence/presentity.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index b2879259340..15d67f0da79 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -610,6 +610,8 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r { LM_ERR("deleting record from hash table failed\n"); } + /* presentity removed, pointer no longer valid */ + p = NULL; lock_release(&pres_htable[hash_code].lock); if(msg && publ_send200ok(msg,presentity->expires,presentity->etag)<0) From d5f92dd04a58192f011048bb1dfda203246e1abf Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 20 Nov 2013 20:00:22 +0200 Subject: [PATCH 096/159] Do not free the header string as it is part of the lumps (and freed together with the lumps). Reported by Jeff Pyle. Fixing bug #126 --- modules/uac/auth.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/uac/auth.c b/modules/uac/auth.c index 6c6a9de4c60..b216196f873 100644 --- a/modules/uac/auth.c +++ b/modules/uac/auth.c @@ -180,15 +180,9 @@ int uac_auth( struct sip_msg *msg) { LM_ERR("failed to apply changes\n"); pkg_free(new_hdr->s); - new_hdr->s = NULL; new_hdr->len = 0; goto error; } - pkg_free(new_hdr->s); - new_hdr->s = NULL; new_hdr->len = 0; - /* increas the Cseq nr */ - - return 0; error: return -1; From 1aab2e8db844ee24b23ee49c7cc21ff3f978adc3 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Fri, 22 Nov 2013 13:19:38 +0100 Subject: [PATCH 097/159] revert commit ec0d05a dialog variables might be binary, therefore strlen should not be used (cherry picked from commit 7401a7a4a4820706aa05d96d5bebdc93c6db6b40) --- modules/dialog/dlg_db_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index 5207bebf6b3..4a7d7a11b98 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -621,7 +621,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) /* script variables */ if (!VAL_NULL(values+17)) read_dialog_vars( VAL_STR(values+17).s, - strlen(VAL_STR(values+17).s), dlg); + VAL_STR(values+17).len, dlg); /* profiles */ if (!VAL_NULL(values+18)) From aead3a7c85b47c309c9702bb3cac6531512f8add Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Fri, 22 Nov 2013 17:05:25 +0200 Subject: [PATCH 098/159] Fix the DB representation of message flags in the acc module * storing flags as strings rather than bitmasks prevents flag conflicts when doing flag modifications in the script, then restarting the proxy * similar usrloc issue was fixed in commit 98b6b0437 (cherry picked from commit f90e347e281b555f89ba05226175ac8d9f07c4ed) --- modules/acc/acc_logic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c index ae9c34dce4e..e9a641a809f 100644 --- a/modules/acc/acc_logic.c +++ b/modules/acc/acc_logic.c @@ -477,7 +477,7 @@ void acc_loaded_callback(struct dlg_cell *dlg, int type, LM_DBG("flags were not saved in dialog\n"); return; } - flags_l = (unsigned int)*flags_s.s; + flags_l = flag_list_to_bitmask(&flags_s, FLAG_TYPE_MSG, FLAG_DELIM); /* register database callbacks */ if (dlg_api.register_dlgcb(dlg, DLGCB_TERMINATED | @@ -566,9 +566,8 @@ static inline void acc_onreply( struct cell* t, struct sip_msg *req, return; } - flags_s.s = (char*)&req->flags; - flags_s.len = sizeof(unsigned int); - + flags_s = bitmask_to_flag_list(FLAG_TYPE_MSG, req->flags); + /* store flags into dlg */ if ( dlg_api.store_dlg_value(dlg, &flags_str, &flags_s) < 0) { LM_ERR("cannot store flag value into dialog\n"); From 94a4481eec4ecba8c14fc9ec9ef519033e74b5d8 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Fri, 22 Nov 2013 12:34:03 -0500 Subject: [PATCH 099/159] uac_registrant: re-register with expires value imposed by the registrar (cherry picked from commit f9a8d985829ed1cce3a2f0985a8c72368d0b3325) --- modules/uac_registrant/registrant.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/uac_registrant/registrant.c b/modules/uac_registrant/registrant.c index 2e73f610397..7d16efe3168 100644 --- a/modules/uac_registrant/registrant.c +++ b/modules/uac_registrant/registrant.c @@ -353,11 +353,8 @@ int run_reg_tm_cback(void *e_data, void *data, void *r_data) } } rec->state = REGISTERED_STATE; - if (exp) { - rec->registration_timeout = now + exp - timer_interval; - } else { - rec->registration_timeout = now + rec->expires - timer_interval; - } + if (exp) rec->expires = exp; + rec->registration_timeout = now + rec->expires - timer_interval; break; case WWW_AUTH_CODE: From 68976ca3883124cad4d3d1ad109e9b32ae6360f3 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 22 Nov 2013 20:46:40 +0200 Subject: [PATCH 100/159] Fixed bogus warning because of variables not being reset. Reported by Jeff Pyle, part of fixing issue #126. --- modules/uac/auth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/uac/auth.c b/modules/uac/auth.c index b216196f873..c7c367d9fbf 100644 --- a/modules/uac/auth.c +++ b/modules/uac/auth.c @@ -180,9 +180,11 @@ int uac_auth( struct sip_msg *msg) { LM_ERR("failed to apply changes\n"); pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; goto error; } + new_hdr->s = NULL; new_hdr->len = 0; return 0; error: return -1; From f2264be2ca41b918dec653be251ce929f27b4a44 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Fri, 22 Nov 2013 10:57:59 -0800 Subject: [PATCH 101/159] Merge pull request #131 from dsandras/ds-pua-mi-warning-fix Fixes bug where a refreshed PUBLISH request triggers an error message.(cherry picked from commit ded0559c527f30181e9bbd494f0e63b048059108) --- modules/pua_mi/mi_func.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/pua_mi/mi_func.c b/modules/pua_mi/mi_func.c index d4c850de8de..6f692d99b3f 100644 --- a/modules/pua_mi/mi_func.c +++ b/modules/pua_mi/mi_func.c @@ -264,11 +264,16 @@ int mi_publ_rpl_cback( ua_pres_t* hentity, struct sip_msg* reply) str etag; str reason= {0, 0}; - if(reply== NULL || hentity== NULL || hentity->cb_param== NULL) + if(reply== NULL || hentity== NULL) { LM_ERR("NULL parameter\n"); return -1; } + if(hentity->cb_param== NULL) + { + LM_DBG("NULL callback parameter, probably a refresh\n"); + return -1; + } if(reply== FAKED_REPLY) { statuscode= 408; From a5d593a62610fbae0efdc6749a158531f68233e5 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Sat, 23 Nov 2013 02:56:12 -0800 Subject: [PATCH 102/159] Merge pull request #122 from dsandras/ds-fix-dialog-info-entity This patch fixes the entity URI in XML documents to contain "sip:".(cherry picked from commit 377e7574d411aa974cf469d6df18b6213b43a31f) --- modules/presence_dialoginfo/notify_body.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index 97e8852d669..7a39db813a9 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -175,10 +175,11 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); return NULL; } - memcpy(buf, pres_user->s, pres_user->len); - buf[pres_user->len] = '@'; - memcpy(buf + pres_user->len + 1, pres_domain->s, pres_domain->len); - buf[pres_user->len + 1 + pres_domain->len]= '\0'; + memcpy(buf, "sip:", 4); + memcpy(buf+4, pres_user->s, pres_user->len); + buf[pres_user->len+4] = '@'; + memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); + buf[pres_user->len + 5 + pres_domain->len]= '\0'; doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) From 9b786aac8c18e908516932a98c19e94202d220ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Sun, 24 Nov 2013 21:26:02 +0100 Subject: [PATCH 103/159] Fixed residential example when using presence --- menuconfig/configs/opensips_residential.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menuconfig/configs/opensips_residential.m4 b/menuconfig/configs/opensips_residential.m4 index faf7a3e4e5f..df639cfbf30 100644 --- a/menuconfig/configs/opensips_residential.m4 +++ b/menuconfig/configs/opensips_residential.m4 @@ -174,7 +174,7 @@ modparam("auth_db|usrloc|uri", "use_domain", 1) ifelse(USE_PRESENCE,`yes',`#### PRESENCE modules loadmodule "presence.so" loadmodule "presence_xml.so" -modparam("presence|presence_xml", "db_url", +modparam("presence", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME From 669efafb150caae9ed757051adff65284c14a8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Sun, 24 Nov 2013 21:32:35 +0100 Subject: [PATCH 104/159] Load xcap module, presence_xml depends on it --- menuconfig/configs/opensips_residential.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/menuconfig/configs/opensips_residential.m4 b/menuconfig/configs/opensips_residential.m4 index df639cfbf30..91bb138c522 100644 --- a/menuconfig/configs/opensips_residential.m4 +++ b/menuconfig/configs/opensips_residential.m4 @@ -172,6 +172,7 @@ modparam("auth_db|usrloc|uri", "use_domain", 1) ', `') ifelse(USE_PRESENCE,`yes',`#### PRESENCE modules +loadmodule "xcap.so" loadmodule "presence.so" loadmodule "presence_xml.so" modparam("presence", "db_url", From b7438f26a2e9769925894b68c47223a2ebd02639 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Mon, 25 Nov 2013 17:52:41 -0500 Subject: [PATCH 105/159] pua: set db_flag to UPDATEDB_FLAG only if there was a previous update (NO_UPDATEDB_FLAG) - in case of a server restart, if the db_flag went from INSERTDB_FLAG to UPDATEDB_FLAG the record will be lost because the record is marked as to be updated, and since there's no record in the db, the update will fail. - if the db_flag is INSERTDB_FLAG, any updates should leave the flag as is and this will cause the new record to be properly inserted (and not updated) into the db. (cherry picked from commit 40962ceb87c1c79db5ded5ed36a5ae82bc735bf2) --- modules/pua/send_publish.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/pua/send_publish.c b/modules/pua/send_publish.c index 831fc1605a5..7a43853bbb0 100644 --- a/modules/pua/send_publish.c +++ b/modules/pua/send_publish.c @@ -568,7 +568,8 @@ int send_publish( publ_info_t* publ ) publ->extra_headers->len); presentity->extra_headers.len= publ->extra_headers->len; } - presentity->db_flag= UPDATEDB_FLAG; + if(presentity->db_flag == NO_UPDATEDB_FLAG) + presentity->db_flag= UPDATEDB_FLAG; if (presentity->waiting_reply) { LM_DBG("Presentity is waiting for reply, queue this PUBLISH\n"); From 37ecc40b14fe86707d7fce7e486bfcb53d0d907a Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 27 Nov 2013 18:52:05 +0200 Subject: [PATCH 106/159] fixed README typo (cherry picked from commit 144e112db1f785875a671f57a727393c2a3b7764) --- modules/load_balancer/README | 2 +- modules/load_balancer/doc/load_balancer_admin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/load_balancer/README b/modules/load_balancer/README index 098bc0eb4ca..bbf8938f6bb 100644 --- a/modules/load_balancer/README +++ b/modules/load_balancer/README @@ -328,7 +328,7 @@ if (t_check_status("(408)|(5[0-9][0-9])")) { Example 1.10. lb_is_destination usage ... -if (is_destination("$si","$sp") ) { +if (lb_is_destination("$si","$sp") ) { # request from a LB destination } ... diff --git a/modules/load_balancer/doc/load_balancer_admin.xml b/modules/load_balancer/doc/load_balancer_admin.xml index 85b6969a2c0..151d96828d3 100644 --- a/modules/load_balancer/doc/load_balancer_admin.xml +++ b/modules/load_balancer/doc/load_balancer_admin.xml @@ -428,7 +428,7 @@ if (t_check_status("(408)|(5[0-9][0-9])")) { <function>lb_is_destination</function> usage ... -if (is_destination("$si","$sp") ) { +if (lb_is_destination("$si","$sp") ) { # request from a LB destination } ... From 8fee8bb4728ba026d233c6518e8e7573489d0953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20Crainea?= Date: Thu, 28 Nov 2013 08:11:10 -0800 Subject: [PATCH 107/159] Merge pull request #139 from shimaore/pkg_mem_events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow for `event_pkg_threshold` support. Credits go to Stéphane Alnet (shimaore) (cherry picked from commit 25289f0c2b0f2bd3137dc062a031be359d6e8937) --- cfg.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cfg.y b/cfg.y index c4950885922..e27c50e1cc8 100644 --- a/cfg.y +++ b/cfg.y @@ -700,7 +700,7 @@ assign_stm: DEBUG EQUAL snumber { } | EVENT_SHM_THRESHOLD EQUAL error { yyerror("int value expected"); } | EVENT_PKG_THRESHOLD EQUAL NUMBER { - #ifdef PKG_MEM + #ifdef PKG_MALLOC #ifdef STATISTICS if ($3 < 0 || $3 > 100) yyerror("PKG threshold has to be a percentage between 0 and 100"); @@ -708,7 +708,7 @@ assign_stm: DEBUG EQUAL snumber { #else yyerror("statistics support not compiled in"); #endif - #else /* PKG_MEM */ + #else /* PKG_MALLOC */ yyerror("pkg memory support not compiled in"); #endif } From 0ee2e2922361bbc9153bf227b21e41b3f564b4b1 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Thu, 28 Nov 2013 14:21:30 -0500 Subject: [PATCH 108/159] pua_dialoginfo: do not blindly load all dialogs - only dialogs with "dlg_peer" vals should be registered for callbacks (cherry picked from commit c631abce52ee4fdbcc98434f7067ee849089af76) --- modules/pua_dialoginfo/pua_dialoginfo.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/pua_dialoginfo/pua_dialoginfo.c b/modules/pua_dialoginfo/pua_dialoginfo.c index 3b7a0440bf5..93a05999787 100644 --- a/modules/pua_dialoginfo/pua_dialoginfo.c +++ b/modules/pua_dialoginfo/pua_dialoginfo.c @@ -400,13 +400,16 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para static void __dialog_loaded(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) { - /* register dialog callbacks which triggers sending PUBLISH */ - if (dlg_api.register_dlgcb(dlg, - DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | - DLGCB_RESPONSE_WITHIN | DLGCB_EARLY, - __dialog_sendpublish, 0, 0) != 0) { - LM_ERR("cannot register callback for interesting dialog types\n"); - } + str peer_uri= {0, 0}; + if(dlg_api.fetch_dlg_value(dlg, &peer_dlg_var, &peer_uri, 1)==0 && peer_uri.len!=0) { + /* register dialog callbacks which triggers sending PUBLISH */ + if (dlg_api.register_dlgcb(dlg, + DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | + DLGCB_RESPONSE_WITHIN | DLGCB_EARLY, + __dialog_sendpublish, 0, 0) != 0) { + LM_ERR("cannot register callback for interesting dialog types\n"); + } + } } From 8079e6460c4268efb0ff7eb28c3947c360997d18 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Mon, 2 Dec 2013 16:48:18 +0200 Subject: [PATCH 109/159] Properly take into account the dialplan priority in case entry matches both string and regex rules (cherry picked from commit 0625610376acbc29f5a9f6a7a79ec897ebfe53fa) --- modules/dialplan/dp_repl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/dialplan/dp_repl.c b/modules/dialplan/dp_repl.c index 82aaa17a440..9bf99f2398d 100644 --- a/modules/dialplan/dp_repl.c +++ b/modules/dialplan/dp_repl.c @@ -334,7 +334,10 @@ int translate(struct sip_msg *msg, str input, str * output, dpl_id_p idp, /* pick the rule with lowest table index if both match and prio are equal */ if ((string_res | regexp_res) == 0) { - if (rrulep->table_id < rulep->table_id) { + if (rulep->pr < rrulep->pr) { + rulep = rrulep; + } else if (rrulep->pr == rulep->pr && + rrulep->table_id < rulep->table_id) { rulep = rrulep; } } From 4115acac9de0d46e77e8141eed2b0bb2710a06a9 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Mon, 2 Dec 2013 17:30:16 +0200 Subject: [PATCH 110/159] drouting: fix drc_table doc default value (cherry picked from commit f25c8e1e520902fde023613cf86ef0cc675d0e32) --- modules/drouting/README | 2 +- modules/drouting/doc/drouting_admin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/drouting/README b/modules/drouting/README index b99acd7d0ee..8f1658b678d 100644 --- a/modules/drouting/README +++ b/modules/drouting/README @@ -435,7 +435,7 @@ modparam("drouting", "drg_table", "groups") The name of the db table storing definitions of the carriers that will be used directly by the routing rules. - Default value is “dr_gw_lists”. + Default value is “dr_carriers”. Example 1.5. Set drc_table parameter ... diff --git a/modules/drouting/doc/drouting_admin.xml b/modules/drouting/doc/drouting_admin.xml index 4e33f04c3ed..7fa98e52cbf 100644 --- a/modules/drouting/doc/drouting_admin.xml +++ b/modules/drouting/doc/drouting_admin.xml @@ -501,7 +501,7 @@ modparam("drouting", "drg_table", "groups") be used directly by the routing rules. - Default value is dr_gw_lists. + Default value is dr_carriers. From 16af3192d367133b5f3de0c2fa0aa3120257e9f2 Mon Sep 17 00:00:00 2001 From: vladpaiu Date: Tue, 3 Dec 2013 00:32:04 -0800 Subject: [PATCH 111/159] Merge pull request #141 from shimaore/db_http_timeout_doc Corrected db_http example: the timeout is an integer.(cherry picked from commit 9a807b819927f7bbbe68dd99a483eb6ee9210385) --- modules/db_http/README | 5 ++--- modules/db_http/doc/db_http_admin.xml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/db_http/README b/modules/db_http/README index 739aec28b38..5e39e9e057b 100644 --- a/modules/db_http/README +++ b/modules/db_http/README @@ -10,8 +10,7 @@ Andrei Dragus Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 8740 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -216,7 +215,7 @@ modparam("db_http", "quote_delimiter","|") Example 1.10. Set timeout parameter ... -modparam("db_http", "timeout","5000") +modparam("db_http", "timeout",5000) ... 1.4. Exported Functions diff --git a/modules/db_http/doc/db_http_admin.xml b/modules/db_http/doc/db_http_admin.xml index 3c549d40d5a..49f4f30aff7 100644 --- a/modules/db_http/doc/db_http_admin.xml +++ b/modules/db_http/doc/db_http_admin.xml @@ -234,7 +234,7 @@ modparam("db_http", "quote_delimiter","|") Set <varname>timeout</varname> parameter ... -modparam("db_http", "timeout","5000") +modparam("db_http", "timeout",5000) ... From 6a58fb661bd5cc45840aedcf96ff9c5f5e8553f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20Crainea?= Date: Tue, 3 Dec 2013 15:14:46 +0200 Subject: [PATCH 112/159] fixed doc avp names (cherry picked from commit f93bbd32775f72a53b050ca95d31d391d91a27e8) --- NEWS | 4 +- test/13.cfg | 2 +- test/14.cfg | 2 +- test/2.cfg | 4 +- test/25.cfg | 6 +- test/7.cfg | 180 +++++++++++++++++++++--------------------- tls/README | 2 +- tls/doc/tls_user.sgml | 2 +- 8 files changed, 101 insertions(+), 101 deletions(-) diff --git a/NEWS b/NEWS index 302c6c79621..2a5d10daaa8 100644 --- a/NEWS +++ b/NEWS @@ -50,7 +50,7 @@ What is new in 1.6.0 2.4 Transformations * added a new nameaddr transformation: param; it extract the value of a certain parameter - o example: avp(i:4) = $(hdr(From){nameaddr.param, tag}); + o example: avp(from) = $(hdr(From){nameaddr.param, tag}); 2.5 AAA API and enhancement of RADIUS support(NEW) AAA API @@ -201,7 +201,7 @@ important - Renamed as AUTH_AAA module - see the AAA API and module changes. * example: modparam("call_control", "init", "call-id=$ci to=$tu from=$fu - authruri=$du another_field = $avp(i:10)") + authruri=$du another_field = $avp(extra)") * the message sent if one of these parameter is set will be the string resulted after expanding the pvars diff --git a/test/13.cfg b/test/13.cfg index f6e9345d5d0..29093b087f7 100644 --- a/test/13.cfg +++ b/test/13.cfg @@ -19,7 +19,7 @@ route{ return; }; if (method == "REGISTER") { - if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) { + if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(extra)")) { sl_send_reply("403", "Not allowed"); } sl_send_reply("200", "OK"); diff --git a/test/14.cfg b/test/14.cfg index d2efec331fa..84a76114d36 100644 --- a/test/14.cfg +++ b/test/14.cfg @@ -19,7 +19,7 @@ route{ return; }; if (method == "REGISTER") { - if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) { + if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(extra)")) { sl_send_reply("403", "Not allowed"); } sl_send_reply("200", "OK"); diff --git a/test/2.cfg b/test/2.cfg index f69350e1eb2..66609c8cd26 100644 --- a/test/2.cfg +++ b/test/2.cfg @@ -55,8 +55,8 @@ loadmodule "xlog/xlog.so" modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") modparam("mi_datagram", "socket_name", "/tmp/opensips.sock") modparam("dialog", "db_mode", 2) -modparam("tm", "fr_inv_timer_avp", "$avp(i:704)") -modparam("auth", "rpid_avp", "$avp(i:302)") +modparam("tm", "fr_inv_timer_avp", "$avp(fr_inv_timer)") +modparam("auth", "rpid_avp", "$avp(rpid)") modparam("sms", "modems", "Nokia [d=/dev/ttyS1;b=9600;m=new;l=30] ") modparam("sms", "networks", "D1 [m=10] ;d2[ m=20]") modparam("sms", "links", "NOKIA[D1;d2]") diff --git a/test/25.cfg b/test/25.cfg index 56cbc29ff45..15a16fafe05 100644 --- a/test/25.cfg +++ b/test/25.cfg @@ -19,8 +19,8 @@ modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") route { #xlog("user: $rU\n"); - $avp(i:80) = $rU; - $avp(i:81) = $rd; + $avp(req-username) = $rU; + $avp(req-domain) = $rd; if(!lookup ("location")){ sl_send_reply("404", "Not Found"); @@ -32,7 +32,7 @@ route { exit; } - if (!check_user_blacklist("$avp(i:80)", "$avp(i:81)")) { + if (!check_user_blacklist("$avp(req-username)", "$avp(req-domain)")) { xlog("$rU user blacklisted\n"); sl_send_reply("403", "Forbidden"); exit; diff --git a/test/7.cfg b/test/7.cfg index 5dd7acda0c4..2b34e3a87d5 100644 --- a/test/7.cfg +++ b/test/7.cfg @@ -162,7 +162,7 @@ modparam("tm", "via1_matching", 1) modparam("tm", "unix_tx_timeout", 2) modparam("tm", "restart_fr_on_each_reply", 1) modparam("tm", "pass_provisional_replies", 0) -modparam("tm", "fr_inv_timer_avp", "$avp(s:callee_fr_inv_timer)") +modparam("tm", "fr_inv_timer_avp", "$avp(callee_fr_inv_timer)") loadmodule "xlog/xlog.so" modparam("xlog", "buf_size", 4096) @@ -187,7 +187,7 @@ modparam("nathelper", "rtpproxy_disable_tout", 60) modparam("nathelper", "rtpproxy_tout", 1) modparam("nathelper", "rtpproxy_retr", 5) modparam("nathelper", "sipping_method", "OPTIONS") -modparam("nathelper", "received_avp", "$avp(i:801)") +modparam("nathelper", "received_avp", "$avp(received)") loadmodule "textops/textops.so" @@ -209,7 +209,7 @@ modparam("registrar", "retry_after", 0) modparam("registrar", "method_filtering", 0) modparam("registrar", "path_mode", 2) modparam("registrar", "path_use_received", 0) -modparam("registrar", "received_avp", "$avp(i:801)") +modparam("registrar", "received_avp", "$avp(received)") loadmodule "sl/sl.so" modparam("sl", "enable_stats", 1) @@ -221,7 +221,7 @@ modparam("db_mysql", "auto_reconnect", 1) loadmodule "auth/auth.so" modparam("auth", "nonce_expire", 300) modparam("auth", "rpid_suffix", ";party=calling;id-type=subscriber;screen=yes") -modparam("auth", "rpid_avp", "$avp(s:rpid)") +modparam("auth", "rpid_avp", "$avp(rpid)") loadmodule "auth_db/auth_db.so" modparam("auth_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -231,7 +231,7 @@ modparam("auth_db", "password_column", "password") modparam("auth_db", "password_column_2", "ha1b") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "use_domain", 0) -modparam("auth_db", "load_credentials", "$avp(s:caller_uuid)=uuid") +modparam("auth_db", "load_credentials", "$avp(caller_uuid)=uuid") loadmodule "uri_db/uri_db.so" modparam("uri_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -266,7 +266,7 @@ modparam("permissions", "source_col", "src_ip") modparam("permissions", "proto_col", "proto") modparam("permissions", "from_col", "from_pattern") modparam("permissions", "tag_col", "tag") -modparam("permissions", "peer_tag_avp", "$avp(s:peer_uuid)") +modparam("permissions", "peer_tag_avp", "$avp(peer_uuid)") loadmodule "lcr/lcr.so" modparam("lcr", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -282,14 +282,14 @@ modparam("lcr", "strip_column", "strip") modparam("lcr", "prefix_column", "prefix") modparam("lcr", "from_uri_column", "from_uri") modparam("lcr", "priority_column", "priority") -modparam("lcr", "gw_uri_avp", "$avp(i:1400)") -modparam("lcr", "ruri_user_avp", "$avp(i:1402)") -modparam("lcr", "contact_avp", "$avp(i:1401)") -modparam("lcr", "fr_inv_timer_avp", "$avp(s:fr_inv_timer_avp)") +modparam("lcr", "gw_uri_avp", "$avp(gw_uri)") +modparam("lcr", "ruri_user_avp", "$avp(ruri_user)") +modparam("lcr", "contact_avp", "$avp(contact)") +modparam("lcr", "fr_inv_timer_avp", "$avp(fr_inv_timer_avp)") modparam("lcr", "fr_inv_timer", 90) modparam("lcr", "fr_inv_timer_next", 30) -modparam("lcr", "rpid_avp", "$avp(s:rpid)") -modparam("lcr", "flags_avp", "$avp(i:712)") +modparam("lcr", "rpid_avp", "$avp(rpid)") +modparam("lcr", "flags_avp", "$avp(flags)") loadmodule "uac_redirect/uac_redirect.so" modparam("uac_redirect", "default_filter", "accept") @@ -329,7 +329,7 @@ modparam("acc", "acc_from_tag_column", "from_tag") modparam("acc", "detect_direction", 1) modparam("acc", "acc_sip_code_column", "sip_code") modparam("acc", "acc_sip_reason_column", "sip_reason") -modparam("acc", "multi_leg_info", "src_leg=$avp(i:901);dst_leg=$avp(i:902)") +modparam("acc", "multi_leg_info", "src_leg=$avp(src_leg);dst_leg=$avp(dst_leg)") ######################################################################## # Request route 'main' @@ -415,8 +415,8 @@ route[0] route[1] { xlog("L_INFO", "Clear caller preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_delete("$avp(s:caller_cli)/g"); - avp_delete("$avp(s:clir)/g"); + avp_delete("$avp(caller_cli)/g"); + avp_delete("$avp(clir)/g"); } @@ -426,9 +426,9 @@ route[1] route[2] { xlog("L_INFO", "Clear callee preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_delete("$avp(s:callee_fr_inv_timer)/g"); - avp_delete("$avp(s:cfu)/g"); - avp_delete("$avp(s:cfc)/g"); + avp_delete("$avp(callee_fr_inv_timer)/g"); + avp_delete("$avp(cfu)/g"); + avp_delete("$avp(cfc)/g"); } @@ -438,11 +438,11 @@ route[2] route[3] { route(1); - xlog("L_INFO", "Load caller preferences for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Load caller preferences for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # load caller avps - avp_db_load("$avp(s:caller_uuid)", "*"); - avp_copy("$avp(s:cli)", "$avp(s:caller_cli)/d"); - if(is_avp_set("$avp(s:clir)/n") && avp_check("$avp(s:clir)", "eq/i:1")) + avp_db_load("$avp(caller_uuid)", "*"); + avp_copy("$avp(cli)", "$avp(caller_cli)/d"); + if(is_avp_set("$avp(clir)/n") && avp_check("$avp(clir)", "eq/i:1")) { # mark for anonymization setflag(28); @@ -455,27 +455,27 @@ route[3] ######################################################################## route[4] { - xlog("L_INFO", "Load callee preferences for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Load callee preferences for uuid '$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # load callee avps - avp_db_load("$avp(s:callee_uuid)", "*"); - if(is_avp_set("$avp(s:cfu)/s")) + avp_db_load("$avp(callee_uuid)", "*"); + if(is_avp_set("$avp(cfu)/s")) { - xlog("L_INFO", "Call-forward-unconditional to '$avp(s:cfu)' found - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Call-forward-unconditional to '$avp(cfu)' found - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(8); - avp_delete("$avp(s:caller_uuid)/g"); - avp_copy("$avp(s:callee_uuid)", "$avp(s:caller_uuid)/d"); - avp_pushto("$ru", "$avp(s:cfu)"); + avp_delete("$avp(caller_uuid)/g"); + avp_copy("$avp(callee_uuid)", "$avp(caller_uuid)/d"); + avp_pushto("$ru", "$avp(cfu)"); route(3); route(14); exit; } - if(is_avp_set("$avp(s:ringtimeout)/n")) + if(is_avp_set("$avp(ringtimeout)/n")) { - xlog("L_INFO", "Setting ring timeout to $avp(s:ringtimeout) secs - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_copy("$avp(s:ringtimeout)", "$avp(s:callee_fr_inv_timer)/d"); + xlog("L_INFO", "Setting ring timeout to $avp(ringtimeout) secs - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_copy("$avp(ringtimeout)", "$avp(callee_fr_inv_timer)/d"); } } @@ -485,8 +485,8 @@ route[4] ######################################################################## route[5] { - xlog("L_INFO", "Setting acc source-leg for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_printf("$avp(i:901)", "$avp(s:caller_uuid)|$avp(s:acc_caller_user)|$avp(s:acc_caller_domain)|$avp(s:acc_state)"); + xlog("L_INFO", "Setting acc source-leg for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_printf("$avp(src_leg)", "$avp(caller_uuid)|$avp(acc_caller_user)|$avp(acc_caller_domain)|$avp(acc_state)"); } @@ -495,8 +495,8 @@ route[5] ######################################################################## route[6] { - xlog("L_INFO", "Setting acc destination-leg for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_printf("$avp(i:902)", "$avp(s:callee_uuid)|$avp(s:acc_callee_user)|$avp(s:acc_callee_domain)"); + xlog("L_INFO", "Setting acc destination-leg for uuid '$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_printf("$avp(dst_leg)", "$avp(callee_uuid)|$avp(acc_callee_user)|$avp(acc_callee_domain)"); } @@ -505,7 +505,7 @@ route[6] ######################################################################## route[7] { - xlog("L_INFO", "Accounting failed request for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Accounting failed request for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(5); route(6); resetflag(24); @@ -518,17 +518,17 @@ route[7] ######################################################################## route[8] { - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(5); route(6); - avp_delete("$avp(s:acc_caller_user)"); - avp_delete("$avp(s:acc_caller_domain)"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - avp_delete("$avp(s:acc_state)/g"); - $avp(s:acc_state) = "cfu"; + avp_delete("$avp(acc_caller_user)"); + avp_delete("$avp(acc_caller_domain)"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + avp_delete("$avp(acc_state)/g"); + $avp(acc_state) = "cfu"; } @@ -616,13 +616,13 @@ route[12] { remove_hf("Remote-Party-ID"); } - if(is_avp_set("$avp(s:caller_cli)/s")) + if(is_avp_set("$avp(caller_cli)/s")) { if(!isflagset(28)) { - xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - append_hf("P-Asserted-Identity: <$avp(s:caller_cli)>\r\n"); + xlog("L_INFO", "Set caller CLI '$avp(caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + append_hf("P-Asserted-Identity: <$avp(caller_cli)>\r\n"); } } @@ -648,8 +648,8 @@ route[12] t_on_failure("2"); if(!isflagset(26)) { - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(5); route(6); @@ -682,7 +682,7 @@ route[13] sl_send_reply("100", "Trying"); if(from_gw()) { - $avp(s:caller_uuid) = "0"; + $avp(caller_uuid) = "0"; xlog("L_INFO", "Call from PSTN' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); setflag(23); @@ -691,18 +691,18 @@ route[13] { if(allow_trusted()) { - if(is_avp_set("$avp(s:peer_uuid)/s")) + if(is_avp_set("$avp(peer_uuid)/s")) { # use tag-column from trusted-table as uuid for this caller - avp_copy("$avp(s:peer_uuid)", "$avp(s:caller_uuid)/d"); + avp_copy("$avp(peer_uuid)", "$avp(caller_uuid)/d"); } else { # if no uuid is set, use "0" as default uuid - $avp(s:caller_uuid) = "0"; + $avp(caller_uuid) = "0"; } - xlog("L_INFO", "Call from trusted peer with uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Call from trusted peer with uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); if(!is_domain_local("$rd")) { @@ -730,9 +730,9 @@ route[13] } } } - $avp(s:acc_caller_user) = $fU; - $avp(s:acc_caller_domain) = $fd; - $avp(s:acc_state) = "call"; + $avp(acc_caller_user) = $fU; + $avp(acc_caller_domain) = $fd; + $avp(acc_state) = "call"; route(3); if(nat_uac_test("19")) @@ -759,21 +759,21 @@ route[14] if(!is_domain_local("$rd")) { setflag(20); - $avp(s:callee_uuid) = "0"; + $avp(callee_uuid) = "0"; route(16); } - avp_delete("$avp(s:callee_uuid)"); - avp_db_query("select uuid from subscriber where username = '$rU'", "$avp(s:callee_uuid)"); - if(is_avp_set("$avp(s:callee_uuid)/s")) + avp_delete("$avp(callee_uuid)"); + avp_db_query("select uuid from subscriber where username = '$rU'", "$avp(callee_uuid)"); + if(is_avp_set("$avp(callee_uuid)/s")) { - xlog("L_INFO", "Callee is local, uuid='$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Callee is local, uuid='$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(15); } else { - $avp(s:callee_uuid) = "0"; + $avp(callee_uuid) = "0"; xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(16); @@ -792,8 +792,8 @@ route[15] { xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(7); sl_send_reply("404", "User Offline"); @@ -879,8 +879,8 @@ route[17] # For international calls, either "00" or + is prefixed, like # +49123456780 or 0049123456789. # - avp_delete("$avp(s:orig_callee_user)/g"); - $avp(s:orig_callee_user) = $rU; + avp_delete("$avp(orig_callee_user)/g"); + $avp(orig_callee_user) = $rU; if(uri =~ "^sip:(\+[1-9])?[0-9]+@") { # looks like a PSTN number @@ -900,18 +900,18 @@ route[17] { # unknown format, maybe NDC wasn't added before? - xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Not normalized callee '$avp(orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(-1); } # else we have "+" + CC + NDC + SN - xlog("L_INFO", "Normalized callee '$avp(s:orig_callee_user)' to E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Normalized callee '$avp(orig_callee_user)' to E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(1); } else { - xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Not normalized callee '$avp(orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(-1); } @@ -940,7 +940,7 @@ route[18] xlog("L_INFO", "ENUM query failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # ENUM query failed, revert $rU - avp_pushto("$ru/username", "$avp(s:orig_callee_user)"); + avp_pushto("$ru/username", "$avp(orig_callee_user)"); } } @@ -1060,12 +1060,12 @@ failure_route[2] } if(t_check_status("301|302")) { - avp_delete("$avp(s:acc_caller_user)/g"); - avp_delete("$avp(s:acc_caller_domain)/g"); - avp_delete("$avp(s:acc_state)/g"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - $avp(s:acc_state) = "cfc"; + avp_delete("$avp(acc_caller_user)/g"); + avp_delete("$avp(acc_caller_domain)/g"); + avp_delete("$avp(acc_state)/g"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + $avp(acc_state) = "cfc"; setflag(29); if(!get_redirects("1:1")) { @@ -1078,10 +1078,10 @@ failure_route[2] exit; } # get last URI from destination-set and set it as R-URI - avp_delete("$avp(s:tmp)/g"); - $avp(s:tmp) = $ds; - avp_subst("$avp(s:tmp)", "/.*(sip:.+@[^:;>]+).*$/\1/"); - avp_pushto("$ru", "$avp(s:tmp)"); + avp_delete("$avp(tmp)/g"); + $avp(tmp) = $ds; + avp_subst("$avp(tmp)", "/.*(sip:.+@[^:;>]+).*$/\1/"); + avp_pushto("$ru", "$avp(tmp)"); setflag(29); t_on_branch("1"); @@ -1089,15 +1089,15 @@ failure_route[2] route(14); exit; } - if($avp(s:cfc) != NULL) + if($avp(cfc) != NULL) { - avp_delete("$avp(s:acc_caller_user)/g"); - avp_delete("$avp(s:acc_caller_domain)/g"); - avp_delete("$avp(s:acc_state)/g"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - $avp(s:acc_state) = "cfc"; - avp_pushto("$ru", "$avp(s:cfc)"); + avp_delete("$avp(acc_caller_user)/g"); + avp_delete("$avp(acc_caller_domain)/g"); + avp_delete("$avp(acc_state)/g"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + $avp(acc_state) = "cfc"; + avp_pushto("$ru", "$avp(cfc)"); setflag(29); t_on_branch("1"); diff --git a/tls/README b/tls/README index 2c24a66d5bb..2cec8a3f60a 100644 --- a/tls/README +++ b/tls/README @@ -779,7 +779,7 @@ route{ ... # calls to other SIP domains # set the proper SSL context (certificate) for local hosted domains - avp_write("$fd","$avp(i:400)"); + avp_write("$fd","$avp(fd)"); t_relay(); # uses NAPTR and SRV lookups exit; ... diff --git a/tls/doc/tls_user.sgml b/tls/doc/tls_user.sgml index f9b8db4142e..3b35a0e0e87 100644 --- a/tls/doc/tls_user.sgml +++ b/tls/doc/tls_user.sgml @@ -887,7 +887,7 @@ route{ ... # calls to other SIP domains # set the proper SSL context (certificate) for local hosted domains - avp_write("$fd","$avp(i:400)"); + avp_write("$fd","$avp(fd)"); t_relay(); # uses NAPTR and SRV lookups exit; ... From 96921f5f90919bdc3dc1a573bcb0c32899c65075 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 6 Dec 2013 14:59:32 +0200 Subject: [PATCH 113/159] Fixed bogus condition in GT, GTE, LT and LTE script tests. Reported by dcb314 on GITHUB Closing issue #146 --- route.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/route.c b/route.c index 6afb7a30dd0..55669b0aca7 100644 --- a/route.c +++ b/route.c @@ -1148,7 +1148,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt>0) ret = 1; - else if(rt==0 && s1->len>s1->len) + else if(rt==0 && s1->len>s2->len) ret = 1; else ret = 0; break; @@ -1158,7 +1158,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt>0) ret = 1; - else if(rt==0 && s1->len>=s1->len) + else if(rt==0 && s1->len>=s2->len) ret = 1; else ret = 0; break; @@ -1168,7 +1168,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt<0) ret = 1; - else if(rt==0 && s1->lenlen) + else if(rt==0 && s1->lenlen) ret = 1; else ret = 0; break; @@ -1178,7 +1178,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt<0) ret = 1; - else if(rt==0 && s1->len<=s1->len) + else if(rt==0 && s1->len<=s2->len) ret = 1; else ret = 0; break; From 9134ebfcbd2f0b1d5814994b49ac6d0cab78591a Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Fri, 6 Dec 2013 14:17:59 -0800 Subject: [PATCH 114/159] Merge pull request #129 from dsandras/ds-pua-expires-refresh-fix Fix bug where a new publication does not extend the desired expire time. (cherry picked from commit ccac0fac1da8ad663e500148fb7f7d9e43e34fd1) --- modules/pua/send_publish.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/pua/send_publish.c b/modules/pua/send_publish.c index 7a43853bbb0..42cde5b83a6 100644 --- a/modules/pua/send_publish.c +++ b/modules/pua/send_publish.c @@ -409,6 +409,7 @@ int send_publish_int(ua_pres_t* presentity, publ_info_t* publ, pua_event_t* ev, memcpy(tuple_id.s, presentity->tuple_id.s, presentity->tuple_id.len); tuple_id.len = presentity->tuple_id.len; } + presentity->desired_expires= publ->expires + (int)time(NULL); presentity->waiting_reply = 1; presentity->cb_param = publ->cb_param; From 52cf1711aef4b6bfb9b1b58db0e14627913ce9ee Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Fri, 6 Dec 2013 14:22:47 -0800 Subject: [PATCH 115/159] Merge pull request #135 from bat-modulis/master Renamed permissions parameter 'from_col' to 'pattern_col' (cherry picked from commit 10763008a99a48c0375f1a5bee32bb05231426b0) --- modules/permissions/permissions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/permissions/permissions.c b/modules/permissions/permissions.c index 66881e7ee8e..ccc5ea1867e 100644 --- a/modules/permissions/permissions.c +++ b/modules/permissions/permissions.c @@ -167,7 +167,7 @@ static param_export_t params[] = { {"address_table", STR_PARAM, &address_table.s }, {"ip_col", STR_PARAM, &ip_col.s }, {"proto_col", STR_PARAM, &proto_col.s }, - {"from_col", STR_PARAM, &pattern_col.s }, + {"pattern_col", STR_PARAM, &pattern_col.s }, {"info_col", STR_PARAM, &info_col.s }, {"grp_col", STR_PARAM, &grp_col.s }, {"mask_col", STR_PARAM, &mask_col.s }, From 0bfe61659f5338b206c33676059b9a5017f59e94 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 6 Dec 2013 23:27:18 +0200 Subject: [PATCH 116/159] Generate proper branch param for the NAT ping requests Credits go to Varun (varunvairavan on GITHUB) Closes #145 (cherry picked from commit 1f18541ced045645f8cbda1c73a85fe52597a1db) --- modules/nat_traversal/nat_traversal.c | 5 ++++- modules/nathelper/sip_pinger.h | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/nat_traversal/nat_traversal.c b/modules/nat_traversal/nat_traversal.c index c563e996a29..3d9380100cb 100644 --- a/modules/nat_traversal/nat_traversal.c +++ b/modules/nat_traversal/nat_traversal.c @@ -1574,6 +1574,8 @@ ClientNatTest(struct sip_msg *msg, unsigned int tests) static void send_keepalive(NAT_Contact *contact) { +#define MAX_BRANCHID 9999999 +#define MIN_BRANCHID 1000000 char buffer[8192], *from_uri, *ptr; static char from[64] = FROM_PREFIX; static char *from_ip = from + sizeof(FROM_PREFIX) - 1; @@ -1596,7 +1598,7 @@ send_keepalive(NAT_Contact *contact) len = snprintf(buffer, sizeof(buffer), "%s %s SIP/2.0\r\n" - "Via: SIP/2.0/UDP %.*s:%d;branch=0\r\n" + "Via: SIP/2.0/UDP %.*s:%d;branch=z9hG4bK%ld\r\n" "From: %s;tag=%x\r\n" "To: %s\r\n" "Call-ID: %s-%x-%x@%.*s\r\n" @@ -1606,6 +1608,7 @@ send_keepalive(NAT_Contact *contact) keepalive_params.method, contact->uri, contact->socket->address_str.len, contact->socket->address_str.s, contact->socket->port_no, + (long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID), from_uri, keepalive_params.from_tag++, contact->uri, keepalive_params.callid_prefix, keepalive_params.callid_counter++, get_ticks(), diff --git a/modules/nathelper/sip_pinger.h b/modules/nathelper/sip_pinger.h index 6d368c662fd..fdc344a8b66 100644 --- a/modules/nathelper/sip_pinger.h +++ b/modules/nathelper/sip_pinger.h @@ -129,6 +129,9 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, int *len_p) { #define s_len(_s) (sizeof(_s)-1) +#define MAX_BRANCHID 9999999 +#define MIN_BRANCHID 1000000 +#define LEN_BRANCHID 7 /* NOTE: this must be sync with the MX and MIN values !! */ static char buf[MAX_SIPPING_SIZE]; char *p, proto_str[4]; str address, port; @@ -158,7 +161,7 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, if ( sipping_method.len + 1 + curi->len + s_len(" SIP/2.0"CRLF) + s_len("Via: SIP/2.0/") + st.len + address.len + - 1 + port.len + s_len(";branch=0") + + 1 + port.len + s_len(";branch=z9hG4bK") + LEN_BRANCHID + (path->len ? (s_len(CRLF"Route: ") + path->len) : 0) + s_len(CRLF"From: ") + sipping_from.len + s_len(";tag=") + 8 + s_len(CRLF"To: ") + curi->len + @@ -182,13 +185,16 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, append_str( p, address); *(p++) = ':'; append_str( p, port); + append_fix( p, ";branch=z9hG4bK"); + int2bstr( + (long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID), + p+LEN_BRANCHID-INT2STR_MAX_LEN+1, NULL); + p += LEN_BRANCHID; if (path->len) { - append_fix( p, ";branch=0"CRLF"Route: "); + append_fix( p, CRLF"Route: "); append_str( p, *path); - append_fix( p, CRLF"From: "); - } else { - append_fix( p, ";branch=0"CRLF"From: "); } + append_fix( p, CRLF"From: "); append_str( p, sipping_from); append_fix( p, ";tag="); len = 8; From dd6e62abada36dfeb6e312abb4f71d30f29924ad Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 11 Dec 2013 11:09:15 +0200 Subject: [PATCH 117/159] mi_json: escape '\\' character also fix incorrect '"' escaping (cherry picked from commit 28b399bb166a786bb0e943ff072606d2d01d96b6) Conflicts: modules/mi_json/http_fnc.c --- modules/mi_json/http_fnc.c | 579 +++++++++++++++++++++++++++++++++++++ 1 file changed, 579 insertions(+) create mode 100644 modules/mi_json/http_fnc.c diff --git a/modules/mi_json/http_fnc.c b/modules/mi_json/http_fnc.c new file mode 100644 index 00000000000..43446e18064 --- /dev/null +++ b/modules/mi_json/http_fnc.c @@ -0,0 +1,579 @@ +/* + * This file is part of Open SIP Server (opensips). + * + * opensips is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * opensips is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * History: + * --------- + * 2013-10-31 first version (shimaore) + */ + + +#include "../../str.h" +#include "../../ut.h" +#include "../../mem/mem.h" +#include "../../mem/shm_mem.h" +#include "../../mi/mi.h" +#include "../../config.h" +#include "../../globals.h" +#include "../../locking.h" + +#include "http_fnc.h" + +extern str http_root; + +mi_json_page_data_t html_page_data; + +gen_lock_t* mi_json_lock; + +struct page_buf { + char *current; + char *buf; + int max_page_len; + short status; +}; + +static inline void MI_JSON_COPY(struct page_buf* pb, const str s) { + if ( pb->status ) { + return; + } + if ( s.s == NULL || s.len == 0 ) { + return; + } + if ( (int)(pb->current - pb->buf) + s.len > pb->max_page_len) { + pb->status = -1; + } else { + memcpy(pb->current, s.s, s.len); + pb->current += s.len; + } +} + +static const str MI_JSON_ESC = str_init("\\"); + +static inline void MI_JSON_ESC_COPY(struct page_buf* pb, const str s) { + str temp_holder; + int temp_counter; + if( pb->status ) { + return; + } + if( s.s == NULL || s.len == 0 ) { + return; + } + temp_holder.s = s.s; + temp_holder.len = 0; + for(temp_counter=0;temp_counterpage, + html_p_data->buffer.len, + tree); + return 0; +} + + +static void mi_json_close_async(struct mi_root *mi_rpl, struct mi_handler *hdl, int done) +{ + struct mi_root *shm_rpl = NULL; + gen_lock_t* lock; + mi_json_async_resp_data_t *async_resp_data; + + if (hdl==NULL) { + LM_CRIT("null mi handler\n"); + return; + } + + LM_DBG("mi_root [%p], hdl [%p], hdl->param [%p], " + "*hdl->param [%p] and done [%u]\n", + mi_rpl, hdl, hdl->param, *(struct mi_root **)hdl->param, done); + + if (!done) { + /* we do not pass provisional stuff (yet) */ + if (mi_rpl) free_mi_tree( mi_rpl ); + return; + } + + async_resp_data = + (mi_json_async_resp_data_t*)((char*)hdl+sizeof(struct mi_handler)); + lock = async_resp_data->lock; + lock_get(lock); + if (mi_rpl!=NULL && (shm_rpl=clone_mi_tree( mi_rpl, 1))!=NULL) { + *(struct mi_root **)hdl->param = shm_rpl; + } else { + LM_WARN("Unable to process async reply [%p]\n", mi_rpl); + /* mark it as invalid */ + hdl->param = NULL; + } + LM_DBG("shm_rpl [%p], hdl [%p], hdl->param [%p], *hdl->param [%p]\n", + shm_rpl, hdl, hdl->param, + (hdl->param)?*(struct mi_root **)hdl->param:NULL); + lock_release(lock); + + if (mi_rpl) free_mi_tree(mi_rpl); + + return; +} + +static inline struct mi_handler* mi_json_build_async_handler(void) +{ + struct mi_handler *hdl; + mi_json_async_resp_data_t *async_resp_data; + unsigned int len; + + len = sizeof(struct mi_handler)+sizeof(mi_json_async_resp_data_t); + hdl = (struct mi_handler*)shm_malloc(len); + if (hdl==NULL) { + LM_ERR("oom\n"); + return NULL; + } + + memset(hdl, 0, len); + async_resp_data = + (mi_json_async_resp_data_t*)((char*)hdl+sizeof(struct mi_handler)); + + hdl->handler_f = mi_json_close_async; + hdl->param = (void*)&async_resp_data->tree; + + async_resp_data->lock = mi_json_lock; + + LM_DBG("hdl [%p], hdl->param [%p], *hdl->param [%p] mi_json_lock=[%p]\n", + hdl, hdl->param, (hdl->param)?*(struct mi_root **)hdl->param:NULL, + async_resp_data->lock); + + return hdl; +} + +struct mi_root* mi_json_run_mi_cmd(const str* miCmd, const str* params, + str *page, str *buffer, struct mi_handler **async_hdl) +{ + struct mi_cmd *f; + struct mi_node *node; + struct mi_root *mi_cmd; + struct mi_root *mi_rpl; + struct mi_handler *hdl; + str val; + int i, j; + + LM_DBG("got command=%.*s\n", miCmd->len, miCmd->s); + + f = lookup_mi_cmd(miCmd->s, miCmd->len); + if (f == NULL) { + LM_ERR("unable to find mi command [%.*s]\n", miCmd->len, miCmd->s); + goto error; + } + + if (f->flags&MI_ASYNC_RPL_FLAG) { + LM_DBG("command=%.*s is async\n", miCmd->len, miCmd->s); + /* We need to build an async handler */ + hdl = mi_json_build_async_handler(); + if (hdl==NULL) { + LM_ERR("failed to build async handler\n"); + goto error; + } + } else { + hdl = NULL; + } + *async_hdl = hdl; + + if (f->flags&MI_NO_INPUT_FLAG) { + LM_DBG("command=%.*s requires no parameters\n", miCmd->len, miCmd->s); + mi_cmd = NULL; + } else { + LM_DBG("command=%.*s accepts parameters\n", miCmd->len, miCmd->s); + if (params->s) { + mi_cmd = init_mi_tree(0,0,0); + if (mi_cmd==NULL) { + LM_ERR("the MI tree cannot be initialized!\n"); + goto error; + } + i = 0; + j = 0; + for( i = 0; i < params->len; i++ ) { + if (params->s[i] == ',') { + val.s = params->s + j; + val.len = i-j; + LM_DBG("got string param [%.*s]\n", val.len, val.s); + node = &mi_cmd->node; + if(!add_mi_node_child(node,0,NULL,0,val.s,val.len)){ + LM_ERR("cannot add the child node to the tree\n"); + free_mi_tree(mi_cmd); + goto error; + } + j = i+1; + } + } + if( j < params->len ) { + val.s = params->s + j; + val.len = params->len-j; + LM_DBG("got string param [%.*s]\n", val.len, val.s); + node = &mi_cmd->node; + if(!add_mi_node_child(node,0,NULL,0,val.s,val.len)){ + LM_ERR("cannot add the child node to the tree\n"); + free_mi_tree(mi_cmd); + goto error; + } + } + mi_cmd->async_hdl = hdl; + } else { + LM_DBG("but no parameters were found\n"); + mi_cmd = init_mi_tree(0,0,0); + if (mi_cmd==NULL) { + LM_ERR("the MI tree cannot be initialized!\n"); + goto error; + } + } + } + + html_page_data.page.s = buffer->s; + html_page_data.page.len = 0; + html_page_data.buffer.s = buffer->s; + html_page_data.buffer.len = buffer->len; + + mi_rpl = run_mi_cmd(f, mi_cmd, + (mi_flush_f *)mi_json_flush_tree, &html_page_data); + if (mi_rpl == NULL) { + LM_ERR("failed to process the command\n"); + if (mi_cmd) free_mi_tree(mi_cmd); + goto error; + } else if (mi_rpl != MI_ROOT_ASYNC_RPL) { + *page = html_page_data.page; + } + LM_DBG("got mi_rpl=[%p]\n",mi_rpl); + + if (mi_cmd) free_mi_tree(mi_cmd); + return mi_rpl; + +error: + return NULL; +} + + +static inline int mi_json_write_node_array(struct page_buf* pb, + struct mi_node *node) +{ + LM_DBG("start\n"); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, node->value); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + + node->flags |= MI_WRITTEN; + return pb->status; +} +static inline int mi_json_write_node_hash(struct page_buf* pb, + struct mi_node *node) +{ + LM_DBG("start\n"); + + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, node->name); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_COPY(pb, MI_JSON_COLON); + if (node->value.s!=NULL) { + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, node->value); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + } else { + MI_JSON_COPY(pb, MI_JSON_NULL); + } + + node->flags |= MI_WRITTEN; + return pb->status; +} + +static inline int mi_json_write_node(struct page_buf* pb, + struct mi_node *node) +{ + struct mi_attr *attr; + LM_DBG("start\n"); + + /* name */ + MI_JSON_COPY(pb, MI_JSON_KEY_NAME); + if (node->name.s!=NULL) { + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, node->name); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + } else { + MI_JSON_COPY(pb, MI_JSON_NULL); + } + MI_JSON_COPY(pb, MI_JSON_COMMA); + + /* value */ + MI_JSON_COPY(pb, MI_JSON_KEY_VALUE); + if (node->value.s!=NULL) { + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, node->value); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + } else { + MI_JSON_COPY(pb, MI_JSON_NULL); + } + MI_JSON_COPY(pb, MI_JSON_COMMA); + + /* attributes */ + MI_JSON_COPY(pb, MI_JSON_KEY_ATTRIBUTES); + MI_JSON_COPY(pb, MI_JSON_OBJECT_START); + for(attr=node->attributes;attr!=NULL;attr=attr->next) { + if (attr->name.s!=NULL) { + /* attribute name */ + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, attr->name); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_COPY(pb, MI_JSON_COLON); + + /* attribute value */ + if (attr->value.s!=NULL) { + MI_JSON_COPY(pb, MI_JSON_SQUOT); + MI_JSON_ESC_COPY(pb, attr->value); + MI_JSON_COPY(pb, MI_JSON_SQUOT); + } else { + MI_JSON_COPY(pb, MI_JSON_NULL); + } + } + if (attr->next!=NULL) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + } + } + MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); + + return pb->status; +} + +/* sync case */ +static int mi_json_recur_write_tree(struct page_buf* pb, + struct mi_node *tree) +{ + int names = 0; + int values = 0; + int attributes = 0; + int kids = 0; + struct mi_node* t; + LM_DBG("start\n"); + for( t = tree; t ; t=t->next ) { + if(t->name.s) { + names++; + } + if(t->value.s) { + values++; + } + if(t->attributes) { + attributes++; + } + if(t->kids) { + kids++; + } + } + + if(names == 0 && values > 0 && attributes == 0 && kids == 0) { + LM_DBG("Treat as an array\n"); + /* Treat as an array */ + MI_JSON_COPY(pb, MI_JSON_ARRAY_START); + for( t = tree; t; t=t->next ) { + mi_json_write_node_array(pb,t); + t->flags |= MI_WRITTEN; + if(t->next) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + } + } + MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); + LM_DBG("done\n"); + return 0; + } + if(names >= values && attributes == 0 && kids == 0) { + LM_DBG("Treat as a hash\n"); + /* Treat as a hash */ + MI_JSON_COPY(pb, MI_JSON_OBJECT_START); + for( t = tree; t; t=t->next ) { + LM_DBG("t = %p\n",t); + mi_json_write_node_hash(pb,t); + t->flags |= MI_WRITTEN; + if(t->next) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + } + } + MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); + LM_DBG("done\n"); + return 0; + } + if(names == 0 && values == 0 && attributes == 0 && kids > 0) { + LM_DBG("Treat as an array of objects\n"); + /* Treat as an array of objects */ + MI_JSON_COPY(pb, MI_JSON_ARRAY_START); + for( t = tree; t; t=t->next ) { + mi_json_recur_write_tree(pb,t->kids); + t->flags |= MI_WRITTEN; + if(t->next) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + } + } + MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); + LM_DBG("done\n"); + return 0; + } + + /* Otherwise */ + LM_DBG("Treat as a complex array of hashes\n"); + /* Treat as a complex array of hashes */ + MI_JSON_COPY(pb, MI_JSON_ARRAY_START); + for( t = tree; t; t=t->next ) { + MI_JSON_COPY(pb, MI_JSON_OBJECT_START); + mi_json_write_node(pb,t); + if (t->kids) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + MI_JSON_COPY(pb, MI_JSON_KEY_CHILDREN); + mi_json_recur_write_tree(pb, t->kids); + } + MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); + if(t->next) { + MI_JSON_COPY(pb, MI_JSON_COMMA); + } + } + MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); + LM_DBG("done\n"); + return pb->status; +} + + +int mi_json_build_content(str *page, int max_page_len, + struct mi_root* tree) +{ + struct page_buf pb; + LM_DBG("start\n"); + + pb.buf = page->s; + pb.current = page->s + page->len; + pb.max_page_len = max_page_len; + pb.status = 0; + + if (tree) { /* Build mi reply */ + mi_json_recur_write_tree(&pb, tree->node.kids); + page->len = pb.current - page->s; + } + LM_DBG("done\n"); + return pb.status; +} + + +int mi_json_build_page(str *page, int max_page_len, + struct mi_root *tree) +{ + LM_DBG("start\n"); + return mi_json_build_content(page, max_page_len, tree); +} + + +/* async case */ +static int mi_json_recur_flush_tree(struct page_buf* pb, + struct mi_node *tree) +{ + struct mi_node *kid; + LM_DBG("start\n"); + + for(kid = tree->kids ; kid ; ){ + if (kid->flags & MI_NOT_COMPLETED) { + return 1; + } + } + + mi_json_recur_write_tree(pb,tree); + LM_DBG("done\n"); + return pb->status; +} + +int mi_json_flush_content(str *page, int max_page_len, + struct mi_root* tree) +{ + struct page_buf pb; + LM_DBG("start\n"); + pb.buf = page->s; + pb.current = page->s + page->len; + pb.max_page_len = max_page_len; + pb.status = 0; + + if (tree) { /* Build mi reply */ + mi_json_recur_flush_tree(&pb, &tree->node); + page->len = pb.current - page->s; + } + LM_DBG("done\n"); + return pb.status; +} From bd38945a28f0ac93fb3be306d550b04e8d424d05 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 11 Dec 2013 11:09:58 +0200 Subject: [PATCH 118/159] remove bogus flushing for mi_json TODO: find a proper way for handling flushing, since the current implementation leads to a infinite loop (cherry picked from commit 0d47a32d18c656a22aa536f5eeb24e3310ade481) --- modules/mi_json/http_fnc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/mi_json/http_fnc.c b/modules/mi_json/http_fnc.c index 43446e18064..66a0066e956 100644 --- a/modules/mi_json/http_fnc.c +++ b/modules/mi_json/http_fnc.c @@ -311,8 +311,9 @@ struct mi_root* mi_json_run_mi_cmd(const str* miCmd, const str* params, html_page_data.buffer.s = buffer->s; html_page_data.buffer.len = buffer->len; + /* FIXME: find a proper way for handling flushing */ mi_rpl = run_mi_cmd(f, mi_cmd, - (mi_flush_f *)mi_json_flush_tree, &html_page_data); + NULL, &html_page_data); if (mi_rpl == NULL) { LM_ERR("failed to process the command\n"); if (mi_cmd) free_mi_tree(mi_cmd); From fe6533689857f165f2c77a5c65f0b248cac82ef3 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 11 Dec 2013 13:11:58 +0200 Subject: [PATCH 119/159] revert bogus commit for mi_json --- modules/mi_json/http_fnc.c | 580 ------------------------------------- 1 file changed, 580 deletions(-) delete mode 100644 modules/mi_json/http_fnc.c diff --git a/modules/mi_json/http_fnc.c b/modules/mi_json/http_fnc.c deleted file mode 100644 index 66a0066e956..00000000000 --- a/modules/mi_json/http_fnc.c +++ /dev/null @@ -1,580 +0,0 @@ -/* - * This file is part of Open SIP Server (opensips). - * - * opensips is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * opensips is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * History: - * --------- - * 2013-10-31 first version (shimaore) - */ - - -#include "../../str.h" -#include "../../ut.h" -#include "../../mem/mem.h" -#include "../../mem/shm_mem.h" -#include "../../mi/mi.h" -#include "../../config.h" -#include "../../globals.h" -#include "../../locking.h" - -#include "http_fnc.h" - -extern str http_root; - -mi_json_page_data_t html_page_data; - -gen_lock_t* mi_json_lock; - -struct page_buf { - char *current; - char *buf; - int max_page_len; - short status; -}; - -static inline void MI_JSON_COPY(struct page_buf* pb, const str s) { - if ( pb->status ) { - return; - } - if ( s.s == NULL || s.len == 0 ) { - return; - } - if ( (int)(pb->current - pb->buf) + s.len > pb->max_page_len) { - pb->status = -1; - } else { - memcpy(pb->current, s.s, s.len); - pb->current += s.len; - } -} - -static const str MI_JSON_ESC = str_init("\\"); - -static inline void MI_JSON_ESC_COPY(struct page_buf* pb, const str s) { - str temp_holder; - int temp_counter; - if( pb->status ) { - return; - } - if( s.s == NULL || s.len == 0 ) { - return; - } - temp_holder.s = s.s; - temp_holder.len = 0; - for(temp_counter=0;temp_counterpage, - html_p_data->buffer.len, - tree); - return 0; -} - - -static void mi_json_close_async(struct mi_root *mi_rpl, struct mi_handler *hdl, int done) -{ - struct mi_root *shm_rpl = NULL; - gen_lock_t* lock; - mi_json_async_resp_data_t *async_resp_data; - - if (hdl==NULL) { - LM_CRIT("null mi handler\n"); - return; - } - - LM_DBG("mi_root [%p], hdl [%p], hdl->param [%p], " - "*hdl->param [%p] and done [%u]\n", - mi_rpl, hdl, hdl->param, *(struct mi_root **)hdl->param, done); - - if (!done) { - /* we do not pass provisional stuff (yet) */ - if (mi_rpl) free_mi_tree( mi_rpl ); - return; - } - - async_resp_data = - (mi_json_async_resp_data_t*)((char*)hdl+sizeof(struct mi_handler)); - lock = async_resp_data->lock; - lock_get(lock); - if (mi_rpl!=NULL && (shm_rpl=clone_mi_tree( mi_rpl, 1))!=NULL) { - *(struct mi_root **)hdl->param = shm_rpl; - } else { - LM_WARN("Unable to process async reply [%p]\n", mi_rpl); - /* mark it as invalid */ - hdl->param = NULL; - } - LM_DBG("shm_rpl [%p], hdl [%p], hdl->param [%p], *hdl->param [%p]\n", - shm_rpl, hdl, hdl->param, - (hdl->param)?*(struct mi_root **)hdl->param:NULL); - lock_release(lock); - - if (mi_rpl) free_mi_tree(mi_rpl); - - return; -} - -static inline struct mi_handler* mi_json_build_async_handler(void) -{ - struct mi_handler *hdl; - mi_json_async_resp_data_t *async_resp_data; - unsigned int len; - - len = sizeof(struct mi_handler)+sizeof(mi_json_async_resp_data_t); - hdl = (struct mi_handler*)shm_malloc(len); - if (hdl==NULL) { - LM_ERR("oom\n"); - return NULL; - } - - memset(hdl, 0, len); - async_resp_data = - (mi_json_async_resp_data_t*)((char*)hdl+sizeof(struct mi_handler)); - - hdl->handler_f = mi_json_close_async; - hdl->param = (void*)&async_resp_data->tree; - - async_resp_data->lock = mi_json_lock; - - LM_DBG("hdl [%p], hdl->param [%p], *hdl->param [%p] mi_json_lock=[%p]\n", - hdl, hdl->param, (hdl->param)?*(struct mi_root **)hdl->param:NULL, - async_resp_data->lock); - - return hdl; -} - -struct mi_root* mi_json_run_mi_cmd(const str* miCmd, const str* params, - str *page, str *buffer, struct mi_handler **async_hdl) -{ - struct mi_cmd *f; - struct mi_node *node; - struct mi_root *mi_cmd; - struct mi_root *mi_rpl; - struct mi_handler *hdl; - str val; - int i, j; - - LM_DBG("got command=%.*s\n", miCmd->len, miCmd->s); - - f = lookup_mi_cmd(miCmd->s, miCmd->len); - if (f == NULL) { - LM_ERR("unable to find mi command [%.*s]\n", miCmd->len, miCmd->s); - goto error; - } - - if (f->flags&MI_ASYNC_RPL_FLAG) { - LM_DBG("command=%.*s is async\n", miCmd->len, miCmd->s); - /* We need to build an async handler */ - hdl = mi_json_build_async_handler(); - if (hdl==NULL) { - LM_ERR("failed to build async handler\n"); - goto error; - } - } else { - hdl = NULL; - } - *async_hdl = hdl; - - if (f->flags&MI_NO_INPUT_FLAG) { - LM_DBG("command=%.*s requires no parameters\n", miCmd->len, miCmd->s); - mi_cmd = NULL; - } else { - LM_DBG("command=%.*s accepts parameters\n", miCmd->len, miCmd->s); - if (params->s) { - mi_cmd = init_mi_tree(0,0,0); - if (mi_cmd==NULL) { - LM_ERR("the MI tree cannot be initialized!\n"); - goto error; - } - i = 0; - j = 0; - for( i = 0; i < params->len; i++ ) { - if (params->s[i] == ',') { - val.s = params->s + j; - val.len = i-j; - LM_DBG("got string param [%.*s]\n", val.len, val.s); - node = &mi_cmd->node; - if(!add_mi_node_child(node,0,NULL,0,val.s,val.len)){ - LM_ERR("cannot add the child node to the tree\n"); - free_mi_tree(mi_cmd); - goto error; - } - j = i+1; - } - } - if( j < params->len ) { - val.s = params->s + j; - val.len = params->len-j; - LM_DBG("got string param [%.*s]\n", val.len, val.s); - node = &mi_cmd->node; - if(!add_mi_node_child(node,0,NULL,0,val.s,val.len)){ - LM_ERR("cannot add the child node to the tree\n"); - free_mi_tree(mi_cmd); - goto error; - } - } - mi_cmd->async_hdl = hdl; - } else { - LM_DBG("but no parameters were found\n"); - mi_cmd = init_mi_tree(0,0,0); - if (mi_cmd==NULL) { - LM_ERR("the MI tree cannot be initialized!\n"); - goto error; - } - } - } - - html_page_data.page.s = buffer->s; - html_page_data.page.len = 0; - html_page_data.buffer.s = buffer->s; - html_page_data.buffer.len = buffer->len; - - /* FIXME: find a proper way for handling flushing */ - mi_rpl = run_mi_cmd(f, mi_cmd, - NULL, &html_page_data); - if (mi_rpl == NULL) { - LM_ERR("failed to process the command\n"); - if (mi_cmd) free_mi_tree(mi_cmd); - goto error; - } else if (mi_rpl != MI_ROOT_ASYNC_RPL) { - *page = html_page_data.page; - } - LM_DBG("got mi_rpl=[%p]\n",mi_rpl); - - if (mi_cmd) free_mi_tree(mi_cmd); - return mi_rpl; - -error: - return NULL; -} - - -static inline int mi_json_write_node_array(struct page_buf* pb, - struct mi_node *node) -{ - LM_DBG("start\n"); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, node->value); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - - node->flags |= MI_WRITTEN; - return pb->status; -} -static inline int mi_json_write_node_hash(struct page_buf* pb, - struct mi_node *node) -{ - LM_DBG("start\n"); - - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, node->name); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_COPY(pb, MI_JSON_COLON); - if (node->value.s!=NULL) { - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, node->value); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - } else { - MI_JSON_COPY(pb, MI_JSON_NULL); - } - - node->flags |= MI_WRITTEN; - return pb->status; -} - -static inline int mi_json_write_node(struct page_buf* pb, - struct mi_node *node) -{ - struct mi_attr *attr; - LM_DBG("start\n"); - - /* name */ - MI_JSON_COPY(pb, MI_JSON_KEY_NAME); - if (node->name.s!=NULL) { - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, node->name); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - } else { - MI_JSON_COPY(pb, MI_JSON_NULL); - } - MI_JSON_COPY(pb, MI_JSON_COMMA); - - /* value */ - MI_JSON_COPY(pb, MI_JSON_KEY_VALUE); - if (node->value.s!=NULL) { - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, node->value); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - } else { - MI_JSON_COPY(pb, MI_JSON_NULL); - } - MI_JSON_COPY(pb, MI_JSON_COMMA); - - /* attributes */ - MI_JSON_COPY(pb, MI_JSON_KEY_ATTRIBUTES); - MI_JSON_COPY(pb, MI_JSON_OBJECT_START); - for(attr=node->attributes;attr!=NULL;attr=attr->next) { - if (attr->name.s!=NULL) { - /* attribute name */ - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, attr->name); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_COPY(pb, MI_JSON_COLON); - - /* attribute value */ - if (attr->value.s!=NULL) { - MI_JSON_COPY(pb, MI_JSON_SQUOT); - MI_JSON_ESC_COPY(pb, attr->value); - MI_JSON_COPY(pb, MI_JSON_SQUOT); - } else { - MI_JSON_COPY(pb, MI_JSON_NULL); - } - } - if (attr->next!=NULL) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - } - } - MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); - - return pb->status; -} - -/* sync case */ -static int mi_json_recur_write_tree(struct page_buf* pb, - struct mi_node *tree) -{ - int names = 0; - int values = 0; - int attributes = 0; - int kids = 0; - struct mi_node* t; - LM_DBG("start\n"); - for( t = tree; t ; t=t->next ) { - if(t->name.s) { - names++; - } - if(t->value.s) { - values++; - } - if(t->attributes) { - attributes++; - } - if(t->kids) { - kids++; - } - } - - if(names == 0 && values > 0 && attributes == 0 && kids == 0) { - LM_DBG("Treat as an array\n"); - /* Treat as an array */ - MI_JSON_COPY(pb, MI_JSON_ARRAY_START); - for( t = tree; t; t=t->next ) { - mi_json_write_node_array(pb,t); - t->flags |= MI_WRITTEN; - if(t->next) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - } - } - MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); - LM_DBG("done\n"); - return 0; - } - if(names >= values && attributes == 0 && kids == 0) { - LM_DBG("Treat as a hash\n"); - /* Treat as a hash */ - MI_JSON_COPY(pb, MI_JSON_OBJECT_START); - for( t = tree; t; t=t->next ) { - LM_DBG("t = %p\n",t); - mi_json_write_node_hash(pb,t); - t->flags |= MI_WRITTEN; - if(t->next) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - } - } - MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); - LM_DBG("done\n"); - return 0; - } - if(names == 0 && values == 0 && attributes == 0 && kids > 0) { - LM_DBG("Treat as an array of objects\n"); - /* Treat as an array of objects */ - MI_JSON_COPY(pb, MI_JSON_ARRAY_START); - for( t = tree; t; t=t->next ) { - mi_json_recur_write_tree(pb,t->kids); - t->flags |= MI_WRITTEN; - if(t->next) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - } - } - MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); - LM_DBG("done\n"); - return 0; - } - - /* Otherwise */ - LM_DBG("Treat as a complex array of hashes\n"); - /* Treat as a complex array of hashes */ - MI_JSON_COPY(pb, MI_JSON_ARRAY_START); - for( t = tree; t; t=t->next ) { - MI_JSON_COPY(pb, MI_JSON_OBJECT_START); - mi_json_write_node(pb,t); - if (t->kids) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - MI_JSON_COPY(pb, MI_JSON_KEY_CHILDREN); - mi_json_recur_write_tree(pb, t->kids); - } - MI_JSON_COPY(pb, MI_JSON_OBJECT_STOP); - if(t->next) { - MI_JSON_COPY(pb, MI_JSON_COMMA); - } - } - MI_JSON_COPY(pb, MI_JSON_ARRAY_STOP); - LM_DBG("done\n"); - return pb->status; -} - - -int mi_json_build_content(str *page, int max_page_len, - struct mi_root* tree) -{ - struct page_buf pb; - LM_DBG("start\n"); - - pb.buf = page->s; - pb.current = page->s + page->len; - pb.max_page_len = max_page_len; - pb.status = 0; - - if (tree) { /* Build mi reply */ - mi_json_recur_write_tree(&pb, tree->node.kids); - page->len = pb.current - page->s; - } - LM_DBG("done\n"); - return pb.status; -} - - -int mi_json_build_page(str *page, int max_page_len, - struct mi_root *tree) -{ - LM_DBG("start\n"); - return mi_json_build_content(page, max_page_len, tree); -} - - -/* async case */ -static int mi_json_recur_flush_tree(struct page_buf* pb, - struct mi_node *tree) -{ - struct mi_node *kid; - LM_DBG("start\n"); - - for(kid = tree->kids ; kid ; ){ - if (kid->flags & MI_NOT_COMPLETED) { - return 1; - } - } - - mi_json_recur_write_tree(pb,tree); - LM_DBG("done\n"); - return pb->status; -} - -int mi_json_flush_content(str *page, int max_page_len, - struct mi_root* tree) -{ - struct page_buf pb; - LM_DBG("start\n"); - pb.buf = page->s; - pb.current = page->s + page->len; - pb.max_page_len = max_page_len; - pb.status = 0; - - if (tree) { /* Build mi reply */ - mi_json_recur_flush_tree(&pb, &tree->node); - page->len = pb.current - page->s; - } - LM_DBG("done\n"); - return pb.status; -} From f56a971ecf7c98ae013d890c6edb89154463fd3c Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Sun, 15 Dec 2013 11:09:01 -0800 Subject: [PATCH 120/159] Merge pull request #150 from staskobzar/master opensipsctl is calling ds_relaod for dr instead of dr_reload (cherry picked from commit 6b6be3057762fb9d0e98bcea104e02d45a30b4c2) --- scripts/opensipsctl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/opensipsctl b/scripts/opensipsctl index 1b27013b94d..12302f1c681 100755 --- a/scripts/opensipsctl +++ b/scripts/opensipsctl @@ -1402,7 +1402,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgw) shift @@ -1452,7 +1452,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmcr) shift @@ -1500,7 +1500,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgrp) shift @@ -1552,7 +1552,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgrule) shift From 39c76cf2f625ad567ce32bda9938e1d25277864f Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Sun, 15 Dec 2013 21:28:31 +0200 Subject: [PATCH 121/159] Fixed bogus triggering of PUBLISHing for non-INVITE sequential requests. Credits go to Damien Sandras Closes pull request #149 (cherry picked from commit e0cc9d009151a086f42c08d7f8092b8c7d5835ed) --- modules/pua_dialoginfo/pua_dialoginfo.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/pua_dialoginfo/pua_dialoginfo.c b/modules/pua_dialoginfo/pua_dialoginfo.c index 93a05999787..ee21f5d1d34 100644 --- a/modules/pua_dialoginfo/pua_dialoginfo.c +++ b/modules/pua_dialoginfo/pua_dialoginfo.c @@ -314,13 +314,16 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para dialog_publish("terminated", &peer_to_body, &from, &(dlg->callid), 0, 0, 0, 0); break; case DLGCB_RESPONSE_WITHIN: - if (get_cseq(msg)->method_id==METHOD_INVITE || get_cseq(msg)->method_id==METHOD_INVITE) { - if (msg->flags & nopublish_flag) { - LM_DBG("nopublish flag was set for this INVITE\n"); - break; - } - LM_DBG("nopublish flag not set for this INVITE, will publish\n"); - } + if (get_cseq(msg)->method_id==METHOD_INVITE) { + if (msg->flags & nopublish_flag) { + LM_DBG("nopublish flag was set for this INVITE\n"); + break; + } + LM_DBG("nopublish flag not set for this INVITE, will publish\n"); + } else { + /* no publish for non-INVITEs */ + break; + } case DLGCB_CONFIRMED: LM_DBG("dialog confirmed, from=%.*s\n", dlg->from_uri.len, dlg->from_uri.s); if(flag == DLG_PUB_AB || flag == DLG_PUB_A) From f2d32ec4e5f20e412a2353372b90c8710cd59900 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Mon, 16 Dec 2013 17:10:48 -0500 Subject: [PATCH 122/159] Makefile.conf.template: add newline at end of file (cherry picked from commit 55bde1d8e2d3d387a796e2a9ed8fcbd6876185d3) --- Makefile.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.conf b/Makefile.conf index 059f04a948c..c1b05031ecb 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -84,4 +84,4 @@ DEFS+= -DUSE_TCP #Compiles in TCP support #DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code #DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC -PREFIX=/usr/ \ No newline at end of file +PREFIX=/usr/ From 3b1761a303f93a0fae7209e0577c8fcdb12bddbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 17 Dec 2013 11:15:46 +0100 Subject: [PATCH 123/159] mediaproxy: always parse To header (cherry picked from 359db7f8713921042d14beffd83b5b07e40536fe) --- modules/mediaproxy/mediaproxy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c index 56e4c50fcbe..6043af2421f 100644 --- a/modules/mediaproxy/mediaproxy.c +++ b/modules/mediaproxy/mediaproxy.c @@ -510,6 +510,11 @@ get_to_uri(struct sip_msg *msg) str uri; char *ptr; + if (parse_headers(msg, HDR_TO_F, 0) == -1) { + LM_ERR("failed to parse To header\n"); + return unknown; + } + if (!msg->to) { LM_ERR("missing To header\n"); return unknown; @@ -564,6 +569,11 @@ get_to_tag(struct sip_msg *msg) return undefined; } + if (parse_headers(msg, HDR_TO_F, 0) == -1) { + LM_ERR("failed to parse To header\n"); + return undefined; + } + if (!msg->to) { LM_ERR("missing To header\n"); return undefined; From 15f435e1edc30d6e98915514c7ebb01948393438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 20 Dec 2013 12:14:22 +0100 Subject: [PATCH 124/159] mediaproxy: fixed detecting messages without a body (cherry picked from e4a334eaba6e7f402fd26a9e354428b066fc6835) --- modules/mediaproxy/mediaproxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c index 6043af2421f..625372bd269 100644 --- a/modules/mediaproxy/mediaproxy.c +++ b/modules/mediaproxy/mediaproxy.c @@ -690,8 +690,8 @@ check_content_type(struct sip_msg *msg) static int get_sdp_message(struct sip_msg *msg, str *sdp) { - if ( get_body(msg, sdp)!=0 || sdp->len==0) - return -1; + if (get_body(msg, sdp)!=0 || sdp->len==0) + return -2; if (!check_content_type(msg)) return -1; From 530556551227e4d417a40dc1cf91fba3411269e4 Mon Sep 17 00:00:00 2001 From: Nick Altmann Date: Fri, 10 Jan 2014 08:03:04 +0400 Subject: [PATCH 125/159] Fixed bugs with processing m4 in fedora init scripts --- packaging/fedora/opensips.init | 14 ++++++++------ packaging/fedora/opensips.m4cfg | 32 ++++++++++++++++++++++++++++++++ packaging/fedora/opensips.spec | 2 +- 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 packaging/fedora/opensips.m4cfg diff --git a/packaging/fedora/opensips.init b/packaging/fedora/opensips.init index 5bf50cde603..b2f0a2256a8 100644 --- a/packaging/fedora/opensips.init +++ b/packaging/fedora/opensips.init @@ -21,12 +21,13 @@ . /etc/rc.d/init.d/functions prog=opensips -oser=/usr/sbin/$prog +opensips=/usr/sbin/$prog +cfgdir="/etc/$prog" pidfile="/var/run/$prog.pid" lockfile="/var/lock/subsys/$prog" -configfile="/etc/$prog/$prog.cfg" -m4configfile="/etc/$prog/$prog.m4" -m4archivedir="/etc/$prog/archive" +configfile="$cfgdir/$prog.cfg" +m4configfile="$cfgdir/$prog.m4" +m4archivedir="$cfgdirg/archive" OPTIONS="" RETVAL=0 @@ -43,9 +44,10 @@ start() { # Generate config from M4 if [ -f $m4configfile ]; then + cd "$cfgdir" m4 -Q $m4configfile >$configfile.tmp if [ $? != 0 ]; then - log "cannot process m4 macro" + echo -n "cannot process m4 macro" && failure && echo rm "$configfile.tmp" return 1 fi @@ -65,7 +67,7 @@ start() { # there is something at end of this output which is needed to # report proper [ OK ] status in Fedora scripts - daemon $oser -u $prog -g $prog -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 + daemon $opensips -u $prog -g $prog -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile diff --git a/packaging/fedora/opensips.m4cfg b/packaging/fedora/opensips.m4cfg new file mode 100644 index 00000000000..e871e352056 --- /dev/null +++ b/packaging/fedora/opensips.m4cfg @@ -0,0 +1,32 @@ +#!/bin/bash + +prog=opensips +cfgdir="/etc/$prog" +configfile="$cfgdir/$prog.cfg" +m4configfile="$cfgdir/$prog.m4" +m4archivedir="$cfgdir/archive" + +# Generate config from M4 +if [ -f $m4configfile ]; then + cd "$cfgdir" + m4 -Q $m4configfile >$configfile.tmp + if [ $? != 0 ]; then + echo "cannot process m4 macro" + rm "$configfile.tmp" + exit 1 + fi + + [ -e $configfile ] || touch $configfile + + # compare configs + if [ `md5sum ${configfile}|awk '{print $1}'` != `md5sum ${configfile}.tmp|awk '{print $1}'` ]; then + mkdir -p "${m4archivedir}" + mv "${configfile}" "${m4archivedir}/${prog}.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "${configfile}.tmp" "${configfile}" + chown ${prog}:${prog} ${configfile} + chmod 640 ${configfile} +fi + +exit 0 diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index ba4e5fee45c..9f661e21949 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -786,7 +786,7 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %if 0%{?fedora} > 16 %{_unitdir}/%{name}.service %{_sysconfdir}/tmpfiles.d/%{name}.conf -%{_sbindir}/opensips-m4cfg +%{_sbindir}/%{name}-m4cfg %dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name} %else %attr(755,root,root) %{_initrddir}/opensips From 8555a91fa3cc32127358a631d2ff5a29b138ea94 Mon Sep 17 00:00:00 2001 From: Bogdan Andrei IANCU Date: Fri, 10 Jan 2014 03:25:51 -0800 Subject: [PATCH 126/159] Merge pull request #156 from lovelle/1.8 Add new line in dbt_base.c for info message log --- modules/db_text/dbt_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index d12371607b5..e63d9af0adf 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -95,7 +95,7 @@ db_con_t* dbt_init(const str* _sqlurl) memset(_res, 0, sizeof(db_con_t) + sizeof(dbt_con_t)); _res->tail = (unsigned long)((char*)_res+sizeof(db_con_t)); - LM_INFO("using database at: %.*s", _s.len, _s.s); + LM_INFO("using database at: %.*s\n", _s.len, _s.s); DBT_CON_CONNECTION(_res) = dbt_cache_get_db(&_s); if (!DBT_CON_CONNECTION(_res)) { From 1e486f83f0d55a7d98c5598308df73fab2f80cb3 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Tue, 14 Jan 2014 17:24:22 +0200 Subject: [PATCH 127/159] properly print statistics while running "-V" (cherry picked from commit e8195fc099efbd0af6c1b5ebfced857da5dab31d) --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index 52c21d10bf5..65ee6372017 100644 --- a/version.h +++ b/version.h @@ -28,7 +28,7 @@ #define OPENSIPS_FULL_VERSION NAME " " VERSION " (" ARCH "/" OS ")" -#ifdef STATS +#ifdef STATISTICS #define STATS_STR "STATS: On" #else #define STATS_STR "STATS: Off" From 8d725d0571eb62386e9794fdbc5b570e639c636c Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 15 Jan 2014 13:53:42 +0200 Subject: [PATCH 128/159] "Interrupted system call" on "select" must not be reported as error/warning --- modules/httpd/httpd_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/httpd/httpd_proc.c b/modules/httpd/httpd_proc.c index 3c579270081..bbbe56affce 100644 --- a/modules/httpd/httpd_proc.c +++ b/modules/httpd/httpd_proc.c @@ -687,7 +687,7 @@ void httpd_proc(int rank) return; break; case EINTR: - LM_WARN("error returned by select: EINTR [%d] " + LM_DBG("failure returned by select: EINTR [%d] " "(Non blocked signal caught)\n", status); break; case EINVAL: From a36e379ff63acc6b7f74484e88205b831f82a9f5 Mon Sep 17 00:00:00 2001 From: vladpaiu Date: Wed, 15 Jan 2014 08:26:30 -0800 Subject: [PATCH 129/159] Merge pull request #160 from rrb3942/localcache_counter_expire Do not reset counter expiration on incr/decr(cherry picked from commit 11a74d7c6dcf1578672b337923729bf3a0aa4a33) --- modules/cachedb_local/hash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/cachedb_local/hash.c b/modules/cachedb_local/hash.c index f4748933483..2618dbbc7b7 100644 --- a/modules/cachedb_local/hash.c +++ b/modules/cachedb_local/hash.c @@ -221,6 +221,7 @@ int lcache_htable_add(cachedb_con *con,str *attr,int val,int expires,int *new_va } old_value+=val; + expires = it->expires; new_value = sint2str(old_value,&new_len); it = shm_realloc(it,sizeof(lcache_entry_t) + attr->len +new_len); if (it == NULL) { @@ -236,13 +237,10 @@ int lcache_htable_add(cachedb_con *con,str *attr,int val,int expires,int *new_va it->attr.s = (char*)(it + 1); it->value.s =(char *)(it + 1) + attr->len; - + it->expires = expires; + memcpy(it->value.s,new_value,new_len); it->value.len = new_len; - if( expires != 0) { - LM_DBG("key %.*s will expire in %d s\n",attr->len,attr->s,expires); - it->expires = get_ticks() + expires; - } lock_release(&cache_htable[hash_code].lock); if (new_val) *new_val = old_value; From d31d3328785ff4c7b8825ff89110a377f3196347 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 30 Jan 2014 13:34:49 +0200 Subject: [PATCH 130/159] Fix "mf_process_maxfwd_header" retcode in case of parsing errors (cherry picked from commit 707982e4ec75f33a1feb5fb00b8b1b71ef77a6bf) --- modules/maxfwd/maxfwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/maxfwd/maxfwd.c b/modules/maxfwd/maxfwd.c index 395fe3559d5..bb0e5696501 100644 --- a/modules/maxfwd/maxfwd.c +++ b/modules/maxfwd/maxfwd.c @@ -152,7 +152,7 @@ static int w_process_maxfwd_header(struct sip_msg* msg, char* str1,char* str2) return 2; /* error */ case -2: - break; + goto error; /* found */ case 0: return -1; From 26044bfee42c28d3d53516fbe54080a3a9420a87 Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Wed, 5 Feb 2014 09:35:14 +0100 Subject: [PATCH 131/159] digest+m_auth: Allow a domain in the digest username. Before this patch, a domain in the digest username was allowed: Digest username="abc@domain", realm="domain" but only if the domain is equal to the realm. This was introduced in a92bf789 (Juha Heinanen, Mar. 29 2006). The SIP spec. doesn't mention any such restriction. This patch undoes that commit and makes sure the whole username is used when authenticating through `pv_www_authorize` and `pv_proxy_authorize`. That makes the following valid: Digest username="abc@domain", realm="something different" --- modules/auth/auth_mod.c | 6 +++--- parser/digest/digest.c | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/auth/auth_mod.c b/modules/auth/auth_mod.c index 80f399fe314..9f397889bf0 100644 --- a/modules/auth/auth_mod.c +++ b/modules/auth/auth_mod.c @@ -366,11 +366,11 @@ static inline int auth_get_ha1(struct sip_msg *msg, struct username* _username, pv_value_destroy(&sval); return 1; } - if(sval.rs.len!= _username->user.len - || strncasecmp(sval.rs.s, _username->user.s, sval.rs.len)) + if(sval.rs.len!= _username->whole.len + || strncasecmp(sval.rs.s, _username->whole.s, sval.rs.len)) { LM_DBG("username mismatch [%.*s] [%.*s]\n", - _username->user.len, _username->user.s, sval.rs.len, sval.rs.s); + _username->whole.len, _username->whole.s, sval.rs.len, sval.rs.s); pv_value_destroy(&sval); return 1; } diff --git a/parser/digest/digest.c b/parser/digest/digest.c index 4483e5b7619..2d5702d7ec7 100644 --- a/parser/digest/digest.c +++ b/parser/digest/digest.c @@ -115,13 +115,6 @@ dig_err_t check_dig_cred(dig_cred_t* _c) /* Realm must be present */ if (_c->realm.s == 0) res |= E_DIG_REALM; - /* If Username has domain, it must equal to Realm */ - if (_c->username.domain.s && - ((_c->username.domain.len != _c->realm.len) || - (strncmp(_c->username.domain.s, _c->realm.s, - _c->realm.len) != 0))) - res |= E_DIG_DOMAIN; - /* Nonce that was used must be specified */ if (_c->nonce.s == 0) res |= E_DIG_NONCE; From d83619e022f095b622a5df887f22c08e6c97b910 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 5 Feb 2014 19:42:13 +0200 Subject: [PATCH 132/159] Fixed bogus test over the presence of a request route. This was generating bogus warning messages to the logs, but without any negative impact over the actual processing. Credits go to rrb3942 on GITHUB Closes issue #162 --- modules/b2b_entities/dlg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 67ae93de186..5d916e2ff8c 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -795,7 +795,7 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) logic_notify: etype = (table==server_htable?B2B_SERVER:B2B_CLIENT); - if(req_routeid) + if(req_routeid > 0) { lock_release(&table[hash_index].lock); run_top_route(rlist[req_routeid].a, msg); From 13f43255e98ecbfa0be966d4eebcb673883f2036 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Wed, 5 Feb 2014 18:22:09 -0500 Subject: [PATCH 133/159] cachedb_mongodb: fix BSON_DATE conversion (cherry picked from commit abdcbaf5731ddea8de37d23a9e7a65b7388db66a) --- modules/cachedb_mongodb/cachedb_mongodb_dbase.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c index ecf163921ed..5b408b45c1d 100644 --- a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c +++ b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c @@ -1456,30 +1456,38 @@ int mongo_db_query_trans(cachedb_con *con,const str *table,const db_key_t* _k, c /* we treat null values as DB string */ VAL_TYPE(cur_val) = DB_STRING; VAL_NULL(cur_val) = 1; + LM_DBG("Found empty [%.*s]\n", _c[j]->len, _c[j]->s); } else { switch( bson_iterator_type( &it ) ) { case BSON_INT: VAL_TYPE(cur_val) = DB_INT; VAL_INT(cur_val) = bson_iterator_int(&it); - LM_DBG("found int %d\n",bson_iterator_int(&it)); + LM_DBG("Found int [%.*s]=[%d]\n", + _c[j]->len, _c[j]->s, VAL_INT(cur_val)); break; case BSON_DOUBLE: VAL_TYPE(cur_val) = DB_DOUBLE; VAL_DOUBLE(cur_val) = bson_iterator_double(&it); - LM_DBG("found double %f\n",bson_iterator_double(&it)); + LM_DBG("Found double [%.*s]=[%f]\n", + _c[j]->len, _c[j]->s, VAL_DOUBLE(cur_val)); break; case BSON_STRING: VAL_TYPE(cur_val) = DB_STRING; VAL_STRING(cur_val) = bson_iterator_string(&it); - LM_DBG("Found string %s\n",bson_iterator_string(&it)); + LM_DBG("Found string [%.*s]=[%s]\n", + _c[j]->len, _c[j]->s, VAL_STRING(cur_val)); break; case BSON_LONG: VAL_TYPE(cur_val) = DB_BIGINT; VAL_BIGINT(cur_val) = bson_iterator_long(&it); + LM_DBG("Found long [%.*s]=[%lld]\n", + _c[j]->len, _c[j]->s, VAL_BIGINT(cur_val)); break; case BSON_DATE: VAL_TYPE(cur_val) = DB_DATETIME; - VAL_TYPE(cur_val) = bson_iterator_time_t(&it); + VAL_TIME(cur_val) = bson_iterator_time_t(&it); + LM_DBG("Found time [%.*s]=[%d]\n", + _c[j]->len, _c[j]->s, (int)VAL_TIME(cur_val)); break; default: LM_WARN("Unsupported type %d - treating as NULL\n",bson_iterator_type(&it)); From 06a76bbc628a439df1c34242bf8a47db692621cc Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 6 Feb 2014 17:41:53 +0200 Subject: [PATCH 134/159] Fix NULL pointer deref. in "acc_db_request" when "db_url" is not set (cherry picked from commit 5d61f3789b191c04d0595aed6e1eb94392fc9e0c) --- modules/acc/acc_logic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c index e9a641a809f..fbdb8c205d0 100644 --- a/modules/acc/acc_logic.c +++ b/modules/acc/acc_logic.c @@ -210,7 +210,7 @@ int w_acc_aaa_request(struct sip_msg *rq, pv_elem_t* comment, char* foo) int w_acc_db_request(struct sip_msg *rq, pv_elem_t* comment, char *table) { struct acc_param accp; - int table_len = strlen(table); + int table_len; if (!table) { LM_ERR("db support not configured\n"); @@ -220,11 +220,13 @@ int w_acc_db_request(struct sip_msg *rq, pv_elem_t* comment, char *table) if (acc_preparse_req(rq)<0) return -1; + table_len = strlen(table); + acc_pvel_to_acc_param(rq, comment, &accp); env_set_to( rq->to ); env_set_comment( &accp ); - env_set_text(table, strlen(table)); + env_set_text(table, table_len); if (table_len == db_table_mc.len && (strncmp(table, db_table_mc.s, table_len) == 0)) { return acc_db_request(rq, NULL, &mc_ins_list); From 5760ba22c42bea5dbdedad2ba8d7da0245405b01 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Thu, 13 Feb 2014 18:20:28 +0200 Subject: [PATCH 135/159] improve docs --- modules/rtpproxy/doc/rtpproxy_admin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml index 731a0f93c50..27b66b0d375 100644 --- a/modules/rtpproxy/doc/rtpproxy_admin.xml +++ b/modules/rtpproxy/doc/rtpproxy_admin.xml @@ -501,7 +501,7 @@ xlog("Used rtpproxy $avp(rtp_sock) for callid $ci"); This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, - BRANCH_ROUTE. + BRANCH_ROUTE, FAILURE_ROUTE and LOCAL_ROUTE. <function>fix_nated_contact</function> usage From 6e5ed263459916579be66b3f911ad824e9c564ba Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Sat, 1 Mar 2014 17:40:07 +0200 Subject: [PATCH 136/159] Fix crash when printing $(ct[*]) (cherry picked from commit aeb4e886d4cd4fde00440671f913605def9db02f) --- pvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvar.c b/pvar.c index 5d878970c4f..bff13a99f2a 100644 --- a/pvar.c +++ b/pvar.c @@ -736,7 +736,7 @@ static int pv_get_contact_body(struct sip_msg *msg, pv_param_t *param, ct = ct_b->contacts; } } - } while (ct_b); + } while (ct_h); res->rs.s = pv_local_buf; res->rs.len = p - pv_local_buf; From 42718eb8a61ad45e819736311ec59b99b6fe9226 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 5 Mar 2014 14:35:11 +0200 Subject: [PATCH 137/159] Fixed the lex for tcp_max_msg_chunks and tcp_max_msg_time (cherry picked from commit 5cf71c32561c5f47abaf2cab015f7cf707be14e6) --- cfg.lex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cfg.lex b/cfg.lex index f6ab4b2b2b2..6ef1c053328 100644 --- a/cfg.lex +++ b/cfg.lex @@ -639,6 +639,8 @@ IMPORTFILE "import_file" {TCP_KEEPCOUNT} { count(); yylval.strval=yytext; return TCP_KEEPCOUNT; } {TCP_KEEPIDLE} { count(); yylval.strval=yytext; return TCP_KEEPIDLE; } {TCP_KEEPINTERVAL} { count(); yylval.strval=yytext; return TCP_KEEPINTERVAL; } +{TCP_MAX_MSG_CHUNKS} { count(); yylval.strval=yytext; return TCP_MAX_MSG_CHUNKS; } +{TCP_MAX_MSG_TIME} { count(); yylval.strval=yytext; return TCP_MAX_MSG_TIME; } {DISABLE_TLS} { count(); yylval.strval=yytext; return DISABLE_TLS; } {TLSLOG} { count(); yylval.strval=yytext; return TLS_PORT_NO; } {TLS_PORT_NO} { count(); yylval.strval=yytext; return TLS_PORT_NO; } From 916f3eec56255bff911ba6e11b1565702ea401af Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Mon, 10 Mar 2014 23:17:20 +0200 Subject: [PATCH 138/159] When updating the database records, first perform all update and inserts and then check the timeout for expired records -> records to be deleted. Doing first the delete may hide records "expired but to be updated". Credits go to Nick Altmann Closes bug #112. (cherry picked from commit 3c1164a012204e92150c5df5101aba709e4cb123) --- modules/presence/subscribe.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c index 590a0eaf8e7..460f33774c2 100644 --- a/modules/presence/subscribe.c +++ b/modules/presence/subscribe.c @@ -1471,27 +1471,12 @@ void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table, update_vals[u_version_col].nul = 0; n_update_cols++; - if(db== NULL) - { + if (db==NULL){ LM_ERR("null database connection\n"); return; } - LM_DBG("delete expired\n"); - update_vals[0].val.int_val= (int)time(NULL); - update_ops[0]= OP_LT; - CON_PS_REFERENCE(db) = &my_ps_delete; - if(dbf.use_table(db, &active_watchers_table) < 0) - { - LM_ERR("deleting expired information from database\n"); - } - - if(dbf.delete(db, update_cols, update_ops, update_vals, 1) < 0) - { - LM_ERR("deleting expired information from database\n"); - } - - for(i=0; i Date: Mon, 10 Mar 2014 23:36:41 +0200 Subject: [PATCH 139/159] Merge pull request #174 from wdoekes/wjd-fix_dialogaggr_memleak presence_dialoginfo: Fix memory leak in dlginfo_agg_nbody. (cherry picked from commit 1e02b323fa38e81949a3e8e9b3cf4e37dd9fa6e5) --- modules/presence_callinfo/add_events.c | 4 +- modules/presence_dialoginfo/notify_body.c | 71 ++++++++++++----------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/modules/presence_callinfo/add_events.c b/modules/presence_callinfo/add_events.c index cfd4e157ba1..3497417f7a3 100644 --- a/modules/presence_callinfo/add_events.c +++ b/modules/presence_callinfo/add_events.c @@ -82,7 +82,7 @@ static int callinfo_hdr_checker(struct sip_msg* msg, int* sent_reply) /* * event specific extra headers builder - for empty notifications */ -str* build_callinfo_dumy_header(str* pres_uri, str* extra_hdrs) +str* build_callinfo_dummy_header(str* pres_uri, str* extra_hdrs) { if (extra_hdrs->s == NULL) { @@ -425,7 +425,7 @@ int callinfo_add_events(void) event.evs_publ_handl = callinfo_hdr_checker; /* register the dummy Call-Info header builder */ - event.build_empty_pres_info = build_callinfo_dumy_header; + event.build_empty_pres_info = build_callinfo_dummy_header; if (pres.add_event(&event) < 0) { LM_ERR("failed to add event \"call-info\"\n"); diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index 7a39db813a9..94695b12212 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -47,6 +47,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in str* build_dialoginfo(str* pres_user, str* pres_domain); extern int force_single_dialog; +static str* _build_empty_dialoginfo(const char* pres_uri_char, str* extra_hdrs); + #define VERSION_HOLDER "00000000000" void free_xml_body(char* body) @@ -59,33 +61,23 @@ void free_xml_body(char* body) str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n, int off_index) { str* n_body= NULL; - str *pres_uri= NULL; - char buf[MAX_URI_SIZE+1]; + char pres_uri_char[MAX_URI_SIZE+1]; - if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { + if ((pres_user->len + pres_domain->len + 5) > MAX_URI_SIZE) { LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); return NULL; } - memcpy(buf, "sip:", 4); - memcpy(buf+4, pres_user->s, pres_user->len); - buf[pres_user->len+4] = '@'; - memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); - buf[pres_user->len + 5 + pres_domain->len]= '\0'; + memcpy(pres_uri_char, "sip:", 4); + memcpy(pres_uri_char + 4, pres_user->s, pres_user->len); + pres_uri_char[pres_user->len + 4] = '@'; + memcpy(pres_uri_char + pres_user->len + 5, pres_domain->s, pres_domain->len); + pres_uri_char[pres_user->len + 5 + pres_domain->len] = '\0'; - pres_uri = (str*)pkg_malloc(sizeof(str)); - if(pres_uri == NULL) - { - LM_ERR("while allocating memory\n"); - return NULL; - } - memset(pres_uri, 0, sizeof(str)); - pres_uri->s = buf; - pres_uri->len = pres_user->len + 5 + pres_domain->len; + LM_DBG("[pres_uri] %s (%d), [n]=%d\n", pres_uri_char, + pres_user->len + 5 + pres_domain->len, n); - LM_DBG("[pres_uri] %.*s, [n]=%d\n", pres_uri->len, pres_uri->s, n); - - if(body_array== NULL) - return build_empty_dialoginfo(pres_uri, NULL); + if(body_array == NULL) + return _build_empty_dialoginfo(pres_uri_char, NULL); if (n == -2) n_body= agregate_xmls(pres_user, pres_domain, body_array, 1, 1); @@ -103,10 +95,10 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n } xmlCleanupParser(); - xmlMemoryDump(); + xmlMemoryDump(); if (n_body== NULL) - n_body= build_empty_dialoginfo(pres_uri, NULL); + n_body = _build_empty_dialoginfo(pres_uri_char, NULL); return n_body; } @@ -467,12 +459,11 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) return NULL; } -str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) +static str* _build_empty_dialoginfo(const char* pres_uri_char, str* extra_hdrs) { str* nbody= 0; xmlDocPtr doc = NULL; xmlNodePtr node; - char* pres_uri_char = NULL; nbody= (str*) pkg_malloc(sizeof(str)); if(nbody== NULL) @@ -500,16 +491,7 @@ str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) xmlNewProp(node, BAD_CAST "version", BAD_CAST VERSION_HOLDER); xmlNewProp(node, BAD_CAST "state", BAD_CAST "full"); - pres_uri_char = (char*)pkg_malloc(pres_uri->len + 1); - if(pres_uri_char == NULL) - { - LM_ERR("No more memory\n"); - goto error; - } - memcpy(pres_uri_char, pres_uri->s, pres_uri->len); - pres_uri_char[pres_uri->len] = '\0'; xmlNewProp(node, BAD_CAST "entity", BAD_CAST pres_uri_char); - pkg_free(pres_uri_char); xmlDocDumpMemory(doc,(xmlChar**)(void*)&nbody->s, &nbody->len); @@ -527,3 +509,24 @@ str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) return 0; } +str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) +{ + char* pres_uri_char; + str* ret; + + pres_uri_char = (char*)pkg_malloc(pres_uri->len + 1); + if(pres_uri_char == NULL) + { + LM_ERR("No more memory\n"); + return NULL; + } + memcpy(pres_uri_char, pres_uri->s, pres_uri->len); + pres_uri_char[pres_uri->len] = '\0'; + + /* do the call with a null-terminated pres_uri */ + ret = _build_empty_dialoginfo(pres_uri_char, extra_hdrs); + + pkg_free(pres_uri_char); + + return ret; +} From 53f64612847ee5e1a8da660068ded4d5476355ea Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Tue, 11 Mar 2014 14:26:04 +0200 Subject: [PATCH 140/159] db_http: add value_delimiter parameter Add a new parameter used to specify the fields delimiters for queries variables (cherry picked from commit ab80adec1665b6416d92637d10677a696550c1db) --- modules/db_http/README | 47 ++++++++++++++++++--------- modules/db_http/db_http.c | 1 + modules/db_http/doc/db_http_admin.xml | 23 ++++++++++++- modules/db_http/http_dbase.c | 21 +++++++++--- modules/db_http/http_dbase.h | 1 + 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/modules/db_http/README b/modules/db_http/README index 5e39e9e057b..41092445976 100644 --- a/modules/db_http/README +++ b/modules/db_http/README @@ -33,7 +33,8 @@ Andrei Dragus 1.3.6. field_delimiter (str) 1.3.7. row_delimiter (str) 1.3.8. quote_delimiter (str) - 1.3.9. timeout (int) + 1.3.9. value_delimiter (str) + 1.3.10. timeout (int) 1.4. Exported Functions 1.5. Server specifications @@ -58,13 +59,14 @@ Andrei Dragus 1.7. Set field_delimiter parameter 1.8. Set row_delimiter parameter 1.9. Set quote_delimiter parameter - 1.10. Set timeout parameter - 1.11. Example query. - 1.12. Example query with variables. - 1.13. More query examples. - 1.14. NULL query example. - 1.15. Example Reply. - 1.16. Quoting Example. + 1.10. Set value_delimiter parameter + 1.11. Set timeout parameter + 1.12. Example query. + 1.13. Example query with variables. + 1.14. More query examples. + 1.15. NULL query example. + 1.16. Example Reply. + 1.17. Quoting Example. Chapter 1. Admin Guide @@ -206,14 +208,27 @@ modparam("db_http", "row_delimiter","\n") modparam("db_http", "quote_delimiter","|") ... -1.3.9. timeout (int) +1.3.9. value_delimiter (str) + + The delimiter used to separate multiple fields of a single + variable (see Section 1.5.2, “Variables”). Only one char may be + set. + + Default value is “,” + + Example 1.10. Set value_delimiter parameter +... +modparam("db_http", "value_delimiter",";") +... + +1.3.10. timeout (int) The maximum number of milliseconds that the HTTP ops are allowed to last Default value is “30000 ( 30 seconds )” - Example 1.10. Set timeout parameter + Example 1.11. Set timeout parameter ... modparam("db_http", "timeout",5000) ... @@ -236,7 +251,7 @@ modparam("db_http", "timeout",5000) apart by the query_type variable. Each type of query uses specific variables simillar to those in the opensips db_api. - Example 1.11. Example query. + Example 1.12. Example query. ... GET /presentity/?c=username,domain,event,expires HTTP/1.1 ... @@ -281,7 +296,7 @@ GET /presentity/?c=username,domain,event,expires HTTP/1.1 value. Will be present in all queries except the "SELECT" (normal query). - Example 1.12. Example query with variables. + Example 1.13. Example query with variables. ... GET /presentity/?c=username,domain,event,expires HTTP/1.1 GET /version/?k=table_name&v=xcap&c=table_version HTTP/1.1 @@ -322,7 +337,7 @@ k=id&v=100&query_type=insert Uses the q variable. This is an optional type of query. If the module is not configured to use it it will not. - Example 1.13. More query examples. + Example 1.14. More query examples. ... POST /active_watchers HTTP/1.1 @@ -342,7 +357,7 @@ k=id&op=%3D&v=100&uk=id&uv=101&query_type=update NULL values in queries are represented as a string of length 1 containing a single character with value '\0'. - Example 1.14. NULL query example. + Example 1.15. NULL query example. ... POST /active_watchers HTTP/1.1 @@ -377,7 +392,7 @@ k=id&op=%3D&v=%00&query_type=delete If the query produced an error the server must reply with a HTTP 500 reply, or with a corresponding error code (404, 401). - Example 1.15. Example Reply. + Example 1.16. Example Reply. ... int;string;blob 6;something=something;1000 @@ -397,7 +412,7 @@ int;string;blob be placed under quotes. A quote delimiter inside a value must be preceeded by another quote delimiter. - Example 1.16. Quoting Example. + Example 1.17. Quoting Example. ... int;string;blob 6;|ana;maria|;1000 diff --git a/modules/db_http/db_http.c b/modules/db_http/db_http.c index 65b9333234b..6bcaa4608a9 100644 --- a/modules/db_http/db_http.c +++ b/modules/db_http/db_http.c @@ -73,6 +73,7 @@ static param_export_t params[] = { {"field_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_col_delim}, {"row_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_line_delim}, {"quote_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_quote_delim}, + {"value_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_value_delim}, {"timeout", INT_PARAM,&db_http_timeout}, {0, 0, 0} }; diff --git a/modules/db_http/doc/db_http_admin.xml b/modules/db_http/doc/db_http_admin.xml index 49f4f30aff7..94222c733dd 100644 --- a/modules/db_http/doc/db_http_admin.xml +++ b/modules/db_http/doc/db_http_admin.xml @@ -221,6 +221,27 @@ modparam("db_http", "quote_delimiter","|")
+
+ <varname>value_delimiter</varname> (str) + + The delimiter used to separate multiple fields of a single + variable (see ). + Only one char may be set. + + + Default value is , + + + + Set <varname>value_delimiter</varname> parameter + +... +modparam("db_http", "value_delimiter",";") +... + + +
+
<varname>timeout</varname> (int) @@ -280,7 +301,7 @@ GET /presentity/?c=username,domain,event,expires HTTP/1.1
-
+
Variables A description of all the variables. Each variable can have diff --git a/modules/db_http/http_dbase.c b/modules/db_http/http_dbase.c index ebab7abbe11..dbe2274a48e 100644 --- a/modules/db_http/http_dbase.c +++ b/modules/db_http/http_dbase.c @@ -74,7 +74,7 @@ int next_state[3][256]; char line_delim = '\n'; char col_delim = ';'; -char *col_delim_s = ";"; +char *val_delim_s = ","; char quote_delim = '|'; extern int use_ssl; @@ -101,7 +101,6 @@ int set_col_delim( unsigned int type, void *val) return -1; } col_delim = v[0]; - col_delim_s = val; return 0; } @@ -135,6 +134,18 @@ int set_quote_delim( unsigned int type, void *val) } +int set_value_delim( unsigned int type, void *val) +{ + if( strlen(val) != 1) + { + LM_ERR("Only one values delimiter may be set\n"); + return -1; + } + val_delim_s = val; + + return 0; +} + str value_to_string(const db_val_t * v); @@ -194,7 +205,7 @@ static int append_keys (var_str * q,const char * name, const db_key_t* k, CHECK(append_str(q,url_encode(*k[i])),0,error); if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; } @@ -223,7 +234,7 @@ static int append_values (var_str * q,const char * name, const db_val_t* v, { CHECK(append_str(q,url_encode(value_to_string(&v[i]))),0,error); if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; @@ -262,7 +273,7 @@ static int append_ops(var_str * q,const char * name, const db_op_t* op, if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; } diff --git a/modules/db_http/http_dbase.h b/modules/db_http/http_dbase.h index da8cae24564..3a711e623fd 100644 --- a/modules/db_http/http_dbase.h +++ b/modules/db_http/http_dbase.h @@ -43,6 +43,7 @@ int set_col_delim( unsigned int type, void *val); int set_line_delim( unsigned int type, void *val); int set_quote_delim( unsigned int type, void *val); +int set_value_delim( unsigned int type, void *val); From 1e320928115f2b307895a0b89565adf5bcb46ace Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Tue, 11 Mar 2014 18:56:25 +0200 Subject: [PATCH 141/159] residential config: Also define the "xcap" db_url (cherry picked from commit 4b4ac96e13dc4686172eb4eecb9dee68be2e6f2b) --- menuconfig/configs/opensips_residential.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menuconfig/configs/opensips_residential.m4 b/menuconfig/configs/opensips_residential.m4 index 91bb138c522..504e943a535 100644 --- a/menuconfig/configs/opensips_residential.m4 +++ b/menuconfig/configs/opensips_residential.m4 @@ -175,7 +175,7 @@ ifelse(USE_PRESENCE,`yes',`#### PRESENCE modules loadmodule "xcap.so" loadmodule "presence.so" loadmodule "presence_xml.so" -modparam("presence", "db_url", +modparam("xcap|presence", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME From 5a119db9031d6231c521367847bf1b3c1b6bb7a5 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 12 Mar 2014 14:27:41 +0200 Subject: [PATCH 142/159] For topo hiding and fix_route_dialog() usage, do not try do add del lumps for already deleted route headers --- modules/dialog/dlg_handlers.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 42facd34152..0ecfa4de1a5 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -389,6 +389,7 @@ static inline void push_reply_in_dialog(struct sip_msg *rpl, struct cell* t, ((t->relaied_reply_branch>=0)? (t->uac[t->relaied_reply_branch].added_rr):0); + LM_DBG("Skipping %d ,%d, %d, %d \n",skip_rrs, dlg->from_rr_nb,t->relaied_reply_branch,t->uac[t->relaied_reply_branch].added_rr); get_routing_info(rpl, 0, &skip_rrs, &contact, &rr_set); dlg_update_routing( dlg, leg, &rr_set, &contact ); if( rr_set.s ) @@ -1547,11 +1548,14 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg) buf = req->buf; if (req->route) { - for (it=req->route;it;it=it->sibling) + for (it=req->route;it;it=it->sibling) { + if (it->parsed && ((rr_t*)it->parsed)->deleted) + continue; if ((lmp = del_lump(req,it->name.s - buf,it->len,HDR_ROUTE_T)) == 0) { LM_ERR("del_lump failed \n"); return -1; } + } } if ( leg->route_set.len !=0 && leg->route_set.s) { @@ -1614,6 +1618,8 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg) if (req->route) { for (it=req->route;it;it=it->sibling) + if (it->parsed && ((rr_t*)it->parsed)->deleted) + continue; if ((lmp = del_lump(req,it->name.s - buf,it->len,HDR_ROUTE_T)) == 0) { LM_ERR("del_lump failed \n"); return -1; From 1e2622fa02c77bb0a0289ac9ef711f9423511e44 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Wed, 12 Mar 2014 15:13:39 +0200 Subject: [PATCH 143/159] Added support for embedded arrays within MongoDB documents (cherry picked from commit 61e21a0a2d9d79b91e5e8692a7c1f3e7cc77cf83) --- .../cachedb_mongodb/cachedb_mongodb_dbase.c | 6 +- .../cachedb_mongodb/cachedb_mongodb_json.c | 105 +++++++++++++----- 2 files changed, 85 insertions(+), 26 deletions(-) diff --git a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c index 5b408b45c1d..d4399a6b140 100644 --- a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c +++ b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c @@ -584,7 +584,11 @@ int mongo_raw_find(cachedb_con *connection,bson *raw_query,cdb_raw_entry ***repl continue; } LM_ERR("Failed to run query. Err = %d, %d , %d \n",conn->err,conn->errcode,conn->lasterrcode); - mongo_cmd_get_last_error(conn,MONGO_DATABASE(connection),&err_b); + ret = mongo_cmd_get_last_error(conn,MONGO_DATABASE(connection),&err_b); + if (ret == MONGO_OK) { + LM_ERR("We had error - can't tell what it was - we're really bogus - probably mongos down\n"); + return -1; + } bson_iterator_init(&i,&err_b); while( bson_iterator_next(&i)) { LM_ERR("Fetched ERR key [%s]. Val = ",bson_iterator_key(&i)); diff --git a/modules/cachedb_mongodb/cachedb_mongodb_json.c b/modules/cachedb_mongodb/cachedb_mongodb_json.c index 397aa9def46..304c5cfcf34 100644 --- a/modules/cachedb_mongodb/cachedb_mongodb_json.c +++ b/modules/cachedb_mongodb/cachedb_mongodb_json.c @@ -191,12 +191,86 @@ int json_to_bson(char *json,bson *bb) return -1; } +void bson_to_json_generic(struct json_object *obj,bson_iterator *it,int type) +{ + const char *curr_key; + char *s; + int len; + struct json_object *obj2=NULL; + bson_iterator it2; + + while (bson_iterator_next(it)) { + curr_key=bson_iterator_key(it); + + switch( bson_iterator_type(it) ) { + case BSON_INT: + LM_DBG("Found key %s with type int\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int(bson_iterator_int(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int(bson_iterator_int(it))); + break; + case BSON_LONG: + LM_DBG("Found key %s with type long\n",curr_key); + /* no intrinsic support in OpenSIPS for 64bit integers - + * converting to string */ + s = int2str(bson_iterator_long(it),&len); + s[len]=0; + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key,json_object_new_string(s)); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_string(s)); + break; + case BSON_DOUBLE: + /* no intrinsic support in OpenSIPS for floating point numbers + * converting to int */ + LM_DBG("Found key %s with type double\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int((int)bson_iterator_double(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int((int)bson_iterator_double(it))); + break; + case BSON_STRING: + LM_DBG("Found key %s with type string\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_string(bson_iterator_string(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_string(bson_iterator_string(it))); + break; + case BSON_BOOL: + LM_DBG("Found key %s with type bool\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int((int)bson_iterator_bool(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int((int)bson_iterator_bool(it))); + break; + case BSON_ARRAY: + LM_DBG("Found key %s with type array\n",curr_key); + obj2 = json_object_new_array(); + bson_iterator_subiterator(it, &it2 ); + bson_to_json_generic(obj2,&it2,BSON_ARRAY); + json_object_object_add(obj,curr_key,obj2); + //json_object_put(obj2); + break; + default: + /* TODO - support embedded documents */ + LM_DBG("Unsupported type %d for key %s - skipping\n", + bson_iterator_type(it),curr_key); + break; + } + } +} + int mongo_cursor_to_json(mongo_cursor *m_cursor, cdb_raw_entry ***reply,int expected_kv_no,int *reply_no) { struct json_object *obj=NULL; bson_iterator it; - const char *curr_key,*p; + const char *p; int current_size=0,len; /* start with a single returned document */ @@ -229,30 +303,8 @@ int mongo_cursor_to_json(mongo_cursor *m_cursor, } obj = json_object_new_object(); - bson_iterator_init(&it,mongo_cursor_bson(m_cursor)); - while (bson_iterator_next(&it)) { - curr_key=bson_iterator_key(&it); - - switch( bson_iterator_type( &it ) ) { - case BSON_INT: - json_object_object_add(obj,curr_key, - json_object_new_int(bson_iterator_int(&it))); - break; - case BSON_DOUBLE: - json_object_object_add(obj,curr_key, - json_object_new_int((int)bson_iterator_double(&it))); - break; - case BSON_STRING: - json_object_object_add(obj,curr_key, - json_object_new_string(bson_iterator_string(&it))); - break; - default: - /* TODO - support embedded documents */ - LM_WARN("Unsupported type %d - skipping\n",bson_iterator_type(&it)); - break; - } - } + bson_to_json_generic(obj,&it,BSON_OBJECT); p = json_object_to_json_string(obj); if (!p) { @@ -279,7 +331,10 @@ int mongo_cursor_to_json(mongo_cursor *m_cursor, *reply_no = current_size; LM_DBG("Fetched %d results\n",current_size); - return 0; + if (current_size == 0) + return -2; + + return 1; error_cleanup: if (obj) From 326c45b82aeae65c00a50605250453a843f9b908 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 12 Mar 2014 17:30:47 +0200 Subject: [PATCH 144/159] update ChangeLog file for 1.10.1 --- ChangeLog | 1073 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1064 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7adaaeeaf62..0ac8dbf055c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,1058 @@ +=========================== Release 1.10.1 ============================== + +2014-03-12 Vlad Paiu + * [1e2622f] : + + Added support for embedded arrays within MongoDB documents + (cherry picked from commit 61e21a0a2d9d79b91e5e8692a7c1f3e7cc77cf83) + + +2014-03-12 Vlad Paiu + * [5a119db] : + + For topo hiding and fix_route_dialog() usage, do not try do add del lumps for already deleted route headers + + +2014-03-11 Liviu Chircu + * [1e32092] : + + residential config: Also define the "xcap" db_url + (cherry picked from commit 4b4ac96e13dc4686172eb4eecb9dee68be2e6f2b) + + +2014-03-11 Razvan Crainea + * [53f6461] : + + db_http: add value_delimiter parameter + Add a new parameter used to specify the fields delimiters for queries + variables + (cherry picked from commit ab80adec1665b6416d92637d10677a696550c1db) + + +2014-03-10 Bogdan Andrei IANCU + * [1ccb254] : + + Merge pull request #174 from wdoekes/wjd-fix_dialogaggr_memleak + presence_dialoginfo: Fix memory leak in dlginfo_agg_nbody. + (cherry picked from commit 1e02b323fa38e81949a3e8e9b3cf4e37dd9fa6e5) + + +2014-03-10 Bogdan-Andrei Iancu + * [916f3ee] : + + When updating the database records, first perform all update and inserts and then check the timeout for expired records -> records to be deleted. Doing first the delete may hide records "expired but to be updated". Credits go to Nick Altmann Closes bug #112. + (cherry picked from commit 3c1164a012204e92150c5df5101aba709e4cb123) + + +2014-03-05 Vlad Paiu + * [42718eb] : + + Fixed the lex for tcp_max_msg_chunks and tcp_max_msg_time + (cherry picked from commit 5cf71c32561c5f47abaf2cab015f7cf707be14e6) + + +2014-03-01 Liviu Chircu + * [6e5ed26] : + + Fix crash when printing $(ct[*]) + (cherry picked from commit aeb4e886d4cd4fde00440671f913605def9db02f) + + +2014-02-13 Bogdan-Andrei Iancu + * [5760ba2] : + + improve docs + + +2014-02-06 Liviu Chircu + * [06a76bb] : + + Fix NULL pointer deref. in "acc_db_request" when "db_url" is not set + (cherry picked from commit 5d61f3789b191c04d0595aed6e1eb94392fc9e0c) + + +2014-02-06 Ovidiu Sas + * [13f4325] : + + cachedb_mongodb: fix BSON_DATE conversion + (cherry picked from commit abdcbaf5731ddea8de37d23a9e7a65b7388db66a) + + +2014-02-05 Bogdan-Andrei Iancu + * [d83619e] : + + Fixed bogus test over the presence of a request route. This was generating bogus warning messages to the logs, but without any negative impact over the actual processing. Credits go to rrb3942 on GITHUB Closes issue #162 + + +2014-02-05 Walter Doekes + * [26044bf] : + + digest+m_auth: Allow a domain in the digest username. + Before this patch, a domain in the digest username was allowed: + + Digest username="abc@domain", realm="domain" + + but only if the domain is equal to the realm. This was introduced in + a92bf789 (Juha Heinanen, Mar. 29 2006). + + The SIP spec. doesn't mention any such restriction. + + This patch undoes that commit and makes sure the whole username is used + when authenticating through `pv_www_authorize` and `pv_proxy_authorize`. + That makes the following valid: + + Digest username="abc@domain", realm="something different" + + +2014-01-30 Liviu Chircu + * [d31d332] : + + Fix "mf_process_maxfwd_header" retcode in case of parsing errors + (cherry picked from commit 707982e4ec75f33a1feb5fb00b8b1b71ef77a6bf) + + +2014-01-15 vladpaiu + * [a36e379] : + + Merge pull request #160 from rrb3942/localcache_counter_expire + Do not reset counter expiration on incr/decr + (cherry picked from commit 11a74d7c6dcf1578672b337923729bf3a0aa4a33) + + +2014-01-15 Bogdan-Andrei Iancu + * [8d725d0] : + + "Interrupted system call" on "select" must not be reported as error/warning + + +2014-01-15 Razvan Crainea + * [1e486f8] : + + properly print statistics while running "-V" + (cherry picked from commit e8195fc099efbd0af6c1b5ebfced857da5dab31d) + + +2014-01-10 Bogdan Andrei IANCU + * [8555a91] : + + Merge pull request #156 from lovelle/1.8 + Add new line in dbt_base.c for info message log + + +2014-01-10 Bogdan Andrei IANCU + * [d51b53f] : + + Merge pull request #159 from nikbyte/1.10 + Fixed bugs with processing m4 in fedora init scripts + + +2014-01-10 Nick Altmann + * [5305565] : + + Fixed bugs with processing m4 in fedora init scripts + + +2013-12-20 Saúl Ibarra Corretgé + * [15f435e] : + + mediaproxy: fixed detecting messages without a body + (cherry picked from e4a334eaba6e7f402fd26a9e354428b066fc6835) + + +2013-12-20 Saúl Ibarra Corretgé + * [3b1761a] : + + mediaproxy: always parse To header + (cherry picked from 359db7f8713921042d14beffd83b5b07e40536fe) + + +2013-12-17 Ovidiu Sas + * [f2d32ec] : + + Makefile.conf.template: add newline at end of file + (cherry picked from commit 55bde1d8e2d3d387a796e2a9ed8fcbd6876185d3) + + +2013-12-15 Bogdan-Andrei Iancu + * [39c76cf] : + + Fixed bogus triggering of PUBLISHing for non-INVITE sequential requests. Credits go to Damien Sandras Closes pull request #149 + (cherry picked from commit e0cc9d009151a086f42c08d7f8092b8c7d5835ed) + + +2013-12-15 Bogdan Andrei IANCU + * [f56a971] : + + Merge pull request #150 from staskobzar/master + opensipsctl is calling ds_relaod for dr instead of dr_reload + (cherry picked from commit 6b6be3057762fb9d0e98bcea104e02d45a30b4c2) + + +2013-12-11 Razvan Crainea + * [fe65336] : + + revert bogus commit for mi_json + + +2013-12-11 Razvan Crainea + * [bd38945] : + + remove bogus flushing for mi_json + TODO: find a proper way for handling flushing, since the current + implementation leads to a infinite loop + (cherry picked from commit 0d47a32d18c656a22aa536f5eeb24e3310ade481) + + +2013-12-11 Razvan Crainea + * [dd6e62a] : + + mi_json: escape '\\' character + also fix incorrect '"' escaping + (cherry picked from commit 28b399bb166a786bb0e943ff072606d2d01d96b6) + + Conflicts: + modules/mi_json/http_fnc.c + + +2013-12-10 Bogdan-Andrei Iancu + * [0bfe616] : + + Generate proper branch param for the NAT ping requests Credits go to Varun (varunvairavan on GITHUB) Closes #145 + (cherry picked from commit 1f18541ced045645f8cbda1c73a85fe52597a1db) + + +2013-12-07 Bogdan Andrei IANCU + * [52cf171] : + + Merge pull request #135 from bat-modulis/master + Renamed permissions parameter 'from_col' to 'pattern_col' + (cherry picked from commit 10763008a99a48c0375f1a5bee32bb05231426b0) + + +2013-12-07 Bogdan Andrei IANCU + * [9134ebf] : + + Merge pull request #129 from dsandras/ds-pua-expires-refresh-fix + Fix bug where a new publication does not extend the desired expire time. + (cherry picked from commit ccac0fac1da8ad663e500148fb7f7d9e43e34fd1) + + +2013-12-06 Bogdan-Andrei Iancu + * [96921f5] : + + Fixed bogus condition in GT, GTE, LT and LTE script tests. Reported by dcb314 on GITHUB Closing issue #146 + + +2013-12-03 Răzvan Crainea + * [6a58fb6] : + + fixed doc avp names + (cherry picked from commit f93bbd32775f72a53b050ca95d31d391d91a27e8) + + +2013-12-03 vladpaiu + * [16af319] : + + Merge pull request #141 from shimaore/db_http_timeout_doc + Corrected db_http example: the timeout is an integer. + (cherry picked from commit 9a807b819927f7bbbe68dd99a483eb6ee9210385) + + +2013-12-02 Razvan Crainea + * [4115aca] : + + drouting: fix drc_table doc default value + (cherry picked from commit f25c8e1e520902fde023613cf86ef0cc675d0e32) + + +2013-12-02 Vlad Paiu + * [8079e64] : + + Properly take into account the dialplan priority in case entry matches both string and regex rules + (cherry picked from commit 0625610376acbc29f5a9f6a7a79ec897ebfe53fa) + + +2013-11-28 Ovidiu Sas + * [0ee2e29] : + + pua_dialoginfo: do not blindly load all dialogs - only dialogs with "dlg_peer" vals should be registered for callbacks + (cherry picked from commit c631abce52ee4fdbcc98434f7067ee849089af76) + + +2013-11-28 Răzvan Crainea + * [8fee8bb] : + + Merge pull request #139 from shimaore/pkg_mem_events + Allow for `event_pkg_threshold` support. + + Credits go to Stéphane Alnet (shimaore) + (cherry picked from commit 25289f0c2b0f2bd3137dc062a031be359d6e8937) + + +2013-11-27 Vlad Paiu + * [37ecc40] : + + fixed README typo + (cherry picked from commit 144e112db1f785875a671f57a727393c2a3b7764) + + +2013-11-26 Ovidiu Sas + * [b7438f2] : + + pua: set db_flag to UPDATEDB_FLAG only if there was a previous update (NO_UPDATEDB_FLAG) - in case of a server restart, if the db_flag went from INSERTDB_FLAG to UPDATEDB_FLAG the record will be lost because the record is marked as to be updated, and since there's no record in the db, the update will fail. - if the db_flag is INSERTDB_FLAG, any updates should leave the flag as is and this will cause the new record to be properly inserted (and not updated) into the db. + (cherry picked from commit 40962ceb87c1c79db5ded5ed36a5ae82bc735bf2) + + +2013-11-24 Saúl Ibarra Corretgé + * [669efaf] : + + Load xcap module, presence_xml depends on it + + +2013-11-24 Saúl Ibarra Corretgé + * [9b786aa] : + + Fixed residential example when using presence + + +2013-11-23 Bogdan Andrei IANCU + * [a5d593a] : + + Merge pull request #122 from dsandras/ds-fix-dialog-info-entity + This patch fixes the entity URI in XML documents to contain "sip:". + (cherry picked from commit 377e7574d411aa974cf469d6df18b6213b43a31f) + + +2013-11-22 Bogdan Andrei IANCU + * [f2264be] : + + Merge pull request #131 from dsandras/ds-pua-mi-warning-fix + Fixes bug where a refreshed PUBLISH request triggers an error message. + (cherry picked from commit ded0559c527f30181e9bbd494f0e63b048059108) + + +2013-11-22 Bogdan-Andrei Iancu + * [68976ca] : + + Fixed bogus warning because of variables not being reset. Reported by Jeff Pyle, part of fixing issue #126. + + +2013-11-22 Ovidiu Sas + * [94a4481] : + + uac_registrant: re-register with expires value imposed by the registrar + (cherry picked from commit f9a8d985829ed1cce3a2f0985a8c72368d0b3325) + + +2013-11-22 Liviu Chircu + * [aead3a7] : + + Fix the DB representation of message flags in the acc module + * storing flags as strings rather than bitmasks prevents flag conflicts + when doing flag modifications in the script, then restarting the proxy + * similar usrloc issue was fixed in commit 98b6b0437 + (cherry picked from commit f90e347e281b555f89ba05226175ac8d9f07c4ed) + + +2013-11-22 Razvan Crainea + * [1aab2e8] : + + revert commit ec0d05a + dialog variables might be binary, therefore strlen should not be used + (cherry picked from commit 7401a7a4a4820706aa05d96d5bebdc93c6db6b40) + + +2013-11-20 Bogdan-Andrei Iancu + * [d5f92dd] : + + Do not free the header string as it is part of the lumps (and freed together with the lumps). Reported by Jeff Pyle. Fixing bug #126 + + +2013-11-20 Bogdan-Andrei Iancu + * [f0816e0] : + + Fixed keeping turns on handling PUBLISHes for the same presentity - when presentity is deleted (due a unPUBLISH) do not do any turn related ops anymore Reported by Damien Sanders + + +2013-11-20 Vlad Paiu + * [f931f0d] : + + Reset the lump cond flags when the condition evaluates to false. + In case there are multiple branches, the conditions can evaluate + differently on each branch - which might lead to bad counting of the + added lumps ( used by the dialog module for dlg validation ) + (cherry picked from commit 24f9366858d0568a2eaa231f37d349efd2d70d96) + + +2013-11-20 Bogdan-Andrei Iancu + * [e8661d1] : + + Fixed restoring SOCKET info from AVP during failover + (cherry picked from commit cc657ffc81e13e66dfba9ffba3e5e9f380e22c1d) + + +2013-11-17 Liviu Chircu + * [a532650] : + + Mask compile-time shift/reduce conflict due to if statement ambiguity + (cherry picked from commit c4b8be1cb86ba6d169ae97b221d4986f8ecad9a4) + + +2013-11-15 Razvan Crainea + * [b4cf13a] : + + rework ratelimit distributed queries + instead of adding -1 to the counter, use the cachedb_sub function exported by + the cachedb module. This prevents ratelimit counters from adding extremely + large values for some backends (ex: memcached). + Thanks go to Brett Nemeroff for reporting and testing. + (cherry picked from commit c06183325e408f47ba4e0a1e1be274fe23581e25) + + +2013-11-04 Bogdan-Andrei Iancu + * [dcb87bc] : + + Proper usage of build_req_buf_from_sip_req() function - socket and proto are required. Closes Bug 664 on SF. + + +2013-11-04 Vlad Paiu + * [dde0516] : + + Allow drouting module to be used for DID matching only ( where you only have prefixes provisioned, no GWs, and call do_routing with the 'C' flag ) + (cherry picked from commit 92a2c9d6061462b2c818da0963e805cbfaa62904) + + +2013-11-04 Vlad Paiu + * [86cbfee] : + + Do proper return code to script from cachedb_* functions ( treat 0 as success ) + (cherry picked from commit 5635d716e0bf1ce8a23688698fe6497fadfe7f23) + + +2013-11-01 Vlad Paiu + * [50463f0] : + + Also trace the CANCEL requests in case we're doing trace_dialog() + + +2013-10-30 Ovidiu Sas + * [f1db3dd] : + + core: enhance error log for un-parsable msg by adding the source IP and port + (cherry picked from commit 57e60928db2ba2a406026565e4569155fb811b6b) + + +2013-10-29 Bogdan-Andrei Iancu + * [f792543] : + + Use proper locking function (via the generic locking API) Reported by Max E. Reyes Vera Juarez. + + +2013-10-29 Bogdan-Andrei Iancu + * [82380ca] : + + Re-install dlg callbacks (for restoring FROM/TO hdr) upon re-loading dialogs on startup. Reported by Jeff Pyle. + + +2013-10-23 Bogdan Andrei IANCU + * [5eeab0f] : + + Merge pull request #109 from rrb3942/shutdown_segfault + Reset prepared statement between query lists on shutdown + + +2013-10-23 Bogdan-Andrei Iancu + * [76bcd17] : + + Fixed the weight-based balancing alg. Credits go to Rob Gagnon (rgagnon24) + + +2013-10-23 Bogdan-Andrei Iancu + * [34d4155] : + + Proper support for BIGINT (as long) in the db_text SQL driver. Many thanks to Jeff Pyle for reporting and troubleshooting this. + + +2013-10-22 Bogdan-Andrei Iancu + * [6b259e6] : + + Removed "auto" flag for the dlg_id in DB_TEXT spec file Reported by Jeff Pyle. + + +2013-10-22 Bogdan-Andrei Iancu + * [aa52721] : + + README files regenerated from XMLs + + +2013-10-18 Bogdan-Andrei Iancu + * [55197a3] : + + Fixed bad prototype for abort when compiling with TM_TIMER_DEBUG. Reported by Mayama Takeshi Closes issue #105 + + +2013-10-18 Bogdan-Andrei Iancu + * [784e87f] : + + Fixed locking on purging profiles for terminated dialogs - in strange cases of concurancy between provisional and final replies, the profile ops for provisional reply may end up iterating on a deleted list. Reported by Trevor Francis (46labs) Closes issue #102 + + +2013-10-18 Bogdan-Andrei Iancu + * [e6f4a51] : + + Fixed accepting "after" changes in lumps attached to the beginning of a del lump Reported by NicK Altmann Solves issues with missing Route hdrs when using the dialog based TH + + +2013-10-18 Earl C. Ruby III + * [403862a] : + + The latest Linux distros from OpenSUSE, Fedora, and other non-Debian based distros no longer add symlinks for libcurses.so -> libncurses.so. Trying to compile menuconfig with -lcurses will not work on these distros, so I changed -lcurses to -lncurses, since -lncurses will work on any modern Linux distro with the ncurses5 libraries installed. + See http://stackoverflow.com/questions/1517756/whats-the-difference-between-lcurses-and-lncurses-when-compiling-c-using-ncur for more info. + (cherry picked from commit 7ae769dac06146253ea07d8d930d73f7ccaa817a) + + +2013-10-17 Razvan Crainea + * [09ab451] : + + fix ratelimit memory corruption + (cherry picked from commit 19cd04ab12fe37a4fd5685e7eabde1d435f8c8b4) + + +2013-10-15 Ovidiu Sas + * [46dbe2b] : + + uac_auth: fix memory leak reported by Jeff Pyle - affected modules: b2b_entities, uac, uac_registrant + (cherry picked from commit 868976769543970844d9001a2c68e11a3eb026b0) + + +2013-10-16 Bogdan-Andrei Iancu + * [62e7692] : + + Make pv_parse_format() more verbous on reporting the causes to fail. Reported by peppolon on IRC + + +2013-10-15 Di-Shi Sun + * [9485224] : + + 1. Added support for appending parameter string in outbound URI. 2. Removed skip plus feature for called number. + (cherry picked from commit 414504077dc72054ae6954f61b998df2ba6ffd53) + + +2013-10-10 Liviu Chircu + * [7e0aa9a] : + + Allow NULL strings to be pushed into binary interface packets + (cherry picked from commit 3a334c3042be2fbc5e7e6019c0f9c8ddef4f6922) + + +2013-10-10 Liviu Chircu + * [728bdef] : + + Fix a particular startup crash + e.g. when defining only 1 tcp interface while specifying + "disable_tcp=true" + (cherry picked from commit 101ee782480af07cd9d056b41b9f33d331d21951) + + +2013-10-07 Vlad Paiu + * [2e6b442] : + + Fixed the re-loading of dlg vars after restart Credits to Nick Altmann + (cherry picked from commit ec0d05aaef41b0a4f30419bbab1295eb4bce7e49) + + +2013-10-07 Vlad Paiu + * [52a732e] : + + Fixed topology_hiding("U") in case of no username in Contact header Credits for report & fix to Nick Altmann + (cherry picked from commit b200e11cf0308ab12c9562c552d69b1a78c52576) + + +2013-10-04 Bogdan-Andrei Iancu + * [606c02e] : + + Fixed is_mod_func_used() (used from is_script_func_used()) to determin if a function is used from script - we need to follow the IF / WHILE / MODULE set of instructions too. Reported by Mayama Takeshi - many thanks for the detailed report on this. Closes issue #98 + + +2013-10-04 Bogdan-Andrei Iancu + * [f6dea9f] : + + In DELAYED mode, flush vars & profile to DB at ACK time too - no timer tick between 200 OK and ACK was droping the update operation to DB. Please note that this "bug" had actually no implications, as dialog data is either used from memory cache, either from DB after a restart (and a shutdown flushes everything to DB). Related to issue #97. + + +2013-10-03 Bogdan-Andrei Iancu + * [c95e902] : + + handle the signals while waiting for the startup route to end (if not, the main proc will never know if the child running startup route crashed and it will hang for ever during startup) + + +2013-10-03 Bogdan-Andrei Iancu + * [8e3b9ee] : + + Merge branch 'master' of github.com:OpenSIPS/opensips + + +2013-10-03 Vlad Paiu + * [2c4b0d3] : + + Fixed menuconfig errors when selecting mi_xmlrpc vs mi_xmlrpc_ng + (cherry picked from commit 7ad1db27dd7bea313beeb97eb276c303d8339fab) + + +2013-10-03 liviuchircu + * [184a746] : + + Properly load contact flags even when NAT pinging is disabled + (cherry picked from commit 39119d1dadb09f3d0999023e41736548a0e446aa) + + +2013-10-03 liviuchircu + * [8f7e4cb] : + + Fix unpatched assignment in commit b33d4b3f + Credits to Nick Altmann for reporting, along with an initial patch + (cherry picked from commit bfcc635c4046bc94017be5166bad8867e98d4f1e) + + +2013-10-03 Bogdan-Andrei Iancu + * [c9bf445] : + + - doc examples fixed Reported by "miha" on IRC + + +2013-10-02 liviuchircu + * [1bd459e] : + + "registered" must also populate the 'attr' avp, if defined + (cherry picked from commit 286f06f2a21c269aebdbeee81d2f5a264be2518d) + + +2013-10-01 liviuchircu + * [ec236bf] : + + Fix some documentation typos + (cherry picked from commit c229d98c3074e3f3c83e99918ed30f9d7e1c8dd6) + + +2013-10-01 liviuchircu + * [6f18ea9] : + + Fix missing GPL headers in event_xmlrpc module + (cherry picked from commit 5bcab3923d0c4ed7d8d613544cc6f1a043dc78c3) + + +2013-09-27 liviuchircu + * [036fea2] : + + Fix invalid pointer when fetching the usrloc extra info column + (cherry picked from commit f2b283de399a58ed3f09f2b46dc9b92958558175) + + +2013-09-25 Bogdan-Andrei Iancu + * [7a3ef04] : + + - fixed double free when building insert fails (in buffered insert mode) Reported by Brett Nemeroff + + +2013-09-25 Bogdan-Andrei Iancu + * [743f48e] : + + - fixed overflow in parsing the content len value Reported by franklyfox on GITHUB Closing issue #78 + + +2013-09-20 Bogdan Andrei IANCU + * [2b22274] : + + Merge pull request #73 from wdoekes/wjd-pua_min_expires_doc + pua.c sets int min_expires= 300, not 0 as documentation states. + + +2013-09-20 Bogdan-Andrei Iancu + * [e16f7e1] : + + - fixed updating the index of the last DEL operation - this is essential for deciding which lumps must be skipped (as overlapping with delete parts of the message) Credits go to Nick Altmann for reporting and helping with troubleshooting. Closes issue #79 + + +2013-09-17 Damien Sandras + * [763ea32] : + + Fix PUA module so that it sends a final PUBLISH on expiration. + A final PUBLISH with expires=0 is now generated when a publication has + expired. This will trigger the transmission of a final state NOTIFY. + + Cherry picked from: c5a57a8d39cf568d6558332ca71ea8344a5a4f57 + + +2013-09-16 liviuchircu + * [85cdc6d] : + + Fix evi crash when defining more than 10 events + (cherry picked from commit ba04cba6d5f7bc945bbc42d2e46694639fea8b79) + + +2013-09-10 Razvan Crainea + * [8d5950c] : + + removed the beta flag + + +2013-09-04 Bogdan-Andrei Iancu + * [bfd86ab] : + + - UAC module does not load (no dependency) on UAC_AUTH if the uac_auth() function is not used. - UAC module does not load RR and DIALOG (with further dependencies on the params of those modules) if no FROM/TO replace ops are done. + + +2013-09-04 Bogdan-Andrei Iancu + * [da85c3a] : + + - new functions added to help a module to check if its functions are used from the script (we cannot rely on the fixup functions as we have functions without parameters or need for fixup). Such function is needed for fixing dependencies between modules (to follow up) + + +2013-09-04 liviuchircu + * [bc3c8e8] : + + Fix: allow rest_client functions in onreply_route + Credits to Jayesh Nambiar for reporting + (cherry picked from commit 6f048e038c4ae6e3e620d1b5f17cf1880fdef246) + + +2013-09-04 Bogdan-Andrei Iancu + * [0ebb2f6] : + + - fixed CANCEL matching in B2B + + +2013-09-04 Bogdan-Andrei Iancu + * [512aaca] : + + - Gracefully detect if the uac_auth modules is available for usage in b2b_entities modules - do not through an error message but rather an info one, as find the uac_auth module is optional. + + +2013-09-04 Bogdan-Andrei Iancu + * [4363dbc] : + + - when starting the FR timer, it should not override any previous setting of a FR or FR_INV timers. Solves Issue #25 (reported and troubleshooted by Mayama Takeshi) when a very fast 100 reply may stop retransmissions, but brake the updating of fr timer from FR to FR_INV state. + + +2013-09-03 Bogdan-Andrei Iancu + * [25629fc] : + + - fixed how lumps can overlap on the edge - an "add" just next to a "delete" Reported by Saul Ibarra Corretge Closes issue #59 + + +2013-09-03 Bogdan-Andrei Iancu + * [b01c688] : + + - fixed incomplete function call (resulted from the merged commit 09a291e) + + +2013-09-03 Bogdan Andrei IANCU + * [a039ec9] : + + Merge pull request #62 from dsandras/ds-dialoginfo-notifications-fixes + Fixed RFC 4235 notifications compliance. + + +2013-09-03 liviuchircu + * [63b158d] : + + Fix several usrloc named flag issues + - fix get_all_db_ucontacts() lookup logic to work with named flags + - fix "Cflags" row of MI *ul_dump* command + - fix DB contact update function to properly store the flags + (cherry picked from commit b33d4b3f019c157a5e63b21a846ad9f891da559e) + + +2013-09-02 liviuchircu + * [444207b] : + + Fix replication of dialog delete events + - instead of sending "deleted" packets based on hash delete operations, + they are now sent when a dialog changes state to "DLG_STATE_DELETED" + - this prevents the receiving instance from replicating the event again + (cherry picked from commit 5a63dcdf87c8d69c3dc9e5d6330f3d58953c28b5) + + +2013-08-30 Bogdan-Andrei Iancu + * [21b91ad] : + + - fixed NULL sockets in external scenarios (this leads to crashing when building the contact hdr) Reported by dexteruk on IRC . + + +2013-08-30 liviuchircu + * [6ee40a5] : + + Fix compilation issue introduced in commit a9fcd84c + (cherry picked from commit 6f8244921231ed837f1d54204cf6b616c33cabc4) + + +2013-08-29 Bogdan Andrei IANCU + * [14b667a] : + + Merge pull request #68 from wdoekes/wjd-fix_nathelper_memleak + Fix memleak in nathelper natping when "failed to fetch contacts". + + +2013-08-29 liviuchircu + * [a9fcd84] : + + Fix replicated dialog profile management in distributed systems + - replication-receiving instances must not do any profile-related + DB queries + (cherry picked from commit 20c92450fac2fd45506f759f7b19473a3dc657f9) + + +2013-08-29 Bogdan Andrei IANCU + * [017274c] : + + Merge pull request #58 from saghul/pua_double_free + Fixed double free issue in pua module + + +2013-08-28 Bogdan-Andrei Iancu + * [f44264a] : + + - complete port of pull request #34 + + +2013-08-28 Bogdan-Andrei Iancu + * [e57330a] : + + - complete backport from 1.8 of pull request #15 + + +2013-08-28 Bogdan-Andrei Iancu + * [062baa3] : + + - complete backport from 1.8 of pull request #15 + + +2013-08-28 Bogdan-Andrei Iancu + * [fa9cb4a] : + + - removed unused variable + + +2013-08-28 Vlad Paiu + * [86a6b3c] : + + Fixed bug introduced by previous commit : - downstream BYEs should go to 200OK leg in order to trigger dialog termination - upstream BYEs have no such limitation ( there's only one caller leg :) ) + (cherry picked from commit 18257f33e71061828493f4232b9dbd8dd7fa6729) + + +2013-08-28 Bogdan-Andrei Iancu + * [8a45cd6] : + + - proper backport of all changes from 1.8 branch + + +2013-08-27 liviuchircu + * [0d38a5a] : + + Fix: also run child_init for bin listeners + - bin listeners are now identified by the PROC_BIN rank + - this way, only the UDP listeners receive positive ranks + (cherry picked from commit 389de529cc7865a475823365cdba90f1a920c1a5) + + +2013-08-26 Bogdan-Andrei Iancu + * [5341c98] : + + - BYE requests received in confirmed state should terminate the dialog only if they match the TO-tag from 200 OK INVITE. This affects parallel forking scenarios where rejected branches are terminated via BYE by caller. Thanks for reporting and testing to Marco Hierl. + + +2013-08-14 Norm Brandinger + * [34fe501] : + + pike: correct spelling + (cherry picked from commit 879eacbb5e2f90f1dba2f9b23165e725a5c754d4) + + +2013-08-14 liviuchircu + * [a9c462d] : + + Fix: sdp_free() bug introduced in commit bde8c0a045 + Credits to csollet for reporting. + (cherry picked from commit a5e9f4bc818a94b282e7ccd10f44dec2d74a794e) + + +2013-08-13 Bogdan Andrei IANCU + * [c55408b] : + + Merge pull request #38 from fabriziopicconi/1.10 + wrong mpath folder (detected by rpmbuild) + + +2013-08-13 Bogdan Andrei IANCU + * [eb9cbfc] : + + Merge pull request #40 from fabriziopicconi/patch-7 + Update to 1.10 + + +2013-08-13 Bogdan Andrei IANCU + * [649c5e7] : + + Merge pull request #53 from nikbyte/1.10 + yum package specs / init-scripts changes for el/fedora + + +2013-08-13 Bogdan-Andrei Iancu + * [5392af6] : + + fixed setting the default min_expires and max_expires module parameters. Credits go to MayamaTakeshi. + + +2013-08-13 Nick Altmann + * [30fb94b] : + + add m4 config support for el/fedora distros, spec file synced with build server + + +2013-08-13 Nick Altmann + * [4597948] : + + add m4 config support for debian distros + + +2013-08-13 Damien Sandras + * [c13a50d] : + + Added documentation for recent changes. + + +2013-08-13 Damien Sandras + * [9d4bc28] : + + PUBLISH requests are now handled in the same order than received. + That is specifically useful for pua dialoginfo which was generating dialog + info notifications that were handled in the wrong order with that patch. + PUBLISH with older documents were sometimes treated after PUBLISH requests + with newer documents, leading to incoherent states. + + +2013-08-13 Nick Altmann + * [8a1c5d9] : + + porting of 8ed2ed: spec file for el/fedora synced with build server + spec file for el/fedora synced with build server + + +2013-08-13 vladpaiu + * [6ff91a1] : + + Merge pull request #47 from fabriziopicconi/patch-9 + remove warning compilation + + +2013-08-12 vladpaiu + * [ddd0c34] : + + Merge pull request #49 from fabriziopicconi/patch-11 + improved parallel compilation + + +2013-08-12 Vlad Paiu + * [6b13b19] : + + Fixed double free issue when reading multiple SIP messages in one TCP chunk Do proper zero-ing out of the tcp_req structure + (cherry picked from commit db24ec00b0d1c48ea109c9609bed81d1f8efa014) + + +2013-08-11 Vlad Paiu + * [e8c3c82] : + + Increased menuconfig parsing buffer to 1024 (Reported by Richard Revels) + Removed mi_http from the excluded modules list - has no external dependencies + (cherry picked from commit 41157e7b911bfb896f4f0a9cb2dc1049a0c2b0c4) + + +2013-08-11 saghul + * [51c5504] : + + Fixed compilation in systems without EPOLL + (cherry picked from 7d727aafa93f79421304121d95f2a038bdbf887c) + + +2013-08-09 liviuchircu + * [4b6531e] : + + Fix: mathops internal parsing bug + Credits to Jayesh Nambiar for reporting + (cherry picked from commit aeddd311d29c9d5cae5017bd59674031089b5574) + + +2013-08-08 Vlad Paiu + * [50b3436] : + + Fixed warning Fixed compilation error for libcurl < 7.16.2 ( due to CURLOPT_TIMEOUT_MS ) + (cherry picked from commit 1ee176a5fadb872cc5015141a118f0398bcb1f8f) + + +2013-08-08 fabriziopicconi + * [33134fe] : + + parallel compilation + speedup compilation on multicore/multicpu machines + + +2013-08-08 fabriziopicconi + * [5d253f8] : + + parallel compilation + speeduo compilation on multicore/multicpu machines + + +2013-08-08 fabriziopicconi + * [314537b] : + + remove warning compilation + remove warning: ‘ret’ may be used uninitialized in this function + + +2013-08-07 saghul + * [09757ce] : + + Cleanup menucnfig files when doing make proper + (cherry picked from commit 4d4d3dbefc084db00c122e499b9299240ed6e0d5) + + +2013-08-07 Saúl Ibarra Corretgé + * [4626525] : + + Fixed crash if send_subscribe fails early + In that case presentity is still NULL, check for it + (cherry picked from commit 6e3b16ec6d3fe59b5a1b415b548394be401e69af) + + +2013-08-06 Vlad Paiu + * [3509fc9] : + + Properly mentioned Steve Frécinaux from Be IP as the module creator + (cherry picked from commit 8f642bab2a47f29c2984f286279f5be4d0d5815a) + + +2013-08-06 Vlad Paiu + * [4bce0cb] : + + Fixed goes_to_gw, is_from_gw and dr_is_gw so that they accept negative gateway types ( to match all gw types) + (cherry picked from commit 3bfd505b72d46ea31930efe31b52e3bd5ea477de) + + +2013-08-06 fabriziopicconi + * [5af905e] : + + Update to 1.10 + Some new rpm optional modules are added: + mi_xmlrpc_ng,sngtc,db_cachedb,mathops,rest_client + + +2013-08-06 fabriziopicconi + * [a031014] : + + wrong mpath folder (detected by rpmbuild) + + =========================== Release 1.10.0 ============================== 2013-08-05 Liviu Chircu @@ -116,7 +1171,7 @@ * [4659c22] : new rpm modules - Some new rpm optional modules are added: + Some new rpm optional modules are added: cachedb_cassandra,cachedb_mongodb,osp,perl,perlvdb,tlsops 2013-07-11 Vlad Paiu @@ -167,12 +1222,12 @@ * [ef3eb8c] : spec file update to CentOS 6 - - CentOS 6 support - Remove rpmbuild warning on BuildPrereq now deprecated for BuildRequires - - opensips 1.9.0 support - Updated list of excluded modules - Updated list of file in rpm of core and modules - - Some new rpm optional modules are added: + - CentOS 6 support + Remove rpmbuild warning on BuildPrereq now deprecated for BuildRequires + - opensips 1.9.0 support + Updated list of excluded modules + Updated list of file in rpm of core and modules + - Some new rpm optional modules are added: db_http pi_http json cachedb_couchbase cachedb_memcached cachedb_redis event_rabbitmq db_berkeley perl db_perlvdb carrierroute mmgeoip ldap h350 identity regex dialplan Xlog mi_xmlrpc db_oracle 2013-06-10 Liviu Chircu @@ -216,14 +1271,14 @@ * [38fab02] : Compilation problem under CentOS 6 - The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. + The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. This path add this folder in the search list. 2013-06-08 Fabrizio Picconi * [0ea16ef] : Compilation problem under CentOS 6 - The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. + The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. This path add this folder in the search list. 2013-06-07 Liviu Chircu From 8bb46f72e529d438f1262ce78491074733b117f6 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 12 Mar 2014 17:33:51 +0200 Subject: [PATCH 145/159] update Makefile for 1.10.1 --- Makefile.defs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.defs b/Makefile.defs index 74818646b37..9b15ea9ea01 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -63,7 +63,7 @@ MAIN_NAME=opensips #version number VERSION = 1 PATCHLEVEL = 10 -SUBLEVEL = 0 +SUBLEVEL = 1 EXTRAVERSION = RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) From 5d2b9a7673f0353a15c357a295edbb1c243e4936 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 12 Mar 2014 17:49:00 +0200 Subject: [PATCH 146/159] update specs for 1.10.1 --- packaging/debian-lenny/changelog | 7 ++ packaging/debian/changelog | 7 ++ packaging/fedora/opensips.spec | 6 +- packaging/freebsd/Makefile | 2 +- packaging/gentoo/opensips-1.10.1.ebuild | 126 ++++++++++++++++++++++++ packaging/netbsd/Makefile | 4 +- packaging/openbsd/Makefile | 2 +- packaging/rpm/opensips.spec.CentOS | 2 +- packaging/rpm/opensips.spec.SuSE | 2 +- packaging/solaris/base-pkginfo | 4 +- packaging/solaris/berkeley-pkginfo | 4 +- packaging/solaris/carrierroute-pkginfo | 4 +- packaging/solaris/identity-pkginfo | 4 +- packaging/solaris/ldap-pkginfo | 4 +- packaging/solaris/mmgeoip-pkginfo | 4 +- packaging/solaris/mysql-pkginfo | 4 +- packaging/solaris/perl-pkginfo | 4 +- packaging/solaris/pgsql-pkginfo | 4 +- packaging/solaris/regex-pkginfo | 4 +- packaging/solaris/snmp-pkginfo | 4 +- packaging/solaris/tls-pkginfo | 4 +- packaging/solaris/xmlrpc-pkginfo | 4 +- 22 files changed, 175 insertions(+), 35 deletions(-) create mode 100644 packaging/gentoo/opensips-1.10.1.ebuild diff --git a/packaging/debian-lenny/changelog b/packaging/debian-lenny/changelog index 029cdca6492..1b85768239e 100644 --- a/packaging/debian-lenny/changelog +++ b/packaging/debian-lenny/changelog @@ -1,3 +1,10 @@ +opensips (1.10.1-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Wed, 12 Mar 2014 17:42:54 +0200 + + opensips (1.10.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/debian/changelog b/packaging/debian/changelog index f08324c786b..d52ab2113d0 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,10 @@ +opensips (1.10.1-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Wed, 12 Mar 2014 17:42:54 +0200 + + opensips (1.10.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index 9f661e21949..9e8b224aee6 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -9,7 +9,7 @@ Summary: Open Source SIP Server Name: opensips -Version: 1.10.0 +Version: 1.10.1 Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons @@ -1257,8 +1257,8 @@ chown -R %{name}:%{name} %{_sysconfdir}/%{name} %doc docdir/README.xmpp %changelog -* Tue Jul 30 2013 Nick Altmann - 1.10.0-1 -- Update to 1.10.0 +* Tue Jul 30 2013 Nick Altmann - 1.10.1-1 +- Update to 1.10.1 * Wed May 22 2013 Nick Altmann - 1.9.1-1 - Rebuild specification, add new modules and dependencies diff --git a/packaging/freebsd/Makefile b/packaging/freebsd/Makefile index 245fe775e68..16f75ace12f 100644 --- a/packaging/freebsd/Makefile +++ b/packaging/freebsd/Makefile @@ -6,7 +6,7 @@ # PORTNAME= opensips -PORTVERSION= 1.10.0 +PORTVERSION= 1.10.1 CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/${PORTVERSION}/src/ DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src diff --git a/packaging/gentoo/opensips-1.10.1.ebuild b/packaging/gentoo/opensips-1.10.1.ebuild new file mode 100644 index 00000000000..917c9d7e498 --- /dev/null +++ b/packaging/gentoo/opensips-1.10.1.ebuild @@ -0,0 +1,126 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +inherit eutils + +DESCRIPTION="OpenSIPS - flexible and robust SIP (RFC3261) server" +HOMEPAGE="http://www.opensips.org/" +MY_P="${P}_src" +SRC_URI="http://opensips.org/pub/opensips/${PV}/src/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="debug ipv6 mysql postgres radius jabber ssl cpl unixodbc" + +RDEPEND=" + mysql? ( >=dev-db/mysql-4.1.20 ) + radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + postgres? ( >=dev-db/postgresql-8.0.8 ) + jabber? ( dev-libs/expat ) + ssl? ( dev-libs/openssl ) + cpl? ( dev-libs/libxml2 ) + b2bua? ( dev-libs/libxml2 ) + presence? ( dev-libs/libxml2 ) + unixodbc? ( dev-libs/unixodbc-2.2.6 )" + +inc_mod="" +make_options="" + +pkg_setup() { + use mysql && \ + inc_mod="${inc_mod} db_mysql" + + use postgres && \ + inc_mod="${inc_mod} db_postgres" + + use radius && \ + inc_mod="${inc_mod} aaa_radius peering" + + use jabber && \ + inc_mod="${inc_mod} jabber" + + use cpl && \ + inc_mod="${inc_mod} cpl-c" + + use b2bua && \ + inc_mod="${inc_mod} b2b_entities b2bua_logic" + + use presence && \ + inc_mod="${inc_mod} presence presence_dialoginfo presence_mwi presence_xcapdiff presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp rls xcap xcap_client" + + use unixodbc && \ + inc_mod="${inc_mod} db_unixodbc" + + export inc_mod +} + +src_unpack() { + unpack ${MY_P}.tar.gz + + cd ${S} + use ipv6 || \ + sed -i -e "s/-DUSE_IPV6//g" Makefile.defs +} + +src_compile() { + local compile_options + + pkg_setup + + # optimization can result in strange debuging symbols so omit it in case + if use debug; then + compile_options="${compile_options} mode=debug" + else + compile_options="${compile_options} CFLAGS=${CFLAGS}" + fi + + if use ssl; then + compile_options="TLS=1 ${compile_options}" + fi + + emake all "${compile_options}" \ + prefix=${ROOT}/ \ + include_modules="${inc_mod}" \ + cfg-prefix=${ROOT}/ \ + cfg-target=${ROOT}/etc/opensips/ || die +} + +src_install () { + local install_options + + emake install \ + prefix=${D}/ \ + include_modules="${inc_mod}" \ + bin-prefix=${D}/usr/sbin \ + bin-dir="" \ + cfg-prefix=${D}/etc \ + cfg-dir=opensips/ \ + cfg-target=${D}/etc/opensips \ + modules-prefix=${D}/usr/lib/opensips \ + modules-dir=modules \ + modules-target=${D}/usr/lib/opensips/modules/ \ + man-prefix=${D}/usr/share/man \ + man-dir="" \ + doc-prefix=${D}/usr/share/doc \ + doc-dir=${PF} || die + exeinto /etc/init.d + newexe ${FILESDIR}/opensips.init opensips + + # fix what the Makefile don't do + use mysql || \ + rm ${D}/usr/sbin/opensips_mysql.sh +} + +pkg_postinst() { + einfo "WARNING: If you upgraded from a previous OpenSIPS version" + einfo "please read the README, NEWS and INSTALL files in the" + einfo "documentation directory because the database and the" + einfo "configuration file of old OpenSIPS versions are incompatible" + einfo "with the current version." +} + +pkg_prerm () { + ${D}/etc/init.d/opensips stop >/dev/null +} diff --git a/packaging/netbsd/Makefile b/packaging/netbsd/Makefile index 4155db2dc0b..228c84ec5e0 100644 --- a/packaging/netbsd/Makefile +++ b/packaging/netbsd/Makefile @@ -8,9 +8,9 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.10.0-notls +PORTVERSION= 1.10.1-notls CATEGORIES= net -MASTER_SITES= http://opensips.org/pub/opensips/1.10.0/src/ +MASTER_SITES= http://opensips.org/pub/opensips/1.10.1/src/ MAINTAINER= bogdan@opensips.org diff --git a/packaging/openbsd/Makefile b/packaging/openbsd/Makefile index a339449ed92..a02a90a78e8 100644 --- a/packaging/openbsd/Makefile +++ b/packaging/openbsd/Makefile @@ -8,7 +8,7 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.10.0-notls +PORTVERSION= 1.10.1-notls CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/1.6.0/src/ diff --git a/packaging/rpm/opensips.spec.CentOS b/packaging/rpm/opensips.spec.CentOS index bdf3a5a0a1b..6457bbab0d7 100644 --- a/packaging/rpm/opensips.spec.CentOS +++ b/packaging/rpm/opensips.spec.CentOS @@ -1,5 +1,5 @@ %define name opensips -%define ver 1.10.0 +%define ver 1.10.1 %define rel 1 %define _sharedir %{_prefix}/share diff --git a/packaging/rpm/opensips.spec.SuSE b/packaging/rpm/opensips.spec.SuSE index 8a8e8deafda..f0a821d5866 100644 --- a/packaging/rpm/opensips.spec.SuSE +++ b/packaging/rpm/opensips.spec.SuSE @@ -1,5 +1,5 @@ %define name opensips -%define ver 1.10.0 +%define ver 1.10.1 %define rel 0 %define EXCLUDED_MODULES aaa_radius b2b_entities b2b_logic db_http json memcached jabber cpl-c xmpp rls mi_xmlrpc xcap_client db_mysql db_postgres db_unixodbc db_oracle db_berkeley osp perl snmpstats db_perlvdb peering carrierroute mmgeoip presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap xcap_client ldap h350 identity regex diff --git a/packaging/solaris/base-pkginfo b/packaging/solaris/base-pkginfo index 11d9b5dfca6..1d6ffbb8fd1 100644 --- a/packaging/solaris/base-pkginfo +++ b/packaging/solaris/base-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-dbg" NAME="Programmable SIP Server Base Install - Debugging Symbols" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="bogdan@opensips.org" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/berkeley-pkginfo b/packaging/solaris/berkeley-pkginfo index 23811808cdb..293c839d41e 100644 --- a/packaging/solaris/berkeley-pkginfo +++ b/packaging/solaris/berkeley-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-berkeley-dbg" NAME="Programmable SIP Server Berkeley Database Support - Debugging Symbols" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/carrierroute-pkginfo b/packaging/solaris/carrierroute-pkginfo index 6de1b51d38e..7f8f9e27c15 100644 --- a/packaging/solaris/carrierroute-pkginfo +++ b/packaging/solaris/carrierroute-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-carrierroute" NAME="Programmable SIP Server carrierroute Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/identity-pkginfo b/packaging/solaris/identity-pkginfo index ec12bc24bab..a859e309275 100644 --- a/packaging/solaris/identity-pkginfo +++ b/packaging/solaris/identity-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-identity" NAME="Programmable SIP Server Identity Module" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/ldap-pkginfo b/packaging/solaris/ldap-pkginfo index 54ae26f6282..da2505803ee 100644 --- a/packaging/solaris/ldap-pkginfo +++ b/packaging/solaris/ldap-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-ldap" NAME="Programmable SIP Server LDAP Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mmgeoip-pkginfo b/packaging/solaris/mmgeoip-pkginfo index 9e6b1b42977..f8978b45abf 100644 --- a/packaging/solaris/mmgeoip-pkginfo +++ b/packaging/solaris/mmgeoip-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-geoip" NAME="Programmable SIP Server Address Location Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mysql-pkginfo b/packaging/solaris/mysql-pkginfo index 6334b38b9ee..ce32c05196c 100644 --- a/packaging/solaris/mysql-pkginfo +++ b/packaging/solaris/mysql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-mysql" NAME="Programmable SIP Server MySQL Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/perl-pkginfo b/packaging/solaris/perl-pkginfo index 8f33bf434d2..55b7c2017c8 100644 --- a/packaging/solaris/perl-pkginfo +++ b/packaging/solaris/perl-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-perl" NAME="Programmable SIP Server PERL Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/pgsql-pkginfo b/packaging/solaris/pgsql-pkginfo index e60e9e78bea..5ce56dd9a97 100644 --- a/packaging/solaris/pgsql-pkginfo +++ b/packaging/solaris/pgsql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-pgsql" NAME="Programmable SIP Server PostgreSQL Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/regex-pkginfo b/packaging/solaris/regex-pkginfo index 5aa45b34b3c..1951235e609 100644 --- a/packaging/solaris/regex-pkginfo +++ b/packaging/solaris/regex-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-regex" NAME="Programmable SIP Server Regex Module" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/snmp-pkginfo b/packaging/solaris/snmp-pkginfo index 6f25bb0ce9c..ee8a4ac0f6f 100644 --- a/packaging/solaris/snmp-pkginfo +++ b/packaging/solaris/snmp-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-snmp" NAME="Programmable SIP Server SNMP Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/tls-pkginfo b/packaging/solaris/tls-pkginfo index c5374336847..134dd69ea52 100644 --- a/packaging/solaris/tls-pkginfo +++ b/packaging/solaris/tls-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-TLS" NAME="Programmable SIP Server Base Install with TLS" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/xmlrpc-pkginfo b/packaging/solaris/xmlrpc-pkginfo index 2834a4ba290..55b1c5653f4 100644 --- a/packaging/solaris/xmlrpc-pkginfo +++ b/packaging/solaris/xmlrpc-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-xmlrpc" NAME="Programmable SIP Server MI XMLRPC Support" -VERSION="1.10.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="05thAug13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" From 384d588cfd731d2b4bdbfb888a5e2eaa8259e9ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20Crainea?= Date: Tue, 18 Mar 2014 18:18:20 +0200 Subject: [PATCH 147/159] Merge pull request #74 from wdoekes/wjd-timeout_avp_and_publish Set the dialog lifetime before running the callbacks. (cherry picked from commit 4df8a64db2d4d017a73c6f131b0925a0a82c488c) --- modules/dialog/dlg_handlers.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 0ecfa4de1a5..3461ec21856 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -1236,13 +1236,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) LM_DBG("sequential request successfully processed (dst_leg=%d)\n", dst_leg); + /* if there is a lifetime update, the dlg_callbacks will want + * to know. fetch it before running the callbacks */ + timeout = get_dlg_timeout_update(req); + if (timeout != 0) + dlg->lifetime = timeout; + /* within dialog request */ run_dlg_callbacks( DLGCB_REQ_WITHIN, dlg, req, dir, 0); - timeout = get_dlg_timeout_update(req); /* update timer during sequential request? */ if (timeout != 0) { - dlg->lifetime = timeout; if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) LM_ERR("failed to update dialog lifetime\n"); } From eb7fbdc5f6c317e4d12d00ad0767550ebdb32c30 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Mon, 24 Mar 2014 14:55:58 +0200 Subject: [PATCH 148/159] sipmsgops: Fix trailing whitespaces when doing "codec_delete_re" * deleting the last payload attribute led to trailing whitespaces * some UAs would return "488 Not Acceptable Here" in this case (cherry picked from commit c9657d4154ebc3ee271e981db036a10d9b9a7922) --- modules/sipmsgops/codecs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c index e5021401927..ac6b14f9486 100644 --- a/modules/sipmsgops/codecs.c +++ b/modules/sipmsgops/codecs.c @@ -561,6 +561,15 @@ static int stream_process(struct sip_msg * msg, struct sdp_stream_cell *cell, found.len++; } + /* when trimming the very last payload, avoid trailing ws */ + if (cur == lmp->u.value + lmp->len) { + tmp = found.s; + while (*(--tmp) == ' ') { + found.s--; + found.len++; + } + } + /* delete the string and update iterators */ for(tmp=found.s ; tmp< lmp->u.value + lmp->len ; tmp++ ) *tmp = *(tmp+found.len); From 54181eb35c90b393dbe543a48bf6805926d48566 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Mon, 24 Mar 2014 12:25:34 -0400 Subject: [PATCH 149/159] pi_http: fix copy/paste error that can lead to a crash when 'order_by_cols' is used --- modules/pi_http/http_fnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pi_http/http_fnc.c b/modules/pi_http/http_fnc.c index c4b4aea451d..4ffc3d6ebda 100644 --- a/modules/pi_http/http_fnc.c +++ b/modules/pi_http/http_fnc.c @@ -1366,7 +1366,7 @@ int ph_getCmds(ph_db_table_t *ph_db_tables, int ph_db_tables_size, NULL, &cmds->o_keys, NULL, - &cmds->q_vals, + NULL, &cmds->o_keys_size, cmd_cols)!=0) return -1; From 880caa37b284d1dc4faf133f961b861b8de69c29 Mon Sep 17 00:00:00 2001 From: Ovidiu Sas Date: Tue, 25 Mar 2014 21:07:55 -0400 Subject: [PATCH 150/159] pi_http: fix HTTP escaping (cherry picked from commit 980dfc853c411730e07db74242188bc6190aafdf) --- modules/pi_http/http_fnc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/pi_http/http_fnc.c b/modules/pi_http/http_fnc.c index 4ffc3d6ebda..6105e1ee23f 100644 --- a/modules/pi_http/http_fnc.c +++ b/modules/pi_http/http_fnc.c @@ -260,31 +260,31 @@ do{ \ case '<': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_LT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '>': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_GT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '&': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_AMP); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '"': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_QUOT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '\'': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_SQUOT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ } \ From 932e7d5ccd7e5499c68634c05b6ea24d55d66225 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 26 Mar 2014 19:52:26 +0200 Subject: [PATCH 151/159] Fixed detection of the module functions used in script - we need to look also into the logical expressions (like IF and WHILE conditions) Credits for reportind and helping with the troubleshooting go to Justin Zondagh (cherry picked from commit ab22467a2ed8af97ba89ce53144d4414dbcd5a52) --- route_struct.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/route_struct.c b/route_struct.c index bed0422216a..eb4a9caa694 100644 --- a/route_struct.c +++ b/route_struct.c @@ -635,6 +635,22 @@ void print_actions(struct action* a) } +static int is_mod_func_in_expr(struct expr *e, char *name, int param_no) +{ + if (e->type==ELEM_T) { + if (e->left.type==ACTION_O) + if (is_mod_func_used((struct action*)e->right.v.data,name,param_no)==1) + return 1; + } else if (e->type==EXP_T) { + if (e->left.v.expr && is_mod_func_in_expr(e->left.v.expr,name,param_no)==1) + return 1; + if (e->right.v.expr && is_mod_func_in_expr(e->right.v.expr,name,param_no)==1) + return 1; + } + return 0; +} + + int is_mod_func_used(struct action *a, char *name, int param_no) { cmd_export_t *cmd; @@ -642,11 +658,16 @@ int is_mod_func_used(struct action *a, char *name, int param_no) if (a->type==MODULE_T) { /* first param is the name of the function */ cmd = (cmd_export_t*)a->elem[0].u.data; + LM_DBG("checking %s against %s\n",name,cmd->name); if (strcasecmp(cmd->name, name)==0 && (param_no==cmd->param_no || param_no==-1) ) return 1; } + if (a->type==IF_T || a->type==WHILE_T) + if (is_mod_func_in_expr((struct expr*)a->elem[0].u.data,name,param_no)==1) + return 1; + /* follow all leads from actions than may have sub-blocks of instructions */ if (a->elem[0].type==ACTIONS_ST) if (is_mod_func_used((struct action*)a->elem[0].u.data,name,param_no)==1) From 3972d266958e6e49110a881e1c9733fa066873ff Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Wed, 12 Mar 2014 10:26:54 +0100 Subject: [PATCH 152/159] presence_dialoginfo: Fix bounds checking by using a helper function. Reported by: dsandras > About the bound checking error, the code was cut&pasted from another > place in the same file where the same error is still present: > ... Also I replaced a heap str with a stack one in build_dialoginfo. This one wasn't freed either unless an error condition was hit. (cherry picked from commit 6d058ec495c2faa015b24f412e2fe1b55526657e) --- modules/presence_dialoginfo/notify_body.c | 75 +++++++++-------------- 1 file changed, 28 insertions(+), 47 deletions(-) diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index 94695b12212..d29244473bf 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -57,22 +57,28 @@ void free_xml_body(char* body) xmlFree(body); } +/* Joins user and domain into "sip:USER@DOMAIN". + * dst must fit at least MAX_URI_SIZE+1 characters! */ +static inline int sipuri_cat(char* dst, const str* user, const str* domain) { + if ((4 + user->len + 1 + domain->len) > MAX_URI_SIZE) { + LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); + return -1; + } + memcpy(dst, "sip:", 4); + memcpy(dst + 4, user->s, user->len); + dst[user->len + 4] = '@'; + memcpy(dst + user->len + 5, domain->s, domain->len); + dst[user->len + 5 + domain->len] = '\0'; + return 0; +} str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n, int off_index) { str* n_body= NULL; char pres_uri_char[MAX_URI_SIZE+1]; - if ((pres_user->len + pres_domain->len + 5) > MAX_URI_SIZE) { - LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); + if (sipuri_cat(pres_uri_char, pres_user, pres_domain) != 0) return NULL; - } - memcpy(pres_uri_char, "sip:", 4); - memcpy(pres_uri_char + 4, pres_user->s, pres_user->len); - pres_uri_char[pres_user->len + 4] = '@'; - memcpy(pres_uri_char + pres_user->len + 5, pres_domain->s, pres_domain->len); - pres_uri_char[pres_user->len + 5 + pres_domain->len] = '\0'; - LM_DBG("[pres_uri] %s (%d), [n]=%d\n", pres_uri_char, pres_user->len + 5 + pres_domain->len, n); @@ -117,7 +123,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in int winner_priority = -1, priority ; xmlNodePtr winner_dialog_node = NULL ; str *body= NULL; - char buf[MAX_URI_SIZE+1]; + char buf[MAX_URI_SIZE+1]; LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n", pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n); @@ -163,15 +169,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in /* LM_DBG("number of bodies in total [n]=%d, number of useful bodies [j]=%d\n", n, j ); */ /* create the new NOTIFY body */ - if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { - LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); - return NULL; - } - memcpy(buf, "sip:", 4); - memcpy(buf+4, pres_user->s, pres_user->len); - buf[pres_user->len+4] = '@'; - memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); - buf[pres_user->len + 5 + pres_domain->len]= '\0'; + if (sipuri_cat(buf, pres_user, pres_domain) != 0) + goto error; doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) @@ -360,37 +359,21 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) xmlNodePtr state_node = NULL; str *body= NULL; - str *pres_uri= NULL; + str pres_uri; char buf[MAX_URI_SIZE+1]; - if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { - LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); + if (sipuri_cat(buf, pres_user, pres_domain) != 0) return NULL; - } - memcpy(buf, "sip:", 4); - memcpy(buf+4, pres_user->s, pres_user->len); - buf[pres_user->len+4] = '@'; - memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); - buf[pres_user->len + 5 + pres_domain->len]= '\0'; - - pres_uri = (str*)pkg_malloc(sizeof(str)); - if(pres_uri == NULL) - { - LM_ERR("while allocating memory\n"); - return NULL; - } - memset(pres_uri, 0, sizeof(str)); - pres_uri->s = buf; - pres_uri->len = pres_user->len + 5 + pres_domain->len; + pres_uri.s = buf; + pres_uri.len = 4 + pres_user->len + 1 + pres_domain->len; + LM_DBG("[pres_uri] %.*s\n", pres_uri.len, pres_uri.s); - LM_DBG("[pres_uri] %.*s\n", pres_uri->len, pres_uri->s); - - if ( pres_contains_presence(pres_uri)<0 ) { + if (pres_contains_presence(&pres_uri) < 0) { LM_DBG("No record exists in hash_table\n"); goto error; } - /* create the Publish body */ + /* create the Publish body */ doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) goto error; @@ -415,8 +398,10 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) LM_ERR("while adding child [dialog]\n"); goto error; } + + /* reuse buf for user-part only */ memcpy(buf, pres_user->s, pres_user->len); - buf[pres_user->len]= '\0'; + buf[pres_user->len] = '\0'; xmlNewProp(dialog_node, BAD_CAST "id", BAD_CAST buf); @@ -444,10 +429,6 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) xmlCleanupParser(); return body; error: - if ( pres_uri ) - { - pkg_free(pres_uri); - } if(body) { if(body->s) From 38dc20be0c20576510a8c57e296741c24a743a80 Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Wed, 26 Mar 2014 20:15:27 +0200 Subject: [PATCH 153/159] Fix two mem corruptions. Closes github issue #176 --- modules/xcap_client/xcap_callbacks.c | 2 +- modules/xcap_client/xcap_functions.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/xcap_client/xcap_callbacks.c b/modules/xcap_client/xcap_callbacks.c index 0bbbf8817a4..e27b00d1cbe 100644 --- a/modules/xcap_client/xcap_callbacks.c +++ b/modules/xcap_client/xcap_callbacks.c @@ -78,6 +78,6 @@ void destroy_xcapcb_list(void) { prev_xcb= xcb; xcb= xcb->next; - shm_free(xcb); + shm_free(prev_xcb); } } diff --git a/modules/xcap_client/xcap_functions.c b/modules/xcap_client/xcap_functions.c index 6b4a689e802..c65c208c1f3 100644 --- a/modules/xcap_client/xcap_functions.c +++ b/modules/xcap_client/xcap_functions.c @@ -85,8 +85,8 @@ void xcapFreeNodeSel(xcap_node_sel_t* node) { m= n; n= n->next; - pkg_free(n->value.s); - pkg_free(n); + pkg_free(m->value.s); + pkg_free(m); } pkg_free(node); From c8a7e26d3c7b5bdfda06dacdc036bedc44f1e2cb Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Fri, 28 Mar 2014 14:27:45 +0200 Subject: [PATCH 154/159] Fix recalculation of sending socket after local route Take into consideration the "force_send_socket" setting in local route. (cherry picked from commit d37ae664dcfd9a5f83de62a493628ba12d495e75) Conflicts: modules/tm/uac.c --- modules/tm/uac.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/tm/uac.c b/modules/tm/uac.c index df4dd9d4ad0..bff89b77c8e 100644 --- a/modules/tm/uac.c +++ b/modules/tm/uac.c @@ -211,6 +211,7 @@ int t_uac(str* method, str* headers, str* body, dlg_t* dialog, unsigned int hi; struct socket_info *send_sock, *new_send_sock; str h_to, h_from, h_cseq, h_callid; + unsigned short dst_changed; ret=-1; @@ -321,13 +322,16 @@ int t_uac(str* method, str* headers, str* body, dlg_t* dialog, set_avp_list( backup ); /* check for changes - if none, do not regenerate the buffer */ - if (req->new_uri.s || req->add_rm || req->body_lumps || - req->dst_uri.len != dialog->hooks.next_hop->len || - memcmp(req->dst_uri.s,dialog->hooks.next_hop->s,req->dst_uri.len) != 0) { + dst_changed = 1; + if (req->new_uri.s || req->force_send_socket!=dialog->send_sock || + req->dst_uri.len != dialog->hooks.next_hop->len || + memcmp(req->dst_uri.s,dialog->hooks.next_hop->s,req->dst_uri.len) || + (dst_changed=0)==0 || req->add_rm || req->body_lumps){ + new_send_sock = NULL; /* do we also need to change the destination? */ - if (req->dst_uri.s || req->new_uri.s) { + if (dst_changed) { /* calculate the socket corresponding to next hop */ new_send_sock = uri2sock(req, req->dst_uri.s ? &(req->dst_uri) : &req->new_uri, From 24629f96643c8fe71e08b9ea427d3d3b0a42b9b8 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Thu, 3 Apr 2014 11:54:25 +0300 Subject: [PATCH 155/159] fixed acc to raise the proper event when using acc_evi_request() Credits go to Brett Nemeroff for reporting and testing (cherry picked from commit 24bd3a843f382860a917dc7da0c8af52afb4c9b8) --- modules/acc/acc.c | 12 ++++-------- modules/acc/acc.h | 4 ++++ modules/acc/acc_logic.c | 12 ++++++++++-- modules/acc/acc_logic.h | 1 + 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/acc/acc.c b/modules/acc/acc.c index 7750a2ae739..d8051d8c3cb 100644 --- a/modules/acc/acc.c +++ b/modules/acc/acc.c @@ -1417,22 +1417,18 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) int n; int i; int backup_idx = -1, ret = -1; - event_id_t event = EVI_ERROR; /* * if the code is not set, choose the missed calls event * otherwise, check if the code is negative */ - event = (!acc_env.code || acc_env.code > 300) ? - acc_missed_event : acc_event; - - if (event == EVI_ERROR) { + if (acc_env.event == EVI_ERROR) { LM_ERR("event not registered %d\n", acc_event); return -1; } /* check if someone is interested in this event */ - if (!evi_probe_event(event)) + if (!evi_probe_event(acc_env.event)) return 1; m = core2strar( rq, val_arr ); @@ -1466,7 +1462,7 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) backup_idx = m - 1; evi_params[backup_idx]->next = NULL; - if (evi_raise_event(event, acc_event_params) < 0) { + if (evi_raise_event(acc_env.event, acc_event_params) < 0) { LM_ERR("cannot raise ACC event\n"); goto end; } @@ -1482,7 +1478,7 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) backup_idx = i - 1; evi_params[backup_idx]->next = NULL; - if (evi_raise_event(event, acc_event_params) < 0) { + if (evi_raise_event(acc_env.event, acc_event_params) < 0) { LM_ERR("cannot raise ACC event\n"); goto end; } diff --git a/modules/acc/acc.h b/modules/acc/acc.h index 74e71844a19..3bb29e8cc6c 100644 --- a/modules/acc/acc.h +++ b/modules/acc/acc.h @@ -112,6 +112,9 @@ int acc_evi_request( struct sip_msg *req, struct sip_msg *rpl); int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg); int store_evi_extra_values(struct dlg_cell *dlg, struct sip_msg *req, struct sip_msg *reply); +extern event_id_t acc_cdr_event; +extern event_id_t acc_event; +extern event_id_t acc_missed_event; @@ -120,4 +123,5 @@ int acc_diam_init(); int acc_diam_request( struct sip_msg *req, struct sip_msg *rpl); #endif + #endif diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c index fbdb8c205d0..764167b4ea9 100644 --- a/modules/acc/acc_logic.c +++ b/modules/acc/acc_logic.c @@ -158,6 +158,11 @@ static inline void env_set_comment(struct acc_param *accp) acc_env.reason = accp->reason; } +static inline void env_set_event(event_id_t ev) +{ + acc_env.event = ev; +} + static inline int acc_preparse_req(struct sip_msg *req) { @@ -422,6 +427,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, */ if (is_evi_mc_on(req)) { + env_set_event(acc_missed_event); acc_evi_request( req, reply ); flags_to_reset |= evi_missed_flag; } @@ -589,8 +595,10 @@ static inline void acc_onreply( struct cell* t, struct sip_msg *req, } } else { /* do old accounting */ - if ( is_evi_acc_on(req) ) + if ( is_evi_acc_on(req) ) { + env_set_event(acc_cdr_event); acc_evi_request( req, reply ); + } if ( is_log_acc_on(req) ) { env_set_text( ACC_ANSWERED, ACC_ANSWERED_LEN); @@ -631,7 +639,7 @@ static void acc_dlg_callback(struct dlg_cell *dlg, int type, flags = (unsigned int)(long)(*_params->param); if (flags & evi_flag) { - + env_set_event(acc_cdr_event); if (acc_evi_cdrs(dlg, _params->msg) < 0) { LM_ERR("cannot send accounting events\n"); return; diff --git a/modules/acc/acc_logic.h b/modules/acc/acc_logic.h index e2393d075d4..50f42a783d7 100644 --- a/modules/acc/acc_logic.h +++ b/modules/acc/acc_logic.h @@ -43,6 +43,7 @@ struct acc_enviroment { struct hdr_field *to; str text; time_t ts; + event_id_t event; }; /* param trasnporter*/ From 61254fc3bf8f3b1914091540e6354af22e9e331d Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 3 Apr 2014 16:51:35 +0300 Subject: [PATCH 156/159] mi_xmlrpc: fix crash when flushing complex MI trees as strings * crash was replicated with "ul_dump" command at 51+ contacts - "reply_option" must be disabled This patch solves a couple of other issues: * properly mark completed nodes when "reply_option" = 0 * a rare memory leak when flushing empty "mi_node"s (cherry picked from commit f5da89d27099f405e1242347bdf9e3cb6368423c) Conflicts: modules/mi_xmlrpc/xr_writer.c --- modules/mi_xmlrpc/xr_server.c | 2 ++ modules/mi_xmlrpc/xr_writer.c | 50 ++++++++++++++++++++++------------- modules/mi_xmlrpc/xr_writer.h | 1 + 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/modules/mi_xmlrpc/xr_server.c b/modules/mi_xmlrpc/xr_server.c index 1362b182b2a..2a84767da90 100644 --- a/modules/mi_xmlrpc/xr_server.c +++ b/modules/mi_xmlrpc/xr_server.c @@ -177,6 +177,8 @@ xmlrpc_value* default_method (xmlrpc_env* env, LM_DBG("starting up.....\n"); + xr_writer_reset(); + f = lookup_mi_cmd((char*)methodName, strlen(methodName)); if ( f == 0 ) { diff --git a/modules/mi_xmlrpc/xr_writer.c b/modules/mi_xmlrpc/xr_writer.c index b756f595084..0fed91cdf22 100644 --- a/modules/mi_xmlrpc/xr_writer.c +++ b/modules/mi_xmlrpc/xr_writer.c @@ -49,6 +49,11 @@ int xr_writer_init( unsigned int size ) return 0; } +void xr_writer_reset(void) +{ + *reply_buffer = '\0'; +} + #ifndef XMLRPC_HAS_FORCE_CHARS #define XMLRPC_NONXML_CHAR 0x7F @@ -217,10 +222,7 @@ static int recur_flush_response_array(xmlrpc_env * env, struct mi_node *tree, kid = kid->next; tree->kids = kid; - if(!tmp->kids){ - /* this node does not have any kids */ - free_mi_node(tmp); - } + free_mi_node(tmp); } else{ /* the node will have more kids => to keep the tree shape, do not @@ -286,11 +288,11 @@ static int recur_build_response( xmlrpc_env * env, struct mi_node * tree, LM_ERR("failed to get MI node data!\n"); return -1; } - - /* we are sure that this node has been written - * => avoid writing it again */ - tree->flags |= MI_WRITTEN; } + + /* we are sure that this node has been written + * => avoid writing it again */ + tree->flags |= MI_WRITTEN; } if ( tree->kids ) { @@ -305,9 +307,11 @@ static int recur_build_response( xmlrpc_env * env, struct mi_node * tree, char* xr_build_response( xmlrpc_env * env, struct mi_root * tree ) { str buf; - - buf.s = reply_buffer; - buf.len = reply_buffer_len; + int len; + + len = strlen(reply_buffer); + buf.s = reply_buffer + len; + buf.len = reply_buffer_len - len; if ( tree->code<200 || tree->code>=300 ){ LM_DBG("command processing failure: %s\n", tree->reason.s); @@ -335,7 +339,16 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf struct mi_node *kid, *tmp; int ret; - for(kid = tree->kids ; kid ; ){ + if (!rpl_opt) { + if (recur_build_response(env, tree, buf) != 0) { + LM_ERR("failed to read from the MI tree!\n"); + return -1; + } + + return 0; + } + + for(kid = tree->kids ; kid ; ){ /* write the current kid */ if (!(kid->flags & MI_WRITTEN)){ if (xr_write_node( buf, kid)!=0) { @@ -371,10 +384,7 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf kid = kid->next; tree->kids = kid; - if(!tmp->kids){ - /* this node does not have any kids */ - free_mi_node(tmp); - } + free_mi_node(tmp); } else{ /* the node will have more kids => to keep the tree shape, do not @@ -389,9 +399,11 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf char* xr_flush_response( xmlrpc_env * env, struct mi_root * tree ) { str buf; - - buf.s = reply_buffer; - buf.len = reply_buffer_len; + int len; + + len = strlen(reply_buffer); + buf.s = reply_buffer + len; + buf.len = reply_buffer_len - len; if ( tree->code<200 || tree->code>=300 ){ LM_DBG("command processing failure: %s\n", tree->reason.s); diff --git a/modules/mi_xmlrpc/xr_writer.h b/modules/mi_xmlrpc/xr_writer.h index 5ad208fa443..aef9e393dbf 100644 --- a/modules/mi_xmlrpc/xr_writer.h +++ b/modules/mi_xmlrpc/xr_writer.h @@ -34,6 +34,7 @@ #include "../../mi/tree.h" int xr_writer_init( unsigned int size ); +void xr_writer_reset(void); char * xr_build_response( xmlrpc_env * env, struct mi_root * tree ); char * xr_flush_response( xmlrpc_env * env, struct mi_root * tree ); int xr_build_response_array( xmlrpc_env * env, struct mi_root * tree ); From 58322923c71320294a47bcd236385068de224a42 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Wed, 9 Apr 2014 11:04:13 +0300 Subject: [PATCH 157/159] exec doc: update the OpenSIPS routes for each function (cherry picked from commit 2f47930ce189815bd9793f7304b00a9dae17f7ac) Conflicts: modules/exec/doc/exec_admin.xml --- modules/exec/README | 9 ++++++--- modules/exec/doc/exec_admin.xml | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/exec/README b/modules/exec/README index aca107dcc99..23ff119b70c 100644 --- a/modules/exec/README +++ b/modules/exec/README @@ -172,7 +172,8 @@ exec_dset("echo TEST > /tmp/$rU.txt"); character in it, the var needs to be placed inside quotes, for ex: exec_msg("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. Example 1.5. exec_msg usage ... @@ -197,7 +198,8 @@ exec_msg("echo TEST > /tmp/$rU.txt"); ex: exec_avp("print-contact.sh '$ct'"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, - LOCAL_ROUTE, STARTUP_ROUTE. + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, + ONREPLY_ROUTE. Example 1.6. exec_avp usage ... @@ -221,7 +223,8 @@ exec_avp("echo TEST", "$avp(test)"); ex: exec_getenv("'$ct'"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, - LOCAL_ROUTE, STARTUP_ROUTE. + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, + ONREPLY_ROUTE. Example 1.7. exec_getenv usage ... diff --git a/modules/exec/doc/exec_admin.xml b/modules/exec/doc/exec_admin.xml index 248ad63fa03..352e8ca5596 100644 --- a/modules/exec/doc/exec_admin.xml +++ b/modules/exec/doc/exec_admin.xml @@ -232,7 +232,8 @@ exec_dset("echo TEST > /tmp/$rU.txt"); exec_msg("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, + TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_msg</function> usage @@ -272,7 +273,8 @@ exec_msg("echo TEST > /tmp/$rU.txt"); exec_avp("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, STARTUP_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_avp</function> usage @@ -313,7 +315,8 @@ exec_avp("echo TEST", "$avp(test)"); exec_getenv("'$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, STARTUP_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_getenv</function> usage From 6302414c57720a5a6a512a1df9fa27ac43b2dc05 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Fri, 11 Apr 2014 16:59:20 +0300 Subject: [PATCH 158/159] msilo dbschema: avoid setting a default value for the body field * this causes errors/warnings on backends such as MySQL/MariaDB (cherry picked from commit 5c790aa9431401dc0b906a9a8694dffb6bd1d34b) --- db/schema/silo.xml | 1 - scripts/db_berkeley/opensips/silo | 2 +- scripts/mysql/msilo-create.sql | 2 +- scripts/oracle/msilo-create.sql | 2 +- scripts/postgres/msilo-create.sql | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/db/schema/silo.xml b/db/schema/silo.xml index 5c0a1fc8496..2560ae3e96d 100644 --- a/db/schema/silo.xml +++ b/db/schema/silo.xml @@ -92,7 +92,6 @@ body binary - Body of the message diff --git a/scripts/db_berkeley/opensips/silo b/scripts/db_berkeley/opensips/silo index c164e3d53c5..cae879ba29c 100644 --- a/scripts/db_berkeley/opensips/silo +++ b/scripts/db_berkeley/opensips/silo @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|''|''|0|0|0|'text/plain'|'' +NIL|''|''|''|''|0|0|0|'text/plain'|NIL diff --git a/scripts/mysql/msilo-create.sql b/scripts/mysql/msilo-create.sql index 691e5cbdc7a..07d80a20947 100644 --- a/scripts/mysql/msilo-create.sql +++ b/scripts/mysql/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time INT DEFAULT 0 NOT NULL, snd_time INT DEFAULT 0 NOT NULL, ctype CHAR(32) DEFAULT 'text/plain' NOT NULL, - body BLOB DEFAULT '' NOT NULL + body BLOB NOT NULL ) ENGINE=MyISAM; CREATE INDEX account_idx ON silo (username, domain); diff --git a/scripts/oracle/msilo-create.sql b/scripts/oracle/msilo-create.sql index 1ae2b27c10f..08e375c7b95 100644 --- a/scripts/oracle/msilo-create.sql +++ b/scripts/oracle/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time NUMBER(10) DEFAULT 0 NOT NULL, snd_time NUMBER(10) DEFAULT 0 NOT NULL, ctype VARCHAR2(32) DEFAULT 'text/plain', - body BLOB DEFAULT '' + body BLOB ); CREATE OR REPLACE TRIGGER silo_tr diff --git a/scripts/postgres/msilo-create.sql b/scripts/postgres/msilo-create.sql index f59e64f01aa..d6323d0af51 100644 --- a/scripts/postgres/msilo-create.sql +++ b/scripts/postgres/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time INTEGER DEFAULT 0 NOT NULL, snd_time INTEGER DEFAULT 0 NOT NULL, ctype VARCHAR(32) DEFAULT 'text/plain' NOT NULL, - body BYTEA DEFAULT '' NOT NULL + body BYTEA NOT NULL ); CREATE INDEX silo_account_idx ON silo (username, domain); From 178077e1836019cb5045841d4a7e055840db8753 Mon Sep 17 00:00:00 2001 From: fabriziopicconi Date: Sat, 12 Apr 2014 16:43:54 +0200 Subject: [PATCH 159/159] thrift 0.9 compilation with thrift 0.9 version --- modules/cachedb_cassandra/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cachedb_cassandra/Makefile b/modules/cachedb_cassandra/Makefile index dc812346df0..9326177ef09 100644 --- a/modules/cachedb_cassandra/Makefile +++ b/modules/cachedb_cassandra/Makefile @@ -5,7 +5,7 @@ NAME=cachedb_cassandra.so CXX=g++ LD=g++ LIBS=cachedb_cassandra_dbase.o cassandra_constants.o cassandra_types.o Cassandra.o -L/usr/local/lib -lthrift -CXXFLAGS=$(CFLAGS:-Wno-deprecated option=) +CXXFLAGS=$(CFLAGS:-Wno-deprecated option=) -DHAVE_NETINET_IN_H # suppress a TON of warnings CXXFLAGS+= -Wno-write-strings -Wno-deprecated -Wno-unused-function -Wno-sign-compare -Wno-strict-aliasing