Fix a Ring group issue for a missing dialplan this affected people using MySQL.

This commit is contained in:
Mark Crane
2013-04-01 21:33:50 +00:00
parent 4530aa299e
commit f215b6c7a2
+45 -31
View File
@@ -259,46 +259,60 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$prep_statement->execute(); $prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) { if ($row['num_rows'] == 0) {
//add the dialplan entry
$dialplan_name = $ring_group_name;
$dialplan_order ='333';
$dialplan_context = $ring_group_context;
$dialplan_enabled = 'true';
$dialplan_description = $ring_group_description;
$app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2';
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
//<condition destination_number="500" /> //add the dialplan
$dialplan_detail_tag = 'condition'; //condition, action, antiaction require_once "includes/classes/database.php";
$dialplan_detail_type = 'destination_number'; $database = new database;
$dialplan_detail_data = '^'.$ring_group_extension.'$'; $database->table = "v_dialplans";
$dialplan_detail_order = '000'; $database->fields['domain_uuid'] = $_SESSION['domain_uuid'];
$dialplan_detail_group = '1'; $database->fields['dialplan_uuid'] = $dialplan_uuid;
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $database->fields['dialplan_name'] = $ring_group_name;
$database->fields['dialplan_order'] = '333';
$database->fields['dialplan_context'] = $ring_group_context;
$database->fields['dialplan_enabled'] = 'true';
$database->fields['dialplan_description'] = $ring_group_description;
$database->fields['app_uuid'] = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2';
$database->add();
//<action application="set" data="ring_group_uuid="/> //add the dialplan details
$dialplan_detail_tag = 'action'; //condition, action, antiaction $database->table = "v_dialplan_details";
$dialplan_detail_type = 'set'; $database->fields['domain_uuid'] = $_SESSION['domain_uuid'];
$dialplan_detail_data = 'ring_group_uuid='.$ring_group_uuid; $database->fields['dialplan_uuid'] = $dialplan_uuid;
$dialplan_detail_order = '010'; $database->fields['dialplan_detail_uuid'] = uuid();
$dialplan_detail_group = '1'; $database->fields['dialplan_detail_tag'] = 'condition'; //condition, action, antiaction
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $database->fields['dialplan_detail_type'] = 'destination_number';
$database->fields['dialplan_detail_data'] = '^'.$ring_group_extension.'$';
$database->fields['dialplan_detail_order'] = '000';
$database->add();
//<action application="lua" data="ring_group.lua"/> //add the dialplan details
$dialplan_detail_tag = 'action'; //condition, action, antiaction $database->table = "v_dialplan_details";
//$dialplan_detail_type = 'transfer'; $database->fields['domain_uuid'] = $_SESSION['domain_uuid'];
//$dialplan_detail_data = $ring_group_extension . ' LUA ring_group.lua'; $database->fields['dialplan_uuid'] = $dialplan_uuid;
$dialplan_detail_type = 'lua'; $database->fields['dialplan_detail_uuid'] = uuid();
$dialplan_detail_data = 'ring_group.lua'; $database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$dialplan_detail_order = '030'; $database->fields['dialplan_detail_type'] = 'set';
$dialplan_detail_group = '1'; $database->fields['dialplan_detail_data'] = 'ring_group_uuid='.$ring_group_uuid;
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $database->fields['dialplan_detail_order'] = '025';
$database->add();
//add the dialplan details
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $_SESSION['domain_uuid'];
$database->fields['dialplan_uuid'] = $dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'lua';
$database->fields['dialplan_detail_data'] = 'ring_group.lua';
$database->fields['dialplan_detail_order'] = '030';
$database->add();
//save the xml //save the xml
save_dialplan_xml(); save_dialplan_xml();
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
} }
} }