[asterisk-commits] branch bweschke/queue_improvements r19503 - in /team/bweschke/queue_improveme...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Apr 11 20:12:18 MST 2006


Author: bweschke
Date: Tue Apr 11 22:12:13 2006
New Revision: 19503

URL: http://svn.digium.com/view/asterisk?rev=19503&view=rev
Log:
Merged revisions 19302,19304-19306,19346,19349-19350,19352,19354,19393,19395-19396,19398,19436-19437,19465-19466 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r19302 | kpfleming | 2006-04-11 16:11:36 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19301 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19301 | kpfleming | 2006-04-11 15:11:01 -0500 (Tue, 11 Apr 2006) | 2 lines

handle call time limit properly when warning is requested _after_ call would hae already ended (issue #6356)

........

................
r19304 | file | 2006-04-11 16:48:57 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19303 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19303 | file | 2006-04-11 17:46:38 -0300 (Tue, 11 Apr 2006) | 2 lines

Minor linked lists bug fix. When you're dealing with swapping entries around a lot it can cause a seg fault.

........

................
r19305 | file | 2006-04-11 16:51:45 -0400 (Tue, 11 Apr 2006) | 2 lines

No need to do this in here any longer since the linkedlists macro is fixed

................
r19306 | rizzo | 2006-04-11 16:52:05 -0400 (Tue, 11 Apr 2006) | 3 lines

remove unused variable (discovered by the compiler)


................
r19346 | kpfleming | 2006-04-11 17:18:27 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19345 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19345 | kpfleming | 2006-04-11 16:14:42 -0500 (Tue, 11 Apr 2006) | 2 lines

don't destroy the entire dialplan during 'reload', just atomically replace it like 'extensions reload' does (issue #6047)

........

................
r19349 | kpfleming | 2006-04-11 17:50:48 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19347 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19347 | kpfleming | 2006-04-11 16:35:52 -0500 (Tue, 11 Apr 2006) | 2 lines

simplify spy queue flushing logic, and always force a flush when one side gets full, even if the other side is not empty (issue #6457)

........

................
r19350 | kpfleming | 2006-04-11 17:51:17 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19348 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19348 | kpfleming | 2006-04-11 16:50:18 -0500 (Tue, 11 Apr 2006) | 2 lines

don't call the originating device as part of the Page() operation (issue #6932)

........

................
r19352 | tilghman | 2006-04-11 17:58:44 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19351 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19351 | tilghman | 2006-04-11 16:55:51 -0500 (Tue, 11 Apr 2006) | 2 lines

Bug 6097 - possible descriptor leak

........

................
r19354 | kpfleming | 2006-04-11 17:59:40 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19353 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19353 | kpfleming | 2006-04-11 16:58:47 -0500 (Tue, 11 Apr 2006) | 2 lines

don't create a 'voicemail' symlink in the sounds directory; app_voicemail has not needed it since January of 2005 (issue #6613)

........

................
r19393 | kpfleming | 2006-04-11 18:07:52 -0400 (Tue, 11 Apr 2006) | 2 lines

fix logic error; don't test for rtcache flag unless asked to (issue #6923)

................
r19395 | tilghman | 2006-04-11 18:25:57 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19394 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19394 | tilghman | 2006-04-11 17:24:46 -0500 (Tue, 11 Apr 2006) | 2 lines

Bug 6061 - Fix ODBC storage of VM on PGSQL and MSSQL

........

................
r19396 | rizzo | 2006-04-11 18:37:27 -0400 (Tue, 11 Apr 2006) | 8 lines

fix various bugs in the DEBUG_THREADS code including:
- misspelled ast_mutex_logger() instead of __ast_mutex_logger()
- misplaced #define ast_mutex_init(pmutex)
- wrong arguments to __ast_mutex_logger() in one instance.

Clearly this code is too spaghetti!


................
r19398 | tilghman | 2006-04-11 18:51:10 -0400 (Tue, 11 Apr 2006) | 10 lines

Merged revisions 19397 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19397 | tilghman | 2006-04-11 17:39:59 -0500 (Tue, 11 Apr 2006) | 2 lines

Bug 6490 - telco intercept should report NOANSWER instead of CHANUNAVAIL

........

................
r19436 | tilghman | 2006-04-11 19:23:16 -0400 (Tue, 11 Apr 2006) | 2 lines

Bug 6943 - transition away from using CallerID header, when we really mean CallerIDNum

................
r19437 | rizzo | 2006-04-11 19:54:33 -0400 (Tue, 11 Apr 2006) | 2 lines

remove useless \0, and fix formatting.

................
r19465 | rizzo | 2006-04-11 20:15:57 -0400 (Tue, 11 Apr 2006) | 3 lines

localize some variables, remove useless parentheses


................
r19466 | rizzo | 2006-04-11 20:17:37 -0400 (Tue, 11 Apr 2006) | 3 lines

reindent block properly


................

Modified:
    team/bweschke/queue_improvements/   (props changed)
    team/bweschke/queue_improvements/Makefile
    team/bweschke/queue_improvements/UPGRADE.txt
    team/bweschke/queue_improvements/acl.c
    team/bweschke/queue_improvements/apps/app_dial.c
    team/bweschke/queue_improvements/apps/app_page.c
    team/bweschke/queue_improvements/apps/app_voicemail.c
    team/bweschke/queue_improvements/asterisk.c
    team/bweschke/queue_improvements/channel.c
    team/bweschke/queue_improvements/channels/chan_iax2.c
    team/bweschke/queue_improvements/channels/chan_sip.c
    team/bweschke/queue_improvements/include/asterisk/linkedlists.h
    team/bweschke/queue_improvements/include/asterisk/lock.h
    team/bweschke/queue_improvements/manager.c
    team/bweschke/queue_improvements/pbx/pbx_config.c

Propchange: team/bweschke/queue_improvements/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/bweschke/queue_improvements/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Apr 11 22:12:13 2006
@@ -1,1 +1,1 @@
-/trunk:1-19288
+/trunk:1-19502

Modified: team/bweschke/queue_improvements/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/Makefile?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/Makefile (original)
+++ team/bweschke/queue_improvements/Makefile Tue Apr 11 22:12:13 2006
@@ -674,7 +674,6 @@
 	if [ -n "$(OLDHEADERS)" ]; then \
 		rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
 	fi
-	rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
@@ -693,7 +692,6 @@
 	else \
 		echo "You need to do cvs update -d not just cvs update" ; \
 	fi 
-	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
 	if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
 	@echo " +---- Asterisk Installation Complete -------+"  
 	@echo " +                                           +"

Modified: team/bweschke/queue_improvements/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/UPGRADE.txt?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/UPGRADE.txt (original)
+++ team/bweschke/queue_improvements/UPGRADE.txt Tue Apr 11 22:12:13 2006
@@ -35,6 +35,15 @@
   using indication tones, so typing in skip would give you unexpected results.
 
 * OSPAuth is added to authenticate OSP tokens in in_bound call setup messages.
+
+Manager:
+
+* After executing the 'status' manager action, the "Status" manager events
+  included the header "CallerID:" which was actually only the CallerID number,
+  and not the full CallerID string.  This header has been renamed to
+  "CallerIDNum".  For compatibility purposes, the CallerID parameter will remain
+  until after the release of 1.4, when it will be removed.  Please use the time
+  during the 1.4 release to make this transition.
 
 Variables:
 

Modified: team/bweschke/queue_improvements/acl.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/acl.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/acl.c (original)
+++ team/bweschke/queue_improvements/acl.c Tue Apr 11 22:12:13 2006
@@ -70,10 +70,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/srv.h"
 #include "asterisk/compat.h"
-
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
-AST_MUTEX_DEFINE_STATIC(routeseq_lock);
-#endif
 
 struct ast_ha {
 	/* Host access rule */

Modified: team/bweschke/queue_improvements/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/apps/app_dial.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/apps/app_dial.c (original)
+++ team/bweschke/queue_improvements/apps/app_dial.c Tue Apr 11 22:12:13 2006
@@ -306,6 +306,8 @@
 		if (chan->cdr) \
 			ast_cdr_failed(chan->cdr); \
 		numnochan++; \
+		break; \
+	case AST_CAUSE_NORMAL_CLEARING: \
 		break; \
 	default: \
 		numnochan++; \
@@ -841,6 +843,21 @@
 			ast_log(LOG_WARNING, "Dial does not accept L(%s), hanging up.\n", limit_str);
 			LOCAL_USER_REMOVE(u);
 			return -1;
+		} else if (play_warning > timelimit) {
+			/* If the first warning is requested _after_ the entire call would end,
+			   and no warning frequency is requested, then turn off the warning. If
+			   a warning frequency is requested, reduce the 'first warning' time by
+			   that frequency until it falls within the call's total time limit.
+			*/
+
+			if (!warning_freq) {
+				play_warning = 0;
+			} else {
+				while (play_warning > timelimit)
+					play_warning -= warning_freq;
+				if (play_warning < 1)
+					play_warning = warning_freq = 0;
+			}
 		}
 
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");

Modified: team/bweschke/queue_improvements/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/apps/app_page.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/apps/app_page.c (original)
+++ team/bweschke/queue_improvements/apps/app_page.c Tue Apr 11 22:12:13 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (c) 2004 - 2005 Digium, Inc.  All rights reserved.
+ * Copyright (c) 2004 - 2006 Digium, Inc.  All rights reserved.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -147,6 +147,7 @@
 	struct ast_app *app;
 	char *tmp;
 	int res=0;
+	char originator[AST_CHANNEL_NAME];
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
@@ -171,7 +172,16 @@
 		ast_app_parse_options(page_opts, &flags, NULL, options);
 
 	snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
+
+	ast_copy_string(originator, chan->name, sizeof(originator));
+	if ((tmp = strchr(originator, '-')))
+		*tmp = '\0';
+
 	while ((tech = strsep(&tmp, "&"))) {
+		/* don't call the originating device */
+		if (!strcasecmp(tech, originator))
+			continue;
+
 		if ((resource = strchr(tech, '/'))) {
 			*resource++ = '\0';
 			launch_page(chan, meetmeopts, tech, resource);
@@ -179,6 +189,7 @@
 			ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);
 		}
 	}
+
 	if (!ast_test_flag(&flags, PAGE_QUIET)) {
 		res = ast_streamfile(chan, "beep", chan->language);
 		if (!res)

Modified: team/bweschke/queue_improvements/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/apps/app_voicemail.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/apps/app_voicemail.c (original)
+++ team/bweschke/queue_improvements/apps/app_voicemail.c Tue Apr 11 22:12:13 2006
@@ -1280,7 +1280,7 @@
 		len = fdlen; /* SQL_LEN_DATA_AT_EXEC(fdlen); */
 		SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
 		SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
-		SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_BINARY, fdlen, 0, (void *)fdm, fdlen, &len);
+		SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, fdlen, 0, (void *)fdm, fdlen, &len);
 		SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(context), 0, (void *)context, 0, NULL);
 		SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(macrocontext), 0, (void *)macrocontext, 0, NULL);
 		SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(callerid), 0, (void *)callerid, 0, NULL);

