From 1c024d3e3e6928111dd2670cb7ce95225c19f3b6 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 11 Dec 2008 11:18:55 +0000 Subject: FreeSWITCH package previous commit bug fix and freeswitch status add backup and restore. --- packages/freeswitch/freeswitch.inc | 6 ++-- packages/freeswitch/freeswitch.xml | 2 +- packages/freeswitch/freeswitch_status.tmp | 58 ++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc index 3d91c781..754ffb7a 100644 --- a/packages/freeswitch/freeswitch.inc +++ b/packages/freeswitch/freeswitch.inc @@ -990,7 +990,7 @@ function sync_package_freeswitch_ivr() $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; $tmp .= " if (session.ready()) {\n"; $tmp .= " if (dtmf.digits == 0) {\n"; - $tmp .= " dtmf.digits += session.getDigits(1, "#", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; + $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; $tmp .= " if (dtmf.digits == 0) {\n"; //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; @@ -1138,7 +1138,7 @@ function sync_package_freeswitch_ivr() $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; $tmp .= " if (session.ready()) {\n"; $tmp .= " if (dtmf.digits == 0) {\n"; - $tmp .= " dtmf.digits += session.getDigits(1, "#", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; + $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; $tmp .= " if (dtmf.digits == 0) {\n"; //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; @@ -1889,7 +1889,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.3.9"; + $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.4.0"; conf_mount_ro(); diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml index e3675b73..c8e6a5b8 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.3.9 + 0.4.0 FreeSWITCH: Settings /usr/local/pkg/freeswitch.inc diff --git a/packages/freeswitch/freeswitch_status.tmp b/packages/freeswitch/freeswitch_status.tmp index 91fe2852..d5dd7a80 100644 --- a/packages/freeswitch/freeswitch_status.tmp +++ b/packages/freeswitch/freeswitch_status.tmp @@ -43,7 +43,12 @@ if ($_GET['a'] == "download") { if ($_GET['t'] == "cdrcsv") { $tmp = '/usr/local/freeswitch/log/cdr-csv/'; $filename = 'Master.csv'; - } + } + if ($_GET['t'] == "backup") { + $tmp = '/tmp/'; + $filename = 'freeswitch.bak.tgz'; + system('cd /usr/local/;tar cvzf /tmp/freeswitch.bak.tgz freeswitch'); + } session_cache_limiter('public'); $fd = fopen($tmp.$filename, "rb"); header("Content-Type: binary/octet-stream"); @@ -53,6 +58,37 @@ if ($_GET['a'] == "download") { exit; } +if ($_GET['a'] == "other") { + if ($_GET['t'] == "restore") { + $tmp = '/tmp/'; + $filename = 'freeswitch.bak.tgz'; + + //extract a specific directory to /usr/local/freeswitch + if (file_exists('/tmp/'.$filename)) { + //echo "The file $filename exists"; + + //Recommended + system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/db/'); + system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/log/'); + system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/recordings/'); + system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/scripts/'); + system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/storage/'); + + //Optional + //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/conf/'); + //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/grammar/'); + //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/htdocs/'); + //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/sounds/'); + + header( 'Location: freeswitch_status.php?savemsg=Backup+has+been+restored.' ) ; + } + else { + header( 'Location: freeswitch_status.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; + } + + exit; + } +} include("head.inc"); @@ -217,6 +253,26 @@ echo "

\n\n"; echo "

\n\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "Backup / Restore
\n"; +echo "The 'backup' button will tar gzip /usr/local/freeswitch/ to /tmp/freeswitch.bak.tgz it then presents a file to download. \n"; +echo "If the backup file does not exist in /tmp/freeswitch.bak.tgz then the 'restore' button will be hidden. \n"; +echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n"; +echo "

\n"; +echo "
\n"; +echo " \n"; +if (file_exists('/tmp/freeswitch.bak.tgz')) { + echo " \n"; +} +echo "
\n"; +echo "

\n\n"; + + echo "\n"; echo "\n"; echo "
\n"; -- cgit v1.2.3