Add additional Dialplan upgrade commands.
This commit is contained in:
@@ -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-2019
|
Portions created by the Initial Developer are Copyright (C) 2008-2022
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -28,48 +28,49 @@
|
|||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//get the list of domains
|
//get the list of domains
|
||||||
$sql = "select * from v_domains ";
|
$sql = "select * from v_domains ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$domains = $database->select($sql, null, 'all');
|
$domains = $database->select($sql, null, 'all');
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
//dialplan class
|
//dialplan class
|
||||||
$dialplan = new dialplan;
|
$dialplan = new dialplan;
|
||||||
$dialplan->import($domains);
|
$dialplan->import($domains);
|
||||||
|
|
||||||
//update the dialplan order
|
//update the dialplan order
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sql = "update v_dialplans set dialplan_order = '870' where dialplan_order = '980' and dialplan_name = 'cidlookup';\n";
|
$sql = "update v_dialplans set dialplan_order = '870' where dialplan_order = '980' and dialplan_name = 'cidlookup';\n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
$sql = "update v_dialplans set dialplan_order = '880' where dialplan_order = '990' and dialplan_name = 'call_screen';\n";
|
$sql = "update v_dialplans set dialplan_order = '880' where dialplan_order = '990' and dialplan_name = 'call_screen';\n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
$sql = "update v_dialplans set dialplan_order = '890' where dialplan_order = '999' and dialplan_name = 'local_extension';\n";
|
$sql = "update v_dialplans set dialplan_order = '890' where dialplan_order = '999' and dialplan_name = 'local_extension';\n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
//set empty strings to null
|
//set empty strings to null
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sql = "update v_device_lines set outbound_proxy_primary = null where outbound_proxy_primary = '';\n";
|
$sql = "update v_device_lines set outbound_proxy_primary = null where outbound_proxy_primary = '';\n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
$sql = "update v_device_lines set outbound_proxy_secondary = null where outbound_proxy_secondary = '';\n";
|
$sql = "update v_device_lines set outbound_proxy_secondary = null where outbound_proxy_secondary = '';\n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
//change recording_slots to recording_id
|
//change recording_slots to recording_id
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=true' ";
|
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=true' ";
|
||||||
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where app_uuid = '430737df-5385-42d1-b933-22600d3fb79e') ";
|
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where app_uuid = '430737df-5385-42d1-b933-22600d3fb79e') ";
|
||||||
$sql .= "and dialplan_detail_data = 'recording_slots=true'; \n";
|
$sql .= "and dialplan_detail_data = 'recording_slots=true'; \n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=false' ";
|
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=false' ";
|
||||||
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where app_uuid = '430737df-5385-42d1-b933-22600d3fb79e') ";
|
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where app_uuid = '430737df-5385-42d1-b933-22600d3fb79e') ";
|
||||||
$sql .= "and dialplan_detail_data = 'recording_slots=false'; \n";
|
$sql .= "and dialplan_detail_data = 'recording_slots=false'; \n";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add xml for each dialplan where the dialplan xml is empty
|
//additional dialplan upgrade commands
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
//add xml for each dialplan where the dialplan xml is empty
|
||||||
$sql = "select domain_name ";
|
$sql = "select domain_name ";
|
||||||
$sql .= "from v_domains \n";
|
$sql .= "from v_domains \n";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
@@ -90,16 +91,27 @@
|
|||||||
$dialplans->destination = "database";
|
$dialplans->destination = "database";
|
||||||
$dialplans->is_empty = "dialplan_xml";
|
$dialplans->is_empty = "dialplan_xml";
|
||||||
$array = $dialplans->xml();
|
$array = $dialplans->xml();
|
||||||
}
|
|
||||||
|
|
||||||
//delete the follow me bridge dialplan
|
//delete the follow me bridge dialplan
|
||||||
if ($domains_processed == 1) {
|
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$sql = "delete from v_dialplan_details where dialplan_uuid = '8ed73d1f-698f-466c-8a7a-1cf4cd229f7f' ";
|
$sql = "delete from v_dialplan_details where dialplan_uuid = '8ed73d1f-698f-466c-8a7a-1cf4cd229f7f' ";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
$sql = "delete from v_dialplans where dialplan_uuid = '8ed73d1f-698f-466c-8a7a-1cf4cd229f7f' ";
|
$sql = "delete from v_dialplans where dialplan_uuid = '8ed73d1f-698f-466c-8a7a-1cf4cd229f7f' ";
|
||||||
$database->execute($sql);
|
$database->execute($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
|
//change dialplan context ${domain_name} to global
|
||||||
|
$sql = "update v_dialplans set dialplan_context = 'global' where dialplan_context = '${domain_name}';\n";
|
||||||
|
$database->execute($sql);
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
//update recordings dialplan change recording_id=true to recording_id
|
||||||
|
$sql = "update v_dialplans set dialplan_xml = replace(dialplan_xml, 'recording_id=true','recording_id=') where dialplan_xml like '%recording_id=true%'\n";
|
||||||
|
$database->execute($sql);
|
||||||
|
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=' where dialplan_detail_data = 'recording_id=true'\n";
|
||||||
|
$database->execute($sql);
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//add not found dialplan to inbound routes
|
//add not found dialplan to inbound routes
|
||||||
|
|||||||
Reference in New Issue
Block a user