--- apps/app_queue.c.orig 2005-05-19 21:42:50.000000000 +0200 +++ apps/app_queue.c 2005-05-20 01:43:14.000000000 +0200 @@ -297,6 +297,7 @@ int count; /* How many entries */ int maxlen; /* Max number of entries */ int wrapuptime; /* Wrapup Time */ + int autologout; /* Autologout Time */ int retry; /* Retry calling everyone after this amount of time */ int timeout; /* How long to wait for an answer */ @@ -314,6 +315,8 @@ static struct ast_call_queue *queues = NULL; AST_MUTEX_DEFINE_STATIC(qlock); +static int remove_from_queue(char *queuename, char *interface); + static void set_queue_result(struct ast_channel *chan, enum queue_result res) { int i; @@ -1115,6 +1118,7 @@ int pos; struct ast_channel *winner; struct ast_channel *in = qe->chan; + time_t idletime; while(*to && !peer) { BUILD_WATCHERS; @@ -1316,8 +1320,21 @@ return NULL; } } - if (!*to && (option_verbose > 2)) - ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig); + if (!*to) { + if (option_verbose > 2) + ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig); + if (outgoing->member->lastcall > 0) + idletime=time(&idletime)-outgoing->member->lastcall; + else + idletime=0; + if (((outgoing->member->lastcall == 0) && (qe->parent->autologout != 0)) || + ((qe->parent->autologout != 0) && (qe->parent->autologout <= idletime))) { + if (option_verbose > 2) + ast_verbose( VERBOSE_PREFIX_3 "Removing Member %s From %s Due To Inactivity Idle %lds\n",outgoing->member->interface,qe->parent->name,idletime); + ast_log(LOG_NOTICE, "Removing Member %s From %s Due To Inactivity Idle %lds\n",outgoing->member->interface,qe->parent->name,idletime); + remove_from_queue(qe->parent->name,outgoing->member->interface); + } + } } return peer; @@ -2588,6 +2605,7 @@ q->callscompletedinsl = 0; q->servicelevel = 0; q->wrapuptime = 0; + q->autologout = 0; free_members(q, 0); q->moh[0] = '\0'; q->announce[0] = '\0'; @@ -2680,6 +2698,8 @@ q->retry = atoi(var->value); } else if (!strcasecmp(var->name, "wrapuptime")) { q->wrapuptime = atoi(var->value); + } else if (!strcasecmp(var->name, "autologout")) { + q->autologout = atoi(var->value); } else if (!strcasecmp(var->name, "maxlen")) { q->maxlen = atoi(var->value); } else if (!strcasecmp(var->name, "servicelevel")) {