Reload music on hold when there is changes. The module will not reload if there is someone actively listening to music on hold at that time.

This commit is contained in:
Mark Crane 2012-10-23 06:01:23 +00:00
parent 1c10553675
commit 54e59691a3
2 changed files with 20 additions and 0 deletions

View File

@ -180,6 +180,11 @@ if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['upload_file']['t
fwrite($fout, $file_contents);
fclose($fout);
//reload the module
require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
$moh = new switch_music_on_hold;
$moh->reload();
//set an upload message
$save_msg = "Uploaded file to ".$target_dir."/".htmlentities($_FILES['upload_file']['name']);
}

View File

@ -85,6 +85,21 @@ include "root.php";
return $select;
}
public function reload() {
//if the handle does not exist create it
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the handle still does not exist show an error message
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
}
//send the api command to check if the module exists
if ($fp) {
$cmd = "reload mod_local_stream";
$switch_result = event_socket_request($fp, 'api '.$cmd);
unset($cmd);
}
}
}
//require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";