[asterisk-commits] mmichelson: branch mmichelson/queue_refcount_trunk r82284 - in /team/mmichels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 12 13:21:39 CDT 2007


Author: mmichelson
Date: Wed Sep 12 13:21:38 2007
New Revision: 82284

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82284
Log:
Maintenance


Modified:
    team/mmichelson/queue_refcount_trunk/   (props changed)
    team/mmichelson/queue_refcount_trunk/apps/app_meetme.c
    team/mmichelson/queue_refcount_trunk/apps/app_queue.c
    team/mmichelson/queue_refcount_trunk/channels/chan_misdn.c
    team/mmichelson/queue_refcount_trunk/channels/misdn/isdn_lib.c
    team/mmichelson/queue_refcount_trunk/main/cdr.c
    team/mmichelson/queue_refcount_trunk/main/manager.c
    team/mmichelson/queue_refcount_trunk/main/minimime/minimime.c
    team/mmichelson/queue_refcount_trunk/main/minimime/mm_mem.c
    team/mmichelson/queue_refcount_trunk/main/minimime/tests/create.c
    team/mmichelson/queue_refcount_trunk/main/minimime/tests/parse.c
    team/mmichelson/queue_refcount_trunk/pbx/pbx_dundi.c
    team/mmichelson/queue_refcount_trunk/res/res_agi.c
    team/mmichelson/queue_refcount_trunk/utils/Makefile
    team/mmichelson/queue_refcount_trunk/utils/hashtest2.c

Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Sep 12 13:21:38 2007
@@ -1,1 +1,1 @@
-/trunk:1-82211
+/trunk:1-82255

Modified: team/mmichelson/queue_refcount_trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_meetme.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_meetme.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_meetme.c Wed Sep 12 13:21:38 2007
@@ -849,8 +849,8 @@
 	int hr, min, sec;
 	int i = 0, total = 0;
 	time_t now;
-	char *header_format = "%-14s %-14s %-10s %-8s  %-8s\n";
-	char *data_format = "%-12.12s   %4.4d	      %4.4s       %02d:%02d:%02d  %-8s\n";
+	char *header_format = "%-14s %-14s %-10s %-8s  %-8s  %-6s\n";
+	char *data_format = "%-12.12s   %4.4d	      %4.4s       %02d:%02d:%02d  %-8s  %-6s\n";
 	char cmdline[1024] = "";
 
 	if (argc > 8)
@@ -869,7 +869,7 @@
 			AST_LIST_UNLOCK(&confs);
 			return RESULT_SUCCESS;
 		}
