--- asterisk-1.2.14/apps/app_queue.c	2006-10-03 21:14:13.000000000 +0100
+++ ../asterisk-1.2.14/apps/app_queue.c	2007-01-21 00:54:00.000000000 +0000
@@ -327,6 +327,7 @@
 		unsigned int joinempty:2;
 		unsigned int eventwhencalled:1;
 		unsigned int leavewhenempty:2;
+		unsigned int ringinuse:1;
 		unsigned int reportholdtime:1;
 		unsigned int wrapped:1;
 		unsigned int timeoutrestart:1;
@@ -610,6 +611,7 @@
 	q->announceholdtime = 0;
 	q->roundingseconds = 0; /* Default - don't announce seconds */
 	q->servicelevel = 0;
+	q->ringinuse = 1;
 	q->moh[0] = '\0';
 	q->announce[0] = '\0';
 	q->context[0] = '\0';
@@ -744,6 +746,8 @@
 		q->timeout = atoi(val);
 		if (q->timeout < 0)
 			q->timeout = DEFAULT_TIMEOUT;
+	} else if (!strcasecmp(param, "ringinuse")) {
+		q->ringinuse = ast_true(val);
 	} else if (!strcasecmp(param, "monitor-join")) {
 		q->monjoin = ast_true(val);
 	} else if (!strcasecmp(param, "monitor-format")) {
@@ -1502,6 +1506,14 @@
 		return 0;
 	}
 	
+	if (!qe->parent->ringinuse && (tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "%s in use, can't receive call\n", tmp->interface);
+		if (qe->chan->cdr)
+			ast_cdr_busy(qe->chan->cdr);
+		tmp->stillgoing = 0;
+		return 0;
+	}
 	if (tmp->member->paused) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "%s paused, can't receive call\n", tmp->interface);
