Write the call center dialplan with the new call center class.
This commit is contained in:
parent
197420d6c9
commit
5d4a2375a0
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -298,7 +298,31 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
//syncrhonize the configuration
|
//get the dialplan_uuid
|
||||||
|
$sql = "select * from v_call_center_queues ";
|
||||||
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||||
|
$sql .= "and call_center_queue_uuid = '$call_center_queue_uuid' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($result as &$row) {
|
||||||
|
$dialplan_uuid = $row["dialplan_uuid"];
|
||||||
|
}
|
||||||
|
unset ($prep_statement);
|
||||||
|
|
||||||
|
//dialplan add or update
|
||||||
|
$c = new call_center;
|
||||||
|
$c->db = $db;
|
||||||
|
$c->domain_uuid = $_SESSION['domain_uuid'];
|
||||||
|
$c->dialplan_uuid = $dialplan_uuid;
|
||||||
|
$c->queue_name = $queue_name;
|
||||||
|
$c->queue_cid_prefix = $queue_cid_prefix;
|
||||||
|
$c->queue_timeout_action = $queue_timeout_action;
|
||||||
|
$c->queue_description = $queue_description;
|
||||||
|
$c->destination_number = $queue_extension;
|
||||||
|
$a = $c->dialplan();
|
||||||
|
|
||||||
|
//synchronize the configuration
|
||||||
save_call_center_xml();
|
save_call_center_xml();
|
||||||
|
|
||||||
//clear the cache
|
//clear the cache
|
||||||
|
|
@ -973,4 +997,5 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -0,0 +1,238 @@
|
||||||
|
<?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) 2010-2014
|
||||||
|
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 $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() {
|
||||||
|
|
||||||
|
//check to see if the dialplan exists
|
||||||
|
if (strlen($this->dialplan_uuid) > 0) {
|
||||||
|
$sql = "select dialplan_uuid, dialplan_name, dialplan_description from v_dialplans ";
|
||||||
|
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
|
||||||
|
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
|
||||||
|
echo $sql;
|
||||||
|
$prep_statement = $this->db->prepare($sql);
|
||||||
|
if ($prep_statement) {
|
||||||
|
$prep_statement->execute();
|
||||||
|
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if (strlen($row['dialplan_uuid']) > 0) {
|
||||||
|
$this->dialplan_uuid = $row['dialplan_uuid'];
|
||||||
|
$dialplan_name = $row['dialplan_name'];
|
||||||
|
$dialplan_description = $row['dialplan_description'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->dialplan_uuid = "";
|
||||||
|
}
|
||||||
|
unset($prep_statement);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->dialplan_uuid = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//build the dialplan array
|
||||||
|
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
|
||||||
|
if (strlen($this->dialplan_uuid) > 0) {
|
||||||
|
$dialplan["dialplan_uuid"] = $this->dialplan_uuid;
|
||||||
|
}
|
||||||
|
$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"] = "condition";
|
||||||
|
$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_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;
|
||||||
|
|
||||||
|
//delete the previous details
|
||||||
|
if(strlen($this->dialplan_uuid) > 0) {
|
||||||
|
$sql = "delete from v_dialplan_details ";
|
||||||
|
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
|
||||||
|
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
|
||||||
|
//echo $sql."<br><br>";
|
||||||
|
$this->db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//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');
|
||||||
|
if (isset($dialplan["dialplan_uuid"])) {
|
||||||
|
$orm->uuid($dialplan["dialplan_uuid"]);
|
||||||
|
}
|
||||||
|
$orm->save($dialplan);
|
||||||
|
$dialplan_response = $orm->message;
|
||||||
|
|
||||||
|
//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();
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -736,6 +736,7 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
|
||||||
}
|
}
|
||||||
|
|
||||||
//fifo queues
|
//fifo queues
|
||||||
|
/*
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/fifo/app_config.php")) {
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/fifo/app_config.php")) {
|
||||||
if ($select_type == "dialplan" || $select_type == "ivr") {
|
if ($select_type == "dialplan" || $select_type == "ivr") {
|
||||||
$sql = "select * from v_dialplan_details ";
|
$sql = "select * from v_dialplan_details ";
|
||||||
|
|
@ -792,6 +793,7 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
|
||||||
unset ($prep_statement);
|
unset ($prep_statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//gateways
|
//gateways
|
||||||
if (if_group("superadmin")) {
|
if (if_group("superadmin")) {
|
||||||
|
|
@ -2236,239 +2238,19 @@ if (!function_exists('save_call_center_xml')) {
|
||||||
global $db, $domain_uuid;
|
global $db, $domain_uuid;
|
||||||
|
|
||||||
if (strlen($_SESSION['switch']['call_center']['dir']) > 0) {
|
if (strlen($_SESSION['switch']['call_center']['dir']) > 0) {
|
||||||
//include the classes
|
|
||||||
include "app/dialplan/resources/classes/dialplan.php";
|
|
||||||
|
|
||||||
|
//get the call center queue array
|
||||||
$sql = "select * from v_call_center_queues ";
|
$sql = "select * from v_call_center_queues ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
$call_center_queues = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$result_count = count($result);
|
$result_count = count($call_center_queues);
|
||||||
unset ($prep_statement, $sql);
|
unset ($prep_statement, $sql);
|
||||||
if ($result_count > 0) {
|
if ($result_count > 0) {
|
||||||
foreach($result as $row) {
|
|
||||||
//set the variables
|
|
||||||
$call_center_queue_uuid = $row["call_center_queue_uuid"];
|
|
||||||
$domain_uuid = $row["domain_uuid"];
|
|
||||||
$dialplan_uuid = $row["dialplan_uuid"];
|
|
||||||
$queue_name = check_str($row["queue_name"]);
|
|
||||||
$queue_extension = $row["queue_extension"];
|
|
||||||
$queue_strategy = $row["queue_strategy"];
|
|
||||||
$queue_moh_sound = $row["queue_moh_sound"];
|
|
||||||
$queue_record_template = $row["queue_record_template"];
|
|
||||||
$queue_time_base_score = $row["queue_time_base_score"];
|
|
||||||
$queue_max_wait_time = $row["queue_max_wait_time"];
|
|
||||||
$queue_max_wait_time_with_no_agent = $row["queue_max_wait_time_with_no_agent"];
|
|
||||||
$queue_tier_rules_apply = $row["queue_tier_rules_apply"];
|
|
||||||
$queue_tier_rule_wait_second = $row["queue_tier_rule_wait_second"];
|
|
||||||
$queue_tier_rule_wait_multiply_level = $row["queue_tier_rule_wait_multiply_level"];
|
|
||||||
$queue_tier_rule_no_agent_no_wait = $row["queue_tier_rule_no_agent_no_wait"];
|
|
||||||
$queue_timeout_action = $row["queue_timeout_action"];
|
|
||||||
$queue_discard_abandoned_after = $row["queue_discard_abandoned_after"];
|
|
||||||
$queue_abandoned_resume_allowed = $row["queue_abandoned_resume_allowed"];
|
|
||||||
$queue_cid_prefix = $row["queue_cid_prefix"];
|
|
||||||
$queue_announce_sound = $row["queue_announce_sound"];
|
|
||||||
$queue_announce_frequency = $row["queue_announce_frequency"];
|
|
||||||
$queue_description = check_str($row["queue_description"]);
|
|
||||||
|
|
||||||
//replace space with an underscore
|
|
||||||
$queue_name = str_replace(" ", "_", $queue_name);
|
|
||||||
|
|
||||||
//add each Queue to the dialplan
|
|
||||||
if (strlen($row['call_center_queue_uuid']) > 0) {
|
|
||||||
$action = 'add'; //set default action to add
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
//determine the action add or update
|
|
||||||
if (strlen($dialplan_uuid) > 0) {
|
|
||||||
$sql = "select * from v_dialplans ";
|
|
||||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
|
||||||
$prep_statement_2 = $db->prepare($sql);
|
|
||||||
$prep_statement_2->execute();
|
|
||||||
while($row2 = $prep_statement_2->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$action = 'update';
|
|
||||||
}
|
|
||||||
unset ($sql, $prep_statement_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'add') {
|
|
||||||
//create queue entry in the dialplan
|
|
||||||
$dialplan_name = $queue_name;
|
|
||||||
$dialplan_order ='210';
|
|
||||||
$dialplan_context = $_SESSION['context'];
|
|
||||||
$dialplan_enabled = 'true';
|
|
||||||
$dialplan_description = $queue_description;
|
|
||||||
$app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
|
||||||
$dialplan_uuid = uuid();
|
|
||||||
dialplan_add($domain_uuid, $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
|
|
||||||
|
|
||||||
//add the dialplan_uuid to the call center table
|
|
||||||
$sql = "update v_call_center_queues set ";
|
|
||||||
$sql .= "dialplan_uuid = '$dialplan_uuid' ";
|
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
||||||
$sql .= "and call_center_queue_uuid = '".$row['call_center_queue_uuid']."' ";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
}
|
|
||||||
if ($action == 'update') {
|
|
||||||
//add the dialplan_uuid to the call center table
|
|
||||||
$sql = "update v_dialplans set ";
|
|
||||||
$sql .= "dialplan_name = '".$queue_name."', ";
|
|
||||||
$sql .= "dialplan_description = '".$queue_description."' ";
|
|
||||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
|
||||||
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
//add the dialplan_uuid to the call center table
|
|
||||||
$sql = "delete from v_dialplan_details ";
|
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
||||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
//group 1
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = '${caller_id_name}';
|
|
||||||
$dialplan->dialplan_detail_data = '^([^#]+#)(.*)$';
|
|
||||||
$dialplan->dialplan_detail_break = 'never';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '1';
|
|
||||||
$dialplan->dialplan_detail_order = '010';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'set';
|
|
||||||
$dialplan->dialplan_detail_data = 'caller_id_name=$2';
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '1';
|
|
||||||
$dialplan->dialplan_detail_order = '020';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
//group 2
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'destination_number';
|
|
||||||
$dialplan->dialplan_detail_data = '^'.$row['queue_extension'].'$';
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '010';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'answer';
|
|
||||||
$dialplan->dialplan_detail_data = '';
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '020';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'set';
|
|
||||||
$dialplan->dialplan_detail_data = 'hangup_after_bridge=true';
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '030';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
if (strlen($queue_cid_prefix) > 0) {
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'set';
|
|
||||||
$dialplan->dialplan_detail_data = "effective_caller_id_name=".$queue_cid_prefix."-\${caller_id_name}";
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '040';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'callcenter';
|
|
||||||
$dialplan->dialplan_detail_data = $queue_name."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '050';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
if (strlen($queue_timeout_action) > 0) {
|
|
||||||
$action_array = explode(":",$queue_timeout_action);
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = $action_array[0];
|
|
||||||
$dialplan->dialplan_detail_data = substr($queue_timeout_action, strlen($action_array[0])+1, strlen($queue_timeout_action));
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '060';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dialplan = new dialplan;
|
|
||||||
$dialplan->domain_uuid = $domain_uuid;
|
|
||||||
$dialplan->dialplan_uuid = $dialplan_uuid;
|
|
||||||
$dialplan->dialplan_detail_tag = 'action'; //condition, action, antiaction
|
|
||||||
$dialplan->dialplan_detail_type = 'hangup';
|
|
||||||
$dialplan->dialplan_detail_data = '';
|
|
||||||
$dialplan->dialplan_detail_break = '';
|
|
||||||
$dialplan->dialplan_detail_inline = '';
|
|
||||||
$dialplan->dialplan_detail_group = '2';
|
|
||||||
$dialplan->dialplan_detail_order = '070';
|
|
||||||
$dialplan->dialplan_detail_add();
|
|
||||||
unset($dialplan);
|
|
||||||
|
|
||||||
//synchronize the xml config
|
|
||||||
save_dialplan_xml();
|
|
||||||
|
|
||||||
//unset variables
|
|
||||||
unset($action);
|
|
||||||
|
|
||||||
} //end if strlen call_center_queue_uuid; add the call center queue to the dialplan
|
|
||||||
}
|
|
||||||
|
|
||||||
//prepare Queue XML string
|
//prepare Queue XML string
|
||||||
$v_queues = '';
|
|
||||||
$sql = "select * from v_call_center_queues ";
|
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
|
||||||
$prep_statement->execute();
|
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$x=0;
|
$x=0;
|
||||||
foreach ($result as &$row) {
|
foreach ($call_center_queues as &$row) {
|
||||||
$queue_name = $row["queue_name"];
|
$queue_name = $row["queue_name"];
|
||||||
$queue_extension = $row["queue_extension"];
|
$queue_extension = $row["queue_extension"];
|
||||||
$queue_strategy = $row["queue_strategy"];
|
$queue_strategy = $row["queue_strategy"];
|
||||||
|
|
@ -2486,6 +2268,10 @@ if (!function_exists('save_call_center_xml')) {
|
||||||
$queue_announce_sound = $row["queue_announce_sound"];
|
$queue_announce_sound = $row["queue_announce_sound"];
|
||||||
$queue_announce_frequency = $row ["queue_announce_frequency"];
|
$queue_announce_frequency = $row ["queue_announce_frequency"];
|
||||||
$queue_description = $row["queue_description"];
|
$queue_description = $row["queue_description"];
|
||||||
|
|
||||||
|
//replace space with an underscore
|
||||||
|
$queue_name = str_replace(" ", "_", $queue_name);
|
||||||
|
|
||||||
if ($x > 0) {
|
if ($x > 0) {
|
||||||
$v_queues .= "\n";
|
$v_queues .= "\n";
|
||||||
$v_queues .= " ";
|
$v_queues .= " ";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue