Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 40948) +++ apps/app_queue.c (working copy) @@ -1,3 +1,7 @@ + + + + /* * Asterisk -- An open source telephony toolkit. * @@ -361,7 +365,7 @@ int retry; /*!< Retry calling everyone after this amount of time */ int timeout; /*!< How long to wait for an answer */ int weight; /*!< Respective weight */ - + int autopause; /*!< Auto pause queue members if they fail to answer */ /* Queue strategy things */ int rrpos; /*!< Round Robin - position */ int memberdelay; /*!< Seconds to delay connecting member to caller */ @@ -374,6 +378,8 @@ static struct call_queue *queues = NULL; AST_MUTEX_DEFINE_STATIC(qlock); +static int set_member_paused(char *queuename, char *interface, int paused); + static void set_queue_result(struct ast_channel *chan, enum queue_result res) { int i; @@ -781,6 +787,8 @@ q->retry = DEFAULT_RETRY; } else if (!strcasecmp(param, "wrapuptime")) { q->wrapuptime = atoi(val); + } else if (!strcasecmp(param, "autopause")) { + q->autopause = ast_true(val); } else if (!strcasecmp(param, "maxlen")) { q->maxlen = atoi(val); if (q->maxlen < 0) @@ -1755,6 +1763,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser *outgoing, int *to, char *digit, int prebusies, int caller_disconnect) { char *queue = qe->parent->name; + char on[256] = ""; struct localuser *o; int found; int numlines; @@ -1798,6 +1807,7 @@ peer = o; } } else if (o->chan && (o->chan == winner)) { + ast_copy_string(on, o->member->interface, sizeof(on)); if (!ast_strlen_zero(o->chan->call_forward)) { char tmpchan[256]=""; char *stuff; @@ -1976,8 +1986,21 @@ } ast_frfree(f); } - 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 (qe->parent->autopause) { + if (!set_member_paused(qe->parent->name, on, 1)) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", on, qe->parent->name); + } else { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", on, qe->parent->name); + } + } + } + /*if (!*to && (option_verbose > 2)) + ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);*/ } return peer; @@ -4027,3 +4050,4 @@ { return ASTERISK_GPL_KEY; } +