Skip to content

Commit

Permalink
Update XML CDR Extension Summary Queries #5979 (#6365)
Browse files Browse the repository at this point in the history
* Change labels to reflect new CC missed field

* Update extension summary queries

* Hide number alias field
  • Loading branch information
emak committed May 5, 2022
1 parent 4e2fe61 commit 2050d98
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
32 changes: 16 additions & 16 deletions app/xml_cdr/app_languages.php
Expand Up @@ -1260,26 +1260,26 @@
$text['label-number']['sv-se'] = "Nummer";
$text['label-number']['uk-ua'] = "Номер";

$text['label-no_answer']['en-us'] = "No Answer";
$text['label-no_answer']['en-gb'] = "No Answer";
$text['label-no_answer']['en-us'] = "CC Missed";
$text['label-no_answer']['en-gb'] = "CC Missed";
$text['label-no_answer']['ar-eg'] = "";
$text['label-no_answer']['de-at'] = "Keine Antwort"; //copied from de-de
$text['label-no_answer']['de-ch'] = "Keine Antwort"; //copied from de-de
$text['label-no_answer']['de-de'] = "Keine Antwort";
$text['label-no_answer']['es-cl'] = "Sin Respuesta";
$text['label-no_answer']['es-mx'] = "Sin Respuesta"; //copied from es-cl
$text['label-no_answer']['fr-ca'] = "Pas de Réponse"; //copied from fr-fr
$text['label-no_answer']['fr-fr'] = "Pas de Réponse";
$text['label-no_answer']['de-at'] = "Callcenter verpasst"; //copied from de-de
$text['label-no_answer']['de-ch'] = "Callcenter verpasst"; //copied from de-de
$text['label-no_answer']['de-de'] = "Callcenter verpasst";
$text['label-no_answer']['es-cl'] = "Centro de llamadas perdido";
$text['label-no_answer']['es-mx'] = "Centro de llamadas perdido"; //copied from es-cl
$text['label-no_answer']['fr-ca'] = "CD Manqué"; //copied from fr-fr
$text['label-no_answer']['fr-fr'] = "CD Manqué";
$text['label-no_answer']['he-il'] = "";
$text['label-no_answer']['it-it'] = "Mancata Risposta";
$text['label-no_answer']['it-it'] = "Call Center perso";
$text['label-no_answer']['nl-nl'] = "";
$text['label-no_answer']['pl-pl'] = "Brak odpowiedzi";
$text['label-no_answer']['pt-br'] = "Sem resposta";
$text['label-no_answer']['pt-pt'] = "Sem Resposta";
$text['label-no_answer']['pl-pl'] = "Nieodebrane Call Center";
$text['label-no_answer']['pt-br'] = "Central de atendimento perdida";
$text['label-no_answer']['pt-pt'] = "Central de atendimento perdida";
$text['label-no_answer']['ro-ro'] = "";
$text['label-no_answer']['ru-ru'] = "Нет ответа";
$text['label-no_answer']['sv-se'] = "Inget Svar";
$text['label-no_answer']['uk-ua'] = "Без відповіді";
$text['label-no_answer']['ru-ru'] = "Колл-центр пропустил";
$text['label-no_answer']['sv-se'] = "Callcenter missat";
$text['label-no_answer']['uk-ua'] = "Кол-центр пропущено";

