diff --git a/app/destinations/app_config.php b/app/destinations/app_config.php index a763b3290f..e705cd6606 100644 --- a/app/destinations/app_config.php +++ b/app/destinations/app_config.php @@ -71,17 +71,44 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_name'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dialplans'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dialplan_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'destination_type'; + $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'destination_name'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the name.'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'destination_number'; + $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'destination_number'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the number.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_caller_id_name'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the caller id name.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_caller_id_number'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the caller id number.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_context'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the context.'; $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_extension'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_app'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the extension.'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the application.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_data'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the data.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_enabled'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 77e611ad49..fefe81a19f 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -1,4 +1,28 @@ + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; @@ -30,7 +54,7 @@ require_once "includes/paging.php"; echo " \n"; echo " \n"; echo " \n"; - echo " Used to provide a simple way of directing a call through the dialplan to find its destination.

\n"; + echo " Inbound destinations are the DID/DDI, DNIS or Alias for inbound calls.

\n"; echo " \n"; echo " \n"; echo "\n"; @@ -52,7 +76,7 @@ require_once "includes/paging.php"; } //prepare to page the results - $rows_per_page = 10; + $rows_per_page = 150; $param = ""; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } @@ -60,10 +84,10 @@ require_once "includes/paging.php"; $offset = $rows_per_page * $page; //get the list - $sql = " select * from v_destinations "; - $sql .= " where domain_uuid = '$domain_uuid' "; + $sql = "select * from v_destinations "; + $sql .= "where domain_uuid = '$domain_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $sql .= " limit $rows_per_page offset $offset "; + $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(); @@ -77,9 +101,9 @@ require_once "includes/paging.php"; echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('destination_name', 'Name', $order_by, $order); + echo th_order_by('destination_type', 'Name', $order_by, $order); + echo th_order_by('destination_number', 'Destination', $order_by, $order); echo th_order_by('destination_context', 'Context', $order_by, $order); - echo th_order_by('destination_extension', 'Extension', $order_by, $order); echo th_order_by('destination_enabled', 'Enabled', $order_by, $order); echo th_order_by('destination_description', 'Description', $order_by, $order); echo "\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; echo "
\n"; @@ -89,9 +113,9 @@ require_once "includes/paging.php"; if ($result_count > 0) { foreach($result as $row) { echo "
".$row['destination_name']." ".$row['destination_type']." ".$row['destination_number']." ".$row['destination_context']." ".$row['destination_extension']." ".$row['destination_enabled']." ".$row['destination_description']." \n"; diff --git a/app/destinations/destinations_delete.php b/app/destinations/destinations_delete.php index b754506f70..ee4b02a11f 100644 --- a/app/destinations/destinations_delete.php +++ b/app/destinations/destinations_delete.php @@ -1,4 +1,28 @@ + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; @@ -14,22 +38,23 @@ if (count($_GET)>0) { $id = check_str($_GET["id"]); } -if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_destinations "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and destination_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); -} +//delete the destination + if (strlen($id)>0) { + $sql .= "delete from v_destinations "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and destination_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); + } -require_once "includes/header.php"; -echo "\n"; -echo "
\n"; -echo "Delete Complete\n"; -echo "
\n"; -require_once "includes/footer.php"; -return; +//redirect the browser + require_once "includes/header.php"; + echo "\n"; + echo "
\n"; + echo "Delete Complete\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; ?> \ No newline at end of file diff --git a/app/destinations/destinations_edit.php b/app/destinations/destinations_edit.php index c13a91aa93..7798a60259 100644 --- a/app/destinations/destinations_edit.php +++ b/app/destinations/destinations_edit.php @@ -1,4 +1,28 @@ + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; @@ -21,9 +45,12 @@ else { //get http post variables and set them to php variables if (count($_POST)>0) { - $destination_name = check_str($_POST["destination_name"]); + $dialplan_uuid = check_str($_POST["dialplan_uuid"]); + $destination_type = check_str($_POST["destination_type"]); + $destination_number = check_str($_POST["destination_number"]); + $destination_caller_id_name = check_str($_POST["destination_caller_id_name"]); + $destination_caller_id_number = check_str($_POST["destination_caller_id_number"]); $destination_context = check_str($_POST["destination_context"]); - $destination_extension = check_str($_POST["destination_extension"]); $destination_enabled = check_str($_POST["destination_enabled"]); $destination_description = check_str($_POST["destination_description"]); } @@ -36,9 +63,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //check for all required data - //if (strlen($destination_name) == 0) { $msg .= "Please provide: Name
\n"; } + //if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID
\n"; } + //if (strlen($destination_type) == 0) { $msg .= "Please provide: Name
\n"; } + //if (strlen($destination_number) == 0) { $msg .= "Please provide: Extension
\n"; } + //if (strlen($destination_caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name
\n"; } + //if (strlen($destination_caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number
\n"; } //if (strlen($destination_context) == 0) { $msg .= "Please provide: Context
\n"; } - //if (strlen($destination_extension) == 0) { $msg .= "Please provide: Extension
\n"; } //if (strlen($destination_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } //if (strlen($destination_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -60,20 +90,30 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql = "insert into v_destinations "; $sql .= "("; $sql .= "domain_uuid, "; + if (strlen($dialplan_uuid) > 0) { + $sql .= "dialplan_uuid, "; + } $sql .= "destination_uuid, "; - $sql .= "destination_name, "; + $sql .= "destination_type, "; + $sql .= "destination_number, "; + $sql .= "destination_caller_id_name, "; + $sql .= "destination_caller_id_number, "; $sql .= "destination_context, "; - $sql .= "destination_extension, "; $sql .= "destination_enabled, "; $sql .= "destination_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; + if (strlen($dialplan_uuid) > 0) { + $sql .= "'$dialplan_uuid', "; + } $sql .= "'".uuid()."', "; - $sql .= "'$destination_name', "; + $sql .= "'$destination_type', "; + $sql .= "'$destination_number', "; + $sql .= "'$destination_caller_id_name', "; + $sql .= "'$destination_caller_id_number', "; $sql .= "'$destination_context', "; - $sql .= "'$destination_extension', "; $sql .= "'$destination_enabled', "; $sql .= "'$destination_description' "; $sql .= ")"; @@ -91,9 +131,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { $sql = "update v_destinations set "; - $sql .= "destination_name = '$destination_name', "; + if (strlen($dialplan_uuid) > 0) { + $sql .= "dialplan_uuid = '$dialplan_uuid', "; + } + $sql .= "destination_type = '$destination_type', "; + $sql .= "destination_number = '$destination_number', "; + $sql .= "destination_caller_id_name = '$destination_caller_id_name', "; + $sql .= "destination_caller_id_number = '$destination_caller_id_number', "; $sql .= "destination_context = '$destination_context', "; - $sql .= "destination_extension = '$destination_extension', "; $sql .= "destination_enabled = '$destination_enabled', "; $sql .= "destination_description = '$destination_description' "; $sql .= "where domain_uuid = '$domain_uuid' "; @@ -122,9 +167,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $prep_statement->execute(); $result = $prep_statement->fetchAll(); foreach ($result as &$row) { - $destination_name = $row["destination_name"]; + $dialplan_uuid = $row["dialplan_uuid"]; + $destination_type = $row["destination_type"]; + $destination_number = $row["destination_number"]; + $destination_caller_id_name = $row["destination_caller_id_name"]; + $destination_caller_id_number = $row["destination_caller_id_number"]; $destination_context = $row["destination_context"]; - $destination_extension = $row["destination_extension"]; $destination_enabled = $row["destination_enabled"]; $destination_description = $row["destination_description"]; break; //limit to 1 row @@ -132,6 +180,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset ($prep_statement); } +//set the defaults + if (strlen($destination_type) == 0) { $destination_type = 'inbound'; } + if (strlen($destination_context) == 0) { $destination_context = 'public'; } + //show the header require_once "includes/header.php"; @@ -146,12 +198,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -162,12 +209,59 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; @@ -182,17 +276,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; echo "
Destination AddDestination EditDestination
\n"; - echo " Name:\n"; + echo " Type:\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo "Enter the name.\n"; + echo "Select the type.\n"; + echo "
\n"; + echo " Destination:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "Enter the destination.\n"; + echo "
\n"; + echo " Caller ID Name:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "Enter the caller id name.\n"; + echo "
\n"; + echo " Caller ID Number:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "Enter the caller id number.\n"; echo "
\n"; - echo " Extension:\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo "Enter the extension.\n"; - echo "
\n"; echo " Enabled:\n"; @@ -201,13 +284,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; if ($action == "update") { + echo " \n"; echo " \n"; } echo " \n";