[svn-commits] branch bweschke/findme_followme r31809 - /team/bweschke/findme_followme/apps/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Jun 3 11:38:00 MST 2006


Author: bweschke
Date: Sat Jun  3 13:37:59 2006
New Revision: 31809

URL: http://svn.digium.com/view/asterisk?rev=31809&view=rev
Log:
 Getting there...


Modified:
    team/bweschke/findme_followme/apps/app_followme.c

Modified: team/bweschke/findme_followme/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/findme_followme/apps/app_followme.c?rev=31809&r1=31808&r2=31809&view=diff
==============================================================================
--- team/bweschke/findme_followme/apps/app_followme.c (original)
+++ team/bweschke/findme_followme/apps/app_followme.c Sat Jun  3 13:37:59 2006
@@ -89,7 +89,7 @@
 struct fm_args {
 	struct ast_channel *chan;
 	char *mohclass;
-	AST_LIST_HEAD_NOLOCK(numbers, number) numbers;
+	AST_LIST_HEAD_NOLOCK(cnumbers, number) cnumbers;
 	int status;
 	char context[AST_MAX_CONTEXT];
 	char namerecloc[AST_MAX_CONTEXT];
@@ -117,33 +117,27 @@
 static char takecall[20] = "1", nextindp[20] = "2", nextinfmfm[20] = "", blindxferexten[20] = "", atxferexten[20] = "";
 
 static AST_LIST_HEAD_STATIC(followmes, ast_call_followme);
-static AST_LIST_HEAD_NOLOCK(findme_user_listptr, findme_user);
+AST_LIST_HEAD_NOLOCK(findme_user_listptr, findme_user);
 
 static void free_numbers(struct ast_call_followme *f)
 {
 	/* Free numbers attached to the profile */
-	struct number *curn, *prev;
-
-	curn = f->numbers;
-	prev = NULL;
-	while ((prev = AST_LIST_REMOVE_HEAD(curn, entry)))
+	struct number *prev;
+
+	while ((prev = AST_LIST_REMOVE_HEAD(&f->numbers, entry)))
 		/* Free the number */
 		free(prev);
-	AST_LIST_HEAD_INIT_NOLOCK(curn);
-
-	curn = f->blnumbers;
-	prev = NULL;
-	while ((prev = AST_LIST_REMOVE_HEAD(curn, entry)))
-		/* Free the number */
+	AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
+
+	while ((prev = AST_LIST_REMOVE_HEAD(&f->blnumbers, entry)))
+		/* Free the blacklisted number */
 		free(prev);
-	AST_LIST_HEAD_INIT_NOLOCK(curn);
-
-	curn = f->wlnumbers;
-	prev = NULL;
-	while ((prev = AST_LIST_REMOVE_HEAD(curn, entry)))
-		/* Free the number */
+	AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
+
+	while ((prev = AST_LIST_REMOVE_HEAD(&f->wlnumbers, entry)))
+		/* Free the whitelisted number */
 		free(prev);
-	AST_LIST_HEAD_INIT_NOLOCK(curn);
+	AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
 	
 }
 
@@ -216,7 +210,7 @@
 	struct ast_config *cfg;
 	char *cat, *tmp;
 	struct ast_variable *var;
-	struct number *prev, *cur;
+	struct number *cur;
 	int new;
 	char numberstr[90];
 	int timeout;
@@ -653,7 +647,7 @@
 
 
 	caller = tpargs->chan;
-	AST_LIST_TRAVERSE(&tpargs.numbers, nm, entry) {
+	AST_LIST_TRAVERSE(&tpargs.cnumbers, nm, entry) {
 		if (option_debug > 2)	
 			ast_log(LOG_DEBUG, "Number %s timeout %ld\n",nm->number,nm->timeout);
 		time(&start_time);
@@ -806,10 +800,10 @@
 				ast_copy_string(targs.context, f->context, sizeof(targs.context));
 				/* Copy the numbers we're going to use into another list in case the master list should get modified 
 				   (and locked) while we're trying to do a follow-me */
-				AST_LIST_HEAD_INIT_NOLOCK(&targs.numbers);
+				AST_LIST_HEAD_INIT_NOLOCK(&targs.cnumbers);
 				AST_LIST_TRAVERSE(&f->numbers, nm, entry) {
 					newnm = create_followme_number(nm->number, nm->timeout);
-					AST_LIST_INSERT_TAIL(&targs.numbers, newnm, entry);
+					AST_LIST_INSERT_TAIL(&targs.cnumbers, newnm, entry);
 				}
 				ast_mutex_unlock(&f->lock);
 
@@ -834,8 +828,8 @@
 
 				findmeexec(&targs);		
 				
-				AST_LIST_TRAVERSE_SAFE_BEGIN(&targs.numbers, nm, entry)	{
-					AST_LIST_REMOVE_CURRENT(&targs.numbers, entry);
+				AST_LIST_TRAVERSE_SAFE_BEGIN(&targs.cnumbers, nm, entry)	{
+					AST_LIST_REMOVE_CURRENT(&targs.cnumbers, entry);
 					free(nm);
 				}
 				AST_LIST_TRAVERSE_SAFE_END



More information about the svn-commits mailing list