This commit is contained in:
markjcrane 2015-08-02 23:43:53 +00:00
commit dd1d7a9ffd
6 changed files with 35 additions and 75 deletions

View File

@ -793,7 +793,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-max_wait_time_with_no_agent']."\n"; echo " ".$text['label-max_wait_time_with_no_agent']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='queue_max_wait_time_with_no_agent' maxlength='255' min='1' step='1' value='$queue_max_wait_time_with_no_agent'>\n"; echo " <input class='formfld' type='number' name='queue_max_wait_time_with_no_agent' maxlength='255' min='0' step='1' value='$queue_max_wait_time_with_no_agent'>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-max_wait_time_with_no_agent']."\n"; echo $text['description-max_wait_time_with_no_agent']."\n";
echo "</td>\n"; echo "</td>\n";
@ -804,7 +804,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-max_wait_time_with_no_agent_time_reached']."\n"; echo " ".$text['label-max_wait_time_with_no_agent_time_reached']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='queue_max_wait_time_with_no_agent_time_reached' maxlength='255' min='1' step='1' value='$queue_max_wait_time_with_no_agent_time_reached'>\n"; echo " <input class='formfld' type='number' name='queue_max_wait_time_with_no_agent_time_reached' maxlength='255' min='0' step='1' value='$queue_max_wait_time_with_no_agent_time_reached'>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-max_wait_time_with_no_agent_time_reached']."\n"; echo $text['description-max_wait_time_with_no_agent_time_reached']."\n";
echo "</td>\n"; echo "</td>\n";
@ -851,7 +851,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-tier_rule_wait_second']."\n"; echo " ".$text['label-tier_rule_wait_second']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='queue_tier_rule_wait_second' maxlength='255' min='1' step='1' value='$queue_tier_rule_wait_second'>\n"; echo " <input class='formfld' type='number' name='queue_tier_rule_wait_second' maxlength='255' min='0' step='1' value='$queue_tier_rule_wait_second'>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-tier_rule_wait_second']."\n"; echo $text['description-tier_rule_wait_second']."\n";
echo "</td>\n"; echo "</td>\n";
@ -910,7 +910,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-discard_abandoned_after']."\n"; echo " ".$text['label-discard_abandoned_after']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='number' name='queue_discard_abandoned_after' maxlength='255' min='1' step='1' value='$queue_discard_abandoned_after'>\n"; echo " <input class='formfld' type='number' name='queue_discard_abandoned_after' maxlength='255' min='0' step='1' value='$queue_discard_abandoned_after'>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-discard_abandoned_after']."\n"; echo $text['description-discard_abandoned_after']."\n";
echo "</td>\n"; echo "</td>\n";

View File

@ -66,35 +66,21 @@
*/ */
public function dialplan() { public function dialplan() {
//check to see if the dialplan exists //delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) { if (strlen($this->dialplan_uuid) > 0) {
$sql = "select dialplan_uuid, dialplan_name, dialplan_description from v_dialplans "; //delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' "; $sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' "; $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$prep_statement = $this->db->prepare($sql); $this->db->exec($sql);
if ($prep_statement) {
$prep_statement->execute(); $sql = "delete from v_dialplan_details ";
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
if (is_array($row)) { $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
//results found $this->db->exec($sql);
$dialplan_name = $row['dialplan_name']; unset($sql);
$dialplan_description = $row['dialplan_description'];
}
else {
//no results
unset($this->dialplan_uuid);
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = null ";
$sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
//echo $sql."<br />\n";
//exit;
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
}
} }
unset($prep_statement);
//build the dialplan array //build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370"; $dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
@ -181,20 +167,6 @@
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2"; $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//delete the previous dialplan
if(strlen($this->dialplan_uuid) > 0) {
$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);
}
//add the dialplan permission //add the dialplan permission
$p = new permissions; $p = new permissions;
$p->add("dialplan_add", 'temp'); $p->add("dialplan_add", 'temp');
@ -205,22 +177,17 @@
//save the dialplan //save the dialplan
$orm = new orm; $orm = new orm;
$orm->name('dialplans'); $orm->name('dialplans');
if (strlen($this->dialplan_uuid) > 0) {
$orm->uuid($this->dialplan_uuid);
}
$orm->save($dialplan); $orm->save($dialplan);
$dialplan_response = $orm->message; $dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue //if new dialplan uuid then update the call center queue
if (strlen($this->dialplan_uuid) == 0) { $sql = "update v_call_center_queues ";
$this->dialplan_uuid = $dialplan_response['uuid']; $sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql = "update v_call_center_queues "; $sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' "; $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' "; $this->db->exec($sql);
$sql .= "and domain_uuid = '".$this->domain_uuid."' "; unset($sql);
$this->db->exec($sql);
unset($sql);
}
//remove the temporary permission //remove the temporary permission
$p->delete("dialplan_add", 'temp'); $p->delete("dialplan_add", 'temp');