Modified: team/bweschke/queue_improvements/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/asterisk.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/asterisk.c (original)
+++ team/bweschke/queue_improvements/asterisk.c Tue Apr 11 22:12:13 2006
@@ -597,6 +597,8 @@
 					consoles[x].fd = s;
 					if (ast_pthread_create(&consoles[x].t, &attr, netconsole, &consoles[x])) {
 						ast_log(LOG_ERROR, "Unable to spawn thread to handle connection: %s\n", strerror(errno));
+						close(consoles[x].p[0]);
+						close(consoles[x].p[1]);
 						consoles[x].fd = -1;
 						fdprint(s, "Server failed to spawn thread\n");
 						close(s);

Modified: team/bweschke/queue_improvements/channel.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/channel.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/channel.c (original)
+++ team/bweschke/queue_improvements/channel.c Tue Apr 11 22:12:13 2006
@@ -1271,7 +1271,6 @@
 	struct ast_frame *translated_frame = NULL;
 	struct ast_channel_spy *spy;
 	struct ast_channel_spy_queue *queue;
-	struct ast_channel_spy_queue *other_queue;
 	struct channel_spy_trans *trans;
 	struct ast_frame *last;
 
@@ -1333,48 +1332,42 @@
 
 		if (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
 			if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE) {
-				other_queue = (dir == SPY_WRITE) ? &spy->read_queue : &spy->write_queue;
-
-				if (other_queue->samples == 0) {
-					switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {
-					case CHANSPY_TRIGGER_READ:
-						if (dir == SPY_WRITE) {
-							ast_set_flag(spy, CHANSPY_TRIGGER_WRITE);
-							ast_clear_flag(spy, CHANSPY_TRIGGER_READ);
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to write-trigger mode\n",
-									spy->type, chan->name);
-						}
-						break;
-					case CHANSPY_TRIGGER_WRITE:
-						if (dir == SPY_READ) {
-							ast_set_flag(spy, CHANSPY_TRIGGER_READ);
-							ast_clear_flag(spy, CHANSPY_TRIGGER_WRITE);
-							if (option_debug)
-								ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to read-trigger mode\n",
-									spy->type, chan->name);
-						}
-						break;
+				switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {
+				case CHANSPY_TRIGGER_READ:
+					if (dir == SPY_WRITE) {
+						ast_set_flag(spy, CHANSPY_TRIGGER_WRITE);
+						ast_clear_flag(spy, CHANSPY_TRIGGER_READ);
+						if (option_debug)
+							ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to write-trigger mode\n",
+								spy->type, chan->name);
 					}
-					if (option_debug)
-						ast_log(LOG_DEBUG, "Triggering queue flush for spy '%s' on '%s'\n",
-							spy->type, chan->name);
-					ast_set_flag(spy, CHANSPY_TRIGGER_FLUSH);
-					ast_cond_signal(&spy->trigger);
-					ast_mutex_unlock(&spy->lock);
-					continue;
+					break;
+				case CHANSPY_TRIGGER_WRITE:
+					if (dir == SPY_READ) {
+						ast_set_flag(spy, CHANSPY_TRIGGER_READ);
+						ast_clear_flag(spy, CHANSPY_TRIGGER_WRITE);
+						if (option_debug)
+							ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to read-trigger mode\n",
+								spy->type, chan->name);
+					}
+					break;
 				}
