diff options
31 files changed, 650 insertions, 449 deletions
diff --git a/config/freeswitch_dev/v_config.inc b/config/freeswitch_dev/v_config.inc index 19f709bd..e3ea77c7 100644 --- a/config/freeswitch_dev/v_config.inc +++ b/config/freeswitch_dev/v_config.inc @@ -30,7 +30,33 @@ */ //ob_start("ob_gzhandler"); -$v_project_label = 'FreeSWITCH'; //FreeSWITCH (TM) http://www.freeswitch.org/ + + +//global variables + $php_dir = '/usr/local/bin/php'; + $tmp_dir = '/tmp/'; + $v_package_version = "0.9.7.6"; + $v_build_version = "1.0.4"; + $v_build_revision = ""; + $v_label = 'FreeSWITCH'; //FreeSWITCH (TM) http://www.freeswitch.org/ + $v_name = 'freeswitch'; + $v_dir = '/usr/local/freeswitch'; + $v_backup_dir = '/root/backup'; + $v_web_dir = '/usr/local/www/packages/freeswitch'; + $v_conf_dir = '/usr/local/freeswitch/conf'; + $v_db_dir = '/usr/local/freeswitch/db'; + $v_htdocs_dir = '/usr/local/freeswitch/htdocs'; + $v_log_dir = '/usr/local/freeswitch/log'; + $v_mod_dir = '/usr/local/freeswitch/mod'; + $v_scripts_dir = '/usr/local/freeswitch/scripts'; + $v_storage_dir = '/usr/local/freeswitch/storage'; + $v_recordings_dir = '/usr/local/freeswitch/recordings'; + +//preferences + $v_label_show = true; + $v_path_show = true; + $v_menu_show = true; + function build_menu() { @@ -264,21 +290,22 @@ function byte_convert( $bytes ) { function lan_sip_profile() { - global $config; + global $config; + global $v_conf_dir; clearstatcache(); //if the lan directory does not exist then create it - if (!is_dir('/usr/local/freeswitch/conf/sip_profiles/lan/')) { - exec("mkdir /usr/local/freeswitch/conf/sip_profiles/lan/"); + if (!is_dir($v_conf_dir.'/sip_profiles/lan/')) { + exec("mkdir ".$v_conf_dir."/sip_profiles/lan/"); } //create the LAN profile if it doesn't exist - if (!file_exists('/usr/local/freeswitch/conf/sip_profiles/lan.xml')) { + if (!file_exists($v_conf_dir.'/sip_profiles/lan.xml')) { $lan_ip = $config['interfaces']['lan']['ipaddr']; if (strlen($lan_ip) > 0) { - exec("cp /usr/local/freeswitch/conf/sip_profiles/internal.xml /usr/local/freeswitch/conf/sip_profiles/lan.xml"); + exec("cp ".$v_conf_dir."/sip_profiles/internal.xml ".$v_conf_dir."/sip_profiles/lan.xml"); - $filename = "/usr/local/freeswitch/conf/sip_profiles/lan.xml"; + $filename = $v_conf_dir."/sip_profiles/lan.xml"; $handle = fopen($filename,"rb"); $contents = fread($handle, filesize($filename)); fclose($handle); @@ -326,9 +353,14 @@ function recording_js() { global $config; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_recordings_dir; + $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']; - $fout = fopen("/usr/local/freeswitch/scripts/recordings.js","w"); + $fout = fopen($v_scripts_dir."/recordings.js","w"); $tmp = " var pin = \"".$admin_pin."\";\n"; $tmp .= " //var pin = \"\"; //don't require a pin\n"; $tmp .= " //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id\n"; @@ -390,7 +422,7 @@ function recording_js() //$tmp .= " session.execute(\"speak\", \"Please enter your pin number now.\");\n"; $tmp .= " digitmaxlength = 6;\n"; $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n"; $tmp .= " }\n"; $tmp .= "\n"; @@ -399,16 +431,16 @@ function recording_js() //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n"; //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n"; //$tmp .= " session.execute(\"speak\", \"Begin recording.\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/begin_recording.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/begin_recording.wav\", mycb, \"dtmf\");\n"; $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.execute(\"record\", \"/usr/local/freeswitch/recordings/temp\"+Year+Month+Day+Hours+Mins+Seconds+\".wav 180 200\");\n"; + $tmp .= " session.execute(\"record\", \"".$v_recordings_dir."/temp\"+Year+Month+Day+Hours+Mins+Seconds+\".wav 180 200\");\n"; $tmp .= " }\n"; $tmp .= " else {\n"; $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n"; //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n"; //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n"; //$tmp .= " session.execute(\"speak\", \"Your pin number is incorect, goodbye.\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; $tmp .= " }\n"; $tmp .= " session.hangup();\n"; $tmp .= "\n"; @@ -423,12 +455,15 @@ function recording_js() function sync_package_v_settings() { - global $config; + global $config; + global $v_conf_dir; + global $v_scripts_dir; + if($config['installedpackages']['freeswitchsettings']['config'] != "") { foreach($config['installedpackages']['freeswitchsettings']['config'] as $rowhelper) { - $fout = fopen("/usr/local/freeswitch/conf/directory/default/default.xml","w"); + $fout = fopen($v_conf_dir."/directory/default/default.xml","w"); $tmpxml = "<include>\n"; $tmpxml .= " <user id=\"default\"> <!--if id is numeric mailbox param is not necessary-->\n"; $tmpxml .= " <variables>\n"; @@ -444,7 +479,7 @@ function sync_package_v_settings() unset($tmpxml); fclose($fout); - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/event_socket.conf.xml","w"); $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n"; $tmpxml .= " <settings>\n"; $tmpxml .= " <param name=\"listen-ip\" value=\"0.0.0.0\"/>\n"; @@ -457,7 +492,7 @@ function sync_package_v_settings() unset($tmpxml, $event_socket_password); fclose($fout); - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/xml_rpc.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/xml_rpc.conf.xml","w"); $tmpxml = "<configuration name=\"xml_rpc.conf\" description=\"XML RPC\">\n"; $tmpxml .= " <settings>\n"; $tmpxml .= " <!-- The port where you want to run the http service (default 8080) -->\n"; @@ -475,7 +510,7 @@ function sync_package_v_settings() recording_js(); //shout.conf.xml - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/shout.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/shout.conf.xml","w"); $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n"; $tmpxml .= " <settings>\n"; $tmpxml .= " <!-- Don't change these unless you are insane -->\n"; @@ -490,7 +525,7 @@ function sync_package_v_settings() //config.js $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']; - $fout = fopen("/usr/local/freeswitch/scripts/config.js","w"); + $fout = fopen($v_scripts_dir."/config.js","w"); $tmp = "//javascript include\n\n"; $tmp .= "var admin_pin = \"" . $admin_pin . "\";\n"; fwrite($fout, $tmp); @@ -509,14 +544,15 @@ function sync_package_v_settings() function sync_package_v_dialplan() { - global $config; + global $config; + global $v_conf_dir; //using backup files rather than pfsense config.xml for this file $config['installedpackages']['freeswitchpublic']['config'][0]['dialplan_default_xml'] = ""; //if(strlen($config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']) == 0) { /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ - //$filename = "/usr/local/freeswitch/conf/dialplan/default.xml"; + //$filename = $v_conf_dir."/dialplan/default.xml"; //$fout = fopen($filename,"r"); //$tmpxml = fread($fout, filesize($filename)); //$config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml); @@ -525,7 +561,7 @@ function sync_package_v_dialplan() //} //else { /* found the dialplan in the pfsense config.xml save it to default.xml. */ - //$fout = fopen("/usr/local/freeswitch/conf/dialplan/default.xml","w"); + //$fout = fopen($v_conf_dir."/dialplan/default.xml","w"); //$tmpxml = $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']; //fwrite($fout, base64_decode($tmpxml)); //fclose($fout); @@ -542,23 +578,25 @@ function sync_package_v_dialplan() function sync_package_v_extensions() { - global $config; + global $config; + global $v_conf_dir; + if($config['installedpackages']['freeswitchextensions']['config'] != "") { /* delete all old extensions to prepare for new ones */ - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/1*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/2*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/3*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/4*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/5*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/6*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/7*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/8*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/9*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/1*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/2*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/3*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/4*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/5*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/6*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/7*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/8*.xml"); + unlink_if_exists($v_conf_dir."/directory/default/9*.xml"); foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) { if ($rowhelper['enabled'] != "false") { - $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); + $fout = fopen($v_conf_dir."/directory/default/".$rowhelper['extension'].".xml","w"); $tmpxml = "<include>\n"; if (strlen($rowhelper['cidr']) == 0) { @@ -634,16 +672,18 @@ function sync_package_v_extensions() function sync_package_v_gateways() { - global $config; + global $config; + global $v_conf_dir; + if($config['installedpackages']['freeswitchgateways']['config'] != "") { /* delete all old gateways to prepare for new ones */ - unlink_if_exists("/usr/local/freeswitch/conf/sip_profiles/external/*.xml"); + unlink_if_exists($v_conf_dir."/sip_profiles/external/*.xml"); foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) { if ($rowhelper['enabled'] != "false") { - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external/".$rowhelper['gateway'].".xml","w"); + $fout = fopen($v_conf_dir."/sip_profiles/external/".$rowhelper['gateway'].".xml","w"); $tmpxml .= "<include>\n"; $tmpxml .= " <gateway name=\"" . $rowhelper['gateway'] . "\">\n"; @@ -734,9 +774,10 @@ function sync_package_v_modules() { global $config; + global $v_conf_dir; foreach($config['installedpackages']['freeswitchmodules']['config'] as $rowhelper) { - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/modules.conf.xml","w"); $tmpxml =""; $tmpxml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n"; @@ -874,14 +915,15 @@ function sync_package_v_modules() function sync_package_v_public() { - global $config; + global $config; + global $v_conf_dir; //using backup files rather than pfsense config.xml for this file $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = ""; //if(strlen($config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']) == 0) { // /* dialplan_public_xml not found in the pfsense config.xml get the default public.xml and save to config.xml. */ - // $filename = "/usr/local/freeswitch/conf/dialplan/public.xml"; + // $filename = $v_conf_dir."/dialplan/public.xml"; // $fout = fopen($filename,"r"); // $tmpxml = fread($fout, filesize($filename)); // $tmpxml = str_replace("<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>", "<!--<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>-->", $tmpxml); @@ -892,7 +934,7 @@ function sync_package_v_public() //} //else { // /* found dialplan_public_xml in the pfsense config.xml save it to public.xml. */ - // $fout = fopen("/usr/local/freeswitch/conf/dialplan/public.xml","w"); + // $fout = fopen($v_conf_dir."/dialplan/public.xml","w"); // $tmpxml = $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']; // fwrite($fout, base64_decode($tmpxml)); // fclose($fout); @@ -910,13 +952,14 @@ function sync_package_v_vars() { global $config; + global $v_conf_dir; //using backup files rather than pfsense config.xml for this file $config['installedpackages']['freeswitchpublic']['config'][0]['vars_xml'] = ""; //if(strlen($config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']) == 0) { // /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ - // $filename = "/usr/local/freeswitch/conf/vars.xml"; + // $filename = $v_conf_dir."/vars.xml"; // $fout = fopen($filename,"r"); // $tmpxml = fread($fout, filesize($filename)); // $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml); @@ -925,7 +968,7 @@ function sync_package_v_vars() //} //else { // /* found the dialplan in the pfsense config.xml save it to default.xml. */ - // $fout = fopen("/usr/local/freeswitch/conf/vars.xml","w"); + // $fout = fopen($v_conf_dir."/vars.xml","w"); // $tmpxml = $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']; // fwrite($fout, base64_decode($tmpxml)); // fclose($fout); @@ -942,57 +985,59 @@ function sync_package_v_vars() function sync_package_v_internal() { global $config; + global $v_conf_dir; + + if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) { + /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */ + $filename = $v_conf_dir."/sip_profiles/internal.xml"; + $fout = fopen($filename,"r"); + $tmpxml = fread($fout, filesize($filename)); + $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml); + unset($filename, $dialplan); + fclose($fout); + } + else { + /* found the internal_xml in the pfsense config.xml save it to internal.xml. */ + $fout = fopen($v_conf_dir."/sip_profiles/internal.xml","w"); + $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']; + fwrite($fout, base64_decode($tmpxml)); + fclose($fout); + unset($tmpxml); + } - if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) { - /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */ - $filename = "/usr/local/freeswitch/conf/sip_profiles/internal.xml"; - $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); - $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml); - unset($filename, $dialplan); - fclose($fout); - } - else { - /* found the internal_xml in the pfsense config.xml save it to internal.xml. */ - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/internal.xml","w"); - $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']; - fwrite($fout, base64_decode($tmpxml)); - fclose($fout); - unset($tmpxml); - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); + $cmd = "api reloadxml"; + //event_socket_request_cmd($cmd); + unset($cmd); } function sync_package_v_external() { - global $config; - - if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) { - /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */ - $filename = "/usr/local/freeswitch/conf/sip_profiles/external.xml"; - $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); - $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml); - unset($filename, $dialplan); - fclose($fout); - } - else { - /* found the external_xml in the pfsense config.xml save it to external.xml. */ - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external.xml","w"); - $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']; - fwrite($fout, base64_decode($tmpxml)); - fclose($fout); - unset($tmpxml); - } + global $config; + global $v_conf_dir; + + if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) { + /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */ + $filename = $v_conf_dir."/sip_profiles/external.xml"; + $fout = fopen($filename,"r"); + $tmpxml = fread($fout, filesize($filename)); + $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml); + unset($filename, $dialplan); + fclose($fout); + } + else { + /* found the external_xml in the pfsense config.xml save it to external.xml. */ + $fout = fopen($v_conf_dir."/sip_profiles/external.xml","w"); + $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']; + fwrite($fout, base64_decode($tmpxml)); + fclose($fout); + unset($tmpxml); + } - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); + $cmd = "api reloadxml"; + //event_socket_request_cmd($cmd); + unset($cmd); } @@ -1009,6 +1054,10 @@ function sync_package_v_hunt_group() global $config; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_recordings_dir; //get the domain $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; @@ -1349,7 +1398,7 @@ function sync_package_v_hunt_group() $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n"; $tmp .= " if (profile == \"auto\") {\n"; $i = 0; - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){ $sip_profile_name = str_replace(".xml", "", $sip_profile_file); if ($i == 0) { $tmp .= " profile = \"".$sip_profile_name."\";\n"; @@ -1424,7 +1473,7 @@ function sync_package_v_hunt_group() $tmp .= " dtmf.digits = \"\";\n"; $tmp .= " digitmaxlength = 6;\n"; $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n"; $tmp .= "\n"; $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n"; @@ -1432,7 +1481,7 @@ function sync_package_v_hunt_group() $tmp .= " }\n"; $tmp .= " else {\n"; $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"".$v_conf_dir."/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; $tmp .= " session.hangup();\n"; $tmp .= " }\n"; $tmp .= "}\n"; @@ -1447,7 +1496,7 @@ function sync_package_v_hunt_group() $tmp .= "}"; $tmp .= "\n"; $tmp .= "var caller_announce = extension+\"_\"+Year+Month+Day+Hours+Mins+Seconds+\".wav\";\n"; - $tmp .= "session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_say_your_name_and_reason_for_calling.wav\");\n"; + $tmp .= "session.streamFile( \"".$v_dir."/sounds/custom/8000/please_say_your_name_and_reason_for_calling.wav\");\n"; $tmp .= "session.execute(\"gentones\", \"%(1000, 0, 640)\");\n"; $tmp .= "session.execute(\"set\", \"playback_terminators=#\");\n"; $tmp .= "session.execute(\"record\", \"/tmp/\"+caller_announce+\" 180 200\");\n"; @@ -1671,7 +1720,7 @@ function sync_package_v_hunt_group() if (strlen($rowhelper['huntgroupid']) > 0) { $huntgroupfilename = "huntgroup_".str_replace(array("{", "}"), "", $rowhelper['huntgroupid']).".js"; - $fout = fopen("/usr/local/freeswitch/scripts/".$huntgroupfilename,"w"); + $fout = fopen($v_scripts_dir."/".$huntgroupfilename,"w"); fwrite($fout, $tmp); unset($huntgroupfilename); fclose($fout); @@ -1688,6 +1737,13 @@ function sync_package_v_fax() { global $config; + global $php_dir; + global $tmp_dir; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_storage_dir; + global $v_web_dir; //loop through all faxes $a_fax = &$config['installedpackages']['freeswitchfax']['config']; @@ -1734,8 +1790,8 @@ function sync_package_v_fax() $id = $i; //echo "update".$i."<br />\n"; - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml"); + if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$extensionname.".xml")){ + unlink($v_conf_dir."/dialplan/default/".$order."_".$extensionname.".xml"); } } $i++; @@ -1802,26 +1858,26 @@ function sync_package_v_fax() $a_dialplan_include_details[] = $ent; unset($ent); - //<action application="rxfax" data="/usr/local/freeswitch/storage/fax/inbox/${last_fax}.tif"/> + //<action application="rxfax" data="$v_storage_dir/fax/inbox/${last_fax}.tif"/> $ent = array(); $ent['dialplanincludeid'] = $faxid; $ent['tag'] = 'action'; //condition, action, antiaction $ent['fieldorder'] = '004'; $ent['fieldtype'] = 'rxfax'; - $ent['fielddata'] = '/usr/local/freeswitch/storage/fax/'.$rowhelper['faxextension'].'/inbox/${last_fax}.tif'; + $ent['fielddata'] = $v_storage_dir.'/fax/'.$rowhelper['faxextension'].'/inbox/${last_fax}.tif'; $a_dialplan_include_details[] = $ent; unset($ent); - //<action application="system" data="/opt/freeswitch/scripts/emailfax.sh USER DOMAIN /usr/local/freeswitch/storage/fax/inbox/9872/${last_fax}.tif"/> + //<action application="system" data="$v_scripts_dir/emailfax.sh USER DOMAIN $v_storage_dir/fax/inbox/9872/${last_fax}.tif"/> $ent = array(); $ent['dialplanincludeid'] = $faxid; $ent['tag'] = 'action'; //condition, action, antiaction $ent['fieldorder'] = '005'; $ent['fieldtype'] = 'system'; - $ent['fielddata'] = '/usr/local/bin/php /usr/local/www/packages/freeswitch/fax_to_email.php email='.$rowhelper['faxemail'].' extension='.$rowhelper['faxextension'].' name=${last_fax} >> /tmp/fax.txt'; + $ent['fielddata'] = $php_dir.' '.$v_web_dir.'/fax_to_email.php email='.$rowhelper['faxemail'].' extension='.$rowhelper['faxextension'].' name=${last_fax} >> '.$tmp_dir.'/fax.txt'; $a_dialplan_include_details[] = $ent; unset($ent); - + //<action application="hangup"/> $ent = array(); $ent['dialplanincludeid'] = $faxid; @@ -1891,7 +1947,15 @@ function get_recording_filename($id) function sync_package_v_ivr() { - global $config; + global $config; + global $php_dir; + global $tmp_dir; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_recordings_dir; + global $v_storage_dir; + global $v_web_dir; $a_ivr = &$config['installedpackages']['freeswitchivr']['config']; if (count($a_ivr) > 0) { @@ -2107,11 +2171,11 @@ function sync_package_v_ivr() $tmp .= "\n"; $tmp .= "//console_log( \"info\", \"IVR Server Time is: \"+Hours+\":\"+Mins+\" \\n\" );\n"; $tmp .= "\n"; - + $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n"; $tmp .= " if (profile == \"auto\") {\n"; $i = 0; - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){ $sip_profile_name = str_replace(".xml", "", $sip_profile_file); if ($i == 0) { $tmp .= " profile = \"".$sip_profile_name."\";\n"; @@ -2239,8 +2303,8 @@ function sync_package_v_ivr() $tmp .= "\n"; $tmp .= " digitmaxlength = 1;\n"; $tmp .= " while (session.ready() && ! exit ) {\n"; - $tmp .= " //session.streamFile( \"C:/Program Files/FreeSWITCH/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; + $tmp .= " //session.streamFile( \"".$v_dir."/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; + $tmp .= " session.streamFile( \"".$v_recordings_dir."/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; $tmp .= " if (session.ready()) {\n"; $tmp .= " if (dtmf.digits.length == 0) {\n"; $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; @@ -2499,7 +2563,7 @@ function sync_package_v_ivr() $tmp .= "\n"; $tmp .= " digitmaxlength = 1;\n"; $tmp .= " while (session.ready() && ! exit ) {\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; + $tmp .= " session.streamFile( \"".$v_recordings_dir."/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; $tmp .= " if (session.ready()) {\n"; $tmp .= " if (dtmf.digits.length == 0) {\n"; $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; @@ -2691,10 +2755,10 @@ function sync_package_v_ivr() } //antiactioncount unset($tmpactiondefault); unset($tmpantiactiondefault); - + if (strlen($rowhelper['ivrid']) > 0) { $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js"; - $fout = fopen("/usr/local/freeswitch/scripts/".$ivrfilename,"w"); + $fout = fopen($v_scripts_dir."/".$ivrfilename,"w"); fwrite($fout, $tmp); unset($ivrfilename); fclose($fout); @@ -2711,6 +2775,14 @@ function sync_package_v_dialplan_includes() { global $config; + global $php_dir; + global $tmp_dir; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_recordings_dir; + global $v_storage_dir; + global $v_web_dir; $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; @@ -2816,7 +2888,7 @@ function sync_package_v_dialplan_includes() if ($rowhelper['enabled'] == "true") { $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - $fout = fopen("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename,"w"); + $fout = fopen($v_conf_dir."/dialplan/default/".$dialplanincludefilename,"w"); fwrite($fout, $tmp); fclose($fout); } @@ -2833,7 +2905,11 @@ function sync_package_v_dialplan_includes() function sync_package_v_public_includes() { - global $config; + global $config; + global $php_dir; + global $tmp_dir; + global $v_dir; + global $v_conf_dir; $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config']; $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; @@ -2940,7 +3016,7 @@ function sync_package_v_public_includes() if ($rowhelper['enabled'] == "true") { $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - $fout = fopen("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename,"w"); + $fout = fopen($v_conf_dir."/dialplan/public/".$publicincludefilename,"w"); fwrite($fout, $tmp); fclose($fout); } @@ -2999,10 +3075,20 @@ function v_php_install_command() config_lock(); global $config; - - $v_package_version = "0.9.7.5"; - $v_build_version = "1.0.4"; - $v_build_revision = "14306"; + global $v_package_version; + global $v_build_version; + global $v_build_revision; + global $php_dir; + global $tmp_dir; + global $v_label; + global $v_name; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_recordings_dir; + global $v_storage_dir; + global $v_web_dir; + global $v_htdocs_dir; //set script execution time limit to 24 hours set_time_limit (86400); @@ -3016,8 +3102,8 @@ function v_php_install_command() exec("mkdir /usr/local/www/packages/"); } - if (!is_dir('/usr/local/www/packages/freeswitch/')) { - exec("mkdir /usr/local/www/packages/freeswitch/"); + if (!is_dir($v_web_dir)) { + exec("mkdir ".$v_web_dir); } //$struname = exec('uname -v'); @@ -3032,13 +3118,13 @@ function v_php_install_command() //exec("cd /tmp/;fetch ".$download_path."freeswitch.tgz"); //handled by freeswitch.xml //exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/"); //unlink_if_exists("/tmp/freeswitch.tgz"); - - if (!is_dir('/usr/local/freeswitch/storage/fax/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/"); + + if (!is_dir($v_storage_dir.'/fax/')) { + exec("mkdir ".$v_storage_dir."/fax/"); } - if (!is_dir('/usr/local/freeswitch/storage/fax/receive/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/receive/"); + if (!is_dir($v_storage_dir.'/fax/receive/')) { + exec("mkdir ".$v_storage_dir."/fax/receive/"); } $static_output = 'Downloading Files'; @@ -3082,50 +3168,51 @@ function v_php_install_command() //download the dialplan default.xml - chdir('/tmp/'); - exec("cd /tmp/;fetch ".$download_path."dialplan.default.xml"); - exec("cp /tmp/dialplan.default.xml /usr/local/freeswitch/conf/dialplan/default.xml"); - unlink_if_exists("/tmp/dialplan.default.xml"); + chdir($tmp_dir.'/'); + exec("cd ".$tmp_dir."/;fetch ".$download_path."dialplan.default.xml"); + exec("cp ".$tmp_dir."/dialplan.default.xml ".$v_conf_dir."/dialplan/default.xml"); + unlink_if_exists($tmp_dir."/dialplan.default.xml"); //download the dialplan public.xml - chdir('/tmp/'); - exec("cd /tmp/;fetch ".$download_path."dialplan.public.xml"); - exec("cp /tmp/dialplan.public.xml /usr/local/freeswitch/conf/dialplan/public.xml"); - unlink_if_exists("/tmp/dialplan.public.xml"); + chdir($tmp_dir.'/'); + exec("cd ".$tmp_dir."/;fetch ".$download_path."dialplan.public.xml"); + exec("cp ".$tmp_dir."/dialplan.public.xml ".$v_conf_dir."/dialplan/public.xml"); + unlink_if_exists($tmp_dir."/dialplan.public.xml"); //make a backup copy of the default config used with the 'Restore Default' buttons on the text areas. - exec("cp -R /usr/local/freeswitch/conf /usr/local/freeswitch/conf.orig"); + exec("cp -R ".$v_conf_dir." ".$v_conf_dir.".orig"); //remove some default config files that are not needed - unlink_if_exists("/usr/local/freeswitch/conf/dialplan/default/01_example.com.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml"); + unlink_if_exists($v_conf_dir."/dialplan/default/01_example.com.xml"); + unlink_if_exists($v_conf_dir."/dialplan/public/00_inbound_did.xml"); - if (!is_dir('/usr/local/freeswitch/sounds/custom/')) { - exec("mkdir /usr/local/freeswitch/sounds/custom/"); + if (!is_dir($v_dir.'/sounds/custom/')) { + exec("mkdir ".$v_dir."/sounds/custom/"); } - if (!is_dir('/usr/local/freeswitch/sounds/custom/8000/')) { - exec("mkdir /usr/local/freeswitch/sounds/custom/8000/"); + if (!is_dir($v_dir.'/sounds/custom/8000/')) { + exec("mkdir ".$v_dir."/sounds/custom/8000/"); } $static_output = 'Downloading Audio Files'; update_output_window($static_output); //copy audio files - chdir('/usr/local/freeswitch/sounds/custom/8000/'); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_your_pin_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_pin_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_extension_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_phone_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_set.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_deleted.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."begin_recording.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."your_pin_number_is_incorect_goodbye.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_say_your_name_and_reason_for_calling.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."press_1_to_accept_2_to_reject_or_3_for_voicemail.wav"); - + chdir($v_dir.'/sounds/custom/8000/'); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_your_pin_number.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_pin_number.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_extension_number.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_phone_number.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_set.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_deleted.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."begin_recording.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."your_pin_number_is_incorect_goodbye.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_say_your_name_and_reason_for_calling.wav"); + exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."press_1_to_accept_2_to_reject_or_3_for_voicemail.wav"); + + //mod_fax - //chdir('/usr/local/freeswitch/mod/'); + //chdir($v_mod_dir.'/mod/'); //exec("fetch ".$download_path."mod_fax.so"); //download lib files @@ -3153,189 +3240,190 @@ function v_php_install_command() system('cd /usr/local/www; tar xvpfz /tmp/edit_area.tgz edit_area'); unlink_if_exists("/tmp/edit_area.tgz"); } - + //rename PHP files from .tmp to .php - chdir('/tmp/'); - exec("cd /tmp/;fetch ".$download_path."index.tmp"); - exec("cp /tmp/index.tmp /usr/local/www/packages/freeswitch/index.php"); - unlink_if_exists("/tmp/index.tmp"); + chdir($tmp_dir.'/'); + exec("fetch ".$download_path."index.tmp"); + exec("cp ".$tmp_dir."/index.tmp ".$v_web_dir."/index.php"); + unlink_if_exists($tmp_dir."/index.tmp"); - exec("cd /tmp/;fetch ".$download_path."class.smtp.tmp"); - exec("cp /tmp/class.smtp.tmp /usr/local/www/packages/freeswitch/class.smtp.php"); - unlink_if_exists("/tmp/class.smtp.tmp"); + exec("fetch ".$download_path."class.smtp.tmp"); + exec("cp ".$tmp_dir."/class.smtp.tmp ".$v_web_dir."/class.smtp.php"); + unlink_if_exists($tmp_dir."/class.smtp.tmp"); - exec("cd /tmp/;fetch ".$download_path."class.phpmailer.tmp"); - exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/freeswitch/class.phpmailer.php"); - unlink_if_exists("/tmp/class.phpmailer.tmp"); + exec("fetch ".$download_path."class.phpmailer.tmp"); + exec("cp ".$tmp_dir."/class.phpmailer.tmp ".$v_web_dir."/class.phpmailer.php"); + unlink_if_exists($tmp_dir."/class.phpmailer.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_cmd.tmp"); - exec("cp /tmp/v_cmd.tmp /usr/local/www/packages/freeswitch/v_cmd.php"); - unlink_if_exists("/tmp/v_cmd.tmp"); + exec("fetch ".$download_path."v_cmd.tmp"); + exec("cp ".$tmp_dir."/v_cmd.tmp ".$v_web_dir."/v_cmd.php"); + unlink_if_exists($tmp_dir."/v_cmd.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_dialplan.tmp"); - exec("cp /tmp/v_dialplan.tmp /usr/local/www/packages/freeswitch/v_dialplan.php"); - unlink_if_exists("/tmp/v_dialplan.tmp"); + exec("fetch ".$download_path."v_dialplan.tmp"); + exec("cp ".$tmp_dir."/v_dialplan.tmp ".$v_web_dir."/v_dialplan.php"); + unlink_if_exists($tmp_dir."/v_dialplan.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_dialplan_includes_details.tmp"); - exec("cp /tmp/v_dialplan_includes_details.tmp /usr/local/www/packages/freeswitch/v_dialplan_includes_details.php"); - unlink_if_exists("/tmp/v_dialplan_includes_details.tmp"); + exec("fetch ".$download_path."v_dialplan_includes_details.tmp"); + exec("cp ".$tmp_dir."/v_dialplan_includes_details.tmp ".$v_web_dir."/v_dialplan_includes_details.php"); + unlink_if_exists($tmp_dir."/v_dialplan_includes_details.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_dialplan_includes_details_edit.tmp"); - exec("cp /tmp/v_dialplan_includes_details_edit.tmp /usr/local/www/packages/freeswitch/v_dialplan_includes_details_edit.php"); - unlink_if_exists("/tmp/v_dialplan_includes_details_edit.tmp"); + exec("fetch ".$download_path."v_dialplan_includes_details_edit.tmp"); + exec("cp ".$tmp_dir."/v_dialplan_includes_details_edit.tmp ".$v_web_dir."/v_dialplan_includes_details_edit.php"); + unlink_if_exists($tmp_dir."/v_dialplan_includes_details_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_dialplan_includes.tmp"); - exec("cp /tmp/v_dialplan_includes.tmp /usr/local/www/packages/freeswitch/v_dialplan_includes.php"); - unlink_if_exists("/tmp/v_dialplan_includes.tmp"); + exec("fetch ".$download_path."v_dialplan_includes.tmp"); + exec("cp ".$tmp_dir."/v_dialplan_includes.tmp ".$v_web_dir."/v_dialplan_includes.php"); + unlink_if_exists($tmp_dir."/v_dialplan_includes.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_dialplan_includes_edit.tmp"); - exec("cp /tmp/v_dialplan_includes_edit.tmp /usr/local/www/packages/freeswitch/v_dialplan_includes_edit.php"); - unlink_if_exists("/tmp/v_dialplan_includes_edit.tmp"); + exec("fetch ".$download_path."v_dialplan_includes_edit.tmp"); + exec("cp ".$tmp_dir."/v_dialplan_includes_edit.tmp ".$v_web_dir."/v_dialplan_includes_edit.php"); + unlink_if_exists($tmp_dir."/v_dialplan_includes_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_extensions.tmp"); - exec("cp /tmp/v_extensions.tmp /usr/local/www/packages/freeswitch/v_extensions.php"); - unlink_if_exists("/tmp/v_extensions.tmp"); + exec("fetch ".$download_path."v_extensions.tmp"); + exec("cp ".$tmp_dir."/v_extensions.tmp ".$v_web_dir."/v_extensions.php"); + unlink_if_exists($tmp_dir."/v_extensions.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_extensions_edit.tmp"); - exec("cp /tmp/v_extensions_edit.tmp /usr/local/www/packages/freeswitch/v_extensions_edit.php"); - unlink_if_exists("/tmp/v_extensions_edit.tmp"); + exec("fetch ".$download_path."v_extensions_edit.tmp"); + exec("cp ".$tmp_dir."/v_extensions_edit.tmp ".$v_web_dir."/v_extensions_edit.php"); + unlink_if_exists($tmp_dir."/v_extensions_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_fax.tmp"); - exec("cp /tmp/v_fax.tmp /usr/local/www/packages/freeswitch/v_fax.php"); - unlink_if_exists("/tmp/v_fax.tmp"); + exec("fetch ".$download_path."v_fax.tmp"); + exec("cp ".$tmp_dir."/v_fax.tmp ".$v_web_dir."/v_fax.php"); + unlink_if_exists($tmp_dir."/v_fax.tmp"); exec("cd /tmp/;fetch ".$download_path."v_fax_edit.tmp"); - exec("cp /tmp/v_fax_edit.tmp /usr/local/www/packages/freeswitch/v_fax_edit.php"); + exec("cp ".$tmp_dir."/v_fax_edit.tmp ".$v_web_dir."/v_fax_edit.php"); unlink_if_exists("/tmp/v_fax_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."fax_to_email.tmp"); - exec("cp /tmp/fax_to_email.tmp /usr/local/www/packages/freeswitch/fax_to_email.php"); - unlink_if_exists("/tmp/fax_to_email.tmp"); + exec("fetch ".$download_path."fax_to_email.tmp"); + exec("cp ".$tmp_dir."/fax_to_email.tmp ".$v_web_dir."/fax_to_email.php"); + unlink_if_exists($tmp_dir."/fax_to_email.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_features.tmp"); - exec("cp /tmp/v_features.tmp /usr/local/www/packages/freeswitch/v_features.php"); - unlink_if_exists("/tmp/v_features.tmp"); + exec("fetch ".$download_path."v_features.tmp"); + exec("cp ".$tmp_dir."/v_features.tmp ".$v_web_dir."/v_features.php"); + unlink_if_exists($tmp_dir."/v_features.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_gateways.tmp"); - exec("cp /tmp/v_gateways.tmp /usr/local/www/packages/freeswitch/v_gateways.php"); - unlink_if_exists("/tmp/v_gateways.tmp"); + exec("fetch ".$download_path."v_gateways.tmp"); + exec("cp ".$tmp_dir."/v_gateways.tmp ".$v_web_dir."/v_gateways.php"); + unlink_if_exists($tmp_dir."/v_gateways.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_gateways_edit.tmp"); - exec("cp /tmp/v_gateways_edit.tmp /usr/local/www/packages/freeswitch/v_gateways_edit.php"); - unlink_if_exists("/tmp/v_gateways_edit.tmp"); + exec("fetch ".$download_path."v_gateways_edit.tmp"); + exec("cp ".$tmp_dir."/v_gateways_edit.tmp ".$v_web_dir."/v_gateways_edit.php"); + unlink_if_exists($tmp_dir."/v_gateways_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_hunt_group.tmp"); - exec("cp /tmp/v_hunt_group.tmp /usr/local/www/packages/freeswitch/v_hunt_group.php"); - unlink_if_exists("/tmp/v_hunt_group.tmp"); + exec("fetch ".$download_path."v_hunt_group.tmp"); + exec("cp ".$tmp_dir."/v_hunt_group.tmp ".$v_web_dir."/v_hunt_group.php"); + unlink_if_exists($tmp_dir."/v_hunt_group.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_hunt_group_edit.tmp"); - exec("cp /tmp/v_hunt_group_edit.tmp /usr/local/www/packages/freeswitch/v_hunt_group_edit.php"); - unlink_if_exists("/tmp/v_hunt_group_edit.tmp"); + exec("fetch ".$download_path."v_hunt_group_edit.tmp"); + exec("cp ".$tmp_dir."/v_hunt_group_edit.tmp ".$v_web_dir."/v_hunt_group_edit.php"); + unlink_if_exists($tmp_dir."/v_hunt_group_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_hunt_group_destinations.tmp"); - exec("cp /tmp/v_hunt_group_destinations.tmp /usr/local/www/packages/freeswitch/v_hunt_group_destinations.php"); - unlink_if_exists("/tmp/v_hunt_group_destinations.tmp"); + exec("fetch ".$download_path."v_hunt_group_destinations.tmp"); + exec("cp ".$tmp_dir."/v_hunt_group_destinations.tmp ".$v_web_dir."/v_hunt_group_destinations.php"); + unlink_if_exists($tmp_dir."/v_hunt_group_destinations.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_hunt_group_destinations_edit.tmp"); - exec("cp /tmp/v_hunt_group_destinations_edit.tmp /usr/local/www/packages/freeswitch/v_hunt_group_destinations_edit.php"); - unlink_if_exists("/tmp/v_hunt_group_destinations_edit.tmp"); + exec("fetch ".$download_path."v_hunt_group_destinations_edit.tmp"); + exec("cp ".$tmp_dir."/v_hunt_group_destinations_edit.tmp ".$v_web_dir."/v_hunt_group_destinations_edit.php"); + unlink_if_exists($tmp_dir."/v_hunt_group_destinations_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_ivr.tmp"); - exec("cp /tmp/v_ivr.tmp /usr/local/www/packages/freeswitch/v_ivr.php"); - unlink_if_exists("/tmp/v_ivr.tmp"); + exec("fetch ".$download_path."v_ivr.tmp"); + exec("cp ".$tmp_dir."/v_ivr.tmp ".$v_web_dir."/v_ivr.php"); + unlink_if_exists($tmp_dir."/v_ivr.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_ivr_edit.tmp"); - exec("cp /tmp/v_ivr_edit.tmp /usr/local/www/packages/freeswitch/v_ivr_edit.php"); - unlink_if_exists("/tmp/v_ivr_edit.tmp"); + exec("fetch ".$download_path."v_ivr_edit.tmp"); + exec("cp ".$tmp_dir."/v_ivr_edit.tmp ".$v_web_dir."/v_ivr_edit.php"); + unlink_if_exists($tmp_dir."/v_ivr_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_ivr_options.tmp"); - exec("cp /tmp/v_ivr_options.tmp /usr/local/www/packages/freeswitch/v_ivr_options.php"); - unlink_if_exists("/tmp/v_ivr_options.tmp"); + exec("fetch ".$download_path."v_ivr_options.tmp"); + exec("cp ".$tmp_dir."/v_ivr_options.tmp ".$v_web_dir."/v_ivr_options.php"); + unlink_if_exists($tmp_dir."/v_ivr_options.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_ivr_options_edit.tmp"); - exec("cp /tmp/v_ivr_options_edit.tmp /usr/local/www/packages/freeswitch/v_ivr_options_edit.php"); - unlink_if_exists("/tmp/v_ivr_options_edit.tmp"); + exec("fetch ".$download_path."v_ivr_options_edit.tmp"); + exec("cp ".$tmp_dir."/v_ivr_options_edit.tmp ".$v_web_dir."/v_ivr_options_edit.php"); + unlink_if_exists($tmp_dir."/v_ivr_options_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_profiles.tmp"); - exec("cp /tmp/v_profiles.tmp /usr/local/www/packages/freeswitch/v_profiles.php"); - unlink_if_exists("/tmp/v_profiles.tmp"); + exec("fetch ".$download_path."v_profiles.tmp"); + exec("cp ".$tmp_dir."/v_profiles.tmp ".$v_web_dir."/v_profiles.php"); + unlink_if_exists($tmp_dir."/v_profiles.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_profile_edit.tmp"); - exec("cp /tmp/v_profile_edit.tmp /usr/local/www/packages/freeswitch/v_profile_edit.php"); - unlink_if_exists("/tmp/v_profile_edit.tmp"); + exec("fetch ".$download_path."v_profile_edit.tmp"); + exec("cp ".$tmp_dir."/v_profile_edit.tmp ".$v_web_dir."/v_profile_edit.php"); + unlink_if_exists($tmp_dir."/v_profile_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_public.tmp"); - exec("cp /tmp/v_public.tmp /usr/local/www/packages/freeswitch/v_public.php"); - unlink_if_exists("/tmp/v_public.tmp"); + exec("fetch ".$download_path."v_public.tmp"); + exec("cp ".$tmp_dir."/v_public.tmp ".$v_web_dir."/v_public.php"); + unlink_if_exists($tmp_dir."/v_public.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_public_includes.tmp"); - exec("cp /tmp/v_public_includes.tmp /usr/local/www/packages/freeswitch/v_public_includes.php"); - unlink_if_exists("/tmp/v_public_includes.tmp"); + exec("fetch ".$download_path."v_public_includes.tmp"); + exec("cp ".$tmp_dir."/v_public_includes.tmp ".$v_web_dir."/v_public_includes.php"); + unlink_if_exists($tmp_dir."/v_public_includes.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_public_includes_edit.tmp"); - exec("cp /tmp/v_public_includes_edit.tmp /usr/local/www/packages/freeswitch/v_public_includes_edit.php"); - unlink_if_exists("/tmp/v_public_includes_edit.tmp"); + exec("fetch ".$download_path."v_public_includes_edit.tmp"); + exec("cp ".$tmp_dir."/v_public_includes_edit.tmp ".$v_web_dir."/v_public_includes_edit.php"); + unlink_if_exists($tmp_dir."/v_public_includes_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_public_includes_details.tmp"); - exec("cp /tmp/v_public_includes_details.tmp /usr/local/www/packages/freeswitch/v_public_includes_details.php"); - unlink_if_exists("/tmp/v_public_includes_details.tmp"); + exec("fetch ".$download_path."v_public_includes_details.tmp"); + exec("cp ".$tmp_dir."/v_public_includes_details.tmp ".$v_web_dir."/v_public_includes_details.php"); + unlink_if_exists($tmp_dir."/v_public_includes_details.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_public_includes_details_edit.tmp"); - exec("cp /tmp/v_public_includes_details_edit.tmp /usr/local/www/packages/freeswitch/v_public_includes_details_edit.php"); - unlink_if_exists("/tmp/v_public_includes_details_edit.tmp"); + exec("fetch ".$download_path."v_public_includes_details_edit.tmp"); + exec("cp ".$tmp_dir."/v_public_includes_details_edit.tmp ".$v_web_dir."/v_public_includes_details_edit.php"); + unlink_if_exists($tmp_dir."/v_public_includes_details_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_mailto.tmp"); - exec("cp /tmp/v_mailto.tmp /usr/local/www/packages/freeswitch/v_mailto.php"); - unlink_if_exists("/tmp/v_mailto.tmp"); + exec("fetch ".$download_path."v_mailto.tmp"); + exec("cp ".$tmp_dir."/v_mailto.tmp ".$v_web_dir."/v_mailto.php"); + unlink_if_exists($tmp_dir."/v_mailto.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_modules.tmp"); - exec("cp /tmp/v_modules.tmp /usr/local/www/packages/freeswitch/v_modules.php"); - unlink_if_exists("/tmp/v_modules.tmp"); + exec("fetch ".$download_path."v_modules.tmp"); + exec("cp ".$tmp_dir."/v_modules.tmp ".$v_web_dir."/v_modules.php"); + unlink_if_exists($tmp_dir."/v_modules.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_recordings.tmp"); - exec("cp /tmp/v_recordings.tmp /usr/local/www/packages/freeswitch/v_recordings.php"); - unlink_if_exists("/tmp/v_recordings.tmp"); + exec("fetch ".$download_path."v_recordings.tmp"); + exec("cp ".$tmp_dir."/v_recordings.tmp ".$v_web_dir."/v_recordings.php"); + unlink_if_exists($tmp_dir."/v_recordings.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_recordings_edit.tmp"); - exec("cp /tmp/v_recordings_edit.tmp /usr/local/www/packages/freeswitch/v_recordings_edit.php"); - unlink_if_exists("/tmp/v_recordings_edit.tmp"); + exec("fetch ".$download_path."v_recordings_edit.tmp"); + exec("cp ".$tmp_dir."/v_recordings_edit.tmp ".$v_web_dir."/v_recordings_edit.php"); + unlink_if_exists($tmp_dir."/v_recordings_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_recordings_play.tmp"); - exec("cp /tmp/v_recordings_play.tmp /usr/local/www/packages/freeswitch/v_recordings_play.php"); - unlink_if_exists("/tmp/v_recordings_play.tmp"); + exec("fetch ".$download_path."v_recordings_play.tmp"); + exec("cp ".$tmp_dir."/v_recordings_play.tmp ".$v_web_dir."/v_recordings_play.php"); + unlink_if_exists($tmp_dir."/v_recordings_play.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_settings.tmp"); - exec("cp /tmp/v_settings.tmp /usr/local/www/packages/freeswitch/v_settings.php"); - unlink_if_exists("/tmp/v_settings.tmp"); + exec("fetch ".$download_path."v_settings.tmp"); + exec("cp ".$tmp_dir."/v_settings.tmp ".$v_web_dir."/v_settings.php"); + unlink_if_exists($tmp_dir."/v_settings.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_status.tmp"); - exec("cp /tmp/v_status.tmp /usr/local/www/packages/freeswitch/v_status.php"); - unlink_if_exists("/tmp/v_status.tmp"); + exec("fetch ".$download_path."v_status.tmp"); + exec("cp ".$tmp_dir."/v_status.tmp ".$v_web_dir."/v_status.php"); + unlink_if_exists($tmp_dir."/v_status.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_time_conditions.tmp"); - exec("cp /tmp/v_time_conditions.tmp /usr/local/www/packages/freeswitch/v_time_conditions.php"); - unlink_if_exists("/tmp/v_time_conditions.tmp"); + exec("fetch ".$download_path."v_time_conditions.tmp"); + exec("cp ".$tmp_dir."/v_time_conditions.tmp ".$v_web_dir."/v_time_conditions.php"); + unlink_if_exists($tmp_dir."/v_time_conditions.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_time_conditions_edit.tmp"); - exec("cp /tmp/v_time_conditions_edit.tmp /usr/local/www/packages/freeswitch/v_time_conditions_edit.php"); - unlink_if_exists("/tmp/v_time_conditions_edit.tmp"); + exec("fetch ".$download_path."v_time_conditions_edit.tmp"); + exec("cp ".$tmp_dir."/v_time_conditions_edit.tmp ".$v_web_dir."/v_time_conditions_edit.php"); + unlink_if_exists($tmp_dir."/v_time_conditions_edit.tmp"); - exec("cd /tmp/;fetch ".$download_path."v_vars.tmp"); - exec("cp /tmp/v_vars.tmp /usr/local/www/packages/freeswitch/v_vars.php"); - unlink_if_exists("/tmp/v_vars.tmp"); + exec("fetch ".$download_path."v_vars.tmp"); + exec("cp ".$tmp_dir."/v_vars.tmp ".$v_web_dir."/v_vars.php"); + unlink_if_exists($tmp_dir."/v_vars.tmp"); - chdir('/usr/local/freeswitch/scripts/'); - exec("cd /usr/local/freeswitch/scripts/;fetch ".$download_path."disa.js"); - exec("cd /usr/local/freeswitch/scripts/;fetch ".$download_path."originate.js"); - exec("cp /usr/local/freeswitch/htdocs/slim.swf /usr/local/www/packages/freeswitch/slim.swf"); + + chdir($v_scripts_dir); + exec("fetch ".$download_path."disa.js"); + exec("fetch ".$download_path."originate.js"); + exec("cp ".$v_htdocs_dir."/slim.swf ".$v_web_dir."/slim.swf"); /* freeswitch settings defaults */ if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US"; } if(strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "ClueCon"; + $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "7e4d3i"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'] = "8021"; @@ -3344,13 +3432,13 @@ function v_php_install_command() $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'] = "8787"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = "freeswitch"; + $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = $v_name; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "freeswitch"; + $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "xmlrpc"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "works"; + $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "7e4d3i"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'] = "7575"; @@ -3476,23 +3564,23 @@ function v_php_install_command() unset($ent); write_config(); - + //prepare switch.conf.xml for voicemail to email - $filename = "/usr/local/freeswitch/conf/autoload_configs/switch.conf.xml"; + $filename = $v_conf_dir."/autoload_configs/switch.conf.xml"; $handle = fopen($filename,"rb"); $contents = fread($handle, filesize($filename)); fclose($handle); $handle = fopen($filename,"w"); - $contents = str_replace("<param name=\"mailer-app\" value=\"sendmail\"/>", "<param name=\"mailer-app\" value=\"/usr/local/bin/php\"/>", $contents); - $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"/usr/local/www/packages/freeswitch/v_mailto.php\"/>", $contents); + $contents = str_replace("<param name=\"mailer-app\" value=\"sendmail\"/>", "<param name=\"mailer-app\" value=\"".$php_dir."\"/>", $contents); + $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"".$v_web_dir."/v_mailto.php\"/>", $contents); fwrite($handle, $contents); unset($contents); fclose($handle); unset($filename); //prepare shout.conf.xml for mod_shout - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/shout.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/shout.conf.xml","w"); $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n"; $tmpxml .= " <settings>\n"; $tmpxml .= " <!-- Don't change these unless you are insane -->\n"; @@ -3505,7 +3593,7 @@ function v_php_install_command() unset($tmpxml); fclose($fout); - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w"); + $fout = fopen($v_conf_dir."/autoload_configs/event_socket.conf.xml","w"); $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n"; $tmpxml .= " <settings>\n"; $tmpxml .= " <param name=\"listen-ip\" value=\"". $config['interfaces']['lan']['ipaddr'] ."\"/>\n"; @@ -3728,55 +3816,56 @@ function v_php_install_command() $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } + //create the backup directory - if (!is_dir('/root/backup/')) { - exec("mkdir /root/backup/"); + if (!is_dir($v_backup_dir.'/')) { + exec("mkdir ".$v_backup_dir."/"); } - //extract a specific directory to /usr/local/freeswitch - $filename = 'freeswitch.bak.tgz'; - if (file_exists('/root/backup/'.$filename)) { + //extract a specific directory + $filename = $v_name.'.bak.tgz'; + if (file_exists($v_backup_dir.$filename)) { $static_output = 'Restore the Backup'; update_output_window($static_output); //echo "The file $filename exists"; - exec("rm -R /usr/local/freeswitch/conf/sip_profiles/"); - exec("rm -R /usr/local/freeswitch/sounds/music/"); + exec("rm -R ".$v_conf_dir."/sip_profiles/"); + exec("rm -R ".$v_dir."/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/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/db/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/log/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/recordings/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/scripts/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/storage/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/custom/8000/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/music/8000/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/ssl/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/sip_profiles/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/vars.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/default.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/public.xml'); //Optional - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/'); - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/grammar/'); - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/htdocs/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/grammar/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/htdocs/'); unset($filename); } 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"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/example.com.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/dialplan/default/99999_enum.xml"); + exec("cp ".$v_conf_dir."/directory/default/brian.xml ".$v_conf_dir."/directory/default/brian.xml.noload"); + unlink_if_exists($v_conf_dir."/directory/default/brian.xml"); + unlink_if_exists($v_conf_dir."/directory/default/example.com.xml"); + unlink_if_exists($v_conf_dir."/dialplan/default/99999_enum.xml"); write_rcfile(array( - "file" => "freeswitch.sh", - "start" => "/usr/local/freeswitch/bin/./freeswitch -nc", - "stop" => "/usr/local/freeswitch/bin/./freeswitch -stop" + "file" => $v_name.".sh", + "start" => $v_dir."/bin/./freeswitch -nc", + "stop" => $v_dir."/bin/./freeswitch -stop" ) ); @@ -3811,6 +3900,16 @@ function v_deinstall_command() conf_mount_rw(); config_lock(); + global $config; + global $php_dir; + global $tmp_dir; + global $v_label; + global $v_name; + global $v_dir; + global $v_conf_dir; + global $v_scripts_dir; + global $v_web_dir; + exec("killall -9 freeswitch"); exec("pkg_delete freeswitch-1.0.4"); @@ -3842,14 +3941,14 @@ function v_deinstall_command() exec("pkg_delete sqlite34"); - unlink_if_exists("/usr/local/pkg/freeswitch.xml"); + unlink_if_exists("/usr/local/pkg/".$v_name.".xml"); unlink_if_exists("/usr/local/pkg/v_config.inc"); - exec("rm -R /usr/local/freeswitch/"); - exec("rm -R /usr/local/www/packages/freeswitch/"); - unlink_if_exists("/usr/local/etc/rc.d/freeswitch.sh"); - unlink_if_exists("/tmp/freeswitch.tar.gz"); - unlink_if_exists("/tmp/pkg_mgr_FreeSWITCH.log"); + exec("rm -R ".$v_dir); + exec("rm -R ".$v_web_dir); + unlink_if_exists("/usr/local/etc/rc.d/".$v_name.".sh"); + //unlink_if_exists($tmp_dir."/".$v_name.".tar.gz"); + unlink_if_exists($tmp_dir."/pkg_mgr_".$v_label.".log"); conf_mount_ro(); config_unlock(); diff --git a/config/freeswitch_dev/v_dialplan.tmp b/config/freeswitch_dev/v_dialplan.tmp index 5779a063..e86f768e 100644 --- a/config/freeswitch_dev/v_dialplan.tmp +++ b/config/freeswitch_dev/v_dialplan.tmp @@ -32,9 +32,15 @@ require("/usr/local/pkg/v_config.inc"); //$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config']; +<?php +if ($v_path_show) { + echo $v_conf_dir."/sip_profiles/external/\n"; +} +?> + if ($_GET['a'] == "default") { conf_mount_rw(); - exec("cp /usr/local/freeswitch/conf.orig/dialplan/default.xml /usr/local/freeswitch/conf/dialplan/default.xml"); + exec("cp ".$v_conf_dir.".orig/dialplan/default.xml ".$v_conf_dir."/dialplan/default.xml"); $savemsg = "Default Restored"; conf_mount_ro(); } @@ -42,7 +48,7 @@ if ($_GET['a'] == "default") { if ($_POST['a'] == "save") { conf_mount_rw(); $content = ereg_replace("\r","",$_POST['code']); - $fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "w"); + $fd = fopen($v_conf_dir."/dialplan/default.xml", "w"); fwrite($fd, $content); fclose($fd); $savemsg = "Saved"; @@ -50,8 +56,8 @@ if ($_POST['a'] == "save") { } -$fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "r"); -$content = fread($fd, filesize("/usr/local/freeswitch/conf/dialplan/default.xml")); +$fd = fopen($v_conf_dir."/dialplan/default.xml", "r"); +$content = fread($fd, filesize($v_conf_dir."/dialplan/default.xml")); fclose($fd); include("head.inc"); @@ -81,7 +87,9 @@ function sf() { document.forms[0].savetopath.focus(); } <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Dialplan</p>\n"; +} ?> <div id="mainlevel"> @@ -124,7 +132,13 @@ build_menu(); <table width="98%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td>/usr/local/freeswitch/conf/dialplan/default.xml</td> + <td> + <?php + if ($v_path_show) { + echo $v_conf_dir."/dialplan/default.xml\n"; + } + ?> + </td> <td align='right'> <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" /> <input type="hidden" name="a" value="save" /> diff --git a/config/freeswitch_dev/v_dialplan_includes.tmp b/config/freeswitch_dev/v_dialplan_includes.tmp index 3fd9e15e..6ce4a3f6 100644 --- a/config/freeswitch_dev/v_dialplan_includes.tmp +++ b/config/freeswitch_dev/v_dialplan_includes.tmp @@ -82,8 +82,8 @@ if ($_GET['act'] == "del") { } //if the dialplan include xml file exists then delete it - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) { - unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename); + if (file_exists($v_conf_dir."/dialplan/default/".$dialplanincludefilename)) { + unlink($v_conf_dir."/dialplan/default/".$dialplanincludefilename); } unset($dialplanincludefilename); @@ -104,7 +104,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Dialplan</p>\n"; +} ?> <div id="mainlevel"> @@ -258,7 +260,12 @@ build_menu(); </form> -/usr/local/freeswitch/conf/dialplan/default/ +<?php +if ($v_path_show) { + echo $v_conf_dir."/dialplan/default/\n"; +} +?> + <br> <br> <br> diff --git a/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp b/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp index e5a8adf2..789f3d1f 100644 --- a/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp +++ b/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp @@ -120,7 +120,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan: Details: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Dialplan: Details: Edit</p>\n"; +} ?> <?php if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_dialplan_includes_edit.tmp b/config/freeswitch_dev/v_dialplan_includes_edit.tmp index 168b0567..1355c412 100644 --- a/config/freeswitch_dev/v_dialplan_includes_edit.tmp +++ b/config/freeswitch_dev/v_dialplan_includes_edit.tmp @@ -133,8 +133,8 @@ if ($_POST) { } if ($filenamechanged){ $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) { - unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename); + if (file_exists($v_conf_dir."/dialplan/default/".$dialplanincludefilename)) { + unlink($v_conf_dir."/dialplan/default/".$dialplanincludefilename); } unset($dialplanincludefilename); } @@ -170,7 +170,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Dialplan: Edit</p>\n"; +} ?> <?php if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_extensions.tmp b/config/freeswitch_dev/v_extensions.tmp index 4550ea55..0eb61d95 100644 --- a/config/freeswitch_dev/v_extensions.tmp +++ b/config/freeswitch_dev/v_extensions.tmp @@ -36,7 +36,7 @@ $a_extensions = &$config['installedpackages']['freeswitchextensions']['confi if ($_GET['act'] == "del") { if ($_GET['type'] == 'extensions') { if ($a_extensions[$_GET['id']]) { - $tmp_file_name = "/usr/local/freeswitch/conf/directory/default/".$_GET['extension'].".xml"; + $tmp_file_name = $v_conf_dir."/directory/default/".$_GET['extension'].".xml"; if (file_exists($tmp_file_name)) { unlink($tmp_file_name); } @@ -57,7 +57,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Extensions</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Extensions</p>\n"; +} ?> <div id="mainlevel"> @@ -197,8 +199,12 @@ if ($config_change == 1) { </form> +<?php +if ($v_path_show) { + echo $v_conf_dir."/directory/default/\n"; +} +?> -/usr/local/freeswitch/conf/directory/default/ <br> <br> <br> diff --git a/config/freeswitch_dev/v_extensions_edit.tmp b/config/freeswitch_dev/v_extensions_edit.tmp index 79e3d860..490a96db 100644 --- a/config/freeswitch_dev/v_extensions_edit.tmp +++ b/config/freeswitch_dev/v_extensions_edit.tmp @@ -133,7 +133,9 @@ function show_advanced_config() { <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Extensions: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Extensions: Edit</p>\n"; +} ?> <?php if ($input_errors) print_input_errors($input_errors); ?> @@ -158,7 +160,11 @@ build_menu(); <tr> <td><p><span class="vexpl"><span class="red"><strong>Extension Setup<br> </strong></span> - /usr/local/freeswitch/conf/directory/default/ + <?php + if ($v_path_show) { + echo $v_conf_dir."/directory/default/\n"; + } + ?> </p></td> </tr> </table> diff --git a/config/freeswitch_dev/v_fax.tmp b/config/freeswitch_dev/v_fax.tmp index 15914ce8..40beb598 100644 --- a/config/freeswitch_dev/v_fax.tmp +++ b/config/freeswitch_dev/v_fax.tmp @@ -31,7 +31,7 @@ require("guiconfig.inc"); require("/usr/local/pkg/v_config.inc"); $a_fax = &$config['installedpackages']['freeswitchfax']['config']; -$dir_fax = '/usr/local/freeswitch/storage/fax/inbox/'; +$dir_fax = $v_storage_dir.'/fax/inbox/'; if ($_GET['act'] == "del") { if ($_GET['type'] == 'fax') { @@ -66,8 +66,8 @@ if ($_GET['act'] == "del") { } } - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml"); + if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml")){ + unlink($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml"); } //remove fax entries @@ -141,7 +141,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: FAX</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: FAX</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_fax_edit.tmp b/config/freeswitch_dev/v_fax_edit.tmp index ea5a1f7d..54729360 100644 --- a/config/freeswitch_dev/v_fax_edit.tmp +++ b/config/freeswitch_dev/v_fax_edit.tmp @@ -49,9 +49,9 @@ if (isset($id) && $a_fax[$id]) { } -$dir_fax_inbox = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/inbox/'; -$dir_fax_sent = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/sent/'; -$dir_fax_temp = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/temp/'; +$dir_fax_inbox = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/inbox/'; +$dir_fax_sent = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/sent/'; +$dir_fax_temp = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/temp/'; if ($_GET['act'] == "del") { if ($_GET['type'] == 'fax') { @@ -86,8 +86,8 @@ if ($_GET['act'] == "del") { } } - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml"); + if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml")){ + unlink($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml"); } //remove fax entries @@ -298,11 +298,11 @@ if ($_POST) { $a_fax[] = $ent; } - if (!is_dir('/usr/local/freeswitch/storage/fax/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/"); + if (!is_dir($v_storage_dir.'/fax/')) { + exec("mkdir ".$v_storage_dir."/fax/"); } - $faxfolder = '/usr/local/freeswitch/storage/fax/'.$_POST['faxextension']; + $faxfolder = $v_storage_dir.'/fax/'.$_POST['faxextension']; if (!is_dir($faxfolder)) { exec('mkdir '.$faxfolder); } @@ -340,8 +340,9 @@ function show_advanced_config() { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: FAX: Edit</p>\n"; - +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: FAX: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_features.tmp b/config/freeswitch_dev/v_features.tmp index c0d93630..781e0bc8 100644 --- a/config/freeswitch_dev/v_features.tmp +++ b/config/freeswitch_dev/v_features.tmp @@ -54,7 +54,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Features</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Features</p>\n"; +} ?> diff --git a/config/freeswitch_dev/v_gateways.tmp b/config/freeswitch_dev/v_gateways.tmp index fb01feae..3ccac677 100644 --- a/config/freeswitch_dev/v_gateways.tmp +++ b/config/freeswitch_dev/v_gateways.tmp @@ -36,7 +36,7 @@ $a_gateways = &$config['installedpackages']['freeswitchgateways']['config']; if ($_GET['act'] == "del") { if ($_GET['type'] == 'gateways') { if ($a_gateways[$_GET['id']]) { - $tmp_file_name = "/usr/local/freeswitch/conf/sip_profiles/external/".$_GET['gateway'].".xml"; + $tmp_file_name = $v_conf_dir."/sip_profiles/external/".$_GET['gateway'].".xml"; if (file_exists($tmp_file_name)) { unlink($tmp_file_name); } @@ -57,7 +57,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Gateways</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Gateways</p>\n"; +} ?> <div id="mainlevel"> @@ -191,8 +193,12 @@ if ($config_change == 1) { </form> +<?php +if ($v_path_show) { + echo $v_conf_dir."/sip_profiles/external/\n"; +} +?> -/usr/local/freeswitch/conf/sip_profiles/external/ <br> <br> <br> diff --git a/config/freeswitch_dev/v_gateways_edit.tmp b/config/freeswitch_dev/v_gateways_edit.tmp index fe609954..10c68e93 100644 --- a/config/freeswitch_dev/v_gateways_edit.tmp +++ b/config/freeswitch_dev/v_gateways_edit.tmp @@ -325,7 +325,9 @@ function show_advanced_config() { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Gateways: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Gateways: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_hunt_group.tmp b/config/freeswitch_dev/v_hunt_group.tmp index 99eae163..fe0dbc26 100644 --- a/config/freeswitch_dev/v_hunt_group.tmp +++ b/config/freeswitch_dev/v_hunt_group.tmp @@ -87,7 +87,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Hunt Group</p>\n"; +} ?> <div id="mainlevel"> @@ -188,7 +190,12 @@ build_menu(); <br> <br> -/usr/local/freeswitch/scripts/ +<?php +if ($v_path_show) { + echo $v_scripts_dir."\n"; +} +?> + <br> <br> <br> diff --git a/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp b/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp index a30b76be..6c02a898 100644 --- a/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp +++ b/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp @@ -108,8 +108,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group: Destinations: Edit</p>\n"; - +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Hunt Group: Destinations: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); ?> @@ -185,7 +186,7 @@ build_menu(); else { echo " <option>auto</option>\n"; } - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){ $sip_profile_name = str_replace(".xml", "", $sip_profile_file); if (htmlspecialchars($pconfig['destinationprofile']) == $sip_profile_name) { diff --git a/config/freeswitch_dev/v_hunt_group_edit.tmp b/config/freeswitch_dev/v_hunt_group_edit.tmp index 45197ada..f72769bb 100644 --- a/config/freeswitch_dev/v_hunt_group_edit.tmp +++ b/config/freeswitch_dev/v_hunt_group_edit.tmp @@ -127,8 +127,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group: Edit</p>\n"; - +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Hunt Group: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_ivr.tmp b/config/freeswitch_dev/v_ivr.tmp index 06eb4f42..5ac793a5 100644 --- a/config/freeswitch_dev/v_ivr.tmp +++ b/config/freeswitch_dev/v_ivr.tmp @@ -37,7 +37,7 @@ $a_ivr = &$config['installedpackages']['freeswitchivr']['config']; if ($_GET['act'] == "del") { if ($_GET['type'] == 'ivr') { if ($a_ivr[$_GET['id']]) { - unlink("/usr/local/freeswitch/scripts/ivr_".$_GET['ivrid'].".js"); + unlink($v_scripts_dir."/ivr_".$_GET['ivrid'].".js"); unset($a_ivr[$_GET['id']]); write_config(); sync_package_v_ivr(); @@ -55,7 +55,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: IVR</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: IVR</p>\n"; +} ?> <div id="mainlevel"> @@ -159,7 +161,13 @@ build_menu(); <br> <br> -/usr/local/freeswitch/scripts/ + +<?php +if ($v_path_show) { + echo $v_scripts_dir."\n"; +} +?> + <br> <br> <br> diff --git a/config/freeswitch_dev/v_ivr_edit.tmp b/config/freeswitch_dev/v_ivr_edit.tmp index 48ec077f..024fcc72 100644 --- a/config/freeswitch_dev/v_ivr_edit.tmp +++ b/config/freeswitch_dev/v_ivr_edit.tmp @@ -222,7 +222,9 @@ function sf() { document.forms[0].savetopath.focus(); } <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: IVR: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: IVR: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); diff --git a/config/freeswitch_dev/v_ivr_options_edit.tmp b/config/freeswitch_dev/v_ivr_options_edit.tmp index 90683ac6..06b69681 100644 --- a/config/freeswitch_dev/v_ivr_options_edit.tmp +++ b/config/freeswitch_dev/v_ivr_options_edit.tmp @@ -108,8 +108,9 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Options: Edit</p>\n"; - +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Options: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); ?> @@ -178,7 +179,8 @@ build_menu(); else { echo " <option>auto</option>\n"; } - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + + foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){ $sip_profile_name = str_replace(".xml", "", $sip_profile_file); if (htmlspecialchars($pconfig['optionprofile']) == $sip_profile_name) { diff --git a/config/freeswitch_dev/v_mailto.tmp b/config/freeswitch_dev/v_mailto.tmp index c6aa4baa..deee4900 100644 --- a/config/freeswitch_dev/v_mailto.tmp +++ b/config/freeswitch_dev/v_mailto.tmp @@ -217,7 +217,7 @@ ob_start(); } if (strlen($strwav) > 0) { - //$mail->AddAttachment("/usr/local/freeswitch/data/domain/example.wav"); // attachment + //$mail->AddAttachment($v_dir."/data/domain/example.wav"); // attachment $filename='voicemail.wav'; $encoding = "base64"; $type = "audio/wav"; $mail->AddStringAttachment(base64_decode($strwav),$filename,$encoding,$type); } diff --git a/config/freeswitch_dev/v_profile_edit.tmp b/config/freeswitch_dev/v_profile_edit.tmp index 2f9c7116..23e4dd7b 100644 --- a/config/freeswitch_dev/v_profile_edit.tmp +++ b/config/freeswitch_dev/v_profile_edit.tmp @@ -63,7 +63,9 @@ function sf() { document.forms[0].savetopath.focus(); } <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Edit Profile</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Edit Profile</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_profiles.tmp b/config/freeswitch_dev/v_profiles.tmp index 21883f25..a8e12e9c 100644 --- a/config/freeswitch_dev/v_profiles.tmp +++ b/config/freeswitch_dev/v_profiles.tmp @@ -74,7 +74,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Profiles</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Profiles</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_public.tmp b/config/freeswitch_dev/v_public.tmp index 4bcadc50..5a629f58 100644 --- a/config/freeswitch_dev/v_public.tmp +++ b/config/freeswitch_dev/v_public.tmp @@ -82,7 +82,9 @@ function sf() { document.forms[0].savetopath.focus(); } <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_public_includes.tmp b/config/freeswitch_dev/v_public_includes.tmp index 8a4c8238..413926b9 100644 --- a/config/freeswitch_dev/v_public_includes.tmp +++ b/config/freeswitch_dev/v_public_includes.tmp @@ -106,7 +106,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_public_includes_details_edit.tmp b/config/freeswitch_dev/v_public_includes_details_edit.tmp index 7910f1a4..4e93e932 100644 --- a/config/freeswitch_dev/v_public_includes_details_edit.tmp +++ b/config/freeswitch_dev/v_public_includes_details_edit.tmp @@ -117,7 +117,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public: Details: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Public: Details: Edit</p>\n"; +} if ($input_errors) { print_input_errors($input_errors); } diff --git a/config/freeswitch_dev/v_public_includes_edit.tmp b/config/freeswitch_dev/v_public_includes_edit.tmp index 8e9da445..cf6bc88a 100644 --- a/config/freeswitch_dev/v_public_includes_edit.tmp +++ b/config/freeswitch_dev/v_public_includes_edit.tmp @@ -136,8 +136,8 @@ if ($_POST) { } if ($filenamechanged){ $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) { - unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename); + if (file_exists($v_conf_dir."/dialplan/public/".$publicincludefilename)) { + unlink($v_conf_dir."/dialplan/public/".$publicincludefilename); } unset($publicincludefilename); } @@ -172,7 +172,9 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Public: Edit</p>\n"; +} if ($input_errors) print_input_errors($input_errors); diff --git a/config/freeswitch_dev/v_recordings.tmp b/config/freeswitch_dev/v_recordings.tmp index f4632831..8cfff7d9 100644 --- a/config/freeswitch_dev/v_recordings.tmp +++ b/config/freeswitch_dev/v_recordings.tmp @@ -31,8 +31,8 @@ require("guiconfig.inc"); require("/usr/local/pkg/v_config.inc"); $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; -$dir_recordings = '/usr/local/freeswitch/recordings/'; -$dir_music_on_hold_8000 = '/usr/local/freeswitch/sounds/music/8000/'; +$dir_recordings = $v_recordings_dir.'/recordings/'; +$dir_music_on_hold_8000 = $v_dir.'/sounds/music/8000/'; if ($_GET['a'] == "download") { @@ -118,7 +118,7 @@ if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_na if ($_GET['act'] == "del") { if ($_GET['type'] == 'rec') { if ($a_recordings[$_GET['id']]) { - unlink_if_exists('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']); + unlink_if_exists($v_recordings_dir.$a_recordings[$_GET['id']]['filename']); unset($a_recordings[$_GET['id']]); write_config(); header("Location: v_recordings.php"); @@ -150,7 +150,9 @@ function EvalSound(soundobj) { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Recordings</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Recordings</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_recordings_edit.tmp b/config/freeswitch_dev/v_recordings_edit.tmp index bdb0f3ad..f5547ba3 100644 --- a/config/freeswitch_dev/v_recordings_edit.tmp +++ b/config/freeswitch_dev/v_recordings_edit.tmp @@ -72,7 +72,7 @@ if ($_POST) { //if file name is not the same then rename the file if ($_POST['filename'] != $_POST['filename_orig']) { - rename('/usr/local/freeswitch/recordings/'.$_POST['filename_orig'], '/usr/local/freeswitch/recordings/'.$_POST['filename']); + rename($v_recordings_dir.$_POST['filename_orig'], $v_recordings_dir.$_POST['filename']); } $a_recordings[$id] = $recordingent; } @@ -97,7 +97,9 @@ include("head.inc"); <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_labels: Recordings: Edit</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Recordings: Edit</p>\n"; +} ?> <?php if ($input_errors) print_input_errors($input_errors); ?> diff --git a/config/freeswitch_dev/v_settings.tmp b/config/freeswitch_dev/v_settings.tmp index bd37086c..6f867dd6 100644 --- a/config/freeswitch_dev/v_settings.tmp +++ b/config/freeswitch_dev/v_settings.tmp @@ -127,7 +127,9 @@ function show_advanced_config() { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Settings</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Settings</p>\n"; +} ?> <?php if ($input_errors) print_input_errors($input_errors); ?> @@ -151,7 +153,11 @@ build_menu(); <tr> <td><p><span class="vexpl"><span class="red"><strong>Settings<br /> </strong></span> - /usr/local/freeswitch/conf/directory/default/ + <?php + //if ($v_path_show) { + // echo $v_conf_dir."/directory/default/\n"; + //} + ?> </p></td> </tr> </table> @@ -193,7 +199,7 @@ build_menu(); <td width="25%" valign="top" class="vncell">Event Socket Password</td> <td width="75%" class="vtable"> <input name="event_socket_password" type="password" class="formfld" id="event_socket_password" size="40" value="<?=htmlspecialchars($pconfig['event_socket_password']);?>"> - <br /><span class="vexpl">Enter the event socket password here. default: ClueCon<br /></span> + <br /><span class="vexpl">Enter the event socket password here. default: 7e4d3i<br /></span> </td> </tr> <tr> @@ -207,21 +213,21 @@ build_menu(); <td width="25%" valign="top" class="vncell">XML RPC Auth Realm</td> <td width="75%" class="vtable"> <input name="xml_rpc_auth_realm" type="text" class="formfld" id="xml_rpc_auth_realm" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_realm']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth Realm here. default: freeswitch<br /></span> + <br /><span class="vexpl">Enter the XML RPC Auth Realm here. default: <?php echo $v_name; ?><br /></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncell">XML RPC Auth User</td> <td width="75%" class="vtable"> <input name="xml_rpc_auth_user" type="text" class="formfld" id="xml_rpc_auth_user" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_user']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth User here. default: freeswitch<br /></span> + <br /><span class="vexpl">Enter the XML RPC Auth User here. default: xmlrpc<br /></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncell">XML RPC Auth Password</td> <td width="75%" class="vtable"> <input name="xml_rpc_auth_pass" type="password" class="formfld" id="xml_rpc_auth_pass" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_pass']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth Password here. default: works<br /></span> + <br /><span class="vexpl">Enter the XML RPC Auth Password here. default: 7e4d3i<br /></span> </td> </tr> <tr> diff --git a/config/freeswitch_dev/v_status.tmp b/config/freeswitch_dev/v_status.tmp index 78d54466..a778cb8a 100644 --- a/config/freeswitch_dev/v_status.tmp +++ b/config/freeswitch_dev/v_status.tmp @@ -33,20 +33,20 @@ require("/usr/local/pkg/v_config.inc"); if ($_GET['a'] == "download") { if ($_GET['t'] == "logs") { - $tmp = '/usr/local/freeswitch/log/'; - $filename = 'freeswitch.log'; + $tmp = $v_log_dir.'/'; + $filename = $v_name.'.log'; } if ($_GET['t'] == "cdrcsv") { - $tmp = '/usr/local/freeswitch/log/cdr-csv/'; + $tmp = $v_log_dir.'/cdr-csv/'; $filename = 'Master.csv'; } if ($_GET['t'] == "backup") { - $tmp = '/root/backup/'; - $filename = 'freeswitch.bak.tgz'; - if (!is_dir('/root/backup/')) { - exec("mkdir /root/backup/"); + $tmp = $v_backup_dir.'/'; + $filename = $v_name.'.bak.tgz'; + if (!is_dir($v_backup_dir.'/')) { + exec("mkdir ".$v_backup_dir."/"); } - system('cd /usr/local/;tar cvzf /root/backup/freeswitch.bak.tgz freeswitch'); + system('cd /usr/local/;tar cvzf '.$v_backup_dir.'/'.$v_name.'.bak.tgz '.$v_name); } session_cache_limiter('public'); $fd = fopen($tmp.$filename, "rb"); @@ -60,30 +60,30 @@ if ($_GET['a'] == "download") { if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { $tmp = '/root/backup/'; - $filename = 'freeswitch.bak.tgz'; + $filename = $v_name.'.bak.tgz'; - //extract a specific directory to /usr/local/freeswitch - if (file_exists('/root/backup/'.$filename)) { + //extract a specific directory + if (file_exists($v_backup_dir.'/'.$filename)) { //echo "The file $filename exists"; //Recommended - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/db/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/log/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/recordings/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/scripts/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/storage/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/custom/8000/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/music/8000/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/ssl'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/sip_profiles/'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/vars.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/default.xml'); + system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/public.xml'); //Optional - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/'); - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/grammar/'); - //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/htdocs/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/grammar/'); + //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/htdocs/'); header( 'Location: v_status.php?savemsg=Backup+has+been+restored.' ) ; } @@ -104,10 +104,10 @@ $host = $config['interfaces']['lan']['ipaddr']; $savemsg = $_GET["savemsg"]; //if service is not running then start it -if (!pkg_is_service_running('freeswitch')) { - $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r"); +if (!pkg_is_service_running($v_name)) { + $handle = popen("/usr/local/etc/rc.d/".$v_name.".sh start", "r"); pclose($handle); - //give freeswitch time to load + //give time for the service to load sleep(7); } ?> @@ -132,8 +132,9 @@ if (!pkg_is_service_running('freeswitch')) { <?php include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Status</p>\n"; - +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: Status</p>\n"; +} if ($savemsg) { print_info_box($savemsg); @@ -168,7 +169,7 @@ echo "<td width='50%'>\n"; echo " <b>sofia status</b> \n"; echo "</td>\n"; echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='reloadxml' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+reloadxml';\" />\n"; +echo " <input type='button' value='reloadxml' onclick=\"document.location.href='v_cmd.php?cmd=api+reloadxml';\" />\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; @@ -178,7 +179,7 @@ echo "</pre>\n"; fclose($fp); echo "<br /><br />\n\n"; -foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ +foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){ $sip_profile_name = str_replace(".xml", "", $sip_profile_file); $fp = event_socket_create($host, $port, $password); @@ -190,14 +191,14 @@ foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_prof echo " <b>sofia status profile $sip_profile_name</b> \n"; echo "</td>\n"; echo "<td width='50%' align='right'>\n"; - echo " <input type='button' value='start' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n"; - echo " <input type='button' value='stop' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n"; - echo " <input type='button' value='restart' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n"; + echo " <input type='button' value='start' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n"; + echo " <input type='button' value='stop' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n"; + echo " <input type='button' value='restart' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n"; if ($sip_profile_name == "external") { - echo " <input type='button' value='rescan' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n"; + echo " <input type='button' value='rescan' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n"; } else { - echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n"; + echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n"; } echo "</td>\n"; echo "</tr>\n"; @@ -264,15 +265,15 @@ echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; echo "<tr>\n"; echo "<td width='80%'>\n"; echo "<b>Backup / Restore</b><br />\n"; -echo "The 'backup' button will tar gzip /usr/local/freeswitch/ to /root/backup/freeswitch.bak.tgz it then presents a file to download. \n"; -echo "If the backup file does not exist in /root/backup/freeswitch.bak.tgz then the 'restore' button will be hidden. \n"; +echo "The 'backup' button will tar gzip ".$v_dir." to ".$v_backup_dir."/".$v_name.".bak.tgz it then presents a file to download. \n"; +echo "If the backup file does not exist in ".$v_backup_dir."/".$v_name.".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 "<br /><br />\n"; echo "</td>\n"; echo "<td width='20%' valign='middle' align='right'>\n"; -echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=download&t=backup';\" />\n"; -if (file_exists('/root/backup/freeswitch.bak.tgz')) { - echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=other&t=restore';\" />\n"; +echo " <input type='button' value='backup' onclick=\"document.location.href='v_status.php?a=download&t=backup';\" />\n"; +if (file_exists($v_backup_dir.'/'.$v_name.'.bak.tgz')) { + echo " <input type='button' value='restore' onclick=\"document.location.href='v_status.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; echo "</tr>\n"; @@ -284,10 +285,10 @@ echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; echo "<tr>\n"; echo "<td width='50%'>\n"; echo "<b>Call Detail Records</b><br />\n"; -echo "/usr/local/freeswitch/log/cdr-csv/Master.csv<br /><br />\n"; +echo $v_log_dir."/cdr-csv/Master.csv<br /><br />\n"; echo "</td>\n"; echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n"; +echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='v_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br /><br />\n\n"; @@ -297,18 +298,18 @@ echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; echo "<tr>\n"; echo "<td width='50%'>\n"; echo "<b>Logs</b><br />\n"; -echo "/usr/local/freeswitch/log/cdr-csv/freeswitch.log<br /><br />\n"; +echo $v_log_dir."/cdr-csv/".$v_name.".log<br /><br />\n"; echo "</td>\n"; echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='download logs' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=download&t=logs';\" />\n"; +echo " <input type='button' value='download logs' onclick=\"document.location.href='v_status.php?a=download&t=logs';\" />\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br /><br />\n\n"; -echo "<b>tail -n 500 /usr/local/freeswitch/log/freeswitch.log</b><br />\n"; +echo "<b>tail -n 500 ".$v_log_dir."/".$v_name.".log</b><br />\n"; echo "<textarea id='log' name='log' cols='93' rows='30' wrap='off'>\n"; -echo system("tail -n 500 /usr/local/freeswitch/log/freeswitch.log"); +echo system("tail -n 500 ".$v_log_dir."/".$v_name.".log"); echo "</textarea>\n"; echo "<br /><br />\n\n"; diff --git a/config/freeswitch_dev/v_time_conditions.tmp b/config/freeswitch_dev/v_time_conditions.tmp index 2f6d096a..676b19c7 100644 --- a/config/freeswitch_dev/v_time_conditions.tmp +++ b/config/freeswitch_dev/v_time_conditions.tmp @@ -54,7 +54,9 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php //include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_labels: IVR Options</p>\n"; +if ($v_label_show) { + echo "<p class=\"pgtitle\">$v_label: IVR Options</p>\n"; +} ?> <div id="mainlevel"> diff --git a/config/freeswitch_dev/v_vars.tmp b/config/freeswitch_dev/v_vars.tmp index 2b6787ac..feab8e19 100644 --- a/config/freeswitch_dev/v_vars.tmp +++ b/config/freeswitch_dev/v_vars.tmp @@ -34,7 +34,7 @@ require("/usr/local/pkg/v_config.inc"); if ($_GET['a'] == "default") { conf_mount_rw(); - exec("cp /usr/local/freeswitch/conf.orig/vars.xml /usr/local/freeswitch/conf/vars.xml"); + exec("cp ".$v_conf_dir.".orig/vars.xml ".$v_conf_dir."/vars.xml"); $savemsg = "Default Restored"; conf_mount_ro(); } @@ -42,7 +42,7 @@ if ($_GET['a'] == "default") { if ($_POST['a'] == "save") { conf_mount_rw(); $content = ereg_replace("\r","",$_POST['code']); - $fd = fopen("/usr/local/freeswitch/conf/vars.xml", "w"); + $fd = fopen($v_conf_dir."/vars.xml", "w"); fwrite($fd, $content); fclose($fd); $savemsg = "Saved"; @@ -50,8 +50,8 @@ if ($_POST['a'] == "save") { } -$fd = fopen("/usr/local/freeswitch/conf/vars.xml", "r"); -$content = fread($fd, filesize("/usr/local/freeswitch/conf/vars.xml")); +$fd = fopen($v_conf_dir."/vars.xml", "r"); +$content = fread($fd, filesize($v_conf_dir."/conf/vars.xml")); fclose($fd); include("head.inc"); @@ -123,7 +123,13 @@ build_menu(); <table width="98%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td>/usr/local/freeswitch/conf/vars.xml</td> + <td> + <?php + if ($v_path_show) { + echo $v_conf_dir."/vars.xml\n"; + } + ?> + </td> <td align='right'> <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" /> <input type="hidden" name="a" value="save" /> |