mod_callcenter add queue count agents with external calls

This commit is contained in:
António Silva 2021-03-11 12:27:12 +00:00
parent 2c2f2f9606
commit 55fd4ae950
1 changed files with 10 additions and 2 deletions

View File

@ -3518,7 +3518,7 @@ static int list_result_json_callback(void *pArg, int argc, char **argv, char **c
"\tcallcenter_config queue list members [queue_name] | \n" \ "\tcallcenter_config queue list members [queue_name] | \n" \
"\tcallcenter_config queue list tiers [queue_name] | \n" \ "\tcallcenter_config queue list tiers [queue_name] | \n" \
"\tcallcenter_config queue count | \n" \ "\tcallcenter_config queue count | \n" \
"\tcallcenter_config queue count agents [queue_name] [status] [state] | \n" \ "\tcallcenter_config queue count agents [queue_name] [status] [state] [external-calls]| \n" \
"\tcallcenter_config queue count members [queue_name] | \n" \ "\tcallcenter_config queue count members [queue_name] | \n" \
"\tcallcenter_config queue count tiers [queue_name]" "\tcallcenter_config queue count tiers [queue_name]"
@ -3959,6 +3959,7 @@ SWITCH_STANDARD_API(cc_config_api_function)
const char *queue_name = argv[1 + initial_argc]; const char *queue_name = argv[1 + initial_argc];
const char *status = NULL; const char *status = NULL;
const char *state = NULL; const char *state = NULL;
const char *external = NULL;
char res[256] = ""; char res[256] = "";
/* queue count agents */ /* queue count agents */
@ -3969,7 +3970,14 @@ SWITCH_STANDARD_API(cc_config_api_function)
if (argc-initial_argc > 3) { if (argc-initial_argc > 3) {
state = argv[3 + initial_argc]; state = argv[3 + initial_argc];
} }
if (state) { if (argc-initial_argc > 4) {
external = argv[4 + initial_argc];
}
if (external) {
sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q' AND agents.state = '%q' AND external_calls_count = '%d' ", queue_name, status, state, atoi(external));
}
else if (state) {
sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q' AND agents.state = '%q'", queue_name, status, state); sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q' AND agents.state = '%q'", queue_name, status, state);
} }
else if (status) { else if (status) {