Skip to content
Commits on Source (10)
[gerrit]
defaultbranch=13
#
# 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=13
13.20.0
\ No newline at end of file
13.22.0
\ No newline at end of file
......@@ -8,6 +8,85 @@
===
==============================================================================
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.21.0 to Asterisk 13.22.0 ----------
------------------------------------------------------------------------------
Core
------------------
* Core bridging and, more specifically, bridge_softmix have been enhanced to
relay received frames of type TEXT or TEXT_DATA to all participants in a
softmix bridge. res_pjsip_messaging and chan_pjsip have been enhanced to
take advantage of this so when res_pjsip_messaging receives an in-dialog
MESSAGE message from a user in a conference call, it's relayed to all
other participants in the call.
app_sendtext
------------------
Support Enhanced Messaging. SendText now accepts new channel variables
that can be used to override the To and From display names and set the
Content-Type of a message. Since you can now set Content-Type, other
text/* content types are now valid.
app_confbridge
------------------
* ConfbridgeList now shows talking status. This utilizes the same voice
detection as the ConfbridgeTalking event, so bridges must be configured
with "talk_detection_events=yes" for this flag to have meaning.
res_pjsip
------------------
* Two new options have been added to the system and endpoint objects to
control whether, on outbound calls, Asterisk will accept updated SDP answers
during the initial INVITE transaction when 100rel is not in effect.
This usually happens when the INVITE is forked to multiple UASs and more
than one sends an SDP answer or when a single UAS needs to change a media
port to switch from custom ringback to the actual media destination.
The 'follow_early_media_forked' option sets whether Asterisk will accept
the updated SDP when the To tag on the subsequent response is different than
that on the the previous response. This usually occurs in the forked INVITE
scenario. The default value is "yes" which is the current behavior.
The 'accept_multiple_sdp_answers' flag sets whether Asterisk will accept the
updated SDP when the To tag on the subsequent response is the same as that
on the previous response. This can occur when a UAS needs to switch media
ports from custom ringback to the final media path. The default value is
"no" which is the current behavior.
These options have to be enabled system-wide in the system config section
of pjsip.conf as well as on individual endpoints that require the
functionality.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.20.0 to Asterisk 13.21.0 ----------
------------------------------------------------------------------------------
Build System
------------------
* RADIUS backends for CEL and CDR can now also be built using the radcli
client library, in addition to the existing support for building them
using either freeradius or radiusclient-ng.
Core
------------------
* A new configuration option "genericplc_on_equal_codecs" was added to the
"plc" section of codecs.conf to allow generic packet loss concealment even
if no transcoding was originally needed. Transcoding via SLIN is forced
in this case.
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.
res_pjsip_notify
------------------
* Extend the PJSIPNotify AMI command to send an in-dialog notify on a
channel.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.19.0 to Asterisk 13.20.0 ----------
------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -218,7 +218,9 @@ ifeq ($(AST_DEVMODE),yes)
endif
endif
ifneq ($(findstring BSD,$(OSARCH)),)
ifeq ($(OSARCH),NetBSD)
_ASTCFLAGS+=-isystem /usr/pkg/include
else ifneq ($(findstring BSD,$(OSARCH)),)
_ASTCFLAGS+=-isystem /usr/local/include
endif
......@@ -229,7 +231,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)
......@@ -240,7 +242,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),)
......@@ -283,7 +287,9 @@ else
# These are used for all but Darwin
SOLINK=-shared
DYLINK=$(SOLINK)
ifneq ($(findstring BSD,$(OSARCH)),)
ifeq ($(OSARCH),NetBSD)
_ASTLDFLAGS+=-L/usr/pkg/lib
else ifneq ($(findstring BSD,$(OSARCH)),)
_ASTLDFLAGS+=-L/usr/local/lib
endif
endif
......@@ -468,7 +474,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
......@@ -487,7 +495,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
......@@ -502,7 +512,7 @@ else
@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@echo "<?xml-stylesheet type=\"text/xsl\" href=\"appdocsxml.xslt\"?>" >> $@
@echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
@for x in $(MOD_SUBDIRS); do \
@for x in $(filter-out third-party,$(MOD_SUBDIRS)); do \
printf "$$x " ; \
for i in `find $$x -name '*.c'`; do \
$(PYTHON) build_tools/get_documentation.py < $$i >> $@ ; \
......@@ -631,7 +641,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)/" ; \
......@@ -930,8 +942,20 @@ 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 [ -f /etc/slackware-version ]; then \
./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
elif [ -f /etc/os-release ] && [ "slackware" = "$(shell . /etc/os-release && echo $$ID)" ] ; then \
./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist" ]; then \
./build_tools/install_subst contrib/init.d/org.asterisk.asterisk.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist"; \
......@@ -939,8 +963,6 @@ config:
if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist" ]; then \
./build_tools/install_subst contrib/init.d/org.asterisk.muted.plist "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.muted.plist"; \
fi; \
elif [ -f /etc/slackware-version ]; then \
echo "Slackware is not currently supported, although an init script does exist for it."; \
else \
echo "We could not install init scripts for your distribution." ; \
fi
......@@ -977,7 +999,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
......
......@@ -21,6 +21,14 @@
=== UPGRADE-12.txt -- Upgrade info for 11 to 12
===========================================================
From 13.20.0 to 13.21.0:
app_dial
------------------
* The Dial application now supports early-media video (in addition to
audio) on both the calling as well as the called party.
Be aware that this is a change in behavior.
From 13.19.0 to 13.20.0:
app_confbridge
......
......@@ -65,6 +65,7 @@ ifneq ($(wildcard mp3/Makefile),)
format_mp3.so: mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o
endif
chan_mobile.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
chan_ooh323.o: _ASTCFLAGS+=$(H323CFLAGS)
chan_ooh323.so: _ASTCFLAGS+=$(H323CFLAGS)
chan_ooh323.so: $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o
......
......@@ -60,6 +60,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define DATE_FORMAT "%Y-%m-%d %T"
#ifndef MYSQL_PORT
# ifdef MARIADB_PORT
# define MYSQL_PORT MARIADB_PORT
# else
# define MYSQL_PORT 3306
# endif
#endif
AST_THREADSTORAGE(sql1_buf);
AST_THREADSTORAGE(sql2_buf);
AST_THREADSTORAGE(escape_buf);
......
......@@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/compat.h"
#include "asterisk/lock.h"
#include "asterisk/callerid.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/logger.h"
......@@ -163,6 +164,12 @@ struct mbl_pvt {
AST_LIST_ENTRY(mbl_pvt) entry;
};
/*! Structure used by hfp_parse_clip to return two items */
struct cidinfo {
char *cnum;
char *cnam;
};
static AST_RWLIST_HEAD_STATIC(devices, mbl_pvt);
static int handle_response_ok(struct mbl_pvt *pvt, char *buf);
......@@ -208,7 +215,7 @@ static char *mblsendsms_desc =
" Dest - destination\n"
" Message - text of the message\n";
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num,
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, struct cidinfo *cidinfo,
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor);
static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *cap,
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);
......@@ -364,7 +371,8 @@ static struct hfp_hf hfp_our_brsf = {
static int hfp_parse_ciev(struct hfp_pvt *hfp, char *buf, int *value);
static char *hfp_parse_clip(struct hfp_pvt *hfp, char *buf);
static struct cidinfo hfp_parse_clip(struct hfp_pvt *hfp, char *buf);
static int parse_next_token(char string[], const int start, const char delim);
static int hfp_parse_cmti(struct hfp_pvt *hfp, char *buf);
static int hfp_parse_cmgr(struct hfp_pvt *hfp, char *buf, char **from_number, char **text);
static int hfp_parse_brsf(struct hfp_pvt *hfp, const char *buf);
......@@ -837,7 +845,7 @@ e_return:
*/
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num,
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, struct cidinfo *cidinfo,
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
{
struct ast_channel *chn;
......@@ -853,8 +861,10 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num
ast_smoother_reset(pvt->smoother, DEVICE_FRAME_SIZE);
ast_dsp_digitreset(pvt->dsp);
chn = ast_channel_alloc(1, state, cid_num, pvt->id, 0, 0, pvt->context,
assignedids, requestor, 0,
chn = ast_channel_alloc(1, state,
cidinfo ? cidinfo->cnum : NULL,
cidinfo ? cidinfo->cnam : NULL,
0, 0, pvt->context, assignedids, requestor, 0,
"Mobile/%s-%04lx", pvt->id, ast_random() & 0xffff);
if (!chn) {
goto e_return;
......@@ -2203,45 +2213,103 @@ static int hfp_parse_ciev(struct hfp_pvt *hfp, char *buf, int *value)
* \param hfp an hfp_pvt struct
* \param buf the buffer to parse (null terminated)
* \note buf will be modified when the CID string is parsed
* \return NULL on error (parse error) or a pointer to the caller id
* information in buf
* \return a cidinfo structure pointing to the cnam and cnum
* data in buf. On parse errors, either or both pointers
* will point to null strings
*/
static char *hfp_parse_clip(struct hfp_pvt *hfp, char *buf)
static struct cidinfo hfp_parse_clip(struct hfp_pvt *hfp, char *buf)
{
int i, state;
char *clip = NULL;
size_t s;
int i;
int tokens[6];
char *cnamtmp;
char delim = ' '; /* First token terminates with space */
int invalid = 0; /* Number of invalid chars in cnam */
struct cidinfo cidinfo = { NULL, NULL };
/* parse clip info in the following format:
* +CLIP: "123456789",128,...
*/
state = 0;
s = strlen(buf);
for (i = 0; i < s && state != 3; i++) {
switch (state) {
case 0: /* search for start of the number (") */
if (buf[i] == '"') {
state++;
ast_debug(3, "[%s] hfp_parse_clip is processing \"%s\"\n", hfp->owner->id, buf);
tokens[0] = 0; /* First token starts in position 0 */
for (i = 1; i < ARRAY_LEN(tokens); i++) {
tokens[i] = parse_next_token(buf, tokens[i - 1], delim);
delim = ','; /* Subsequent tokens terminate with comma */
}
ast_debug(3, "[%s] hfp_parse_clip found tokens: 0=%s, 1=%s, 2=%s, 3=%s, 4=%s, 5=%s\n",
hfp->owner->id, &buf[tokens[0]], &buf[tokens[1]], &buf[tokens[2]],
&buf[tokens[3]], &buf[tokens[4]], &buf[tokens[5]]);
/* Clean up cnum, and make sure it is legitimate since it is untrusted. */
cidinfo.cnum = ast_strip_quoted(&buf[tokens[1]], "\"", "\"");
if (!ast_isphonenumber(cidinfo.cnum)) {
ast_debug(1, "[%s] hfp_parse_clip invalid cidinfo.cnum data \"%s\" - deleting\n",
hfp->owner->id, cidinfo.cnum);
cidinfo.cnum = "";
}
/*
* Some docs say tokens 2 and 3 including the commas are optional.
* If absent, that would move CNAM back to token 3.
*/
cidinfo.cnam = &buf[tokens[5]]; /* Assume it's in token 5 */
if (buf[tokens[5]] == '\0' && buf[tokens[4]] == '\0') {
/* Tokens 4 and 5 are empty. See if token 3 looks like CNAM (starts with ") */
i = tokens[3];
while (buf[i] == ' ') { /* Find the first non-blank */
i++;
}
break;
case 1: /* mark the number */
clip = &buf[i];
state++;
/* fall through */
case 2: /* search for the end of the number (") */
if (buf[i] == '"') {
buf[i] = '\0';
state++;
/* Starts with quote. Use this for CNAM. */
cidinfo.cnam = &buf[i];
}
break;
}
/* Clean up CNAM. */
cidinfo.cnam = ast_strip_quoted(cidinfo.cnam, "\"", "\"");
for (cnamtmp = cidinfo.cnam; *cnamtmp != '\0'; cnamtmp++) {
if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789-,abcdefghijklmnopqrstuvwxyz_", *cnamtmp)) {
*cnamtmp = '_'; /* Invalid. Replace with underscore. */
invalid++;
}
}
if (invalid) {
ast_debug(2, "[%s] hfp_parse_clip replaced %d invalid byte(s) in cnam data\n",
hfp->owner->id, invalid);
}
ast_debug(2, "[%s] hfp_parse_clip returns cnum=%s and cnam=%s\n",
hfp->owner->id, cidinfo.cnum, cidinfo.cnam);
if (state != 3) {
return NULL;
return cidinfo;
}
return clip;
/*!
* \brief Terminate current token and return an index to start of the next token.
* \param string the null-terminated string being parsed (will be altered!)
* \param start where the current token starts
* \param delim the token termination delimiter. \0 is also considered a terminator.
* \return index of the next token. May be the same as this token if the string is
* exhausted.
*/
static int parse_next_token(char string[], const int start, const char delim)
{
int index;
int quoting = 0;
for (index = start; string[index] != 0; index++) {
if ((string[index] == delim) && !quoting ) {
/* Found the delimiter, outside of quotes. This is the end of the token. */
string[index] = '\0'; /* Terminate this token. */
index++; /* Point the index to the start of the next token. */
break; /* We're done. */
} else if (string[index] == '"' && !quoting) {
/* Found a beginning quote mark. Remember it. */
quoting = 1;
} else if (string[index] == '"' ) {
/* Found the end quote mark. */
quoting = 0;
}
}
return index;
}
/*!
......@@ -3578,19 +3646,17 @@ static int handle_response_ciev(struct mbl_pvt *pvt, char *buf)
*/
static int handle_response_clip(struct mbl_pvt *pvt, char *buf)
{
char *clip;
struct msg_queue_entry *msg;
struct ast_channel *chan;
struct cidinfo cidinfo;
if ((msg = msg_queue_head(pvt)) && msg->expected == AT_CLIP) {
msg_queue_free_and_pop(pvt);
pvt->needcallerid = 0;
if (!(clip = hfp_parse_clip(pvt->hfp, buf))) {
ast_debug(1, "[%s] error parsing CLIP: %s\n", pvt->id, buf);
}
cidinfo = hfp_parse_clip(pvt->hfp, buf);
if (!(chan = mbl_new(AST_STATE_RING, pvt, clip, NULL, NULL))) {
if (!(chan = mbl_new(AST_STATE_RING, pvt, &cidinfo, NULL, NULL))) {
ast_log(LOG_ERROR, "[%s] unable to allocate channel for incoming call\n", pvt->id);
hfp_send_chup(pvt->hfp);
msg_queue_push(pvt, AT_OK, AT_CHUP);
......@@ -3859,7 +3925,7 @@ static void *do_monitor_phone(void *data)
break;
}
ast_debug(1, "[%s] %s\n", pvt->id, buf);
ast_debug(1, "[%s] read %s\n", pvt->id, buf);
switch (at_msg) {
case AT_BRSF:
......
......@@ -1174,7 +1174,6 @@ 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_channel_unlock(ast);
ooAnswerCall(p->callToken);
......@@ -1282,7 +1281,7 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
struct ooh323_pvt *p = (struct ooh323_pvt *) ast_channel_tech_pvt(ast);
char *callToken = (char *)NULL;
int res = -1;
int res = -1, rres;
if (!p) return -1;
......@@ -1329,11 +1328,9 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
case AST_CONTROL_PROGRESS:
if (ast_channel_state(ast) != AST_STATE_UP) {
if (!p->progsent) {
rres = ooManualProgress(callToken);
if (gH323Debug) {
ast_debug(1, "Sending manual progress for %s, res = %u\n", callToken,
ooManualProgress(callToken));
} else {
ooManualProgress(callToken);
ast_debug(1, "Sending manual progress for %s, res = %u\n", callToken, rres);
}
p->progsent = 1;
}
......@@ -1342,12 +1339,9 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
case AST_CONTROL_RINGING:
if (ast_channel_state(ast) == AST_STATE_RING || ast_channel_state(ast) == AST_STATE_RINGING) {
if (!p->alertsent) {
rres = ooManualRingback(callToken);
if (gH323Debug) {
ast_debug(1, "Sending manual ringback for %s, res = %u\n",
callToken,
ooManualRingback(callToken));
} else {
ooManualRingback(callToken);
ast_debug(1, "Sending manual ringback for %s, res = %u\n", callToken, rres);
}
p->alertsent = 1;
}
......@@ -5054,9 +5048,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner),target_context);
}
p->faxdetected = 1;
if (dfr) {
ast_frfree(dfr);
}
return &ast_null_frame;
}
}
......
......@@ -163,6 +163,7 @@ OOCTXT* newContext ()
/* ASN1CRTFREE0 (pctxt); */
free(pctxt);
pctxt = 0;
return (pctxt);
}
pctxt->flags |= ASN1DYNCTXT;
}
......
......@@ -622,7 +622,7 @@ void memHeapFreePtr (void** ppvMemHeap, void* mem_p)
}
}
}
if (!ISLAST (pElem) && ISFREE (GETNEXT (pElem))) {
if (pElem && !ISLAST (pElem) && ISFREE (GETNEXT (pElem))) {
OSMemElemDescr* nextelem_p = GETNEXT (pElem);
/* +1 because the OSMemElemDescr has size ONE unit (8 bytes) */
......@@ -637,7 +637,7 @@ void memHeapFreePtr (void** ppvMemHeap, void* mem_p)
}
/* correct the prevOff field of next element */
if (!ISLAST (pElem)) {
if (pElem && !ISLAST (pElem)) {
OSMemElemDescr* nextelem_p = GETNEXT (pElem);
pElem_prevOff (nextelem_p) = QOFFSETOF (nextelem_p, pElem);
}
......@@ -685,7 +685,7 @@ static void initNewFreeElement (OSMemBlk* pMemBlk,
}
pNextElem = GETNEXT (pNewElem);
if (ISFREE (pNextElem)) {
if (pNextElem && ISFREE (pNextElem)) {
/* if the next elem is free, then unite them together */
......@@ -819,7 +819,7 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
/* look for free element after pElem */
pNextElem = GETNEXT (pElem);
if (ISFREE (pNextElem)) {
if (pNextElem && ISFREE (pNextElem)) {
/* +1 'cos sizeof (OSMemElemDescr) == 1 unit */
sumSize += pElem_nunits (pNextElem) + 1;
freeMem++;
......@@ -1061,7 +1061,7 @@ void memHeapAddRef (void** ppvMemHeap)
void memHeapRelease (void** ppvMemHeap)
{
OSMemHeap** ppMemHeap = (OSMemHeap**)ppvMemHeap;
OSMemHeap* pMemHeap = *ppMemHeap;
OSMemHeap* pMemHeap;
if (ppMemHeap != 0 && *ppMemHeap != 0 && --(*ppMemHeap)->refCnt == 0) {
OSMemLink* pMemLink, *pMemLink2;
......@@ -1079,6 +1079,7 @@ void memHeapRelease (void** ppvMemHeap)
}
if ((*ppMemHeap)->flags & RT_MH_FREEHEAPDESC) {
pMemHeap = *ppMemHeap;
ast_mutex_destroy(&pMemHeap->pLock);
free (*ppMemHeap);
}
......
......@@ -804,8 +804,7 @@ int ooAddMediaInfo(OOH323CallData *call, OOMediaInfo mediaInfo)
if(!call)
{
OOTRACEERR3("Error:Invalid 'call' param for ooAddMediaInfo.(%s, %s)\n",
call->callType, call->callToken);
OOTRACEERR1("Error:Invalid 'call' param for ooAddMediaInfo.\n");
return OO_FAILED;
}
newMediaInfo = (OOMediaInfo*) memAlloc(call->pctxt, sizeof(OOMediaInfo));
......
......@@ -62,8 +62,6 @@ int ooCapabilityEnableDTMFCISCO
/*Dynamic RTP payload type range is from 96 - 127 */
if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127)
gcDynamicRTPPayloadType = dynamicRTPPayloadType;
else
call->dtmfcodec = dynamicRTPPayloadType;
}
else{
call->dtmfmode |= OO_CAP_DTMF_CISCO;
......@@ -623,8 +621,7 @@ int ooCapabilityAddT38Capability
else pctxt = call->pctxt;
epCap = (ooH323EpCapability*)memAllocZ(pctxt, sizeof(ooH323EpCapability));
params = (OOCapParams*) memAlloc(pctxt, sizeof(OOCapParams));
memset(params, 0 , sizeof(OOCapParams));
params = (OOCapParams*) memAllocZ(pctxt, sizeof(OOCapParams));
if(!epCap || !params)
{
OOTRACEERR1("ERROR: Memory - ooCapabilityAddT38Capability - "
......@@ -808,15 +805,14 @@ void* ooCapabilityCreateDTMFCapability(int cap, int dtmfcodec, OOCTXT *pctxt)
}
memset(pATECap, 0, sizeof(H245AudioTelephonyEventCapability));
pATECap->dynamicRTPPayloadType = dtmfcodec;
events = (char*)memAlloc(pctxt, strlen("0-16")+1);
memset(events, 0, strlen("0-16")+1);
events = (char*)memAllocZ(pctxt, strlen("0-16")+1);
if(!events)
{
OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - events\n");
memFreePtr(pctxt, pATECap);
return NULL;
}
strncpy(events, "0-16", strlen("0-16"));
strcpy(events, "0-16");
pATECap->audioTelephoneEvent = events;
return pATECap;
case OO_CAP_DTMF_CISCO:
......
......@@ -2332,9 +2332,8 @@ int ooGkClientSendIRR
pIRR->m.perCallInfoPresent = TRUE;
perCallInfo =
(H225InfoRequestResponse_perCallInfo_element *)memAlloc(pctxt,
(H225InfoRequestResponse_perCallInfo_element *)memAllocZ(pctxt,
sizeof(H225InfoRequestResponse_perCallInfo_element));
memset(perCallInfo, 0, sizeof(H225InfoRequestResponse_perCallInfo_element));
if(!perCallInfo)
{
......
......@@ -356,7 +356,6 @@ int ooSendTermCapMsg(OOH323CallData *call)
/* pctxt = &gH323ep.msgctxt; */
pctxt = call->msgctxt;
ph245msg->msgType = OOTerminalCapabilitySet;
memset(request, 0, sizeof(H245RequestMessage));
if(request == NULL)
{
OOTRACEERR3("ERROR: No memory allocated for request message (%s, %s)\n",
......@@ -364,6 +363,7 @@ int ooSendTermCapMsg(OOH323CallData *call)
return OO_FAILED;
}
memset(request, 0, sizeof(H245RequestMessage));
request->t = T_H245RequestMessage_terminalCapabilitySet;
request->u.terminalCapabilitySet = (H245TerminalCapabilitySet*)
memAlloc(pctxt, sizeof(H245TerminalCapabilitySet));
......
......@@ -2439,8 +2439,10 @@ int ooH323HandleCallFwdRequest(OOH323CallData *call)
alias = call->pCallFwdData->aliases;
while(alias)
{
pNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases));
pNewAlias->value = (char*) memAlloc(pctxt, strlen(alias->value)+1);
pNewAlias = (ooAliases*) memAllocZ(pctxt, sizeof(ooAliases));
if (pNewAlias) {
pNewAlias->value = (char*) memAllocZ(pctxt, strlen(alias->value)+1);
}
if(!pNewAlias || !pNewAlias->value)
{
OOTRACEERR3("Error:Memory - ooH323HandleCallFwdRequest - "
......
......@@ -30,7 +30,11 @@ include $(ASTTOPDIR)/Makefile.moddir_rules
clean::
rm -f confbridge/*.o confbridge/*.i confbridge/*.gcda confbridge/*.gcno
app_confbridge.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
app_meetme.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
app_minivm.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
app_voicemail.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
app_while.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
app_confbridge.so: $(subst .c,.o,$(wildcard confbridge/*.c))
$(subst .c,.o,$(wildcard confbridge/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,app_confbridge)
......
......@@ -440,6 +440,7 @@ static void *agent_cfg_alloc(const char *name)
cfg = ao2_alloc_options(sizeof(*cfg), agent_cfg_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!cfg || ast_string_field_init(cfg, 64)) {
ao2_cleanup(cfg);
return NULL;
}
ast_string_field_set(cfg, username, name);
......
......@@ -279,6 +279,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))) {
......@@ -289,15 +295,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);
......@@ -308,7 +321,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);
......