Change app/call_center to app/call_centers.

This commit is contained in:
markjcrane
2015-08-03 16:09:38 -06:00
parent 1bd77f955e
commit 14e9c2743e
15 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,349 @@
<?php
//application details
$apps[$x]['name'] = "Call Center";
$apps[$x]['uuid'] = "95788e50-9500-079e-2807-fd530b0ea370";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Queues for managing inbound calls and routing those calls to available agents.";
$apps[$x]['description']['es-cl'] = "Colas pra administar las llamadas entrantes y enviarlas a los agentes disponibles";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "Files d'attente d'appels entrants distribu%uFFFDs aux agents disponibles.";
$apps[$x]['description']['fr-ca'] = "Queues pour envoyer les appels entrants vers les agents disponibles.";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "As filas servem para gerenciamento de chamadas de entrada e encaminhamento das mesmas para os agentes dispon%uFFFDveis.";
$apps[$x]['description']['pt-br'] = "";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "call_center_queue_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6c072b29-5b6c-49fc-008e-95e24c77de99";
$apps[$x]['permissions'][$y]['groups'][] = "agent";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_queue_add";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_queue_edit";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_queue_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_agent_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "597c483a-51a9-f95a-8d54-ea7d87ada2b8";
$apps[$x]['permissions'][$y]['groups'][] = "agent";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_agent_add";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_agent_edit";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_agent_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_tier_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6c072b29-5b6c-49fc-008e-95e24c77de99";
$apps[$x]['permissions'][$y]['groups'][] = "agent";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_tier_add";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_tier_edit";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_tier_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_log_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "6c072b29-5b6c-49fc-008e-95e24c77de99";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_log_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_log_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_center_log_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_call_center_agents";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "call_center_agent_id";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "serial";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "integer";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "INT NOT NULL AUTO_INCREMENT";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_center_agent_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "v_id";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_call_timeout";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_id";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_password";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_contact";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_status";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_logout";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_max_no_answer";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_wrap_up_time";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_reject_delay_time";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_busy_delay_time";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_no_answer_delay_time";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_call_center_queues";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "call_center_queue_id";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "serial";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "integer";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "INT NOT NULL AUTO_INCREMENT";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_center_queue_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dialplan_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_dialplans";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "dialplan_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "v_id";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_extension";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_strategy";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_moh_sound";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_record_template";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_time_base_score";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_max_wait_time";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_max_wait_time_with_no_agent";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_max_wait_time_with_no_agent_time_reached";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rules_apply";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_wait_second";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_no_agent_no_wait";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_timeout_action";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_discard_abandoned_after";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_abandoned_resume_allowed";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_tier_rule_wait_multiply_level";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_cid_prefix";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_announce_sound";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_announce_frequency";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_description";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_call_center_tiers";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "call_center_tier_id";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "serial";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "integer";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "INT NOT NULL AUTO_INCREMENT";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_center_tier_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "v_id";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "agent_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "tier_level";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "tier_position";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
?>

View File

@@ -0,0 +1,68 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//process this only one time
if ($domains_processed == 1) {
//add switch call_center dir if it is missing
$sql = "select count(*) as num_rows from v_default_settings ";
$sql .= "where default_setting_category = 'switch' ";
$sql .= "and default_setting_subcategory = 'call_center' ";
$sql .= "and default_setting_name = 'dir' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_default_settings ";
$sql .= "(";
$sql .= "default_setting_uuid, ";
$sql .= "default_setting_category, ";
$sql .= "default_setting_subcategory, ";
$sql .= "default_setting_name, ";
$sql .= "default_setting_value, ";
$sql .= "default_setting_enabled, ";
$sql .= "default_setting_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'switch', ";
$sql .= "'call_center', ";
$sql .= "'dir', ";
$sql .= "'".$_SESSION['switch']['conf']['dir']."/autoload_configs', ";
$sql .= "'true', ";
$sql .= "'' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
unset($prep_statement, $row);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Call Center";
$apps[$x]['menu'][0]['title']['es-cl'] = "Centro de Llamadas";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Centre d'appel";
$apps[$x]['menu'][0]['title']['fr-ca'] = "Centre d' appels";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Centro de Chamadas";
$apps[$x]['menu'][0]['title']['pt-br'] = "Centro de chamadas";
$apps[$x]['menu'][0]['title']['pl'] = "Call Center ";
$apps[$x]['menu'][0]['title']['sv-se'] = "Call Center";
$apps[$x]['menu'][0]['title']['uk'] = "Кол-центр";
$apps[$x]['menu'][0]['title']['de-at'] = "Callcenter";
$apps[$x]['menu'][0]['uuid'] = "6c072b29-5b6c-49fc-008e-95e24c77de99";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/call_center/call_center_queues.php";
$apps[$x]['menu'][0]['groups'][] = "agent";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
$apps[$x]['menu'][1]['title']['en-us'] = "Agent Status";
$apps[$x]['menu'][1]['title']['es-cl'] = "Estado de Agente";
$apps[$x]['menu'][1]['title']['fr-fr'] = "État de l'agent";
$apps[$x]['menu'][1]['title']['pt-pt'] = "Estado do Agente";
$apps[$x]['menu'][1]['title']['pt-br'] = "Estado do agente";
$apps[$x]['menu'][1]['title']['pl'] = "Status agenta";
$apps[$x]['menu'][1]['title']['sv-se'] = "Agent Status";
$apps[$x]['menu'][1]['title']['uk'] = "Статус оператора";
$apps[$x]['menu'][1]['title']['de-at'] = "Agenten Status";
$apps[$x]['menu'][1]['uuid'] = "597c483a-51a9-f95a-8d54-ea7d87ada2b8";
$apps[$x]['menu'][1]['parent_uuid'] = "0438b504-8613-7887-c420-c837ffb20cb1";
$apps[$x]['menu'][1]['category'] = "internal";
$apps[$x]['menu'][1]['path'] = "/app/call_center/call_center_agent_status.php";
$apps[$x]['menu'][1]['groups'][] = "agent_admin";
$apps[$x]['menu'][1]['groups'][] = "admin";
$apps[$x]['menu'][1]['groups'][] = "superadmin";
?>

View File

@@ -0,0 +1,95 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_agent_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//get the agent details
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
break; //limit to 1 row
}
unset ($prep_statement);
//delete the agent from the freeswitch
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//delete the agent over event socket
if ($fp) {
$cmd = "api callcenter_config agent del ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
$response = event_socket_request($fp, $cmd);
}
//delete the agent from db
if (strlen($id)>0) {
//tiers table
$sql = "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and agent_name = '$agent_name' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//agents table
$sql = "delete from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//synchronize configuration
save_call_center_xml();
//redirect the browser
$_SESSION["message"] = $text['message-delete'];
header("Location: call_center_agents.php");
return;
?>

View File

@@ -0,0 +1,607 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_agent_add') || permission_exists('call_center_agent_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//check for duplicates
if ($_GET["check"] == 'duplicate') {
//agent id
if ($_GET["agent_id"] != '') {
$sql = "select ";
$sql .= "agent_name ";
$sql .= "from ";
$sql .= "v_call_center_agents ";
$sql .= "where ";
$sql .= "agent_id = '".check_str($_GET["agent_id"])."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
if ($_GET["agent_uuid"] != '') {
$sql .= " and call_center_agent_uuid <> '".check_str($_GET["agent_uuid"])."' ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['agent_name'] != '') {
echo $text['message-duplicate_agent_id'].((if_group("superadmin")) ? ": ".$row["agent_name"] : null);
}
}
unset($prep_statement);
}
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_center_agent_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$agent_name = check_str($_POST["agent_name"]);
$agent_type = check_str($_POST["agent_type"]);
$agent_call_timeout = check_str($_POST["agent_call_timeout"]);
$agent_id = check_str($_POST["agent_id"]);
$agent_password = check_str($_POST["agent_password"]);
$agent_contact = check_str($_POST["agent_contact"]);
$agent_status = check_str($_POST["agent_status"]);
//$agent_logout = check_str($_POST["agent_logout"]);
$agent_no_answer_delay_time = check_str($_POST["agent_no_answer_delay_time"]);
$agent_max_no_answer = check_str($_POST["agent_max_no_answer"]);
$agent_wrap_up_time = check_str($_POST["agent_wrap_up_time"]);
$agent_reject_delay_time = check_str($_POST["agent_reject_delay_time"]);
$agent_busy_delay_time = check_str($_POST["agent_busy_delay_time"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_center_agent_uuid = check_str($_POST["call_center_agent_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
//if (strlen($agent_name) == 0) { $msg .= $text['message-required'].$text['label-agent_name']."<br>\n"; }
//if (strlen($agent_type) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($agent_call_timeout) == 0) { $msg .= $text['message-required'].$text['label-call_timeout']."<br>\n"; }
//if (strlen($agent_contact) == 0) { $msg .= $text['message-required'].$text['label-contact']."<br>\n"; }
//if (strlen($agent_status) == 0) { $msg .= $text['message-required'].$text['label-status']."<br>\n"; }
//if (strlen($agent_logout) == 0) { $msg .= $text['message-required'].$text['label-agent_logout']."<br>\n"; }
//if (strlen($agent_no_answer_delay_time) == 0) { $msg .= $text['message-required'].$text['label-no_answer_delay_time']."<br>\n"; }
//if (strlen($agent_max_no_answer) == 0) { $msg .= $text['message-required'].$text['label-max_no_answer']."<br>\n"; }
//if (strlen($agent_wrap_up_time) == 0) { $msg .= $text['message-required'].$text['label-wrap_up_time']."<br>\n"; }
//if (strlen($agent_reject_delay_time) == 0) { $msg .= $text['message-required'].$text['label-reject_delay_time']."<br>\n"; }
//if (strlen($agent_busy_delay_time) == 0) { $msg .= $text['message-required'].$text['label-busy_delay_time']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//get and then set the complete agent_contact with the call_timeout and when necessary confirm
//if you change this variable, also change resources/switch.php
$tmp_confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=".$agent_call_timeout;
if(strstr($agent_contact, '}') === FALSE) {
//not found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//add the call_timeout
$tmp_agent_contact = "{call_timeout=".$agent_call_timeout."}".$agent_contact;
}
else {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
$tmp_agent_contact = "{".$tmp_confirm.",call_timeout=".$agent_call_timeout."}".$agent_contact;
echo "\n\n".$tmp_agent_contact."\n\n";
}
}
else {
//found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//not found
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
}
else {
//the string has the call timeout
$tmp_agent_contact = $agent_contact;
}
}
else {
//found
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.',call_timeout='.$agent_call_timeout.$tmp_last;
}
else {
//add confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.$tmp_last;
}
}
}
//set the user_status
$sql = "update v_users set ";
$sql .= "user_status = '".$agent_status."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and username = '".$agent_name."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
//add the agent
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//add the agent using event socket
if ($fp) {
//add the agent
$cmd = "api callcenter_config agent add ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_type;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set contact
$cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$tmp_agent_contact;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set status
$cmd = "api callcenter_config agent set status ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." '".$agent_status."'";
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set reject_delay_time
$cmd = "api callcenter_config agent set reject_delay_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_reject_delay_time;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set busy_delay_time
$cmd = "api callcenter_config agent set busy_delay_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_busy_delay_time;
$response = event_socket_request($fp, $cmd);
//agent set no_answer_delay_time
$cmd = "api callcenter_config agent set no_answer_delay_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_no_answer_delay_time;
$response = event_socket_request($fp, $cmd);
//agent set max_no_answer
$cmd = "api callcenter_config agent set max_no_answer ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_max_no_answer;
$response = event_socket_request($fp, $cmd);
//agent set wrap_up_time
$cmd = "api callcenter_config agent set wrap_up_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_wrap_up_time;
$response = event_socket_request($fp, $cmd);
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
//add the agent to the database
$call_center_agent_uuid = uuid();
$sql = "insert into v_call_center_agents ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_center_agent_uuid, ";
$sql .= "agent_name, ";
$sql .= "agent_type, ";
$sql .= "agent_call_timeout, ";
$sql .= "agent_id, ";
$sql .= "agent_password, ";
$sql .= "agent_contact, ";
$sql .= "agent_status, ";
//$sql .= "agent_logout, ";
$sql .= "agent_no_answer_delay_time, ";
$sql .= "agent_max_no_answer, ";
$sql .= "agent_wrap_up_time, ";
$sql .= "agent_reject_delay_time, ";
$sql .= "agent_busy_delay_time ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_center_agent_uuid', ";
$sql .= "'$agent_name', ";
$sql .= "'$agent_type', ";
$sql .= "'$agent_call_timeout', ";
$sql .= "'$agent_id', ";
$sql .= "'$agent_password', ";
$sql .= "'$agent_contact', ";
$sql .= "'$agent_status', ";
//$sql .= "'$agent_logout', ";
$sql .= "'$agent_no_answer_delay_time', ";
$sql .= "'$agent_max_no_answer', ";
$sql .= "'$agent_wrap_up_time', ";
$sql .= "'$agent_reject_delay_time', ";
$sql .= "'$agent_busy_delay_time' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
$_SESSION["message"] = $text['message-add'];
header("Location: call_center_agents.php");
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_call_center_agents set ";
$sql .= "agent_name = '$agent_name', ";
$sql .= "agent_type = '$agent_type', ";
$sql .= "agent_call_timeout = '$agent_call_timeout', ";
$sql .= "agent_id = '$agent_id', ";
$sql .= "agent_password = '$agent_password', ";
$sql .= "agent_contact = '$agent_contact', ";
$sql .= "agent_status = '$agent_status', ";
//$sql .= "agent_logout = '$agent_logout', ";
$sql .= "agent_no_answer_delay_time = '$agent_no_answer_delay_time', ";
$sql .= "agent_max_no_answer = '$agent_max_no_answer', ";
$sql .= "agent_wrap_up_time = '$agent_wrap_up_time', ";
$sql .= "agent_reject_delay_time = '$agent_reject_delay_time', ";
$sql .= "agent_busy_delay_time = '$agent_busy_delay_time' ";
$sql .= "where domain_uuid = '$domain_uuid'";
$sql .= "and call_center_agent_uuid = '$call_center_agent_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
$_SESSION["message"] = $text['message-update'];
header("Location: call_center_agents.php");
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$call_center_agent_uuid = $_GET["id"];
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$call_center_agent_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
$agent_type = $row["agent_type"];
$agent_call_timeout = $row["agent_call_timeout"];
$agent_id = $row["agent_id"];
$agent_password = $row["agent_password"];
$agent_contact = $row["agent_contact"];
$agent_status = $row["agent_status"];
//$agent_logout = $row["agent_logout"];
$agent_no_answer_delay_time = $row["agent_no_answer_delay_time"];
$agent_max_no_answer = $row["agent_max_no_answer"];
$agent_wrap_up_time = $row["agent_wrap_up_time"];
$agent_reject_delay_time = $row["agent_reject_delay_time"];
$agent_busy_delay_time = $row["agent_busy_delay_time"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//set default values
if (strlen($agent_type) == 0) { $agent_type = "callback"; }
if (strlen($agent_call_timeout) == 0) { $agent_call_timeout = "15"; }
if (strlen($agent_max_no_answer) == 0) { $agent_max_no_answer = "0"; }
if (strlen($agent_wrap_up_time) == 0) { $agent_wrap_up_time = "10"; }
if (strlen($agent_no_answer_delay_time) == 0) { $agent_no_answer_delay_time = "30"; }
if (strlen($agent_reject_delay_time) == 0) { $agent_reject_delay_time = "90"; }
if (strlen($agent_busy_delay_time) == 0) { $agent_busy_delay_time = "90"; }
//show the header
require_once "resources/header.php";
if ($action == "add") {
$document['title'] = $text['title-call_center_agent_add'];
}
if ($action == "update") {
$document['title'] = $text['title-call_center_agent_edit'];
}
//javascript to check for duplicates
?>
<script language="javascript">
function check_duplicates() {
//check agent id
var agent_id = document.getElementById('agent_id').value;
$("#duplicate_agent_id_response").load("call_center_agent_edit.php?check=duplicate&agent_id="+agent_id+"&agent_uuid=<?php echo $call_center_agent_uuid;?>", function() {
var duplicate_agent_id = false;
if ($("#duplicate_agent_id_response").html() != '') {
$('#agent_id').addClass('formfld_highlight_bad');
display_message($("#duplicate_agent_id_response").html(), 'negative'<?php if (if_group("superadmin")) { echo ', 3000'; } ?>);
duplicate_agent_id = true;
}
else {
$("#duplicate_agent_id_response").html('');
$('#agent_id').removeClass('formfld_highlight_bad');
duplicate_agent_id = false;
}
if (duplicate_agent_id == false) {
document.getElementById('frm').submit();
}
});
}
</script>
<?php
//show the content
echo "<form method='post' name='frm' id='frm' action='' onsubmit='check_duplicates(); return false;'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-call_center_agent_add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-call_center_agent_edit']."</b></td>\n";
}
echo "<td width='70%' align='right'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='call_center_agents.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-agent_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_enabled = 'true' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"agent_name\" name=\"agent_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[username] == $agent_name) {
echo "<option value='".$field[username]."' selected='selected'>".$field[username]."</option>\n";
}
else {
echo "<option value='".$field[username]."'>".$field[username]."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo $text['description-agent_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-type']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_type' maxlength='255' value=\"$agent_type\" pattern='^(callback|uuid-standby)$'>\n";
echo "<br />\n";
echo $text['description-type']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-call_timeout']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_call_timeout' maxlength='255' min='1' step='1' value='$agent_call_timeout'>\n";
echo "<br />\n";
echo $text['description-call_timeout']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-agent_id']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_id' id='agent_id' maxlength='255' min='1' step='1' value='$agent_id'>\n";
echo " <div style='display: none;' id='duplicate_agent_id_response'></div>\n";
echo "<br />\n";
echo $text['description-agent_id']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-agent_password']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='password' name='agent_password' autocomplete='off' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!\$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' min='1' step='1' value='$agent_password'>\n";
echo "<br />\n";
echo $text['description-agent_password']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
switch_select_destination("call_center_contact", "", "agent_contact", $agent_contact, "width: 350px;", "");
echo "<br />\n";
echo $text['description-contact']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-status']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='agent_status'>\n";
if ($agent_status == "Logged Out") {
echo " <option value='Logged Out' SELECTED >".$text['option-logged_out']."</option>\n";
}
else {
echo " <option value='Logged Out'>".$text['option-logged_out']."</option>\n";
}
if ($agent_status == "Available") {
echo " <option value='Available' SELECTED >".$text['option-available']."</option>\n";
}
else {
echo " <option value='Available'>".$text['option-available']."</option>\n";
}
if ($agent_status == "Available (On Demand)") {
echo " <option value='Available (On Demand)' SELECTED >".$text['option-available_on_demand']."</option>\n";
}
else {
echo " <option value='Available (On Demand)'>".$text['option-available_on_demand']."</option>\n";
}
if ($agent_status == "On Break") {
echo " <option value='On Break' SELECTED >".$text['option-on_break']."</option>\n";
}
else {
echo " <option value='On Break'>".$text['option-on_break']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-status']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-no_answer_delay_time']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_no_answer_delay_time' maxlength='255' min='1' step='1' value='$agent_no_answer_delay_time'>\n";
echo "<br />\n";
echo $text['description-no_answer_delay_time']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-max_no_answer']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_max_no_answer' maxlength='255' min='0' step='1' value='$agent_max_no_answer'>\n";
echo "<br />\n";
echo $text['description-max_no_answer']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-wrap_up_time']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_wrap_up_time' maxlength='255' min='1' step='1' value='$agent_wrap_up_time'>\n";
echo "<br />\n";
echo $text['description-wrap_up_time']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-reject_delay_time']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_reject_delay_time' maxlength='255' min='1' step='1' value='$agent_reject_delay_time'>\n";
echo "<br />\n";
echo $text['description-reject_delay_time']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-busy_delay_time']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='agent_busy_delay_time' maxlength='255' min='1' step='1' value='$agent_busy_delay_time'>\n";
echo "<br />\n";
echo $text['description-busy_delay_time']."\n";
echo "</td>\n";
echo "</tr>\n";
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-agent_logout']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_logout' maxlength='255' value='$agent_logout'>\n";
echo "<br />\n";
echo $text['description-agent_logout']."\n";
echo "</td>\n";
echo "</tr>\n";
*/
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='call_center_agent_uuid' value='$call_center_agent_uuid'>\n";
}
echo " <br />";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
//footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,241 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_agent_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//includes and title
require_once "resources/header.php";
$document['title'] = $text['title-call_center_agent_status'];
require_once "resources/paging.php";
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the http post values and set them as php variables
if (count($_POST) > 0) {
//include the dnd php class
include PROJECT_PATH."/app/calls/resources/classes/do_not_disturb.php";
foreach($_POST['agents'] as $row) {
if (strlen($row['agent_status']) > 0) {
//agent set status
if ($fp) {
//set the user_status
$sql = "update v_users set ";
$sql .= "user_status = '".$row['agent_status']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and username = '".$row['agent_name']."' ";
//echo $sql."\n";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
//set the call center status
if ($row['agent_status'] == "Do Not Disturb") {
//set the default dnd action
$dnd_action = "add";
//set the call center status to Logged Out
$cmd = "api callcenter_config agent set status ".$row['agent_name']."@".$_SESSION['domains'][$domain_uuid]['domain_name']." 'Logged Out'";
}
else {
$cmd = "api callcenter_config agent set status ".$row['agent_name']."@".$_SESSION['domains'][$domain_uuid]['domain_name']." '".$row['agent_status']."'";
}
$response = event_socket_request($fp, $cmd);
//echo $cmd."\n";
usleep(200);
}
//loop through the list of assigned extensions
//foreach ($_SESSION['user']['extension'] as &$sub_row) {
// //update dnd
// $dnd = new do_not_disturb;
// //$dnd->debug = false;
// $dnd->domain_uuid = $domain_uuid;
// $dnd->domain_name = $_SESSION['domain_name'];
// $dnd->extension = $sub_row["user"];
// if ($row['status'] == "Do Not Disturb") {
// $dnd->enabled = "true";
// }
// else {
// $dnd->enabled = "false";
// }
// $dnd->set();
// unset($dnd);
//}
//unset ($prep_statement);
}
}
}
//get the agents from the database
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$agents = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get the agent list from event socket
$switch_cmd = 'callcenter_config agent list';
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$call_center_agents = csv_to_named_array($event_socket_str, '|');
//echo "<pre>\n";
//print_r($call_center_agents);
//echo "</pre>\n";
//get the agent status from mod_callcenter and update the agent status in the agents array
$x = 0;
foreach ($agents as $row) {
//add the domain name
$domain_name = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
$agents[$x]['domain_name'] = $domain_name;
//update the agent status
foreach ($call_center_agents as $r) {
if ($r['name'] == $row[agent_name].'@'.$domain_name) {
$agents[$x]['agent_status'] = $r['status'];
}
}
//increment x
$x++;
}
//echo "<pre>\n";
//print_r($agents);
//echo "</pre>\n";
//set the status on the user_array by using the extension as the key
//foreach ($call_center_agents as $row) {
// if (count($_SESSION['domains']) == 1) {
// //get the extension status from the call center agent list
// preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
// $extension = $matches[1];
// $user_array[$extension]['username'] = $tmp[0];
// if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
// $user_array[$extension]['user_status'] = $row['status'];
// }
// } else {
// $tmp = explode('@',$row["name"]);
// if ($tmp[1] == $_SESSION['domain_name']) {
// //get the extension status from the call center agent list
// preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
// $extension = $matches[1];
// $user_array[$extension]['username'] = $tmp[0];
// if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
// $user_array[$extension]['user_status'] = $row['status'];
// }
// }
// }
//}
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-call_center_agent_status']."</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='call_center_queues.php'\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-refresh']."' onclick=\"window.location='call_center_agent_status.php'\" value='".$text['button-refresh']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo $text['description-call_center_agent_status']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-agent']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-options']."</th>\n";
echo "<tr>\n";
$x = 0;
foreach($agents as $row) {
$str = '';
$str .= "<tr >\n";
$str .= " <td valign='middle' class='".$row_style[$c]."'>".$row['agent_name']."&nbsp;</td>\n";
$str .= " <td valign='middle' class='".$row_style[$c]."'>".$row['agent_status']."&nbsp;</td>\n";
$str .= " <td valign='middle' class='".$row_style[$c]."'>";
$str .= " <input type='hidden' name='agents[".$x."][agent_name]' id='agent_".$x."_name' value='".$row['agent_name']."'>\n";
$str .= " <input type='hidden' name='agents[".$x."][id]' id='agent_".$x."_name' value='".$row['call_center_agent_uuid']."'>\n";
$str .= " <input type='radio' name='agents[".$x."][agent_status]' id='agent_".$x."_status_no_change' value='' checked='checked'><label for='agent_".$x."_status_no_change'>".$text['option-no_change']."</label>\n";
$str .= " <input type='radio' name='agents[".$x."][agent_status]' id='agent_".$x."_status_available' value='Available'><label for='agent_".$x."_status_available'>".$text['option-available']."</label>\n";
$str .= " <input type='radio' name='agents[".$x."][agent_status]' id='agent_".$x."_status_logged_out' value='Logged Out'><label for='agent_".$x."_status_logged_out'>".$text['option-logged_out']."</label>\n";
$str .= " <input type='radio' name='agents[".$x."][agent_status]' id='agent_".$x."_status_on_break' value='On Break'><label for='agent_".$x."_status_on_break'>".$text['option-on_break']."</label>\n";
//$str .= " <input type='radio' name='agents[".$x."][agent_status]' id='agent_".$x."_status_dnd' value='Do Not Disturb'><label for='agent_".$x."_status_dnd'>".$text['option-do_not_disturb']."</label>\n";
$str .= " </td>\n";
$str .= "</tr>\n";
if (count($_SESSION['domains']) > 1) {
if ($row['domain_name'] == $_SESSION['domain_name']) {
echo $str;
if ($c==0) { $c=1; } else { $c=0; }
}
}
else {
echo $str;
if ($c==0) { $c=1; } else { $c=0; }
}
$x++;
} //end foreach
unset($sql, $result, $row_count);
echo "<tr>\n";
echo "<td colspan='11' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
echo " <br />\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-update_status']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
echo "</form>\n";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,204 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_agent_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//includes and title
require_once "resources/header.php";
$document['title'] = $text['title-call_center_agents'];
require_once "resources/paging.php";
//get http values and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-call_center_agents']."</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='call_center_queues.php'\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-status']."' onclick=\"window.location='call_center_agent_status.php'\" value='".$text['button-status']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo $text['description-call_center_agents']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'agent_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'agent_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
//echo th_order_by('domain_uuid', 'domain_uuid', $order_by, $order);
echo th_order_by('agent_name', $text['label-agent_name'], $order_by, $order);
echo th_order_by('agent_id', $text['label-agent_id'], $order_by, $order);
echo th_order_by('agent_type', $text['label-type'], $order_by, $order);
echo th_order_by('agent_call_timeout', $text['label-call_timeout'], $order_by, $order);
echo th_order_by('agent_contact', $text['label-contact'], $order_by, $order);
echo th_order_by('agent_max_no_answer', $text['label-max_no_answer'], $order_by, $order);
echo th_order_by('agent_status', $text['label-default_status'], $order_by, $order);
//echo th_order_by('agent_wrap_up_time', $text['label-wrap_up_time'], $order_by, $order);
//echo th_order_by('agent_reject_delay_time', $text['label-reject_delay_time'], $order_by, $order);
//echo th_order_by('agent_busy_delay_time', $text['label-busy_delay_time'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('call_center_agent_add')) {
echo "<a href='call_center_agent_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count == 0) { //no results
}
else { //received results
foreach($result as $row) {
$tr_link = (permission_exists('call_center_agent_edit')) ? "href='call_center_agent_edit.php?id=".$row['call_center_agent_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[domain_uuid]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('call_center_agent_edit')) {
echo "<a href='call_center_agent_edit.php?id=".$row['call_center_agent_uuid']."'>".$row['agent_name']."</a>";
}
else {
echo $row['agent_name'];
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['agent_id']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['agent_type']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['agent_call_timeout']."&nbsp;</td>\n";
$agent_contact = $row['agent_contact'];
// parse out gateway uuid
$bridge_statement = explode('/', $row['agent_contact']);
if ($bridge_statement[0] == 'sofia' && $bridge_statement[1] == 'gateway' && is_uuid($bridge_statement[2])) {
// retrieve gateway name from db
$sql = "select gateway from v_gateways where gateway_uuid = '".$bridge_statement[2]."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
$gateway_name = $result[0]['gateway'];
$agent_contact = str_replace($bridge_statement[2], $gateway_name, $agent_contact);
}
unset ($prep_statement, $sql, $bridge_statement);
}
echo " <td valign='top' class='".$row_style[$c]."'>".$agent_contact."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['agent_max_no_answer']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['agent_status']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_wrap_up_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_reject_delay_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_busy_delay_time]."&nbsp;</td>\n";
echo " <td class='list_control_icons'>\n";
if (permission_exists('call_center_agent_edit')) {
echo "<a href='call_center_agent_edit.php?id=".$row['call_center_agent_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('call_center_agent_delete')) {
echo "<a href='call_center_agent_delete.php?id=".$row['call_center_agent_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='call_center_agent_edit.php?id=".$row[call_center_agent_uuid]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='call_center_agent_delete.php?id=".$row[call_center_agent_uuid]."' }\" value='x'>\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='11' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('call_center_agent_add')) {
echo "<a href='call_center_agent_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,102 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_queue_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
}
if (strlen($id) > 0) {
//get the dialplan uuid
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$id' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$queue_name = $row['queue_name'];
$dialplan_uuid = $row['dialplan_uuid'];
}
//delete the tier from the database
$sql = "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and queue_name = '$queue_name' ";
$db->query($sql);
unset($sql);
//delete the call center queue
$sql = "delete from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan entry
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//clear the cache
$cache = new cache;
$cache->delete("memcache delete dialplan:".$_SESSION["context"]);
//synchronize configuration
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
//redirect the browser
$_SESSION["message"] = $text['message-delete'];
header("Location: call_center_queues.php");
return;
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,206 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_queue_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//includes and title
require_once "resources/header.php";
$document['title'] = $text['title-call_center_queues'];
require_once "resources/paging.php";
//get http variables and set as php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-call_center_queues']."</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' value='".$text['button-agents']."' alt='".$text['button-agents']."' onclick=\"window.location='call_center_agents.php'\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo $text['description-call_center_queues']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
//get total call center queues count from the database
$sql = "select count(*) as num_rows from v_call_center_queues where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_call_center_queues = $row['num_rows'];
}
unset($prep_statement, $row);
//prepare to page the results (reuse $sql from above)
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('queue_name', $text['label-queue_name'], $order_by, $order);
echo th_order_by('queue_extension', $text['label-extension'], $order_by, $order);
echo th_order_by('queue_strategy', $text['label-strategy'], $order_by, $order);
//echo th_order_by('queue_moh_sound', $text['label-music_on_hold'], $order_by, $order);
//echo th_order_by('queue_record_template', $text['label-record_template'], $order_by, $order);
//echo th_order_by('queue_time_base_score', $text['label-time_base_score'], $order_by, $order);
//echo th_order_by('queue_max_wait_time', $text['label-max_wait_time'], $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', $text['label-max_wait_time_with_no_agent'], $order_by, $order);
echo th_order_by('queue_tier_rules_apply', $text['label-tier_rules_apply'], $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', $text['label-tier_rule_wait_second'], $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', $text['label-tier_rule_no_agent_no_wait'], $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', $text['label-discard_abandoned_after'], $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', $text['label-abandoned_resume_allowed'], $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', $text['label-tier_rule_wait_multiply_level'], $order_by, $order);
echo th_order_by('queue_description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) {
if ($_SESSION['limit']['call_center_queues']['numeric'] == '' || ($_SESSION['limit']['call_center_queues']['numeric'] != '' && $total_call_center_queues < $_SESSION['limit']['call_center_queues']['numeric'])) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('call_center_queue_edit')) ? "href='call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('call_center_queue_edit')) {
echo "<a href='call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."'>".$row[queue_name]."</a>";
}
else {
echo $row[queue_name];
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_extension]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_strategy]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_moh_sound]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_record_template]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_time_base_score]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time_with_no_agent]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row[queue_tier_rules_apply])."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_second]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_no_agent_no_wait]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_discard_abandoned_after]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_abandoned_resume_allowed]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_multiply_level]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row[queue_description]."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('call_center_queue_edit')) {
echo "<a href='call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('call_center_queue_delete')) {
echo "<a href='call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='17' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('call_center_queue_add')) {
if ($_SESSION['limit']['call_center_queues']['numeric'] == '' || ($_SESSION['limit']['call_center_queues']['numeric'] != '' && $total_call_center_queues < $_SESSION['limit']['call_center_queues']['numeric'])) {
echo "<a href='call_center_queue_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,394 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_tier_add') || permission_exists('call_center_tier_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set tier uuid
$call_center_tier_uuid = check_str($_REQUEST["id"]);
//get http post variables and set them to php variables
if (count($_POST)>0) {
$agent_name = check_str($_POST["agent_name"]);
$queue_name = check_str($_POST["queue_name"]);
$tier_level = check_str($_POST["tier_level"]);
$tier_position = check_str($_POST["tier_position"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
$call_center_tier_uuid = check_str($_POST["call_center_tier_uuid"]);
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
//if (strlen($agent_name) == 0) { $msg .= $text['message-required'].$text['label-agent_name']."<br>\n"; }
//if (strlen($queue_name) == 0) { $msg .= $text['message-required'].$text['label-queue_name']."<br>\n"; }
//if (strlen($tier_level) == 0) { $msg .= $text['message-required'].$text['label-tier_level']."<br>\n"; }
//if (strlen($tier_position) == 0) { $msg .= $text['message-required'].$text['label-tier_position']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add the agent
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//add the agent using event socket
if ($fp) {
//get the domain using the $domain_uuid
$tmp_domain = $_SESSION['domains'][$domain_uuid]['domain_name'];
//syntax
//callcenter_config tier add [queue_name] [agent_name] [level] [position]
//callcenter_config tier set state [queue_name] [agent_name] [state]
//callcenter_config tier set level [queue_name] [agent_name] [level]
//callcenter_config tier set position [queue_name] [agent_name] [position]
//add the agent
$cmd = "api callcenter_config tier add ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_level." ".$tier_position;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set level
$cmd = "api callcenter_config tier set level ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_level;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set position
$cmd = "api callcenter_config tier set position ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_position;
$response = event_socket_request($fp, $cmd);
usleep(200);
}
//update the database
$sql = "update v_call_center_tiers set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "agent_name = '$agent_name', ";
$sql .= "queue_name = '$queue_name', ";
$sql .= "tier_level = '$tier_level', ";
$sql .= "tier_position = '$tier_position' ";
$sql .= "where call_center_tier_uuid = '$call_center_tier_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
//look up queue uuid by queue name (ugh)
$sql = "select call_center_queue_uuid from v_call_center_queues where queue_name = '".$queue_name."'";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$queue_uuid = $row["call_center_queue_uuid"];
break;
}
unset($prep_statement);
$_SESSION["message"] = $text['message-update'];
header("Location: call_center_queue_edit.php?id=".$queue_uuid);
return;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$sql = "select * from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_tier_uuid = '$call_center_tier_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
$queue_name = $row["queue_name"];
$tier_level = $row["tier_level"];
$tier_position = $row["tier_position"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
$document['title'] = $text['title-call_center_tier_edit'];
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-call_center_tier_edit']."</b></td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick='history.back();' value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo $text['description-call_center_tiers']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-agent_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_enabled = 'true' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"agent_name\" name=\"agent_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[username] == $agent_name) {
echo "<option value='".$field['username']."' selected='selected'>".$field['username']."</option>\n";
}
else {
echo "<option value='".$field['username']."'>".$field['username']."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo $text['description-agent']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-queue_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by queue_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"queue_name\" name=\"queue_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[queue_name] == $queue_name) {
echo "<option value='".$field['queue_name']."' selected='selected'>".$field['queue_name']."</option>\n";
}
else {
echo "<option value='".$field['queue_name']."'>".$field['queue_name']."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo $text['description-options']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-tier_level']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='tier_level'>\n";
//echo " <option value=''></option>\n";
if ($tier_level == "0") {
echo " <option value='0' selected='selected' >0</option>\n";
}
else {
echo " <option value='0'>0</option>\n";
}
if ($tier_level == "1") {
echo " <option value='1' selected='selected' >1</option>\n";
}
else {
echo " <option value='1'>1</option>\n";
}
if ($tier_level == "2") {
echo " <option value='2' selected='selected' >2</option>\n";
}
else {
echo " <option value='2'>2</option>\n";
}
if ($tier_level == "3") {
echo " <option value='3' selected='selected' >3</option>\n";
}
else {
echo " <option value='3'>3</option>\n";
}
if ($tier_level == "4") {
echo " <option value='4' selected='selected' >4</option>\n";
}
else {
echo " <option value='4'>4</option>\n";
}
if ($tier_level == "5") {
echo " <option value='5' selected='selected' >5</option>\n";
}
else {
echo " <option value='5'>5</option>\n";
}
if ($tier_level == "6") {
echo " <option value='6' selected='selected' >6</option>\n";
}
else {
echo " <option value='6'>6</option>\n";
}
if ($tier_level == "7") {
echo " <option value='7' selected='selected' >7</option>\n";
}
else {
echo " <option value='7'>7</option>\n";
}
if ($tier_level == "8") {
echo " <option value='8' selected='selected' >8</option>\n";
}
else {
echo " <option value='8'>8</option>\n";
}
if ($tier_level == "9") {
echo " <option value='9' selected='selected' >9</option>\n";
}
else {
echo " <option value='9'>9</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-tier_level']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-tier_position']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='tier_position'>\n";
//echo " <option value=''></option>\n";
if ($tier_position == "1") {
echo " <option value='1' selected='selected' >1</option>\n";
}
else {
echo " <option value='1'>1</option>\n";
}
if ($tier_position == "2") {
echo " <option value='2' selected='selected' >2</option>\n";
}
else {
echo " <option value='2'>2</option>\n";
}
if ($tier_position == "3") {
echo " <option value='3' selected='selected' >3</option>\n";
}
else {
echo " <option value='3'>3</option>\n";
}
if ($tier_position == "4") {
echo " <option value='4' selected='selected' >4</option>\n";
}
else {
echo " <option value='4'>4</option>\n";
}
if ($tier_position == "5") {
echo " <option value='5' selected='selected' >5</option>\n";
}
else {
echo " <option value='5'>5</option>\n";
}
if ($tier_position == "6") {
echo " <option value='6' selected='selected' >6</option>\n";
}
else {
echo " <option value='6'>6</option>\n";
}
if ($tier_position == "7") {
echo " <option value='7' selected='selected' >7</option>\n";
}
else {
echo " <option value='7'>7</option>\n";
}
if ($tier_position == "8") {
echo " <option value='8' selected='selected' >8</option>\n";
}
else {
echo " <option value='8'>8</option>\n";
}
if ($tier_position == "9") {
echo " <option value='9' selected='selected' >9</option>\n";
}
else {
echo " <option value='9'>9</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-tier_position']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='call_center_tier_uuid' value='$call_center_tier_uuid'>\n";
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo "</tr>";
echo "</table>";
echo "</form>";
require_once "resources/footer.php";
?>

58
app/call_centers/cmd.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_queue_add') || permission_exists('call_center_queue_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
$cmd = $_GET['cmd'];
$rdr = $_GET['rdr'];
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$response = event_socket_request($fp, 'api reloadxml');
$response = event_socket_request($fp, $cmd);
fclose($fp);
}
else {
$response = '';
}
if ($rdr == "false") {
//redirect false
echo $response;
}
else {
$_SESSION["message"] = $response;
header("Location: call_center_queues.php?savemsg=".urlencode($response));
}
?>

View File

@@ -0,0 +1,224 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* cache class provides an abstracted cache
*
* @method string dialplan - builds the dialplan for call center
*/
//define the call center class
if (!class_exists('call_center')) {
class call_center {
/**
* define the variables
*/
public $domain_uuid;
public $call_center_queue_uuid;
public $dialplan_uuid;
public $queue_name;
public $queue_description;
public $destination_number;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan() {
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->destination_number;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "210";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->queue_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^".$this->destination_number."\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=".$this->queue_cid_prefix."#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name.'@'.$_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":",$this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0])+1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
}
}
/*
$o = new call_center;
$c->domain_uuid = "";
$c->dialplan_uuid = "";
$c->queue_name = "";
$c->queue_cid_prefix = "";
$c->queue_timeout_action = "";
$c->queue_description = "";
$c->destination_number = "";
$c->dialplan();
*/
?>

50
app/call_centers/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>