-		ast_cli(fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation");
+		ast_cli(fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked");
 		AST_LIST_TRAVERSE(&confs, cnf, list) {
 			if (cnf->markedusers == 0)
 				strcpy(cmdline, "N/A ");
@@ -879,7 +879,7 @@
 			min = ((now - cnf->start) % 3600) / 60;
 			sec = (now - cnf->start) % 60;
 
-			ast_cli(fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static");
+			ast_cli(fd, data_format, cnf->confno, cnf->users, cmdline, hr, min, sec, cnf->isdynamic ? "Dynamic" : "Static", cnf->locked ? "Yes" : "No");
 
 			total += cnf->users; 	
 		}

Modified: team/mmichelson/queue_refcount_trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_queue.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_queue.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_queue.c Wed Sep 12 13:21:38 2007
@@ -409,7 +409,12 @@
 	int autofill;                       /*!< Ignore the head call status and ring an available agent */
 	
 	struct ao2_container *members;             /*!< Head of the list of members */
-	int membercount;					/*!< Number of members in queue */
+	/*! 
+	 * \brief Number of members _logged in_
+	 * \note There will be members in the members container that are not logged
+	 *       in, so this can not simply be replaced with ao2_container_count(). 
+	 */
+	int membercount;
 	struct queue_ent *head;             /*!< Head of the list of callers */
 	AST_LIST_ENTRY(call_queue) list;    /*!< Next call queue */
 };
@@ -529,12 +534,12 @@
 static enum queue_member_status get_member_status(struct call_queue *q, int max_penalty)
 {
 	struct member *member;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 	enum queue_member_status result = QUEUE_NO_MEMBERS;
 
 	ast_mutex_lock(&q->lock);
-	i = ao2_iterator_init(q->members, 0);
-	while ((member = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((member = ao2_iterator_next(&mem_iter))) {
 		if (max_penalty && (member->penalty > max_penalty)) {
 			ao2_ref(member, -1);
 			continue;
@@ -577,7 +582,7 @@
 {
 	struct call_queue *q;
 	struct member *cur;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 	struct member_interface *curint;
 	struct ao2_iterator queue_iter;
 	char *loc;
@@ -614,8 +619,8 @@
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_iterator_next(&queue_iter))) {
 		ast_mutex_lock(&q->lock);
-		i = ao2_iterator_init(q->members, 0);
-		while ((cur = ao2_iterator_next(&i))) {
+		mem_iter = ao2_iterator_init(q->members, 0);
+		while ((cur = ao2_iterator_next(&mem_iter))) {
 			char *interface;
 			char *slash_pos;
 			interface = ast_strdupa(cur->interface);
@@ -1133,9 +1138,9 @@
 {
 	/* Free non-dynamic members */
 	struct member *cur;
-	struct ao2_iterator i = ao2_iterator_init(q->members, 0);
-
-	while ((cur = ao2_iterator_next(&i))) {
+	struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0);
+
+	while ((cur = ao2_iterator_next(&mem_iter))) {
 		if (all || !cur->dynamic) {
 			ao2_unlink(q->members, cur);
 			remove_from_interfaces(cur->interface);
@@ -1171,14 +1176,9 @@
 static struct 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 call_queue *q;
-<<<<<<< .mine
-	struct call_queue tmpq;
-	struct member *m, *prev_m, *next_m;
-=======
+	struct call_queue *q, tmpq;
 	struct member *m;
-	struct ao2_iterator i;
->>>>>>> .r82248
+	struct ao2_iterator mem_iter;
 	char *interface = NULL;
 	char *tmp, *tmp_name;
 	char tmpbuf[64];	/* Must be longer than the longest queue param name. */
@@ -1249,8 +1249,8 @@
 
 	/* Temporarily set realtime members dead so we can detect deleted ones. 
 	 * Also set the membercount correctly for realtime*/
-	i = ao2_iterator_init(q->members, 0);
-	while ((m = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((m = ao2_iterator_next(&mem_iter))) {
 		q->membercount++;
 		if (m->realtime)
 			m->dead = 1;
@@ -1265,8 +1265,8 @@
 	}
 
 	/* Delete all realtime members that have been deleted in DB. */
-	i = ao2_iterator_init(q->members, 0);
-	while ((m = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
 			ao2_unlink(q->members, m);
 			ast_mutex_unlock(&q->lock);
@@ -1349,7 +1349,7 @@
 	struct ast_config *member_config = NULL;
 	struct member *m;
 	char *interface = NULL;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 
 	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
 	if (!member_config) {
@@ -1361,8 +1361,8 @@
 	ast_mutex_lock(&q->lock);
 	
 	/* Temporarily set realtime  members dead so we can detect deleted ones.*/ 
-	i = ao2_iterator_init(q->members, 0);
-	while ((m = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->realtime)
 			m->dead = 1;
 		ao2_ref(m, -1);
@@ -1376,8 +1376,8 @@
 	}
 
 	/* Delete all realtime members that have been deleted in DB. */
-	i = ao2_iterator_init(q->members, 0);
-	while ((m = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
 			ao2_unlink(q->members, m);
 			ast_mutex_unlock(&q->lock);
@@ -1691,13 +1691,13 @@
 static int update_status(struct call_queue *q, struct member *member, int status)
 {
 	struct member *cur;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 
 	/* Since a reload could have taken place, we have to traverse the list to
 		be sure it's still valid */
 	ast_mutex_lock(&q->lock);
-	i = ao2_iterator_init(q->members, 0);
-	while ((cur = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((cur = ao2_iterator_next(&mem_iter))) {
 		if (member != cur) {
 			ao2_ref(cur, -1);
 			continue;
@@ -2361,8 +2361,8 @@
 			ast_debug(1, "Even though there are %d available members, the strategy is ringall so only the head call is allowed in\n", avl);
 			avl = 1;
 		} else {
-			struct ao2_iterator i = ao2_iterator_init(qe->parent->members, 0);
-			while ((cur = ao2_iterator_next(&i))) {
+			struct ao2_iterator mem_iter = ao2_iterator_init(qe->parent->members, 0);
+			while ((cur = ao2_iterator_next(&mem_iter))) {
 				switch (cur->status) {
 				case AST_DEVICE_NOT_INUSE:
 				case AST_DEVICE_UNKNOWN:
@@ -2651,6 +2651,7 @@
 		struct callattempt *tmp = ast_calloc(1, sizeof(*tmp));
 
 		if (!tmp) {
+			ao2_ref(cur, -1);
 			ast_mutex_unlock(&qe->parent->lock);
 			if (use_weight)
 				ao2_unlock(queues);
@@ -3079,13 +3080,13 @@
 static struct member *interface_exists(struct call_queue *q, const char *interface)
 {
 	struct member *mem;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 
 	if (!q)
 		return NULL;
 
-	i = ao2_iterator_init(q->members, 0);
-	while ((mem = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((mem = ao2_iterator_next(&mem_iter))) {
 		if (!strcasecmp(interface, mem->interface))
 			return mem;
 		ao2_ref(mem, -1);
@@ -3106,15 +3107,15 @@
 	char value[PM_MAX_LEN];
 	int value_len = 0;
 	int res;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 
 	memset(value, 0, sizeof(value));
 
 	if (!pm_queue)
 		return;
 
-	i = ao2_iterator_init(pm_queue->members, 0);
-	while ((cur_member = ao2_iterator_next(&i))) {
+	mem_iter = ao2_iterator_init(pm_queue->members, 0);
+	while ((cur_member = ao2_iterator_next(&mem_iter))) {
 		if (!cur_member->dynamic) {
 			ao2_ref(cur_member, -1);
 			continue;
@@ -3890,7 +3891,7 @@
 	int count = 0;
 	struct call_queue *q, tmpq;
 	struct member *m;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 
 	buf[0] = '\0';
 	
@@ -3903,8 +3904,8 @@
 	
 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
 		ast_mutex_lock(&q->lock);
-		i = ao2_iterator_init(q->members, 0);
-		while ((m = ao2_iterator_next(&i))) {
+		mem_iter = ao2_iterator_init(q->members, 0);
+		while ((m = ao2_iterator_next(&mem_iter))) {
 			/* Count the agents who are logged in and presently answering calls */
 			if ((m->status != AST_DEVICE_UNAVAILABLE) && (m->status != AST_DEVICE_INVALID)) {
 				count++;
@@ -3965,14 +3966,10 @@
 
 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
 		int buflen = 0, count = 0;
-		struct ao2_iterator i = ao2_iterator_init(q->members, 0);
-
-<<<<<<< .mine
+		struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0);
+
 		ast_mutex_lock(&q->lock);
-		for (m = q->members; m; m = m->next) {
-=======
-		while ((m = ao2_iterator_next(&i))) {
->>>>>>> .r82248
+		while ((m = ao2_iterator_next(&mem_iter))) {
 			/* strcat() is always faster than printf() */
 			if (count++) {
 				strncat(buf + buflen, ",", len - buflen - 1);
@@ -3982,6 +3979,7 @@
 			buflen += strlen(m->interface);
 			/* Safeguard against overflow (negative length) */
 			if (buflen >= len - 2) {
+				ao2_ref(m, -1);
 				ast_log(LOG_WARNING, "Truncating list\n");
 				break;
 			}
@@ -4050,7 +4048,7 @@
 	char *cat, *tmp;
 	struct ast_variable *var;
 	struct member *cur, *newm;
-	struct ao2_iterator i;
+	struct ao2_iterator mem_iter;
 	int new;
 	const char *general_val = NULL;
 	char parse[80];
@@ -4116,8 +4114,8 @@
 				init_queue(q);
 				if (!queue_keep_stats) 
 					clear_queue(q);
-				i = ao2_iterator_init(q->members, 0);
-				while ((cur = ao2_iterator_next(&i))) {
+				mem_iter = ao2_iterator_init(q->members, 0);
+				while ((cur = ao2_iterator_next(&mem_iter))) {
 					if (!cur->dynamic) {
 						cur->delme = 1;
 					}
@@ -4166,8 +4164,8 @@
 				}
 
 				/* Free remaining members marked as delme */
-				i = ao2_iterator_init(q->members, 0);
-				while ((cur = ao2_iterator_next(&i))) {
+				mem_iter = ao2_iterator_init(q->members, 0);
+				while ((cur = ao2_iterator_next(&mem_iter))) {
 					if (! cur->delme) {
 						ao2_ref(cur, -1);
 						continue;
@@ -4195,8 +4193,8 @@
 			ao2_unlink(queues, q);
 		} else {
 			ast_mutex_lock(&q->lock);
-			i = ao2_iterator_init(q->members, 0);
-			while ((cur = ao2_iterator_next(&i))) {
+			mem_iter = ao2_iterator_init(q->members, 0);
+			while ((cur = ao2_iterator_next(&mem_iter))) {
 				if (cur->dynamic)
 					q->membercount++;
 				cur->status = ast_device_state(cur->interface);
@@ -4225,11 +4223,8 @@
 	struct ast_str *out = ast_str_alloca(240);
 	int found = 0;
 	time_t now = time(NULL);
-<<<<<<< .mine
 	struct ao2_iterator queue_iter;
-=======
-	struct ao2_iterator i;
->>>>>>> .r82248
+	struct ao2_iterator mem_iter;
 
 	if (argc != 2 && argc != 3)
 		return RESULT_SHOWUSAGE;
@@ -4267,8 +4262,8 @@
 			struct member *mem;
 
 			do_print(s, fd, "   Members: ");
-			i = ao2_iterator_init(q->members, 0);
-			while ((mem = ao2_iterator_next(&i))) {
+			mem_iter = ao2_iterator_init(q->members, 0);
+			while ((mem = ao2_iterator_next(&mem_iter))) {
 				ast_str_set(&out, 0, "      %s", mem->interface);
 				if (mem->penalty)
 					ast_str_append(&out, 0, " with penalty %d", mem->penalty);
@@ -4375,11 +4370,8 @@
 	struct call_queue *q;
 	struct queue_ent *qe;
 	struct member *mem;
-<<<<<<< .mine
 	struct ao2_iterator queue_iter;
-=======
-	struct ao2_iterator i;
->>>>>>> .r82248
+	struct ao2_iterator mem_iter;
 
 	astman_send_ack(s, m, "Queue summary will follow");
 	time(&now);
@@ -4392,8 +4384,8 @@
 		/* List queue properties */
 		if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
 			/* List Queue Members */
-			i = ao2_iterator_init(q->members, 0);
-			while ((mem = ao2_iterator_next(&i))) {
+			mem_iter = ao2_iterator_init(q->members, 0);
+			while ((mem = ao2_iterator_next(&mem_iter))) {
 				if ((mem->status != AST_DEVICE_UNAVAILABLE) && (mem->status != AST_DEVICE_INVALID)) {
 					++qmemcount;
 					if (((mem->status == AST_DEVICE_NOT_INUSE) || (mem->status == AST_DEVICE_UNKNOWN)) && !(mem->paused)) {
@@ -4439,11 +4431,8 @@
 	struct queue_ent *qe;
 	float sl = 0;
 	struct member *mem;
-<<<<<<< .mine
 	struct ao2_iterator queue_iter;
-=======
-	struct ao2_iterator i;
->>>>>>> .r82248
+	struct ao2_iterator mem_iter;
 
 	astman_send_ack(s, m, "Queue status will follow");
 	time(&now);
@@ -4473,8 +4462,8 @@
 				q->name, q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted,
 				q->callsabandoned, q->servicelevel, sl, q->weight, idText);
 			/* List Queue Members */
-			i = ao2_iterator_init(q->members, 0);
-			while ((mem = ao2_iterator_next(&i))) {
+			mem_iter = ao2_iterator_init(q->members, 0);
+			while ((mem = ao2_iterator_next(&mem_iter))) {
 				if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
 					astman_append(s, "Event: QueueMember\r\n"
 						"Queue: %s\r\n"
@@ -4775,11 +4764,8 @@
 	int which = 0;
 	struct call_queue *q;
 	struct member *m;
-<<<<<<< .mine
 	struct ao2_iterator queue_iter;
-=======
-	struct ao2_iterator i;
->>>>>>> .r82248
+	struct ao2_iterator mem_iter;
 
 	/* 0 - queue; 1 - remove; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
 	if (pos > 5 || pos < 3)
@@ -4791,30 +4777,19 @@
 		return complete_queue(line, word, pos, state);
 
 	/* here is the case for 3, <member> */
-<<<<<<< .mine
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_iterator_next(&queue_iter))) {
 		ast_mutex_lock(&q->lock);
-		for (m = q->members ; m ; m = m->next) {
+		mem_iter = ao2_iterator_init(q->members, 0);
+		while ((m = ao2_iterator_next(&mem_iter))) {
 			if (++which > state) {
+				char *tmp;
 				ast_mutex_unlock(&q->lock);
-				queue_unref(q);
-				return ast_strdup(m->interface);
-=======
-	if (!AST_LIST_EMPTY(&queues)) { /* XXX unnecessary ? the traverse does that for us */
-		AST_LIST_TRAVERSE(&queues, q, list) {
-			ast_mutex_lock(&q->lock);
-			i = ao2_iterator_init(q->members, 0);
-			while ((m = ao2_iterator_next(&i))) {
-				if (++which > state) {
-					char *tmp;
-					ast_mutex_unlock(&q->lock);
-					tmp = ast_strdup(m->interface);
-					ao2_ref(m, -1);
-					return tmp;
-				}
->>>>>>> .r82248
-			}
+				tmp = ast_strdup(m->interface);
+				ao2_ref(m, -1);
+				return tmp;
+			}
+			ao2_ref(m, -1);
 		}
 		ast_mutex_unlock(&q->lock);
 		queue_unref(q);

Modified: team/mmichelson/queue_refcount_trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_misdn.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_misdn.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_misdn.c Wed Sep 12 13:21:38 2007
@@ -4517,7 +4517,7 @@
 			if (FD_ISSET(ch->pipe[1], &wrfs)) {
 				chan_misdn_log(9, bc->port, "writing %d bytes 2 asterisk\n", bc->bframe_len);
 				if (write(ch->pipe[1], bc->bframe, bc->bframe_len) <= 0) {
-					chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n", strerror(errno));
+					chan_misdn_log(0, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n", strerror(errno));
 
 					stop_bc_tones(ch);
 					hangup_chan(ch);
@@ -4585,7 +4585,7 @@
 		struct ast_channel *hold_ast;
 
 		if (!ch) {
-			chan_misdn_log(4, bc->port, " --> no CH, searching in holded");
+			chan_misdn_log(4, bc->port, " --> no CH, searching in holded\n");
 			ch = find_holded_l3(cl_te, bc->l3_id, 1);
 		}
 
@@ -4607,9 +4607,11 @@
 		if (hold_ast) {
 			ast_moh_stop(hold_ast);
 		}
-
-		if (misdn_lib_send_event(bc, EVENT_RETRIEVE_ACKNOWLEDGE) < 0)
+	
+		if (misdn_lib_send_event(bc, EVENT_RETRIEVE_ACKNOWLEDGE) < 0) {
+			chan_misdn_log(4, bc->port, " --> RETRIEVE_ACK failed\n");
 			misdn_lib_send_event(bc, EVENT_RETRIEVE_REJECT);
+		}
 	}
 	break;
     

Modified: team/mmichelson/queue_refcount_trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/misdn/isdn_lib.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/misdn/isdn_lib.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/misdn/isdn_lib.c Wed Sep 12 13:21:38 2007
@@ -1816,6 +1816,7 @@
 				free(hold_bc);
 
 				bc->holded=0;
+				bc->b_stid=0;
 			}
 			
 		}
@@ -2849,7 +2850,6 @@
 		case SSTATUS_L1_DEACTIVATED:
 			cb_log(3, 0, "MGMT: SSTATUS: L1_DEACTIVATED \n");
 			stack->l1link=0;
-
 			clear_l3(stack);
 			break;
 

Modified: team/mmichelson/queue_refcount_trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/cdr.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/cdr.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/cdr.c Wed Sep 12 13:21:38 2007
@@ -714,8 +714,8 @@
 void ast_cdr_failed(struct ast_cdr *cdr)
 {
 	for (; cdr; cdr = cdr->next) {
-		check_post(cdr);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			check_post(cdr);
 			if (cdr->disposition < AST_CDR_FAILED)
 				cdr->disposition = AST_CDR_FAILED;
 		}
@@ -727,10 +727,10 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
-		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
-			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
+				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (cdr->disposition < AST_CDR_NOANSWER)
 				cdr->disposition = AST_CDR_NOANSWER;
 		}
@@ -763,9 +763,10 @@
 void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
 {
 	for (; cdr; cdr = cdr->next) {
-		check_post(cdr);
-		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			check_post(cdr);
 			ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
+		}
 	}
 }
 

Modified: team/mmichelson/queue_refcount_trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/manager.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/manager.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/manager.c Wed Sep 12 13:21:38 2007
@@ -625,13 +625,18 @@
 {
 	struct mansession *s;
 	char *format = "  %-15.15s  %-15.15s\n";
+	int count = 0;
 
 	ast_cli(fd, format, "Username", "IP Address");
 
 	AST_LIST_LOCK(&sessions);
-	AST_LIST_TRAVERSE(&sessions, s, list)
+	AST_LIST_TRAVERSE(&sessions, s, list) {
 		ast_cli(fd, format,s->username, ast_inet_ntoa(s->sin.sin_addr));
+		count++;
+	}
 	AST_LIST_UNLOCK(&sessions);
+
+	ast_cli(fd, "%d users connected.\n", count);
 
 	return RESULT_SUCCESS;
 }

Modified: team/mmichelson/queue_refcount_trunk/main/minimime/minimime.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/minimime/minimime.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/minimime/minimime.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/minimime/minimime.c Wed Sep 12 13:21:38 2007
@@ -38,7 +38,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <getopt.h>
-#include <err.h>
 
 #include "mm.h"
 
@@ -106,20 +105,20 @@
 			i = mm_parse_file(ctx, argv[0], MM_PARSE_LOOSE, 0);
 		} else {
 			if (stat(argv[0], &st) == -1) {
-				err(1, "stat");
+				fprintf(stderr, "INFO: stat");
 			}
 	
 			if ((fd = open(argv[0], O_RDONLY)) == -1) {
-				err(1, "open");
+				fdprintf(stderr, "INFO: open");
 			}
 
 			buf = (char *)malloc(st.st_size);
 			if (buf == NULL) {
-				err(1, "malloc");
+				fdprintf(stderr, "INFO: malloc");
 			}	
 
 			if (read(fd, buf, st.st_size) != st.st_size) {
-				err(1, "read");
+				fdprintf(stderr, "INFO: read");
 			}
 
 			close(fd);

Modified: team/mmichelson/queue_refcount_trunk/main/minimime/mm_mem.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/minimime/mm_mem.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/minimime/mm_mem.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/minimime/mm_mem.c Wed Sep 12 13:21:38 2007
@@ -37,7 +37,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <err.h>
 #include <assert.h>
 
 #include "mm_internal.h"
@@ -55,11 +54,11 @@
 
 	pointer = malloc(size);
 	if (pointer == NULL)
-		err(1, "malloc");
+		fdprintf(stderr, "INFO: malloc");
 
 	chunk = (struct MM_mem_chunk *)malloc(sizeof(struct MM_mem_chunk));
 	if (chunk == NULL)
-		err(1, "malloc");
+		fdprintf(stderr, "INFO: malloc");
 
 	chunk->address = pointer;
 	chunk->size = size;

Modified: team/mmichelson/queue_refcount_trunk/main/minimime/tests/create.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/minimime/tests/create.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/minimime/tests/create.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/minimime/tests/create.c Wed Sep 12 13:21:38 2007
@@ -40,7 +40,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <getopt.h>
-#include <err.h>
 
 #include "mm.h"
 

Modified: team/mmichelson/queue_refcount_trunk/main/minimime/tests/parse.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/minimime/tests/parse.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/minimime/tests/parse.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/minimime/tests/parse.c Wed Sep 12 13:21:38 2007
@@ -40,7 +40,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <getopt.h>
-#include <err.h>
 
 #include "mm.h"
 

Modified: team/mmichelson/queue_refcount_trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/pbx/pbx_dundi.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/pbx/pbx_dundi.c (original)
+++ team/mmichelson/queue_refcount_trunk/pbx/pbx_dundi.c Wed Sep 12 13:21:38 2007
@@ -273,6 +273,13 @@
 static AST_LIST_HEAD_NOLOCK_STATIC(requests, dundi_request);
 static AST_LIST_HEAD_NOLOCK_STATIC(alltrans, dundi_transaction);
 
+/*!
+ * \brief Wildcard peer
+ *
+ * This peer is created if the [*] entry is specified in dundi.conf
+ */
+static struct dundi_peer *any_peer;
+
 static int dundi_xmit(struct dundi_packet *pack);
 
 static void dundi_debug_output(const char *data)
@@ -493,6 +500,9 @@
 		if (!dundi_eid_cmp(&cur->eid,eid))
 			break;
 	}
+
+	if (!cur && any_peer)
+		cur = any_peer;
 
 	return cur;
 }
@@ -1529,7 +1539,7 @@
 	unsigned char *bufcpy;
 	struct dundi_ie_data ied;
 	struct dundi_ies ies;
-	struct dundi_peer *peer;
+	struct dundi_peer *peer = NULL;
 	char eid_str[20];
 	char eid_str2[20];
 	memset(&ied, 0, sizeof(ied));
@@ -1614,6 +1624,23 @@
 	case DUNDI_COMMAND_REGREQ:
 		/* A register request -- should only have one entity */
 		peer = find_peer(ies.eids[0]);
+		
+		/* if the peer is not found and we have a valid 'any_peer' setting */
+		if (any_peer && peer == any_peer) {
+			/* copy any_peer into a new peer object */
+			peer = ast_calloc(1, sizeof(*peer));
+			if (peer) {
+				memcpy(peer, any_peer, sizeof(*peer));
+
+				/* set EID to remote EID */
+				peer->eid = *ies.eids[0];
+
+				AST_LIST_LOCK(&peers);
+				AST_LIST_INSERT_HEAD(&peers, peer, list);
+				AST_LIST_UNLOCK(&peers);
+			}
+		}
+
 		if (!peer || !peer->dynamic) {
 			dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_NOAUTH, NULL);
 			dundi_send(trans, DUNDI_COMMAND_REGRESPONSE, 0, 1, &ied);
@@ -4583,7 +4610,10 @@
 
 	dundi_ttl = DUNDI_DEFAULT_TTL;
 	dundi_cache_time = DUNDI_DEFAULT_CACHE_TIME;
-
+	any_peer = NULL;
+	
+	cfg = ast_config_load(config_file, config_flags);
+	
 	if (!cfg) {
 		ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
 		return -1;
@@ -4705,7 +4735,10 @@
 			/* Entries */
 			if (!dundi_str_to_eid(&testeid, cat))
 				build_peer(&testeid, ast_variable_browse(cfg, cat), &globalpcmodel);
-			else
+			else if (!strcasecmp(cat, "*")) {
+				build_peer(&empty_eid, ast_variable_browse(cfg, cat), &globalpcmodel);
+				any_peer = find_peer(NULL);
+			} else
 				ast_log(LOG_NOTICE, "Ignoring invalid EID entry '%s'\n", cat);
 		}
 		cat = ast_category_browse(cfg, cat);
@@ -4742,6 +4775,11 @@
 	close(netsocket);
 	io_context_destroy(io);
 	sched_context_destroy(sched);
+
+	mark_mappings();
+	prune_mappings();
+	mark_peers();
+	prune_peers();
 
 	return 0;
 }

Modified: team/mmichelson/queue_refcount_trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/res/res_agi.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/res/res_agi.c (original)
+++ team/mmichelson/queue_refcount_trunk/res/res_agi.c Wed Sep 12 13:21:38 2007
@@ -67,6 +67,8 @@
 #include "asterisk/agi.h"
 
 #define MAX_ARGS 128
+#define AGI_NANDFS_RETRY 3
+#define AGI_BUF_LEN 2048
 
 static char *app = "AGI";
 
@@ -1856,18 +1858,17 @@
 	}
 	return 0;
 }
-#define RETRY	3
 static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid, int *status, int dead, int argc, char *argv[])
 {
 	struct ast_channel *c;
 	int outfd, ms, needhup = 0;
 	enum agi_result returnstatus = AGI_RESULT_SUCCESS;
 	struct ast_frame *f;
-	char buf[2048];
+	char buf[AGI_BUF_LEN];
 	FILE *readf;
 	/* how many times we'll retry if ast_waitfor_nandfs will return without either 
 	  channel or file descriptor in case select is interrupted by a system call (EINTR) */
-	int retry = RETRY;
+	int retry = AGI_NANDFS_RETRY;
 
 	if (!(readf = fdopen(agi->ctrl, "r"))) {
 		ast_log(LOG_WARNING, "Unable to fdopen file descriptor\n");
@@ -1887,7 +1888,7 @@
 		ms = -1;
 		c = ast_waitfor_nandfds(&chan, dead ? 0 : 1, &agi->ctrl, 1, NULL, &outfd, &ms);
 		if (c) {
-			retry = RETRY;
+			retry = AGI_NANDFS_RETRY;
 			/* Idle the channel until we get a command */
 			f = ast_read(c);
 			if (!f) {
@@ -1904,9 +1905,25 @@
 				ast_frfree(f);
 			}
 		} else if (outfd > -1) {
-			retry = RETRY;
+			size_t len = sizeof(buf);
+			size_t buflen = 0;
+
+			retry = AGI_NANDFS_RETRY;
 			buf[0] = '\0';
-			if (!fgets(buf, sizeof(buf), readf)) {
+
+			while (buflen < (len - 1)) {
+				fgets(buf + buflen, len, readf);
+				if (feof(readf)) 
+					break;
+				if (ferror(readf) && ((errno != EINTR) && (errno != EAGAIN))) 
+					break;
+				buflen = strlen(buf);
+				len -= buflen;
+				if (agidebug)
+					ast_verbose( "AGI Rx << temp buffer %s - errno %s\n", buf, strerror(errno));
+			}
+
+			if (!buf[0]) {
 				/* Program terminated */
 				if (returnstatus && returnstatus != AST_PBX_KEEPALIVE)
 					returnstatus = -1;
@@ -1917,6 +1934,7 @@
 				pid = -1;
 				break;
 			}
+
 			/* get rid of trailing newline, if any */
 			if (*buf && buf[strlen(buf) - 1] == '\n')
 				buf[strlen(buf) - 1] = 0;
@@ -2067,12 +2085,11 @@
 {
 	enum agi_result res;
 	struct ast_module_user *u;
-	char buf[2048] = "", *tmp = buf;
+	char buf[AGI_BUF_LEN] = "", *tmp = buf;
 	int fds[2], efd = -1, pid;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(arg)[MAX_ARGS];
 	);
-	__attribute__((unused))char *empty = NULL;
 	AGI agi;
 
 	if (ast_strlen_zero(data)) {

Modified: team/mmichelson/queue_refcount_trunk/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/utils/Makefile?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/utils/Makefile (original)
+++ team/mmichelson/queue_refcount_trunk/utils/Makefile Wed Sep 12 13:21:38 2007
@@ -131,8 +131,8 @@
 hashtest2.o : hashtest2.c
 	$(CC) -g -O0 -c hashtest2.c -I/usr/include -I../include
 
-hashtest2 : hashtest2.o md5.o utils.o astobj2.o sha1.o
-	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o -lpthread
+hashtest2 : hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o
+	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o strcompat.o -lpthread
 
 extconf.o : extconf.c
 

Modified: team/mmichelson/queue_refcount_trunk/utils/hashtest2.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/utils/hashtest2.c?view=diff&rev=82284&r1=82283&r2=82284
==============================================================================
--- team/mmichelson/queue_refcount_trunk/utils/hashtest2.c (original)
+++ team/mmichelson/queue_refcount_trunk/utils/hashtest2.c Wed Sep 12 13:21:38 2007
@@ -34,7 +34,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
+#endif
 #include <string.h>
 #include <pthread.h>
 #include <sys/stat.h>
@@ -42,6 +44,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "asterisk/compat.h"
 #include "asterisk/lock.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/channel.h"




More information about the asterisk-commits mailing list