-			}
-
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Spy '%s' on channel '%s' %s queue too long, dropping frames\n",
-					spy->type, chan->name, (dir == SPY_READ) ? "read" : "write");
-			while (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
-				struct ast_frame *drop = queue->head;
-
-				queue->samples -= drop->samples;
-				queue->head = drop->next;
-				ast_frfree(drop);
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Triggering queue flush for spy '%s' on '%s'\n",
+						spy->type, chan->name);
+				ast_set_flag(spy, CHANSPY_TRIGGER_FLUSH);
+				ast_cond_signal(&spy->trigger);
+			} else {
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Spy '%s' on channel '%s' %s queue too long, dropping frames\n",
+						spy->type, chan->name, (dir == SPY_READ) ? "read" : "write");
+				while (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
+					struct ast_frame *drop = queue->head;
+					
+					queue->samples -= drop->samples;
+					queue->head = drop->next;
+					ast_frfree(drop);
+				}
 			}
 		} else {
 			switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {

Modified: team/bweschke/queue_improvements/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/channels/chan_iax2.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/channels/chan_iax2.c (original)
+++ team/bweschke/queue_improvements/channels/chan_iax2.c Tue Apr 11 22:12:13 2006
@@ -847,7 +847,6 @@
 	thread = AST_LIST_FIRST(&idle_list);
 	if (thread != NULL) {
 		AST_LIST_REMOVE(&idle_list, thread, list);
-		thread->list.next = NULL;
 	}
 	AST_LIST_UNLOCK(&idle_list);
 
@@ -857,7 +856,6 @@
 		thread = AST_LIST_FIRST(&dynamic_list);
 		if (thread != NULL) {
 			AST_LIST_REMOVE(&dynamic_list, thread, list);
-			thread->list.next = NULL;
 		}
 		/* Make sure we absolutely have a thread... if not, try to make one if allowed */
 		if (thread == NULL && iaxmaxthreadcount > iaxdynamicthreadcount) {
@@ -8024,7 +8022,6 @@
 		/* Now... remove ourselves from the active list, and return to the idle list */
 		AST_LIST_LOCK(&active_list);
 		AST_LIST_REMOVE(&active_list, thread, list);
-		thread->list.next = NULL;
 		AST_LIST_UNLOCK(&active_list);
 
 		/* Go back into our respective list */

Modified: team/bweschke/queue_improvements/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/channels/chan_sip.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/channels/chan_sip.c (original)
+++ team/bweschke/queue_improvements/channels/chan_sip.c Tue Apr 11 22:12:13 2006
@@ -3927,56 +3927,57 @@
 	Received: RFC 3261, rport RFC 3581 */
 static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, struct sip_request *orig, char *field)
 {
-	char tmp[256], *end;
+	int copied = 0;
 	int start = 0;
-	int copied = 0;
-	char iabuf[INET_ADDRSTRLEN];
 
 	for (;;) {
+		char new[256];
 		const char *oh = __get_header(orig, field, &start);
 
 		if (ast_strlen_zero(oh))
 			break;
 
-			/* XXX reindent next block */
-			if (!copied) {	/* Only check for empty rport in topmost via header */
-				char *rport;
-				char new[256];
-
-				/* Find ;rport;  (empty request) */
-				rport = strstr(oh, ";rport");
-				if (rport && *(rport+6) == '=') 
-					rport = NULL;		/* We already have a parameter to rport */
-
-				if (rport && (ast_test_flag(&p->flags[0], SIP_NAT) == SIP_NAT_ALWAYS)) {
-					/* We need to add received port - rport */
-					ast_copy_string(tmp, oh, sizeof(tmp));
-
-					rport = strstr(tmp, ";rport");
-
-					if (rport) {
-						end = strchr(rport + 1, ';');
-						if (end)
-							memmove(rport, end, strlen(end) + 1);
-						else
-							*rport = '\0';
-					}
-
-					/* Add rport to first VIA header if requested */
-					/* Whoo hoo!  Now we can indicate port address translation too!  Just
-					   another RFC (RFC3581). I'll leave the original comments in for
-					   posterity.  */
-					snprintf(new, sizeof(new), "%s;received=%s;rport=%d", tmp, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr), ntohs(p->recv.sin_port));
-				} else {
-					/* We should *always* add a received to the topmost via */
-					snprintf(new, sizeof(new), "%s;received=%s", oh, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr));
+		if (!copied) {	/* Only check for empty rport in topmost via header */
+			char iabuf[INET_ADDRSTRLEN];
+			char *rport;
+
+			/* Find ;rport;  (empty request) */
+			rport = strstr(oh, ";rport");
+			if (rport && *(rport+6) == '=') 
+				rport = NULL;		/* We already have a parameter to rport */
+
+			if (rport && ast_test_flag(&p->flags[0], SIP_NAT) == SIP_NAT_ALWAYS) {
+				/* We need to add received port - rport */
+				char tmp[256], *end;
+
+				ast_copy_string(tmp, oh, sizeof(tmp));
+
+				rport = strstr(tmp, ";rport");
+
+				if (rport) {
+					end = strchr(rport + 1, ';');
+					if (end)
+						memmove(rport, end, strlen(end) + 1);
+					else
+						*rport = '\0';
 				}
-				add_header(req, field, new);
+
+				/* Add rport to first VIA header if requested */
+				/* Whoo hoo!  Now we can indicate port address translation too!  Just
+				   another RFC (RFC3581). I'll leave the original comments in for
+				   posterity.  */
+				snprintf(new, sizeof(new), "%s;received=%s;rport=%d",
+					tmp, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr),
+					ntohs(p->recv.sin_port));
 			} else {
-				/* Add the following via headers untouched */
-				add_header(req, field, oh);
+				/* We should *always* add a received to the topmost via */
+				snprintf(new, sizeof(new), "%s;received=%s",
+					oh, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr));
 			}
-			copied++;
+			oh = new;	/* the header to copy */
+		}  /* else add the following via headers untouched */
+		add_header(req, field, oh);
+		copied++;
 	}
 	if (!copied) {
 		ast_log(LOG_NOTICE, "No header field '%s' present to copy\n", field);
@@ -8502,7 +8503,7 @@
 	ASTOBJ_CONTAINER_TRAVERSE(&peerl, !result, do {
 		/* locking of the object is not required because only the name and flags are being compared */
 		if (!strncasecmp(word, iterator->name, wordlen) &&
-				ast_test_flag(&iterator->flags[1], flags2) &&
+				(!flags2 || ast_test_flag(&iterator->flags[1], flags2)) &&
 				++which > state)
 			result = ast_strdup(iterator->name);
 	} while(0) );
@@ -8882,11 +8883,12 @@
 	if (argc != 2) {
 		if (argc != 4) 
 			return RESULT_SHOWUSAGE;
-		else if (strncmp(argv[2], "ip\0", 3) == 0)
+		else if (strncmp(argv[2], "ip", 3) == 0)
 			return sip_do_debug_ip(fd, argc, argv);
-		else if (strncmp(argv[2], "peer\0", 5) == 0)
+		else if (strncmp(argv[2], "peer", 5) == 0)
 			return sip_do_debug_peer(fd, argc, argv);
-		else return RESULT_SHOWUSAGE;
+		else
+			return RESULT_SHOWUSAGE;
 	}
 	ast_set_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE);
 	memset(&debugaddr, 0, sizeof(debugaddr));

Modified: team/bweschke/queue_improvements/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/include/asterisk/linkedlists.h?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/include/asterisk/linkedlists.h (original)
+++ team/bweschke/queue_improvements/include/asterisk/linkedlists.h Tue Apr 11 22:12:13 2006
@@ -486,6 +486,7 @@
 				(head)->last = curelm;				\
 		} \
 	}								\
