[svn-commits] branch oej/moduletest - r7880 in /team/oej/moduletest: ./ apps/ channels/ for...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Jan 9 07:44:57 CST 2006


Author: oej
Date: Mon Jan  9 07:44:44 2006
New Revision: 7880

URL: http://svn.digium.com/view/asterisk?rev=7880&view=rev
Log:
Merged revisions 7677,7706,7709,7736,7738,7740,7743,7746,7771,7773,7792,7795,7799-7800,7803,7805,7807,7809,7812,7819,7823,7825,7827,7829,7831,7848,7870-7871 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7677 | tilghman | 2005-12-30 15:54:19 +0100 (Fri, 30 Dec 2005) | 2 lines

Bug 6091 - Fix race condition around uniqueid

........
r7706 | bweschke | 2006-01-02 03:04:14 +0100 (Mon, 02 Jan 2006) | 3 lines

 Fix compiler warnings.


........
r7709 | tilghman | 2006-01-02 08:31:54 +0100 (Mon, 02 Jan 2006) | 2 lines

Bug 6084 - MixMonitor after a 'cli stop monitor' deadlocks

........
r7736 | kpfleming | 2006-01-03 17:34:12 +0100 (Tue, 03 Jan 2006) | 2 lines

don't leak memory for (most) expression evaluations

........
r7738 | kpfleming | 2006-01-03 18:00:01 +0100 (Tue, 03 Jan 2006) | 2 lines

