app_queue: add new Service Level calculation

Adds a new formula for SL2 and documentation

ASTERISK-26559

Change-Id: I0970c620460507cd9d45b0d43600779c8915e770
changes/82/4682/2
Sebastian Gutierrez 9 years ago committed by Matthew Fredrickson
parent 059a54202c
commit 740ca862e4

@ -1668,6 +1668,7 @@ struct call_queue {
int talktime; /*!< Current avg talktime, based on the same exponential average */ int talktime; /*!< Current avg talktime, based on the same exponential average */
int callscompleted; /*!< Number of queue calls completed */ int callscompleted; /*!< Number of queue calls completed */
int callsabandoned; /*!< Number of queue calls abandoned */ int callsabandoned; /*!< Number of queue calls abandoned */
int callsabandonedinsl; /*!< Number of queue calls abandoned in servicelevel */
int servicelevel; /*!< seconds setting for servicelevel*/ int servicelevel; /*!< seconds setting for servicelevel*/
int callscompletedinsl; /*!< Number of calls answered with servicelevel*/ int callscompletedinsl; /*!< Number of calls answered with servicelevel*/
char monfmt[8]; /*!< Format to use when recording calls */ char monfmt[8]; /*!< Format to use when recording calls */
@ -4621,6 +4622,9 @@ static int say_periodic_announcement(struct queue_ent *qe, int ringing)
/*! \brief Record that a caller gave up on waiting in queue */ /*! \brief Record that a caller gave up on waiting in queue */
static void record_abandoned(struct queue_ent *qe) static void record_abandoned(struct queue_ent *qe)
{ {
int callabandonedinsl = 0;
time_t now;
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref); RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
pbx_builtin_setvar_helper(qe->chan, "ABANDONED", "TRUE"); pbx_builtin_setvar_helper(qe->chan, "ABANDONED", "TRUE");
@ -4633,6 +4637,13 @@ static void record_abandoned(struct queue_ent *qe)
"OriginalPosition", qe->opos, "OriginalPosition", qe->opos,
"HoldTime", (int)(time(NULL) - qe->start)); "HoldTime", (int)(time(NULL) - qe->start));
time(&now);
callabandonedinsl = ((now - qe->start) <= qe->parent->servicelevel);
if (callabandonedinsl) {
qe->parent->callsabandonedinsl++;
}
qe->parent->callsabandoned++; qe->parent->callsabandoned++;
ao2_unlock(qe->parent); ao2_unlock(qe->parent);
@ -9379,6 +9390,8 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
queue_iter = ao2_iterator_init(queues, AO2_ITERATOR_DONTLOCK); queue_iter = ao2_iterator_init(queues, AO2_ITERATOR_DONTLOCK);
while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) { while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
float sl; float sl;
float sl2;
struct call_queue *realtime_queue = NULL; struct call_queue *realtime_queue = NULL;
ao2_lock(q); ao2_lock(q);
@ -9411,12 +9424,16 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
ast_str_append(&out, 0, "unlimited"); ast_str_append(&out, 0, "unlimited");
} }
sl = 0; sl = 0;
sl2 = 0;
if (q->callscompleted > 0) { if (q->callscompleted > 0) {
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted); 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) {
int2strat(q->strategy), q->holdtime, q->talktime, q->weight, sl2 =100 * (((float)q->callsabandonedinsl + (float)q->callscompletedinsl) / ((float)q->callsabandoned + (float)q->callscompleted));
q->callscompleted, q->callsabandoned,sl,q->servicelevel); }
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, sl2, q->servicelevel);
do_print(s, fd, ast_str_buffer(out)); do_print(s, fd, ast_str_buffer(out));
if (!ao2_container_count(q->members)) { if (!ao2_container_count(q->members)) {
do_print(s, fd, " No Members"); do_print(s, fd, " No Members");
@ -9773,6 +9790,7 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
struct call_queue *q; struct call_queue *q;
struct queue_ent *qe; struct queue_ent *qe;
float sl = 0; float sl = 0;
float sl2 = 0;
struct member *mem; struct member *mem;
struct ao2_iterator queue_iter; struct ao2_iterator queue_iter;
struct ao2_iterator mem_iter; struct ao2_iterator mem_iter;
@ -9791,6 +9809,8 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
/* List queue properties */ /* List queue properties */
if (ast_strlen_zero(queuefilter) || !strcasecmp(q->name, queuefilter)) { if (ast_strlen_zero(queuefilter) || !strcasecmp(q->name, queuefilter)) {
sl = ((q->callscompleted > 0) ? 100 * ((float)q->callscompletedinsl / (float)q->callscompleted) : 0); 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" astman_append(s, "Event: QueueParams\r\n"
"Queue: %s\r\n" "Queue: %s\r\n"
"Max: %d\r\n" "Max: %d\r\n"
@ -9802,11 +9822,12 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
"Abandoned: %d\r\n" "Abandoned: %d\r\n"
"ServiceLevel: %d\r\n" "ServiceLevel: %d\r\n"
"ServicelevelPerf: %2.1f\r\n" "ServicelevelPerf: %2.1f\r\n"
"ServicelevelPerf2: %2.1f\r\n"
"Weight: %d\r\n" "Weight: %d\r\n"
"%s" "%s"
"\r\n", "\r\n",
q->name, q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->talktime, q->callscompleted, 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; ++q_items;
/* List Queue Members */ /* List Queue Members */

@ -113,8 +113,10 @@ monitor-type = MixMonitor
;strategy = ringall ;strategy = ringall
; ;
; Second settings for service level (default 0) ; Second settings for service level (default 0)
; Used for service level statistics (calls answered within service level time ; Used for service level statistics (calls answered within service level time frame)
; frame) ; There are 2 Service Level Performance Calculations SL and SL2
; SL = (total calls answered within threshold / total calls answered) * 100
; SL2 = ((calls answered within threshold + calls abandoned within threshold) / (answered calls + abandoned calls)) * 100
;servicelevel = 60 ;servicelevel = 60
; ;
; A context may be specified, in which if the user types a SINGLE ; A context may be specified, in which if the user types a SINGLE

Loading…
Cancel
Save