+        (elm)->field.next = NULL;                                       \
 } while (0)
 
 #endif /* _ASTERISK_LINKEDLISTS_H */

Modified: team/bweschke/queue_improvements/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/include/asterisk/lock.h?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/include/asterisk/lock.h (original)
+++ team/bweschke/queue_improvements/include/asterisk/lock.h Tue Apr 11 22:12:13 2006
@@ -102,7 +102,7 @@
 
 #ifdef DEBUG_THREADS
 
-#define __ast_mutex_logger(...) { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); }
+#define __ast_mutex_logger(...)  do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0)
 
 #ifdef THREAD_CRASH
 #define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
@@ -141,7 +141,7 @@
 		__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is already initialized.\n",
 				   filename, lineno, func, mutex_name);
 		__ast_mutex_logger("%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
-				   t->file, t->lineno, t->func, mutex_name);
+				   t->file[0], t->lineno[0], t->func[0], mutex_name);
 #ifdef THREAD_CRASH
 		DO_THREAD_CRASH;
 #endif
@@ -168,6 +168,7 @@
 
 	return __ast_pthread_mutex_init_attr(filename, lineno, func, mutex_name, t, &attr);
 }
+#define ast_mutex_init(pmutex) __ast_pthread_mutex_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
 
 static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *func,
 						const char *mutex_name, ast_mutex_t *t)