backport rport scanning fix from trunk (bug #6071)

........
r7740 | kpfleming | 2006-01-03 18:24:56 +0100 (Tue, 03 Jan 2006) | 4 lines

revert incorrect fix for bug #6048 from revision 7709
put in correct (simpler) fix
add doxygen docs for channel spy 'state' values

........
r7743 | tilghman | 2006-01-03 19:15:12 +0100 (Tue, 03 Jan 2006) | 2 lines

Bug 6121 - typo in application description

........
r7746 | kpfleming | 2006-01-03 21:22:18 +0100 (Tue, 03 Jan 2006) | 2 lines

remove unused 'old' expression parser

........
r7771 | bweschke | 2006-01-04 06:27:38 +0100 (Wed, 04 Jan 2006) | 3 lines

 Fix the 'if' clause to be true under the right conditions. Bug #6126


........
r7773 | russell | 2006-01-04 08:06:50 +0100 (Wed, 04 Jan 2006) | 2 lines

use a more correct way of determining the size of the destination buffer

........
r7792 | oej | 2006-01-04 22:43:14 +0100 (Wed, 04 Jan 2006) | 2 lines

Fixing typo in XML for video updates.

........
r7795 | oej | 2006-01-04 22:46:40 +0100 (Wed, 04 Jan 2006) | 2 lines

Issue #5980: Removing extra CR+LF in manager events - needs port to trunk

........
r7799 | kpfleming | 2006-01-05 00:02:38 +0100 (Thu, 05 Jan 2006) | 2 lines

make monitoring more tolerant of peers that deliver frames in bursts

........
r7800 | kpfleming | 2006-01-05 00:27:57 +0100 (Thu, 05 Jan 2006) | 2 lines

ensure that ulaw/alaw sound files are filled with silence when extended (not zeroes)

........
r7803 | kpfleming | 2006-01-05 00:45:34 +0100 (Thu, 05 Jan 2006) | 2 lines

return properly after extending file

........
r7805 | kpfleming | 2006-01-05 00:51:03 +0100 (Thu, 05 Jan 2006) | 2 lines

use proper fwrite() parameters and return value

........
r7807 | kpfleming | 2006-01-05 01:18:46 +0100 (Thu, 05 Jan 2006) | 2 lines

doh... fseek() has no useful return value

........
r7809 | kpfleming | 2006-01-05 01:58:29 +0100 (Thu, 05 Jan 2006) | 2 lines

send device state updates for auto-logoff of agents as well

........
r7812 | oej | 2006-01-05 10:13:21 +0100 (Thu, 05 Jan 2006) | 2 lines

Fix copyright of changed file

........
r7819 | kpfleming | 2006-01-05 21:52:38 +0100 (Thu, 05 Jan 2006) | 2 lines

ensure that variable is initialized

........
r7823 | tilghman | 2006-01-06 00:07:08 +0100 (Fri, 06 Jan 2006) | 2 lines

Bug 6081 - fix for memory leak, formatting fixes

........
r7825 | kpfleming | 2006-01-06 00:49:50 +0100 (Fri, 06 Jan 2006) | 3 lines

eliminate rounding errors that caused call time limits to be inaccurate (issue #5913)
round 'time left' reported during call limit warnings up to sound more accurate

........
r7827 | tilghman | 2006-01-06 00:53:07 +0100 (Fri, 06 Jan 2006) | 2 lines

Bug 6076 - Fix documentation of ast_trim_blank return value

........
r7829 | kpfleming | 2006-01-06 01:21:00 +0100 (Fri, 06 Jan 2006) | 2 lines

update agent persistence when an agent gets logged off by autologoff

........
r7831 | tilghman | 2006-01-06 01:34:40 +0100 (Fri, 06 Jan 2006) | 2 lines

Dumb error messages - "Context 'context' already included in 'in' context"

........
r7848 | tilghman | 2006-01-07 08:27:18 +0100 (Sat, 07 Jan 2006) | 2 lines

Bug 6156 - catch all threading errors, not just simple failure

........
r7870 | russell | 2006-01-09 05:52:16 +0100 (Mon, 09 Jan 2006) | 2 lines

backport fix for unnecessary unlock (issue #6171)

........
r7871 | russell | 2006-01-09 06:11:44 +0100 (Mon, 09 Jan 2006) | 2 lines

fix seg fault when using greek syntax in VoicemMailMain (issue #6142)

........

Removed:
    team/oej/moduletest/ast_expr.y
Modified:
    team/oej/moduletest/   (props changed)
    team/oej/moduletest/apps/app_chanspy.c
    team/oej/moduletest/apps/app_mixmonitor.c
    team/oej/moduletest/apps/app_privacy.c
    team/oej/moduletest/apps/app_stack.c
    team/oej/moduletest/apps/app_voicemail.c
    team/oej/moduletest/ast_expr2.fl
    team/oej/moduletest/ast_expr2f.c
    team/oej/moduletest/channel.c
    team/oej/moduletest/channels/chan_agent.c
    team/oej/moduletest/channels/chan_iax2.c
    team/oej/moduletest/channels/chan_sip.c
    team/oej/moduletest/formats/format_pcm.c
    team/oej/moduletest/formats/format_pcm_alaw.c
    team/oej/moduletest/funcs/func_moh.c
    team/oej/moduletest/include/asterisk/chanspy.h
    team/oej/moduletest/include/asterisk/strings.h
    team/oej/moduletest/manager.c
    team/oej/moduletest/pbx/pbx_config.c
    team/oej/moduletest/pbx/pbx_spool.c
    team/oej/moduletest/res/res_features.c

Propchange: team/oej/moduletest/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan  9 07:44:44 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7496,7498-7672
+/branches/1.2:1-7496,7498-7879

Modified: team/oej/moduletest/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_chanspy.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_chanspy.c (original)
+++ team/oej/moduletest/apps/app_chanspy.c Mon Jan  9 07:44:44 2006
@@ -208,9 +208,9 @@
 
 static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy) 
 {
-	/* If our status has changed, then the channel we're spying on is gone....
+	/* If our status has changed to DONE, then the channel we're spying on is gone....
 	   DON'T TOUCH IT!!!  RUN AWAY!!! */
-	if (spy->status != CHANSPY_RUNNING)
+	if (spy->status == CHANSPY_DONE)
 		return;
 
 	if (!chan)

Modified: team/oej/moduletest/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_mixmonitor.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_mixmonitor.c (original)
+++ team/oej/moduletest/apps/app_mixmonitor.c Mon Jan  9 07:44:44 2006
@@ -112,9 +112,9 @@
 
 static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy) 
 {
-	/* If our status has changed, then the channel we're spying on is gone....
+	/* If our status has changed to DONE, then the channel we're spying on is gone....
 	   DON'T TOUCH IT!!!  RUN AWAY!!! */
-	if (spy->status != CHANSPY_RUNNING)
+	if (spy->status == CHANSPY_DONE)
 		return;
 
 	if (!chan)

Modified: team/oej/moduletest/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_privacy.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_privacy.c (original)
+++ team/oej/moduletest/apps/app_privacy.c Mon Jan  9 07:44:44 2006
@@ -193,7 +193,7 @@
 		}
 		
 		/*Got a number, play sounds and send them on their way*/
-		if ((retries < maxretries) && res == 1 ) {
+		if ((retries < maxretries) && !res ) {
 			res = ast_streamfile(chan, "privacy-thankyou", chan->language);
 			if (!res)
 				res = ast_waitstream(chan, "");

Modified: team/oej/moduletest/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_stack.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_stack.c (original)
+++ team/oej/moduletest/apps/app_stack.c Mon Jan  9 07:44:44 2006
@@ -52,22 +52,18 @@
 
 static const char *gosub_descrip =
 "Gosub([[context|]exten|]priority)\n"
-"  Jumps to the label specified, saving the return address.\n"
-"  Returns 0 if the label exists or -1 otherwise.\n";
+"  Jumps to the label specified, saving the return address.\n";
 static const char *gosubif_descrip =
-"Gosub(condition?labeliftrue[:labeliffalse])\n"
+"GosubIf(condition?labeliftrue[:labeliffalse])\n"
 "  If the condition is true, then jump to labeliftrue.  If false, jumps to\n"
 "labeliffalse, if specified.  In either case, a jump saves the return point\n"
-"in the dialplan, to be returned to with a Return.\n"
-"  Returns 0 if the label exists or -1 otherwise.\n";
+"in the dialplan, to be returned to with a Return.\n";
 static const char *return_descrip =
 "Return()\n"
-"  Jumps to the last label in the stack, removing it.\n"
-"  Returns 0 if there's a label in the stack or -1 otherwise.\n";
+"  Jumps to the last label on the stack, removing it.\n";
 static const char *pop_descrip =
 "StackPop()\n"
-"  Removes last label in the stack, discarding it.\n"
-"  Always returns 0, even if the stack is empty.\n";
+"  Removes last label on the stack, discarding it.\n";
 
 STANDARD_LOCAL_USER;
 

Modified: team/oej/moduletest/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_voicemail.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_voicemail.c (original)
+++ team/oej/moduletest/apps/app_voicemail.c Mon Jan  9 07:44:44 2006
@@ -3919,8 +3919,8 @@
 static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox)
 {
 	int cmd;
-	char buf[sizeof(mbox)+1]; 
-
+	char *buf;
+	buf = alloca(strlen(mbox)+2); 
 	memset(buf, '\0', sizeof(char)*(sizeof(buf)));
 	strcpy(buf, mbox);
 	strcat(buf,"s");

Modified: team/oej/moduletest/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/ast_expr2.fl?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/ast_expr2.fl (original)
+++ team/oej/moduletest/ast_expr2.fl Mon Jan  9 07:44:44 2006
@@ -98,42 +98,42 @@
 
 int ast_expr(char *expr, char *buf, int length)
 {
-	struct parse_io *io;
+	struct parse_io io;
+	int return_value = 0;
 	
-	io = calloc(sizeof(struct parse_io),1);
-	io->string = expr;  /* to pass to the error routine */
+	memset(&io, 0, sizeof(io));
+	io.string = expr;  /* to pass to the error routine */
 	
-	ast_yylex_init(&io->scanner);
+	ast_yylex_init(&io.scanner);
 	
-	ast_yy_scan_string(expr, io->scanner);
+	ast_yy_scan_string(expr, io.scanner);
 	
-	ast_yyparse ((void *) io);
+	ast_yyparse ((void *) &io);
 
-	ast_yylex_destroy(io->scanner);
+	ast_yylex_destroy(io.scanner);
 
-	if (io->val == NULL) {
+	if (!io.val) {
 		if (length > 1) {
 			strcpy(buf, "0");
-			return 1;
+			return_value = 1;
 		}
 	} else {
-		if (io->val->type == AST_EXPR_integer) {
+		if (io.val->type == AST_EXPR_integer) {
 			int res_length;
 
-			res_length = snprintf(buf, length, "%ld", (long int) io->val->u.i);
-			return res_length <= length ? res_length : length;
+			res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
+			return_value = (res_length <= length) ? res_length : length;
 		} else {
 #ifdef STANDALONE
-			strncpy(buf, io->val->u.s, length - 1);
+			strncpy(buf, io.val->u.s, length - 1);
 #else /* !STANDALONE */
-			ast_copy_string(buf, io->val->u.s, length);
+			ast_copy_string(buf, io.val->u.s, length);
 #endif /* STANDALONE */
-			return strlen(buf);
+			return_value = strlen(buf);
 		}
-		free(io->val);
+		free(io.val);
 	}
-	free(io);
-	return 0;
+	return return_value;
 }
 
 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )

Modified: team/oej/moduletest/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/ast_expr2f.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/ast_expr2f.c (original)
+++ team/oej/moduletest/ast_expr2f.c Mon Jan  9 07:44:44 2006
@@ -2562,42 +2562,42 @@
 
 int ast_expr(char *expr, char *buf, int length)
 {
-	struct parse_io *io;
+	struct parse_io io;
+	int return_value = 0;
 	
-	io = calloc(sizeof(struct parse_io),1);
-	io->string = expr;  /* to pass to the error routine */
+	memset(&io, 0, sizeof(io));
+	io.string = expr;  /* to pass to the error routine */
 	
-	ast_yylex_init(&io->scanner);
+	ast_yylex_init(&io.scanner);
 	
-	ast_yy_scan_string(expr, io->scanner);
+	ast_yy_scan_string(expr, io.scanner);
 	
-	ast_yyparse ((void *) io);
-
-	ast_yylex_destroy(io->scanner);
-
-	if (io->val == NULL) {
+	ast_yyparse ((void *) &io);
+
+	ast_yylex_destroy(io.scanner);
+
+	if (!io.val) {
 		if (length > 1) {
 			strcpy(buf, "0");
-			return 1;
+			return_value = 1;
 		}
 	} else {
-		if (io->val->type == AST_EXPR_integer) {
+		if (io.val->type == AST_EXPR_integer) {
 			int res_length;
 
-			res_length = snprintf(buf, length, "%ld", (long int) io->val->u.i);
-			return res_length <= length ? res_length : length;
+			res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
+			return_value = (res_length <= length) ? res_length : length;
 		} else {
 #ifdef STANDALONE
-			strncpy(buf, io->val->u.s, length - 1);
+			strncpy(buf, io.val->u.s, length - 1);
 #else /* !STANDALONE */
-			ast_copy_string(buf, io->val->u.s, length);
+			ast_copy_string(buf, io.val->u.s, length);
 #endif /* STANDALONE */
-			return strlen(buf);
+			return_value = strlen(buf);
 		}
-		free(io->val);
+		free(io.val);
 	}
-	free(io);
-	return 0;
+	return return_value;
 }
 
 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )

Modified: team/oej/moduletest/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channel.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/channel.c (original)
+++ team/oej/moduletest/channel.c Mon Jan  9 07:44:44 2006
@@ -94,6 +94,7 @@
  */
 static int shutting_down = 0;
 
+AST_MUTEX_DEFINE_STATIC(uniquelock);
 static int uniqueint = 0;
 
 unsigned long global_fin = 0, global_fout = 0;
@@ -583,7 +584,9 @@
 	tmp->data = NULL;
 	tmp->fin = global_fin;
 	tmp->fout = global_fout;
+	ast_mutex_lock(&uniquelock);
 	snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
+	ast_mutex_unlock(&uniquelock);
 	headp = &tmp->varshead;
 	ast_mutex_init(&tmp->lock);
 	AST_LIST_HEAD_INIT_NOLOCK(headp);
@@ -1021,7 +1024,7 @@
 	AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
 		ast_mutex_lock(&spy->lock);
 		if ((spy->type == type) && (spy->status == CHANSPY_RUNNING)) {
-			spy->status = CHANSPY_DONE;
+			spy->status = CHANSPY_STOP;
 			if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
 				ast_cond_signal(&spy->trigger);
 		}
@@ -1912,11 +1915,11 @@
 
 			if (chan->monitor && chan->monitor->read_stream ) {
 #ifndef MONITOR_CONSTANT_DELAY
-				int jump = chan->outsmpl - chan->insmpl - 2 * f->samples;
+				int jump = chan->outsmpl - chan->insmpl - 4 * f->samples;
 				if (jump >= 0) {
 					if (ast_seekstream(chan->monitor->read_stream, jump + f->samples, SEEK_FORCECUR) == -1)
 						ast_log(LOG_WARNING, "Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
-					chan->insmpl += jump + 2 * f->samples;
+					chan->insmpl += jump + 4 * f->samples;
 				} else
 					chan->insmpl+= f->samples;
 #else
@@ -2273,11 +2276,11 @@
 				if( chan->monitor && chan->monitor->write_stream &&
 						f && ( f->frametype == AST_FRAME_VOICE ) ) {
 #ifndef MONITOR_CONSTANT_DELAY
-					int jump = chan->insmpl - chan->outsmpl - 2 * f->samples;
+					int jump = chan->insmpl - chan->outsmpl - 4 * f->samples;
 					if (jump >= 0) {
 						if (ast_seekstream(chan->monitor->write_stream, jump + f->samples, SEEK_FORCECUR) == -1)
 							ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
-						chan->outsmpl += jump + 2 * f->samples;
+						chan->outsmpl += jump + 4 * f->samples;
 					} else
 						chan->outsmpl += f->samples;
 #else
@@ -3216,7 +3219,8 @@
 }
 
 static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct ast_channel *c1,
-			      struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc, int toms)
+						 struct ast_bridge_config *config, struct ast_frame **fo,
+						 struct ast_channel **rc, struct timeval bridge_end)
 {
 	/* Copy voice back and forth between the two channels. */
 	struct ast_channel *cs[3];
@@ -3228,6 +3232,7 @@
 	int watch_c0_dtmf;
 	int watch_c1_dtmf;
 	void *pvt0, *pvt1;
+	int to;
 	
 	cs[0] = c0;
 	cs[1] = c1;
@@ -3246,12 +3251,13 @@
 			res = AST_BRIDGE_RETRY;
 			break;
 		}
-		who = ast_waitfor_n(cs, 2, &toms);
+		to = ast_tvdiff_ms(bridge_end, ast_tvnow());
+		if (to <= 0) {
+			res = AST_BRIDGE_RETRY;
+			break;
+		}
+		who = ast_waitfor_n(cs, 2, &to);
 		if (!who) {
-			if (!toms) {
-				res = AST_BRIDGE_RETRY;
-				break;
-			}
 			ast_log(LOG_DEBUG, "Nobody there, continuing...\n"); 
 			if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
 				if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
@@ -3420,10 +3426,13 @@
 			
 			if (!to) {
 				if (time_left_ms >= 5000) {
+					/* force the time left to round up if appropriate */
 					if (caller_warning && config->warning_sound && config->play_warning)
-						bridge_playfile(c0, c1, config->warning_sound, time_left_ms / 1000);
+						bridge_playfile(c0, c1, config->warning_sound,
+								(time_left_ms + 500) / 1000);
 					if (callee_warning && config->warning_sound && config->play_warning)
-						bridge_playfile(c1, c0, config->warning_sound, time_left_ms / 1000);
+						bridge_playfile(c1, c0, config->warning_sound,
+								(time_left_ms + 500) / 1000);
 				}
 				if (config->warning_freq) {
 					nexteventts = ast_tvadd(nexteventts, ast_samp2tv(config->warning_freq, 1000));
@@ -3524,7 +3533,7 @@
 			o0nativeformats = c0->nativeformats;
 			o1nativeformats = c1->nativeformats;
 		}
-		res = ast_generic_bridge(c0, c1, config, fo, rc, to);
+		res = ast_generic_bridge(c0, c1, config, fo, rc, nexteventts);
 		if (res != AST_BRIDGE_RETRY)
 			break;
 	}

Modified: team/oej/moduletest/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channels/chan_agent.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/channels/chan_agent.c (original)
+++ team/oej/moduletest/channels/chan_agent.c Mon Jan  9 07:44:44 2006
@@ -795,8 +795,11 @@
 				snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
 				ast_queue_log("NONE", ast->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "Autologoff");
 				set_agentbycallerid(p->logincallerid, NULL);
+				ast_device_state_changed("Agent/%s", p->agent);
 				p->loginchan[0] = '\0';
 				p->logincallerid[0] = '\0';
+				if (persistent_agents)
+					dump_agents();
 			}
 		} else if (p->dead) {
 			ast_mutex_lock(&p->chan->lock);

Modified: team/oej/moduletest/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channels/chan_iax2.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/channels/chan_iax2.c (original)
+++ team/oej/moduletest/channels/chan_iax2.c Mon Jan  9 07:44:44 2006
@@ -2599,7 +2599,7 @@
 				break;
 			} 
 		} else if (!strcasecmp(tmp->name, "regseconds")) {
-			if (sscanf(tmp->value, "%i", (int *)&regseconds) != 1)
+			if (sscanf(tmp->value, "%ld", (time_t *)&regseconds) != 1)
 				regseconds = 0;
 		} else if (!strcasecmp(tmp->name, "ipaddr")) {
 			inet_aton(tmp->value, &(peer->addr.sin_addr));

Modified: team/oej/moduletest/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channels/chan_sip.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/channels/chan_sip.c (original)
+++ team/oej/moduletest/channels/chan_sip.c Mon Jan  9 07:44:44 2006
@@ -4241,7 +4241,7 @@
 		" <media_control>\r\n"
 		"  <vc_primitive>\r\n"
 		"   <to_encoder>\r\n"
-		"    <picture_fast_update\r\n"
+		"    <picture_fast_update>\r\n"
 		"    </picture_fast_update>\r\n"
 		"   </to_encoder>\r\n"
 		"  </vc_primitive>\r\n"
@@ -6797,7 +6797,7 @@
 	return -1;
 }
 
-/*! \brief  check_via: check Via: headers ---*/
+/*! \brief check Via: header for hostname, port and rport request/answer */
 static int check_via(struct sip_pvt *p, struct sip_request *req)
 {
 	char via[256];
@@ -6807,9 +6807,16 @@
 	struct ast_hostent ahp;
 
 	ast_copy_string(via, get_header(req, "Via"), sizeof(via));
+
+	/* Check for rport */
+	c = strstr(via, ";rport");
+	if (c && (c[6] != '='))	/* rport query, not answer */
+		ast_set_flag(p, SIP_NAT_ROUTE);
+
 	c = strchr(via, ';');
 	if (c) 
 		*c = '\0';
+
 	c = strchr(via, ' ');
 	if (c) {
 		*c = '\0';
@@ -6830,9 +6837,7 @@
 		p->sa.sin_family = AF_INET;
 		memcpy(&p->sa.sin_addr, hp->h_addr, sizeof(p->sa.sin_addr));
 		p->sa.sin_port = htons(pt ? atoi(pt) : DEFAULT_SIP_PORT);
-		c = strstr(via, ";rport");
-		if (c && (c[6] != '='))	/* rport query, not answer */
-			ast_set_flag(p, SIP_NAT_ROUTE);
+
 		if (sip_debug_test_pvt(p)) {
 			c = (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE) ? "NAT" : "non-NAT";
 			ast_verbose("Sending to %s : %d (%s)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr), ntohs(p->sa.sin_port), c);
@@ -12069,7 +12074,7 @@
 		}
 
 		if (realtime && !strcasecmp(v->name, "regseconds")) {
-			if (sscanf(v->value, "%i", (int *)&regseconds) != 1)
+			if (sscanf(v->value, "%ld", (time_t *)&regseconds) != 1)
 				regseconds = 0;
 		} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
 			inet_aton(v->value, &(peer->addr.sin_addr));

Modified: team/oej/moduletest/formats/format_pcm.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/formats/format_pcm.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/formats/format_pcm.c (original)
+++ team/oej/moduletest/formats/format_pcm.c Mon Jan  9 07:44:44 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>
  *
@@ -44,6 +44,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/module.h"
 #include "asterisk/endian.h"
+#include "asterisk/ulaw.h"
 
 #define BUF_SIZE 160		/* 160 samples */
 
@@ -66,6 +67,8 @@
 static char *name = "pcm";
 static char *desc = "Raw uLaw 8khz Audio support (PCM)";
 static char *exts = "pcm|ulaw|ul|mu";
+
+static char ulaw_silence[BUF_SIZE];
 
 static struct ast_filestream *pcm_open(FILE *f)
 {
@@ -173,24 +176,46 @@
 
 static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence)
 {
-	off_t offset=0,min,cur,max;
-
-	min = 0;
+	long cur, max, offset = 0;
+
 	cur = ftell(fs->f);
 	fseek(fs->f, 0, SEEK_END);
 	max = ftell(fs->f);
-	if (whence == SEEK_SET)
+
+	switch (whence) {
+	case SEEK_SET:
 		offset = sample_offset;
-	else if (whence == SEEK_CUR || whence == SEEK_FORCECUR)
-		offset = sample_offset + cur;
-	else if (whence == SEEK_END)
+		break;
+	case SEEK_END:
 		offset = max - sample_offset;
-	if (whence != SEEK_FORCECUR) {
-		offset = (offset > max)?max:offset;
-	}
-	/* always protect against seeking past begining. */
-	offset = (offset < min)?min:offset;
-	return fseek(fs->f, offset, SEEK_SET);
+		break;
+	case SEEK_CUR:
+	case SEEK_FORCECUR:
+		offset = cur + sample_offset;
+		break;
+	}
+
+	switch (whence) {
+	case SEEK_FORCECUR:
+		if (offset > max) {
+			size_t left = offset - max;
+			size_t res;
+
+			while (left) {
+				res = fwrite(ulaw_silence, sizeof(ulaw_silence[0]),
+					     (left > BUF_SIZE) ? BUF_SIZE : left, fs->f);
+				if (res == -1)
+					return res;
+				left -= res * sizeof(ulaw_silence[0]);
+			}
+			return offset;
+		}
+		/* fall through */
+	default:
+		offset = (offset > max) ? max : offset;
+		offset = (offset < 0) ? 0 : offset;
+		return fseek(fs->f, offset, SEEK_SET);
+	}
 }
 
 static int pcm_trunc(struct ast_filestream *fs)
@@ -212,18 +237,21 @@
 
 int load_module()
 {
+	int index;
+
+	for (index = 0; index < (sizeof(ulaw_silence) / sizeof(ulaw_silence[0])); index++)
+		ulaw_silence[index] = AST_LIN2MU(0);
+
 	return ast_format_register(name, exts, AST_FORMAT_ULAW,
-								pcm_open,
-								pcm_rewrite,
-								pcm_write,
-								pcm_seek,
-								pcm_trunc,
-								pcm_tell,
-								pcm_read,
-								pcm_close,
-								pcm_getcomment);
-								
-								
+				   pcm_open,
+				   pcm_rewrite,
+				   pcm_write,
+				   pcm_seek,
+				   pcm_trunc,
+				   pcm_tell,
+				   pcm_read,
+				   pcm_close,
+				   pcm_getcomment);
 }
 
 int unload_module()

Modified: team/oej/moduletest/formats/format_pcm_alaw.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/formats/format_pcm_alaw.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/formats/format_pcm_alaw.c (original)
+++ team/oej/moduletest/formats/format_pcm_alaw.c Mon Jan  9 07:44:44 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>
  *
@@ -45,6 +45,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/module.h"
 #include "asterisk/endian.h"
+#include "asterisk/alaw.h"
 
 #define BUF_SIZE 160		/* 160 samples */
 
@@ -73,6 +74,8 @@
 static char *desc = "Raw aLaw 8khz PCM Audio support";
 static char *exts = "alaw|al";
 
+static char alaw_silence[BUF_SIZE];
+
 
 #if 0
 /* Returns time in msec since system boot. */
@@ -248,24 +251,46 @@
 
 static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence)
 {
-	off_t offset=0,min,cur,max;
-
-	min = 0;
+	long cur, max, offset = 0;
+
 	cur = ftell(fs->f);
 	fseek(fs->f, 0, SEEK_END);
 	max = ftell(fs->f);
-	if (whence == SEEK_SET)
+
+	switch (whence) {
+	case SEEK_SET:
 		offset = sample_offset;
-	else if (whence == SEEK_CUR || whence == SEEK_FORCECUR)
-		offset = sample_offset + cur;
-	else if (whence == SEEK_END)
+		break;
+	case SEEK_END:
 		offset = max - sample_offset;
-	if (whence != SEEK_FORCECUR) {
-		offset = (offset > max)?max:offset;
-	}
-	/* Always protect against seeking past begining */
-	offset = (offset < min)?min:offset;
-	return fseek(fs->f, offset, SEEK_SET);
+		break;
+	case SEEK_CUR:
+	case SEEK_FORCECUR:
+		offset = cur + sample_offset;
+		break;
+	}
+
+	switch (whence) {
+	case SEEK_FORCECUR:
+		if (offset > max) {
+			size_t left = offset - max;
+			size_t res;
+
+			while (left) {
+				res = fwrite(alaw_silence, sizeof(alaw_silence[0]),
+					     (left > BUF_SIZE) ? BUF_SIZE : left, fs->f);
+				if (res == -1)
+					return res;
+				left -= res * sizeof(alaw_silence[0]);
+			}
+			return offset;
+		}
+		/* fall through */
+	default:
+		offset = (offset > max) ? max : offset;
+		offset = (offset < 0) ? 0 : offset;
+		return fseek(fs->f, offset, SEEK_SET);
+	}
 }
 
 static int pcm_trunc(struct ast_filestream *fs)
@@ -288,16 +313,21 @@
 
 int load_module()
 {
+	int index;
+
+	for (index = 0; index < (sizeof(alaw_silence) / sizeof(alaw_silence[0])); index++)
+		alaw_silence[index] = AST_LIN2A(0);
+
 	return ast_format_register(name, exts, AST_FORMAT_ALAW,
-								pcm_open,
-								pcm_rewrite,
-								pcm_write,
-								pcm_seek,
-								pcm_trunc,
-								pcm_tell,
-								pcm_read,
-								pcm_close,
-								pcm_getcomment);
+				   pcm_open,
+				   pcm_rewrite,
+				   pcm_write,
+				   pcm_seek,
+				   pcm_trunc,
+				   pcm_tell,
+				   pcm_read,
+				   pcm_close,
+				   pcm_getcomment);
 }
 
 int unload_module()

Modified: team/oej/moduletest/funcs/func_moh.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/funcs/func_moh.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/funcs/func_moh.c (original)
+++ team/oej/moduletest/funcs/func_moh.c Mon Jan  9 07:44:44 2006
@@ -39,7 +39,7 @@
 
 static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value) 
 {
-	ast_copy_string(chan->musicclass, value, MAX_MUSICCLASS);
+	ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass));
 }
 
 #ifndef BUILTIN_FUNC

Modified: team/oej/moduletest/include/asterisk/chanspy.h
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/include/asterisk/chanspy.h?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/include/asterisk/chanspy.h (original)
+++ team/oej/moduletest/include/asterisk/chanspy.h Mon Jan  9 07:44:44 2006
@@ -30,9 +30,10 @@
 #include "asterisk/linkedlists.h"
 
 enum chanspy_states {
-	CHANSPY_NEW = 0,
-	CHANSPY_RUNNING = 1,
-	CHANSPY_DONE = 2,
+	CHANSPY_NEW = 0,		/*!< spy not yet operating */
+	CHANSPY_RUNNING = 1,		/*!< normal operation, spy is still operating */
+	CHANSPY_DONE = 2,		/*!< spy is stopped and already removed from channel */
+	CHANSPY_STOP = 3,		/*!< spy requested to stop, still attached to channel */
 };
 
 enum chanspy_flags {

Modified: team/oej/moduletest/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/include/asterisk/strings.h?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/include/asterisk/strings.h (original)
+++ team/oej/moduletest/include/asterisk/strings.h Mon Jan  9 07:44:44 2006
@@ -54,7 +54,7 @@
   \brief Trims trailing whitespace characters from a string.
   \param ast_trim_blanks function being used
   \param str the input string
-  \return a pointer to the NULL following the string
+  \return a pointer to the modified string
  */
 AST_INLINE_API(
 char *ast_trim_blanks(char *str),

Modified: team/oej/moduletest/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/manager.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/manager.c (original)
+++ team/oej/moduletest/manager.c Mon Jan  9 07:44:44 2006
@@ -1626,7 +1626,6 @@
 	cur = malloc(sizeof(struct manager_action));
 	if (!cur) {
 		ast_log(LOG_WARNING, "Manager: out of memory trying to register action\n");
-		ast_mutex_unlock(&actionlock);
 		return -1;
 	}
 	cur->action = action;

Modified: team/oej/moduletest/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/pbx/pbx_config.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/pbx/pbx_config.c (original)
+++ team/oej/moduletest/pbx/pbx_config.c Mon Jan  9 07:44:44 2006
@@ -712,7 +712,7 @@
 	if (argc != 5) return RESULT_SHOWUSAGE;
 
 	/* third arg must be 'in' ... */
-	if (strcmp(argv[3], "in")) return RESULT_SHOWUSAGE;
+	if (strcmp(argv[3], "in") && strcmp(argv[3], "into")) return RESULT_SHOWUSAGE;
 
 	if (ast_context_add_include(argv[4], argv[2], registrar)) {
 		switch (errno) {
@@ -724,7 +724,7 @@
 
 			case EEXIST:
 				ast_cli(fd, "Context '%s' already included in '%s' context\n",
-					argv[1], argv[3]); break;
+					argv[2], argv[4]); break;
 
 			case ENOENT:
 			case EINVAL:
@@ -733,14 +733,14 @@
 
 			default:
 				ast_cli(fd, "Failed to include '%s' in '%s' context\n",
-					argv[1], argv[3]); break;
+					argv[2], argv[4]); break;
 		}
 		return RESULT_FAILURE;
 	}
 
 	/* show some info ... */
 	ast_cli(fd, "Context '%s' included in '%s' context\n",
-		argv[2], argv[3]);
+		argv[2], argv[4]);
 
 	return RESULT_SUCCESS;
 }

