[asterisk-commits] branch oej/moduletest - r8303 in /team/oej/moduletest: ./ apps/ channels/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 15:49:49 MST 2006


Author: oej
Date: Thu Jan 19 16:49:43 2006
New Revision: 8303

URL: http://svn.digium.com/view/asterisk?rev=8303&view=rev
Log:
Merged revisions 8122,8124,8134,8140,8162,8173,8194,8232,8242,8276,8281 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r8122 | kpfleming | 2006-01-17 14:11:55 +0100 (Tue, 17 Jan 2006) | 2 lines

update CLI copyright notice

........
r8124 | mogorman | 2006-01-17 17:55:30 +0100 (Tue, 17 Jan 2006) | 3 lines

Fixed code ordering of logger_init and queue_log_init
bug 6263

........
r8134 | mattf | 2006-01-17 19:29:57 +0100 (Tue, 17 Jan 2006) | 2 lines

Backport of fix for #6094

........
r8140 | mogorman | 2006-01-17 21:10:29 +0100 (Tue, 17 Jan 2006) | 3 lines

Stop any generators running on a channel when
festival is called as described in 5996

........
r8162 | mogorman | 2006-01-18 01:47:04 +0100 (Wed, 18 Jan 2006) | 4 lines

Changed order of autoload so that pbx_ comes before
channels, and in doing so cause bug 6002 to not
be an issue

........
r8173 | russell | 2006-01-18 03:49:21 +0100 (Wed, 18 Jan 2006) | 2 lines

remove ChangeLog from the 1.2 branch.  It will only be present in the tags.

........
r8194 | mogorman | 2006-01-18 22:02:06 +0100 (Wed, 18 Jan 2006) | 3 lines

Solves issue with the login proccess in meetme
patch from 6136

........
r8232 | russell | 2006-01-19 05:17:45 +0100 (Thu, 19 Jan 2006) | 3 lines

fix a seg fault due to assuming that space gets allocatted on the stack in the
same order that we declare the variables (issue #6290)

........
r8242 | russell | 2006-01-19 05:56:48 +0100 (Thu, 19 Jan 2006) | 3 lines

fix Message-Account header to use the ip address if the fromdomain 
isn't set (issue #6278)

........
r8276 | tilghman | 2006-01-19 20:14:37 +0100 (Thu, 19 Jan 2006) | 2 lines

Bug 6072 - Memory leaks in the expression parser

........
r8281 | oej | 2006-01-19 20:40:28 +0100 (Thu, 19 Jan 2006) | 2 lines

Enable "musicclass" setting for sip peers as per the config sample.

........

Removed:
    team/oej/moduletest/ChangeLog
Modified:
    team/oej/moduletest/   (props changed)
    team/oej/moduletest/apps/app_festival.c
    team/oej/moduletest/apps/app_meetme.c
    team/oej/moduletest/apps/app_milliwatt.c
    team/oej/moduletest/ast_expr2.fl
    team/oej/moduletest/ast_expr2.y
    team/oej/moduletest/asterisk.c
    team/oej/moduletest/channels/chan_sip.c
    team/oej/moduletest/loader.c
    team/oej/moduletest/logger.c
    team/oej/moduletest/res/res_features.c

Propchange: team/oej/moduletest/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 19 16:49:43 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7496,7498-8117
+/branches/1.2:1-7496,7498-8301

Modified: team/oej/moduletest/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_festival.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_festival.c (original)
+++ team/oej/moduletest/apps/app_festival.c Thu Jan 19 16:49:43 2006
@@ -175,7 +175,8 @@
 	if (chan->_state != AST_STATE_UP)
 		ast_answer(chan);
 	ast_stopstream(chan);
-
+	ast_indicate(chan, -1);
+	
 	owriteformat = chan->writeformat;
 	res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
 	if (res < 0) {

Modified: team/oej/moduletest/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_meetme.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_meetme.c (original)
+++ team/oej/moduletest/apps/app_meetme.c Thu Jan 19 16:49:43 2006
@@ -1737,7 +1737,8 @@
 			if (dynamic_pin) {
 				if (dynamic_pin[0] == 'q') {
 					/* Query the user to enter a PIN */
-					ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0);
+					if (ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0) < 0)
+						return NULL;
 				}
 				cnf = build_conf(confno, dynamic_pin, "", make, dynamic);
 			} else {

Modified: team/oej/moduletest/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/apps/app_milliwatt.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/apps/app_milliwatt.c (original)
+++ team/oej/moduletest/apps/app_milliwatt.c Thu Jan 19 16:49:43 2006
@@ -73,30 +73,29 @@
 static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
 {
 	struct ast_frame wf;
-	unsigned char waste[AST_FRIENDLY_OFFSET];
-	unsigned char buf[640];
+	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
 	int i,*indexp = (int *) data;
 
-	if (len > sizeof(buf))
+	if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
 	{
-		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
-		len = sizeof(buf);
+		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
+		len = sizeof(buf) - AST_FRIENDLY_OFFSET;
 	}
-	waste[0] = 0; /* make compiler happy */
 	wf.frametype = AST_FRAME_VOICE;
 	wf.subclass = AST_FORMAT_ULAW;
 	wf.offset = AST_FRIENDLY_OFFSET;
 	wf.mallocd = 0;
-	wf.data = buf;
+	wf.data = buf + AST_FRIENDLY_OFFSET;
 	wf.datalen = len;
 	wf.samples = wf.datalen;
 	wf.src = "app_milliwatt";
 	wf.delivery.tv_sec = 0;
 	wf.delivery.tv_usec = 0;
+	wf.prev = wf.next = NULL;
 	/* create a buffer containing the digital milliwatt pattern */
 	for(i = 0; i < len; i++)
 	{
-		buf[i] = digital_milliwatt[(*indexp)++];
+		buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
 		*indexp &= 7;
 	}
 	if (ast_write(chan,&wf) < 0)

Modified: team/oej/moduletest/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/ast_expr2.fl?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/ast_expr2.fl (original)
+++ team/oej/moduletest/ast_expr2.fl Thu Jan 19 16:49:43 2006
@@ -1,4 +1,9 @@
 %{
+/*! \file
+ *
+ * \brief Dialplan Expression Parser
+ */
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,7 +49,7 @@
  
 void ast_yyset_column(int column_no, yyscan_t yyscanner);
 int ast_yyget_column(yyscan_t yyscanner);
-
+static int curlycount = 0;
 %}
 
 %option prefix="ast_yy"
@@ -54,6 +59,7 @@
 %option bison-bridge
 %option bison-locations
 %option noyywrap
+%x var trail
 
 %%
 
@@ -75,6 +81,8 @@
 \:\:	{ SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
 \(	{ SET_COLUMNS; SET_STRING; return TOK_LP;}
 \)	{ SET_COLUMNS; SET_STRING; return TOK_RP;}
+\$\{   {/* gather the contents of ${} expressions, with trailing stuff, into a single TOKEN. They are much more complex now than they used to be */
+                       curlycount = 0; BEGIN(var); yymore();}
 
 [ 	\r]		{}
 \"[^"]*\"   {SET_COLUMNS; SET_STRING; return TOKEN;}
@@ -83,7 +91,14 @@
 [0-9]+		{   SET_COLUMNS;  /* the original behavior of the expression parser was to bring in numbers as a numeric string */
 				SET_NUMERIC_STRING;
 				return TOKEN;}
-[a-zA-Z0-9,.';{}\\_^%$#@!]+	{SET_COLUMNS; SET_STRING; return TOKEN;}
+[a-zA-Z0-9,.';\\_^%$#@!]+	{SET_COLUMNS; SET_STRING; return TOKEN;}
+
+<var>[^{}]*\}  {curlycount--; if(curlycount < 0){ BEGIN(trail);  yymore();} else {  yymore();}}
+<var>[^{}]*\{  {curlycount++; yymore();  }
+<trail>[^-\t\r \n$():?%/+=*<>!|&]* {BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN;}
+<trail>[-\t\r \n$():?%/+=*<>!|&]        {char c = yytext[yyleng-1]; BEGIN(0); unput(c); SET_COLUMNS; SET_STRING; return TOKEN;}
+<trail>\$\{            {curlycount = 0; BEGIN(var); yymore();  }
+<trail><<EOF>>		{BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN; /* actually, if an expr is only a variable ref, this could happen a LOT */}
 
 %%
 
@@ -130,6 +145,7 @@
 			ast_copy_string(buf, io.val->u.s, length);
 #endif /* STANDALONE */
 			return_value = strlen(buf);
+			free(io.val->u.s);
 		}
 		free(io.val);
 	}
@@ -144,15 +160,6 @@
 	int i=0;
 	spacebuf[0] = 0;
 	
-#ifdef WHEN_LOC_MEANS_SOMETHING
-	if( loc->first_column > 7990 ) /* if things get out of whack, why crash? */
-		loc->first_column = 7990;
-	if( loc->last_column > 7990 )
-		loc->last_column = 7990;
-	for(i=0;i<loc->first_column;i++) spacebuf[i] = ' ';
-	for(   ;i<loc->last_column;i++) spacebuf[i] = '^';
-	spacebuf[i] = 0;
-#endif
 	for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,
 													which is the same thing as... get this:
 													yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column

Modified: team/oej/moduletest/ast_expr2.y
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/ast_expr2.y?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/ast_expr2.y (original)
+++ team/oej/moduletest/ast_expr2.y Thu Jan 19 16:49:43 2006
@@ -124,7 +124,12 @@
    some useful info about the error. Not as easy as it looks, but it
    is possible. */
 #define ast_yyerror(x) ast_yyerror(x,&yyloc,parseio)
-
+#define DESTROY(x) { \
+if ((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) \
+	free((x)->u.s); \
+	(x)->u.s = 0; \
+	free(x); \
+}
 %}
  
 %pure-parser
@@ -158,69 +163,91 @@
 %%
 
 start: expr { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
-              ((struct parse_io *)parseio)->val->type = $$->type;
-              if( $$->type == AST_EXPR_integer )
-		((struct parse_io *)parseio)->val->u.i = $$->u.i;
+              ((struct parse_io *)parseio)->val->type = $1->type;
+              if( $1->type == AST_EXPR_integer )
+				  ((struct parse_io *)parseio)->val->u.i = $1->u.i;
               else
-                ((struct parse_io *)parseio)->val->u.s = $$->u.s; }
+				  ((struct parse_io *)parseio)->val->u.s = $1->u.s; 
+			  free($1);
+			}
 	;
 
 expr:	TOKEN   { $$= $1;}
 	| TOK_LP expr TOK_RP { $$ = $2; 
 	                       @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
-						   @$.first_line=0; @$.last_line=0;}
+						   @$.first_line=0; @$.last_line=0;
+							DESTROY($1); DESTROY($3); }
 	| expr TOK_OR expr { $$ = op_or ($1, $3);
+						DESTROY($2);	
                          @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						 @$.first_line=0; @$.last_line=0;}
 	| expr TOK_AND expr { $$ = op_and ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
                           @$.first_line=0; @$.last_line=0;}
 	| expr TOK_EQ expr { $$ = op_eq ($1, $3);
+						DESTROY($2);	
 	                     @$.first_column = @1.first_column; @$.last_column = @3.last_column;
 						 @$.first_line=0; @$.last_line=0;}
 	| expr TOK_GT expr { $$ = op_gt ($1, $3);
+						DESTROY($2);	
                          @$.first_column = @1.first_column; @$.last_column = @3.last_column;
 						 @$.first_line=0; @$.last_line=0;}
 	| expr TOK_LT expr { $$ = op_lt ($1, $3); 
+						DESTROY($2);	
 	                     @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						 @$.first_line=0; @$.last_line=0;}
 	| expr TOK_GE expr  { $$ = op_ge ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						  @$.first_line=0; @$.last_line=0;}
 	| expr TOK_LE expr  { $$ = op_le ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						  @$.first_line=0; @$.last_line=0;}
 	| expr TOK_NE expr  { $$ = op_ne ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						  @$.first_line=0; @$.last_line=0;}
 	| expr TOK_PLUS expr { $$ = op_plus ($1, $3); 
+						DESTROY($2);	
 	                       @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						   @$.first_line=0; @$.last_line=0;}
 	| expr TOK_MINUS expr { $$ = op_minus ($1, $3); 
+						DESTROY($2);	
 	                        @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	| TOK_MINUS expr %prec TOK_COMPL { $$ = op_negate ($2); 
+						DESTROY($1);	
 	                        @$.first_column = @1.first_column; @$.last_column = @2.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	| TOK_COMPL expr   { $$ = op_compl ($2); 
+						DESTROY($1);	
 	                        @$.first_column = @1.first_column; @$.last_column = @2.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	| expr TOK_MULT expr { $$ = op_times ($1, $3); 
+						DESTROY($2);	
 	                       @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						   @$.first_line=0; @$.last_line=0;}
 	| expr TOK_DIV expr { $$ = op_div ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						  @$.first_line=0; @$.last_line=0;}
 	| expr TOK_MOD expr { $$ = op_rem ($1, $3); 
+						DESTROY($2);	
 	                      @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 						  @$.first_line=0; @$.last_line=0;}
 	| expr TOK_COLON expr { $$ = op_colon ($1, $3); 
+						DESTROY($2);	
 	                        @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	| expr TOK_EQTILDE expr { $$ = op_eqtilde ($1, $3); 
+						DESTROY($2);	
 	                        @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	| expr TOK_COND expr TOK_COLONCOLON expr  { $$ = op_cond ($1, $3, $5); 
+						DESTROY($2);	
+						DESTROY($4);	
 	                        @$.first_column = @1.first_column; @$.last_column = @3.last_column; 
 							@$.first_line=0; @$.last_line=0;}
 	;
@@ -281,6 +308,7 @@
 	}
 	if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
 		free (vp->u.s);	
+	free(vp);
 }
 
 

Modified: team/oej/moduletest/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/asterisk.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/asterisk.c (original)
+++ team/oej/moduletest/asterisk.c Thu Jan 19 16:49:43 2006
@@ -130,7 +130,7 @@
 
 /*! \brief Welcome message when starting a CLI interface */
 #define WELCOME_MESSAGE \
-	ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2005 Digium, Inc. and others.\n"); \
+	ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2006 Digium, Inc. and others.\n"); \
 	ast_verbose("Created by Mark Spencer <markster at digium.com>\n"); \
 	ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'show warranty' for details.\n"); \
 	ast_verbose("This is free software, with components licensed under the GNU General Public\n"); \

Modified: team/oej/moduletest/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channels/chan_sip.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/channels/chan_sip.c (original)
+++ team/oej/moduletest/channels/chan_sip.c Thu Jan 19 16:49:43 2006
@@ -5114,13 +5114,14 @@
 	char tmp[500];
 	char *t = tmp;
 	size_t maxbytes = sizeof(tmp);
+	char iabuf[INET_ADDRSTRLEN];
 
 	initreqprep(&req, p, SIP_NOTIFY);
 	add_header(&req, "Event", "message-summary");
 	add_header(&req, "Content-Type", default_notifymime);
 
 	ast_build_string(&t, &maxbytes, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
-	ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, p->fromdomain);
+	ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain);
 	ast_build_string(&t, &maxbytes, "Voice-Message: %d/%d (0/0)\r\n", newmsgs, oldmsgs);
 
 	if (t > tmp + sizeof(tmp))
@@ -12174,7 +12175,7 @@
 			}
 		} else if (!strcasecmp(v->name, "accountcode")) {
 			ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
-		} else if (!strcasecmp(v->name, "musiconhold")) {
+		} else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(peer->musicclass, v->value, sizeof(peer->musicclass));
 		} else if (!strcasecmp(v->name, "mailbox")) {
 			ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));

