forked from roramirez/qpanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-mod_callcenter-Realtime-counter-for-calls-in-a-queue.patch
105 lines (91 loc) · 5.53 KB
/
0001-mod_callcenter-Realtime-counter-for-calls-in-a-queue.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
From b62f3d09a4c86cf73eccd42597a6cc175905475c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= <[email protected]>
Date: Tue, 26 Jan 2016 00:40:04 -0300
Subject: [PATCH] mod_callcenter: Realtime counter for calls in a queue
Added counters for answered and abandoned calls for a queue.
Create two vars for cc_queue struct
- calls_answered
- calls_abandoned
These increases when the call is hangup.
This change also :
- refactor long lines of header and body to print the queue information.
- Update year in copyright
diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c
index 0b9e319..d439f44 100644
--- a/src/mod/applications/mod_callcenter/mod_callcenter.c
+++ b/src/mod/applications/mod_callcenter/mod_callcenter.c
@@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2014, Anthony Minessale II <[email protected]>
+ * Copyright (C) 2005-2016, Anthony Minessale II <[email protected]>
*
* Version: MPL 1.1
*
@@ -444,6 +444,8 @@ struct cc_queue {
uint32_t max_wait_time;
uint32_t max_wait_time_with_no_agent;
uint32_t max_wait_time_with_no_agent_time_reached;
+ uint32_t calls_answered;
+ uint32_t calls_abandoned;
switch_mutex_t *mutex;
@@ -722,6 +724,8 @@ static cc_queue_t *load_queue(const char *queue_name)
queue->last_agent_exist = 0;
queue->last_agent_exist_check = 0;
+ queue->calls_answered = 0;
+ queue->calls_abandoned = 0;
switch_mutex_init(&queue->mutex, SWITCH_MUTEX_NESTED, queue->pool);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added queue %s\n", queue->name);
@@ -2871,6 +2875,7 @@ SWITCH_STANDARD_APP(callcenter_function)
switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")),
switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")),
queue_name, cc_member_cancel_reason2str(h->member_cancel_reason));
+ queue->calls_abandoned++;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name);
@@ -2883,6 +2888,7 @@ SWITCH_STANDARD_APP(callcenter_function)
/* Update some channel variables for xml_cdr needs */
switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered");
+ queue->calls_answered++;
}
@@ -3300,7 +3306,12 @@ SWITCH_STANDARD_API(cc_config_api_function)
/* queue list */
if (argc-initial_argc < 1) {
switch_hash_index_t *hi;
- stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template\n");
+ stream->write_function(stream, "%s",
+ "name|strategy|moh_sound|time_base_score|tier_rules_apply|"\
+ "tier_rule_wait_second|tier_rule_wait_multiply_level|"\
+ "tier_rule_no_agent_no_wait|discard_abandoned_after|"\
+ "abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|"\
+ "max_wait_time_with_no_agent_time_reached|record_template|calls_answered|calls_abandoned\n");
switch_mutex_lock(globals.mutex);
for (hi = switch_core_hash_first(globals.queue_hash); hi; hi = switch_core_hash_next(&hi)) {
void *val = NULL;
@@ -3309,7 +3320,23 @@ SWITCH_STANDARD_API(cc_config_api_function)
cc_queue_t *queue;
switch_core_hash_this(hi, &key, &keylen, &val);
queue = (cc_queue_t *) val;
- stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->max_wait_time_with_no_agent_time_reached, queue->record_template);
+ stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s|%d|%d\n",
+ queue->name,
+ queue->strategy,
+ queue->moh,
+ queue->time_base_score,
+ (queue->tier_rules_apply?"true":"false"),
+ queue->tier_rule_wait_second,
+ (queue->tier_rule_wait_multiply_level?"true":"false"),
+ (queue->tier_rule_no_agent_no_wait?"true":"false"),
+ queue->discard_abandoned_after,
+ (queue->abandoned_resume_allowed?"true":"false"),
+ queue->max_wait_time,
+ queue->max_wait_time_with_no_agent,
+ queue->max_wait_time_with_no_agent_time_reached,
+ queue->record_template,
+ queue->calls_answered,
+ queue->calls_abandoned);
queue = NULL;
}
switch_mutex_unlock(globals.mutex);
--
2.1.4