Add the caller id prefix

This commit is contained in:
Mark Crane
2014-08-02 10:39:49 +00:00
parent f6d6965c8d
commit 477e950ab3

View File

@@ -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 "<td class='vtable' align='left'>\n";
echo " <table width='52%' border='0' cellpadding='2' cellspacing='0'>\n";
//echo " <tr>\n";
//echo " <td class='vtable'>".$text['label-dialplan_detail_type']."</td>\n";
//echo " <td class='vtable'>".$text['label-dialplan_detail_data']."</td>\n";
//echo " <td class='vtable'>".$text['label-dialplan_detail_order']."</td>\n";
//echo " <td></td>\n";
//echo " </tr>\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 " <input name='dialplan_details[".$x."][dialplan_detail_uuid]' type='hidden' value=\"".$row['dialplan_detail_uuid']."\">\n";
}
echo " <input name='dialplan_details[".$x."][dialplan_detail_type]' type='hidden' value=\"".$row['dialplan_detail_type']."\">\n";
echo " <input name='dialplan_details[".$x."][dialplan_detail_order]' type='hidden' value=\"".$order."\">\n";
if (strlen($row['dialplan_detail_uuid']) > 0) {
echo " <input name='dialplan_details[".$x."][dialplan_detail_uuid]' type='hidden' value=\"".$row['dialplan_detail_uuid']."\">\n";
echo " <tr>\n";
echo " <td>\n";
//echo $order."<br />\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 " </td>\n";
//echo " <td>\n";
//echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
//echo " </td>\n";
echo " <td class='list_control_icons' style='width: 25px;'>";
if (strlen($row['destination_uuid']) > 0) {
//echo "<a href='estination_edit.php?id=".$row['destination_uuid']."&destination_uuid=".$row['destination_uuid']."' alt='edit'>$v_link_label_edit</a>";
echo "<a href='destination_delete.php?id=".$row['destination_uuid']."&destination_uuid=".$row['destination_uuid']."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo " </tr>\n";
}
//$order = $row['dialplan_detail_order'] + 10;
//echo " <input name='dialplan_details[".$x."][dialplan_detail_order]' type='hidden' value=\"".$order."\">\n";
echo " <tr>\n";
echo " <td>\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 " </td>\n";
//echo " <td>\n";
//echo " <input type=\"text\" name=\"dialplan_details[".$x."][dialplan_detail_order]\" class=\"formfld\" style=\"width: 90%;\"value=\"".$row['dialplan_detail_order']."\">\n";
//echo " </td>\n";
//echo " <td>\n";
//echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
//echo " </td>\n";
echo " <td class='list_control_icons' style='width: 25px;'>";
if (strlen($row['destination_uuid']) > 0) {
//echo "<a href='estination_edit.php?id=".$row['destination_uuid']."&destination_uuid=".$row['destination_uuid']."' alt='edit'>$v_link_label_edit</a>";
echo "<a href='destination_delete.php?id=".$row['destination_uuid']."&destination_uuid=".$row['destination_uuid']."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </td>";
echo " </tr>";
$order = $order + 10;
$x++;
}
echo " </table>\n";
@@ -789,4 +763,5 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//include the footer
require_once "resources/footer.php";
?>
?>