Only in apps: app_queue.20100505
diff -crB apps/app_queue.c apps-new/app_queue.c
*** apps/app_queue.c	2010-05-06 00:50:07.000000000 +0200
--- apps-new/app_queue.c	2010-05-06 00:50:31.000000000 +0200
***************
*** 122,127 ****
--- 122,133 ----
  	QUEUE_STRATEGY_RRMEMORY
  };
  
+ enum {
+   QUEUE_AUTOPAUSE_OFF = 0,
+   QUEUE_AUTOPAUSE_ON,
+   QUEUE_AUTOPAUSE_ALL
+ };
+ 
  static struct strategy {
  	int strategy;
  	char *name;
***************
*** 134,139 ****
--- 140,155 ----
  	{ QUEUE_STRATEGY_RRMEMORY, "rrmemory" },
  };
  
+ static const struct autopause {
+   int autopause;
+   const char *name;
+ } autopausesmodes [] = {
+   { QUEUE_AUTOPAUSE_OFF,"no" },
+   { QUEUE_AUTOPAUSE_ON, "yes" },
+   { QUEUE_AUTOPAUSE_ALL,"all" },
+ };
+ 
+ 
  #define DEFAULT_RETRY		5
  #define DEFAULT_TIMEOUT		15
  #define RECHECK			1		/* Recheck every second to see we we're at the top yet */
***************
*** 511,516 ****
--- 527,552 ----
  	return -1;
  }
  
+ static int autopause2int(const char *autopause)
+ {
+   int x;
+   /*This 'double check' that default value is OFF */
+   if (ast_strlen_zero(autopause))
+     return QUEUE_AUTOPAUSE_OFF;
+   
+   /*This 'double check' is to ensure old values works */
+   if(ast_true(autopause))
+     return QUEUE_AUTOPAUSE_ON;
+   
+   for (x = 0; x < ARRAY_LEN(autopausesmodes); x++) {
+     if (!strcasecmp(autopause, autopausesmodes[x].name))
+       return autopausesmodes[x].autopause;
+   }
+   
+   /*This 'double check' that default value is OFF */
+   return QUEUE_AUTOPAUSE_OFF;
+ }
+ 
  /*!
   * \brief removes a call_queue from the list of call_queues
   */
***************
*** 875,880 ****
--- 911,917 ----
  	q->eventwhencalled = 0;
  	q->weight = 0;
  	q->timeoutrestart = 0;
+ 	q->autopause = QUEUE_AUTOPAUSE_OFF;
  	if (!q->members)
  		q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);
  	q->membercount = 0;
***************
*** 1089,1095 ****
  		if (!strcasecmp(val, "mixmonitor"))
  			q->montype = 1;
  	} else if (!strcasecmp(param, "autopause")) {
! 		q->autopause = ast_true(val);
  	} else if (!strcasecmp(param, "maxlen")) {
  		q->maxlen = atoi(val);
  		if (q->maxlen < 0)
--- 1126,1132 ----
  		if (!strcasecmp(val, "mixmonitor"))
  			q->montype = 1;
  	} else if (!strcasecmp(param, "autopause")) {
! 	  q->autopause = autopause2int(val);
  	} else if (!strcasecmp(param, "maxlen")) {
  		q->maxlen = atoi(val);
  		if (q->maxlen < 0)
***************
*** 2182,2196 ****
  	if (option_verbose > 2)
  		ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", rnatime);
  	ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
! 	if (qe->parent->autopause && pause) {
! 		if (!set_member_paused(qe->parent->name, interface, 1)) {
! 			if (option_verbose > 2)
! 				ast_verbose( VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", interface, qe->parent->name);
! 		} else {
! 			if (option_verbose > 2)
! 				ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", interface, qe->parent->name);
! 		}
  	}
  	return;
  }
  
--- 2219,2243 ----
  	if (option_verbose > 2)
  		ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", rnatime);
  	ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
! 
! 	if (qe->parent->autopause != QUEUE_AUTOPAUSE_OFF && pause) {
! 	  if (qe->parent->autopause == QUEUE_AUTOPAUSE_ON) {
! 	    if (!set_member_paused(qe->parent->name, interface, 1)) {
! 	      ast_verbose(VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n",interface, qe->parent->name);
! 	    } else {
! 	      ast_verbose(VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", interface, qe->parent->name);
! 	    }
! 	  } else {
! 	    /* If queue autopause is mode all, just don't send any queue to stop.
! 	     * the function will stop in all queues */
! 	    if (!set_member_paused("", interface, 1)) {
! 	      ast_verbose(VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in all queues since they failed to answer on queue %s.\n",interface, qe->parent->name);
! 	    } else {
! 	      ast_verbose(VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in all queues!\n", interface);
! 	    }
! 	  }
  	}
+ 
  	return;
  }
  
