[Asterisk-code-review] app queue: add new Service Level calculation (asterisk[13])
scgm11
asteriskteam at digium.com
Sun Nov 6 06:38:50 CST 2016
scgm11 has uploaded a new change for review. ( https://gerrit.asterisk.org/4325 )
Change subject: app_queue: add new Service Level calculation
......................................................................
app_queue: add new Service Level calculation
Adds a new formula for SL2
ASTERISK-26559
Change-Id: I0970c620460507cd9d45b0d43600779c8915e770
---
M apps/app_queue.c
1 file changed, 22 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/25/4325/1
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 5fe9324..8bdc6dd 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1622,6 +1622,7 @@
int talktime; /*!< Current avg talktime, based on the same exponential average */
int callscompleted; /*!< Number of queue calls completed */
int callsabandoned; /*!< Number of queue calls abandoned */
+ int callsabandonedinsl; /*!< Number of queue calls abandoned in servicelevel */
int servicelevel; /*!< seconds setting for servicelevel*/
int callscompletedinsl; /*!< Number of calls answered with servicelevel*/
char monfmt[8]; /*!< Format to use when recording calls */
@@ -2734,6 +2735,7 @@
q->callscompleted = 0;
q->callsabandoned = 0;
q->callscompletedinsl = 0;
+ q->callsabandonedinsl = 0;
q->talktime = 0;
if (q->members) {
@@ -4601,6 +4603,12 @@
"Position", qe->pos,
"OriginalPosition", qe->opos,
"HoldTime", (int)(time(NULL) - qe->start));
+
+ time_t now;
+ time(&now);
+ int callabandonedinsl = ((now - qe->start) <= qe->parent->servicelevel);
+ if(callabandonedinsl)
+ qe->parent->callsabandonedinsl++;
qe->parent->callsabandoned++;
ao2_unlock(qe->parent);
@@ -9232,6 +9240,8 @@
queue_iter = ao2_iterator_init(queues, AO2_ITERATOR_DONTLOCK);
while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
float sl;
+ float sl2;
+
struct call_queue *realtime_queue = NULL;
ao2_lock(q);
@@ -9264,12 +9274,17 @@
ast_str_append(&out, 0, "unlimited");
}
sl = 0;
+ sl2 = 0;
if (q->callscompleted > 0) {
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
}
- ast_str_append(&out, 0, ") in '%s' strategy (%ds holdtime, %ds talktime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds",
+ if (q->callscompleted + q->callsabandoned > 0) {
+ sl2 =100 * (((float)q->callsabandonedinsl + (float)q->callscompletedinsl) / ((float)q->callsabandoned + (float)q->callscompleted));
+ }
+
+ ast_str_append(&out, 0, ") in '%s' strategy (%ds holdtime, %ds talktime), W:%d, C:%d, A:%d, SL:%2.1f%%, SL2:%2.1f%% within %ds",
int2strat(q->strategy), q->holdtime, q->talktime, q->weight,
- q->callscompleted, q->callsabandoned,sl,q->servicelevel);
+ q->callscompleted, q->callsabandoned,sl,sl2,q->servicelevel);
do_print(s, fd, ast_str_buffer(out));
if (!ao2_container_count(q->members)) {
do_print(s, fd, " No Members");
@@ -9616,6 +9631,7 @@
struct call_queue *q;
struct queue_ent *qe;
float sl = 0;
+ float sl2 = 0;
struct member *mem;
struct ao2_iterator queue_iter;
struct ao2_iterator mem_iter;
@@ -9634,6 +9650,8 @@
/* List queue properties */
if (ast_strlen_zero(queuefilter) || !strcasecmp(q->name, queuefilter)) {
sl = ((q->callscompleted > 0) ? 100 * ((float)q->callscompletedinsl / (float)q->callscompleted) : 0);
+ sl2 = (((q->callscompleted + q->callsabandoned) > 0) ? 100 * (((float)q->callsabandonedinsl + (float)q->callscompletedinsl) / ((float)q->callsabandoned + (float)q->callscompleted)) : 0);
+
astman_append(s, "Event: QueueParams\r\n"
"Queue: %s\r\n"
"Max: %d\r\n"
@@ -9645,11 +9663,12 @@
"Abandoned: %d\r\n"
"ServiceLevel: %d\r\n"
"ServicelevelPerf: %2.1f\r\n"
+ "ServicelevelPerf2: %2.1f\r\n"
"Weight: %d\r\n"
"%s"
"\r\n",
q->name, q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->talktime, q->callscompleted,
- q->callsabandoned, q->servicelevel, sl, q->weight, idText);
+ q->callsabandoned, q->servicelevel, sl, sl2, q->weight, idText);
++q_items;
/* List Queue Members */
--
To view, visit https://gerrit.asterisk.org/4325
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0970c620460507cd9d45b0d43600779c8915e770
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: scgm11 <scgm11 at gmail.com>
More information about the asterisk-code-review
mailing list