Modified: team/oej/moduletest/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/loader.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/loader.c (original)
+++ team/oej/moduletest/loader.c Thu Jan 19 16:49:43 2006
@@ -509,8 +509,8 @@
 static const char *loadorder[] =
 {
 	"res_",
+	"pbx_",
 	"chan_",
-	"pbx_",
 	NULL,
 };
 

Modified: team/oej/moduletest/logger.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/logger.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/logger.c (original)
+++ team/oej/moduletest/logger.c Thu Jan 19 16:49:43 2006
@@ -461,8 +461,8 @@
 
 	filesize_reload_needed = 0;
 
+	init_logger_chain();
 	queue_log_init();
-	init_logger_chain();
 
 	if (logfiles.event_log) {
 		if (eventlog) {
@@ -589,11 +589,11 @@
 	ast_cli_register(&rotate_logger_cli);
 	ast_cli_register(&logger_show_channels_cli);
 
+	/* create log channels */
+	init_logger_chain();
+
 	/* initialize queue logger */
 	queue_log_init();
-
-	/* create log channels */
-	init_logger_chain();
 
 	/* create the eventlog */
 	if (logfiles.event_log) {

Modified: team/oej/moduletest/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/res/res_features.c?rev=8303&r1=8302&r2=8303&view=diff
==============================================================================
--- team/oej/moduletest/res/res_features.c (original)
+++ team/oej/moduletest/res/res_features.c Thu Jan 19 16:49:43 2006
@@ -1282,17 +1282,11 @@
 			if (!(monitor_app = pbx_findapp("Monitor")))
 				monitor_ok=0;
 		}
-		if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR"))) 
-			src = chan;
-		else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR")))
-			src = peer;
-		if (src) {
-			char *tmp = ast_strdupa(monitor_exec);
-			if (tmp) {
-				pbx_exec(src, monitor_app, tmp, 1);
-			} else {
-				ast_log(LOG_ERROR, "Monitor failed: out of memory\n");
-			}
+		if (monitor_app) {
+			if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR"))) 
+				pbx_exec(chan, monitor_app, monitor_exec, 1);
+			else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR")))
+				pbx_exec(peer, monitor_app, monitor_exec, 1);
 		}
 	}
 	



More information about the asterisk-commits mailing list