[svn-commits] branch murf/bug_6264-1.2 - r8419 in /team/murf/bug_6264-1.2: ./ apps/ channels/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Jan 21 19:06:11 MST 2006


Author: murf
Date: Sat Jan 21 20:06:08 2006
New Revision: 8419

URL: http://svn.digium.com/view/asterisk?rev=8419&view=rev
Log:
Merged revisions 8232,8242,8276,8281,8320,8347,8394,8412,8414 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r8232 | russell | 2006-01-18 21:17:45 -0700 (Wed, 18 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-18 21:56:48 -0700 (Wed, 18 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 12:14:37 -0700 (Thu, 19 Jan 2006) | 2 lines

Bug 6072 - Memory leaks in the expression parser

........
r8281 | oej | 2006-01-19 12:40:28 -0700 (Thu, 19 Jan 2006) | 2 lines

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

........
r8320 | mogorman | 2006-01-19 18:00:46 -0700 (Thu, 19 Jan 2006) | 3 lines

solved problem with delayreject and iax trunking
bug 4291

........
r8347 | russell | 2006-01-20 11:34:42 -0700 (Fri, 20 Jan 2006) | 2 lines

fix invalid value of prev_q (issue #6302)

........
r8394 | tilghman | 2006-01-21 11:29:39 -0700 (Sat, 21 Jan 2006) | 2 lines

Bug 5936 - AddQueueMember fails on realtime queue, if queue not yet loaded

........
r8412 | russell | 2006-01-21 16:17:06 -0700 (Sat, 21 Jan 2006) | 2 lines

prevent the possibility of writing outside of the available workspace (issue #6271)

........
r8414 | russell | 2006-01-21 16:43:14 -0700 (Sat, 21 Jan 2006) | 2 lines

temporarily revert substring fix pending the result of the discussion in issue #6271

........

Modified:
    team/murf/bug_6264-1.2/   (props changed)
    team/murf/bug_6264-1.2/apps/app_milliwatt.c
    team/murf/bug_6264-1.2/apps/app_queue.c
    team/murf/bug_6264-1.2/ast_expr2.fl
    team/murf/bug_6264-1.2/ast_expr2.y
    team/murf/bug_6264-1.2/channels/chan_iax2.c
    team/murf/bug_6264-1.2/channels/chan_sip.c

Propchange: team/murf/bug_6264-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Jan 21 20:06:08 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-8226
+/branches/1.2:1-8417

Modified: team/murf/bug_6264-1.2/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/apps/app_milliwatt.c?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/apps/app_milliwatt.c (original)
+++ team/murf/bug_6264-1.2/apps/app_milliwatt.c Sat Jan 21 20:06:08 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/murf/bug_6264-1.2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/apps/app_queue.c?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/apps/app_queue.c (original)
+++ team/murf/bug_6264-1.2/apps/app_queue.c Sat Jan 21 20:06:08 2006
@@ -758,25 +758,21 @@
 
 /*!\brief Reload a single queue via realtime.
    \return Return the queue, or NULL if it doesn't exist.
-   \note Should be called with the global qlock locked.
-   When found, the queue is returned with q->lock locked. */
-static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
+   \note Should be called with the global qlock locked. */
+static struct ast_call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
 {
 	struct ast_variable *v;
-	struct ast_call_queue *q, *prev_q;
+	struct ast_call_queue *q, *prev_q = NULL;
 	struct member *m, *prev_m, *next_m;
 	char *interface;
 	char *tmp, *tmp_name;
 	char tmpbuf[64];	/* Must be longer than the longest queue param name. */
 
 	/* Find the queue in the in-core list (we will create a new one if not found). */
-	q = queues;
-	prev_q = NULL;
-	while (q) {
+	for (q = queues; q; q = q->next) {
 		if (!strcasecmp(q->name, queuename)) {
 			break;
 		}
-		q = q->next;
 		prev_q = q;
 	}
 
@@ -788,6 +784,7 @@
 				ast_mutex_unlock(&q->lock);
 				return NULL;
 			} else {
+				ast_mutex_unlock(&q->lock);
 				return q;
 			}
 		}
@@ -882,13 +879,60 @@
 		m = next_m;
 	}
 
+	ast_mutex_unlock(&q->lock);
+
 	return q;
 }
 
-static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+static struct ast_call_queue *load_realtime_queue(char *queuename)
 {
 	struct ast_variable *queue_vars = NULL;
 	struct ast_config *member_config = NULL;
+	struct ast_call_queue *q;
+
+	/* Find the queue in the in-core list first. */
+	ast_mutex_lock(&qlock);
+	for (q = queues; q; q = q->next) {
+		if (!strcasecmp(q->name, queuename)) {
+			break;
+		}
+	}
+	ast_mutex_unlock(&qlock);
+
+	if (!q) {
+		/*! \note Load from realtime before taking the global qlock, to avoid blocking all
+		   queue operations while waiting for the DB.
+
+		   This will be two separate database transactions, so we might
+		   see queue parameters as they were before another process
+		   changed the queue and member list as it was after the change.
+		   Thus we might see an empty member list when a queue is
+		   deleted. In practise, this is unlikely to cause a problem. */
+
+		queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
+		if (queue_vars) {
+			member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
+			if (!member_config) {
+				ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
+				return NULL;
+			}
+		}
+
+		ast_mutex_lock(&qlock);
+
+		q = find_queue_by_name_rt(queuename, queue_vars, member_config);
+		if (member_config)
+			ast_config_destroy(member_config);
+		if (queue_vars)
+			ast_variables_destroy(queue_vars);
+
+		ast_mutex_unlock(&qlock);
+	}
+	return q;
+}
+
+static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+{
 	struct ast_call_queue *q;
 	struct queue_ent *cur, *prev = NULL;
 	int res = -1;
@@ -896,35 +940,12 @@
 	int inserted = 0;
 	enum queue_member_status stat;
 
-	/*! \note Load from realtime before taking the global qlock, to avoid blocking all
-	   queue operations while waiting for the DB.
-
-	   This will be two separate database transactions, so we might
-	   see queue parameters as they were before another process
-	   changed the queue and member list as it was after the change.
-	   Thus we might see an empty member list when a queue is
-	   deleted. In practise, this is unlikely to cause a problem. */
-	queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
-	if (queue_vars) {
-		member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
-		if (!member_config) {
-			ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
-			return res;
-		}
-	}
+	q = load_realtime_queue(queuename);
+	if (!q)
+		return res;
 
 	ast_mutex_lock(&qlock);
-	q = reload_queue_rt(queuename, queue_vars, member_config);
-	/* Note: If found, reload_queue_rt() returns with q->lock locked. */
-	if(member_config)
-		ast_config_destroy(member_config);
-	if(queue_vars)
-		ast_variables_destroy(queue_vars);
-
-	if (!q) {
-		ast_mutex_unlock(&qlock);
-		return res;
-	}
+	ast_mutex_lock(&q->lock);
 
 	/* This is our one */
 	stat = get_member_status(q);
@@ -2405,41 +2426,42 @@
 	struct member *new_member;
 	int res = RES_NOSUCHQUEUE;
 
+	/* \note Ensure the appropriate realtime queue is loaded.  Note that this
+	 * short-circuits if the queue is already in memory. */
+	q = load_realtime_queue(queuename);
+
 	ast_mutex_lock(&qlock);
-	for (q = queues ; q ; q = q->next) {
+
+	if (q) {
 		ast_mutex_lock(&q->lock);
-		if (!strcmp(q->name, queuename)) {
-			if (interface_exists(q, interface) == NULL) {
-				new_member = create_queue_member(interface, penalty, paused);
-
-				if (new_member != NULL) {
-					new_member->dynamic = 1;
-					new_member->next = q->members;
-					q->members = new_member;
-					manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
-						"Queue: %s\r\n"
-						"Location: %s\r\n"
-						"Membership: %s\r\n"
-						"Penalty: %d\r\n"
-						"CallsTaken: %d\r\n"
-						"LastCall: %d\r\n"
-						"Status: %d\r\n"
-						"Paused: %d\r\n",
-					q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
-					new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+		if (interface_exists(q, interface) == NULL) {
+			new_member = create_queue_member(interface, penalty, paused);
+
+			if (new_member != NULL) {
+				new_member->dynamic = 1;
+				new_member->next = q->members;
+				q->members = new_member;
+				manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
+					"Queue: %s\r\n"
+					"Location: %s\r\n"
+					"Membership: %s\r\n"
+					"Penalty: %d\r\n"
+					"CallsTaken: %d\r\n"
+					"LastCall: %d\r\n"
+					"Status: %d\r\n"
+					"Paused: %d\r\n",
+				q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+				new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
 					
-					if (dump)
-						dump_queue_members(q);
-
-					res = RES_OKAY;
-				} else {
-					res = RES_OUTOFMEMORY;
-				}
+				if (dump)
+					dump_queue_members(q);
+
+				res = RES_OKAY;
 			} else {
-				res = RES_EXISTS;
-			}
-			ast_mutex_unlock(&q->lock);
-			break;
+				res = RES_OUTOFMEMORY;
+			}
+		} else {
+			res = RES_EXISTS;
 		}
 		ast_mutex_unlock(&q->lock);
 	}
@@ -3273,7 +3295,13 @@
 	time(&now);
 	if ((!queue_show && argc != 2) || (queue_show && argc != 3))
 		return RESULT_SHOWUSAGE;
+
+	/* We only want to load realtime queues when a specific queue is asked for. */
+	if (queue_show)
+		load_realtime_queue(argv[2]);
+
 	ast_mutex_lock(&qlock);
+
 	q = queues;
 	if (!q) {	
 		ast_mutex_unlock(&qlock);

Modified: team/murf/bug_6264-1.2/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/ast_expr2.fl?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/ast_expr2.fl (original)
+++ team/murf/bug_6264-1.2/ast_expr2.fl Sat Jan 21 20:06:08 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/murf/bug_6264-1.2/ast_expr2.y
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/ast_expr2.y?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/ast_expr2.y (original)
+++ team/murf/bug_6264-1.2/ast_expr2.y Sat Jan 21 20:06:08 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/murf/bug_6264-1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/channels/chan_iax2.c?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/channels/chan_iax2.c (original)
+++ team/murf/bug_6264-1.2/channels/chan_iax2.c Sat Jan 21 20:06:08 2006
@@ -4894,6 +4894,8 @@
 	fh.iseqno = 0;
 	fh.type = AST_FRAME_IAX;
 	fh.csub = compress_subclass(IAX_COMMAND_INVAL);
+	if (iaxdebug)
+		 iax_showframe(NULL, &fh, 0, sin, 0);
 #if 0
 	if (option_debug)
 #endif	
@@ -6766,6 +6768,10 @@
 					break;
 				if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr)
 					check_provisioning(&sin, fd, ies.serviceident, ies.provver);
+				/* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
+				if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
+					fr.callno = make_trunk(fr.callno, 1);
+				}
 				/* For security, always ack immediately */
 				if (delayreject)
 					send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
@@ -6775,10 +6781,6 @@
 					if (authdebug)
 						ast_log(LOG_NOTICE, "Rejected connect attempt from %s, who was trying to reach '%s@%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), iaxs[fr.callno]->exten, iaxs[fr.callno]->context);
 					break;
-				}
-				/* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
-				if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
-					fr.callno = make_trunk(fr.callno, 1);
 				}
 				/* This might re-enter the IAX code and need the lock */
 				if (strcasecmp(iaxs[fr.callno]->exten, "TBD")) {

Modified: team/murf/bug_6264-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6264-1.2/channels/chan_sip.c?rev=8419&r1=8418&r2=8419&view=diff
==============================================================================
--- team/murf/bug_6264-1.2/channels/chan_sip.c (original)
+++ team/murf/bug_6264-1.2/channels/chan_sip.c Sat Jan 21 20:06:08 2006
@@ -5113,13 +5113,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))
@@ -12171,7 +12172,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));



More information about the svn-commits mailing list