aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 20:30:13 +0000
committerautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 20:30:13 +0000
commit16302ff29c5b2d8da1a745d91e7a505785883118 (patch)
treea585c009eb4a1d8d4f6037229c4df5b7c1fd3bb8
parentd5bc312830cc0dba9088239f2818cffc97406c10 (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@74473 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_queue.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index cedf9983e..4b790b7f8 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1331,21 +1331,17 @@ static int say_position(struct queue_ent *qe)
return res;
}
-static void recalc_holdtime(struct queue_ent *qe)
+static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
{
- int oldvalue, newvalue;
+ int oldvalue;
/* Calculate holdtime using a recursive boxcar filter */
/* Thanks to SRT for this contribution */
/* 2^2 (4) is the filter coefficient; a higher exponent would give old entries more weight */
- newvalue = time(NULL) - qe->start;
-
ast_mutex_lock(&qe->parent->lock);
- if (newvalue <= qe->parent->servicelevel)
- qe->parent->callscompletedinsl++;
oldvalue = qe->parent->holdtime;
- qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
+ qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2;
ast_mutex_unlock(&qe->parent->lock);
}
@@ -2082,7 +2078,7 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
return res;
}
-static int update_queue(struct call_queue *q, struct member *member)
+static int update_queue(struct call_queue *q, struct member *member, int callcompletedinsl)
{
struct member *cur;
@@ -2099,6 +2095,8 @@ static int update_queue(struct call_queue *q, struct member *member)
cur = cur->next;
}
q->callscompleted++;
+ if (callcompletedinsl)
+ q->callscompletedinsl++;
ast_mutex_unlock(&q->lock);
return 0;
}
@@ -2179,6 +2177,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
time_t now = time(NULL);
struct ast_bridge_config bridge_config;
char nondataquality = 1;
+ int callcompletedinsl;
memset(&bridge_config, 0, sizeof(bridge_config));
time(&now);
@@ -2309,7 +2308,11 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
if (!strcmp(peer->type,"Zap"))
ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
/* Update parameters for the queue */
- recalc_holdtime(qe);
+ time(&now);
+ recalc_holdtime(qe, (now - qe->start));
+ ast_mutex_lock(&qe->parent->lock);
+ callcompletedinsl = ((now - qe->start) <= qe->parent->servicelevel);
+ ast_mutex_unlock(&qe->parent->lock);
member = lpeer->member;
hangupcalls(outgoing, peer);
outgoing = NULL;
@@ -2454,7 +2457,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
if (bridge != AST_PBX_NO_HANGUP_PEER)
ast_hangup(peer);
- update_queue(qe->parent, member);
+ update_queue(qe->parent, member, callcompletedinsl);
res = bridge ? bridge : 1;
}
out: