[asterisk-commits] branch russell/ast_malloc - r7527 in /team/russell/ast_malloc: ./ apps/ build...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 19 16:58:50 CST 2005


Author: russell
Date: Mon Dec 19 16:58:43 2005
New Revision: 7527

URL: http://svn.digium.com/view/asterisk?rev=7527&view=rev
Log:
Merged revisions 7457,7469,7471-7472,7481,7494,7496,7498,7509,7511-7512,7514,7516,7518,7520,7522,7524 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r7457 | kpfleming | 2005-12-13 01:00:17 -0500 (Tue, 13 Dec 2005) | 25 lines

Merged revisions 7448-7449,7451,7453 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7448 | kpfleming | 2005-12-12 22:25:14 -0600 (Mon, 12 Dec 2005) | 2 lines

use the stream's current point when pausing/unpausing, instead of elapsed time (which doesn't work when the stream has been skipped forward or backward) (issue #5897)

........
r7449 | kpfleming | 2005-12-12 22:43:38 -0600 (Mon, 12 Dec 2005) | 2 lines

only report AGENT_IDLE for callback mode agents when they are actually idle (issue #5902)

........
r7451 | kpfleming | 2005-12-12 23:14:27 -0600 (Mon, 12 Dec 2005) | 2 lines

ensure that hangups while incoming calls are in early state are handled properly (issue #5919)

........
r7453 | kpfleming | 2005-12-12 23:53:00 -0600 (Mon, 12 Dec 2005) | 2 lines

restore ability of caller to hangup calls that are still ringing (issue #5839)

........

................
r7469 | kpfleming | 2005-12-13 11:07:19 -0500 (Tue, 13 Dec 2005) | 10 lines

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

........
r7468 | kpfleming | 2005-12-13 10:06:27 -0600 (Tue, 13 Dec 2005) | 2 lines

correct broken math in tvfix() for timestamp values over one million

........

................
r7471 | kpfleming | 2005-12-13 13:54:41 -0500 (Tue, 13 Dec 2005) | 10 lines

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

........
r7470 | kpfleming | 2005-12-13 12:54:22 -0600 (Tue, 13 Dec 2005) | 2 lines

clarify substring documentation

........

................
r7472 | russell | 2005-12-13 17:03:06 -0500 (Tue, 13 Dec 2005) | 2 lines

reduce some duplicated code when doing a strdup (issue #5986)

................
r7481 | bweschke | 2005-12-14 21:49:17 -0500 (Wed, 14 Dec 2005) | 3 lines

 Bug #6003 - Don't free the channel structure until after having sent the manager event.


................
r7494 | tilghman | 2005-12-15 12:31:52 -0500 (Thu, 15 Dec 2005) | 2 lines

Make sure the functions CUT and SORT are built.

................
r7496 | tilghman | 2005-12-15 14:05:41 -0500 (Thu, 15 Dec 2005) | 2 lines

Properly move these functions over to the funcs directory (since they no longer contain apps)

................
r7498 | tilghman | 2005-12-15 19:55:39 -0500 (Thu, 15 Dec 2005) | 3 lines

First field was truncated.
(Don't kill me; this attempted merge didn't work because the paths changed.)

................
r7509 | tilghman | 2005-12-16 20:07:44 -0500 (Fri, 16 Dec 2005) | 3 lines

Merged revisions 7508 via svnmerge from
/branches/1.2

................
r7511 | kpfleming | 2005-12-16 21:21:36 -0500 (Fri, 16 Dec 2005) | 2 lines

block a commit to a module that no longer exists in trunk

................
r7512 | kpfleming | 2005-12-16 21:22:24 -0500 (Fri, 16 Dec 2005) | 10 lines

Merged revision 7510 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7510 | kpfleming | 2005-12-16 20:20:04 -0600 (Fri, 16 Dec 2005) | 2 lines

fix some buglet when building team branch version strings

........

................
r7514 | kpfleming | 2005-12-16 22:45:25 -0500 (Fri, 16 Dec 2005) | 10 lines

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

........
r7513 | kpfleming | 2005-12-16 21:44:30 -0600 (Fri, 16 Dec 2005) | 2 lines

forcibly expire previous subscriptions from a peer when they resubscribe (keeps them from building up and waiting for expiration, and stops us sending unwanted NOTIFY messages to devices)

........

................
r7516 | kpfleming | 2005-12-16 22:59:27 -0500 (Fri, 16 Dec 2005) | 10 lines

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

........
r7515 | kpfleming | 2005-12-16 21:59:05 -0600 (Fri, 16 Dec 2005) | 2 lines

Max-Forwards headers must only be present on requests, not responses

........

................
r7518 | tilghman | 2005-12-17 12:22:24 -0500 (Sat, 17 Dec 2005) | 3 lines

Merged revisions 7517 via svnmerge from
/branches/1.2

................
r7520 | tilghman | 2005-12-17 13:58:57 -0500 (Sat, 17 Dec 2005) | 3 lines

Merged revisions 7519 via svnmerge from
/branches/1.2

................
r7522 | tilghman | 2005-12-19 00:42:55 -0500 (Mon, 19 Dec 2005) | 3 lines

Merged revisions 7521 via svnmerge from
/branches/1.2

................
r7524 | tilghman | 2005-12-19 14:08:42 -0500 (Mon, 19 Dec 2005) | 3 lines

Merged revisions 7523 via svnmerge from
/branches/1.2

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

Added:
    team/russell/ast_malloc/funcs/func_cut.c
      - copied unchanged from r7524, trunk/funcs/func_cut.c
Removed:
    team/russell/ast_malloc/apps/app_cut.c
Modified:
    team/russell/ast_malloc/   (props changed)
    team/russell/ast_malloc/app.c
    team/russell/ast_malloc/apps/app_chanspy.c
    team/russell/ast_malloc/apps/app_dial.c
    team/russell/ast_malloc/apps/app_macro.c
    team/russell/ast_malloc/build_tools/make_svn_branch_name
    team/russell/ast_malloc/cdr.c
    team/russell/ast_malloc/channel.c
    team/russell/ast_malloc/channels/chan_agent.c
    team/russell/ast_malloc/channels/chan_sip.c
    team/russell/ast_malloc/doc/README.ael
    team/russell/ast_malloc/doc/README.variables
    team/russell/ast_malloc/file.c
    team/russell/ast_malloc/include/asterisk/linkedlists.h
    team/russell/ast_malloc/pbx.c
    team/russell/ast_malloc/utils.c

Propchange: team/russell/ast_malloc/
------------------------------------------------------------------------------
    svnmerge-blocked = /branches/1.2:7497

Propchange: team/russell/ast_malloc/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Dec 19 16:58:43 2005
@@ -1,1 +1,1 @@
-/trunk:1-7451
+/trunk:1-7526

Modified: team/russell/ast_malloc/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/app.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/app.c (original)
+++ team/russell/ast_malloc/app.c Mon Dec 19 16:58:43 2005
@@ -430,11 +430,11 @@
 			   const char *stop, const char *pause,
 			   const char *restart, int skipms) 
 {
-	long elapsed = 0, last_elapsed = 0;
 	char *breaks = NULL;
 	char *end = NULL;
 	int blen = 2;
 	int res;
+	long pause_restart_point = 0;
 
 	if (stop)
 		blen += strlen(stop);
@@ -456,9 +456,6 @@
 	if (chan->_state != AST_STATE_UP)
 		res = ast_answer(chan);
 
-	if (chan)
-		ast_stopstream(chan);
-
 	if (file) {
 		if ((end = strchr(file,':'))) {
 			if (!strcasecmp(end, ":end")) {
@@ -469,25 +466,18 @@
 	}
 
 	for (;;) {
-		struct timeval started = ast_tvnow();
-
-		if (chan)
-			ast_stopstream(chan);
+		ast_stopstream(chan);
 		res = ast_streamfile(chan, file, chan->language);
 		if (!res) {
-			if (end) {
+			if (pause_restart_point) {
+				ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
+				pause_restart_point = 0;
+			}
+			else if (end) {
 				ast_seekstream(chan->stream, 0, SEEK_END);
-				end=NULL;
-			}
-			res = 1;
-			if (elapsed) {
-				ast_stream_fastforward(chan->stream, elapsed);
-				last_elapsed = elapsed - 200;
-			}
-			if (res)
-				res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
-			else
-				break;
+				end = NULL;
+			};
+			res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
 		}
 
 		if (res < 1)
@@ -496,17 +486,16 @@
 		/* We go at next loop if we got the restart char */
 		if (restart && strchr(restart, res)) {
 			ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
-			elapsed=0; /* To make sure the next stream will start at beginning */
+			pause_restart_point = 0;
 			continue;
 		}
 
-		if (pause != NULL && strchr(pause, res)) {
-			elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
-			for(;;) {
-				if (chan)
-					ast_stopstream(chan);
+		if (pause && strchr(pause, res)) {
+			pause_restart_point = ast_tellstream(chan->stream);
+			for (;;) {
+				ast_stopstream(chan);
 				res = ast_waitfordigit(chan, 1000);
-				if (res == 0)
+				if (!res)
 					continue;
 				else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
 					break;
@@ -516,17 +505,16 @@
 				continue;
 			}
 		}
+
 		if (res == -1)
 			break;
 
 		/* if we get one of our stop chars, return it to the calling function */
-		if (stop && strchr(stop, res)) {
-			/* res = 0; */
-			break;
-		}
-	}
-	if (chan)
-		ast_stopstream(chan);
+		if (stop && strchr(stop, res))
+			break;
+	}
+
+	ast_stopstream(chan);
 
 	return res;
 }

Modified: team/russell/ast_malloc/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/apps/app_chanspy.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/apps/app_chanspy.c (original)
+++ team/russell/ast_malloc/apps/app_chanspy.c Mon Dec 19 16:58:43 2005
@@ -482,7 +482,7 @@
 					}
 				}
 				
-				if (igrp && (!spec || ((strlen(spec) < strlen(peer->name) &&
+				if (igrp && (!spec || ((strlen(spec) <= strlen(peer->name) &&
 							!strncasecmp(peer->name, spec, strlen(spec)))))) {
 					if (peer && (!bronly || ast_bridged_channel(peer)) &&
 					    !ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {

Modified: team/russell/ast_malloc/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/apps/app_dial.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/apps/app_dial.c (original)
+++ team/russell/ast_malloc/apps/app_dial.c Mon Dec 19 16:58:43 2005
@@ -962,7 +962,7 @@
 	/* If a channel group has been specified, get it for use when we create peer channels */
 	outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
 
-	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID);
+	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
 	cur = args.peers;
 	do {
 		/* Remember where to start next time */

Modified: team/russell/ast_malloc/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/apps/app_macro.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/apps/app_macro.c (original)
+++ team/russell/ast_malloc/apps/app_macro.c Mon Dec 19 16:58:43 2005
@@ -86,6 +86,11 @@
 STANDARD_LOCAL_USER;
 
 LOCAL_USER_DECL;
+
+static char *safe_strdup(const char *s)
+{
+	return s ? strdup(s) : NULL;
+}
 
 static int macro_exec(struct ast_channel *chan, void *data)
 {
@@ -162,25 +167,17 @@
 	}
 	argc = 1;
 	/* Save old macro variables */
-	save_macro_exten = pbx_builtin_getvar_helper(chan, "MACRO_EXTEN");
-	if (save_macro_exten) 
-		save_macro_exten = strdup(save_macro_exten);
+	save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
 	pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
 
-	save_macro_context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT");
-	if (save_macro_context)
-		save_macro_context = strdup(save_macro_context);
+	save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
 	pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
 
-	save_macro_priority = pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY");
-	if (save_macro_priority) 
-		save_macro_priority = strdup(save_macro_priority);
+	save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
 	snprintf(pc, sizeof(pc), "%d", oldpriority);
 	pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
   
-	save_macro_offset = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET");
-	if (save_macro_offset) 
-		save_macro_offset = strdup(save_macro_offset);
+	save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
 	pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
 
 	/* Setup environment for new run */

Modified: team/russell/ast_malloc/build_tools/make_svn_branch_name
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/build_tools/make_svn_branch_name?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/build_tools/make_svn_branch_name (original)
+++ team/russell/ast_malloc/build_tools/make_svn_branch_name Mon Dec 19 16:58:43 2005
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-PARTS=`LANG=C svn info | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :'`
+PARTS=`LANG=C svn info | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/asterisk/:: | sed -e 's:/: :g'`
 BRANCH=0
 TEAM=0
 
@@ -47,4 +47,4 @@
   fi
 done
 
-echo ${RESULT}-r${REV}
+echo ${RESULT##-}-r${REV}

Modified: team/russell/ast_malloc/cdr.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/cdr.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/cdr.c (original)
+++ team/russell/ast_malloc/cdr.c Mon Dec 19 16:58:43 2005
@@ -691,12 +691,15 @@
 
 int ast_cdr_setamaflags(struct ast_channel *chan, const char *flag)
 {
-	struct ast_cdr *cdr = chan->cdr;
+	struct ast_cdr *cdr;
 	int newflag;
 
 	newflag = ast_cdr_amaflags2int(flag);
-	if (newflag)
-		cdr->amaflags = newflag;
+	if (newflag) {
+		for (cdr = chan->cdr; cdr; cdr = cdr->next) {
+			cdr->amaflags = newflag;
+		}
+	}
 
 	return 0;
 }

Modified: team/russell/ast_malloc/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/channel.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/channel.c (original)
+++ team/russell/ast_malloc/channel.c Mon Dec 19 16:58:43 2005
@@ -3055,7 +3055,6 @@
 	if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
 		ast_log(LOG_DEBUG, "Destroying channel clone '%s'\n", clone->name);
 		ast_mutex_unlock(&clone->lock);
-		ast_channel_free(clone);
 		manager_event(EVENT_FLAG_CALL, "Hangup", 
 			"Channel: %s\r\n"
 			"Uniqueid: %s\r\n"
@@ -3066,6 +3065,7 @@
 			clone->hangupcause,
 			ast_cause2str(clone->hangupcause)
 			);
+		ast_channel_free(clone);
 	} else {
 		struct ast_frame null_frame = { AST_FRAME_NULL, };
 		ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);

Modified: team/russell/ast_malloc/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/channels/chan_agent.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/channels/chan_agent.c (original)
+++ team/russell/ast_malloc/channels/chan_agent.c Mon Dec 19 16:58:43 2005
@@ -1417,7 +1417,7 @@
 		/* Set a default status. It 'should' get changed. */
 		status = "AGENT_UNKNOWN";
 
-		if (!ast_strlen_zero(p->loginchan)) {
+		if (!ast_strlen_zero(p->loginchan) && !p->chan) {
 			loginChan = p->loginchan;
 			talkingtoChan = "n/a";
 			status = "AGENT_IDLE";

Modified: team/russell/ast_malloc/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/channels/chan_sip.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/channels/chan_sip.c (original)
+++ team/russell/ast_malloc/channels/chan_sip.c Mon Dec 19 16:58:43 2005
@@ -2279,6 +2279,7 @@
 /* Possible values taken from causes.h */
 
 	switch(cause) {
+		case 603:	/* Declined */
 		case 403:	/* Not found */
 			return AST_CAUSE_CALL_REJECTED;
 		case 404:	/* Not found */
@@ -2458,7 +2459,7 @@
 				if (ast->hangupcause && ((res = hangup_cause2sip(ast->hangupcause)))) {
 					transmit_response_reliable(p, res, &p->initreq, 1);
 				} else 
-					transmit_response_reliable(p, "403 Forbidden", &p->initreq, 1);
+					transmit_response_reliable(p, "603 Declined", &p->initreq, 1);
 			}
 		} else {	/* Call is in UP state, send BYE */
 			if (!p->pendinginvite) {
@@ -3992,7 +3993,6 @@
 	copy_header(resp, req, "CSeq");
 	add_header(resp, "User-Agent", default_useragent);
 	add_header(resp, "Allow", ALLOWED_METHODS);
-	add_header(resp, "Max-Forwards", DEFAULT_MAX_FORWARDS);
 	if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) {
 		/* For registration responses, we also need expiry and
 		   contact info */
@@ -10798,12 +10798,40 @@
 			ast_set_flag(p, SIP_NEEDDESTROY);	
 			return 0;
 		} else {
+			struct sip_pvt *p_old;
+
 			transmit_response(p, "200 OK", req);
 			transmit_state_notify(p, firststate, 1, 1);	/* Send first notification */
 			append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
+
+			/* remove any old subscription from this peer for the same exten/context,
+			   as the peer has obviously forgotten about it and it's wasteful to wait
+			   for it to expire and send NOTIFY messages to the peer only to have them
+			   ignored (or generate errors)
+			*/
+			ast_mutex_lock(&iflock);
+			for (p_old = iflist; p_old; p_old = p_old->next) {
+				if (p_old == p)
+					continue;
+				if (p_old->initreq.method != SIP_SUBSCRIBE)
+					continue;
+				if (p_old->subscribed == NONE)
+					continue;
+				ast_mutex_lock(&p_old->lock);
+				if (!strcmp(p_old->username, p->username)) {
+					if (!strcmp(p_old->exten, p->exten) &&
+					    !strcmp(p_old->context, p->context)) {
+						ast_set_flag(p_old, SIP_NEEDDESTROY);
+						ast_mutex_unlock(&p_old->lock);
+						break;
+					}
+				}
+				ast_mutex_unlock(&p_old->lock);
+			}
+			ast_mutex_unlock(&iflock);
 		}
 		if (!p->expiry)
-			ast_set_flag(p, SIP_NEEDDESTROY);	
+			ast_set_flag(p, SIP_NEEDDESTROY);
 	}
 	return 1;
 }

Modified: team/russell/ast_malloc/doc/README.ael
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/doc/README.ael?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/doc/README.ael (original)
+++ team/russell/ast_malloc/doc/README.ael Mon Dec 19 16:58:43 2005
@@ -263,3 +263,11 @@
 	i => Playback(invalid);
 };
 
+
+Syntax Note
+------------------------
+Please note that all opening {'s are on the same line as the keyword.  For
+the time being, that syntax is mandatory.  We are looking at ways to allow
+other syntax in the future for flexibility, but for now, that is the way
+you must write AEL clauses.
+

Modified: team/russell/ast_malloc/doc/README.variables
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/doc/README.variables?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/doc/README.variables (original)
+++ team/russell/ast_malloc/doc/README.variables Mon Dec 19 16:58:43 2005
@@ -94,17 +94,17 @@
 
 
 
-_______________________________
-REMOVING CHARACTERS FROM STRING
--------------------------------
-
-The format for removing characters from a variable can be expressed as:
+___________________________________
+SELECTING CHARACTERS FROM VARIABLES
+-----------------------------------
+
+The format for selecting characters from a variable can be expressed as:
 
 	${variable_name[:offset[:length]]}
 
-If you want to remove the first N characters from the string assigned
+If you want to select the first N characters from the string assigned
 to a variable, simply append a colon and the number of characters to
-remove from the beginning of the string to the variable name.
+skip from the beginning of the string to the variable name.
 
 	;Remove the first character of extension, save in "number" variable
 	exten => _9X.,1,Set(number=${EXTEN:1})
@@ -115,7 +115,7 @@
 digit.
 
 If you use a negative offset number, Asterisk starts counting from the end 
-of the string and then removes everything before the new position. The following
+of the string and then selects everything after the new position. The following
 example will save the numbers 1234 to the 'number' variable, still assuming
 we've dialed 918005551234.
 

Modified: team/russell/ast_malloc/file.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/file.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/file.c (original)
+++ team/russell/ast_malloc/file.c Mon Dec 19 16:58:43 2005
@@ -955,6 +955,8 @@
 					fs->filename = strdup(filename);
 				}
 				fs->vfs = NULL;
+				/* If truncated, we'll be at the beginning; if not truncated, then append */
+				f->seek(fs, 0, SEEK_END);
 			} else {
 				ast_log(LOG_WARNING, "Unable to rewrite %s\n", fn);
 				close(fd);

Modified: team/russell/ast_malloc/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/include/asterisk/linkedlists.h?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/include/asterisk/linkedlists.h (original)
+++ team/russell/ast_malloc/include/asterisk/linkedlists.h Mon Dec 19 16:58:43 2005
@@ -381,7 +381,8 @@
   used to link entries of this list together.
 
   Note: The link field in the appended entry is \b not modified, so if it is
-  actually the head of a list itself, the entire list will be appended.
+  actually the head of a list itself, the entire list will be appended
+  temporarily (until the next AST_LIST_INSERT_TAIL is performed).
  */
 #define AST_LIST_INSERT_TAIL(head, elm, field) do {			\
       if (!(head)->first) {						\
@@ -431,7 +432,7 @@
 		while (curelm->field.next != (elm))			\
 			curelm = curelm->field.next;			\
 		curelm->field.next = (elm)->field.next;			\
-		if ((head)->last == curelm->field.next)			\
+		if ((head)->last == (elm))				\
 			(head)->last = curelm;				\
 	}								\
 } while (0)

Modified: team/russell/ast_malloc/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/pbx.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/pbx.c (original)
+++ team/russell/ast_malloc/pbx.c Mon Dec 19 16:58:43 2005
@@ -5443,6 +5443,8 @@
 static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
 {
 	/* Just return non-zero and it will hang up */
+	if (!chan->hangupcause)
+		chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
 	return -1;
 }
 

Modified: team/russell/ast_malloc/utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_malloc/utils.c?rev=7527&r1=7526&r2=7527&view=diff
==============================================================================
--- team/russell/ast_malloc/utils.c (original)
+++ team/russell/ast_malloc/utils.c Mon Dec 19 16:58:43 2005
@@ -613,11 +613,11 @@
 	if (a.tv_usec >= ONE_MILLION) {
 		ast_log(LOG_WARNING, "warning too large timestamp %ld.%ld\n",
 			a.tv_sec, (long int) a.tv_usec);
-		a.tv_sec += a.tv_usec % ONE_MILLION;
+		a.tv_sec += a.tv_usec / ONE_MILLION;
 		a.tv_usec %= ONE_MILLION;
 	} else if (a.tv_usec < 0) {
 		ast_log(LOG_WARNING, "warning negative timestamp %ld.%ld\n",
-				a.tv_sec, (long int) a.tv_usec);
+			a.tv_sec, (long int) a.tv_usec);
 		a.tv_usec = 0;
 	}
 	return a;



More information about the asterisk-commits mailing list