From 734d2b9891f769f72c02776d2eaefad3d42b18ff Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 11 Dec 2008 12:05:44 +0000 Subject: FreeSWITCH package if the backup file exists during the install auto restore it. Also adjusted timeout option for the auto attendant. --- packages/freeswitch/freeswitch.inc | 76 ++++++++++++++++++++++++-------------- packages/freeswitch/freeswitch.xml | 2 +- pkg_config.7.xml | 2 +- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc index 754ffb7a..32349c0d 100644 --- a/packages/freeswitch/freeswitch.inc +++ b/packages/freeswitch/freeswitch.inc @@ -994,7 +994,7 @@ function sync_package_freeswitch_ivr() $tmp .= " if (dtmf.digits == 0) {\n"; //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; - + $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; //find the timeout IVR options with the correct action if (count($a_ivr_options) > 0) { foreach($a_ivr_options as $row) { @@ -1002,7 +1002,7 @@ function sync_package_freeswitch_ivr() if ($row['ivrid'] == $rowhelper['ivrid']) { if ($row['optionaction'] == "action") { - + if ($row['optionnumber'] == "t") { if ($row['optiontype'] == "extension") { $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; } @@ -1010,8 +1010,8 @@ function sync_package_freeswitch_ivr() //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; } - - } //end anti-action + } + } //end anti-action } //end ivrid @@ -1064,17 +1064,17 @@ function sync_package_freeswitch_ivr() //$tmpaction .= "\n"; switch ($row['optionnumber']) { - case "t": + //case "t": - if ($row['optiontype'] == "extension") { - $tmpactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; - } - if ($row['optiontype'] == "voicemail") { - //$tmpactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; - $tmpactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + //if ($row['optiontype'] == "extension") { + // $tmpactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; + //} + //if ($row['optiontype'] == "voicemail") { + // //$tmpactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; + // $tmpactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; + //} - break; + //break; default: //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; if ($x == 0) { @@ -1146,11 +1146,11 @@ function sync_package_freeswitch_ivr() //find the timeout IVR options with the correct action if (count($a_ivr_options) > 0) { foreach($a_ivr_options as $row) { - if ($row['ivrid'] == $rowhelper['ivrid']) { if ($row['optionaction'] == "anti-action") { + if ($row['optionnumber'] == "t") { if ($row['optiontype'] == "extension") { $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; @@ -1159,11 +1159,10 @@ function sync_package_freeswitch_ivr() //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; } - - } //end anti-action + } + } //end anti-action } //end ivrid - } //end for each } //if count @@ -1221,17 +1220,17 @@ function sync_package_freeswitch_ivr() if ($row['optionaction'] == "anti-action") { switch ($row['optionnumber']) { - case "t": + //case "t": - if ($row['optiontype'] == "extension") { - $tmpantiactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; - } - if ($row['optiontype'] == "voicemail") { - //$tmpantiactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; - $tmpantiactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + //if ($row['optiontype'] == "extension") { + // $tmpantiactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; + //} + //if ($row['optiontype'] == "voicemail") { + // //$tmpantiactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; + // $tmpantiactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; + //} - break; + //break; default: //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; @@ -1871,6 +1870,29 @@ function freeswitch_php_install_command() $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } + // if backup file exists restore it + $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/'); + + unset($filename); + } + write_rcfile(array( "file" => "freeswitch.sh", "start" => "/usr/local/freeswitch/bin/./freeswitch -nc", @@ -1889,7 +1911,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.4.0"; + $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.4.1"; conf_mount_ro(); diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml index c8e6a5b8..f24ffcc6 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.4.0 + 0.4.1 FreeSWITCH: Settings /usr/local/pkg/freeswitch.inc diff --git a/pkg_config.7.xml b/pkg_config.7.xml index b426033f..8f4c264d 100644 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -49,7 +49,7 @@ Services http://www.pfsense.com/packages/config/freeswitch/freeswitch.xml http://files.pfsense.org/packages/7/All/ - 0.4.0 + 0.4.1 Beta 1.2.1 markjcrane@gmail.com -- cgit v1.2.3