View File

@ -83,6 +83,9 @@
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin"; //$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++; $y++;
$apps[$x]['permissions'][$y]['name'] = "extension_user_context";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
//schema details //schema details
$y = 0; //table array index $y = 0; //table array index

View File

@ -85,7 +85,7 @@ else {
if (if_group("superadmin")) { if (if_group("superadmin")) {
$accountcode = $_POST["accountcode"]; $accountcode = $_POST["accountcode"];
} }
else if (if_group("admin") && $billing_app_exists) { elseif (if_group("admin") && $billing_app_exists) {
$sql_accountcode = "SELECT COUNT(*) as count FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."' AND type_value='".$_POST["accountcode"]."'"; $sql_accountcode = "SELECT COUNT(*) as count FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."' AND type_value='".$_POST["accountcode"]."'";
$prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode)); $prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
$prep_statement_accountcode->execute(); $prep_statement_accountcode->execute();
@ -328,7 +328,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
//set the default user context //set the default user context
if (if_group("superadmin")) { if (permission_exists("extension_user_context")) {
//allow a user assigned to super admin to change the user_context //allow a user assigned to super admin to change the user_context
} }
else { else {
@ -634,7 +634,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "directory_exten_visible = '$directory_exten_visible', "; $sql .= "directory_exten_visible = '$directory_exten_visible', ";
$sql .= "limit_max = '$limit_max', "; $sql .= "limit_max = '$limit_max', ";
$sql .= "limit_destination = '$limit_destination', "; $sql .= "limit_destination = '$limit_destination', ";
$sql .= "user_context = '$user_context', "; if (permission_exists("extension_user_context")) {
$sql .= "user_context = '$user_context', ";
}
if (permission_exists('extension_missed_call')) { if (permission_exists('extension_missed_call')) {
$sql .= "missed_call_app = '$missed_call_app', "; $sql .= "missed_call_app = '$missed_call_app', ";
$sql .= "missed_call_data = '$missed_call_data', "; $sql .= "missed_call_data = '$missed_call_data', ";
@ -881,7 +883,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") { if ($action == "update") {
$document['title'] = $text['title-extension-edit']; $document['title'] = $text['title-extension-edit'];
} }
else if ($action == "add") { elseif ($action == "add") {
$document['title'] = $text['title-extension-add']; $document['title'] = $text['title-extension-add'];
} }

View File

@ -1,6 +1,6 @@
-- xml_handler.lua -- xml_handler.lua
-- Part of FusionPBX -- Part of FusionPBX
-- Copyright (C) 2013 Mark J Crane <markjcrane@fusionpbx.com> -- Copyright (C) 2013-2015 Mark J Crane <markjcrane@fusionpbx.com>
-- All rights reserved. -- All rights reserved.
-- --
-- Redistribution and use in source and binary forms, with or without -- Redistribution and use in source and binary forms, with or without
@ -61,17 +61,6 @@
end end
end end
--get the domain name
function get_domain_name(domains, domain_uuid)
for key,value in ipairs(domains) do
if (value.domain_uuid == domain_uuid) then
return value.domain_name;
end
end
return nil;
end
--set the xml array and then concatenate the array to a string --set the xml array and then concatenate the array to a string
local xml = {} local xml = {}
table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]); table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]);
@ -253,11 +242,10 @@
end end
end end
if (call_context == "public") then if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then
if (dialplan_detail_tag == "action") then if (dialplan_detail_tag == "action") then
if (first_action) then if (first_action) then
if (domain_uuid ~= nil and domain_uuid ~= '') then if (domain_uuid ~= nil and domain_uuid ~= '') then
--domain_name = get_domain_name(domains, domain_uuid);
domain_name = domains[domain_uuid]; domain_name = domains[domain_uuid];
table.insert(xml, [[ <action application="set" data="call_direction=inbound"/>]]); table.insert(xml, [[ <action application="set" data="call_direction=inbound"/>]]);
table.insert(xml, [[ <action application="set" data="domain_uuid=]] .. domain_uuid .. [["/>]]); table.insert(xml, [[ <action application="set" data="domain_uuid=]] .. domain_uuid .. [["/>]]);

View File

@ -2226,7 +2226,7 @@ if (!function_exists('save_call_center_xml')) {
} }
//get the contents of the template //get the contents of the template
$file_contents = file_get_contents($path."/autoload_configs/callcenter.conf.xml"); $file_contents = file_get_contents($path."/autoload_configs/callcenter.conf.xml.noload");
//add the Call Center Queues, Agents and Tiers to the XML config //add the Call Center Queues, Agents and Tiers to the XML config
$file_contents = str_replace("{v_queues}", $v_queues, $file_contents); $file_contents = str_replace("{v_queues}", $v_queues, $file_contents);