summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorBJ Weschke <bweschke@btwtech.com>2006-05-25 00:11:30 +0000
committerBJ Weschke <bweschke@btwtech.com>2006-05-25 00:11:30 +0000
commit6848d55d8551bdf084cb8e0e87c6808980c85601 (patch)
treebbb4ecb62a8f86dd1f8a0943ed818ad598ac7bf2 /apps/app_queue.c
parenteefc9193e7cc5edd5ce2155b7a4d7dd6f744a7c6 (diff)
Make sure we catch all the instances where a member didn't answer the call sent to them rather than just on a timeout after a dial attempt and some minor code cleanup/reuse.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@30152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 4f244db53..a1d7e5b15 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1659,6 +1659,23 @@ static void record_abandoned(struct queue_ent *qe)
ast_mutex_unlock(&qe->parent->lock);
}
+static void rna(int rnatime, struct queue_ent *qe, char *membername)
+{
+
+ 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) {
+ if (!set_member_paused(qe->parent->name, membername, 1)) {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", membername, qe->parent->name);
+ } else {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", membername, qe->parent->name);
+ }
+ }
+ return;
+}
#define AST_MAX_WATCHERS 256
@@ -1677,6 +1694,10 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
struct ast_channel *winner;
struct ast_channel *in = qe->chan;
char on[256] = "";
+ long starttime = 0;
+ long endtime = 0;
+
+ starttime = (long)time(NULL);
while(*to && !peer) {
int numlines, retry, pos = 1;
@@ -1792,6 +1813,9 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
if (in->cdr)
ast_cdr_busy(in->cdr);
do_hang(o);
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
*to = orig;
@@ -1804,6 +1828,9 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_verbose( VERBOSE_PREFIX_3 "%s is circuit-busy\n", o->chan->name);
if (in->cdr)
ast_cdr_busy(in->cdr);
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
@@ -1831,6 +1858,9 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
}
ast_frfree(f);
} else {
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
@@ -1872,20 +1902,8 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
}
ast_frfree(f);
}
- if (!*to) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);
- ast_queue_log(qe->parent->name, qe->chan->uniqueid, on, "RINGNOANSWER", "%d", 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)
+ rna(orig, qe, on);
}
return peer;