Complete fixing the dialplan destination edit functionality so that it will not duplicate the dialplan details
This commit is contained in:
@@ -185,71 +185,69 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
$dialplan["dialplan_order"] = "100";
|
$dialplan["dialplan_order"] = "100";
|
||||||
$dialplan["dialplan_enabled"] = $destination_enabled;
|
$dialplan["dialplan_enabled"] = $destination_enabled;
|
||||||
$dialplan["dialplan_description"] = $destination_description;
|
$dialplan["dialplan_description"] = $destination_description;
|
||||||
|
|
||||||
$dialplan_detail_order = 10;
|
$dialplan_detail_order = 10;
|
||||||
if (strlen($dialplan_uuid) == 0) {
|
|
||||||
//add the public condition
|
//add the public condition
|
||||||
$y = 0;
|
$y = 0;
|
||||||
|
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||||
|
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||||
|
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context";
|
||||||
|
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public";
|
||||||
|
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||||
|
$y++;
|
||||||
|
|
||||||
|
//increment the dialplan detail order
|
||||||
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||||
|
|
||||||
|
//check the destination number
|
||||||
|
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['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"] = $regex_destination_number;
|
||||||
|
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||||
|
$y++;
|
||||||
|
|
||||||
|
//increment the dialplan detail order
|
||||||
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||||
|
|
||||||
|
//set the caller id name prefix
|
||||||
|
if (strlen($destination_cid_name_prefix) > 0) {
|
||||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=".$destination_cid_name_prefix."#\${caller_id_name}";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||||
$y++;
|
$y++;
|
||||||
|
|
||||||
//increment the dialplan detail order
|
//increment the dialplan detail order
|
||||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||||
|
}
|
||||||
|
|
||||||
//check the destination number
|
//set the call accountcode
|
||||||
|
if (strlen($destination_accountcode) > 0) {
|
||||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $regex_destination_number;
|
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "accountcode=".$destination_accountcode;
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||||
$y++;
|
$y++;
|
||||||
|
|
||||||
//increment the dialplan detail order
|
//increment the dialplan detail order
|
||||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||||
|
}
|
||||||
|
|
||||||
//set the caller id name prefix
|
//set the call carrier
|
||||||
if (strlen($destination_cid_name_prefix) > 0) {
|
if (strlen($destination_carrier) > 0) {
|
||||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid'];
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=".$destination_cid_name_prefix."#\${caller_id_name}";
|
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "carrier=$destination_carrier";
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||||
$y++;
|
$y++;
|
||||||
|
|
||||||
//increment the dialplan detail order
|
//increment the dialplan detail order
|
||||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the call accountcode
|
|
||||||
if (strlen($destination_accountcode) > 0) {
|
|
||||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['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"] = "accountcode=".$destination_accountcode;
|
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
|
||||||
$y++;
|
|
||||||
|
|
||||||
//increment the dialplan detail order
|
|
||||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
//set the call carrier
|
|
||||||
if (strlen($destination_carrier) > 0) {
|
|
||||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['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"] = "carrier=$destination_carrier";
|
|
||||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
|
||||||
$y++;
|
|
||||||
|
|
||||||
//increment the dialplan detail order
|
|
||||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//add fax detection
|
//add fax detection
|
||||||
if (strlen($fax_uuid) > 0) {
|
if (strlen($fax_uuid) > 0) {
|
||||||
@@ -336,10 +334,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//delete the previous details
|
//delete the previous details
|
||||||
if(strlen($row["dialplan_detail_uuid"]) > 0){
|
if(strlen($dialplan_uuid) > 0) {
|
||||||
$sql = "delete from v_dialplan_details ";
|
$sql = "delete from v_dialplan_details ";
|
||||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||||
$sql .= "and dialplan_uuid = '".$row["dialplan_detail_uuid"]."' ";
|
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
@@ -352,6 +350,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
$orm->save($dialplan);
|
$orm->save($dialplan);
|
||||||
$dialplan_response = $orm->message;
|
$dialplan_response = $orm->message;
|
||||||
|
//print_r($dialplan_response);
|
||||||
|
|
||||||
//synchronize the xml config
|
//synchronize the xml config
|
||||||
save_dialplan_xml();
|
save_dialplan_xml();
|
||||||
|
|||||||
Reference in New Issue
Block a user