[asterisk-commits] mmichelson: trunk r190250 - /trunk/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 23 12:45:43 CDT 2009


Author: mmichelson
Date: Thu Apr 23 12:45:35 2009
New Revision: 190250

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=190250
Log:
Fix reversed behavior of leavewhenempty option in queues.conf.

(closes issue #14650)
Reported by: alecdavis
Patches:
      14650.patch uploaded by mmichelson (license 60)
Tested by: mmichelson, lmadsen


Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_queue.c?view=diff&rev=190250&r1=190249&r2=190250
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Thu Apr 23 12:45:35 2009
@@ -1310,7 +1310,7 @@
 	return 0;
 }
 
-static void parse_empty_options(const char *value, enum empty_conditions *empty)
+static void parse_empty_options(const char *value, enum empty_conditions *empty, int joinempty)
 {
 	char *value_copy = ast_strdupa(value);
 	char *option = NULL;
@@ -1335,10 +1335,12 @@
 			*empty = (QUEUE_EMPTY_PENALTY | QUEUE_EMPTY_INVALID);
 		} else if (!strcasecmp(option, "strict")) {
 			*empty = (QUEUE_EMPTY_PENALTY | QUEUE_EMPTY_INVALID | QUEUE_EMPTY_PAUSED | QUEUE_EMPTY_UNAVAILABLE);
-		} else if (ast_false(option)) {
+		} else if ((ast_false(option) && joinempty) || (ast_true(option) && !joinempty)) {
 			*empty = (QUEUE_EMPTY_PENALTY | QUEUE_EMPTY_INVALID | QUEUE_EMPTY_PAUSED);
-		} else if (ast_true(option)) {
+		} else if ((ast_false(option) && !joinempty) || (ast_true(option) && joinempty)) {
 			*empty = 0;
+		} else {
+			ast_log(LOG_WARNING, "Unknown option %s for '%s'\n", option, joinempty ? "joinempty" : "leavewhenempty");
 		}
 	}
 }
@@ -1503,9 +1505,9 @@
 		}
 		q->strategy = strategy;
 	} else if (!strcasecmp(param, "joinempty")) {
-		parse_empty_options(val, &q->joinempty);
+		parse_empty_options(val, &q->joinempty, 1);
 	} else if (!strcasecmp(param, "leavewhenempty")) {
-		parse_empty_options(val, &q->leavewhenempty);
+		parse_empty_options(val, &q->leavewhenempty, 0);
 	} else if (!strcasecmp(param, "eventmemberstatus")) {
 		q->maskmemberstatus = !ast_true(val);
 	} else if (!strcasecmp(param, "eventwhencalled")) {




More information about the asterisk-commits mailing list