@@ -251,7 +252,7 @@
 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) || defined(AST_MUTEX_INIT_ON_FIRST_USE)
 	if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
 #ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
-		ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
+		__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
 				 filename, lineno, func, mutex_name);
 #endif
 		ast_mutex_init(t);
@@ -525,7 +526,6 @@
 	return res;
 }
 
-#define ast_mutex_init(pmutex) __ast_pthread_mutex_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
 #define ast_mutex_destroy(a) __ast_pthread_mutex_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_mutex_lock(a) __ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_mutex_unlock(a) __ast_pthread_mutex_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)

Modified: team/bweschke/queue_improvements/manager.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/manager.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/manager.c (original)
+++ team/bweschke/queue_improvements/manager.c Tue Apr 11 22:12:13 2006
@@ -1186,7 +1186,8 @@
 			"Event: Status\r\n"
 			"Privilege: Call\r\n"
 			"Channel: %s\r\n"
-			"CallerID: %s\r\n"
+			"CallerID: %s\r\n"		/* This parameter is deprecated and will be removed post-1.4 */
+			"CallerIDNum: %s\r\n"
 			"CallerIDName: %s\r\n"
 			"Account: %s\r\n"
 			"State: %s\r\n"
@@ -1200,6 +1201,7 @@
 			"\r\n",
 			c->name, 
 			c->cid.cid_num ? c->cid.cid_num : "<unknown>", 
