From 18967860d5f1a38f02f34cf2d790d6dfd1b1a99d Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 31 Dec 2008 01:25:36 +0000 Subject: FreeSWITCH package add music on hold to rec tab add upload for rec and moh, add acl, cidr, and callgroup to extensions. --- packages/freeswitch/freeswitch.inc | 24 +- packages/freeswitch/freeswitch.xml | 2 +- packages/freeswitch/freeswitch_extensions.tmp | 4 +- packages/freeswitch/freeswitch_extensions_edit.tmp | 60 ++++- packages/freeswitch/freeswitch_recordings.tmp | 279 +++++++++++++++++---- packages/freeswitch/freeswitch_recordings_play.tmp | 19 +- 6 files changed, 326 insertions(+), 62 deletions(-) (limited to 'packages/freeswitch') diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc index 8b92536a..cca8e0c1 100644 --- a/packages/freeswitch/freeswitch.inc +++ b/packages/freeswitch/freeswitch.inc @@ -177,6 +177,16 @@ function event_socket_request_cmd($cmd) } +function byte_convert( $bytes ) { + + if ($bytes<=0) + return '0 Byte'; + + $convention=1000; //[1000->10^x|1024->2^x] + $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); + $e=floor(log($bytes,$convention)); + return round($bytes/pow($convention,$e),2).' '.$s[$e]; +} function recording_js() { @@ -401,7 +411,12 @@ function sync_package_freeswitch_extensions() $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); $tmpxml = "\n"; - $tmpxml .= " \n"; + if (strlen($rowhelper['cidr']) == 0) { + $tmpxml .= " \n"; + } + else { + $tmpxml .= " \n"; + } $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; @@ -420,7 +435,10 @@ function sync_package_freeswitch_extensions() } $tmpxml .= " \n"; - } + } + if (strlen($rowhelper['auth-acl']) > 0) { + $tmpxml .= " \n"; + } $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; @@ -2066,7 +2084,7 @@ function freeswitch_php_install_command() } $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 10638."; - $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.5.7.1"; + $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.5.8"; conf_mount_ro(); diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml index e512273e..ba3b2d39 100644 --- a/packages/freeswitch/freeswitch.xml +++ b/packages/freeswitch/freeswitch.xml @@ -44,7 +44,7 @@ Describe your package requirements here Currently there are no FAQ items provided. FreeSWITCH Settings - 0.5.7.2 + 0.5.8 FreeSWITCH: Settings /usr/local/pkg/freeswitch.inc diff --git a/packages/freeswitch/freeswitch_extensions.tmp b/packages/freeswitch/freeswitch_extensions.tmp index 00131836..ca6f3d73 100644 --- a/packages/freeswitch/freeswitch_extensions.tmp +++ b/packages/freeswitch/freeswitch_extensions.tmp @@ -113,7 +113,7 @@ if ($config_change == 1) { Extension Mail To - Context + Call Group Description @@ -144,7 +144,7 @@ if ($config_change == 1) {   -   +     diff --git a/packages/freeswitch/freeswitch_extensions_edit.tmp b/packages/freeswitch/freeswitch_extensions_edit.tmp index c5619d19..ae931c49 100644 --- a/packages/freeswitch/freeswitch_extensions_edit.tmp +++ b/packages/freeswitch/freeswitch_extensions_edit.tmp @@ -57,6 +57,9 @@ if (isset($id) && $a_extensions[$id]) { $pconfig['vm-mailto'] = $a_extensions[$id]['vm-mailto']; $pconfig['vm-attach-file'] = $a_extensions[$id]['vm-attach-file']; $pconfig['user_context'] = $a_extensions[$id]['user_context']; + $pconfig['callgroup'] = $a_extensions[$id]['callgroup']; + $pconfig['auth-acl'] = $a_extensions[$id]['auth-acl']; + $pconfig['cidr'] = $a_extensions[$id]['cidr']; $pconfig['description'] = $a_extensions[$id]['description']; } @@ -82,6 +85,10 @@ if ($_POST) { $ent['vm-mailto'] = $_POST['vm-mailto']; $ent['vm-attach-file'] = $_POST['vm-attach-file']; $ent['user_context'] = $_POST['user_context']; + $ent['callgroup'] = $_POST['callgroup']; + $ent['auth-acl'] = $_POST['auth-acl']; + $ent['cidr'] = $_POST['cidr']; + $ent['description'] = $_POST['description']; if (isset($id) && $a_extensions[$id]) { @@ -105,6 +112,15 @@ include("head.inc"); ?> + @@ -248,14 +264,52 @@ include("head.inc"); Choose whether to attach the file to the email. - + User Context
Enter the user context here. Example: default
- - + + + Call Group + + +
Enter the user call group here. Example: sales
+ + + +
+ + + + + +
Show Advanced + +
+
+ + + Extension Description diff --git a/packages/freeswitch/freeswitch_recordings.tmp b/packages/freeswitch/freeswitch_recordings.tmp index 9e2d0446..a56c92a6 100644 --- a/packages/freeswitch/freeswitch_recordings.tmp +++ b/packages/freeswitch/freeswitch_recordings.tmp @@ -33,47 +33,112 @@ require("guiconfig.inc"); require("/usr/local/pkg/freeswitch.inc"); -$recording_dir = '/usr/local/freeswitch/recordings/'; +$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; +$dir_recordings = '/usr/local/freeswitch/recordings/'; +$dir_music_on_hold_8000 = '/usr/local/freeswitch/sounds/music/8000/'; + +if ($_GET['a'] == "download") { -if (($_GET['a'] == "download") && file_exists($recording_dir.$_GET['filename'])) { session_cache_limiter('public'); - $fd = fopen($recording_dir.$_GET['filename'], "rb"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - header("Content-Type: audio/x-wav"); - } - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize($recording_dir.$_GET['filename'])); - fpassthru($fd); + + if ($_GET['type'] = "rec") { + if (file_exists($dir_recordings.$_GET['filename'])) { + $fd = fopen($dir_recordings.$_GET['filename'], "rb"); + if ($_GET['t'] == "bin") { + header("Content-Type: application/force-download"); + header("Content-Type: application/octet-stream"); + header("Content-Type: application/download"); + header("Content-Description: File Transfer"); + header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); + } + else { + $file_ext = substr($_GET['filename'], -3); + if ($file_ext == "wav") { + header("Content-Type: audio/x-wav"); + } + if ($file_ext == "mp3") { + header("Content-Type: audio/mp3"); + } + } + header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header("Content-Length: " . filesize($dir_recordings.$_GET['filename'])); + fpassthru($fd); + } + } + + if ($_GET['type'] = "moh") { + if (file_exists($dir_music_on_hold_8000.$_GET['filename'])) { + $fd = fopen($dir_music_on_hold_8000.$_GET['filename'], "rb"); + if ($_GET['t'] == "bin") { + header("Content-Type: application/force-download"); + header("Content-Type: application/octet-stream"); + header("Content-Type: application/download"); + header("Content-Description: File Transfer"); + header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); + } + else { + $file_ext = substr($_GET['filename'], -3); + if ($file_ext == "wav") { + header("Content-Type: audio/x-wav"); + } + if ($file_ext == "mp3") { + header("Content-Type: audio/mp3"); + } + } + header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header("Content-Length: " . filesize($dir_music_on_hold_8000.$_GET['filename'])); + fpassthru($fd); + } + } + exit; } else { - //echo $recording_dir.$_GET['filename']; + //echo $dir_recordings.$_GET['filename']; +} + +if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { + + if ($_POST['type'] == 'moh') { + move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_music_on_hold_8000 . $_FILES['ulfile']['name']); + $savemsg = "Uploaded file to $dir_music_on_hold_8000" . htmlentities($_FILES['ulfile']['name']); + //system('chmod -R 744 $dir_music_on_hold_8000*'); + unset($_POST['txtCommand']); + } + if ($_POST['type'] == 'rec') { + move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_recordings . $_FILES['ulfile']['name']); + $savemsg = "Uploaded file to $dir_recordings" . htmlentities($_FILES['ulfile']['name']); + //system('chmod -R 744 $dir_recordings*'); + unset($_POST['txtCommand']); + } } -$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; if ($_GET['act'] == "del") { - if ($_GET['type'] == 'recordings') { + if ($_GET['type'] == 'rec') { if ($a_recordings[$_GET['id']]) { - unlink('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']); + unlink_if_exists('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']); unset($a_recordings[$_GET['id']]); write_config(); header("Location: freeswitch_recordings.php"); exit; } } + + if ($_GET['type'] == 'moh') { + unlink_if_exists($dir_music_on_hold_8000.$_GET['filename']); + header("Location: freeswitch_recordings.php"); + exit; + } + } + + include("head.inc"); ?> @@ -117,7 +182,6 @@ function EvalSound(soundobj) { -
0) { $config_change = 0; -if (is_dir($recording_dir)) { - if ($dh = opendir($recording_dir)) { +if (is_dir($dir_recordings)) { + if ($dh = opendir($dir_recordings)) { while (($file = readdir($dh)) !== false) { - if (filetype($recording_dir . $file) == "file") { + if (filetype($dir_recordings . $file) == "file") { if (strpos($config_recording_list, $file) === false) { - //$handle = fopen($recording_dir.$file,'rb'); - //$file_content = fread($handle,filesize($recording_dir.$file)); + //$handle = fopen($dir_recordings.$file,'rb'); + //$file_content = fread($handle,filesize($dir_recordings.$file)); //fclose($handle); $a_file = split("\.", $file); @@ -177,12 +241,12 @@ if (is_dir($recording_dir)) { //if (count($a_recordings) > 0) { // foreach ($a_recordings as $recordingent) { -// if (!is_file($recording_dir.$recordingent['filename'])) { +// if (!is_file($dir_recordings.$recordingent['filename'])) { //echo "not found: ".$recordingent['filename']."
"; //recording not found restore the file from the config.xml //$file_content = $recordingent['filecontent']; - //$handle = fopen($recording_dir.$recordingent['filename'],'w'); + //$handle = fopen($dir_recordings.$recordingent['filename'],'w'); //fwrite ($handle, base64_decode($file_content)); //unset($file_content); //fclose($handle); @@ -214,28 +278,44 @@ if ($config_change == 1) { //endif; ?> - - - - -

Note:
-
- To make a recording dial extension 732673 (record) or you can make a - 16bit 8khz/16khz Mono WAV file then copy it to the - following directory then refresh the page to play it back. - Click on the 'Filename' to download it or the 'Recording Name' to - play the audio. -
-
- /usr/local/freeswitch/recordings/ -

-
+ + + + +

Recordings:
+
+ To make a recording dial extension 732673 (record) or you can make a + 16bit 8khz/16khz Mono WAV file then copy it to the + following directory then refresh the page to play it back. + Click on the 'Filename' to download it or the 'Recording Name' to + play the audio. +

+ +
+ +
+ + + + + + + + +
location: + + File to upload: + + +
+
+
- - - + + + + +
Filename (download)Recording Name (play)DescriptionFilename (download)Recording Name (play)Description +

+ +
+ +
+
+ + + + + + + +
location: + + File to upload: + + +
+
+ + + + + + + + + + + + \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + + } + } + closedir($handle); + } + ?> + + + + + +
File Name (download)Name (play)Last ModifiedSize
\n"; + echo " \n"; + echo " $file"; + echo " "; + echo " \n"; + echo " \n"; + $tmp_file_array = split("\.",$file); + echo " ".$tmp_file_array[0]; + echo " "; + echo " \n"; + echo date ("F d Y H:i:s", filemtime($dir_music_on_hold_8000.$file)); + echo " \n"; + echo " ".$tmp_filesize; + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "


diff --git a/packages/freeswitch/freeswitch_recordings_play.tmp b/packages/freeswitch/freeswitch_recordings_play.tmp index aa837c58..4135362d 100644 --- a/packages/freeswitch/freeswitch_recordings_play.tmp +++ b/packages/freeswitch/freeswitch_recordings_play.tmp @@ -32,9 +32,12 @@ */ $filename = $_GET['filename']; +$type = $_GET['type']; //moh //rec ?> + + @@ -45,7 +48,21 @@ $filename = $_GET['filename'];
- + \n"; + } + if ($file_ext == "mp3") { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + ?>
-- cgit v1.2.3