summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES11
-rw-r--r--Makefile30
-rw-r--r--addons/chan_ooh323.c3
-rw-r--r--apps/app_amd.c21
-rw-r--r--apps/app_directory.c6
-rw-r--r--apps/app_fax.c2
-rw-r--r--apps/app_minivm.c2
-rw-r--r--apps/app_osplookup.c6
-rw-r--r--apps/app_voicemail.c76
-rwxr-xr-xbootstrap.sh4
-rw-r--r--cdr/cdr_adaptive_odbc.c1
-rw-r--r--cdr/cdr_odbc.c1
-rw-r--r--cdr/cdr_pgsql.c22
-rw-r--r--cel/cel_odbc.c1
-rw-r--r--cel/cel_pgsql.c18
-rw-r--r--channels/chan_dahdi.c4
-rw-r--r--channels/chan_sip.c31
-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-xconfigure80
-rw-r--r--configure.ac28
-rw-r--r--funcs/func_odbc.c1
-rw-r--r--include/asterisk/astosp.h31
-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--main/asterisk.c4
-rw-r--r--main/callerid.c2
-rw-r--r--main/config.c8
-rw-r--r--main/netsock2.c8
-rw-r--r--main/pbx.c10
-rw-r--r--main/sched.c35
-rw-r--r--main/stdtime/localtime.c6
-rw-r--r--main/utils.c3
-rw-r--r--res/res_config_ldap.c12
-rw-r--r--res/res_config_odbc.c1
-rw-r--r--res/res_config_pgsql.c14
-rw-r--r--res/res_config_sqlite.c2
-rw-r--r--res/res_http_post.c2
-rw-r--r--res/res_monitor.c2
-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_rfc3326.c6
-rw-r--r--res/res_pjsip_session.c31
-rw-r--r--res/res_rtp_asterisk.c28
-rw-r--r--res/res_sdp_translator_pjmedia.c14
-rw-r--r--third-party/pjproject/patches/0070-sdp_media_fmt.patch19
-rw-r--r--third-party/pjproject/patches/0071-sdp_fmtp_attr.patch34
-rw-r--r--third-party/versions.mak2
52 files changed, 389 insertions, 308 deletions
diff --git a/CHANGES b/CHANGES
index f339a2202..0f4ced2af 100644
--- a/CHANGES
+++ b/CHANGES
@@ -98,6 +98,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..e624abf77 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,9 @@ 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),)
+ifeq ($(GREP),)
+else ifeq ($(GREP),:)
+else
ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
endif
ifneq ($(AWK),)
@@ -467,7 +469,9 @@ endif
$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
done
-ifneq ($(GREP),)
+ifeq ($(GREP),)
+else ifeq ($(GREP),:)
+else
XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
@@ -486,7 +490,9 @@ doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
@echo
@echo "</docs>" >> $@
-ifneq ($(GREP),)
+ifeq ($(GREP),)
+else ifeq ($(GREP),:)
+else
XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
@@ -630,7 +636,9 @@ oldmodcheck:
fi
ld-cache-update:
-ifneq ($(LDCONFIG),)
+ifeq ($(LDCONFIG),)
+else ifeq ($(LDCONFIG),:)
+else
ifeq ($(DESTDIR),) # DESTDIR means binary archive creation; ldconfig should be run on postinst
@if [ $$(id -u) -eq 0 ] ; then \
$(LDCONFIG) "$(ASTLIBDIR)/" ; \
@@ -929,6 +937,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 +992,9 @@ ifeq ($(HAVE_DAHDI),1)
rm -f $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk
endif
$(MAKE) -C sounds uninstall
-ifneq ($(LDCONFIG),)
+ifeq ($(LDCONFIG),)
+else ifeq ($(LDCONFIG),:)
+else
$(LDCONFIG) "$(ASTLIBDIR)/" || :
endif
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 8c4ff2c4a..278c5876f 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -1174,8 +1174,7 @@ static int ooh323_answer(struct ast_channel *ast)
p->alertsent = 1;
}
ast_setstate(ast, AST_STATE_UP);
- if (option_debug)
- ast_debug(1, "ooh323_answer(%s)\n", ast_channel_name(ast));
+ ast_debug(1, "ooh323_answer(%s)\n", ast_channel_name(ast));
ast_channel_unlock(ast);
ooAnswerCall(p->callToken);
}
diff --git a/apps/app_amd.c b/apps/app_amd.c
index e10f2cc01..3f805bb9a 100644
--- a/apps/app_amd.c
+++ b/apps/app_amd.c
@@ -277,6 +277,12 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
/* Now we go into a loop waiting for frames from the channel */
while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {
+ int ms = 0;
+
+ /* Figure out how long we waited */
+ if (res > 0) {
+ ms = 2 * maxWaitTimeForFrame - res;
+ }
/* If we fail to read in a frame, that means they hung up */
if (!(f = ast_read(chan))) {
@@ -287,15 +293,22 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
break;
}
- if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_NULL || f->frametype == AST_FRAME_CNG) {
- /* If the total time exceeds the analysis time then give up as we are not too sure */
+ if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_CNG) {
+ /* Figure out how long the frame is in milliseconds */
if (f->frametype == AST_FRAME_VOICE) {
framelength = (ast_codec_samples_count(f) / DEFAULT_SAMPLES_PER_MS);
} else {
- framelength = 2 * maxWaitTimeForFrame;
+ framelength = ms;
}
iTotalTime += framelength;
+
+ ast_debug(1, "AMD: Channel [%s] frametype [%s] iTotalTime [%d] framelength [%d] totalAnalysisTime [%d]\n",
+ ast_channel_name(chan),
+ f->frametype == AST_FRAME_VOICE ? "AST_FRAME_VOICE" : "AST_FRAME_CNG",
+ iTotalTime, framelength, totalAnalysisTime);
+
+ /* If the total time exceeds the analysis time then give up as we are not too sure */
if (iTotalTime >= totalAnalysisTime) {
ast_verb(3, "AMD: Channel [%s]. Too long...\n", ast_channel_name(chan));
ast_frfree(f);
@@ -306,7 +319,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
/* Feed the frame of audio into the silence detector and see if we get a result */
if (f->frametype != AST_FRAME_VOICE)
- dspsilence += 2 * maxWaitTimeForFrame;
+ dspsilence += framelength;
else {
dspsilence = 0;
ast_dsp_silence(silenceDetector, f, &dspsilence);
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 48533f592..a47fe3b66 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -815,10 +815,10 @@ static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, stru
/* Sort items */
sort_items(sorted, count);
- if (option_debug) {
- ast_debug(2, "Listing matching entries:\n");
+ if (DEBUG_ATLEAST(2)) {
+ ast_log(LOG_DEBUG, "Listing matching entries:\n");
for (ptr = sorted, i = 0; i < count; i++, ptr++) {
- ast_debug(2, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
+ ast_log(LOG_DEBUG, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
}
}
diff --git a/apps/app_fax.c b/apps/app_fax.c
index 293925ac1..c5d0f514b 100644
--- a/apps/app_fax.c
+++ b/apps/app_fax.c
@@ -995,7 +995,7 @@ static int load_module(void)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Simple FAX Application",
- .support_level = AST_MODULE_SUPPORT_EXTENDED,
+ .support_level = AST_MODULE_SUPPORT_DEPRECATED,
.load = load_module,
.unload = unload_module,
);
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index e9fa2118c..c09fba173 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -1438,7 +1438,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
ast_debug(1, "Using default subject for this email \n");
}
- if (option_debug > 2)
+ if (DEBUG_ATLEAST(3))
fprintf(p, "X-Asterisk-debug: template %s user account %s@%s\n", template->name, vmu->username, vmu->domain);
fprintf(p, "MIME-Version: 1.0\n");
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index c42e1873e..78f573a6c 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -50,7 +50,6 @@
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/cli.h"
-#include "asterisk/astosp.h"
/*** DOCUMENTATION
<application name="OSPAuth" language="en_US">
@@ -436,6 +435,11 @@
</application>
***/
+/* OSP Return statuses */
+#define AST_OSP_SUCCESS ((char*)"SUCCESS") /* Return status, success */
+#define AST_OSP_FAILED ((char*)"FAILED") /* Return status, failed */
+#define AST_OSP_ERROR ((char*)"ERROR") /* Return status, error */
+
/* OSP Buffer Sizes */
#define OSP_SIZE_INTSTR ((unsigned int)16) /* OSP signed/unsigned int string buffer size */
#define OSP_SIZE_NORSTR ((unsigned int)256) /* OSP normal string buffer size */
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 72e3e59c1..82fa3b341 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3657,7 +3657,7 @@ static void set_update(MAILSTREAM * stream)
char buf[1024] = "";
if (!(user = get_user_by_mailbox(mailbox, buf, sizeof(buf))) || !(vms = get_vm_state_by_imapuser(user, 0))) {
- if (user && option_debug > 2)
+ if (user && DEBUG_ATLEAST(3))
ast_log(AST_LOG_WARNING, "User %s mailbox not found for update.\n", user);
return;
}
@@ -6089,22 +6089,33 @@ static int has_voicemail(const char *mailbox, const char *folder)
return 0;
}
-
+/*!
+ * \brief Check the given mailbox's message count.
+ * \param mailbox The @ delimited string for user@context. If no context is found, uses 'default' for the context.
+ * \param urgentmsgs urgent message count.
+ * \param newmsgs new message count.
+ * \param oldmsgs old message count pointer
+ * \return -1 if error occurred, 0 otherwise.
+ */
static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs)
{
char tmp[256];
char *context;
/* If no mailbox, return immediately */
- if (ast_strlen_zero(mailbox))
+ if (ast_strlen_zero(mailbox)) {
return 0;
+ }
- if (newmsgs)
+ if (newmsgs) {
*newmsgs = 0;
- if (oldmsgs)
+ }
+ if (oldmsgs) {
*oldmsgs = 0;
- if (urgentmsgs)
+ }
+ if (urgentmsgs) {
*urgentmsgs = 0;
+ }
if (strchr(mailbox, ',')) {
int tmpnew, tmpold, tmpurgent;
@@ -6114,15 +6125,18 @@ static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *
mb = tmp;
while ((cur = strsep(&mb, ", "))) {
if (!ast_strlen_zero(cur)) {
- if (inboxcount2(cur, urgentmsgs ? &tmpurgent : NULL, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL))
+ if (inboxcount2(cur, urgentmsgs ? &tmpurgent : NULL, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL)) {
return -1;
- else {
- if (newmsgs)
+ } else {
+ if (newmsgs) {
*newmsgs += tmpnew;
- if (oldmsgs)
+ }
+ if (oldmsgs) {
*oldmsgs += tmpold;
- if (urgentmsgs)
+ }
+ if (urgentmsgs) {
*urgentmsgs += tmpurgent;
+ }
}
}
}
@@ -6131,17 +6145,21 @@ static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *
ast_copy_string(tmp, mailbox, sizeof(tmp));
- if ((context = strchr(tmp, '@')))
+ if ((context = strchr(tmp, '@'))) {
*context++ = '\0';
- else
+ } else {
context = "default";
+ }
- if (newmsgs)
+ if (newmsgs) {
*newmsgs = __has_voicemail(context, tmp, "INBOX", 0);
- if (oldmsgs)
+ }
+ if (oldmsgs) {
*oldmsgs = __has_voicemail(context, tmp, "Old", 0);
- if (urgentmsgs)
+ }
+ if (urgentmsgs) {
*urgentmsgs = __has_voicemail(context, tmp, "Urgent", 0);
+ }
return 0;
}
@@ -13241,7 +13259,10 @@ static void stop_poll_thread(void)
poll_thread = AST_PTHREADT_NULL;
}
-/*! \brief Append vmu info string into given astman with event_name. */
+/*!
+ * \brief Append vmu info string into given astman with event_name.
+ * \return 0 failed. 1 otherwise.
+*/
static int append_vmu_info_astman(
struct mansession *s,
struct ast_vm_user *vmu,
@@ -13251,14 +13272,33 @@ static int append_vmu_info_astman(
{
int new;
int old;
+ char *mailbox;
+ int ret;
if((s == NULL) || (vmu == NULL) || (event_name == NULL) || (actionid == NULL)) {
ast_log(LOG_ERROR, "Wrong input parameter.");
return 0;
}
+ /* create mailbox string */
+ if (!ast_strlen_zero(vmu->context)) {
+ ret = ast_asprintf(&mailbox, "%s@%s", vmu->mailbox, vmu->context);
+ } else {
+ ret = ast_asprintf(&mailbox, "%s", vmu->mailbox);
+ }
+ if (ret == -1) {
+ ast_log(LOG_ERROR, "Could not create mailbox string. err[%s]\n", strerror(errno));
+ return 0;
+ }
+
/* get mailbox count */
- inboxcount(vmu->mailbox, &new, &old);
+ ret = inboxcount(mailbox, &new, &old);
+ ast_free(mailbox);
+ if (ret == -1) {
+ ast_log(LOG_ERROR, "Could not get mailbox count. user[%s], context[%s]\n",
+ vmu->mailbox ?: "", vmu->context ?: "");
+ return 0;
+ }
astman_append(s,
"Event: %s\r\n"
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/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index d4da850ce..e04b9fec8 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -35,6 +35,7 @@
/*** MODULEINFO
<depend>res_odbc</depend>
+ <depend>generic_odbc</depend>
<support_level>core</support_level>
***/
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c
index b44bbf52a..efa68c1a9 100644
--- a/cdr/cdr_odbc.c
+++ b/cdr/cdr_odbc.c
@@ -39,6 +39,7 @@
/*** MODULEINFO
<depend>res_odbc</depend>
+ <depend>generic_odbc</depend>
<support_level>extended</support_level>
***/
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index b482fe6c8..3af9b4b3b 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -644,20 +644,20 @@ static int config_module(int reload)
return -1;
}
- if (option_debug) {
+ if (DEBUG_ATLEAST(1)) {
if (ast_strlen_zero(pghostname)) {
- ast_debug(1, "using default unix socket\n");
+ ast_log(LOG_DEBUG, "using default unix socket\n");
} else {
- ast_debug(1, "got hostname of %s\n", pghostname);
+ ast_log(LOG_DEBUG, "got hostname of %s\n", pghostname);
}
- ast_debug(1, "got port of %s\n", pgdbport);
- ast_debug(1, "got user of %s\n", pgdbuser);
- ast_debug(1, "got dbname of %s\n", pgdbname);
- ast_debug(1, "got password of %s\n", pgpassword);
- ast_debug(1, "got application name of %s\n", pgappname);
- ast_debug(1, "got sql table name of %s\n", table);
- ast_debug(1, "got encoding of %s\n", encoding);
- ast_debug(1, "got timezone of %s\n", tz);
+ ast_log(LOG_DEBUG, "got port of %s\n", pgdbport);
+ ast_log(LOG_DEBUG, "got user of %s\n", pgdbuser);
+ ast_log(LOG_DEBUG, "got dbname of %s\n", pgdbname);
+ ast_log(LOG_DEBUG, "got password of %s\n", pgpassword);
+ ast_log(LOG_DEBUG, "got application name of %s\n", pgappname);
+ ast_log(LOG_DEBUG, "got sql table name of %s\n", table);
+ ast_log(LOG_DEBUG, "got encoding of %s\n", encoding);
+ ast_log(LOG_DEBUG, "got timezone of %s\n", tz);
}
pgsql_reconnect();
diff --git a/cel/cel_odbc.c b/cel/cel_odbc.c
index 05c1095cb..b4967b647 100644
--- a/cel/cel_odbc.c
+++ b/cel/cel_odbc.c
@@ -28,6 +28,7 @@
/*** MODULEINFO
<depend>res_odbc</depend>
+ <depend>generic_odbc</depend>
<support_level>core</support_level>
***/
diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c
index 5fe66784b..eb8f5d836 100644
--- a/cel/cel_pgsql.c
+++ b/cel/cel_pgsql.c
@@ -556,18 +556,18 @@ static int process_my_load_module(struct ast_config *cfg)
ast_log(LOG_WARNING,"PostgreSQL Ran out of memory copying schema info\n");
return AST_MODULE_LOAD_DECLINE;
}
- if (option_debug) {
+ if (DEBUG_ATLEAST(3)) {
if (ast_strlen_zero(pghostname)) {
- ast_debug(3, "cel_pgsql: using default unix socket\n");
+ ast_log(LOG_DEBUG, "cel_pgsql: using default unix socket\n");
} else {
- ast_debug(3, "cel_pgsql: got hostname of %s\n", pghostname);
+ ast_log(LOG_DEBUG, "cel_pgsql: got hostname of %s\n", pghostname);
}
- ast_debug(3, "cel_pgsql: got port of %s\n", pgdbport);
- ast_debug(3, "cel_pgsql: got user of %s\n", pgdbuser);
- ast_debug(3, "cel_pgsql: got dbname of %s\n", pgdbname);
- ast_debug(3, "cel_pgsql: got password of %s\n", pgpassword);
- ast_debug(3, "cel_pgsql: got sql table name of %s\n", table);
- ast_debug(3, "cel_pgsql: got show_user_defined of %s\n",
+ ast_log(LOG_DEBUG, "cel_pgsql: got port of %s\n", pgdbport);
+ ast_log(LOG_DEBUG, "cel_pgsql: got user of %s\n", pgdbuser);
+ ast_log(LOG_DEBUG, "cel_pgsql: got dbname of %s\n", pgdbname);
+ ast_log(LOG_DEBUG, "cel_pgsql: got password of %s\n", pgpassword);
+ ast_log(LOG_DEBUG, "cel_pgsql: got sql table name of %s\n", table);
+ ast_log(LOG_DEBUG, "cel_pgsql: got show_user_defined of %s\n",
cel_show_user_def ? "Yes" : "No");
}
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index de2c15279..0579a5a36 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -15058,14 +15058,14 @@ retry:
ast_mutex_lock(&p->lock);
if (p->owner && !p->restartpending) {
if (ast_channel_trylock(p->owner)) {
- if (option_debug > 2)
+ if (DEBUG_ATLEAST(3))
ast_verbose("Avoiding deadlock\n");
/* Avoid deadlock since you're not supposed to lock iflock or pvt before a channel */
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&iflock);
goto retry;
}
- if (option_debug > 2)
+ if (DEBUG_ATLEAST(3))
ast_verbose("Softhanging up on %s\n", ast_channel_name(p->owner));
ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_EXPLICIT);
p->restartpending = 1;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index acf5a147e..cd2929448 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10964,22 +10964,25 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
if (portno != -1 || vportno != -1 || tportno != -1) {
/* We are now ready to change the sip session and RTP structures with the offered codecs, since
they are acceptable */
+ unsigned int framing;
ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);
ast_format_cap_append_from_cap(p->jointcaps, newjointcapability, AST_MEDIA_TYPE_UNKNOWN); /* Our joint codec profile for this call */
ast_format_cap_remove_by_type(p->peercaps, AST_MEDIA_TYPE_UNKNOWN);
ast_format_cap_append_from_cap(p->peercaps, newpeercapability, AST_MEDIA_TYPE_UNKNOWN); /* The other side's capability in latest offer */
p->jointnoncodeccapability = newnoncodeccapability; /* DTMF capabilities */
+ tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0);
+ framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt);
/* respond with single most preferred joint codec, limiting the other side's choice */
if (ast_test_flag(&p->flags[1], SIP_PAGE2_PREFERRED_CODEC)) {
- unsigned int framing;
-
- tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0);
- framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt);
ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);
ast_format_cap_append(p->jointcaps, tmp_fmt, framing);
- ao2_ref(tmp_fmt, -1);
}
+ if (!ast_rtp_codecs_get_framing(&newaudiortp)) {
+ /* Peer did not force us to use a specific framing, so use our own */
+ ast_rtp_codecs_set_framing(&newaudiortp, framing);
+ }
+ ao2_ref(tmp_fmt, -1);
}
/* Setup audio address and port */
@@ -11488,6 +11491,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_
if (framing && p->autoframing) {
ast_debug(1, "Setting framing to %ld\n", framing);
ast_format_cap_set_framing(p->caps, framing);
+ ast_rtp_codecs_set_framing(newaudiortp, framing);
}
found = TRUE;
} else if (sscanf(a, "rtpmap: %30u %127[^/]/%30u", &codec, mimeSubtype, &sample_rate) == 3) {
@@ -22475,7 +22479,7 @@ static void sip_dump_history(struct sip_pvt *dialog)
return;
}
- if (!option_debug && !sipdebug) {
+ if (!sipdebug && !DEBUG_ATLEAST(1)) {
if (!errmsg) {
ast_log(LOG_NOTICE, "You must have debugging enabled (SIP or Asterisk) in order to dump SIP history.\n");
errmsg = 1;
@@ -22483,20 +22487,20 @@ static void sip_dump_history(struct sip_pvt *dialog)
return;
}
- ast_debug(1, "\n---------- SIP HISTORY for '%s' \n", dialog->callid);
+ ast_log(LOG_DEBUG, "\n---------- SIP HISTORY for '%s' \n", dialog->callid);
if (dialog->subscribed) {
- ast_debug(1, " * Subscription\n");
+ ast_log(LOG_DEBUG, " * Subscription\n");
} else {
- ast_debug(1, " * SIP Call\n");
+ ast_log(LOG_DEBUG, " * SIP Call\n");
}
if (dialog->history) {
AST_LIST_TRAVERSE(dialog->history, hist, list)
- ast_debug(1, " %-3.3d. %s\n", ++x, hist->event);
+ ast_log(LOG_DEBUG, " %-3.3d. %s\n", ++x, hist->event);
}
if (!x) {
- ast_debug(1, "Call '%s' has no history\n", dialog->callid);
+ ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid);
}
- ast_debug(1, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid);
+ ast_log(LOG_DEBUG, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid);
}
@@ -23984,6 +23988,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..9add31da4 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"
@@ -19762,9 +19762,7 @@ _ACEOF
fi
-
-if test "${PBX_BFD}" = "0"; then
- # Fedora/RedHat/CentOS require extra libraries
+# Fedora/RedHat/CentOS require extra libraries
if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
pbxlibdir=""
@@ -19779,9 +19777,9 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_check_format in -lbfd" >&5
-$as_echo_n "checking for bfd_check_format in -lbfd... " >&6; }
-if ${ac_cv_lib_bfd_bfd_check_format+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19795,27 +19793,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char bfd_check_format ();
+char bfd_openr ();
int
main ()
{
-return bfd_check_format ();
+return bfd_openr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_bfd_bfd_check_format=yes
+ ac_cv_lib_bfd_bfd_openr=yes
else
- ac_cv_lib_bfd_bfd_check_format=no
+ ac_cv_lib_bfd_bfd_openr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_check_format" >&5
-$as_echo "$ac_cv_lib_bfd_bfd_check_format" >&6; }
-if test "x$ac_cv_lib_bfd_bfd_check_format" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
AST_BFD_FOUND=yes
else
AST_BFD_FOUND=no
@@ -19861,10 +19859,7 @@ _ACEOF
fi
-fi
-
-if test "${PBX_BFD}" = "0"; then
- # openSUSE requires -lz
+# openSUSE requires -lz
if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
pbxlibdir=""
@@ -19879,9 +19874,9 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_check_format in -lbfd" >&5
-$as_echo_n "checking for bfd_check_format in -lbfd... " >&6; }
-if ${ac_cv_lib_bfd_bfd_check_format+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19895,27 +19890,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char bfd_check_format ();
+char bfd_openr ();
int
main ()
{
-return bfd_check_format ();
+return bfd_openr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_bfd_bfd_check_format=yes
+ ac_cv_lib_bfd_bfd_openr=yes
else
- ac_cv_lib_bfd_bfd_check_format=no
+ ac_cv_lib_bfd_bfd_openr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_check_format" >&5
-$as_echo "$ac_cv_lib_bfd_bfd_check_format" >&6; }
-if test "x$ac_cv_lib_bfd_bfd_check_format" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
AST_BFD_FOUND=yes
else
AST_BFD_FOUND=no
@@ -19961,7 +19956,6 @@ _ACEOF
fi
-fi
case "${OSARCH}" in
linux*)
@@ -20768,8 +20762,7 @@ $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h
fi
fi
-if test "${PBX_LIBEDIT}" != 1; then
- # some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
+# some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
if test "x${PBX_LIBEDIT}" != "x1" -a "${USE_LIBEDIT}" != "no"; then
pbxlibdir=""
@@ -20866,7 +20859,6 @@ _ACEOF
fi
-fi
if test "${PBX_LIBEDIT}" != 1; then
as_fn_error $? "*** Please install the 'libedit' development package." "$LINENO" 5
exit 1
@@ -29706,7 +29698,7 @@ if test "x${PBX_LUA}" = "x1" ; then
fi
fi
-# Some distributions (like SuSE) remove the 5.1 suffix.
+# Some distributions (like openSUSE and NetBSD) remove the 5.x suffix.
if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
pbxlibdir=""
@@ -29721,9 +29713,9 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for luaL_openlib in -llua" >&5
-$as_echo_n "checking for luaL_openlib in -llua... " >&6; }
-if ${ac_cv_lib_lua_luaL_openlib+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for luaL_newstate in -llua" >&5
+$as_echo_n "checking for luaL_newstate in -llua... " >&6; }
+if ${ac_cv_lib_lua_luaL_newstate+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -29737,27 +29729,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char luaL_openlib ();
+char luaL_newstate ();
int
main ()
{
-return luaL_openlib ();
+return luaL_newstate ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_lua_luaL_openlib=yes
+ ac_cv_lib_lua_luaL_newstate=yes
else
- ac_cv_lib_lua_luaL_openlib=no
+ ac_cv_lib_lua_luaL_newstate=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_luaL_openlib" >&5
-$as_echo "$ac_cv_lib_lua_luaL_openlib" >&6; }
-if test "x$ac_cv_lib_lua_luaL_openlib" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_luaL_newstate" >&5
+$as_echo "$ac_cv_lib_lua_luaL_newstate" >&6; }
+if test "x$ac_cv_lib_lua_luaL_newstate" = xyes; then :
AST_LUA_FOUND=yes
else
AST_LUA_FOUND=no
diff --git a/configure.ac b/configure.ac
index 1bb4bc4ff..893489ac3 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(
@@ -1458,16 +1458,10 @@ PKG_PROG_PKG_CONFIG()
AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
-
-if test "${PBX_BFD}" = "0"; then
- # Fedora/RedHat/CentOS require extra libraries
- AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty])
-fi
-
-if test "${PBX_BFD}" = "0"; then
- # openSUSE requires -lz
- AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty -lz])
-fi
+# Fedora/RedHat/CentOS require extra libraries
+AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty])
+# openSUSE requires -lz
+AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty -lz])
case "${OSARCH}" in
linux*)
@@ -1575,10 +1569,8 @@ if test "${USE_ILBC}" != "no"; then
fi
AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
-if test "${PBX_LIBEDIT}" != 1; then
- # some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
- AST_EXT_LIB_CHECK([LIBEDIT], [edit], [history_init], [histedit.h], [-ltermcap])
-fi
+# some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
+AST_EXT_LIB_CHECK([LIBEDIT], [edit], [history_init], [histedit.h], [-ltermcap])
if test "${PBX_LIBEDIT}" != 1; then
AC_MSG_ERROR(*** Please install the 'libedit' development package.)
exit 1
@@ -2387,8 +2379,8 @@ if test "x${PBX_LUA}" = "x1" ; then
fi
fi
-# Some distributions (like SuSE) remove the 5.1 suffix.
-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm])
+# Some distributions (like openSUSE and NetBSD) remove the 5.x suffix.
+AST_EXT_LIB_CHECK([LUA], [lua], [luaL_newstate], [lua.h], [-lm])
# Accept either RADIUS client library, their APIs are fully compatible,
# just different header filenames and different SONAMEs
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index 0f6b65e7d..0d053f614 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -29,6 +29,7 @@
/*** MODULEINFO
<depend>res_odbc</depend>
+ <depend>generic_odbc</depend>
<support_level>core</support_level>
***/
diff --git a/include/asterisk/astosp.h b/include/asterisk/astosp.h
deleted file mode 100644
index 4faa2b4e7..000000000
--- a/include/asterisk/astosp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*!
- * \file
- * \brief Open Settlement Protocol (OSP)
- */
-
-#ifndef _ASTERISK_OSP_H
-#define _ASTERISK_OSP_H
-
-#define AST_OSP_SUCCESS ((char*)"SUCCESS") /* Return status, success */
-#define AST_OSP_FAILED ((char*)"FAILED") /* Return status, failed */
-#define AST_OSP_ERROR ((char*)"ERROR") /* Return status, error */
-
-#endif /* _ASTERISK_OSP_H */
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/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/callerid.c b/main/callerid.c
index d6f8575fb..6c4e5cf04 100644
--- a/main/callerid.c
+++ b/main/callerid.c
@@ -501,7 +501,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
case 0x06: /* short dial number */
case 0x07: /* reserved */
default: /* reserved */
- if (option_debug > 1)
+ if (DEBUG_ATLEAST(2))
ast_log(LOG_NOTICE, "did info:#1=%X\n", (unsigned)cid->rawdata[x]);
break ;
}
diff --git a/main/config.c b/main/config.c
index 27a61c299..dfa6f0923 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2187,10 +2187,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;
}
}
@@ -2777,9 +2777,7 @@ int ast_config_text_file_save2(const char *configfile, const struct ast_config *
}
cat = cat->next;
}
- if (!option_debug) {
- ast_verb(2, "Saving '%s': saved\n", fn);
- }
+ ast_verb(2, "Saving '%s': saved\n", fn);
} else {
ast_debug(1, "Unable to open for writing: %s\n", fn);
ast_verb(2, "Unable to write '%s' (%s)\n", fn, strerror(errno));
diff --git a/main/netsock2.c b/main/netsock2.c
index ef74ab92b..fedbd94a0 100644
--- a/main/netsock2.c
+++ b/main/netsock2.c
@@ -443,7 +443,7 @@ uint16_t _ast_sockaddr_port(const struct ast_sockaddr *addr, const char *file, i
&& addr->ss.ss_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)&addr->ss)->sin6_port);
}
- if (option_debug >= 1) {
+ if (DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Not an IPv4 nor IPv6 address, cannot get port.\n");
}
return 0;
@@ -461,7 +461,7 @@ void _ast_sockaddr_set_port(struct ast_sockaddr *addr, uint16_t port, const char
} else if (addr->len == sizeof(struct sockaddr_in6)
&& addr->ss.ss_family == AF_INET6) {
((struct sockaddr_in6 *)&addr->ss)->sin6_port = htons(port);
- } else if (option_debug >= 1) {
+ } else if (DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func,
"Not an IPv4 nor IPv6 address, cannot set port.\n");
}
@@ -657,7 +657,7 @@ int _ast_sockaddr_to_sin(const struct ast_sockaddr *addr,
return 0;
}
- if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+ if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
}
@@ -670,7 +670,7 @@ void _ast_sockaddr_from_sin(struct ast_sockaddr *addr, const struct sockaddr_in
{
memcpy(&addr->ss, sin, sizeof(*sin));
- if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+ if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
}
diff --git a/main/pbx.c b/main/pbx.c
index 942c15c05..70e72fe43 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7508,13 +7508,13 @@ static int ast_add_extension2_lockopt(struct ast_context *con,
ast_add_hint(tmp);
}
}
- if (option_debug) {
+ if (DEBUG_ATLEAST(1)) {
if (tmp->matchcid == AST_EXT_MATCHCID_ON) {
- ast_debug(1, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
- tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
+ ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
+ tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
} else {
- ast_debug(1, "Added extension '%s' priority %d to %s (%p)\n",
- tmp->name, tmp->priority, con->name, con);
+ ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s (%p)\n",
+ tmp->name, tmp->priority, con->name, con);
}
}
diff --git a/main/sched.c b/main/sched.c
index a4ca260c6..d8afc74e6 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -31,10 +31,7 @@
#include "asterisk.h"
#ifdef DEBUG_SCHEDULER
-#define DEBUG(a) do { \
- if (option_debug) \
- DEBUG_M(a) \
- } while (0)
+#define DEBUG(a) a
#else
#define DEBUG(a)
#endif
@@ -548,8 +545,7 @@ int ast_sched_add_variable(struct ast_sched_context *con, int when, ast_sched_cb
}
#ifdef DUMP_SCHEDULER
/* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
- if (option_debug)
- ast_sched_dump(con);
+ ast_sched_dump(con);
#endif
if (con->sched_thread) {
ast_cond_signal(&con->sched_thread->cond);
@@ -649,8 +645,7 @@ int _ast_sched_del(struct ast_sched_context *con, int id, const char *file, int
#ifdef DUMP_SCHEDULER
/* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
- if (option_debug)
- ast_sched_dump(con);
+ ast_sched_dump(con);
#endif
if (con->sched_thread) {
ast_cond_signal(&con->sched_thread->cond);
@@ -711,25 +706,33 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc
void ast_sched_dump(struct ast_sched_context *con)
{
struct sched *q;
- struct timeval when = ast_tvnow();
+ struct timeval when;
int x;
size_t heap_size;
+
+ if (!DEBUG_ATLEAST(1)) {
+ return;
+ }
+
+ when = ast_tvnow();
#ifdef SCHED_MAX_CACHE
- ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n",
+ ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
#else
- ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
+ ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n",
+ ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
#endif
- ast_debug(1, "=============================================================\n");
- ast_debug(1, "|ID Callback Data Time (sec:ms) |\n");
- ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
+ ast_log(LOG_DEBUG, "=============================================================\n");
+ ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n");
+ ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n");
ast_mutex_lock(&con->lock);
heap_size = ast_heap_size(con->sched_heap);
for (x = 1; x <= heap_size; x++) {
struct timeval delta;
q = ast_heap_peek(con->sched_heap, x);
delta = ast_tvsub(q->when, when);
- ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
+ ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->sched_id->id,
q->callback,
q->data,
@@ -737,7 +740,7 @@ void ast_sched_dump(struct ast_sched_context *con)
(long int)delta.tv_usec);
}
ast_mutex_unlock(&con->lock);
- ast_debug(1, "=============================================================\n");
+ ast_log(LOG_DEBUG, "=============================================================\n");
}
/*! \brief
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/main/utils.c b/main/utils.c
index dab8889a6..c2e07fccf 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -189,7 +189,9 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
+#ifndef HAVE_GETHOSTBYNAME_R_5
int res;
+#endif
int herrno;
int dots = 0;
const char *s;
@@ -199,7 +201,6 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
integers, we break with tradition and refuse to look up a
pure integer */
s = host;
- res = 0;
while (s && *s) {
if (*s == '.')
dots++;
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 10265c93d..15d9ec018 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -548,11 +548,11 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
} /*!< while (ldap_attribute_name) */
ber_free(ber, 0);
if (static_table_config == table_config) {
- if (option_debug > 2) {
+ if (DEBUG_ATLEAST(3)) {
const struct ast_variable *tmpdebug = variable_named(var, "variable_name");
const struct ast_variable *tmpdebug2 = variable_named(var, "variable_value");
if (tmpdebug && tmpdebug2) {
- ast_debug(3, "Added to vars - %s = %s\n", tmpdebug->value, tmpdebug2->value);
+ ast_log(LOG_DEBUG, "Added to vars - %s = %s\n", tmpdebug->value, tmpdebug2->value);
}
}
vars[entry_index++] = var;
@@ -1618,14 +1618,14 @@ static int update2_ldap(const char *basedn, const char *table_name, const struct
/* Ready to update */
ast_debug(3, "Modifying %zu matched entries\n", entry_count);
- if (option_debug > 2) {
+ if (DEBUG_ATLEAST(3)) {
size_t i;
for (i = 0; modifications[i]; i++) {
if (modifications[i]->mod_op != LDAP_MOD_DELETE) {
- ast_debug(3, "%s => %s\n", modifications[i]->mod_type,
- modifications[i]->mod_values[0]);
+ ast_log(LOG_DEBUG, "%s => %s\n", modifications[i]->mod_type,
+ modifications[i]->mod_values[0]);
} else {
- ast_debug(3, "deleting %s\n", modifications[i]->mod_type);
+ ast_log(LOG_DEBUG, "deleting %s\n", modifications[i]->mod_type);
}
}
}
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 186e89dcd..5d6c2c60a 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -30,6 +30,7 @@
/*** MODULEINFO
<depend>res_odbc</depend>
+ <depend>generic_odbc</depend>
<support_level>core</support_level>
***/
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index cee4e488d..c259b30c1 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -1528,16 +1528,16 @@ static int parse_config(int is_reload)
ast_config_destroy(config);
- if (option_debug) {
+ if (DEBUG_ATLEAST(1)) {
if (!ast_strlen_zero(dbhost)) {
- ast_debug(1, "PostgreSQL RealTime Host: %s\n", dbhost);
- ast_debug(1, "PostgreSQL RealTime Port: %i\n", dbport);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime Host: %s\n", dbhost);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime Port: %i\n", dbport);
} else {
- ast_debug(1, "PostgreSQL RealTime Socket: %s\n", dbsock);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime Socket: %s\n", dbsock);
}
- ast_debug(1, "PostgreSQL RealTime User: %s\n", dbuser);
- ast_debug(1, "PostgreSQL RealTime Password: %s\n", dbpass);
- ast_debug(1, "PostgreSQL RealTime DBName: %s\n", dbname);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime User: %s\n", dbuser);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime Password: %s\n", dbpass);
+ ast_log(LOG_DEBUG, "PostgreSQL RealTime DBName: %s\n", dbname);
}
if (!pgsql_reconnect(NULL)) {
diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index 83d2dca72..af3b12449 100644
--- a/res/res_config_sqlite.c
+++ b/res/res_config_sqlite.c
@@ -1773,7 +1773,7 @@ static int load_module(void)
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Realtime SQLite configuration",
- .support_level = AST_MODULE_SUPPORT_EXTENDED,
+ .support_level = AST_MODULE_SUPPORT_DEPRECATED,
.load = load_module,
.unload = unload_module,
.load_pri = AST_MODPRI_REALTIME_DRIVER,
diff --git a/res/res_http_post.c b/res/res_http_post.c
index 44bb8ee9d..f36b772d4 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -36,7 +36,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <gmime/gmime.h>
-#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__Darwin__)
+#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Darwin__)
#include <libgen.h>
#endif
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 95acf554d..efedab7c3 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -1007,7 +1007,7 @@ static int unload_module(void)
/* usecount semantics need to be defined */
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Call Monitoring Resource",
- .support_level = AST_MODULE_SUPPORT_CORE,
+ .support_level = AST_MODULE_SUPPORT_DEPRECATED,
.load = load_module,
.unload = unload_module,
.load_pri = AST_MODPRI_CHANNEL_DEPEND,
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_rfc3326.c b/res/res_pjsip_rfc3326.c
index 6c02a176c..5ac16f024 100644
--- a/res/res_pjsip_rfc3326.c
+++ b/res/res_pjsip_rfc3326.c
@@ -91,12 +91,12 @@ static void rfc3326_add_reason_header(struct ast_sip_session *session, struct pj
{
char buf[20];
- snprintf(buf, sizeof(buf), "Q.850;cause=%i", ast_channel_hangupcause(session->channel) & 0x7f);
- ast_sip_add_header(tdata, "Reason", buf);
-
if (ast_channel_hangupcause(session->channel) == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_sip_add_header(tdata, "Reason", "SIP;cause=200;text=\"Call completed elsewhere\"");
}
+
+ snprintf(buf, sizeof(buf), "Q.850;cause=%i", ast_channel_hangupcause(session->channel) & 0x7f);
+ ast_sip_add_header(tdata, "Reason", buf);
}
static void rfc3326_outgoing_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index fcd190bcb..f25201731 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -876,15 +876,30 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_
struct ast_stream_topology *topology;
unsigned int changed = 0;
- /* This situation can legitimately happen when an SDP is received in a
- * 183 Session Progress message. In that case, everything's been done
- * by the time this function is called and there are no more pending
- * streams.
- */
if (!session->pending_media_state->topology) {
- ast_debug(1, "Pending topology was NULL for channel '%s'\n",
- session->channel ? ast_channel_name(session->channel) : "unknown");
- return 0;
+ if (session->active_media_state->topology) {
+ /*
+ * This happens when we have negotiated media after receiving a 183,
+ * and we're now receiving a 200 with a new SDP. In this case, there
+ * is active_media_state, but the pending_media_state has been reset.
+ */
+ struct ast_sip_session_media_state *active_media_state_clone;
+
+ active_media_state_clone =
+ ast_sip_session_media_state_clone(session->active_media_state);
+ if (!active_media_state_clone) {
+ ast_log(LOG_WARNING, "Unable to clone active media state for channel '%s'\n",
+ session->channel ? ast_channel_name(session->channel) : "unknown");
+ return -1;
+ }
+
+ ast_sip_session_media_state_free(session->pending_media_state);
+ session->pending_media_state = active_media_state_clone;
+ } else {
+ ast_log(LOG_WARNING, "No pending or active media state for channel '%s'\n",
+ session->channel ? ast_channel_name(session->channel) : "unknown");
+ return -1;
+ }
}
/* If we're handling negotiated streams, then we should already have set
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index d3273b463..d0e482405 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
@@ -4562,11 +4565,9 @@ static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *fr
format = frame->subclass.format;
if (ast_format_cmp(rtp->lasttxformat, format) == AST_FORMAT_CMP_NOT_EQUAL) {
/* Oh dear, if the format changed we will have to set up a new smoother */
- if (option_debug > 0) {
- ast_debug(1, "Ooh, format changed from %s to %s\n",
- ast_format_get_name(rtp->lasttxformat),
- ast_format_get_name(frame->subclass.format));
- }
+ ast_debug(1, "Ooh, format changed from %s to %s\n",
+ ast_format_get_name(rtp->lasttxformat),
+ ast_format_get_name(frame->subclass.format));
ao2_replace(rtp->lasttxformat, format);
if (rtp->smoother) {
ast_smoother_free(rtp->smoother);
@@ -5741,7 +5742,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance,
ast_sockaddr_stringify(&remote_address),
strerror(errno));
} else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
- if (option_debug || rtpdebug) {
+ if (rtpdebug || DEBUG_ATLEAST(1)) {
ast_log(LOG_WARNING,
"RTP NAT: Can't write RTP to private "
"address %s, waiting for other end to "
@@ -6114,13 +6115,14 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
if (ext) {
hdrlen += (ntohl(rtpheader[hdrlen/4]) & 0xffff) << 2;
hdrlen += 4;
- if (option_debug) {
+ if (DEBUG_ATLEAST(1)) {
unsigned int profile;
profile = (ntohl(rtpheader[3]) & 0xffff0000) >> 16;
- if (profile == 0x505a)
- ast_debug(1, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
- else
- ast_debug(1, "Found unknown RTP Extensions %x\n", profile);
+ if (profile == 0x505a) {
+ ast_log(LOG_DEBUG, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
+ } else {
+ ast_log(LOG_DEBUG, "Found unknown RTP Extensions %x\n", profile);
+ }
}
}
@@ -7376,7 +7378,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 +7403,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",
);
diff --git a/third-party/pjproject/patches/0070-sdp_media_fmt.patch b/third-party/pjproject/patches/0070-sdp_media_fmt.patch
deleted file mode 100644
index 0a0977d55..000000000
--- a/third-party/pjproject/patches/0070-sdp_media_fmt.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c
-index a3dd80b..0a13206 100644
---- a/pjmedia/src/pjmedia/sdp.c
-+++ b/pjmedia/src/pjmedia/sdp.c
-@@ -1516,11 +1516,12 @@ PJ_DEF(pj_status_t) pjmedia_sdp_validate2(const pjmedia_sdp_session *sdp,
- * RTC based programs sends "null" for instant messaging!
- */
- if (pj_isdigit(*m->desc.fmt[j].ptr)) {
-- unsigned pt = pj_strtoul(&m->desc.fmt[j]);
-+ unsigned long pt;
-+ pj_status_t status = pj_strtoul3(&m->desc.fmt[j], &pt, 10);
-
- /* Payload type is between 0 and 127.
- */
-- CHECK( pt <= 127, PJMEDIA_SDP_EINPT);
-+ CHECK( status == PJ_SUCCESS && pt <= 127, PJMEDIA_SDP_EINPT);
-
- /* If port is not zero, then for each dynamic payload type, an
- * rtpmap attribute must be specified.
diff --git a/third-party/pjproject/patches/0071-sdp_fmtp_attr.patch b/third-party/pjproject/patches/0071-sdp_fmtp_attr.patch
deleted file mode 100644
index 8228d5dd6..000000000
--- a/third-party/pjproject/patches/0071-sdp_fmtp_attr.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c
-index a3dd80b..6117e07 100644
---- a/pjmedia/src/pjmedia/sdp.c
-+++ b/pjmedia/src/pjmedia/sdp.c
-@@ -256,7 +256,8 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get_rtpmap( const pjmedia_sdp_attr *attr,
-
- PJ_ASSERT_RETURN(pj_strcmp2(&attr->name, "rtpmap")==0, PJ_EINVALIDOP);
-
-- PJ_ASSERT_RETURN(attr->value.slen != 0, PJMEDIA_SDP_EINATTR);
-+ if (attr->value.slen == 0)
-+ return PJMEDIA_SDP_EINATTR;
-
- init_sdp_parser();
-
-@@ -341,6 +342,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get_fmtp( const pjmedia_sdp_attr *attr,
-
- PJ_ASSERT_RETURN(pj_strcmp2(&attr->name, "fmtp")==0, PJ_EINVALIDOP);
-
-+ if (attr->value.slen == 0)
-+ return PJMEDIA_SDP_EINATTR;
-+
- /* fmtp BNF:
- * a=fmtp:<format> <format specific parameter>
- */
-@@ -379,6 +383,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get_rtcp(const pjmedia_sdp_attr *attr,
-
- PJ_ASSERT_RETURN(pj_strcmp2(&attr->name, "rtcp")==0, PJ_EINVALIDOP);
-
-+ if (attr->value.slen == 0)
-+ return PJMEDIA_SDP_EINATTR;
-+
- init_sdp_parser();
-
- /* fmtp BNF:
diff --git a/third-party/versions.mak b/third-party/versions.mak
index a90a52348..b6daf1989 100644
--- a/third-party/versions.mak
+++ b/third-party/versions.mak
@@ -1,2 +1,2 @@
-PJPROJECT_VERSION = 2.7.1
+PJPROJECT_VERSION = 2.7.2