From b2613d476cba2db27f51185cbdd821506652d5a1 Mon Sep 17 00:00:00 2001 From: mcrane Date: Wed, 13 May 2009 21:42:31 -0600 Subject: FreeSWITCH package show all profiles on the status page, fix internal.xml copy problem on new install --- config/freeswitch/freeswitch.inc | 43 ++++++++++++++------ config/freeswitch/freeswitch.xml | 2 +- config/freeswitch/freeswitch_profiles.tmp | 2 - config/freeswitch/freeswitch_status.tmp | 67 +++++++++++-------------------- 4 files changed, 55 insertions(+), 59 deletions(-) (limited to 'config/freeswitch') diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index 20c75803..4ed56349 100644 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -282,6 +282,30 @@ function lan_sip_profile() } +function ListFiles($dir) { + + if($dh = opendir($dir)) { + + $files = Array(); + $inner_files = Array(); + + while($file = readdir($dh)) { + if($file != "." && $file != ".." && $file[0] != '.') { + if(is_dir($dir . "/" . $file)) { + //$inner_files = ListFiles($dir . "/" . $file); //recursive + if(is_array($inner_files)) $files = array_merge($files, $inner_files); + } else { + array_push($files, $file); + //array_push($files, $dir . "/" . $file); + } + } + } + + closedir($dh); + return $files; + } +} + function recording_js() { @@ -1804,7 +1828,7 @@ function sync_package_freeswitch() function freeswitch_php_install_command() { global $config; - $freeswitch_package_version = "0.8.7.2"; + $freeswitch_package_version = "0.8.7.3"; $freeswitch_build_version = "1.0.4 pre 6"; $freeswitch_build_revision = "13238"; @@ -2400,18 +2424,19 @@ function freeswitch_php_install_command() $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } - // if backup file exists restore it - $filename = 'freeswitch.bak.tgz'; + // if backup file exists restore it if (!is_dir('/root/backup/')) { - exec("rm -R /usr/local/freeswitch/conf/sip_profiles/"); - exec("rm -R /usr/local/freeswitch/sounds/music/"); exec("mkdir /root/backup/"); } //extract a specific directory to /usr/local/freeswitch + $filename = 'freeswitch.bak.tgz'; if (file_exists('/root/backup/'.$filename)) { //echo "The file $filename exists"; + exec("rm -R /usr/local/freeswitch/conf/sip_profiles/"); + exec("rm -R /usr/local/freeswitch/sounds/music/"); + //Recommended system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/'); system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/'); @@ -2435,14 +2460,6 @@ function freeswitch_php_install_command() } - - write_rcfile(array( - "file" => "freeswitch.sh", - "start" => "/usr/local/freeswitch/bin/./freeswitch -nc", - "stop" => "/usr/local/freeswitch/bin/./freeswitch -stop" - ) - ); - exec("rm -R /freeswitch"); exec("cp /usr/local/freeswitch/conf/directory/default/brian.xml /usr/local/freeswitch/conf/directory/default/brian.xml.noload"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/brian.xml"); diff --git a/config/freeswitch/freeswitch.xml b/config/freeswitch/freeswitch.xml index ff4b89eb..02e236c1 100644 --- a/config/freeswitch/freeswitch.xml +++ b/config/freeswitch/freeswitch.xml @@ -44,7 +44,7 @@ Describe your package requirements here Currently there are no FAQ items provided. FreeSWITCH Settings - 0.8.7.2 + 0.8.7.3 FreeSWITCH: Settings /usr/local/pkg/freeswitch.inc diff --git a/config/freeswitch/freeswitch_profiles.tmp b/config/freeswitch/freeswitch_profiles.tmp index bcfcf021..31ee99a1 100644 --- a/config/freeswitch/freeswitch_profiles.tmp +++ b/config/freeswitch/freeswitch_profiles.tmp @@ -148,8 +148,6 @@ include("head.inc"); $file){ ?> diff --git a/config/freeswitch/freeswitch_status.tmp b/config/freeswitch/freeswitch_status.tmp index ceccd89a..3c6b5231 100644 --- a/config/freeswitch/freeswitch_status.tmp +++ b/config/freeswitch/freeswitch_status.tmp @@ -181,50 +181,31 @@ echo "\n"; fclose($fp); echo "

\n\n"; +foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + + $sip_profile_name = str_replace(".xml", "", $sip_profile_file); + $fp = event_socket_create($host, $port, $password); + $cmd = "api sofia status profile ".$sip_profile_name; + $response = event_socket_request($fp, $cmd); + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " sofia status profile $sip_profile_name \n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n";
+	echo $response;
+	echo "
\n"; + fclose($fp); + echo "

\n\n"; -$fp = event_socket_create($host, $port, $password); -$cmd = "api sofia status profile internal"; -$response = event_socket_request($fp, $cmd); -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
\n"; -echo " sofia status profile internal \n"; -echo "\n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo "
\n"; -echo "
\n";
-echo $response;
-echo "
\n"; -fclose($fp); -echo "

\n\n"; - - -$fp = event_socket_create($host, $port, $password); -$cmd = "api sofia status profile external"; -$response = event_socket_request($fp, $cmd); -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
\n"; -echo " sofia status profile external \n"; -echo "\n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo "
\n"; -echo "
\n";
-echo $response;
-echo "
\n"; -fclose($fp); -echo "

\n\n"; +} $fp = event_socket_create($host, $port, $password); -- cgit v1.2.3