[Asterisk-cvs] asterisk/apps app_queue.c,1.85,1.86
russell at lists.digium.com
russell at lists.digium.com
Mon Sep 27 23:29:50 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv4392/apps
Modified Files:
app_queue.c
Log Message:
add ability to purge callers from queue if no agents are logged in
Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- app_queue.c 25 Sep 2004 14:22:27 -0000 1.85
+++ app_queue.c 28 Sep 2004 03:32:21 -0000 1.86
@@ -226,6 +226,7 @@
int wrapped; /* Round Robin - wrapped around? */
int joinempty; /* Do we care if the queue has no members? */
int eventwhencalled; /* Generate an event when the agent is called (before pickup) */
+ int leavewhenempty; /* If all agents leave the queue, remove callers from the queue */
struct member *members; /* Member channels to be tried */
struct queue_ent *head; /* Start of the actual queue */
@@ -912,6 +913,12 @@
break;
}
+ /* leave the queue if no agents, if enabled */
+ if (!(qe->parent->members) && qe->parent->leavewhenempty) {
+ leave_queue(qe);
+ break;
+ }
+
/* Make a position announcement, if enabled */
if (qe->parent->announcefrequency && !ringing)
say_position(qe);
@@ -1626,7 +1633,7 @@
/* This is the wait loop for the head caller*/
/* To exit, they may get their call answered; */
/* they may dial a digit from the queue context; */
- /* or, they may may timeout. */
+ /* or, they may timeout. */
/* Leave if we have exceeded our queuetimeout */
if (qe.queuetimeout && ( (time(NULL) - qe.start) >= qe.queuetimeout) ) {
@@ -1634,6 +1641,12 @@
break;
}
+ /* leave the queue if no agents, if enabled */
+ if (!((qe.parent)->members) && (qe.parent)->leavewhenempty) {
+ leave_queue(&qe);
+ break;
+ }
+
/* Make a position announcement, if enabled */
if (qe.parent->announcefrequency && !ringing)
say_position(&qe);
@@ -1872,6 +1885,8 @@
}
} else if (!strcasecmp(var->name, "joinempty")) {
q->joinempty = ast_true(var->value);
+ } else if (!strcasecmp(var->name, "leavewhenempty")) {
+ q->leavewhenempty = ast_true(var->value);
} else if (!strcasecmp(var->name, "eventwhencalled")) {
q->eventwhencalled = ast_true(var->value);
} else {
More information about the svn-commits
mailing list