summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitreview7
-rw-r--r--CHANGES11
-rw-r--r--Makefile20
-rwxr-xr-xbootstrap.sh4
-rw-r--r--channels/chan_sip.c3
-rw-r--r--channels/chan_unistim.c4
-rw-r--r--configs/samples/pjproject.conf.sample7
-rw-r--r--configs/samples/voicemail.conf.sample5
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rwxr-xr-xcontrib/scripts/ast_coredumper7
-rw-r--r--include/asterisk/autoconfig.h.in3
-rw-r--r--include/asterisk/options.h5
-rw-r--r--include/asterisk/res_pjproject.h26
-rw-r--r--include/asterisk/rtp_engine.h4
-rw-r--r--main/asterisk.c4
-rw-r--r--main/config.c4
-rw-r--r--main/stdtime/localtime.c6
-rw-r--r--res/res_pjproject.c12
-rw-r--r--res/res_pjsip.c4
-rw-r--r--res/res_pjsip/location.c4
-rw-r--r--res/res_pjsip_history.c5
-rw-r--r--res/res_pjsip_refer.c32
-rw-r--r--res/res_pjsip_sdp_rtp.c11
-rw-r--r--res/res_rtp_asterisk.c7
-rw-r--r--res/res_sdp_translator_pjmedia.c14
26 files changed, 170 insertions, 47 deletions
diff --git a/.gitreview b/.gitreview
index d38061d45..21f9efff8 100644
--- a/.gitreview
+++ b/.gitreview
@@ -1,5 +1,10 @@
[gerrit]
+defaultbranch=master
+#
+# Intentional padding to ensure it is possible to point a commit
+# to an alternative gerrit server/repository without breaking
+# cherry-pick between branches.
+#
host=gerrit.asterisk.org
port=29418
project=asterisk.git
-defaultbranch=master
diff --git a/CHANGES b/CHANGES
index 66ffca5d0..37ec31931 100644
--- a/CHANGES
+++ b/CHANGES
@@ -91,6 +91,17 @@ Core:
by the system.
------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 15.3.0 to Asterisk 15.4.0 ------------
+------------------------------------------------------------------------------
+
+res_pjproject
+------------------
+ * Added the "cache_pools" option to pjproject.conf. Disabling the option
+ helps track down pool content mismanagement when using valgrind or
+ MALLOC_DEBUG. The cache gets in the way of determining if the pool contents
+ are used after free and who freed it.
+
+------------------------------------------------------------------------------
--- Functionality changes from Asterisk 15.2.0 to Asterisk 15.3.0 ------------
------------------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index a11c8deb8..4e6072e3a 100644
--- a/Makefile
+++ b/Makefile
@@ -228,7 +228,7 @@ ifeq ($(OSARCH),FreeBSD)
endif
ifeq ($(OSARCH),NetBSD)
- _ASTCFLAGS+=-pthread -I/usr/pkg/include
+ _ASTCFLAGS+=-pthread -D__LIBPTHREAD_SOURCE__ -I/usr/pkg/include
endif
ifeq ($(OSARCH),OpenBSD)
@@ -239,7 +239,7 @@ ifeq ($(OSARCH),SunOS)
_ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
endif
-ifneq ($(GREP),)
+ifneq ($(GREP),:)
ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
endif
ifneq ($(AWK),)
@@ -467,7 +467,7 @@ endif
$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
done
-ifneq ($(GREP),)
+ifneq ($(GREP),:)
XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
@@ -486,7 +486,7 @@ doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
@echo
@echo "</docs>" >> $@
-ifneq ($(GREP),)
+ifneq ($(GREP),:)
XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
@@ -630,7 +630,7 @@ oldmodcheck:
fi
ld-cache-update:
-ifneq ($(LDCONFIG),)
+ifneq ($(LDCONFIG),:)
ifeq ($(DESTDIR),) # DESTDIR means binary archive creation; ldconfig should be run on postinst
@if [ $$(id -u) -eq 0 ] ; then \
$(LDCONFIG) "$(ASTLIBDIR)/" ; \
@@ -929,6 +929,14 @@ config:
if [ -z "$(DESTDIR)" ] ; then \
/sbin/chkconfig --add asterisk ; \
fi ; \
+ elif [ -f /etc/os-release ] && [ "opensuse" = "$(shell . /etc/os-release && echo $$ID)" ] ; then \
+ ./build_tools/install_subst contrib/init.d/rc.suse.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
+ if [ ! -f /etc/sysconfig/asterisk ] ; then \
+ $(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
+ fi ; \
+ if [ -z "$(DESTDIR)" ] ; then \
+ /sbin/chkconfig --add asterisk ; \
+ fi ; \
elif [ -f /etc/arch-release -o -f /etc/arch-release ] ; then \
./build_tools/install_subst contrib/init.d/rc.archlinux.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
@@ -976,7 +984,7 @@ ifeq ($(HAVE_DAHDI),1)
rm -f $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
endif
$(MAKE) -C sounds uninstall
-ifneq ($(LDCONFIG),)
+ifneq ($(LDCONFIG),:)
$(LDCONFIG) "$(ASTLIBDIR)/" || :
endif
diff --git a/bootstrap.sh b/bootstrap.sh
index 1ceb326a0..106f202a2 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -17,6 +17,10 @@ case `uname -sr` in
MY_AC_VER=
MY_AM_VER=
;;
+ NetBSD*)
+ MY_AC_VER=
+ MY_AM_VER=
+ ;;
OpenBSD*)
# pkg_add autoconf%2.63 automake%1.9 metaauto
[ -z "$AUTOCONF_VERSION" ] && export AUTOCONF_VERSION=2.63
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index acf5a147e..85701634c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23984,6 +23984,9 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
ast_queue_control(p->owner, AST_CONTROL_RINGING);
if (ast_channel_state(p->owner) != AST_STATE_UP) {
ast_setstate(p->owner, AST_STATE_RINGING);
+ if (p->relatedpeer) {
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_NOT_CACHABLE, "SIP/%s", p->relatedpeer->name);
+ }
}
}
if (find_sdp(req)) {
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 9d4c453fc..28d84eeea 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -41,7 +41,7 @@
#include <sys/stat.h>
#include <signal.h>
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(__NetBSD__)
/*
* cygwin headers are partly inconsistent. struct iovec is defined in sys/uio.h
* which is not included by default by sys/socket.h - in_pktinfo is defined in
@@ -53,7 +53,7 @@
#ifdef HAVE_PKTINFO
#undef HAVE_PKTINFO
#endif
-#endif /* __CYGWIN__ */
+#endif /* __CYGWIN__ || __NetBSD__ */
#include "asterisk/paths.h" /* ast_config_AST_LOG_DIR used in (too ?) many places */
#include "asterisk/network.h"
diff --git a/configs/samples/pjproject.conf.sample b/configs/samples/pjproject.conf.sample
index 82c81a1f6..03149c453 100644
--- a/configs/samples/pjproject.conf.sample
+++ b/configs/samples/pjproject.conf.sample
@@ -5,6 +5,13 @@
; NOTES: The name of this section in the pjproject.conf configuration file must
; remain startup or the configuration will not be applied.
;
+;cache_pools = yes ; Cache pjproject memory pools for performance
+ ; Disable this option to help track down pool content
+ ; mismanagement when using valgrind or MALLOC_DEBUG.
+ ; The cache gets in the way of determining if the
+ ; pool contents are used after being freed and who
+ ; freed it.
+ ; Default yes
;log_level=default ; Initial maximum pjproject logging level to log
; Valid values are: 0-6, and default
;
diff --git a/configs/samples/voicemail.conf.sample b/configs/samples/voicemail.conf.sample
index c90f8513c..e4130d356 100644
--- a/configs/samples/voicemail.conf.sample
+++ b/configs/samples/voicemail.conf.sample
@@ -145,8 +145,9 @@ maxlogins=3
; You can select between two variables by using dialplan functions, e.g.
; ${IF(${ISNULL(${ORIG_VM_DATE})}?${VM_DATE}:${ORIG_VM_DATE})}
;
-; Note: The emailbody config row can only be up to 512 characters due to a
-; limitation in the Asterisk configuration subsystem.
+; Note: The emailbody config row can only be up to 8190 characters due to a
+; limitation in the Asterisk configuration subsystem. If compiled with
+; LOW_MEMORY the limit is 510 characters.
;emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}
; The following definition is very close to the default, but the default shows
; just the CIDNAME, if it is not null, otherwise just the CIDNUM, or "an unknown
diff --git a/configure b/configure
index 2849fe591..18609ca20 100755
--- a/configure
+++ b/configure
@@ -14105,7 +14105,7 @@ fi
-if test "x$JANSSON_LIB" == "x"; then
+if test "${PBX_JANSSON}" != 1; then
as_fn_error $? "*** JSON support not found (this typically means the libjansson development package is missing)" "$LINENO" 5
fi
@@ -16701,7 +16701,7 @@ fi
done
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.ac b/configure.ac
index 1bb4bc4ff..a59646cfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -659,7 +659,7 @@ AC_SUBST(UUID_LIB)
# Find required JSON support.
AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_dumps], [jansson.h])
-if test "x$JANSSON_LIB" == "x"; then
+if test "${PBX_JANSSON}" != 1; then
AC_MSG_ERROR([*** JSON support not found (this typically means the libjansson development package is missing)])
fi
@@ -754,7 +754,7 @@ AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl])
AC_MSG_CHECKING(for htonll)
AC_LINK_IFELSE(
diff --git a/contrib/scripts/ast_coredumper b/contrib/scripts/ast_coredumper
index 884ede71f..38d95ccaa 100755
--- a/contrib/scripts/ast_coredumper
+++ b/contrib/scripts/ast_coredumper
@@ -216,6 +216,7 @@ running=false
RUNNING=false
latest=false
tarball_coredumps=false
+tarball_config=false
delete_coredumps_after=false
tarball_results=false
delete_results_after=false
@@ -281,6 +282,9 @@ for a in "$@" ; do
--tarball-coredumps)
tarball_coredumps=true
;;
+ --tarball-config)
+ tarball_config=true
+ ;;
--delete-coredumps-after)
delete_coredumps_after=true
;;
@@ -436,7 +440,7 @@ for i in ${!COREDUMPS[@]} ; do
ln -s ${cf} ${dest}/tmp/${cfname}
cp ${outputdir}/${cfname}*.txt ${dest}/tmp/
- cp /etc/os-release ${dest}/etc/
+ [ -f /etc/os-release ] && cp /etc/os-release ${dest}/etc/
if $tarball_config ; then
cp -a /etc/asterisk ${dest}/etc/
fi
@@ -445,6 +449,7 @@ for i in ${!COREDUMPS[@]} ; do
cp -a /usr/sbin/asterisk ${dest}/usr/sbin
rm -rf ${tf}
tar -chzf ${tf} --transform="s/^[.]/${cfname}/" -C ${dest} .
+ sleep 3
rm -rf ${dest}
echo "Created $tf"
elif $tarball_results ; then
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 4a9a273b7..06114616d 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -1203,6 +1203,9 @@
/* Define to 1 if you have the uriparser library library. */
#undef HAVE_URIPARSER
+/* Define to 1 if you have the `uselocale' function. */
+#undef HAVE_USELOCALE
+
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 878748d16..78f596a88 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -173,6 +173,11 @@ enum ast_option_flags {
/*! Current linked pjproject maximum logging level */
extern int ast_pjproject_max_log_level;
+#define DEFAULT_PJPROJECT_CACHE_POOLS 1
+
+/*! Current pjproject pool caching enable */
+extern int ast_option_pjproject_cache_pools;
+
/*! Current pjproject logging level */
extern int ast_option_pjproject_log_level;
diff --git a/include/asterisk/res_pjproject.h b/include/asterisk/res_pjproject.h
index 4993be610..17ebdd201 100644
--- a/include/asterisk/res_pjproject.h
+++ b/include/asterisk/res_pjproject.h
@@ -19,6 +19,9 @@
#ifndef _RES_PJPROJECT_H
#define _RES_PJPROJECT_H
+#include <pj/types.h>
+#include <pj/pool.h>
+
/*!
* \brief Retrieve a pjproject build option
*
@@ -71,4 +74,27 @@ void ast_pjproject_log_intercept_begin(int fd);
*/
void ast_pjproject_log_intercept_end(void);
+/*!
+ * \brief Initialize the caching pool factory.
+ * \since 13.21.0
+ *
+ * \param cp Caching pool factory to initialize
+ * \param policy Pool factory policy
+ * \param max_capacity Total capacity to be retained in the cache. Zero disables caching.
+ *
+ * \return Nothing
+ */
+void ast_pjproject_caching_pool_init(pj_caching_pool *cp,
+ const pj_pool_factory_policy *policy, pj_size_t max_capacity);
+
+/*!
+ * \brief Destroy caching pool factory and all cached pools.
+ * \since 13.21.0
+ *
+ * \param cp Caching pool factory to destroy
+ *
+ * \return Nothing
+ */
+void ast_pjproject_caching_pool_destroy(pj_caching_pool *cp);
+
#endif /* _RES_PJPROJECT_H */
diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h
index c77be4584..3812cb159 100644
--- a/include/asterisk/rtp_engine.h
+++ b/include/asterisk/rtp_engine.h
@@ -122,6 +122,10 @@ enum ast_rtp_property {
AST_RTP_PROPERTY_RTCP,
/*! Enable Asymmetric RTP Codecs */
AST_RTP_PROPERTY_ASYMMETRIC_CODEC,
+ /*! Enable packet retransmission for received packets */
+ AST_RTP_PROPERTY_RETRANS_RECV,
+ /*! Enable packet retransmission for sent packets */
+ AST_RTP_PROPERTY_RETRANS_SEND,
/*!
* \brief Maximum number of RTP properties supported
diff --git a/main/asterisk.c b/main/asterisk.c
index 4c15d231f..e348b2199 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -331,6 +331,7 @@ int option_verbose; /*!< Verbosity level */
int option_debug; /*!< Debug level */
int ast_pjproject_max_log_level = -1;/* Default to -1 to know if we have read the level from pjproject yet. */
int ast_option_pjproject_log_level;
+int ast_option_pjproject_cache_pools;
double ast_option_maxload; /*!< Max load avg on system */
int ast_option_maxcalls; /*!< Max number of active calls */
int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
@@ -3744,6 +3745,7 @@ static void read_pjproject_startup_options(void)
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE | CONFIG_FLAG_NOREALTIME };
ast_option_pjproject_log_level = DEFAULT_PJ_LOG_MAX_LEVEL;
+ ast_option_pjproject_cache_pools = DEFAULT_PJPROJECT_CACHE_POOLS;
cfg = ast_config_load2("pjproject.conf", "" /* core, can't reload */, config_flags);
if (!cfg
@@ -3762,6 +3764,8 @@ static void read_pjproject_startup_options(void)
} else if (MAX_PJ_LOG_MAX_LEVEL < ast_option_pjproject_log_level) {
ast_option_pjproject_log_level = MAX_PJ_LOG_MAX_LEVEL;
}
+ } else if (!strcasecmp(v->name, "cache_pools")) {
+ ast_option_pjproject_cache_pools = !ast_false(v->value);
}
}
diff --git a/main/config.c b/main/config.c
index 118b9586e..8107fce04 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2195,10 +2195,10 @@ static struct ast_config *config_text_file_load(const char *database, const char
lineno++;
if (fgets(buf, sizeof(buf), f)) {
/* Skip lines that are too long */
- if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 1] != '\n') {
+ if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 2] != '\n') {
ast_log(LOG_WARNING, "Line %d too long, skipping. It begins with: %.32s...\n", lineno, buf);
while (fgets(buf, sizeof(buf), f)) {
- if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 1] == '\n') {
+ if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 2] == '\n') {
break;
}
}
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index 2976e59c1..5134ec2b9 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -310,7 +310,7 @@ static struct state * sstate_alloc(void);
static void sstate_free(struct state *p);
static AST_LIST_HEAD_STATIC(zonelist, state);
-#ifdef HAVE_NEWLOCALE
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE)
static AST_LIST_HEAD_STATIC(localelist, locale_entry);
#endif
@@ -504,7 +504,7 @@ static void *kqueue_daemon(void *data)
continue;
}
- sp = kev.udata;
+ sp = (struct state *) kev.udata;
AST_LIST_LOCK(&zonelist);
/* see comment near psx_sp in add_notify() */
@@ -2362,7 +2362,7 @@ struct timeval ast_mktime(struct ast_tm *tmp, const char *zone)
return time1(tmp, localsub, 0L, sp);
}
-#ifdef HAVE_NEWLOCALE
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE)
static struct locale_entry *find_by_locale(locale_t locale)
{
struct locale_entry *cur;
diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index f506a62fd..ebd71b99b 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -459,6 +459,18 @@ static struct ast_cli_entry pjproject_cli[] = {
AST_CLI_DEFINE(handle_pjproject_show_log_level, "Show the maximum active pjproject logging level"),
};
+void ast_pjproject_caching_pool_init(pj_caching_pool *cp,
+ const pj_pool_factory_policy *policy, pj_size_t max_capacity)
+{
+ /* Passing a max_capacity of zero disables caching pools */
+ pj_caching_pool_init(cp, policy, ast_option_pjproject_cache_pools ? max_capacity : 0);
+}
+
+void ast_pjproject_caching_pool_destroy(pj_caching_pool *cp)
+{
+ pj_caching_pool_destroy(cp);
+}
+
static int load_module(void)
{
ast_debug(3, "Starting PJPROJECT logging to Asterisk logger\n");
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index ca173a8af..9f6b5d115 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -4998,7 +4998,7 @@ static int unload_pjsip(void *data)
ast_pjsip_endpoint = NULL;
if (caching_pool.lock) {
- pj_caching_pool_destroy(&caching_pool);
+ ast_pjproject_caching_pool_destroy(&caching_pool);
}
pj_shutdown();
@@ -5015,7 +5015,7 @@ static int load_pjsip(void)
* example code from PJLIB. This can be adjusted
* if necessary.
*/
- pj_caching_pool_init(&caching_pool, NULL, 1024 * 1024);
+ ast_pjproject_caching_pool_init(&caching_pool, NULL, 1024 * 1024);
if (pjsip_endpt_create(&caching_pool.factory, "SIP", &ast_pjsip_endpoint) != PJ_SUCCESS) {
ast_log(LOG_ERROR, "Failed to create PJSIP endpoint structure. Aborting load\n");
goto error;
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 84f73c742..22da80577 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -17,8 +17,8 @@
*/
#include "asterisk.h"
-#include "pjsip.h"
-#include "pjlib.h"
+#include <pjsip.h>
+#include <pjlib.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/logger.h"
diff --git a/res/res_pjsip_history.c b/res/res_pjsip_history.c
index fa9e27f00..ab035a296 100644
--- a/res/res_pjsip_history.c
+++ b/res/res_pjsip_history.c
@@ -42,6 +42,7 @@
#include "asterisk/netsock2.h"
#include "asterisk/vector.h"
#include "asterisk/lock.h"
+#include "asterisk/res_pjproject.h"
#define HISTORY_INITIAL_SIZE 256
@@ -1369,7 +1370,7 @@ static int load_module(void)
ast_log(LOG_WARNING, "Unable to register history log level\n");
}
- pj_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0);
+ ast_pjproject_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0);
AST_VECTOR_INIT(&vector_history, HISTORY_INITIAL_SIZE);
@@ -1387,7 +1388,7 @@ static int unload_module(void)
ast_sip_push_task_synchronous(NULL, clear_history_entries, NULL);
AST_VECTOR_FREE(&vector_history);
- pj_caching_pool_destroy(&cachingpool);
+ ast_pjproject_caching_pool_destroy(&cachingpool);
if (log_level != -1) {
ast_logger_unregister_level("PJSIP_HISTORY");
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 5e0141b09..7d892f653 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -468,10 +468,20 @@ static struct refer_attended *refer_attended_alloc(struct ast_sip_session *trans
return attended;
}
-static int defer_termination_cancel(void *data)
+static int session_end_if_deferred_task(void *data)
{
struct ast_sip_session *session = data;
+ ast_sip_session_end_if_deferred(session);
+ ao2_ref(session, -1);
+ return 0;
+}
+
+static int defer_termination_cancel_task(void *data)
+{
+ struct ast_sip_session *session = data;
+
+ ast_sip_session_end_if_deferred(session);
ast_sip_session_defer_termination_cancel(session);
ao2_ref(session, -1);
return 0;
@@ -513,6 +523,7 @@ static int refer_attended_task(void *data)
{
struct refer_attended *attended = data;
int response;
+ int (*task_cb)(void *data);
if (attended->transferer_second->channel) {
ast_debug(3, "Performing a REFER attended transfer - Transferer #1: %s Transferer #2: %s\n",
@@ -543,13 +554,18 @@ static int refer_attended_task(void *data)
}
}
- ast_sip_session_end_if_deferred(attended->transferer);
- if (response != 200) {
- if (!ast_sip_push_task(attended->transferer->serializer,
- defer_termination_cancel, attended->transferer)) {
- /* Gave the ref to the pushed task. */
- attended->transferer = NULL;
- }
+ if (response == 200) {
+ task_cb = session_end_if_deferred_task;
+ } else {
+ task_cb = defer_termination_cancel_task;
+ }
+ if (!ast_sip_push_task(attended->transferer->serializer,
+ task_cb, attended->transferer)) {
+ /* Gave the ref to the pushed task. */
+ attended->transferer = NULL;
+ } else {
+ /* Do this anyway even though it is the wrong serializer. */
+ ast_sip_session_end_if_deferred(attended->transferer);
}
ao2_ref(attended, -1);
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index ce8ed82df..9f0cdd300 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -219,10 +219,13 @@ static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_me
(session->endpoint->media.tos_audio || session->endpoint->media.cos_audio)) {
ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_audio,
session->endpoint->media.cos_audio, "SIP RTP Audio");
- } else if (session_media->type == AST_MEDIA_TYPE_VIDEO &&
- (session->endpoint->media.tos_video || session->endpoint->media.cos_video)) {
- ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_video,
- session->endpoint->media.cos_video, "SIP RTP Video");
+ } else if (session_media->type == AST_MEDIA_TYPE_VIDEO) {
+ ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_RETRANS_RECV, session->endpoint->media.webrtc);
+ ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_RETRANS_SEND, session->endpoint->media.webrtc);
+ if (session->endpoint->media.tos_video || session->endpoint->media.cos_video) {
+ ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_video,
+ session->endpoint->media.cos_video, "SIP RTP Video");
+ }
}
ast_rtp_instance_set_last_rx(session_media->rtp, time(NULL));
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index d3273b463..b53b38ad7 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -71,6 +71,9 @@
#include "asterisk/smoother.h"
#include "asterisk/uuid.h"
#include "asterisk/test.h"
+#ifdef HAVE_PJPROJECT
+#include "asterisk/res_pjproject.h"
+#endif
#define MAX_TIMESTAMP_SKEW 640
@@ -7376,7 +7379,7 @@ static void rtp_terminate_pjproject(void)
pj_thread_destroy(timer_thread);
}
- pj_caching_pool_destroy(&cachingpool);
+ ast_pjproject_caching_pool_destroy(&cachingpool);
pj_shutdown();
}
#endif
@@ -7401,7 +7404,7 @@ static int load_module(void)
return AST_MODULE_LOAD_DECLINE;
}
- pj_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0);
+ ast_pjproject_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0);
pool = pj_pool_create(&cachingpool.factory, "timer", 512, 512, NULL);
diff --git a/res/res_sdp_translator_pjmedia.c b/res/res_sdp_translator_pjmedia.c
index 772be272c..676e740bc 100644
--- a/res/res_sdp_translator_pjmedia.c
+++ b/res/res_sdp_translator_pjmedia.c
@@ -17,6 +17,11 @@
*/
#include "asterisk.h"
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "asterisk/res_pjproject.h"
#include "asterisk/sdp_translator.h"
#include "asterisk/sdp_options.h"
#include "asterisk/vector.h"
@@ -27,10 +32,6 @@
#include "asterisk/module.h"
#include "asterisk/sdp.h"
-#ifdef HAVE_PJPROJECT
-#include <pjlib.h>
-#include <pjmedia.h>
-#endif
/*** MODULEINFO
<depend>pjproject</depend>
@@ -573,7 +574,7 @@ static int load_module(void)
if (ast_sdp_register_translator(&pjmedia_translator)) {
return AST_MODULE_LOAD_DECLINE;
}
- pj_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024);
+ ast_pjproject_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024);
AST_TEST_REGISTER(pjmedia_to_sdp_test);
AST_TEST_REGISTER(sdp_to_pjmedia_test);
@@ -583,7 +584,7 @@ static int load_module(void)
static int unload_module(void)
{
ast_sdp_unregister_translator(&pjmedia_translator);
- pj_caching_pool_destroy(&sdp_caching_pool);
+ ast_pjproject_caching_pool_destroy(&sdp_caching_pool);
AST_TEST_UNREGISTER(pjmedia_to_sdp_test);
AST_TEST_UNREGISTER(sdp_to_pjmedia_test);
return 0;
@@ -600,4 +601,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJMEDIA SDP Translato
.unload = unload_module,
.reload = reload_module,
.load_pri = AST_MODPRI_CHANNEL_DEPEND,
+ .requires = "res_pjproject",
);