+			c->cid.cid_num ? c->cid.cid_num : "<unknown>", 
 			c->cid.cid_name ? c->cid.cid_name : "<unknown>", 
 			c->accountcode,
 			ast_state2str(c->_state), c->context,
@@ -1209,7 +1211,8 @@
 			"Event: Status\r\n"
 			"Privilege: Call\r\n"
 			"Channel: %s\r\n"
-			"CallerID: %s\r\n"
+			"CallerID: %s\r\n"		/* This parameter is deprecated and will be removed post-1.4 */
+			"CallerIDNum: %s\r\n"
 			"CallerIDName: %s\r\n"
 			"Account: %s\r\n"
 			"State: %s\r\n"
@@ -1218,6 +1221,7 @@
 			"%s"
 			"\r\n",
 			c->name, 
+			c->cid.cid_num ? c->cid.cid_num : "<unknown>", 
 			c->cid.cid_num ? c->cid.cid_num : "<unknown>", 
 			c->cid.cid_name ? c->cid.cid_name : "<unknown>", 
 			c->accountcode,
@@ -1347,10 +1351,12 @@
 		"Exten: %s\r\n"
 		"Reason: %d\r\n"
 		"Uniqueid: %s\r\n"
-		"CallerID: %s\r\n"
+		"CallerID: %s\r\n"		/* This parameter is deprecated and will be removed post-1.4 */
+		"CallerIDNum: %s\r\n"
 		"CallerIDName: %s\r\n",
 		in->idtext, in->tech, in->data, in->context, in->exten, reason, 
 		chan ? chan->uniqueid : "<null>",
+		in->cid_num ? in->cid_num : "<unknown>",
 		in->cid_num ? in->cid_num : "<unknown>",
 		in->cid_name ? in->cid_name : "<unknown>"
 		);

Modified: team/bweschke/queue_improvements/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/pbx/pbx_config.c?rev=19503&r1=19502&r2=19503&view=diff
==============================================================================
--- team/bweschke/queue_improvements/pbx/pbx_config.c (original)
+++ team/bweschke/queue_improvements/pbx/pbx_config.c Tue Apr 11 22:12:13 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -1535,7 +1535,6 @@
 
 STATIC_MODULE int reload(void)
 {
-	ast_context_destroy(NULL, registrar);
 	if (clearglobalvars_config)
 		pbx_builtin_clear_globals();
 	pbx_load_module();



More information about the asterisk-commits mailing list