[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe r398941 - in /team/dlee/ASTERI...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 12 12:13:45 CDT 2013


Author: dlee
Date: Thu Sep 12 12:13:39 2013
New Revision: 398941

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398941
Log:
Merged revisions 398694-398938 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    team/dlee/ASTERISK-22451-ari-subscribe/   (props changed)
    team/dlee/ASTERISK-22451-ari-subscribe/apps/app_queue.c
    team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_pjsip.c
    team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
    team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h
    team/dlee/ASTERISK-22451-ari-subscribe/configs/chan_dahdi.conf.sample
    team/dlee/ASTERISK-22451-ari-subscribe/configs/confbridge.conf.sample
    team/dlee/ASTERISK-22451-ari-subscribe/funcs/func_dialgroup.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/asterisk.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/astmm.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/cli.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/event.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/heap.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/indications.c
    team/dlee/ASTERISK-22451-ari-subscribe/main/xmldoc.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_musiconhold.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/pjsip_configuration.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_caller_id.c
    team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c
    team/dlee/ASTERISK-22451-ari-subscribe/utils/ael_main.c
    team/dlee/ASTERISK-22451-ari-subscribe/utils/check_expr.c
    team/dlee/ASTERISK-22451-ari-subscribe/utils/conf2ael.c

Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Sep 12 12:13:39 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398690
+/branches/12:1-398940

Modified: team/dlee/ASTERISK-22451-ari-subscribe/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/apps/app_queue.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/apps/app_queue.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/apps/app_queue.c Thu Sep 12 12:13:39 2013
@@ -9489,8 +9489,8 @@
 	case CLI_INIT:
 		e->command = "queue add member";
 		e->usage =
-			"Usage: queue add member <channel> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
-			"       Add a channel to a queue with optionally:  a penalty, membername and a state_interface\n";
+			"Usage: queue add member <dial string> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
+			"       Add a dial string (Such as a channel,e.g. SIP/6001) to a queue with optionally:  a penalty, membername and a state_interface\n";
 		return NULL;
 	case CLI_GENERATE:
 		return complete_queue_add_member(a->line, a->word, a->pos, a->n);

Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_pjsip.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_pjsip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_pjsip.c Thu Sep 12 12:13:39 2013
@@ -1077,6 +1077,7 @@
 static int update_connected_line_information(void *data)
 {
 	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
+	struct ast_party_id connected_id;
 
 	if ((ast_channel_state(session->channel) != AST_STATE_UP) && (session->inv_session->role == PJSIP_UAS_ROLE)) {
 		int response_code = 0;
@@ -1101,7 +1102,13 @@
 			method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
 		}
 
-		ast_sip_session_refresh(session, NULL, NULL, NULL, method, 0);
+		connected_id = ast_channel_connected_effective_id(session->channel);
+		if ((session->endpoint->id.send_pai || session->endpoint->id.send_rpid) &&
+		    (session->endpoint->id.trust_outbound ||
+		     ((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
+		      (connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) {
+			ast_sip_session_refresh(session, NULL, NULL, NULL, method, 1);
+		}
 	}
 
 	return 0;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c Thu Sep 12 12:13:39 2013
@@ -23250,6 +23250,15 @@
 					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
 				}
 			ast_rtp_instance_activate(p->rtp);
+		} else if (!reinvite) {
+			struct ast_sockaddr remote_address = {{0,}};
+
+			ast_rtp_instance_get_remote_address(p->rtp, &remote_address);
+			if (ast_sockaddr_isnull(&remote_address) || (!ast_strlen_zero(p->theirprovtag) && strcmp(p->theirtag, p->theirprovtag))) {
+				ast_log(LOG_WARNING, "Received response: \"200 OK\" from '%s' without SDP\n", p->relatedpeer->name);
+				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
+				ast_rtp_instance_activate(p->rtp);
+			}
 		}
 
 		if (!req->ignore && p->owner) {
@@ -24200,7 +24209,11 @@
 
 		gettag(req, "To", tag, sizeof(tag));
 		ast_string_field_set(p, theirtag, tag);
-	}
+	} else {
+		/* Store theirtag to track for changes when 200 responses to invites are received without SDP */
+		ast_string_field_set(p, theirprovtag, p->theirtag);
+	}
+
 	/* This needs to be configurable on a channel/peer level,
 	   not mandatory for all communication. Sadly enough, NAT implementations
 	   are not so stable so we can always rely on these headers.

Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/sip/include/sip.h Thu Sep 12 12:13:39 2013
@@ -1019,6 +1019,7 @@
 		AST_STRING_FIELD(rdnis);        /*!< Referring DNIS */
 		AST_STRING_FIELD(redircause);   /*!< Referring cause */
 		AST_STRING_FIELD(theirtag);     /*!< Their tag */
+		AST_STRING_FIELD(theirprovtag); /*!< Provisional their tag, used when evaluating responses to invites */
 		AST_STRING_FIELD(tag);          /*!< Our tag for this session */
 		AST_STRING_FIELD(username);     /*!< [user] name */
 		AST_STRING_FIELD(peername);     /*!< [peer] name, not set if [user] */

Modified: team/dlee/ASTERISK-22451-ari-subscribe/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/configs/chan_dahdi.conf.sample?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/configs/chan_dahdi.conf.sample (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/configs/chan_dahdi.conf.sample Thu Sep 12 12:13:39 2013
@@ -582,7 +582,8 @@
 ; easily be re-attaching to a prior incoming call that was not yet hung up).
 ; This option changes the hangup to wait for a dialtone on the line, before
 ; marking the line as once again available for use with outgoing calls.
-;waitfordialtone=yes
+; Specified in milliseconds, not set by default.
+;waitfordialtone=1000
 ;
 ; For analog lines, enables Asterisk to use dialtone detection per channel
 ; if an incoming call was hung up before it was answered.  If dialtone is

Modified: team/dlee/ASTERISK-22451-ari-subscribe/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/configs/confbridge.conf.sample?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/configs/confbridge.conf.sample (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/configs/confbridge.conf.sample Thu Sep 12 12:13:39 2013
@@ -109,7 +109,7 @@
 
 ;denoise=yes ; Sets whether or not a denoise filter should be applied
              ; to the audio before mixing or not.  Off by default. Requires
-             ; codec_speex to be built and installed.  Do not confuse this option
+             ; func_speex to be built and installed.  Do not confuse this option
              ; with drop_silence.  Denoise is useful if there is a lot of background
              ; noise for a user as it attempts to remove the noise while preserving
              ; the speech.  This option does NOT remove silence from being mixed into

Modified: team/dlee/ASTERISK-22451-ari-subscribe/funcs/func_dialgroup.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/funcs/func_dialgroup.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/funcs/func_dialgroup.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/funcs/func_dialgroup.c Thu Sep 12 12:13:39 2013
@@ -174,11 +174,17 @@
 {
 	int len = 500, res = 0;
 	char *buf = NULL;
+	char *new_buf;
 	char *dialgroup = ast_strdupa(cdialgroup);
 
 	do {
 		len *= 2;
-		buf = ast_realloc(buf, len);
+		new_buf = ast_realloc(buf, len);
+		if (!new_buf) {
+			ast_free(buf);
+			return -1;
+		}
+		buf = new_buf;
 
 		if ((res = dialgroup_read(chan, "", dialgroup, buf, len)) < 0) {
 			ast_free(buf);

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/asterisk.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/asterisk.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/asterisk.c Thu Sep 12 12:13:39 2013
@@ -2777,45 +2777,62 @@
 	return ast_str_buffer(prompt);
 }
 
+static void destroy_match_list(char **match_list, int matches)
+{
+	if (match_list) {
+		int idx;
+
+		for (idx = 0; idx < matches; ++idx) {
+			ast_free(match_list[idx]);
+		}
+		ast_free(match_list);
+	}
+}
+
 static char **ast_el_strtoarr(char *buf)
 {
-	char **match_list = NULL, **match_list_tmp, *retstr;
-	size_t match_list_len;
+	char *retstr;
+	char **match_list = NULL;
+	char **new_list;
+	size_t match_list_len = 1;
 	int matches = 0;
 
-	match_list_len = 1;
-	while ( (retstr = strsep(&buf, " ")) != NULL) {
-
-		if (!strcmp(retstr, AST_CLI_COMPLETE_EOF))
+	while ((retstr = strsep(&buf, " "))) {
+		if (!strcmp(retstr, AST_CLI_COMPLETE_EOF)) {
 			break;
+		}
 		if (matches + 1 >= match_list_len) {
 			match_list_len <<= 1;
-			if ((match_list_tmp = ast_realloc(match_list, match_list_len * sizeof(char *)))) {
-				match_list = match_list_tmp;
-			} else {
-				if (match_list)
-					ast_free(match_list);
-				return (char **) NULL;
-			}
-		}
-
-		match_list[matches++] = ast_strdup(retstr);
-	}
-
-	if (!match_list)
-		return (char **) NULL;
+			new_list = ast_realloc(match_list, match_list_len * sizeof(char *));
+			if (!new_list) {
+				destroy_match_list(match_list, matches);
+				return NULL;
+			}
+			match_list = new_list;
+		}
+
+		retstr = ast_strdup(retstr);
+		if (!retstr) {
+			destroy_match_list(match_list, matches);
+			return NULL;
+		}
+		match_list[matches++] = retstr;
+	}
+
+	if (!match_list) {
+		return NULL;
+	}
 
 	if (matches >= match_list_len) {
-		if ((match_list_tmp = ast_realloc(match_list, (match_list_len + 1) * sizeof(char *)))) {
-			match_list = match_list_tmp;
-		} else {
-			if (match_list)
-				ast_free(match_list);
-			return (char **) NULL;
-		}
-	}
-
-	match_list[matches] = (char *) NULL;
+		new_list = ast_realloc(match_list, (match_list_len + 1) * sizeof(char *));
+		if (!new_list) {
+			destroy_match_list(match_list, matches);
+			return NULL;
+		}
+		match_list = new_list;
+	}
+
+	match_list[matches] = NULL;
 
 	return match_list;
 }
@@ -2916,7 +2933,9 @@
 
 		if (nummatches > 0) {
 			char *mbuf;
+			char *new_mbuf;
 			int mlen = 0, maxmbuf = 2048;
+
 			/* Start with a 2048 byte buffer */
 			if (!(mbuf = ast_malloc(maxmbuf))) {
 				*((char *) lf->cursor) = savechr;
@@ -2930,10 +2949,13 @@
 				if (mlen + 1024 > maxmbuf) {
 					/* Every step increment buffer 1024 bytes */
 					maxmbuf += 1024;
-					if (!(mbuf = ast_realloc(mbuf, maxmbuf))) {
+					new_mbuf = ast_realloc(mbuf, maxmbuf);
+					if (!new_mbuf) {
+						ast_free(mbuf);
 						*((char *) lf->cursor) = savechr;
 						return (char *)(CC_ERROR);
 					}
+					mbuf = new_mbuf;
 				}
 				/* Only read 1024 bytes at a time */
 				res = read(ast_consock, mbuf + mlen, 1024);

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/astmm.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/astmm.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/astmm.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/astmm.c Thu Sep 12 12:13:39 2013
@@ -71,7 +71,7 @@
 #undef vasprintf
 #undef asprintf
 
-#define FENCE_MAGIC		0xdeadbeef	/*!< Allocated memory high/low fence overwrite check. */
+#define FENCE_MAGIC		0xfeedbabe	/*!< Allocated memory high/low fence overwrite check. */
 #define FREED_MAGIC		0xdeaddead	/*!< Freed memory wipe filler. */
 #define MALLOC_FILLER	0x55		/*!< Malloced memory filler.  Must not be zero. */
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/cli.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/cli.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/cli.c Thu Sep 12 12:13:39 2013
@@ -2363,9 +2363,22 @@
 	return matches;
 }
 
+static void destroy_match_list(char **match_list, int matches)
+{
+	if (match_list) {
+		int idx;
+
+		for (idx = 1; idx < matches; ++idx) {
+			ast_free(match_list[idx]);
+		}
+		ast_free(match_list);
+	}
+}
+
 char **ast_cli_completion_matches(const char *text, const char *word)
 {
 	char **match_list = NULL, *retstr, *prevstr;
+	char **new_list;
 	size_t match_list_len, max_equal, which, i;
 	int matches = 0;
 
@@ -2374,14 +2387,19 @@
 	while ((retstr = ast_cli_generator(text, word, matches)) != NULL) {
 		if (matches + 1 >= match_list_len) {
 			match_list_len <<= 1;
-			if (!(match_list = ast_realloc(match_list, match_list_len * sizeof(*match_list))))
+			new_list = ast_realloc(match_list, match_list_len * sizeof(*match_list));
+			if (!new_list) {
+				destroy_match_list(match_list, matches);
 				return NULL;
+			}
+			match_list = new_list;
 		}
 		match_list[++matches] = retstr;
 	}
 
-	if (!match_list)
+	if (!match_list) {
 		return match_list; /* NULL */
+	}
 
 	/* Find the longest substring that is common to all results
 	 * (it is a candidate for completion), and store a copy in entry 0.
@@ -2394,20 +2412,23 @@
 		max_equal = i;
 	}
 
-	if (!(retstr = ast_malloc(max_equal + 1))) {
-		ast_free(match_list);
-		return NULL;
-	}
-
+	retstr = ast_malloc(max_equal + 1);
+	if (!retstr) {
+		destroy_match_list(match_list, matches);
+		return NULL;
+	}
 	ast_copy_string(retstr, match_list[1], max_equal + 1);
 	match_list[0] = retstr;
 
 	/* ensure that the array is NULL terminated */
 	if (matches + 1 >= match_list_len) {
-		if (!(match_list = ast_realloc(match_list, (match_list_len + 1) * sizeof(*match_list)))) {
+		new_list = ast_realloc(match_list, (match_list_len + 1) * sizeof(*match_list));
+		if (!new_list) {
 			ast_free(retstr);
+			destroy_match_list(match_list, matches);
 			return NULL;
 		}
+		match_list = new_list;
 	}
 	match_list[matches + 1] = NULL;
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c Thu Sep 12 12:13:39 2013
@@ -441,10 +441,18 @@
  */
 static int unreal_colp_redirect_indicate(struct ast_unreal_pvt *p, struct ast_channel *ast, int condition)
 {
+	struct ast_channel *my_chan;
+	struct ast_channel *my_owner;
 	struct ast_channel *this_channel;
 	struct ast_channel *the_other_channel;
 	int isoutbound;
 	int res = 0;
+	unsigned char frame_data[1024];
+	struct ast_frame f = {
+		.frametype = AST_FRAME_CONTROL,
+		.subclass.integer = condition,
+		.data.ptr = frame_data,
+	};
 
 	/*
 	 * A connected line update frame may only contain a partial
@@ -458,7 +466,8 @@
 	 * redirecting information, which is why it is handled here as
 	 * well.
 	 */
-	ao2_lock(p);
+	ast_channel_unlock(ast);
+	ast_unreal_lock_all(p, &my_chan, &my_owner);
 	isoutbound = AST_UNREAL_IS_OUTBOUND(ast, p);
 	if (isoutbound) {
 		this_channel = p->chan;
@@ -468,13 +477,6 @@
 		the_other_channel = p->chan;
 	}
 	if (the_other_channel) {
-		unsigned char frame_data[1024];
-		struct ast_frame f = {
-			.frametype = AST_FRAME_CONTROL,
-			.subclass.integer = condition,
-			.data.ptr = frame_data,
-		};
-
 		if (condition == AST_CONTROL_CONNECTED_LINE) {
 			ast_connected_line_copy_to_caller(ast_channel_caller(the_other_channel),
 				ast_channel_connected(this_channel));
@@ -484,9 +486,20 @@
 			f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data),
 				ast_channel_redirecting(this_channel), NULL);
 		}
-		res = unreal_queue_frame(p, isoutbound, &f, ast, 1);
-	}
-	ao2_unlock(p);
+	}
+	if (my_chan) {
+		ast_channel_unlock(my_chan);
+		ast_channel_unref(my_chan);
+	}
+	if (my_owner) {
+		ast_channel_unlock(my_owner);
+		ast_channel_unref(my_owner);
+	}
+	if (the_other_channel) {
+		res = unreal_queue_frame(p, isoutbound, &f, ast, 0);
+	}
+	ao2_unlock(p);
+	ast_channel_lock(ast);
 
 	return res;
 }

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/event.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/event.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/event.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/event.c Thu Sep 12 12:13:39 2013
@@ -311,13 +311,17 @@
 	const void *data, size_t data_len)
 {
 	struct ast_event_ie *ie;
+	struct ast_event *old_event;
 	unsigned int extra_len;
 	uint16_t event_len;
 
 	event_len = ntohs((*event)->event_len);
 	extra_len = sizeof(*ie) + data_len;
 
-	if (!(*event = ast_realloc(*event, event_len + extra_len))) {
+	old_event = *event;
+	*event = ast_realloc(*event, event_len + extra_len);
+	if (!*event) {
+		ast_free(old_event);
 		return -1;
 	}
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/heap.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/heap.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/heap.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/heap.c Thu Sep 12 12:13:39 2013
@@ -181,18 +181,19 @@
 #endif
 )
 {
-	h->avail_len = h->avail_len * 2 + 1;
-
-	if (!(h->heap =
-#ifdef MALLOC_DEBUG
-			__ast_realloc(h->heap, h->avail_len * sizeof(void *), file, lineno, func)
-#else
-			ast_realloc(h->heap, h->avail_len * sizeof(void *))
-#endif
-		)) {
-		h->cur_len = h->avail_len = 0;
+	void **new_heap;
+	size_t new_len = h->avail_len * 2 + 1;
+
+#ifdef MALLOC_DEBUG
+	new_heap = __ast_realloc(h->heap, new_len * sizeof(void *), file, lineno, func);
+#else
+	new_heap = ast_realloc(h->heap, new_len * sizeof(void *));
+#endif
+	if (!new_heap) {
 		return -1;
 	}
+	h->heap = new_heap;
+	h->avail_len = new_len;
 
 	return 0;
 }

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/indications.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/indications.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/indications.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/indications.c Thu Sep 12 12:13:39 2013
@@ -341,12 +341,12 @@
 	}
 
 	while ((s = strsep(&stringp, separator)) && !ast_strlen_zero(s)) {
+		struct playtones_item *new_items;
 		struct ast_tone_zone_part tone_data = {
 			.time = 0,
 		};
 
 		s = ast_strip(s);
-
 		if (s[0]=='!') {
 			s++;
 		} else if (d.reppos == -1) {
@@ -374,9 +374,12 @@
 			}
 		}
 
-		if (!(d.items = ast_realloc(d.items, (d.nitems + 1) * sizeof(*d.items)))) {
+		new_items = ast_realloc(d.items, (d.nitems + 1) * sizeof(*d.items));
+		if (!new_items) {
+			ast_free(d.items);
 			return -1;
 		}
+		d.items = new_items;
 
 		d.items[d.nitems].fac1 = 2.0 * cos(2.0 * M_PI * (tone_data.freq1 / sample_rate)) * max_sample_val;
 		d.items[d.nitems].init_v2_1 = sin(-4.0 * M_PI * (tone_data.freq1 / sample_rate)) * d.vol;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/xmldoc.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/xmldoc.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/xmldoc.c Thu Sep 12 12:13:39 2013
@@ -607,8 +607,11 @@
  */
 static void __attribute__((format(printf, 4, 5))) xmldoc_reverse_helper(int reverse, int *len, char **syntax, const char *fmt, ...)
 {
-	int totlen, tmpfmtlen;
-	char *tmpfmt, tmp;
+	int totlen;
+	int tmpfmtlen;
+	char *tmpfmt;
+	char *new_syntax;
+	char tmp;
 	va_list ap;
 
 	va_start(ap, fmt);
@@ -621,12 +624,12 @@
 	tmpfmtlen = strlen(tmpfmt);
 	totlen = *len + tmpfmtlen + 1;
 
-	*syntax = ast_realloc(*syntax, totlen);
-
-	if (!*syntax) {
+	new_syntax = ast_realloc(*syntax, totlen);
+	if (!new_syntax) {
 		ast_free(tmpfmt);
 		return;
 	}
+	*syntax = new_syntax;
 
 	if (reverse) {
 		memmove(*syntax + tmpfmtlen, *syntax, *len);

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_musiconhold.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_musiconhold.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_musiconhold.c Thu Sep 12 12:13:39 2013
@@ -1055,20 +1055,26 @@
 static int moh_add_file(struct mohclass *class, const char *filepath)
 {
 	if (!class->allowed_files) {
-		if (!(class->filearray = ast_calloc(1, INITIAL_NUM_FILES * sizeof(*class->filearray))))
+		class->filearray = ast_calloc(1, INITIAL_NUM_FILES * sizeof(*class->filearray));
+		if (!class->filearray) {
 			return -1;
+		}
 		class->allowed_files = INITIAL_NUM_FILES;
 	} else if (class->total_files == class->allowed_files) {
-		if (!(class->filearray = ast_realloc(class->filearray, class->allowed_files * sizeof(*class->filearray) * 2))) {
-			class->allowed_files = 0;
-			class->total_files = 0;
+		char **new_array;
+
+		new_array = ast_realloc(class->filearray, class->allowed_files * sizeof(*class->filearray) * 2);
+		if (!new_array) {
 			return -1;
 		}
+		class->filearray = new_array;
 		class->allowed_files *= 2;
 	}
 
-	if (!(class->filearray[class->total_files] = ast_strdup(filepath)))
-		return -1;
+	class->filearray[class->total_files] = ast_strdup(filepath);
+	if (!class->filearray[class->total_files]) {
+		return -1;
+	}
 
 	class->total_files++;
 

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip.c Thu Sep 12 12:13:39 2013
@@ -1387,8 +1387,8 @@
 }
 
 /* PJSIP doesn't know about the INFO method, so we have to define it ourselves */
-const pjsip_method pjsip_info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
-const pjsip_method pjsip_message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} };
+static const pjsip_method info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
+static const pjsip_method message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} };
 
 static struct {
 	const char *method;
@@ -1403,8 +1403,8 @@
 	{ "SUBSCRIBE", &pjsip_subscribe_method },
 	{ "NOTIFY", &pjsip_notify_method },
 	{ "PUBLISH", &pjsip_publish_method },
-	{ "INFO", &pjsip_info_method },
-	{ "MESSAGE", &pjsip_message_method },
+	{ "INFO", &info_method },
+	{ "MESSAGE", &message_method },
 };
 
 static const pjsip_method *get_pjsip_method(const char *method)

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/pjsip_configuration.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/pjsip_configuration.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip/pjsip_configuration.c Thu Sep 12 12:13:39 2013
@@ -290,6 +290,7 @@
 		ast_free((char *) auths->names[i]);
 	}
 	ast_free(auths->names);
+	auths->names = NULL;
 	auths->num = 0;
 }
 
@@ -300,22 +301,26 @@
 	char *auth_names = ast_strdupa(value);
 	char *val;
 	int num_alloced = 0;
-	const char **alloced_auths = NULL;
+	const char **alloced_auths;
+
+	ast_assert(auths != NULL);
+	ast_assert(auths->names == NULL);
+	ast_assert(!auths->num);
 
 	while ((val = strsep(&auth_names, ","))) {
 		if (auths->num >= num_alloced) {
-			size_t size;
 			num_alloced += AUTH_INCREMENT;
-			size = num_alloced * sizeof(char *);
-			auths->names = ast_realloc(alloced_auths, size);
-			if (!auths->names) {
+			alloced_auths = ast_realloc(auths->names, num_alloced * sizeof(char *));
+			if (!alloced_auths) {
 				goto failure;
 			}
-		}
-		auths->names[auths->num] = ast_strdup(val);
-		if (!auths->names[auths->num]) {
+			auths->names = alloced_auths;
+		}
+		val = ast_strdup(val);
+		if (!val) {
 			goto failure;
 		}
+		auths->names[auths->num] = val;
 		++auths->num;
 	}
 	return 0;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_caller_id.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_caller_id.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_caller_id.c Thu Sep 12 12:13:39 2013
@@ -662,9 +662,6 @@
 
 		modify_id_header(tdata->pool, from, &connected_id);
 		modify_id_header(dlg->pool, dlg->local.info, &connected_id);
-		if (should_queue_connected_line_update(session, &session->endpoint->id.self)) {
-			queue_connected_line_update(session, &session->endpoint->id.self);
-		}
 	}
 	add_id_headers(session, tdata, &connected_id);
 }
@@ -674,7 +671,7 @@
  * \brief Session supplement for outgoing INVITE response
  *
  * This will add P-Asserted-Identity and Remote-Party-ID headers if necessary
- * 
+ *
  * \param session The session on which the INVITE response is to be sent
  * \param tdata The outbound INVITE response
  */

Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_endpoint_identifier_ip.c Thu Sep 12 12:13:39 2013
@@ -89,8 +89,20 @@
 {
 	struct ip_identify_match *identify = obj;
 	struct ast_sockaddr *addr = arg;
+	int sense;
 
-	return (ast_apply_ha(identify->matches, addr) != AST_SENSE_ALLOW) ? CMP_MATCH | CMP_STOP : 0;
+	sense = ast_apply_ha(identify->matches, addr);
+	if (sense != AST_SENSE_ALLOW) {
+		ast_debug(3, "Source address %s matches identify '%s'\n",
+				ast_sockaddr_stringify(addr),
+				ast_sorcery_object_get_id(identify));
+		return CMP_MATCH | CMP_STOP;
+	} else {
+		ast_debug(3, "Source address %s does not match identify '%s'\n",
+				ast_sockaddr_stringify(addr),
+				ast_sorcery_object_get_id(identify));
+		return 0;
+	}
 }
 
 static struct ast_sip_endpoint *ip_identify(pjsip_rx_data *rdata)
@@ -103,6 +115,7 @@
 	/* If no possibilities exist return early to save some time */
 	if (!(candidates = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "identify", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL)) ||
 		!ao2_container_count(candidates)) {
+		ast_debug(3, "No identify sections to match against\n");
 		return NULL;
 	}
 
@@ -110,12 +123,17 @@
 	ast_sockaddr_set_port(&addr, rdata->pkt_info.src_port);
 
 	if (!(match = ao2_callback(candidates, 0, ip_identify_match_check, &addr))) {
+		ast_debug(3, "'%s' did not match any identify section rules\n",
+				ast_sockaddr_stringify(&addr));
 		return NULL;
 	}
 
 	endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", match->endpoint_name);
 	if (endpoint) {
 		ast_debug(3, "Retrieved endpoint %s\n", ast_sorcery_object_get_id(endpoint));
+	} else {
+		ast_log(LOG_WARNING, "Identify section '%s' points to endpoint '%s' but endpoint could not be looked up\n",
+				ast_sorcery_object_get_id(match), match->endpoint_name);
 	}
 
 	return endpoint;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/utils/ael_main.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/utils/ael_main.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/utils/ael_main.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/utils/ael_main.c Thu Sep 12 12:13:39 2013
@@ -648,5 +648,11 @@
 {
 }
 #endif /* HAVE_BKTR */
+void ast_suspend_lock_info(void *lock_addr)
+{
+}
+void ast_restore_lock_info(void *lock_addr)
+{
+}
 #endif /* !defined(LOW_MEMORY) */
 #endif /* DEBUG_THREADS */

Modified: team/dlee/ASTERISK-22451-ari-subscribe/utils/check_expr.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/utils/check_expr.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/utils/check_expr.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/utils/check_expr.c Thu Sep 12 12:13:39 2013
@@ -55,6 +55,7 @@
 }
 #endif
 