Modified: team/oej/moduletest/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/pbx/pbx_spool.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/pbx/pbx_spool.c (original)
+++ team/oej/moduletest/pbx/pbx_spool.c Mon Jan  9 07:44:44 2006
@@ -288,10 +288,11 @@
 {
 	pthread_t t;
 	pthread_attr_t attr;
+	int ret;
 	pthread_attr_init(&attr);
  	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-	if (ast_pthread_create(&t,&attr,attempt_thread, o) == -1) {
-		ast_log(LOG_WARNING, "Unable to create thread :(\n");
+	if ((ret = ast_pthread_create(&t,&attr,attempt_thread, o)) != 0) {
+		ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
 		free_outgoing(o);
 	}
 }
@@ -412,6 +413,7 @@
 {
 	pthread_t thread;
 	pthread_attr_t attr;
+	int ret;
 	snprintf(qdir, sizeof(qdir), "%s/%s", ast_config_AST_SPOOL_DIR, "outgoing");
 	if (mkdir(qdir, 0700) && (errno != EEXIST)) {
 		ast_log(LOG_WARNING, "Unable to create queue directory %s -- outgoing spool disabled\n", qdir);
@@ -419,8 +421,8 @@
 	}
 	pthread_attr_init(&attr);
  	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-	if (ast_pthread_create(&thread,&attr,scan_thread, NULL) == -1) {
-		ast_log(LOG_WARNING, "Unable to create thread :(\n");
+	if ((ret = ast_pthread_create(&thread,&attr,scan_thread, NULL)) != 0) {
+		ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
 		return -1;
 	}
 	return 0;

Modified: team/oej/moduletest/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/res/res_features.c?rev=7880&r1=7879&r2=7880&view=diff
==============================================================================
--- team/oej/moduletest/res/res_features.c (original)
+++ team/oej/moduletest/res/res_features.c Mon Jan  9 07:44:44 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>
  *
@@ -357,7 +357,7 @@
 		"From: %s\r\n"
 		"Timeout: %ld\r\n"
 		"CallerID: %s\r\n"
-		"CallerIDName: %s\r\n\r\n"
+		"CallerIDName: %s\r\n"
 		,pu->parkingnum, pu->chan->name, peer->name
 		,(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL)
 		,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
@@ -943,13 +943,15 @@
 	
 	app = pbx_findapp(feature->app);
 	if (app) {
-		struct ast_channel *work=chan;
-		if (ast_test_flag(feature,AST_FEATURE_FLAG_CALLEE)) work=peer;
+		struct ast_channel *work = chan;
+		if (ast_test_flag(feature, AST_FEATURE_FLAG_CALLEE))
+			work = peer;
 		res = pbx_exec(work, app, feature->app_args, 1);
-		if (res<0) return res; 
+		if (res < 0)
+			return res; 
 	} else {
 		ast_log(LOG_WARNING, "Could not find application (%s)\n", feature->app);
-		res = -2;
+		return -2;
 	}
 	
 	return FEATURE_RETURN_SUCCESS;
@@ -1543,7 +1545,7 @@
 					"Exten: %d\r\n"
 					"Channel: %s\r\n"
 					"CallerID: %s\r\n"
-					"CallerIDName: %s\r\n\r\n"
+					"CallerIDName: %s\r\n"
 					,pu->parkingnum, pu->chan->name
 					,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
 					,(pu->chan->cid.cid_name ? pu->chan->cid.cid_name : "<unknown>")
@@ -1582,12 +1584,13 @@
 						/* See if they need servicing */
 						f = ast_read(pu->chan);
 						if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass ==  AST_CONTROL_HANGUP))) {
-
+							if (f)
+								ast_frfree(f);
 							manager_event(EVENT_FLAG_CALL, "ParkedCallGiveUp",
 								"Exten: %d\r\n"
 								"Channel: %s\r\n"
 								"CallerID: %s\r\n"
-								"CallerIDName: %s\r\n\r\n"
+								"CallerIDName: %s\r\n"
 								,pu->parkingnum, pu->chan->name
 								,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
 								,(pu->chan->cid.cid_name ? pu->chan->cid.cid_name : "<unknown>")
@@ -1724,7 +1727,7 @@
 			"Channel: %s\r\n"
 			"From: %s\r\n"
 			"CallerID: %s\r\n"
-			"CallerIDName: %s\r\n\r\n"
+			"CallerIDName: %s\r\n"
 			,pu->parkingnum, pu->chan->name, chan->name
 			,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
 			,(pu->chan->cid.cid_name ? pu->chan->cid.cid_name : "<unknown>")



More information about the svn-commits mailing list