Destination Edit - efficiency improvements.

Efficiency Improvements.
- Use the build dialplan XML when saving a dialplan as its more efficient than running the dialplan class xml method.
- Remove delete previous dialplan details as there it seems to be redundant. There is a broader delete for dialplan details in the code.
This commit is contained in:
FusionPBX 2021-07-30 14:27:02 -06:00 committed by GitHub
parent 832549a32e
commit e20a27d659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 70 deletions

View File

@ -362,7 +362,6 @@
}
//build the xml dialplan
if ($_SESSION['destinations']['dialplan_details']['boolean'] == "false") {
$dialplan["dialplan_xml"] = "<extension name=\"".$dialplan_name."\" continue=\"false\" uuid=\"".$dialplan_uuid."\">\n";
$dialplan["dialplan_xml"] .= " <condition field=\"".$dialplan_detail_type."\" expression=\"".$destination_number_regex."\">\n";
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
@ -399,7 +398,6 @@
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".$fax_extension." XML \${domain_name}\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +3000\"/>\n";
}
if ($destination->valid($destination_app.':'.$destination_data)) {
$dialplan["dialplan_xml"] .= " <action application=\"".$destination_app."\" data=\"".$destination_data."\"/>\n";
@ -409,27 +407,10 @@
}
$dialplan["dialplan_xml"] .= " </condition>\n";
$dialplan["dialplan_xml"] .= "</extension>\n";
}
//dialplan details
if ($_SESSION['destinations']['dialplan_details']['boolean'] == "true") {
//delete previous dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and (dialplan_uuid = :dialplan_uuid or dialplan_uuid is null) ";
$sql .= "and (";
$sql .= " dialplan_detail_data like '%tone_detect%' ";
$sql .= " or dialplan_detail_type = 'tone_detect' ";
$sql .= " or dialplan_detail_type = 'record_session' ";
$sql .= " or (dialplan_detail_type = 'sleep' and dialplan_detail_data = '3000') ";
$sql .= ")";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['dialplan_uuid'] = $dialplan_uuid;
$database = new database;
$database->execute($sql, $parameters);
unset($sql, $parameters);
//increment the dialplan detail order
$dialplan_detail_order = $dialplan_detail_order + 10;
@ -785,14 +766,6 @@
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//update the dialplan xml
if ($_SESSION['destinations']['dialplan_details']['boolean'] == "true") {
$dialplans = new dialplan;
$dialplans->source = "details";
$dialplans->destination = "database";
$dialplans->xml();
}
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$destination_context);