This commit is contained in:
markjcrane
2016-06-24 14:51:15 -06:00
33 changed files with 269 additions and 958 deletions

View File

@@ -230,7 +230,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan->dialplan_uuid = $dialplan_uuid;
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan->dialplan_detail_type = 'destination_number';
$dialplan->dialplan_detail_data = '^'.str_replace('*', '\*', $call_flow_feature_code).'$';
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_feature_code)).'$';
$dialplan->dialplan_detail_break = 'on-true';
//$dialplan->dialplan_detail_inline = '';
$dialplan->dialplan_detail_group = '1';
@@ -287,7 +287,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan->dialplan_uuid = $dialplan_uuid;
$dialplan->dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan->dialplan_detail_type = 'destination_number';
$dialplan->dialplan_detail_data = '^'.str_replace('*', '\*', $call_flow_extension).'$';
$dialplan->dialplan_detail_data = '^'.str_replace('+', '\+', str_replace('*', '\*', $call_flow_extension)).'$';
//$dialplan->dialplan_detail_break = '';
//$dialplan->dialplan_detail_inline = '';
$dialplan->dialplan_detail_group = '2';

View File

@@ -51,13 +51,13 @@ else {
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//prepare the command
if ($cmd == "unregister") {
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
}
else {
$command = "lua app.lua event_notify ".$profile." ".$cmd." ".$user." ".$vendor;
//if ($cmd == "check_sync") {
// $command = "sofia profile ".$profile." check_sync ".$user;
//}
@@ -65,8 +65,10 @@ else {
//send the command
$response = event_socket_request($fp, "api ".$command);
$response = event_socket_request($fp, "api log notice ".$command);
//show the response
$_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response;
//close the connection
fclose($fp);
}
@@ -77,7 +79,15 @@ else {
echo $response;
}
else {
header("Location: status_registrations.php?profile=".$profile."&show=".$show);
//send the message
$_SESSION["message_delay"] = 3500;
$_SESSION["message_mood"] = 'positive';
$_SESSION["message"] = $text['button-applied'];
//send the redirect
if (isset($_SERVER['HTTP_REFERER'])) {
header("Location: ".$_SERVER['HTTP_REFERER']);
}
}
?>
?>

View File

@@ -50,6 +50,7 @@
//add or update the device keys
foreach ($_POST['device_keys'] as &$row) {
//validate the data
$valid_data = true;
//if (!is_uuid($row["device_key_uuid"])) { $valid_data = false; }
@@ -59,6 +60,7 @@
if (strlen($row["device_key_type"]) > 25) { $valid_data = false; echo "type "; }
if (strlen($row["device_key_value"]) > 25) { $valid_data = false; echo "value "; }
if (strlen($row["device_key_label"]) > 25) { $valid_data = false; echo "label "; }
//escape characters in the string
$device_uuid = check_str($row["device_uuid"]);
$device_key_uuid = check_str($row["device_key_uuid"]);
@@ -177,6 +179,18 @@
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get the user
foreach ($device_lines as $row) {
if ($_SESSION['domain_name'] == $row['server_address']) {
$user_id = $row['user_id'];
$server_address = $row['server_address'];
break;
}
}
//set the sip profile name
$sip_profile_name = 'internal';
//get device keys
$sql = "SELECT * from v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
@@ -239,11 +253,11 @@
echo " <br />";
echo " </div>\n";
// echo " <div style='float: right;'>";
// echo " <input type='button' class='btn' value='".$text['button-apply']."' onclick=\"document.location.href='".PROJECT_PATH."/app/devices/cmd.php?cmd=check_sync&profile=".$sip_profile_name."&show=".$show."&user=".$row['user']."&domain=".$row['sip-auth-realm']."&agent=".urlencode($row['agent'])."';\" ".$onhover_pause_refresh.">\n";
// echo " </div>\n";
echo " <div style='float: right;'>";
echo " </div>\n";
echo "<div style='float: right;'>\n";
echo " <input type='button' class='btn' value='".$text['button-apply']."' onclick=\"document.location.href='".PROJECT_PATH."/app/devices/cmd.php?cmd=check_sync&profile=".$sip_profile_name."&user=".$user_id."@".$server_address."&domain=".$server_address."&agent=".$device_key_vendor."';\">&nbsp;\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</div>\n";

View File

@@ -108,17 +108,35 @@ include "root.php";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $row) {
//set the variables
$moh_name = $row['music_on_hold_name'];
$moh_rate = $row['music_on_hold_rate'];
//set the value
$moh_value = "local_stream://".$moh_name;
if($moh_name == 'default') {
$moh_name = $text['option-default'];
}
$array[$moh_value] = str_replace('_', ' ', $moh_name);
//build the names array without the rates
$names = array();
foreach($result as $row) {
//convert the strings into arrays
$name_array = explode("/", $row['music_on_hold_name']);
//name with the domain
if (count($name_array) == "3") {
$stream_name = $name_array[0].'/'.$name_array[1];
}
//name without the domain
if (count($name_array) == "2") {
$stream_name = $name_array[0];
}
//prevent duplicate names in the array
if (!in_array($stream_name, $names)) {
$names[] = $stream_name;
}
}
//add the value and name to the array before it is returned
foreach($names as $name) {
$value = "local_stream://".$name;
if($stream == 'default') {
$name = $text['option-default'];
}
$array[$value] = str_replace('_', ' ', $name);
}
//return the array
@@ -216,4 +234,4 @@ include "root.php";
//$moh->xml();
//$moh->save();
?>
?>

View File

@@ -55,6 +55,19 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Define which storage type (base_64 stores in the database).';
$x++;
$array[$x]['default_setting_category'] = 'voicemail';
$array[$x]['default_setting_subcategory'] = 'message_max_length';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '300';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Maximum length of a voicemail (in seconds).';
$x++;
$array[$x]['default_setting_category'] = 'voicemail';
$array[$x]['default_setting_subcategory'] = 'greeting_max_length';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '90';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Maximum length of a voicemail greeting (in seconds).';
//iterate and add each, if necessary
foreach ($array as $index => $default_settings) {