Build dialplan xml from the array. More efficient to save data and xml in one step.

This commit is contained in:
FusionPBX
2023-11-03 02:18:57 -06:00
committed by GitHub
parent 9da5a10a77
commit fa123ff069
4 changed files with 153 additions and 94 deletions
+12 -13
View File
@@ -77,7 +77,7 @@
unset($sql);
}
//additional dialplan upgrade commands
//additional dialplan upgrade commands
if ($domains_processed == 1) {
//add xml for each dialplan where the dialplan xml is empty
$sql = "select domain_name ";
@@ -121,10 +121,9 @@
$sql = "update v_dialplan_details set dialplan_detail_data = 'recording_id=' where dialplan_detail_data = 'recording_id=true'\n";
$database->execute($sql);
unset($sql);
}
//remove origination_callee_id_name from domain-variables dialplan
//remove origination_callee_id_name from domain-variables dialplan
if ($domains_processed == 1) {
$sql = "select count(*) from v_dialplans ";
$sql .= "where dialplan_name = 'domain-variables' ";
@@ -132,18 +131,18 @@
$database = new database;
$num_rows = $database->select($sql, null, 'column');
if ($num_rows > 0) {
$sql = "update v_dialplan_details set dialplan_detail_data = 'origination_callee_id_name=\${caller_destination}', update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables') \n";
$sql .= "and dialplan_detail_data = 'origination_callee_id_name=\${destination_number}'; \n";
$database->execute($sql);
$sql = "update v_dialplan_details set dialplan_detail_data = 'origination_callee_id_name=\${caller_destination}', update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables') \n";
$sql .= "and dialplan_detail_data = 'origination_callee_id_name=\${destination_number}'; \n";
$database->execute($sql);
$sql = "update v_dialplans set dialplan_xml = REPLACE(dialplan_xml, '<action application=\"export\" data=\"origination_callee_id_name=\${destination_number}\"/>', '<action application=\"export\" data=\"origination_callee_id_name=\${caller_destination}\"/>'), update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables'); \n";
$database->execute($sql);
$sql = "update v_dialplans set dialplan_xml = REPLACE(dialplan_xml, '<action application=\"export\" data=\"origination_callee_id_name=\${destination_number}\"/>', '<action application=\"export\" data=\"origination_callee_id_name=\${caller_destination}\"/>'), update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables'); \n";
$database->execute($sql);
$sql = "update v_dialplans set dialplan_xml = REPLACE(dialplan_xml, '<action application=\"export\" data=\"origination_callee_id_name=\${destination_number}\" inline=\"true\"/>', '<action application=\"export\" data=\"origination_callee_id_name=\${caller_destination}\" inline=\"true\"/>'), update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables'); \n";
$database->execute($sql);
$sql = "update v_dialplans set dialplan_xml = REPLACE(dialplan_xml, '<action application=\"export\" data=\"origination_callee_id_name=\${destination_number}\" inline=\"true\"/>', '<action application=\"export\" data=\"origination_callee_id_name=\${caller_destination}\" inline=\"true\"/>'), update_date = now() \n";
$sql .= "where dialplan_uuid in (select dialplan_uuid from v_dialplans where dialplan_name = 'domain-variables' or dialplan_name = 'variables'); \n";
$database->execute($sql);
}
unset($sql, $num_rows);
}