$text['label-network_addr']['en-us'] = "Network Address";
$text['label-network_addr']['en-gb'] = "Network Address";
Expand Down
57 changes: 41 additions & 16 deletions app/xml_cdr/resources/classes/xml_cdr.php
Expand Up @@ -432,7 +432,7 @@ function ($matches) {
//call center
$this->array[$key]['cc_side'] = urldecode($xml->variables->cc_side);
$this->array[$key]['cc_member_uuid'] = urldecode($xml->variables->cc_member_uuid);
$this->array[$key]['cc_queue_joined_epoch'] = urldecode($xml->variables->cc_queue_joined_epoch);
$this->array[$key]['cc_queue'] = urldecode($xml->variables->cc_queue);
$this->array[$key]['cc_member_session_uuid'] = urldecode($xml->variables->cc_member_session_uuid);
$this->array[$key]['cc_agent_uuid'] = urldecode($xml->variables->cc_agent_uuid);
$this->array[$key]['cc_agent'] = urldecode($xml->variables->cc_agent);
Expand Down Expand Up @@ -1042,10 +1042,14 @@ public function user_summary() {
$sql .= "e.extension, \n";
$sql .= "e.number_alias, \n";

//answered
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and (answer_stamp is not null and bridge_uuid is not null) \n";
$sql .= " and hangup_cause != 'LOSE_RACE' \n";
$sql .= " and originating_leg_uuid IS NULL \n";
$sql .= " and (answer_stamp IS NOT NULL and bridge_uuid IS NOT NULL) \n";
$sql .= " and (cc_side IS NULL or cc_side !='agent')";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
Expand All @@ -1055,16 +1059,30 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as answered, \n";

//missed
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and missed_call = true \n";
if (!permission_exists('xml_cdr_enterprise_leg')) {
$sql .= " and originating_leg_uuid is null \n";
}
elseif (!permission_exists('xml_cdr_lose_race')) {
$sql .= " and hangup_cause <> 'LOSE_RACE' \n";
}
$sql .= " and hangup_cause != 'LOSE_RACE' \n";
$sql .= " and originating_leg_uuid IS NULL \n";

$sql .= " and ( \n";
$sql .= " ( \n";
$sql .= " missed_call = '1' \n";
$sql .= " and (cc_side is null or cc_side != 'agent') \n";
$sql .= " ) \n";

$sql .= " or ( \n";
$sql .= " (cc_side is null or cc_side != 'agent') \n";
$sql .= " and (answer_stamp is not null and bridge_uuid is null) \n";
$sql .= " ) \n";

$sql .= " or ( \n";
$sql .= " ((answer_stamp is null and bridge_uuid is null) \n";
$sql .= " and sip_hangup_disposition != 'send_refuse' ) \n";
$sql .= " or ( answer_stamp is not null and bridge_uuid is null and voicemail_message = false )) \n";
$sql .= " and (cc_side is null or cc_side != 'agent') \n";
$sql .= " ) \n";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') ";
} else {
Expand All @@ -1073,10 +1091,12 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as missed, \n";

//cc missed
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
$sql .= " and c.hangup_cause = 'NO_ANSWER' \n";
$sql .= " and (cc_side IS NOT NULL or cc_side ='agent')";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
Expand All @@ -1086,6 +1106,7 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as no_answer, \n";

//busy
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
Expand All @@ -1099,6 +1120,7 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as busy, \n";

//aloc
$sql .= "sum(c.billsec) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
Expand All @@ -1115,15 +1137,13 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as aloc, \n";

//inbound calls
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
if (!permission_exists('xml_cdr_enterprise_leg')) {
$sql .= " and originating_leg_uuid is null \n";
}
elseif (!permission_exists('xml_cdr_lose_race')) {
$sql .= " and hangup_cause <> 'LOSE_RACE' \n";
}
$sql .= " and hangup_cause != 'LOSE_RACE' \n";
$sql .= " and originating_leg_uuid IS NULL \n";
$sql .= " and (cc_side is null or cc_side != 'agent') \n";
if ($this->include_internal) {
$sql .= " and (direction = 'inbound' or direction = 'local') \n";
}
Expand All @@ -1133,6 +1153,7 @@ public function user_summary() {
$sql .= ") \n";
$sql .= "as inbound_calls, \n";

//inbound duration
$sql .= "sum(c.billsec) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
Expand All @@ -1144,6 +1165,7 @@ public function user_summary() {
}
$sql .= "as inbound_duration, \n";

//outbound duration
$sql .= "count(*) \n";
$sql .= "filter ( \n";
$sql .= " where c.extension_uuid = e.extension_uuid \n";
Expand Down Expand Up @@ -1173,7 +1195,10 @@ public function user_summary() {
$sql .= " start_stamp, \n";
$sql .= " hangup_cause, \n";
$sql .= " originating_leg_uuid, \n";
$sql .= " billsec \n";
$sql .= " billsec, \n";
$sql .= " cc_side, \n";
$sql .= " sip_hangup_disposition, \n";
$sql .= " voicemail_message \n";
$sql .= " from v_xml_cdr \n";
if (!($_GET['show'] === 'all' && permission_exists('xml_cdr_extension_summary_all'))) {
$sql .= " where domain_uuid = :domain_uuid \n";
Expand Down
4 changes: 2 additions & 2 deletions app/xml_cdr/xml_cdr_extension_summary.php
Expand Up @@ -192,7 +192,7 @@
echo " <th>".$text['label-domain']."</th>\n";
}
echo " <th>".$text['label-extension']."</th>\n";
echo " <th>".$text['label-number_alias']."</th>\n";
//echo " <th>".$text['label-number_alias']."</th>\n";
echo " <th class='center'>".$text['label-answered']."</th>\n";
echo " <th class='center'>".$text['label-missed']."</th>\n";
echo " <th class='center'>".$text['label-no_answer']."</th>\n";
Expand All @@ -212,7 +212,7 @@
echo " <td>".escape($row['domain_name'])."</td>\n";
}
echo " <td>".escape($row['extension'])."</td>\n";
echo " <td>".escape($row['number_alias'])."&nbsp;</td>\n";
//echo " <td>".escape($row['number_alias'])."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['answered'])."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['missed'])."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['no_answer'])."&nbsp;</td>\n";
Expand Down

0 comments on commit 2050d98

Please sign in to comment.