+#ifdef DEBUG_THREADS
 #if !defined(LOW_MEMORY)
 #ifdef HAVE_BKTR
 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
@@ -105,12 +106,20 @@
 }
 #endif /* HAVE_BKTR */
 
+void ast_suspend_lock_info(void *lock_addr)
+{
+}
+void ast_restore_lock_info(void *lock_addr)
+{
+}
 void ast_mark_lock_acquired(void *);
 void ast_mark_lock_acquired(void *foo)
 {
     /* not a lot to do in a standalone w/o threading! */
 }
 #endif
+#endif /* DEBUG_THREADS */
+
 
 static int global_lineno = 1;
 static int global_expr_count=0;

Modified: team/dlee/ASTERISK-22451-ari-subscribe/utils/conf2ael.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/utils/conf2ael.c?view=diff&rev=398941&r1=398940&r2=398941
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/utils/conf2ael.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/utils/conf2ael.c Thu Sep 12 12:13:39 2013
@@ -777,5 +777,11 @@
 {
 }
 #endif /* HAVE_BKTR */
+void ast_suspend_lock_info(void *lock_addr)
+{
+}
+void ast_restore_lock_info(void *lock_addr)
+{
+}
 #endif /* !defined(LOW_MEMORY) */
 #endif /* DEBUG_THREADS */




More information about the asterisk-commits mailing list