From 477e950ab3492776386fd99181cbf6956c78097d Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 2 Aug 2014 10:39:49 +0000 Subject: [PATCH] Add the caller id prefix --- app/destinations/destination_edit.php | 117 ++++++++++---------------- 1 file changed, 46 insertions(+), 71 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index ae82cf4b65..2cad835f4b 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -210,17 +210,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //increment the dialplan detail order $dialplan_detail_order = $dialplan_detail_order + 10; - //set the call direction - $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"] = "call_direction=inbound"; - $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']; @@ -323,14 +312,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "3000"; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; $y++; + + //increment the dialplan detail order + $dialplan_detail_order = $dialplan_detail_order + 10; } //add the actions foreach ($dialplan_details as $row) { - $actions = explode(":", $row["dialplan_detail_data"]); - $dialplan_detail_type = array_shift($actions); - $dialplan_detail_data = join(':', $actions); - if (strlen($dialplan_detail_type) > 1) { + if (strlen($row["dialplan_detail_data"]) > 1) { + $actions = explode(":", $row["dialplan_detail_data"]); + $dialplan_detail_type = array_shift($actions); + $dialplan_detail_data = join(':', $actions); if (isset($row["dialplan_detail_uuid"])) { $dialplan["dialplan_details"][$y]["dialplan_detail_uuid"] = $row["dialplan_detail_uuid"]; } @@ -338,29 +330,20 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $dialplan_detail_type; $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $dialplan_detail_data; - if (strlen($row["dialplan_detail_order"]) > 0) { - $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $row["dialplan_detail_order"]; - } - else { - $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; - } - $y++; - - //increment the dialplan detail order + $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; $dialplan_detail_order = $dialplan_detail_order + 10; + $y++; } } //save the dialplan - if (strlen($dialplan_details[0][dialplan_detail_data]) > 2) { - $orm = new orm; - $orm->name('dialplans'); - if (isset($dialplan["dialplan_uuid"])) { - $orm->uuid($dialplan["dialplan_uuid"]); - } - $orm->save($dialplan); - $dialplan_response = $orm->message; + $orm = new orm; + $orm->name('dialplans'); + if (isset($dialplan["dialplan_uuid"])) { + $orm->uuid($dialplan["dialplan_uuid"]); } + $orm->save($dialplan); + $dialplan_response = $orm->message; //get the destination_uuid if (strlen($dialplan_response['uuid']) > 0) { @@ -374,6 +357,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $orm->uuid($destination_uuid); } $orm->save($_POST); + $message = $orm->message; $destination_response = $orm->message; //get the destination_uuid @@ -463,8 +447,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql = "select * from v_dialplan_details "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and dialplan_uuid = '".$dialplan_uuid."' "; - $sql .= "and dialplan_detail_tag = 'action' "; - $sql .= "and (dialplan_detail_type = 'transfer' or dialplan_detail_type = 'bridge') "; $sql .= "order by dialplan_detail_group asc, dialplan_detail_order asc"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); @@ -602,46 +584,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; $x = 0; + $order = 10; foreach($dialplan_details as $row) { + if ($row["dialplan_detail_type"] == "transfer" || $row["dialplan_detail_type"] == "bridge" || $row["dialplan_detail_type"] == "") { + if (strlen($row['dialplan_detail_uuid']) > 0) { + echo " \n"; + } + echo " \n"; + echo " \n"; - if (strlen($row['dialplan_detail_uuid']) > 0) { - echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + echo " \n"; + echo " \n"; } - //$order = $row['dialplan_detail_order'] + 10; - //echo " \n"; - - echo " \n"; - echo " \n"; - //echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; - - echo " "; - echo " "; + $order = $order + 10; $x++; } echo "
".$text['label-dialplan_detail_type']."".$text['label-dialplan_detail_data']."".$text['label-dialplan_detail_order']."
\n"; + //echo $order."
\n"; + //switch_select_destination(select_type, select_label, select_name, select_value, select_style, action); + $data = $row['dialplan_detail_data']; + $label = explode("XML", $data); + $detail_action = $row['dialplan_detail_type'].":".$row['dialplan_detail_data']; + switch_select_destination("dialplan", $label[0], "dialplan_details[".$x."][dialplan_detail_data]", $detail_action, "width: 60%;", $row['dialplan_detail_type']); + + echo "
\n"; + //echo " \n"; + //echo " "; + if (strlen($row['destination_uuid']) > 0) { + //echo "$v_link_label_edit"; + echo "$v_link_label_delete"; + } + echo "
\n"; - //switch_select_destination(select_type, select_label, select_name, select_value, select_style, action); - $data = $row['dialplan_detail_data']; - $label = explode("XML", $data); - $detail_action = $row['dialplan_detail_type'].":".$row['dialplan_detail_data']; - switch_select_destination("dialplan", $label[0], "dialplan_details[".$x."][dialplan_detail_data]", $detail_action, "width: 60%;", $row['dialplan_detail_type']); - - echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " \n"; - //echo " "; - if (strlen($row['destination_uuid']) > 0) { - //echo "$v_link_label_edit"; - echo "$v_link_label_delete"; - } - echo "
\n"; @@ -789,4 +763,5 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> + +?> \ No newline at end of file