diff options
Diffstat (limited to 'config/freeswitch')
47 files changed, 2990 insertions, 2889 deletions
diff --git a/config/freeswitch/call_forward_has_been_deleted.wav b/config/freeswitch/call_forward_has_been_deleted.wav Binary files differnew file mode 100644 index 00000000..ebe6ed36 --- /dev/null +++ b/config/freeswitch/call_forward_has_been_deleted.wav diff --git a/config/freeswitch/call_forward_has_been_set.wav b/config/freeswitch/call_forward_has_been_set.wav Binary files differnew file mode 100644 index 00000000..58262852 --- /dev/null +++ b/config/freeswitch/call_forward_has_been_set.wav diff --git a/config/freeswitch/disa.js b/config/freeswitch/disa.js new file mode 100644 index 00000000..5cff6424 --- /dev/null +++ b/config/freeswitch/disa.js @@ -0,0 +1,78 @@ +include("/usr/local/freeswitch/scripts/config.js");
+
+ //var admin_pin = ""; //don't require a pin
+ //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id
+ var predefined_destination = ""; //example: 9999
+ //predefined_destination leave empty in most cases
+ //Use this to define a single destination
+ var digitmaxlength = 0;
+ var timeoutpin = 7500;
+ var timeouttransfer = 7500;
+
+ function mycb( session, type, obj, arg ) {
+ try {
+ if ( type == "dtmf" ) {
+ console_log( "info", "digit: "+obj.digit+"\n" );
+ if ( obj.digit == "#" ) {
+ //console_log( "info", "detected pound sign.\n" );
+ exit = true;
+ return( false );
+ }
+
+ dtmf.digits += obj.digit;
+
+ if ( dtmf.digits.length >= digitmaxlength ) {
+ exit = true;
+ return( false );
+ }
+ }
+ } catch (e) {
+ console_log( "err", e+"\n" );
+ }
+ return( true );
+ } //end function mycb
+
+
+ //console_log( "info", "DISA Request\n" );
+
+ var dtmf = new Object( );
+ dtmf.digits = "";
+
+ if ( session.ready( ) ) {
+ session.answer( );
+
+ if (admin_pin.length > 0) {
+ digitmaxlength = 6;
+ session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf");
+ session.collectInput( mycb, dtmf, timeoutpin );
+ //console_log( "info", "DISA pin: " + dtmf.digits + "\n" );
+ }
+
+ if (dtmf.digits == admin_pin || admin_pin.length == 0) {
+
+ //console_log( "info", "DISA pin is correct\n" );
+
+ us_ring = session.getVariable("us-ring");
+ session.execute("set", "ringback="+us_ring); //set to ringtone
+ session.execute("set", "transfer_ringback="+us_ring); //set to ringtone
+ session.execute("set", "hangup_after_bridge=true");
+
+ if (predefined_destination.length == 0) {
+ dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request
+ digitmaxlength = 11;
+ session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf");
+ session.collectInput( mycb, dtmf, timeouttransfer );
+ console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" );
+ session.execute("transfer", dtmf.digits + " XML default");
+ }
+ else {
+ session.execute("transfer", predefined_destination + " XML default");
+ }
+
+ }
+ else {
+ session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf");
+ console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" );
+ }
+
+ }
diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index 4222d27a..4e0ab1ab 100755..100644 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -6,12 +6,10 @@ freeswitch.inc Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ - */ -/* ========================================================================== */ -/* + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -34,6 +32,73 @@ POSSIBILITY OF SUCH DAMAGE. */ +function build_menu() { + + //$script_name_array = split ("/", $_SERVER["SCRIPT_NAME"]); + //$script_name = $script_name_array[count($script_name_array)-1]; + //echo "script_name: ".$script_name."<br />"; + + $tab_array = array(); + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/pkg_edit.php?xml=freeswitch.xml&id=0") { $menu_selected = true; } + $tab_array[] = array(gettext("Settings"), $menu_selected, "/pkg_edit.php?xml=freeswitch.xml&id=0"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Dialplan"), $menu_selected, "/packages/freeswitch/freeswitch_dialplan_includes.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_extensions.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_extensions_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Extensions"), $menu_selected, "/packages/freeswitch/freeswitch_extensions.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_features.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr_options_edit.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Features"), $menu_selected, "/packages/freeswitch/freeswitch_features.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_gateways.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_gateways_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Gateways"), $menu_selected, "/packages/freeswitch/freeswitch_gateways.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_profiles.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_profile_edit.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Profiles"), $menu_selected, "/packages/freeswitch/freeswitch_profiles.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes.php") { $menu_selected = true; } + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Public"), $menu_selected, "/packages/freeswitch/freeswitch_public_includes.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_status.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Status"), $menu_selected, "/packages/freeswitch/freeswitch_status.php"); + unset($menu_selected); + + $menu_selected = false; + if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_vars.php") { $menu_selected = true; } + $tab_array[] = array(gettext("Vars"), $menu_selected, "/packages/freeswitch/freeswitch_vars.php"); + unset($menu_selected); + + return $tab_array; +} + function guid() { @@ -56,7 +121,7 @@ function guid() //echo guid(); -function pkg_is_service_running($servicename) +function pkg_is_service_running($servicename) { exec("/bin/ps ax | awk '{ print $5 }'", $psout); array_shift($psout); @@ -72,10 +137,10 @@ function pkg_is_service_running($servicename) } -function event_socket_create($host, $port, $password) +function event_socket_create($host, $port, $password) { //$host has been deprecated - + //build the interface list $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN'); for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { @@ -86,15 +151,15 @@ function event_socket_create($host, $port, $password) foreach ($ifdescrs as $ifdescr => $ifname){ $ifinfo = get_interface_info($ifdescr); $interface_ip_address = $ifinfo['ipaddr']; - + if (strlen($interface_ip_address) > 0) { $fp = fsockopen($interface_ip_address, $port, $errno, $errdesc, 3); socket_set_blocking($fp,false); - + if (!$fp) { - //connection failed continue through the loop testing other addresses - //invalid handle + //connection failed continue through the loop testing other addresses + //invalid handle } else { //connected to the socket return the handle @@ -107,20 +172,20 @@ function event_socket_create($host, $port, $password) break; } } - return $fp; - } - + return $fp; + } + } //end if interface_ip_address - } //end foreach + } //end foreach } //end function -function event_socket_request($fp, $cmd) +function event_socket_request($fp, $cmd) { - if ($fp) { - fputs($fp, $cmd."\n\n"); + if ($fp) { + fputs($fp, $cmd."\n\n"); usleep(100); //allow time for reponse - + $response = ""; $i = 0; $contentlength = 0; @@ -129,7 +194,7 @@ function event_socket_request($fp, $cmd) if ($contentlength > 0) { $response .= $buffer; } - + if ($contentlength == 0) { //if contentlenght is already don't process again if (strlen(trim($buffer)) > 0) { //run only if buffer has content $temparray = split(":", trim($buffer)); @@ -138,21 +203,21 @@ function event_socket_request($fp, $cmd) } } } - + usleep(100); //allow time for reponse - + //optional because of script timeout //don't let while loop become endless - if ($i > 10000) { break; } - + if ($i > 10000) { break; } + if ($contentlength > 0) { //is contentlength set //stop reading if all content has been read. - if (strlen($response) >= $contentlength) { + if (strlen($response) >= $contentlength) { break; } } $i++; } - + return $response; } else { @@ -165,7 +230,7 @@ function event_socket_request_cmd($cmd) { global $config; $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; - $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; + $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; $host = $config['interfaces']['lan']['ipaddr']; if (pkg_is_service_running('freeswitch')) { @@ -188,12 +253,65 @@ function byte_convert( $bytes ) { return round($bytes/pow($convention,$e),2).' '.$s[$e]; } +function lan_sip_profile() +{ + global $config; + //create the LAN profile if it doesn't exist + if (!file_exists('/usr/local/freeswitch/conf/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"); + + $filename = "/usr/local/freeswitch/conf/sip_profiles/lan.xml"; + $handle = fopen($filename,"rb"); + $contents = fread($handle, filesize($filename)); + fclose($handle); + + $handle = fopen($filename,"w"); + $contents = str_replace("<profile name=\"internal\">", "<profile name=\"lan\">", $contents); + $contents = str_replace("<alias name=\"default\"/>", "", $contents); + $contents = str_replace("<X-PRE-PROCESS cmd=\"include\" data=\"internal/*.xml\"/>", "<X-PRE-PROCESS cmd=\"include\" data=\"lan/*.xml\"/>", $contents); + $contents = str_replace("<param name=\"rtp-ip\" value=\"\$\${local_ip_v4}\"/>", "<param name=\"rtp-ip\" value=\"".$lan_ip."\"/>", $contents); + $contents = str_replace("<param name=\"sip-ip\" value=\"\$\${local_ip_v4}\"/>", "<param name=\"sip-ip\" value=\"".$lan_ip."\"/>", $contents); + fwrite($handle, $contents); + unset($contents); + fclose($handle); + unset($filename); + } + } + +} + +function ListFiles($dir) { + + if($dh = opendir($dir)) { + + $files = Array(); + $inner_files = Array(); + + while($file = readdir($dh)) { + if($file != "." && $file != ".." && $file[0] != '.') { + if(is_dir($dir . "/" . $file)) { + //$inner_files = ListFiles($dir . "/" . $file); //recursive + if(is_array($inner_files)) $files = array_merge($files, $inner_files); + } else { + array_push($files, $file); + //array_push($files, $dir . "/" . $file); + } + } + } + + closedir($dh); + return $files; + } +} + function recording_js() { - global $config; + global $config; $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']; - + $fout = fopen("/usr/local/freeswitch/scripts/recordings.js","w"); $tmp = " var pin = \"".$admin_pin."\";\n"; $tmp .= " //var pin = \"\"; //don't require a pin\n"; @@ -254,9 +372,9 @@ function recording_js() //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n"; //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n"; //$tmp .= " session.execute(\"speak\", \"Please enter your pin number now.\");\n"; - $tmp .= " digitmaxlength = 6;\n"; + $tmp .= " digitmaxlength = 6;\n"; $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/please_enter_your_pin_number.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n"; $tmp .= " }\n"; $tmp .= "\n"; @@ -265,7 +383,7 @@ 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/recordings/begin_recording.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"/usr/local/freeswitch/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 .= " }\n"; @@ -274,7 +392,7 @@ function recording_js() //$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/recordings/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; + $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; $tmp .= " }\n"; $tmp .= " session.hangup();\n"; $tmp .= "\n"; @@ -285,66 +403,89 @@ function recording_js() } - + function sync_package_freeswitch_settings() { - global $config; + global $config; if($config['installedpackages']['freeswitchsettings']['config'] != "") { - + conf_mount_rw(); config_unlock(); foreach($config['installedpackages']['freeswitchsettings']['config'] as $rowhelper) { - $fout = fopen("/usr/local/freeswitch/conf/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"; - $tmpxml .= " <!--all variables here will be set on all inbound calls that originate from this user -->\n"; - $tmpxml .= " <!-- set these to take advantage of a dialplan localized to this user -->\n"; - $tmpxml .= " <variable name=\"numbering_plan\" value=\"" . $rowhelper['numbering_plan'] . "\"/>\n"; - $tmpxml .= " <variable name=\"default_gateway\" value=\"" . $rowhelper['default_gateway'] . "\"/>\n"; - $tmpxml .= " <variable name=\"default_area_code\" value=\"" . $rowhelper['default_area_code'] . "\"/>\n"; - $tmpxml .= " </variables>\n"; - $tmpxml .= " </user>\n"; - $tmpxml .= "</include>\n"; - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); - - $fout = fopen("/usr/local/freeswitch/conf/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"; - $tmpxml .= " <param name=\"listen-port\" value=\"" . $rowhelper['event_socket_port'] . "\"/>\n"; - $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['event_socket_password'] . "\"/>\n"; - $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n"; - $tmpxml .= " </settings>\n"; - $tmpxml .= "</configuration>"; - fwrite($fout, $tmpxml); - unset($tmpxml, $event_socket_password); - fclose($fout); - - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/xml_rpc.conf","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"; - $tmpxml .= " <param name=\"http-port\" value=\"" . $rowhelper['xml_rpc_http_port'] . "\"/>\n"; - $tmpxml .= " <!-- if all 3 of the following params exist all http traffic will require auth -->\n"; - $tmpxml .= " <param name=\"auth-realm\" value=\"" . $rowhelper['xml_rpc_auth_realm'] . "\"/>\n"; - $tmpxml .= " <param name=\"auth-user\" value=\"" . $rowhelper['xml_rpc_auth_user'] . "\"/>\n"; - $tmpxml .= " <param name=\"auth-pass\" value=\"" . $rowhelper['xml_rpc_auth_pass'] . "\"/>\n"; - $tmpxml .= " </settings>\n"; - $tmpxml .= "</configuration>\n"; - fwrite($fout, $tmpxml); - unset($tmpxml, $event_socket_password); - fclose($fout); - - recording_js(); - + $fout = fopen("/usr/local/freeswitch/conf/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"; + $tmpxml .= " <!--all variables here will be set on all inbound calls that originate from this user -->\n"; + $tmpxml .= " <!-- set these to take advantage of a dialplan localized to this user -->\n"; + $tmpxml .= " <variable name=\"numbering_plan\" value=\"" . $rowhelper['numbering_plan'] . "\"/>\n"; + $tmpxml .= " <variable name=\"default_gateway\" value=\"" . $rowhelper['default_gateway'] . "\"/>\n"; + $tmpxml .= " <variable name=\"default_area_code\" value=\"" . $rowhelper['default_area_code'] . "\"/>\n"; + $tmpxml .= " </variables>\n"; + $tmpxml .= " </user>\n"; + $tmpxml .= "</include>\n"; + fwrite($fout, $tmpxml); + unset($tmpxml); + fclose($fout); + + $fout = fopen("/usr/local/freeswitch/conf/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"; + $tmpxml .= " <param name=\"listen-port\" value=\"" . $rowhelper['event_socket_port'] . "\"/>\n"; + $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['event_socket_password'] . "\"/>\n"; + $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n"; + $tmpxml .= " </settings>\n"; + $tmpxml .= "</configuration>"; + fwrite($fout, $tmpxml); + unset($tmpxml, $event_socket_password); + fclose($fout); + + $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/xml_rpc.conf","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"; + $tmpxml .= " <param name=\"http-port\" value=\"" . $rowhelper['xml_rpc_http_port'] . "\"/>\n"; + $tmpxml .= " <!-- if all 3 of the following params exist all http traffic will require auth -->\n"; + $tmpxml .= " <param name=\"auth-realm\" value=\"" . $rowhelper['xml_rpc_auth_realm'] . "\"/>\n"; + $tmpxml .= " <param name=\"auth-user\" value=\"" . $rowhelper['xml_rpc_auth_user'] . "\"/>\n"; + $tmpxml .= " <param name=\"auth-pass\" value=\"" . $rowhelper['xml_rpc_auth_pass'] . "\"/>\n"; + $tmpxml .= " </settings>\n"; + $tmpxml .= "</configuration>\n"; + fwrite($fout, $tmpxml); + unset($tmpxml); + fclose($fout); + + recording_js(); + + //shout.conf.xml + $fout = fopen("/usr/local/freeswitch/conf/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"; + $tmpxml .= " <param name=\"decoder\" value=\"" . $rowhelper['mod_shout_decoder'] . "\"/>\n"; + $tmpxml .= " <param name=\"volume\" value=\"" . $rowhelper['mod_shout_volume'] . "\"/>\n"; + $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n"; + $tmpxml .= " </settings>\n"; + $tmpxml .= "</configuration>"; + fwrite($fout, $tmpxml); + unset($tmpxml); + fclose($fout); + + //config.js + $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']; + $fout = fopen("/usr/local/freeswitch/scripts/config.js","w"); + $tmp = "//javascript include\n\n"; + $tmp .= "var admin_pin = \"" . $admin_pin . "\";\n"; + fwrite($fout, $tmp); + unset($tmp); + fclose($fout); + } - + conf_mount_ro(); $cmd = "api reloadxml"; //event_socket_request_cmd($cmd); @@ -359,12 +500,12 @@ function sync_package_freeswitch_dialplan() global $config; conf_mount_rw(); config_unlock(); - + 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"; $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); + $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); @@ -389,13 +530,13 @@ function sync_package_freeswitch_dialplan() function sync_package_freeswitch_extensions() { - global $config; + global $config; if($config['installedpackages']['freeswitchextensions']['config'] != "") { conf_mount_rw(); config_unlock(); - /* delete all old extensions to prepare for new ones */ + /* 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"); @@ -411,7 +552,7 @@ function sync_package_freeswitch_extensions() $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); $tmpxml = "<include>\n"; - if (strlen($rowhelper['cidr']) == 0) { + if (strlen($rowhelper['cidr']) == 0) { $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\">\n"; } else { @@ -422,7 +563,7 @@ function sync_package_freeswitch_extensions() $tmpxml .= " <param name=\"vm-password\" value=\"" . $rowhelper['vm-password'] . "\"/>\n"; if (strlen($rowhelper['vm-mailto']) > 0) { $tmpxml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n"; - + switch ($rowhelper['vm-attach-file']) { case "true": $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n"; @@ -436,8 +577,8 @@ function sync_package_freeswitch_extensions() $tmpxml .= " <param name=\"vm-mailto\" value=\"" . $rowhelper['vm-mailto'] . "\"/>\n"; } - if (strlen($rowhelper['auth-acl']) > 0) { - $tmpxml .= " <param name=\"auth-acl\" value=\"" . $rowhelper['auth-acl'] . "\"/>\n"; + if (strlen($rowhelper['auth-acl']) > 0) { + $tmpxml .= " <param name=\"auth-acl\" value=\"" . $rowhelper['auth-acl'] . "\"/>\n"; } $tmpxml .= " </params>\n"; $tmpxml .= " <variables>\n"; @@ -459,26 +600,26 @@ function sync_package_freeswitch_extensions() unset($tmpxml); fclose($fout); } - + conf_mount_ro(); $cmd = "api reloadxml"; //event_socket_request_cmd($cmd); unset($cmd); - } + } } function sync_package_freeswitch_gateways() { - global $config; + global $config; if($config['installedpackages']['freeswitchgateways']['config'] != "") { - + conf_mount_rw(); config_unlock(); - /* delete all old gateways to prepare for new ones */ + /* delete all old gateways to prepare for new ones */ unlink_if_exists("/usr/local/freeswitch/conf/sip_profiles/external/*.xml"); foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) { @@ -493,7 +634,7 @@ function sync_package_freeswitch_gateways() } if (strlen($rowhelper['password']) > 0) { $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n"; - } + } if (strlen($rowhelper['realm']) > 0) { $tmpxml .= " <param name=\"realm\" value=\"" . $rowhelper['realm'] . "\"/>\n"; } @@ -512,9 +653,24 @@ function sync_package_freeswitch_gateways() if (strlen($rowhelper['register']) > 0) { $tmpxml .= " <param name=\"register\" value=\"" . $rowhelper['register'] . "\"/>\n"; } + if (strlen($rowhelper['register-transport']) > 0) { - $tmpxml .= " <param name=\"register-transport\" value=\"" . $rowhelper['register-transport'] . "\"/>\n"; - } + switch ($rowhelper['register-transport']) { + case "udp": + $tmpxml .= " <param name=\"register-transport\" value=\"udp\"/>\n"; + break; + case "tcp": + $tmpxml .= " <param name=\"register-transport\" value=\"tcp\"/>\n"; + break; + case "tls": + $tmpxml .= " <param name=\"register-transport\" value=\"tls\"/>\n"; + $tmpxml .= " <param name=\"contact-params\" value=\"transport=tls\"/>\n"; + break; + default: + $tmpxml .= " <param name=\"register-transport\" value=\"" . $rowhelper['register-transport'] . "\"/>\n"; + } + } + if (strlen($rowhelper['retry-seconds']) > 0) { $tmpxml .= " <param name=\"retry-seconds\" value=\"" . $rowhelper['retry-seconds'] . "\"/>\n"; } @@ -529,38 +685,38 @@ function sync_package_freeswitch_gateways() } if (strlen($rowhelper['supress-cng']) > 0) { $tmpxml .= " <param name=\"context\" value=\"" . $rowhelper['context'] . "\"/>\n"; - } + } $tmpxml .= " </gateway>\n"; $tmpxml .= "</include>"; - + fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); - } - + } + } - + conf_mount_ro(); $cmd = "api sofia profile external restart reloadxml"; //event_socket_request_cmd($cmd); unset($cmd); - + } - + } function sync_package_freeswitch_modules() { - + global $config; conf_mount_rw(); config_unlock(); foreach($config['installedpackages']['freeswitchmodules']['config'] as $rowhelper) { $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml","w"); - + $tmpxml =""; $tmpxml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n"; $tmpxml .= " <modules>\n"; @@ -682,12 +838,12 @@ function sync_package_freeswitch_public() global $config; conf_mount_rw(); config_unlock(); - + 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"; $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); + $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); $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = base64_encode($tmpxml); unset($filename, $tmpxml); @@ -716,12 +872,12 @@ function sync_package_freeswitch_vars() global $config; conf_mount_rw(); config_unlock(); - + 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"; $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); + $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); @@ -748,12 +904,12 @@ function sync_package_freeswitch_internal() global $config; conf_mount_rw(); config_unlock(); - + 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)); + $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); @@ -780,12 +936,12 @@ function sync_package_freeswitch_external() global $config; conf_mount_rw(); config_unlock(); - + 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)); + $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); @@ -818,9 +974,9 @@ function get_recording_filename($id) return $rowhelper['filename']; } } - } + } } - + function sync_package_freeswitch_ivr() { @@ -830,37 +986,37 @@ function sync_package_freeswitch_ivr() config_lock(); $a_ivr = &$config['installedpackages']['freeswitchivr']['config']; - if (count($a_ivr) > 0) { + if (count($a_ivr) > 0) { foreach($a_ivr as $rowhelper) { /* $rowhelper['ivrid'] $rowhelper['ivrextension'] $rowhelper['ivrname'] - $rowhelper['recordingid'] + $rowhelper['recordingid'] $rowhelper['ivrtimeout'] $rowhelper['ivrcontext'] $rowhelper['ivrconditionjs'] - $rowhelper['ivrdescr'] + $rowhelper['ivrdescr'] */ - + $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; + $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - + //add the IVR to the dialplan if (strlen($rowhelper['ivrid']) > 0) { $action = 'add'; //set default action to add $i = 0; if (count($a_dialplan_includes) > 0) { foreach($a_dialplan_includes as $row) { - + //$row['dialplanincludeid']; //$row['extensionname']; //$row['context']; //$row['enabled']; //echo "if (".$row['opt1name']." == \"ivrid\" && ".$row['opt1value']." == ".$rowhelper['ivrid'].") {\n"; - + if ($row['opt1name'] == "ivrid" && $row['opt1value'] == $rowhelper['ivrid']) { //update $action = 'update'; @@ -873,18 +1029,18 @@ function sync_package_freeswitch_ivr() $opt1name = $row['opt1name']; $opt1value = $row['opt1value']; $id = $i; - //echo "update".$i."<br />\n"; + //echo "update".$i."<br />\n"; } $i++; - + } } - - + + $ent = array(); if ($action == 'add') { - + $dialplanincludeid = guid(); $ent['dialplanincludeid'] = $dialplanincludeid; $ent['extensionname'] = $rowhelper['ivrextension']; @@ -894,7 +1050,7 @@ function sync_package_freeswitch_ivr() $ent['descr'] = 'IVR'; $ent['opt1name'] = 'ivrid'; $ent['opt1value'] = $rowhelper['ivrid']; - + //add to the config $a_dialplan_includes[] = $ent; unset($ent); @@ -906,7 +1062,7 @@ function sync_package_freeswitch_ivr() $ent['fielddata'] = '^'.$rowhelper['ivrextension'].'$'; $a_dialplan_include_details[] = $ent; unset($ent); - + $ivrid = str_replace(array("{", "}"), "", $rowhelper['ivrid']); $ent = array(); @@ -921,7 +1077,7 @@ function sync_package_freeswitch_ivr() } if ($action == 'update') { - + $ent['dialplanincludeid'] = $dialplanincludeid; $ent['extensionname'] = $rowhelper['ivrextension']; $ent['order'] = $order; @@ -950,7 +1106,7 @@ function sync_package_freeswitch_ivr() unset($dialplanincludeid); } //end if strlen ivrid; add the IVR to the dialplan - + // Build the IVR javascript $recording_action_filename = get_recording_filename($rowhelper['recordingidaction']); $recording_antiaction_filename = get_recording_filename($rowhelper['recordingidantiaction']); @@ -964,8 +1120,8 @@ function sync_package_freeswitch_ivr() $cmd = "api global_getvar domain"; $domain = trim(event_socket_request($fp, $cmd)); } - - + + $tmp = ""; //make sure the variable starts with no value $tmp .= "\n"; $tmp .= " var condition = true;\n"; @@ -1017,17 +1173,17 @@ function sync_package_freeswitch_ivr() $tmp .= " }\n"; $tmp .= " return( true );\n"; $tmp .= " } //end function mycb\n"; - + $tmp .= "\n"; $tmp .= base64_decode($rowhelper['ivrconditionjs']); $tmp .= "\n"; $tmp .= "\n"; - + //$tmp .= " //condition = true; //debugging\n"; $actiondirect = false; $actioncount = 0; - foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) { + foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) { //find the correct IVR options with the correct action if ($row['ivrid'] == $rowhelper['ivrid']) { if ($row['optionaction'] == "action") { @@ -1076,23 +1232,23 @@ function sync_package_freeswitch_ivr() $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; $tmp .= " if (dtmf.digits == 0) {\n"; //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; - - $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; + + $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; //find the timeout IVR options with the correct action if (count($a_ivr_options) > 0) { - foreach($a_ivr_options as $row) { + foreach($a_ivr_options as $row) { if ($row['ivrid'] == $rowhelper['ivrid']) { - + if ($row['optionaction'] == "action") { - if (strtolower($row['optionnumber']) == "t") { + if (strtolower($row['optionnumber']) == "t") { if ($row['optiontype'] == "extension") { $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; } if ($row['optiontype'] == "voicemail") { //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + } } } //end anti-action @@ -1100,14 +1256,14 @@ function sync_package_freeswitch_ivr() } //end for each } //if count - - + + $tmp .= " }\n"; $tmp .= " else {\n"; $tmp .= " break; //dtmf found end the while loop\n"; - $tmp .= " }\n"; - $tmp .= " }\n"; - $tmp .= " }\n"; + $tmp .= " }\n"; + $tmp .= " }\n"; + $tmp .= " }\n"; $tmp .= " }\n"; $tmp .= "\n"; $tmp .= " //pickup the remaining digits\n"; @@ -1128,35 +1284,35 @@ function sync_package_freeswitch_ivr() $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; if (count($a_ivr_options) > 0) { foreach($a_ivr_options as $row) { - + /* $row['ivrid'] $row['optionnumber'] $row['optiontype'] $row['optionaction'] $row['optiondest'] - $row['optiondescr'] + $row['optiondescr'] */ - - $tmpactiondefault = ""; - + + $tmpactiondefault = ""; + //find the correct IVR options with the correct action if ($row['ivrid'] == $rowhelper['ivrid']){ - + if ($row['optionaction'] == "action") { //$tmpaction .= "\n"; - + switch ($row['optionnumber']) { //case "t": - + //if ($row['optiontype'] == "extension") { // $tmpactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; //} //if ($row['optiontype'] == "voicemail") { // //$tmpactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; // $tmpactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - //} - + //} + //break; default: //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; @@ -1172,17 +1328,17 @@ function sync_package_freeswitch_ivr() if ($row['optiontype'] == "voicemail") { //$tmpaction .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmpaction .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + } $tmpaction .= " }\n"; - + } - + $x++; - } //end if action + } //end if action } //end ivrid - + } //end foreach } //end if count @@ -1193,9 +1349,9 @@ function sync_package_freeswitch_ivr() //$tmp .= $tmpactiondefault; $tmp .= " }\n"; $tmp .= "\n"; - unset($tmpaction); + unset($tmpaction); + - $tmp .= " } \n"; //$tmp .= " else if ( dtmf.digits.length == \"3\" ) {\n"; //$tmp .= " //Transfer to the extension the caller chose\n"; @@ -1207,13 +1363,13 @@ function sync_package_freeswitch_ivr() $tmp .= " } //end if session.ready\n"; $tmp .= "\n"; $tmp .= " }\n"; //end if condition - + } //if ($actiondirect) { } //actioncount - + $antiactiondirect = false; $antiactioncount = 0; - foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) { + foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) { //find the correct IVR options with the correct action if ($row['ivrid'] == $rowhelper['ivrid']) { if ($row['optionaction'] == "anti-action") { @@ -1228,7 +1384,7 @@ function sync_package_freeswitch_ivr() } //$tmp .= "anti-action count: ".$antiactioncount."<br />\n"; - + if ($antiactioncount > 0) { if ($antiactiondirect) { $tmp .= " else {\n"; @@ -1261,40 +1417,40 @@ function sync_package_freeswitch_ivr() $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; $tmp .= " if (dtmf.digits == 0) {\n"; //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; - - + + //find the timeout IVR options with the correct action if (count($a_ivr_options) > 0) { foreach($a_ivr_options as $row) { if ($row['ivrid'] == $rowhelper['ivrid']) { - + if ($row['optionaction'] == "anti-action") { - if (strtolower($row['optionnumber']) == "t") { - + if (strtolower($row['optionnumber']) == "t") { + if ($row['optiontype'] == "extension") { $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; } if ($row['optiontype'] == "voicemail") { //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + } } - + } //end anti-action } //end ivrid } //end for each } //if count - - + + $tmp .= " }\n"; $tmp .= " else {\n"; $tmp .= " break; //dtmf found end the while loop\n"; $tmp .= " }\n"; - - $tmp .= " }\n"; + + $tmp .= " }\n"; $tmp .= " }\n"; $tmp .= " }\n"; $tmp .= "\n"; @@ -1307,48 +1463,48 @@ function sync_package_freeswitch_ivr() $tmp .= "\n"; - + $tmpantiaction = ""; $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n"; - + $x = 0; if (count($a_ivr_options) > 0) { foreach($a_ivr_options as $row) { - + /* $row['ivrid'] $row['optionnumber'] $row['optiontype'] $row['optionaction'] $row['optiondest'] - $row['optiondescr'] + $row['optiondescr'] */ //$tmpantiactiondefault = ""; - + //find the correct IVR options with the correct action if ($row['ivrid'] == $rowhelper['ivrid']) { - + if ($row['optionaction'] == "anti-action") { - + switch ($row['optionnumber']) { //case "t": - + //if ($row['optiontype'] == "extension") { // $tmpantiactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n"; //} //if ($row['optiontype'] == "voicemail") { // //$tmpantiactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; // $tmpantiactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - //} - + //} + //break; default: //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; if ($x == 0) { - $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; + $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; } else { $tmpantiaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; @@ -1360,13 +1516,13 @@ function sync_package_freeswitch_ivr() if ($row['optiontype'] == "voicemail") { //$tmpantiaction .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n"; $tmpantiaction .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n"; - } + } $tmpantiaction .= " }\n"; - + } //end switch - - $x++; + + $x++; } //end anti-action } //end ivrid @@ -1374,15 +1530,15 @@ function sync_package_freeswitch_ivr() } //end for each } //if count - + $tmp .= $tmpantiaction; $tmp .= " else {\n"; - $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n"; + $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n"; //$tmp .= $tmpantiactiondefault; $tmp .= " }\n"; $tmp .= "\n"; unset($tmpantiaction); - + $tmp .= " } \n"; //$tmp .= " else if ( dtmf.digits.length == \"3\" ) {\n"; //$tmp .= " //Transfer to the extension the caller chose\n"; @@ -1395,22 +1551,22 @@ function sync_package_freeswitch_ivr() $tmp .= " } //end if session.ready\n"; $tmp .= "\n"; $tmp .= " } //end if condition"; - + } //if ($antiactiondirect) { } //antiactioncount unset($tmpactiondefault); - unset($tmpantiactiondefault); - + unset($tmpantiactiondefault); + if (strlen($rowhelper['ivrid']) > 0) { - $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js"; + $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js"; $fout = fopen("/usr/local/freeswitch/scripts/".$ivrfilename,"w"); fwrite($fout, $tmp); unset($ivrfilename); fclose($fout); } - - } //end foreach - } //end if count + + } //end foreach + } //end if count conf_mount_ro(); config_unlock(); @@ -1427,73 +1583,73 @@ function sync_package_freeswitch_dialplan_includes() $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - + if (count($a_dialplan_includes) > 0) { foreach($config['installedpackages']['freeswitchdialplanincludes']['config'] as $rowhelper) { $tmp = ""; $tmp .= "\n"; - + //$rowhelper['dialplanincludeid']; //$rowhelper['extensionname']; //$rowhelper['context']; //$rowhelper['enabled']; - + $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n"; - - if (count($a_dialplan_include_details) > 0) { - + + if (count($a_dialplan_include_details) > 0) { + $conditioncount = 0; $i = 0; foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) { $conditioncount++; $i++; - } + } } - + $i = 1; foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) { - if ($conditioncount == 1) { //single condition + if ($conditioncount == 1) { //single condition //start tag - $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; + $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; } - else { //more than one condition - if ($i < $conditioncount) { + else { //more than one condition + if ($i < $conditioncount) { //all tags should be self-closing except the last one $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n"; } else { - //for the last tag use the start tag + //for the last tag use the start tag $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; } } $i++; } } //end for each - + } //end if count - + if (count($a_dialplan_include_details) > 0) { $i = 0; foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) { - $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; - } - $i++; + $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; + } + $i++; } } - + if (count($a_dialplan_include_details) > 0) { $i = 0; foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "anti-action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) { $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; - } - $i++; + } + $i++; } } - + //if (count($a_dialplan_include_details) > 0) { //foreach ($a_dialplan_include_details as $ent) { // $i = 0; @@ -1501,38 +1657,38 @@ function sync_package_freeswitch_dialplan_includes() //$ent['tag'] //$ent['fieldtype'] //$ent['fielddata'] - // } - // $i++; + // } + // $i++; // } //} - + if ($conditioncount > 0) { $tmp .= " </condition>\n"; } - unset ($conditioncount); + unset ($conditioncount); $tmp .= "</extension>\n"; - - + + if ($rowhelper['enabled'] == "true") { - $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; + $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; $fout = fopen("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename,"w"); fwrite($fout, $tmp); - fclose($fout); + fclose($fout); } unset($dialplanincludefilename); unset($tmp); - - + + } //end foreach - } //if array count - + } //if array count + conf_mount_ro(); config_unlock(); - + } -function sync_package_freeswitch_public_includes() +function sync_package_freeswitch_public_includes() { global $config; @@ -1542,73 +1698,73 @@ function sync_package_freeswitch_public_includes() $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config']; $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - if (count($a_public_includes) > 0) { + if (count($a_public_includes) > 0) { foreach($a_public_includes as $rowhelper) { $tmp = ""; $tmp .= "\n"; - + //$rowhelper['publicincludeid']; //$rowhelper['extensionname']; //$rowhelper['context']; //$rowhelper['enabled']; - + $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n"; - if (count($a_public_include_details) > 0) { - + if (count($a_public_include_details) > 0) { + $conditioncount = 0; $i = 0; foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) { $conditioncount++; $i++; - } + } } - + $i = 1; foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) { - if ($conditioncount == 1) { //single condition + if ($conditioncount == 1) { //single condition //start tag - $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; + $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; } - else { //more than one condition - if ($i < $conditioncount) { + else { //more than one condition + if ($i < $conditioncount) { //all tags should be self-closing except the last one $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n"; } else { - //for the last tag use the start tag + //for the last tag use the start tag $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; } } $i++; } } //end for each - + } //end if count - + if (count($a_public_include_details) > 0) { $i = 0; foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) { - $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; - } - $i++; + $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; + } + $i++; } } - + if (count($a_public_include_details) > 0) { $i = 0; foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "anti-action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) { $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n"; - } - $i++; + } + $i++; } } - + //if (count($a_public_include_details) > 0) { //foreach ($a_public_include_details as $ent) { // $i = 0; @@ -1616,192 +1772,280 @@ function sync_package_freeswitch_public_includes() //$ent['tag'] //$ent['fieldtype'] //$ent['fielddata'] - // } - // $i++; + // } + // $i++; // } //} - + if ($conditioncount > 0) { $tmp .= " </condition>\n"; } unset ($conditioncount); $tmp .= "</extension>\n"; - - + + if ($rowhelper['enabled'] == "true") { - $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; + $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; $fout = fopen("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename,"w"); fwrite($fout, $tmp); - fclose($fout); + fclose($fout); } unset($publicincludefilename); unset($tmp); - - } //end foreach - } //end if count + + } //end foreach + } //end if count conf_mount_ro(); config_unlock(); - + } -function sync_package_freeswitch() +function sync_package_freeswitch() { - - global $config; + + global $config; sync_package_freeswitch_settings(); sync_package_freeswitch_dialplan(); - sync_package_freeswitch_dialplan_includes(); + sync_package_freeswitch_dialplan_includes(); sync_package_freeswitch_extensions(); sync_package_freeswitch_gateways(); sync_package_freeswitch_modules(); sync_package_freeswitch_public(); - sync_package_freeswitch_public_includes(); - sync_package_freeswitch_vars(); + sync_package_freeswitch_public_includes(); + sync_package_freeswitch_vars(); sync_package_freeswitch_internal(); sync_package_freeswitch_external(); //sync_package_freeswitch_recordings(); - if (pkg_is_service_running('freeswitch')) { + if (pkg_is_service_running('freeswitch')) { sync_package_freeswitch_ivr(); } } - -function freeswitch_php_install_command() + +function freeswitch_php_install_command() { global $config; - $freeswitch_package_version = "0.8.3.5"; - $freeswitch_build_version = "1.0.3"; - $freeswitch_build_revision = "12545"; + $freeswitch_package_version = "0.8.7.5"; + $freeswitch_build_version = "1.0.4 pre 6"; + $freeswitch_build_revision = "13238"; + + //set script execution time limit to 24 hours + set_time_limit (86400); + ini_set(max_execution_time,86400); + + //hide errors + ini_set('display_errors', '0'); conf_mount_rw(); config_lock(); - - //needed for mod_fax support - system('pkg_add -r spandsp'); - if (!is_dir('/usr/local/www/freeswitch/')) { - exec("mkdir /usr/local/www/freeswitch/"); + if (!is_dir('/usr/local/www/packages/')) { + exec("mkdir /usr/local/www/packages/"); } + if (!is_dir('/usr/local/www/packages/freeswitch/')) { + exec("mkdir /usr/local/www/packages/freeswitch/"); + } //$struname = exec('uname -v'); //if (stristr($struname, 'FreeBSD 7.0')) { // $freebsd_version = "7.0"; //} - + + //exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch.tgz"); //handled by freeswitch.xml exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/"); unlink_if_exists("/tmp/freeswitch.tgz"); //make a backup copy of the default config - exec("cp -R /usr/local/freeswitch/conf /usr/local/freeswitch/conf.rev".$freeswitch_build_revision.".orig"); + exec("cp -R /usr/local/freeswitch/conf /usr/local/freeswitch/conf.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("/usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml"); - //copy audio files - exec("cp /tmp/please_enter_your_pin_number.wav /usr/local/freeswitch/recordings/please_enter_your_pin_number.wav"); - unlink_if_exists("/tmp/please_enter_your_pin_number.wav"); + if (!is_dir('/usr/local/freeswitch/sounds/custom/')) { + exec("mkdir /usr/local/freeswitch/sounds/custom/"); + } - exec("cp /tmp/begin_recording.wav /usr/local/freeswitch/recordings/begin_recording.wav"); - unlink_if_exists("/tmp/begin_recording.wav"); - - exec("cp /tmp/your_pin_number_is_incorect_goodbye.wav /usr/local/freeswitch/recordings/your_pin_number_is_incorect_goodbye.wav"); - unlink_if_exists("/tmp/your_pin_number_is_incorect_goodbye.wav"); + if (!is_dir('/usr/local/freeswitch/sounds/custom/8000/')) { + exec("mkdir /usr/local/freeswitch/sounds/custom/8000/"); + } - - //rename .so files from .1 to .so - exec("cp /tmp/mod_shout.so.1 /usr/local/freeswitch/mod/mod_shout.so"); - unlink_if_exists("/tmp/mod_shout.so.tmp"); + //copy audio files + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/please_enter_your_pin_number.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/please_enter_the_pin_number.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/please_enter_the_extension_number.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/please_enter_the_phone_number.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/call_forward_has_been_set.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/call_forward_has_been_deleted.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/begin_recording.wav"); + exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch http://www.pfsense.com/packages/config/freeswitch/your_pin_number_is_incorect_goodbye.wav"); - exec("cp /tmp/mod_fax.so.1 /usr/local/freeswitch/mod/mod_fax.so"); - unlink_if_exists("/tmp/mod_shout.so.tmp"); + //download lib files + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libtinfo.so.5.6"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libncurses.so.5.6"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libogg.so.5.3"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libvorbis.so.4"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libcurl.so.5"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libspandsp.so.1"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libodbc.so.1"); + exec("cd /usr/local/lib/;fetch http://www.pfsense.com/packages/config/freeswitch/libiconv.so.3"); + + + //download xml package files + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch.inc"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch.xml"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.xml"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_external.xml"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_internal.xml"); + exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_modules.xml"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public.xml"); + //exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_vars.xml"); + + //misc files + if (!is_dir('/usr/local/www/edit_area/')) { + exec("cd /usr/local/pkg/;fetch http://www.pfsense.com/packages/config/freeswitch/edit_area.tgz"); + 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 - exec("cp /tmp/class.smtp.tmp /usr/local/www/freeswitch/class.smtp.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/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("cp /tmp/class.phpmailer.tmp /usr/local/www/freeswitch/class.phpmailer.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/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("cp /tmp/freeswitch_cmd.tmp /usr/local/www/freeswitch/freeswitch_cmd.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_cmd.tmp"); + exec("cp /tmp/freeswitch_cmd.tmp /usr/local/www/packages/freeswitch/freeswitch_cmd.php"); unlink_if_exists("/tmp/freeswitch_cmd.tmp"); - - exec("cp /tmp/freeswitch_dialplan_includes_details.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_details.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.tmp"); + exec("cp /tmp/freeswitch_dialplan.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan.php"); + unlink_if_exists("/tmp/freeswitch_dialplan.tmp"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details.tmp"); + exec("cp /tmp/freeswitch_dialplan_includes_details.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details.php"); unlink_if_exists("/tmp/freeswitch_dialplan_includes_details.tmp"); - exec("cp /tmp/freeswitch_dialplan_includes_details_edit.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_details_edit.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp"); + exec("cp /tmp/freeswitch_dialplan_includes_details_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php"); unlink_if_exists("/tmp/freeswitch_dialplan_includes_details_edit.tmp"); - exec("cp /tmp/freeswitch_dialplan_includes.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes.tmp"); + exec("cp /tmp/freeswitch_dialplan_includes.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes.php"); unlink_if_exists("/tmp/freeswitch_dialplan_includes.tmp"); - - exec("cp /tmp/freeswitch_dialplan_includes_edit.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_edit.tmp"); + exec("cp /tmp/freeswitch_dialplan_includes_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_edit.php"); unlink_if_exists("/tmp/freeswitch_dialplan_includes_edit.tmp"); - - exec("cp /tmp/freeswitch_extensions.tmp /usr/local/www/freeswitch/freeswitch_extensions.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions.tmp"); + exec("cp /tmp/freeswitch_extensions.tmp /usr/local/www/packages/freeswitch/freeswitch_extensions.php"); unlink_if_exists("/tmp/freeswitch_extensions.tmp"); - - exec("cp /tmp/freeswitch_extensions_edit.tmp /usr/local/www/freeswitch/freeswitch_extensions_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions_edit.tmp"); + exec("cp /tmp/freeswitch_extensions_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_extensions_edit.php"); unlink_if_exists("/tmp/freeswitch_extensions_edit.tmp"); - exec("cp /tmp/freeswitch_gateways.tmp /usr/local/www/freeswitch/freeswitch_gateways.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_features.tmp"); + exec("cp /tmp/freeswitch_features.tmp /usr/local/www/packages/freeswitch/freeswitch_features.php"); + unlink_if_exists("/tmp/freeswitch_features.tmp"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways.tmp"); + exec("cp /tmp/freeswitch_gateways.tmp /usr/local/www/packages/freeswitch/freeswitch_gateways.php"); unlink_if_exists("/tmp/freeswitch_gateways.tmp"); - - exec("cp /tmp/freeswitch_gateways_edit.tmp /usr/local/www/freeswitch/freeswitch_gateways_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways_edit.tmp"); + exec("cp /tmp/freeswitch_gateways_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_gateways_edit.php"); unlink_if_exists("/tmp/freeswitch_gateways_edit.tmp"); - - exec("cp /tmp/freeswitch_ivr.tmp /usr/local/www/freeswitch/freeswitch_ivr.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr.tmp"); + exec("cp /tmp/freeswitch_ivr.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr.php"); unlink_if_exists("/tmp/freeswitch_ivr.tmp"); - - exec("cp /tmp/freeswitch_ivr_edit.tmp /usr/local/www/freeswitch/freeswitch_ivr_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_edit.tmp"); + exec("cp /tmp/freeswitch_ivr_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_edit.php"); unlink_if_exists("/tmp/freeswitch_ivr_edit.tmp"); - - exec("cp /tmp/freeswitch_ivr_options.tmp /usr/local/www/freeswitch/freeswitch_ivr_options.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options.tmp"); + exec("cp /tmp/freeswitch_ivr_options.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_options.php"); unlink_if_exists("/tmp/freeswitch_ivr_options.tmp"); - exec("cp /tmp/freeswitch_ivr_options_edit.tmp /usr/local/www/freeswitch/freeswitch_ivr_options_edit.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options_edit.tmp"); + exec("cp /tmp/freeswitch_ivr_options_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_options_edit.php"); unlink_if_exists("/tmp/freeswitch_ivr_options_edit.tmp"); - - exec("cp /tmp/freeswitch_public_includes.tmp /usr/local/www/freeswitch/freeswitch_public_includes.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_profiles.tmp"); + exec("cp /tmp/freeswitch_profiles.tmp /usr/local/www/packages/freeswitch/freeswitch_profiles.php"); + unlink_if_exists("/tmp/freeswitch_profiles.tmp"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_profile_edit.tmp"); + exec("cp /tmp/freeswitch_profile_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_profile_edit.php"); + unlink_if_exists("/tmp/freeswitch_profile_edit.tmp"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public.tmp"); + exec("cp /tmp/freeswitch_public.tmp /usr/local/www/packages/freeswitch/freeswitch_public.php"); + unlink_if_exists("/tmp/freeswitch_public.tmp"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes.tmp"); + exec("cp /tmp/freeswitch_public_includes.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes.php"); unlink_if_exists("/tmp/freeswitch_public_includes.tmp"); - - exec("cp /tmp/freeswitch_public_includes_edit.tmp /usr/local/www/freeswitch/freeswitch_public_includes_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_edit.tmp"); + exec("cp /tmp/freeswitch_public_includes_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_edit.php"); unlink_if_exists("/tmp/freeswitch_public_includes_edit.tmp"); - exec("cp /tmp/freeswitch_public_includes_details.tmp /usr/local/www/freeswitch/freeswitch_public_includes_details.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details.tmp"); + exec("cp /tmp/freeswitch_public_includes_details.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_details.php"); unlink_if_exists("/tmp/freeswitch_public_includes_details.tmp"); - exec("cp /tmp/freeswitch_public_includes_details_edit.tmp /usr/local/www/freeswitch/freeswitch_public_includes_details_edit.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details_edit.tmp"); + exec("cp /tmp/freeswitch_public_includes_details_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_details_edit.php"); unlink_if_exists("/tmp/freeswitch_public_includes_details_edit.tmp"); - exec("cp /tmp/freeswitch_mailto.tmp /usr/local/www/freeswitch/freeswitch_mailto.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_mailto.tmp"); + exec("cp /tmp/freeswitch_mailto.tmp /usr/local/www/packages/freeswitch/freeswitch_mailto.php"); unlink_if_exists("/tmp/freeswitch_mailto.tmp"); - - exec("cp /tmp/freeswitch_recordings.tmp /usr/local/www/freeswitch/freeswitch_recordings.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings.tmp"); + exec("cp /tmp/freeswitch_recordings.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings.php"); unlink_if_exists("/tmp/freeswitch_recordings.tmp"); - - exec("cp /tmp/freeswitch_recordings_edit.tmp /usr/local/www/freeswitch/freeswitch_recordings_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_edit.tmp"); + exec("cp /tmp/freeswitch_recordings_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings_edit.php"); unlink_if_exists("/tmp/freeswitch_recordings_edit.tmp"); - exec("cp /tmp/freeswitch_recordings_play.tmp /usr/local/www/freeswitch/freeswitch_recordings_play.php"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_play.tmp"); + exec("cp /tmp/freeswitch_recordings_play.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings_play.php"); unlink_if_exists("/tmp/freeswitch_recordings_play.tmp"); - - exec("cp /tmp/freeswitch_status.tmp /usr/local/www/freeswitch/freeswitch_status.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_status.tmp"); + exec("cp /tmp/freeswitch_status.tmp /usr/local/www/packages/freeswitch/freeswitch_status.php"); unlink_if_exists("/tmp/freeswitch_status.tmp"); - - exec("cp /tmp/freeswitch_time_conditions.tmp /usr/local/www/freeswitch/freeswitch_time_conditions.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions.tmp"); + exec("cp /tmp/freeswitch_time_conditions.tmp /usr/local/www/packages/freeswitch/freeswitch_time_conditions.php"); unlink_if_exists("/tmp/freeswitch_time_conditions.tmp"); - - exec("cp /tmp/freeswitch_time_conditions_edit.tmp /usr/local/www/freeswitch/freeswitch_time_conditions_edit.php"); + + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions_edit.tmp"); + exec("cp /tmp/freeswitch_time_conditions_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_time_conditions_edit.php"); unlink_if_exists("/tmp/freeswitch_time_conditions_edit.tmp"); - exec("cp /usr/local/freeswitch/htdocs/slim.swf /usr/local/www/freeswitch/slim.swf"); + exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_vars.tmp"); + exec("cp /tmp/freeswitch_vars.tmp /usr/local/www/packages/freeswitch/freeswitch_vars.php"); + unlink_if_exists("/tmp/freeswitch_vars.tmp"); + + exec("cd /usr/local/freeswitch/scripts/;fetch http://www.pfsense.com/packages/config/freeswitch/disa.js"); + exec("cp /usr/local/freeswitch/htdocs/slim.swf /usr/local/www/packages/freeswitch/slim.swf"); /* freeswitch settings defaults */ if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) { @@ -1827,7 +2071,13 @@ function freeswitch_php_install_command() } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'] = "7575"; - } + } + if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder']) == 0) { + $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder'] = "i386"; + } + if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume']) == 0) { + $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume'] = "0.3"; + } $numbering_plan = $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']; $event_socket_password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; @@ -1837,13 +2087,13 @@ function freeswitch_php_install_command() $xml_rpc_auth_user = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']; $xml_rpc_auth_pass = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']; $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']; - + //write the recording.js script recording_js(); - + //add recording.js to the dialplan $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; + $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; //delete dialplan recording from the previous install if (count($a_dialplan_includes) > 0) { @@ -1851,12 +2101,12 @@ function freeswitch_php_install_command() foreach ($a_dialplan_includes as $ent) { if ($ent['extensionname'] == "Recordings") { unset($a_dialplan_includes[$i]); - } - $i++; + } + $i++; } } - //delete the recording dialplan details + //delete the recording dialplan details if (count($a_dialplan_include_details) > 0) { $i = 0; foreach ($a_dialplan_include_details as $ent) { @@ -1865,40 +2115,84 @@ function freeswitch_php_install_command() } if ($ent['fielddata'] == "recordings.js") { unset($a_dialplan_include_details[$i]); - } - $i++; + } + $i++; } } - - $dialplanincludeid = guid(); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = 'Recordings'; - $ent['order'] = '9000'; - $ent['context'] = 'default'; - $ent['enabled'] = 'true'; - $ent['descr'] = 'Default system recordings tool'; - $a_dialplan_includes[] = $ent; - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^732673$'; - $a_dialplan_include_details[] = $ent; - unset($ent); + + //add recording to the dialplan + $dialplanincludeid = guid(); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['extensionname'] = 'Recordings'; + $ent['order'] = '9000'; + $ent['context'] = 'default'; + $ent['enabled'] = 'true'; + $ent['descr'] = '*732673 Default system recordings tool'; + $a_dialplan_includes[] = $ent; + unset($ent); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['tag'] = 'condition'; //condition, action, antiaction + $ent['fieldtype'] = 'destination_number'; + $ent['fielddata'] = '^\*(732673)$'; + $a_dialplan_include_details[] = $ent; + unset($ent); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['tag'] = 'action'; //condition, action, antiaction + $ent['fieldtype'] = 'javascript'; + $ent['fielddata'] = 'recordings.js'; + $a_dialplan_include_details[] = $ent; + unset($ent); + + + //delete dialplan DISA from the previous install + $disa_enabled = 'false'; + if (count($a_dialplan_includes) > 0) { + $i = 0; + foreach ($a_dialplan_includes as $ent) { + if ($ent['extensionname'] == "DISA") { + $disa_enabled = $ent['enabled']; + unset($a_dialplan_includes[$i]); + } + $i++; + } + } - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'javascript'; - $ent['fielddata'] = 'recordings.js'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - write_config(); + //add the DISA to the dialplan + $dialplanincludeid = guid(); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['extensionname'] = 'DISA'; + $ent['order'] = '000'; + $ent['context'] = 'default'; + $ent['enabled'] = $disa_enabled; + $ent['descr'] = '*3472 Direct Inward System Access'; + $a_dialplan_includes[] = $ent; + unset($ent); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['tag'] = 'condition'; //condition, action, antiaction, set + $ent['fieldtype'] = 'destination_number'; + $ent['fielddata'] = '^\*(3472)$'; + $a_dialplan_include_details[] = $ent; + unset($ent); + + $ent = array(); + $ent['dialplanincludeid'] = $dialplanincludeid; + $ent['tag'] = 'action'; //condition, action, antiaction, set + $ent['fieldtype'] = 'javascript'; + $ent['fielddata'] = 'disa.js'; + $a_dialplan_include_details[] = $ent; + unset($ent); + + write_config(); //prepare switch.conf.xml for voicemail to email $filename = "/usr/local/freeswitch/conf/autoload_configs/switch.conf.xml"; @@ -1908,7 +2202,7 @@ function freeswitch_php_install_command() $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/freeswitch/freeswitch_mailto.php\"/>", $contents); + $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"/usr/local/www/packages/freeswitch/freeswitch_mailto.php\"/>", $contents); fwrite($handle, $contents); unset($contents); fclose($handle); @@ -1940,9 +2234,9 @@ function freeswitch_php_install_command() fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); - - /* freeswitch modules defaults */ - + + /* freeswitch modules defaults */ + if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_console']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_console'] = "enable"; } @@ -1963,7 +2257,7 @@ function freeswitch_php_install_command() } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl'] = "disable"; - } + } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr'] = "disable"; } @@ -2062,7 +2356,7 @@ function freeswitch_php_install_command() } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr'] = "enable"; - } + } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc'] = "enable"; } @@ -2130,68 +2424,75 @@ function freeswitch_php_install_command() $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } - // if backup file exists restore it - $filename = 'freeswitch.bak.tgz'; - - //extract a specific directory to /usr/local/freeswitch - if (file_exists('/tmp/'.$filename)) { - //echo "The file $filename exists"; + // if backup file exists restore it + if (!is_dir('/root/backup/')) { + exec("mkdir /root/backup/"); + } + + //extract a specific directory to /usr/local/freeswitch + $filename = 'freeswitch.bak.tgz'; + if (file_exists('/root/backup/'.$filename)) { + //echo "The file $filename exists"; - //Recommended - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/db/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/log/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/recordings/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/scripts/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/storage/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/sounds/music/8000/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/conf/ssl'); - - //Optional - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/conf/'); - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/grammar/'); - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/htdocs/'); + exec("rm -R /usr/local/freeswitch/conf/sip_profiles/"); + exec("rm -R /usr/local/freeswitch/sounds/music/"); + //Recommended + system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/'); + system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/'); + 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'); + + //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/'); + unset($filename); - } - - write_rcfile(array( - "file" => "freeswitch.sh", - "start" => "/usr/local/freeswitch/bin/./freeswitch -nc", - "stop" => "/usr/local/freeswitch/bin/./freeswitch -stop" - ) - ); - + } + + exec("rm -R /freeswitch"); exec("cp /usr/local/freeswitch/conf/directory/default/brian.xml /usr/local/freeswitch/conf/directory/default/brian.xml.noload"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/brian.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/example.com.xml"); - + unlink_if_exists("/usr/local/freeswitch/conf/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" ) ); - + + lan_sip_profile(); + sync_package_freeswitch(); $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r"); pclose($handle); - - if (pkg_is_service_running('freeswitch')) { - sync_package_freeswitch_ivr(); + + if (pkg_is_service_running('freeswitch')) { + sync_package_freeswitch_ivr(); } - $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = $freeswitch_build_version." revision ".$freeswitch_build_revision."."; $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = $freeswitch_package_version; - + conf_mount_ro(); config_unlock(); - + } -function freeswitch_deinstall_command() +function freeswitch_deinstall_command() { conf_mount_rw(); @@ -2207,42 +2508,42 @@ function freeswitch_deinstall_command() unlink_if_exists("/usr/local/pkg/freeswitch_public.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_vars.xml"); - unlink_if_exists("/usr/local/www/freeswitch/class.smtp.php"); - unlink_if_exists("/usr/local/www/freeswitch/class.phpmailer.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_cmd.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_details.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_details_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_extensions.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_extensions_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_options_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_options.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_gateways.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_gateways_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_mailto.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_details.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_details_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings_play.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_time_conditions.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_time_conditions_edit.php"); - unlink_if_exists("/usr/local/www/freeswitch/freeswitch_status.php"); - unlink_if_exists("/usr/local/www/freeswitch/slim.swf"); - + unlink_if_exists("/usr/local/www/packages/freeswitch/class.smtp.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/class.phpmailer.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_cmd.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_extensions.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_extensions_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_options_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_options.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_gateways.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_gateways_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_mailto.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_details.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_details_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings_play.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_time_conditions.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_time_conditions_edit.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_status.php"); + unlink_if_exists("/usr/local/www/packages/freeswitch/slim.swf"); + exec("rm -R /usr/local/freeswitch/"); - exec("rm -R /usr/local/www/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"); conf_mount_ro(); config_unlock(); - + } ?> diff --git a/config/freeswitch/freeswitch.xml b/config/freeswitch/freeswitch.xml index 65acc4d8..a8e57203 100755..100644 --- a/config/freeswitch/freeswitch.xml +++ b/config/freeswitch/freeswitch.xml @@ -13,7 +13,7 @@ FreeSWITCH (TM) http://www.freeswitch.org/ - */ +*/ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -36,7 +36,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ +*/ /* ========================================================================== */ ]]> </copyright> @@ -44,7 +44,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>FreeSWITCH Settings</name> - <version>0.8.3.5</version> + <version>0.8.7.5</version> <title>FreeSWITCH: Settings</title> <include_file>/usr/local/pkg/freeswitch.inc</include_file> <menu> @@ -58,7 +58,7 @@ <name>freeswitch</name> <rcfile>freeswitch.sh</rcfile> <executable>freeswitch</executable> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </description> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </description> </service> <tabs> <tab> @@ -68,47 +68,35 @@ </tab> <tab> <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> + <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url> </tab> <tab> <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> + <url>/packages/freeswitch/freeswitch_extensions.php</url> </tab> <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + <text>Features</text> + <url>/packages/freeswitch/freeswitch_features.php</url> + </tab> <tab> <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> + <url>/packages/freeswitch/freeswitch_gateways.php</url> </tab> <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> + <text>Profiles</text> + <url>/packages/freeswitch/freeswitch_profiles.php</url> </tab> <tab> <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> + <url>/packages/freeswitch/freeswitch_public_includes.php</url> </tab> <tab> <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> + <url>/packages/freeswitch/freeswitch_status.php</url> </tab> <tab> <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> + <url>/packages/freeswitch/freeswitch_vars.php</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->freeswitchsettings</configpath> @@ -122,231 +110,6 @@ <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch.inc</item> </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libtinfo.so.5.6</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libncurses.so.5.6</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libogg.so.5.3</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libvorbis.so.4</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libcurl.so.5</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/mod_shout.so.1</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/mod_fax.so.1</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libspandsp.so.1</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libodbc.so.1</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libiconv.so.3</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/please_enter_your_pin_number.wav</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/begin_recording.wav</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/your_pin_number_is_incorect_goodbye.wav</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/class.smtp.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/class.phpmailer.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_cmd.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.xml</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_external.xml</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_internal.xml</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_mailto.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_modules.xml</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public.xml</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_play.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_status.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions_edit.tmp</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_vars.xml</item> - </additional_files_needed> <fields> <field> <fielddescr>Numbering Plan</fielddescr> @@ -474,6 +237,18 @@ <description>Enter the SMTP From Name.</description> <type>input</type> </field> + <field> + <fielddescr>Mod Shout Decoder</fielddescr> + <fieldname>mod_shout_decoder</fieldname> + <description>Enter the Decoder. default: i386</description> + <type>input</type> + </field> + <field> + <fielddescr>Mod Shout Volume</fielddescr> + <fieldname>mod_shout_volume</fieldname> + <description>Enter the Volume. default: 0.3</description> + <type>input</type> + </field> </fields> <custom_add_php_command> </custom_add_php_command> diff --git a/config/freeswitch/freeswitch_cmd.tmp b/config/freeswitch/freeswitch_cmd.tmp index 05ae77cf..21dba508 100755..100644 --- a/config/freeswitch/freeswitch_cmd.tmp +++ b/config/freeswitch/freeswitch_cmd.tmp @@ -4,7 +4,7 @@ freeswitch_cmd.php Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ @@ -44,6 +44,6 @@ $fp = event_socket_create($host, $port, $password); $response = event_socket_request($fp, $cmd); fclose($fp); -header("Location: /freeswitch/freeswitch_status.php?savemsg=".urlencode($response)); +header("Location: /packages/freeswitch/freeswitch_status.php?savemsg=".urlencode($response)); ?>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_dialplan.tmp b/config/freeswitch/freeswitch_dialplan.tmp new file mode 100644 index 00000000..fcfb3192 --- /dev/null +++ b/config/freeswitch/freeswitch_dialplan.tmp @@ -0,0 +1,163 @@ +<?php +/* $Id$ */ +/* + freeswitch_dialplan.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config']; + +if ($_GET['a'] == "default") { + conf_mount_rw(); + exec("cp /usr/local/freeswitch/conf.orig/dialplan/default.xml /usr/local/freeswitch/conf/dialplan/default.xml"); + $savemsg = "Default Restored"; + conf_mount_ro(); +} + +if ($_POST['a'] == "save") { + conf_mount_rw(); + $content = ereg_replace("\r","",$_POST['code']); + $fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "w"); + fwrite($fd, $content); + fclose($fd); + $savemsg = "Saved"; + conf_mount_ro(); +} + + +$fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "r"); +$content = fread($fd, filesize("/usr/local/freeswitch/conf/dialplan/default.xml")); +fclose($fd); + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<script language="Javascript"> +function sf() { document.forms[0].savetopath.focus(); } +</script> +<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script> +<script language="Javascript" type="text/javascript"> + // initialisation + editAreaLoader.init({ + id: "code" // id of the textarea to transform + ,start_highlight: false + ,allow_toggle: false + ,language: "en" + ,syntax: "html" + ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" + ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql" + ,show_line_colors: true + }); +</script> + +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Dialplan</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> + + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="freeswitch_dialplan.php" method="post" name="iform" id="iform"> +<?php + +?> + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width='90%'><p><span class="vexpl"><span class="red"><strong>Default Dialplan<br> + </strong></span> + The default dialplan is used to setup call destinations based on conditions and context. + You can use the dialplan to send calls to gateways, IVRs, external numbers, to scripts, or any destination. + </p> + </td> + <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td> + </tr> + </table> + <br /> + <br /> + + <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea> + <br /> + <br /> + + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td>/usr/local/freeswitch/conf/dialplan/default.xml</td> + <td align='right'> + <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" /> + <input type="hidden" name="a" value="save" /> + <?php + echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_dialplan.php?a=default&f=default.xml';\" />"; + ?> + </td> + </tr> + </table> + +</form> + +<br> +<br> + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_dialplan.xml b/config/freeswitch/freeswitch_dialplan.xml deleted file mode 100755 index 41ca32d4..00000000 --- a/config/freeswitch/freeswitch_dialplan.xml +++ /dev/null @@ -1,136 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - freeswitch_dialplan.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchdialplan</name> - <version>0.1</version> - <title>FreeSWITCH: Dialplan</title> - <aftersaveredirect>pkg_edit.php?xml=freeswitch_dialplan.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - <active/> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchdialplan</configpath> - <fields> - <field> - <fielddescr><b>Default Dialplan</b> <br /> <br /> The default dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, IVRs, external numbers, to scripts, or any destination. </fielddescr> - <fieldname>dialplan_default_xml</fieldname> - <description><br />Path: /usr/local/freeswitch/conf/dialplan/default.xml <br /><br /></description> - <type>textarea</type> - <encoding>base64</encoding> - <wrap>off</wrap> - <size>30</size> - <cols>70</cols> - <rows>33</rows> - </field> - </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_after_head_command> - sync_package_freeswitch_dialplan(); - </custom_php_after_head_command> - <custom_php_after_form_command> - </custom_php_after_form_command> - <custom_php_validation_command> - </custom_php_validation_command> - <custom_php_resync_config_command> - sync_package_freeswitch_dialplan(); - </custom_php_resync_config_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_dialplan_includes.tmp b/config/freeswitch/freeswitch_dialplan_includes.tmp index 4b7bacfa..55379ea5 100755..100644 --- a/config/freeswitch/freeswitch_dialplan_includes.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes.tmp @@ -1,10 +1,10 @@ <?php /* $Id$ */ /* - freeswitch_dialplan_includes.php + freeswitch_dialplan_includes.php Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ @@ -41,7 +41,7 @@ require("/usr/local/pkg/freeswitch.inc"); //default //enabled //descr - + //freeswitchdialplanincludedetails //dialplanincludeid @@ -53,7 +53,7 @@ require("/usr/local/pkg/freeswitch.inc"); //tagorder //1-20 //fieldtype - + //fielddata @@ -63,7 +63,7 @@ $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplan if ($_GET['act'] == "del") { if ($_GET['type'] == 'dialplanincludes') { - + if ($a_dialplan_includes[$_GET['id']]) { $dialplanincludeid = $a_dialplan_includes[$_GET['id']][dialplanincludeid]; @@ -71,7 +71,7 @@ if ($_GET['act'] == "del") { $extensionname = $a_dialplan_includes[$_GET['id']][extensionname]; $order = $a_dialplan_includes[$_GET['id']][order]; $dialplanincludefilename = $order."_".$extensionname.".xml"; - + //delete the dialplan include details. aka. child data if (count($a_dialplan_includes_details) > 0) { $i=0; @@ -80,16 +80,16 @@ if ($_GET['act'] == "del") { //echo "child id: ".$i."<br />\n"; unset($a_dialplan_includes_details[$i]); } - $i++; + $i++; } } - + //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); } - - unset($dialplanincludefilename); + + unset($dialplanincludefilename); unset($a_dialplan_includes[$_GET['id']]); write_config(); sync_package_freeswitch_dialplan_includes(); @@ -111,21 +111,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -136,7 +123,7 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_dialplan_includes.php" method="post" name="iform" id="iform"> -<?php +<?php //echo "<pre>"; @@ -146,28 +133,28 @@ include("head.inc"); //if ($config_change == 1) { // write_config(); -// $config_change = 0; +// $config_change = 0; //} -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("This has been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> <br /> <br /> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><span class="vexpl"><span class="red"><strong>Dialplan </strong></span></span> </td> <td align='right'> - <input type='button' value='default.xml' onclick="document.location.href='/pkg_edit.php?xml=freeswitch_dialplan.xml&id=0';"> - </td> + <input type='button' value='default.xml' onclick="document.location.href='/packages/freeswitch/freeswitch_dialplan.php';"> + </td> </tr> <tr> <td colspan='2'> @@ -175,14 +162,14 @@ include("head.inc"); The dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, IVRs, external numbers, to scripts, or any destination. </span> </td> - + </tr> </table> <br /> <br /> - <br /> - + <br /> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Extension Name</td> @@ -199,35 +186,55 @@ include("head.inc"); </td> </tr> - <?php - $i = 0; - if (count($a_dialplan_includes) > 0) { - foreach ($a_dialplan_includes as $ent) { + <?php + //create a temporary id for the array + $i = 0; + if (count($a_dialplan_includes) > 0) { + foreach ($a_dialplan_includes as $ent) { + $a_dialplan_includes[$i]['id'] = $i; + $i++; + } + } + + //order the array + function cmp_number($a, $b) { + if ($a["order"] > $b["order"]) { + return 1; + } + else { + return 0; + } + } + if (count($a_public_includes) > 0) { usort($a_dialplan_includes, "cmp_number"); } + + $i = 0; + if (count($a_dialplan_includes) > 0) { + foreach ($a_dialplan_includes as $ent) { ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>'"> - <?=$ent['extensionname']?> - </td> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>'"> - <?=$ent['order']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>';"> - <?=$ent['enabled'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_dialplan_includes.php?type=dialplanincludes&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - <?php - $i++; + <tr> + <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>'"> + <?=$ent['extensionname']?> + </td> + <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>'"> + <?=$ent['order']?> + </td> + <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>';"> + <?=$ent['enabled'];?> + </td> + <td class="listbg" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>';"> + <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_dialplan_includes.php?type=dialplanincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + $i++; } } ?> @@ -248,7 +255,7 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> /usr/local/freeswitch/conf/dialplan/default/ @@ -268,4 +275,4 @@ include("head.inc"); <?php include("fend.inc"); ?> </body> -</html> +</html>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_dialplan_includes_details.tmp b/config/freeswitch/freeswitch_dialplan_includes_details.tmp index 7b14dae4..1504d590 100755 --- a/config/freeswitch/freeswitch_dialplan_includes_details.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_details.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_dialplan_includes_details.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp index 391d46d7..bd719273 100755..100644 --- a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp @@ -1,24 +1,24 @@ -<?php +<?php /* $Id$ */ /* freeswitch_dialplan_includes_details_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -62,9 +62,9 @@ if (isset($_POST['dialplanincludeid'])) { //tagorder //1-20 //fieldtype - + //fielddata - + if (isset($id) && $a_dialplan_includes_details[$id]) { $pconfig['dialplanincludeid'] = $a_dialplan_includes_details[$id]['dialplanincludeid']; @@ -89,7 +89,7 @@ if ($_POST) { if (!$input_errors) { - + $ent = array(); $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; $ent['tag'] = $_POST['tag']; @@ -103,7 +103,7 @@ if ($_POST) { $a_dialplan_includes_details[$id] = $ent; } else { - //add + //add $a_dialplan_includes_details[] = $ent; } @@ -129,29 +129,16 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); - + +display_top_tabs(build_menu()); + ?> </td></tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - + <form action="freeswitch_dialplan_includes_details_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> @@ -179,9 +166,9 @@ include("head.inc"); if (tag == "") { document.getElementById("label_fieldtype").innerHTML = "Type"; document.getElementById("label_fielddata").innerHTML = "Data"; - } + } } - </script> + </script> <?php echo " <select name='tag' class='formfld' id='form_tag' onchange='dialplan_include_details_tag_onchange();'>\n"; echo " <option></option>\n"; @@ -209,7 +196,7 @@ include("head.inc"); echo " <option>action</option>\n"; echo " <option>anti-action</option>\n"; //echo " <option selected='yes'>param</option>\n"; - break; + break; default: echo " <option>condition</option>\n"; echo " <option>action</option>\n"; @@ -217,31 +204,31 @@ include("head.inc"); //echo " <option>param</option>\n"; } echo " </select>\n"; - + //condition //field expression //action - //application + //application //data //antiaction - //application + //application //data //param //name //value - + ?> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td> - <td width="78%" class="vtable"> - <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>"> + <td width="78%" class="vtable"> + <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>"> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>"> <br> <span class="vexpl"></span></td> </tr> @@ -249,16 +236,16 @@ include("head.inc"); <td width="22%" valign="top"> </td> <td width="78%"> <input name="dialplanincludeid" type="hidden" value="<?=$dialplanincludeid;?>"> - <input name="parentid" type="hidden" value="<?=$parentid;?>"> + <input name="parentid" type="hidden" value="<?=$parentid;?>"> <?php if (isset($id) && $a_dialplan_includes_details[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> + <input name="id" type="hidden" value="<?=$id;?>"> <?php endif; ?> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> </td> </tr> </table> </form> - + <br /> <br /> <b>Additional Information</b> @@ -270,7 +257,7 @@ include("head.inc"); <br /> <br /> <br /> - + <b>Conditions</b> <br /> <br /> @@ -287,49 +274,49 @@ include("head.inc"); <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li> <li><b>source</b> Name of the FreeSwitch module that received the call (e.g. PortAudio)</li> <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li> - <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li> + <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li> </ul> In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args} <br /> <br /> - Variables may be used in either the field or the expression, as follows + Variables may be used in either the field or the expression, as follows <br /> <br /> <br /> <br /> - + <b>Action and Anti-Actions</b> <br /> <br /> Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>. Additional information on applications for Actions and Anti-Actions.<br /> - <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a> + <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a> <br /> <a href='http://wiki.freeswitch.org/wiki/Dialplan_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_Functions</a> <br /> <br /> <br /> - The following is a partial list of <b>applications</b>. + The following is a partial list of <b>applications</b>. <ul> <li><b>answer</b> answer the call</li> <li><b>bridge</b> bridge the call<li> <li><b>cond</b></li> - <li><b>db</b> is a a runtime database either sqlite by default or odbc</li> + <li><b>db</b> is a a runtime database either sqlite by default or odbc</li> <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li> <li><b>group</b> allows grouping of several extensions for things like ring groups</li> <li><b>expr</b></li> - <li><b>hangup</b> hangs up the call</li> + <li><b>hangup</b> hangs up the call</li> <li><b>info</b> sends call info to the console</li> <li><b>javascript</b> run javascript .js files</li> <li><b>playback</b></li> <li><b>reject</b> reject the call</li> - <li><b>respond</b></li> - <li><b>ring_ready</b></li> + <li><b>respond</b></li> + <li><b>ring_ready</b></li> <li><b>set</b> set a variable</li> <li><b>set_user</b></li> <li><b>sleep</b></li> - <li><b>sofia_contact</b></li> + <li><b>sofia_contact</b></li> <li><b>transfer</b> transfer the call to another extension or number<li> <li><b>voicemail</b> send the call to voicemail</li> </ul> @@ -342,13 +329,13 @@ include("head.inc"); <b>Param</b> Example parameters by name and value <br /> - <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a> + <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a> <ul> - <li><b>codec-ms</b> 20</li> + <li><b>codec-ms</b> 20</li> <li><b>codec-prefs</b> PCMU@20i</li> <li><b>debug</b> 1</li> <li><b>dialplan</b> XML</li> - <li><b>dtmf-duration</b> 100</li> + <li><b>dtmf-duration</b> 100</li> <li><b>rfc2833-pt</b>" 101</li> <li><b>sip-port</b> 5060</li> <li><b>use-rtp-timer</b> true</li> @@ -357,13 +344,13 @@ include("head.inc"); <br /> --> - + <br /> <br /> <br /> <br /> <br /> - + </td> </tr> </table> diff --git a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp index e838a277..1901608f 100755..100644 --- a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_dialplan_includes_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -42,7 +41,7 @@ require("/usr/local/pkg/freeswitch.inc"); //default //enabled //descr - + // @@ -88,11 +87,11 @@ if ($_POST) { if (!$input_errors) { - + $ent = array(); if (strlen($_POST['dialplanincludeid']) > 0) { //update - $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; + $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; } else { //add @@ -107,48 +106,48 @@ if ($_POST) { $ent['opt1name'] = $_POST['opt1name']; $ent['opt1value'] = $_POST['opt1value']; - + if (isset($id) && $a_dialplan_includes[$id]) { - + if (count($a_dialplan_includes)>0) { foreach($a_dialplan_includes as $rowhelper) { - + //$rowhelper['dialplanincludeid']; //$rowhelper['extensionname']; //$rowhelper['context']; //$rowhelper['enabled']; - + $filenamechanged = false; if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) { - + if ($rowhelper['extensionname'] != $_POST['extensionname']) { //if the extension name has changed then remove the current dialplan xml file //to prepare for the new file - $filenamechanged = true; + $filenamechanged = true; } if ($rowhelper['order'] != $_POST['order']) { //if the order has changed then remove the current dialplan xml file //to prepare for the new file - $filenamechanged = true; - } + $filenamechanged = true; + } if ($_POST['enabled'] == "false") { //if the extension name is disabled then remove the dialplan xml file $filenamechanged = true; } - if ($filenamechanged){ + 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); } unset($dialplanincludefilename); } - + } - unset($filenamechanged); - + unset($filenamechanged); + } //end foreach } //end count - + //update the config $a_dialplan_includes[$id] = $ent; } @@ -181,21 +180,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -203,8 +189,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Dialplan:<br> </strong></span> @@ -218,27 +204,27 @@ include("head.inc"); <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Extension Name</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>"> <br /> - Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'. + Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'. </td> </tr> <!-- <tr> <td width="22%" valign="top" class="vncellreq">Context</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>"> <br /> e.g. default </td> </tr> --> - + <tr> <td width="22%" valign="top" class="vncellreq">Enabled</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='enabled' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['enabled'])) { @@ -256,30 +242,30 @@ include("head.inc"); echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> </td> </tr> - + <tr> <td width="22%" valign="top" class="vncellreq">Order</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <?php - + echo " <select name='order' class='formfld'>\n"; - echo " <option></option>\n"; + //echo " <option></option>\n"; if (strlen(htmlspecialchars($pconfig['order']))> 0) { - echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n"; + echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n"; } $i=0; while($i<=999) { - if (strlen($i) == 1) { + if (strlen($i) == 1) { echo " <option value='00$i'>00$i</option>\n"; } if (strlen($i) == 2) { echo " <option value='0$i'>0$i</option>\n"; } if (strlen($i) == 3) { - echo " <option value='$i'>$i</option>\n"; + echo " <option value='$i'>$i</option>\n"; } $i++; @@ -287,24 +273,24 @@ include("head.inc"); echo " </select>\n"; ?> <br /> - Processing of each dialplan include is determined by this order. + Processing of each dialplan include is determined by this order. </td> </tr> - + <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> - </tr> + </tr> <tr> <td width="22%" valign="top"> </td> <td width="78%"> <input name="dialplanincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['dialplanincludeid']);?>"> - <?php + <?php if (strlen($id) > 0 && $a_dialplan_includes[$id]) { - echo "\n"; + echo "\n"; echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n"; echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n"; echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n"; @@ -315,36 +301,36 @@ include("head.inc"); </tr> </table> </form> - + <br> <br> <form action="freeswitch_dialplan_includes_edit.php" method="post" name="iform2" id="iform2"> - <?php - + <?php + //echo "<pre>"; //print_r ($a_dialplan_includes); //echo "</pre>"; - - //if ($savemsg) print_info_box($savemsg); + + //if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; - //endif; - + //endif; + ?> - - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br /> </strong></span> - The following conditions, actions and anti-actions are used in the dialplan to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension. + The following conditions, actions and anti-actions are used in the dialplan to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension. </span></p></td> </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Tag</td> @@ -358,13 +344,13 @@ include("head.inc"); </tr> </table> </td> - </tr> - - <?php - + </tr> + + <?php + $i = 0; if (count($a_dialplan_include_details) > 0) { - + foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) { ?> @@ -377,7 +363,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -387,15 +373,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_dialplan_include_details) > 0) { - + foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "action" && $dialplanincludeid == $ent['dialplanincludeid']) { ?> @@ -408,7 +394,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -418,15 +404,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_dialplan_include_details) > 0) { - + foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "anti-action" && $dialplanincludeid == $ent['dialplanincludeid']) { ?> @@ -439,7 +425,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -449,15 +435,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_dialplan_include_details) > 0) { - + foreach ($a_dialplan_include_details as $ent) { if ($ent['tag'] == "param" && $dialplanincludeid == $ent['dialplanincludeid']) { ?> @@ -470,7 +456,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -480,11 +466,11 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } - } + } ?> <tr> <td class="list" colspan="3"></td> @@ -504,14 +490,14 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> - - + + + <br> <br> - <br> </td> </tr> diff --git a/config/freeswitch/freeswitch_extensions.tmp b/config/freeswitch/freeswitch_extensions.tmp index ca6f3d73..8ef415fd 100755..100644 --- a/config/freeswitch/freeswitch_extensions.tmp +++ b/config/freeswitch/freeswitch_extensions.tmp @@ -4,7 +4,7 @@ freeswitch_extensions.php Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ @@ -38,7 +38,8 @@ $a_extensions = &$config['installedpackages']['freeswitchextensions']['confi if ($_GET['act'] == "del") { if ($_GET['type'] == 'extensions') { - if ($a_extensions[$_GET['id']]) { + if ($a_extensions[$_GET['id']]) { + unlink("/usr/local/freeswitch/conf/directory/default/".$_GET['extension'].".xml"); unset($a_extensions[$_GET['id']]); write_config(); header("Location: freeswitch_extensions.php"); @@ -60,21 +61,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), true, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -85,21 +73,21 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_extensions.php" method="post" name="iform" id="iform"> -<?php +<?php if ($config_change == 1) { write_config(); - $config_change = 0; + $config_change = 0; } -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH extensions have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Extensions<br> </strong></span> @@ -128,46 +116,66 @@ if ($config_change == 1) { </tr> - <?php - + <?php + + //create a temporary id for the array + $i = 0; + if (count($a_extensions) > 0) { + foreach ($a_extensions as $ent) { + $a_extensions[$i]['id'] = $i; + $i++; + } + } + + //order the array + function cmp_number($a, $b) { + if ($a["extension"] > $b["extension"]) { + return 1; + } + else { + return 0; + } + } + if (count($a_extensions) > 0) { usort($a_extensions, "cmp_number"); } + $i = 0; if (count($a_extensions) > 0) { foreach ($a_extensions as $ent) { - + ?> <tr> - <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$i;?>';"> + <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['extension'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$i;?>';"> + </td> + <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['vm-mailto'];?> </td> - <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$i;?>';"> + <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['callgroup'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$i;?>';"> + </td> + <td class="listbg" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?> </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td valign="middle"><a href="freeswitch_extensions_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_extensions.php?type=extensions&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="freeswitch_extensions_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_extensions.php?type=extensions&act=del&id=<?=$ent['id'];?>&extension=<?=$ent['extension'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> </table> </td> </tr> - <?php + <?php - $i++; + $i++; } } ?> <tr> <td class="list" colspan="4"></td> - <td class="list"> + <td class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> <td width="17"></td> @@ -183,7 +191,7 @@ if ($config_change == 1) { <td class="list"></td> </tr> </table> - + </form> @@ -206,4 +214,4 @@ if ($config_change == 1) { <?php include("fend.inc"); ?> </body> -</html> +</html>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_extensions.xml b/config/freeswitch/freeswitch_extensions.xml deleted file mode 100755 index 1e3c13a4..00000000 --- a/config/freeswitch/freeswitch_extensions.xml +++ /dev/null @@ -1,225 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - - freeswitch_extensions.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchextensions</name> - <version>0.1</version> - <title>FreeSWITCH: Extensions</title> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - <active/> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->extensions</configpath> - <adddeleteeditpagefields> - <columnitem> - <fielddescr>Extension</fielddescr> - <fieldname>extension</fieldname> - </columnitem> - <columnitem> - <fielddescr>Mailbox</fielddescr> - <fieldname>mailbox</fieldname> - </columnitem> - <columnitem> - <fielddescr>Description</fielddescr> - <fieldname>description</fieldname> - </columnitem> - </adddeleteeditpagefields> - <fields> - <field> - <fielddescr>Extension</fielddescr> - <fieldname>extension</fieldname> - <description>Enter the extension here. The default configuration expects extension numbers between 1001 -1019. To use additional numbers for the extensions by adjusting the dialplan. In the in the dialplan under name="Local_Extension" adjust the regular expression="^(10[01][0-9])$".</description> - <type>input</type> - </field> - <field> - <fielddescr>Password</fielddescr> - <fieldname>password</fieldname> - <description>Enter the password here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Mailbox</fielddescr> - <fieldname>mailbox</fieldname> - <description>Enter the mailbox here. Example: extension 1001 then mailbox 1001</description> - <type>input</type> - </field> - <field> - <fielddescr>Voicemail Password</fielddescr> - <fieldname>vm-password</fieldname> - <description>Enter the voicemail password here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Account Code</fielddescr> - <fieldname>accountcode</fieldname> - <description>Enter the account code here. Example: extension 1001 then accountcode 1001</description> - <type>input</type> - </field> - <field> - <fielddescr>Effective Caller ID Name</fielddescr> - <fieldname>effective_caller_id_name</fieldname> - <description>Enter the effective caller id name here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Effective Caller ID Number</fielddescr> - <fieldname>effective_caller_id_number</fieldname> - <description>Enter the effective caller id number here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Outbound Caller ID Name</fielddescr> - <fieldname>outbound_caller_id_name</fieldname> - <description>Enter the outbound caller id name here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Outbound Caller ID Number</fielddescr> - <fieldname>outbound_caller_id_number</fieldname> - <description>Enter the outbound caller id number here.</description> - <type>input</type> - </field> - <field> - <fielddescr>Voicemail Mail To</fielddescr> - <fieldname>vm-mailto</fieldname> - <description>Optional: Enter the email address to send voicemail to.</description> - <type>input</type> - </field> - <field> - <fielddescr>Voicemail Attach File</fielddescr> - <fieldname>vm-attach-file</fieldname> - <description>Choose whether to attach the file to the email.</description> - <type>select</type> - <options> - <option> - <name>true</name> - <value>true</value> - </option> - <option> - <name>false</name> - <value>false</value> - </option> - </options> - </field> - - <field> - <fielddescr>User Context</fielddescr> - <fieldname>user_context</fieldname> - <description>Enter the user context here. Example: default</description> - <type>input</type> - </field> - <field> - <fielddescr>Extension Description</fielddescr> - <fieldname>description</fieldname> - <description>Enter the description of the extension here.</description> - <type>input</type> - </field> - </fields> - <custom_add_php_command> - </custom_add_php_command> - <custom_php_resync_config_command> - sync_package_freeswitch_extensions(); - </custom_php_resync_config_command> - <custom_delete_php_command> - sync_package_freeswitch_extensions(); - </custom_delete_php_command> - <custom_php_deinstall_command> - </custom_php_deinstall_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_extensions_edit.tmp b/config/freeswitch/freeswitch_extensions_edit.tmp index aeaaf4bc..deb7a597 100755..100644 --- a/config/freeswitch/freeswitch_extensions_edit.tmp +++ b/config/freeswitch/freeswitch_extensions_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_extensions_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -96,7 +95,7 @@ if ($_POST) { $a_extensions[$id] = $ent; } else { - //add + //add $a_extensions[] = $ent; } @@ -132,21 +131,8 @@ function show_advanced_config() { <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), true, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -156,64 +142,64 @@ function show_advanced_config() { <td class="tabcont" > - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Extension Setup<br> </strong></span> - /usr/local/freeswitch/conf/directory/default/ + /usr/local/freeswitch/conf/directory/default/ </p></td> </tr> </table> <br /> - + <form action="freeswitch_extensions_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="25%" valign="top" class="vncellreq">Extension</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="extension" type="text" class="formfld unknown" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>"> <br><span class="vexpl">Enter the extension here. The default configuration expects extension numbers between 1000 -1019. To use 3 digit extensions adjust the dialplan 'default.xml' under name="Local_Extension" change the regular expression="^(10[01][0-9])$" to expression="^(\d{3})$".<br></span> </td> - </tr> + </tr> <tr> <td width="25%" valign="top" class="vncellreq">Password</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="password" type="password" class="formfld pwd" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>"> <br><span class="vexpl">Enter the password here.<br></span> </td> - </tr> + </tr> <tr> <td width="25%" valign="top" class="vncellreq">Mailbox</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="mailbox" type="text" class="formfld unknown" id="mailbox" size="40" value="<?=htmlspecialchars($pconfig['mailbox']);?>"> <br><span class="vexpl">Enter the mailbox here. Example: extension 1001 then mailbox 1001<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Voicemail Password</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="vm-password" type="password" class="formfld pwd" id="vm-password" size="40" value="<?=htmlspecialchars($pconfig['vm-password']);?>"> <br><span class="vexpl">Enter the voicemail password here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Account Code</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="accountcode" type="text" class="formfld unknown" id="accountcode" size="40" value="<?=htmlspecialchars($pconfig['accountcode']);?>"> <br><span class="vexpl">Enter the account code here. Example: extension 1001 then accountcode 1001<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Name</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="effective_caller_id_name" type="text" class="formfld unknown" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>"> <br><span class="vexpl">Enter the effective caller id name here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Number</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="effective_caller_id_number" type="text" class="formfld unknown" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>"> <br><span class="vexpl">Enter the effective caller id number here.<br></span> </td> @@ -221,14 +207,14 @@ function show_advanced_config() { <!-- <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Name</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="outbound_caller_id_name" type="text" class="formfld unknown" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>"> <br><span class="vexpl">Enter the outbound caller id name here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Number</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="outbound_caller_id_number" type="text" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>"> <br><span class="vexpl">Enter the outbound caller id number here.<br></span> </td> @@ -236,15 +222,15 @@ function show_advanced_config() { --> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="vm-mailto" type="text" class="formfld unknown" id="vm-mailto" size="40" value="<?=htmlspecialchars($pconfig['vm-mailto']);?>"> <br><span class="vexpl">Optional: Enter the email address to send voicemail to.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Attach File</td> - <td width="75%" class="vtable"> - <?php + <td width="75%" class="vtable"> + <?php echo " <select name='vm-attach-file' class='formfld unknown'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['vm-attach-file'])) { @@ -262,31 +248,31 @@ function show_advanced_config() { echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> Choose whether to attach the file to the email. </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">User Context</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="user_context" type="text" class="formfld unknown" id="user_context" size="40" value="<?=htmlspecialchars($pconfig['user_context']);?>"> <br><span class="vexpl">Enter the user context here. Example: default<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Call Group</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="callgroup" type="text" class="formfld unknown" id="callgroup" size="40" value="<?=htmlspecialchars($pconfig['callgroup']);?>"> <br><span class="vexpl">Enter the user call group here. Example: sales, support<br></span> </td> - </tr> + </tr> </table> - + <div id="showadvancedbox"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="25%" valign="top" class="vncell">Show Advanced</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a> </td> </tr> @@ -296,25 +282,25 @@ function show_advanced_config() { <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="25%" valign="top" class="vncell">Auth-ACL</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="auth-acl" type="text" class="formfld unknown" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>"> <br> <span class="vexpl">Enter the auth acl here.<br></span> </td> </tr> <tr> <td valign="top" class="vncell">CIDR</td> - <td class="vtable"> + <td class="vtable"> <input name="cidr" type="text" class="formfld unknown" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>"> <br> <span class="vexpl">Enter the cidr here.<br></span> </td> - </tr> - </table> + </tr> + </table> </div> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="25%" valign="top" class="vncellreq">Extension Description</td> - <td width="75%" class="vtable"> + <td width="75%" class="vtable"> <input name="description" type="text" class="formfld unknown" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> <br><span class="vexpl">Enter the description of the extension here.<br></span> </td> diff --git a/config/freeswitch/freeswitch_external.xml b/config/freeswitch/freeswitch_external.xml deleted file mode 100755 index 7dd2d65b..00000000 --- a/config/freeswitch/freeswitch_external.xml +++ /dev/null @@ -1,136 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - - freeswitch_external.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchexternal</name> - <version>0.1</version> - <title>FreeSWITCH: External</title> - <aftersaveredirect>pkg_edit.php?xml=freeswitch_external.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - <active/> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchexternal</configpath> - <fields> - <field> - <fielddescr><b>External</b> <br /> <br />SIP external profile for outbound registrations.</fielddescr> - <fieldname>external_xml</fieldname> - <description><br />Path: /usr/local/freeswitch/conf/sip_profiles/external.xml <br /><br /></description> - <type>textarea</type> - <encoding>base64</encoding> - <wrap>off</wrap> - <size>30</size> - <cols>70</cols> - <rows>33</rows> - </field> - </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_after_head_command> - sync_package_freeswitch_external(); - </custom_php_after_head_command> - <custom_php_after_form_command> - </custom_php_after_form_command> - <custom_php_validation_command> - </custom_php_validation_command> - <custom_php_resync_config_command> - sync_package_freeswitch_external(); - </custom_php_resync_config_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_features.tmp b/config/freeswitch/freeswitch_features.tmp new file mode 100644 index 00000000..c55e4aa4 --- /dev/null +++ b/config/freeswitch/freeswitch_features.tmp @@ -0,0 +1,187 @@ +<?php +/* $Id$ */ +/* + freeswitch_extensions.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +$a_extensions = &$config['installedpackages']['freeswitchextensions']['config']; + + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'extensions') { + if ($a_extensions[$_GET['id']]) { + unset($a_extensions[$_GET['id']]); + write_config(); + header("Location: freeswitch_extensions.php"); + exit; + } + } +} + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Extensions</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + <!-- + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Features<br> + </strong></span> + List of a few of the features. + </p></td> + </tr> + </table> + <br />--> + + <br /> + <br /> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="listtopic" colspan='2'>Auto Attendant</td> + </tr> + <tr> + <td width='10%' class="vncell"><a href='freeswitch_ivr.php'>Open</a></td> + <td class="vtable"> + An interactive voice response (IVR) often refered to as an Auto Attendant. + It associates a recording to multiple options that can be used to direct + calls to extensions, voicemail, queues, other IVR applications, and external + phone numbers. + </td> + </tr> + </table> + + <br /> + <br /> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="listtopic" colspan='2'>Direct Inward System Access</td> + </tr> + <tr> + <td width='10%' class="vncell"></td> + <td class="vtable"> + Direct Inward System Access (DISA) allows inbound callers to make internal or external calls. For security reasons it is disabled by default. + To enable it first set a secure pin number from the Settings->Admin PIN Number. + Then go to Dialplan tab and find the DISA entry and edit it to set 'Enabled' to 'true'. + To use DISA dial *3427 (disa) enter the admin pin code and the extension or phone number you wish to call. + </td> + </tr> + </table> + + <br /> + <br /> + + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="listtopic" colspan='2'>Modules</td> + </tr> + <tr> + <td width='10%' class="vncell"><a href='/pkg_edit.php?xml=freeswitch_modules.xml&id=0'>Open</a></td> + <td class="vtable"> + Modules add additional features and can be enabled or disabled to provide the desired features. + </td> + </tr> + </table> + + <br /> + <br /> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="listtopic" colspan='2'>Music on Hold</td> + </tr> + <tr> + <td width='10%' class="vncell"><a href='freeswitch_recordings.php'>Open</a></td> + <td class="vtable"> + Music on hold can be in WAV or MP3 format. To play an MP3 files you must have mod_shout enabled on the 'Modules' tab. + For best performance upload 16bit 8khz/16khz Mono WAV files. + </td> + </tr> + </table> + + <br /> + <br /> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td class="listtopic" colspan='2'>Recordings</td> + </tr> + <tr> + <td width='10%' class="vncell"><a href='freeswitch_recordings.php'>Open</a></td> + <td class="vtable"> + To make a recording dial *732673 (record) or you can make a 16bit 8khz/16khz + Mono WAV file then copy it to the following directory then refresh the page to play + it back. Click on the 'Filename' to download it or the 'Recording Name' to play the audio. + </td> + </tr> + </table> + +<br /> +<br /> +<br /> +<br /> +<br /> +<br /> +<br /> +<br /> + +</td> +</tr> +</table> + +</div> + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_gateways.tmp b/config/freeswitch/freeswitch_gateways.tmp index 75718a7c..279be301 100755..100644 --- a/config/freeswitch/freeswitch_gateways.tmp +++ b/config/freeswitch/freeswitch_gateways.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_gateways.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -38,7 +38,8 @@ $a_gateways = &$config['installedpackages']['freeswitchgateways']['config']; if ($_GET['act'] == "del") { if ($_GET['type'] == 'gateways') { - if ($a_gateways[$_GET['id']]) { + if ($a_gateways[$_GET['id']]) { + unlink("/usr/local/freeswitch/conf/sip_profiles/external/".$_GET['gateway'].".xml"); unset($a_gateways[$_GET['id']]); write_config(); header("Location: freeswitch_gateways.php"); @@ -60,21 +61,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), true, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -85,21 +73,21 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_gateways.php" method="post" name="iform" id="iform"> -<?php +<?php if ($config_change == 1) { write_config(); - $config_change = 0; + $config_change = 0; } -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH gateways have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Gateways<br> </strong></span> @@ -108,7 +96,7 @@ if ($config_change == 1) { </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Gateway</td> @@ -128,46 +116,60 @@ if ($config_change == 1) { </tr> - <?php - + <?php + //create a temporary id for the array + $i = 0; + if (count($a_gateways) > 0) { + foreach ($a_gateways as $ent) { + $a_gateways[$i]['id'] = $i; + $i++; + } + } + + //order the array + function cmp_string($a, $b) { + return strcmp($a["gateway"], $b["gateway"]); + } + if (count($a_gateways) > 0) { usort($a_gateways, "cmp_string"); } + $i = 0; if (count($a_gateways) > 0) { foreach ($a_gateways as $ent) { - + ?> <tr> - <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';"> + <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['gateway'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';"> + </td> + <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['context'];?> </td> - <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';"> + <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['enabled'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';"> + </td> + <td class="listbg" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?> </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td valign="middle"><a href="freeswitch_gateways_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_gateways.php?type=gateways&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="freeswitch_gateways_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_gateways.php?type=gateways&act=del&id=<?=$ent['id'];?>&gateway=<?=$ent['gateway'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> </table> </td> </tr> - <?php + <?php - $i++; + $i++; } } ?> <tr> <td class="list" colspan="4"></td> - <td class="list"> + <td class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> <td width="17"></td> @@ -183,7 +185,7 @@ if ($config_change == 1) { <td class="list"></td> </tr> </table> - + </form> @@ -206,4 +208,4 @@ if ($config_change == 1) { <?php include("fend.inc"); ?> </body> -</html> +</html>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_gateways_edit.tmp b/config/freeswitch/freeswitch_gateways_edit.tmp index 030f88cf..ea2b7efe 100755..100644 --- a/config/freeswitch/freeswitch_gateways_edit.tmp +++ b/config/freeswitch/freeswitch_gateways_edit.tmp @@ -1,24 +1,24 @@ -<?php +<?php /* $Id$ */ /* freeswitch_gateways_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -104,7 +104,7 @@ if ($_POST) { $a_gateways[$id] = $ent; } else { - //add + //add $a_gateways[] = $ent; } @@ -115,46 +115,46 @@ if ($_POST) { $gatewayid = $_POST['gatewayid']; $gateway = $_POST['gateway']; $context = $_POST['context']; - + $default_area_code = &$config['installedpackages']['freeswitchsettings']['config'][0]['default_area_code']; $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; + $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - + $tmp_array = split("\\\n", $_POST['dialplan_expression']); foreach($tmp_array as $dialplan_expression) { - + $dialplan_expression = trim($dialplan_expression); if (strlen($dialplan_expression)>0) { - - switch ($dialplan_expression) { + + switch ($dialplan_expression) { case "^(\d{7})$": $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; $label = "7 digits"; - $abbrv = "7d"; - break; + $abbrv = "7d"; + break; case "^(\d{10})$": $action_data = "sofia/gateway/".$gateway."/1\$1"; $label = "10 digits"; - $abbrv = "10d"; + $abbrv = "10d"; break; case "^(\d{11})$": $action_data = "sofia/gateway/".$gateway."/\$1"; $label = "11 digits"; $abbrv = "11d"; break; - case "^311$": + case "^(311)$": $action_data = "sofia/gateway/".$gateway."/\$1"; $label = "311"; $abbrv = "311"; break; - case "^411$": + case "^(411)$": $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "411"; + $label = "411"; $abbrv = "411"; - break; - case "^911$": + break; + case "^(911)$": $action_data = "sofia/gateway/".$gateway."/\$1"; $label = "911"; $abbrv = "911"; @@ -162,17 +162,17 @@ if ($_POST) { case "^9(\d{3})$": $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; $label = "dial 9, 3 digits"; - $abbrv = "9.3d"; + $abbrv = "9.3d"; break; case "^9(\d{4})$": $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; $label = "dial 9, 4 digits"; - $abbrv = "9.4d"; - break; + $abbrv = "9.4d"; + break; case "^9(\d{7})$": $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; $label = "dial 9, 7 digits"; - $abbrv = "9.7d"; + $abbrv = "9.7d"; break; case "^9(\d{10})$": $action_data = "sofia/gateway/".$gateway."/\$1"; @@ -194,39 +194,39 @@ if ($_POST) { $label = $dialplan_expression; $abbrv = $dialplan_expression; } - + $dialplanincludeid = guid(); $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $gateway.".".$abbrv; - $ent['order'] = '9002'; //if update use the existing order number and extension name and desc - $ent['context'] = $context; - $ent['enabled'] = 'true'; - $ent['descr'] = $label.' '.$gateway; - $ent['opt1name'] = 'gatewayid'; - $ent['opt1value'] = $gatewayid; - $a_dialplan_includes[] = $ent; - unset($ent); + $ent['extensionname'] = $gateway.".".$abbrv; + $ent['order'] = '9002'; //if update use the existing order number and extension name and desc + $ent['context'] = $context; + $ent['enabled'] = 'true'; + $ent['descr'] = $label.' '.$gateway; + $ent['opt1name'] = 'gatewayid'; + $ent['opt1value'] = $gatewayid; + $a_dialplan_includes[] = $ent; + unset($ent); $ent = array(); $ent['dialplanincludeid'] = $dialplanincludeid; $ent['tag'] = 'condition'; //condition, action, antiaction $ent['fieldtype'] = 'destination_number'; $ent['fielddata'] = $dialplan_expression; - $a_dialplan_include_details[] = $ent; - unset($ent); + $a_dialplan_include_details[] = $ent; + unset($ent); $ent = array(); $ent['dialplanincludeid'] = $dialplanincludeid; $ent['tag'] = 'action'; //condition, action, antiaction $ent['fieldtype'] = 'bridge'; $ent['fielddata'] = $action_data; - $a_dialplan_include_details[] = $ent; - unset($ent); - - unset($label); - unset($abbrv); - unset($dialplan_expression); - unset($action_data); + $a_dialplan_include_details[] = $ent; + unset($ent); + + unset($label); + unset($abbrv); + unset($dialplan_expression); + unset($action_data); } //if strlen } //end for each } @@ -273,21 +273,8 @@ function show_advanced_config() { <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), true, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -297,7 +284,7 @@ function show_advanced_config() { <td class="tabcont" > - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Gateway Setup<br> </strong></span> @@ -307,69 +294,69 @@ function show_advanced_config() { </tr> </table> <br /> - + <form action="freeswitch_gateways_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Gateway</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>"> <br><span class="vexpl">Enter the gateway name here.<br></span> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq">Username</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="username" type="text" class="formfld" id="username" size="40" value="<?=htmlspecialchars($pconfig['username']);?>"> <br><span class="vexpl">Enter the username here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Password</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="password" type="password" class="formfld" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>"> <br><span class="vexpl">Enter the password here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">From-user</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="from-user" type="text" class="formfld" id="from-user" size="40" value="<?=htmlspecialchars($pconfig['from-user']);?>"> <br><span class="vexpl">Enter the from-user here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">From-domain</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="from-domain" type="text" class="formfld" id="from-domain" size="40" value="<?=htmlspecialchars($pconfig['from-domain']);?>"> <br><span class="vexpl">Enter the from-domain here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Proxy</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="proxy" type="text" class="formfld" id="proxy" size="40" value="<?=htmlspecialchars($pconfig['proxy']);?>"> <br><span class="vexpl">Enter the proxy here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Realm</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="realm" type="text" class="formfld" id="realm" size="40" value="<?=htmlspecialchars($pconfig['realm']);?>"> <br><span class="vexpl">Enter the realm here.<br></span> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq">Expire-seconds</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="expire-seconds" type="text" class="formfld" id="expire-seconds" size="40" value="<?=htmlspecialchars($pconfig['expire-seconds']);?>"> <br><span class="vexpl">Enter the expire-seconds here. Example: 600<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Register</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='register' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['register'])) { @@ -387,32 +374,32 @@ function show_advanced_config() { echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> Choose whether to register. </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Retry-seconds</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="retry-seconds" type="text" class="formfld" id="retry-seconds" size="40" value="<?=htmlspecialchars($pconfig['retry-seconds']);?>"> <br> <span class="vexpl">Enter the retry_seconds here. Example: 30<br></span> </td> - </tr> - + </tr> + <tr> <td width="22%" valign="top" class="vncellreq">Context</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>"> <br> <span class="vexpl">Enter the context here. Example: public<br></span> </td> - </tr> + </tr> </table> <div id="showadvancedbox"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncell">Show Advanced</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a> </td> </tr> @@ -422,40 +409,46 @@ function show_advanced_config() { <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncell">Register-transport</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='register-transport' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['register-transport'])) { case "udp": echo " <option value='udp' selected='yes'>udp</option>\n"; echo " <option value='tcp'>tcp</option>\n"; + echo " <option value='tls'>tls</option>\n"; break; case "tcp": echo " <option value='udp'>udp</option>\n"; echo " <option value='tcp' selected='yes'>tcp</option>\n"; - + echo " <option value='tls'>tls</option>\n"; + case "tls": + echo " <option value='udp'>udp</option>\n"; + echo " <option value='tcp'>tcp</option>\n"; + echo " <option value='tls' selected='yes'>tls</option>\n"; break; default: echo " <option value='udp'>udp</option>\n"; echo " <option value='tcp'>tcp</option>\n"; + echo " <option value='tls'>tls</option>\n"; } echo " </select>\n"; - ?> - Choose whether to register-transport. + ?> + Choose whether to register-transport. </td> </tr> <tr> <td width="22%" valign="top" class="vncell">Extension</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>"> <br> <span class="vexpl">Enter the extension here.<br></span> </td> </tr> <tr> <td width="22%" valign="top" class="vncell">Caller-id-in-from</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='caller-id-in-from' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['caller-id-in-from'])) { @@ -466,20 +459,20 @@ function show_advanced_config() { case "false": echo " <option value='true'>true</option>\n"; echo " <option value='false' selected='yes'>false</option>\n"; - + break; default: echo " <option value='true'>true</option>\n"; echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> </td> </tr> <tr> <td width="22%" valign="top" class="vncell">Supress-cng</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='supress-cng' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['supress-cng'])) { @@ -490,25 +483,25 @@ function show_advanced_config() { case "false": echo " <option value='true'>true</option>\n"; echo " <option value='false' selected='yes'>false</option>\n"; - + break; default: echo " <option value='true'>true</option>\n"; echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> </td> </tr> </table> - + </div> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Enabled</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='enabled' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['enabled'])) { @@ -526,10 +519,10 @@ function show_advanced_config() { echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> </td> </tr> - + <tr> <td width="22%" valign="top" class="vncell">Dialplan Expression</td> <td width="78%" class="vtable"> @@ -538,7 +531,7 @@ function show_advanced_config() { ?> <br> <select name='dialplan_expression_select' id='dialplan_expression_select' onchange="document.getElementById('dialplan_expression').value += document.getElementById('dialplan_expression_select').value + '\n';" class='formfld'> - <option></option> + <option></option> <option value='^(\d{7})$'>7 digits local</option> <option value='^(\d{10})$'>10 digits long distance</option> <option value='^(\d{11})$'>11 digits long distance</option> @@ -551,17 +544,17 @@ function show_advanced_config() { <option value='^9(\d{4})$'>Dial 9 then 4 digits</option> <option value='^9(\d{7})$'>Dial 9 then 7 digits</option> <option value='^9(\d{10})$'>Dial 9 then 10 digits</option> - <option value='^9(\d{11})$'>Dial 9 then 11 digits</option> + <option value='^9(\d{11})$'>Dial 9 then 11 digits</option> </select> <span class="vexpl"> <br /> - Shortcut to create the outbound dialplan entries for this Gateway. The entries are saved to and edited from the 'Dialplan' tab. + Shortcut to create the outbound dialplan entries for this Gateway. The entries are saved to and edited from the 'Dialplan' tab. </span></td> - </tr> - + </tr> + <tr> <td width="22%" valign="top" class="vncell">Gateway Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> <br> <span class="vexpl">Enter the description of the gateway here.</span></td> </tr> diff --git a/config/freeswitch/freeswitch_internal.xml b/config/freeswitch/freeswitch_internal.xml deleted file mode 100755 index db43b707..00000000 --- a/config/freeswitch/freeswitch_internal.xml +++ /dev/null @@ -1,136 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - - freeswitch_internal.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net> - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchinternal</name> - <version>0.1</version> - <title>FreeSWITCH: Internal</title> - <aftersaveredirect>pkg_edit.php?xml=freeswitch_internal.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - <active/> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchinternal</configpath> - <fields> - <field> - <fielddescr><b>Internal</b> <br /> <br />SIP internal profile. </fielddescr> - <fieldname>internal_xml</fieldname> - <description><br />Path: /usr/local/freeswitch/conf/sip_profiles/internal.xml <br /><br /></description> - <type>textarea</type> - <encoding>base64</encoding> - <wrap>off</wrap> - <size>30</size> - <cols>70</cols> - <rows>33</rows> - </field> - </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_after_head_command> - sync_package_freeswitch_internal(); - </custom_php_after_head_command> - <custom_php_after_form_command> - </custom_php_after_form_command> - <custom_php_validation_command> - </custom_php_validation_command> - <custom_php_resync_config_command> - sync_package_freeswitch_internal(); - </custom_php_resync_config_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_ivr.tmp b/config/freeswitch/freeswitch_ivr.tmp index d05337ce..67084f07 100755..100644 --- a/config/freeswitch/freeswitch_ivr.tmp +++ b/config/freeswitch/freeswitch_ivr.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_ivr.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -40,6 +40,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"); unset($a_ivr[$_GET['id']]); write_config(); sync_package_freeswitch_ivr(); @@ -61,21 +62,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -86,50 +74,20 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_ivr.php" method="post" name="iform" id="iform"> -<?php - - -//echo "<pre>"; -//print_r ($a_ivr); -//echo "</pre>"; - -//build a list of recordings from the config.xml -//$config_recording_list = ''; -//$i = 0; -//if (count($a_ivr) > 0) { -// foreach ($a_ivr as $ivrent) { -// $config_recording_list .= $ivrent['filename']."|"; -// $i++; -// } -//} -//echo "config recording list: ".$config_recording_list."<br />\n"; - - -//if ($config_change == 1) { -// write_config(); -// $config_change = 0; -//} -//if ($savemsg) print_info_box($savemsg); -//if (file_exists($d_hostsdirty_path)): echo"<p>"; -//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); -//echo"<br />"; -//endif; - -?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>IVR<br /> </strong></span> - An interactive voice response (IVR) often refered to as an Auto Attendant. - It associates a recording to multiple options that can be used to direct calls - to extensions, voicemail, queues, other IVR applications, and external + An interactive voice response (IVR) often refered to as an Auto Attendant. + It associates a recording to multiple options that can be used to direct calls + to extensions, voicemail, queues, other IVR applications, and external phone numbers. </span></p></td> </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Extension</td> @@ -143,20 +101,23 @@ include("head.inc"); </tr> </table> </td> - </tr> + </tr> - <?php + <?php $i = 0; - if (count($a_ivr) > 0) { + if (count($a_ivr) > 0) { foreach ($a_ivr as $ent) { if (strlen($ent['ivrid']) > 0) { + + $ivrid = str_replace(array("{", "}"), "", $ent['ivrid']); + ?> <tr> <td class="listlr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>'"> <?=$ent['ivrextension']?> </td> <td class="listr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';"> - <?=$ent['ivrname'];?> + <?=$ent['ivrname'];?> <?=$ent['ivrid'];?> </td> <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['ivrdescr']);?> @@ -165,14 +126,14 @@ include("head.inc"); <table border="0" cellspacing="0" cellpadding="1"> <tr> <td valign="middle"><a href="freeswitch_ivr_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_ivr.php?type=ivr&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_ivr.php?type=ivr&act=del&id=<?=$i;?>&ivrid=<?php echo $ivrid; ?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> </table> </td> </tr> <?php - } - $i++; + } + $i++; } } ?> @@ -193,7 +154,7 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> <br> diff --git a/config/freeswitch/freeswitch_ivr_edit.tmp b/config/freeswitch/freeswitch_ivr_edit.tmp index f9d4652d..603e4af5 100755..100644 --- a/config/freeswitch/freeswitch_ivr_edit.tmp +++ b/config/freeswitch/freeswitch_ivr_edit.tmp @@ -1,11 +1,11 @@ -<?php +<?php /* $Id$ */ /* freeswitch_ivr_edit.php Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ @@ -122,8 +122,8 @@ $parentid = $id; $ivrconditionjs .= " condition = false;\n"; $ivrconditionjs .= "}\n"; $ivrconditionjs .= "\n"; - - + + if (isset($id) && $a_ivr[$id]) { $pconfig['ivrid'] = $a_ivr[$id]['ivrid']; $ivrid = $a_ivr[$id]['ivrid']; @@ -149,7 +149,6 @@ if ($_POST) { unset($a_ivr_options[$_GET['optionid']]); write_config(); sync_package_freeswitch_ivr(); - //touch($d_hostsdirty_path); header("Location: freeswitch_ivr_edit.php?id=".$_GET['id']); exit; } @@ -171,7 +170,7 @@ if ($_POST) { $ivrent['recordingidaction'] = $_POST['recordingidaction']; $ivrent['recordingidantiaction'] = $_POST['recordingidantiaction']; $ivrent['ivrtimeout'] = $_POST['ivrtimeout']; - $ivrent['ivrcontext'] = $_POST['ivrcontext']; + $ivrent['ivrcontext'] = $_POST['ivrcontext']; $ivrent['ivrconditionjs'] = base64_encode($_POST['ivrconditionjs']); $ivrent['ivrdescr'] = $_POST['ivrdescr']; @@ -207,21 +206,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -229,8 +215,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>General Settings:<br> </strong></span> @@ -244,20 +230,20 @@ include("head.inc"); <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Extension</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ivrextension" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrextension']);?>"> <br> <span class="vexpl">e.g. <em>5002</em></span></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">IVR Name</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ivrname" type="text" class="formfld" id="ivrname" size="40" value="<?=htmlspecialchars($pconfig['ivrname']);?>"> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Recording Action</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; echo " <select name='recordingidaction' class='formfld'>\n"; echo " <option></option>\n"; @@ -272,13 +258,13 @@ include("head.inc"); } } echo " </select>\n"; - ?> + ?> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Recording Anti-Action</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php //$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; echo " <select name='recordingidantiaction' class='formfld'>\n"; echo " <option></option>\n"; @@ -293,33 +279,33 @@ include("head.inc"); } } echo " </select>\n"; - ?> + ?> </td> </tr> <?php if (strlen($pconfig['ivrtimeout']) == 0) { $pconfig['ivrtimeout'] = 10; //set a default timeout - } - ?> + } + ?> <tr> <td width="22%" valign="top" class="vncellreq">Timeout</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ivrtimeout" type="text" class="formfld" id="ivrtimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrtimeout']);?>"> - <br><span class="vexpl">After the recording concludes the - timeout sets the time in seconds to continue to wait for DTMF. - If the DTMF is <br />not detected during that time the 't' + <br><span class="vexpl">After the recording concludes the + timeout sets the time in seconds to continue to wait for DTMF. + If the DTMF is <br />not detected during that time the 't' timeout option is executed.</span> </td> </tr> <tr> <td width="22%" valign="top" class="vncell">Context</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ivrcontext" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrcontext']);?>"> <br> <span class="vexpl">e.g. <em>default</em></span></td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="ivrdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['ivrdescr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> @@ -337,14 +323,14 @@ include("head.inc"); echo "<textarea name=\"ivrconditionjs\" cols=\"50\" rows=\"7\" wrap=\"off\">".htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))."</textarea>\n"; } ?> - <br> <span class="vexpl">A simple valid condition is: - condition=true; To re-populate the default simply empty the - textarea and click on save. The following javascript variables - have been defined: Hours, Mins, Seconds, Month, Date, Year, + <br> <span class="vexpl">A simple valid condition is: + condition=true; To re-populate the default simply empty the + textarea and click on save. The following javascript variables + have been defined: Hours, Mins, Seconds, Month, Date, Year, and Day.</span></td> - </tr> - - + </tr> + + <tr> <td width="22%" valign="top"> </td> <td width="78%"> @@ -357,39 +343,39 @@ include("head.inc"); </tr> </table> </form> - + <br> <br> <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2"> - <?php - - + <?php + + //echo "<pre>"; //print_r ($a_ivr); //echo "</pre>"; - - //if ($savemsg) print_info_box($savemsg); + + //if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; - //endif; - + //endif; + ?> - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong><br> </strong></span> - Options are the choices that are available to the caller when they - are calling the auto attendant. If the caller presses 2 then the call + Options are the choices that are available to the caller when they + are calling the auto attendant. If the caller presses 2 then the call is directed to the corresponding destination. </span></p></td> </tr> </table> - - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Action<br /> </strong></span> @@ -398,7 +384,7 @@ include("head.inc"); </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Option</td> @@ -415,9 +401,9 @@ include("head.inc"); </td> </tr> - <?php + <?php $i = 0; - if (count($a_ivr_options) > 0) { + if (count($a_ivr_options) > 0) { foreach ($a_ivr_options as $ent) { if ($ent['optionaction'] == "action" && $ivrid == $ent['ivrid']) { ?> @@ -430,7 +416,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> <?=$ent['optiondest'];?> - </td> + </td> <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?> </td> @@ -443,9 +429,9 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } ?> @@ -467,36 +453,36 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> - + <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2"> - <?php - - + <?php + + //echo "<pre>"; //print_r ($a_ivr); //echo "</pre>"; - - //if ($savemsg) print_info_box($savemsg); + + //if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; - //endif; - + //endif; + ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Anti-Action<br /> </strong></span> - The options that are executed when the <b>condition does NOT match.</b> + The options that are executed when the <b>condition does NOT match.</b> </span></p></td> </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Option</td> @@ -513,9 +499,9 @@ include("head.inc"); </td> </tr> - <?php + <?php $i = 0; - if (count($a_ivr_options) > 0) { + if (count($a_ivr_options) > 0) { foreach ($a_ivr_options as $ent) { if ($ent['optionaction'] == "anti-action" && $ivrid == $ent['ivrid']) { ?> @@ -528,7 +514,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> <?=$ent['optiondest'];?> - </td> + </td> <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?> </td> @@ -541,9 +527,9 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } ?> @@ -565,11 +551,11 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> - + + <br> <br> - <br> </td> </tr> diff --git a/config/freeswitch/freeswitch_ivr_options.tmp b/config/freeswitch/freeswitch_ivr_options.tmp index 8356bc58..096e5b6e 100755 --- a/config/freeswitch/freeswitch_ivr_options.tmp +++ b/config/freeswitch/freeswitch_ivr_options.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_ivr_options.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/config/freeswitch/freeswitch_ivr_options_edit.tmp b/config/freeswitch/freeswitch_ivr_options_edit.tmp index 78975a7f..1e3313d0 100755..100644 --- a/config/freeswitch/freeswitch_ivr_options_edit.tmp +++ b/config/freeswitch/freeswitch_ivr_options_edit.tmp @@ -1,24 +1,24 @@ -<?php +<?php /* $Id$ */ /* freeswitch_recordings_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -89,7 +89,7 @@ if ($_POST) { $a_ivr_options[$id] = $ivroptionent; } else { - //add + //add $a_ivr_options[] = $ivroptionent; } @@ -115,21 +115,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -137,19 +124,19 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - + <form action="freeswitch_ivr_options_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Option Number</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optionnumber" type="text" class="formfld" id="optionnumber" size="40" value="<?=htmlspecialchars($pconfig['optionnumber']);?>"> <br> <span class="vexpl">Option Number<br> e.g. <em>1</em></span></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Type</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <?php echo " <select name='optiontype' class='formfld'>\n"; echo " <option></option>\n"; @@ -168,17 +155,17 @@ include("head.inc"); echo " </select>\n"; ?> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq">Destination</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>"> <br> <span class="vexpl">Destination<br> e.g. <em>1001</em></span></td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optiondescr" type="text" class="formfld" id="optiondescr" size="40" value="<?=htmlspecialchars($pconfig['optiondescr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> @@ -188,23 +175,23 @@ include("head.inc"); <td width="78%"> <input name="ivrid" type="hidden" value="<?=$ivrid;?>"> <input name="parentid" type="hidden" value="<?=$parentid;?>"> - <input name="optionaction" type="hidden" value="<?=$pconfig['optionaction'];?>"> + <input name="optionaction" type="hidden" value="<?=$pconfig['optionaction'];?>"> <?php if (isset($id) && $a_ivr_options[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> + <input name="id" type="hidden" value="<?=$id;?>"> <?php endif; ?> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> </td> </tr> </table> </form> - + <br> <br> <br> <br> <br> <br> - + </td> </tr> </table> diff --git a/config/freeswitch/freeswitch_mailto.tmp b/config/freeswitch/freeswitch_mailto.tmp index 23645570..71af859c 100755 --- a/config/freeswitch/freeswitch_mailto.tmp +++ b/config/freeswitch/freeswitch_mailto.tmp @@ -1,12 +1,12 @@ <?php /* $Id$ */ /* - freeswitch_mailto.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + freeswitch_mailto.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -32,7 +32,7 @@ require_once("config.inc"); require_once("/usr/local/pkg/freeswitch.inc"); -global $config; +global $config; $tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost']; $tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL" @@ -43,12 +43,12 @@ $tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'] $tmp_smtpfrom = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfrom']; $tmp_smtpfromname = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfromname']; - + ini_set(max_execution_time,900); //15 minutes ini_set('memory_limit', '96M'); $fd = fopen("php://stdin", "r"); -$email = file_get_contents ("php://stdin"); +$email = file_get_contents ("php://stdin"); fclose($fd); @@ -65,8 +65,8 @@ ob_start(); $tmparray = split("\n\n", $email); $mainheader = $tmparray[0]; $maincontent = substr($email, strlen($mainheader), strlen($email)); - -//get the boundary + +//get the boundary $tmparray = split("\n", $mainheader); $contenttmp = $tmparray[1]; //Content-Type: multipart/mixed; boundary="XXXX_boundary_XXXX" $tmparray = split('; ', $contenttmp); //boundary="XXXX_boundary_XXXX" @@ -75,11 +75,11 @@ ob_start(); $boundary = $tmparray[1]; $boundary = trim($boundary,'"'); //echo "boundary: $boundary\n"; - + //put the main headers into an array $mainheaderarray = split("\n", $mainheader); //print_r($mainheaderarray); - foreach ($mainheaderarray as $val) { + foreach ($mainheaderarray as $val) { $tmparray = split(': ', $val); //print_r($tmparray); $var[$tmparray[0]] = trim($tmparray[1]); @@ -87,13 +87,13 @@ ob_start(); $var['To'] = str_replace("<", "", $var['To']); $var['To'] = str_replace(">", "", $var['To']); - + echo "To: ".$var['To']."\n"; echo "From: ".$var['From']."\n"; echo "Subject: ".$var['Subject']."\n"; //print_r($var); echo "\n\n"; - + // split mime type multi-part into each part $maincontent = str_replace($boundary."--", $boundary, $maincontent); @@ -102,7 +102,7 @@ ob_start(); // loop through each mime part $i=0; foreach ($tmparray as $mimepart) { - + $mimearray = split("\n\n", $mimepart); $subheader = $mimearray[0]; $headermimearray = split("\n", trim($subheader)); @@ -117,40 +117,40 @@ ob_start(); //echo "subboundary: ".$subboundary."\n"; } } - else { + else { $tmparray = split(':', $val); //':' found } - + //print_r($tmparray); $var[trim($tmparray[0])] = trim($tmparray[1]); } //print_r($var); - - + + $contenttypearray = split(' ', $headermimearray[0]); - + if ($contenttypearray[0] == "Content-Type:") { $contenttype = trim($contenttypearray[1]); - + switch ($contenttype) { case "multipart/alternative;": - + //echo "type: ".$contenttype."\n"; $content = trim(substr($mimepart, strlen($subheader), strlen($mimepart))); - + $content = str_replace($subboundary."--", $subboundary, $content); $tmpsubarray = split("--".$subboundary, $content); foreach ($tmpsubarray as $mimesubsubpart) { - + $mimesubsubarray = split("\n\n", $mimesubsubpart); $subsubheader = $mimesubsubarray[0]; - + $headersubsubmimeearray = split("\n", trim($subsubheader)); $subsubcontenttypearray = split(' ', $headersubsubmimeearray[0]); //echo "subsubcontenttypearray[0] ".$subsubcontenttypearray[0]."\n"; if ($subsubcontenttypearray[0] == "Content-Type:") { - $subsubcontenttype = trim($subsubcontenttypearray[1]); + $subsubcontenttype = trim($subsubcontenttypearray[1]); switch ($subsubcontenttype) { case "text/plain;": $textplain = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart))); @@ -162,51 +162,51 @@ ob_start(); break; } } //end if - + } //end foreach - + break; case "audio/wav;": - //echo "type: ".$contenttype."\n"; + //echo "type: ".$contenttype."\n"; $strwav = trim(substr($mimepart, strlen($subheader), strlen($mimepart))); //echo "\n*** begin wav ***\n".$strwav."\n*** end wav ***\n"; break; - - }//end switch + + }//end switch } //end if - - $i++; - + + $i++; + } //end foreach //send the email - + include "class.phpmailer.php"; include "class.smtp.php"; ; // optional, gets called from within class.phpmailer.php if not already loaded - + $mail = new PHPMailer(); - + $mail->IsSMTP(); // set mailer to use SMTP $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication $mail->Host = $tmp_smtphost; if (strlen($tmp_smtpsecure)>0) { $mail->SMTPSecure = $tmp_smtpsecure; } - if ($tmp_smtpauth) { + if ($tmp_smtpauth) { $mail->Username = $tmp_smtpusername; $mail->Password = $tmp_smtppassword; } - + $mail->From = $tmp_smtpfrom; $mail->FromName = $tmp_smtpfromname; $mail->Subject = $var['Subject']; $mail->AltBody = $textplain; // optional, comment out and test $mail->MsgHTML($texthtml); - - + + $tmp_to = $var['To']; $tmp_to = str_replace(";", ",", $tmp_to); $tmp_to_array = split(",", $tmp_to); @@ -222,10 +222,10 @@ ob_start(); $mail->AddStringAttachment(base64_decode($strwav),$filename,$encoding,$type); } unset($strwav); - + if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; - } + } else { echo "Message sent!"; } diff --git a/config/freeswitch/freeswitch_modules.xml b/config/freeswitch/freeswitch_modules.xml index fd962aa3..8c211820 100755..100644 --- a/config/freeswitch/freeswitch_modules.xml +++ b/config/freeswitch/freeswitch_modules.xml @@ -65,7 +65,7 @@ <name>freeswitch</name> <rcfile>freeswitch.sh</rcfile> <executable>freeswitch</executable> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> </service> <tabs> <tab> @@ -74,48 +74,35 @@ </tab> <tab> <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> + <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url> </tab> <tab> <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> + <url>/packages/freeswitch/freeswitch_extensions.php</url> </tab> <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> + <text>Features</text> + <url>/packages/freeswitch/freeswitch_features.php</url> </tab> <tab> <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> + <url>/packages/freeswitch/freeswitch_gateways.php</url> </tab> <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - <active/> + <text>Profiles</text> + <url>/packages/freeswitch/freeswitch_profiles.php</url> </tab> <tab> <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> + <url>/packages/freeswitch/freeswitch_public_includes.php</url> </tab> <tab> <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> + <url>/packages/freeswitch/freeswitch_status.php</url> </tab> <tab> <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> + <url>/packages/freeswitch/freeswitch_vars.php</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->freeswitchmodules</configpath> diff --git a/config/freeswitch/freeswitch_profile_edit.tmp b/config/freeswitch/freeswitch_profile_edit.tmp new file mode 100644 index 00000000..2466f115 --- /dev/null +++ b/config/freeswitch/freeswitch_profile_edit.tmp @@ -0,0 +1,143 @@ +<?php +/* $Id$ */ +/* + freeswitch_profile_edit.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config']; + +$fd = fopen("/usr/local/freeswitch/conf/sip_profiles/".$_GET['f'], "r"); +$content = fread($fd, filesize("/usr/local/freeswitch/conf/sip_profiles/".$_GET['f'])); +fclose($fd); + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<script language="Javascript"> +function sf() { document.forms[0].savetopath.focus(); } +</script> +<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script> +<script language="Javascript" type="text/javascript"> + // initialisation + editAreaLoader.init({ + id: "code" // id of the textarea to transform + ,start_highlight: false + ,allow_toggle: false + ,language: "en" + ,syntax: "html" + ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" + ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql" + ,show_line_colors: true + }); +</script> + +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Edit Profile</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> + + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="freeswitch_profiles.php" method="post" name="iform" id="iform"> +<?php + +?> + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Edit Profile<br> + </strong></span> + Use this to configure your SIP profiles. + </p> + </td> + <td align='right' valign='middle'>Filename: <input type="text" name="f" value="<?php echo $_GET['f']; ?>" /><input type="submit" value="save" /></td> + </tr> + </table> + <br /> + <br /> + + <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea> + <br /> + <br /> + + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td>/usr/local/freeswitch/conf/sip_profiles/<?php echo $_GET['f']; ?></td> + <td align='right'> + <input type="hidden" name="a" value="save" /> + <?php + echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_profiles.php?a=default&f=".$_GET['f']."';\" />"; + ?> + </td> + </tr> + </table> + +</form> + +<br> +<br> + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_profiles.tmp b/config/freeswitch/freeswitch_profiles.tmp new file mode 100644 index 00000000..983b448c --- /dev/null +++ b/config/freeswitch/freeswitch_profiles.tmp @@ -0,0 +1,224 @@ +<?php +/* $Id$ */ +/* + freeswitch_profiles.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +//$a_extensions = &$config['installedpackages']['freeswitchextensions']['config']; + + +if ($_GET['a'] == "default") { + conf_mount_rw(); + exec("cp /usr/local/freeswitch/conf.orig/sip_profiles/".$_GET['f']." /usr/local/freeswitch/conf/sip_profiles/".$_GET['f']); + $savemsg = "Restore Default"; + conf_mount_ro(); +} + +if ($_POST['a'] == "save") { + conf_mount_rw(); + $content = ereg_replace("\r","",$_POST['code']); + $fd = fopen("/usr/local/freeswitch/conf/sip_profiles/".$_POST['f'], "w"); + fwrite($fd, $content); + fclose($fd); + $savemsg = "Saved"; + conf_mount_ro(); +} + + +if ($_GET['a'] == "del") { + if ($_GET['type'] == 'profile') { + //if ($a_profiles[$_GET['id']]) { + //unset($a_extensions[$_GET['id']]); + //write_config(); + + exec("rm /usr/local/freeswitch/conf/sip_profiles/".$_GET['f']); + header("Location: freeswitch_profiles.php"); + exit; + //} + } +} + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Profiles</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + + $tab_array = array(); + $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); + $tab_array[] = array(gettext("Dialplan"), false, "/packages/freeswitch/freeswitch_dialplan_includes.php"); + $tab_array[] = array(gettext("Extensions"), false, "/packages/freeswitch/freeswitch_extensions.php"); + $tab_array[] = array(gettext("Features"), false, "/packages/freeswitch/freeswitch_features.php"); + $tab_array[] = array(gettext("Gateways"), false, "/packages/freeswitch/freeswitch_gateways.php"); + $tab_array[] = array(gettext("Profiles"), true, "/packages/freeswitch/freeswitch_profiles.php"); + $tab_array[] = array(gettext("Public"), false, "/packages/freeswitch/freeswitch_public_includes.php"); + $tab_array[] = array(gettext("Status"), false, "/packages/freeswitch/freeswitch_status.php"); + $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); + display_top_tabs($tab_array); + +?> +</td></tr> +</table> + + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="freeswitch_profiles.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Profiles<br> + </strong></span> + Use this to configure your SIP profiles. + </p></td> + </tr> + </table> + <br /> + + + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="25%" class="listhdrr">Name</td> + <td width="70%" class="listhdr">Description</td> + <td width="5%" class="list"> + </td> + </tr> + + + <?php + + foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$file){ + ?> + <tr> + <td class="listr" ondblclick="document.location='freeswitch_profile_edit.php?f=<?=$file;?>';" valign="middle"> + <?=$file;?> + </td> + <td class="listbg" ondblclick="document.location='freeswitch_profile_edit.php?f=<?=$file;?>';"> + <?php + + switch ($file) { + case "internal.xml": + echo "<font color='#FFFFFF'>"; + echo "The Internal profile by default requires registration which is most often used for extensions. "; + echo "By default the Internal profile binds to the WAN IP which is accessible to the internal network. "; + echo "A rule can be set from PFSense -> Firewall -> Rules -> WAN to the the WAN IP for port 5060 which "; + echo "enables phones register from outside the network."; + echo ""; + echo "</font>"; + echo " "; + break; + case "internal-ipv6.xml": + echo "<font color='#FFFFFF'>The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.</font> "; + break; + case "external.xml": + echo "<font color='#FFFFFF'>"; + echo "The External profile handles outbound registrations to a SIP provider or other SIP Server. The SIP provider sends calls to you, and you "; + echo "send calls to your provider, through the external profile. The external profile allows anonymous calling, which is "; + echo "required as your provider will never authenticate with you to send you a call. Calls can be sent using a SIP URL \"my.domain.com:5080\" "; + echo "</font> "; + break; + case "lan.xml": + echo "<font color='#FFFFFF'>The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.</font> "; + break; + default: + echo "<font color='#FFFFFF'>default</font> "; + } + ?> + </td> + <td valign="middle" nowrap class="list" valign="top"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="freeswitch_profile_edit.php?type=profile&f=<?=$file;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_profiles.php?type=profile&a=del&f=<?=$file;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + $i++; + } + + ?> + + <tr> + <td class="list" colspan="4"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"></td> + </tr> + </table> + </td> + </tr> + + + <tr> + <td class="list" colspan="4"></td> + <td class="list"></td> + </tr> + </table> + +</form> + +<br> +<br> +/usr/local/freeswitch/conf/sip_profiles +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_public.tmp b/config/freeswitch/freeswitch_public.tmp new file mode 100644 index 00000000..0c05fe47 --- /dev/null +++ b/config/freeswitch/freeswitch_public.tmp @@ -0,0 +1,162 @@ +<?php +/* $Id$ */ +/* + freeswitch_public.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config']; + +if ($_GET['a'] == "default") { + conf_mount_rw(); + exec("cp /usr/local/freeswitch/conf.orig/dialplan/public.xml /usr/local/freeswitch/conf/dialplan/public.xml"); + $savemsg = "Default Restored"; + conf_mount_ro(); +} + +if ($_POST['a'] == "save") { + conf_mount_rw(); + $content = ereg_replace("\r","",$_POST['code']); + $fd = fopen("/usr/local/freeswitch/conf/dialplan/public.xml", "w"); + fwrite($fd, $content); + fclose($fd); + $savemsg = "Saved"; + conf_mount_ro(); +} + + +$fd = fopen("/usr/local/freeswitch/conf/dialplan/public.xml", "r"); +$content = fread($fd, filesize("/usr/local/freeswitch/conf/dialplan/public.xml")); +fclose($fd); + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<script language="Javascript"> +function sf() { document.forms[0].savetopath.focus(); } +</script> +<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script> +<script language="Javascript" type="text/javascript"> + // initialisation + editAreaLoader.init({ + id: "code" // id of the textarea to transform + ,start_highlight: false + ,allow_toggle: false + ,language: "en" + ,syntax: "html" + ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" + ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql" + ,show_line_colors: true + }); +</script> + +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Public</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> + + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="freeswitch_public.php" method="post" name="iform" id="iform"> +<?php + +?> + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width='90%'><p><span class="vexpl"><span class="red"><strong>Public<br> + </strong></span> + Directs inbound calls to extensions, IVRs, external numbers, and scripts. + </p> + </td> + <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td> + </tr> + </table> + <br /> + <br /> + + <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea> + <br /> + <br /> + + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td>/usr/local/freeswitch/conf/dialplan/public.xml</td> + <td align='right'> + <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" /> + <input type="hidden" name="a" value="save" /> + <?php + echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_public.php?a=default&f=public.xml';\" />"; + ?> + </td> + </tr> + </table> + +</form> + +<br> +<br> + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_public.xml b/config/freeswitch/freeswitch_public.xml deleted file mode 100755 index ed633a4e..00000000 --- a/config/freeswitch/freeswitch_public.xml +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - freeswitch_public.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net> - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchpublic</name> - <version>0.1</version> - <title>FreeSWITCH: Public</title> - <aftersaveredirect>pkg_edit.php?xml=freeswitch_public.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - <active/> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchpublic</configpath> - <fields> - <field> - <fielddescr><b>Public</b> <br /> <br />Directs inbound calls to extensions, IVRs, external numbers, and scripts. </fielddescr> - <fieldname>public_xml</fieldname> - <description><br />Path: /usr/local/freeswitch/conf/dialplan/public.xml <br /><br /></description> - <type>textarea</type> - <encoding>base64</encoding> - <wrap>off</wrap> - <size>30</size> - <cols>70</cols> - <rows>33</rows> - </field> - </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_after_head_command> - sync_package_freeswitch_public(); - </custom_php_after_head_command> - <custom_php_after_form_command> - </custom_php_after_form_command> - <custom_php_validation_command> - </custom_php_validation_command> - <custom_php_resync_config_command> - sync_package_freeswitch_public(); - </custom_php_resync_config_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_public_includes.tmp b/config/freeswitch/freeswitch_public_includes.tmp index 66f733b3..51a535d4 100755..100644 --- a/config/freeswitch/freeswitch_public_includes.tmp +++ b/config/freeswitch/freeswitch_public_includes.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_public_includes.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -41,7 +41,7 @@ require("/usr/local/pkg/freeswitch.inc"); //default //enabled //descr - + //freeswitchpublicincludedetails //publicincludeid @@ -53,7 +53,7 @@ require("/usr/local/pkg/freeswitch.inc"); //tagorder //1-20 //fieldtype - + //fielddata @@ -63,7 +63,7 @@ $a_public_includes_details = &$config['installedpackages']['freeswitchpublicincl if ($_GET['act'] == "del") { if ($_GET['type'] == 'publicincludes') { - + if ($a_public_includes[$_GET['id']]) { $publicincludeid = $a_public_includes[$_GET['id']][publicincludeid]; @@ -71,7 +71,7 @@ if ($_GET['act'] == "del") { $extensionname = $a_public_includes[$_GET['id']][extensionname]; $order = $a_public_includes[$_GET['id']][order]; $publicincludefilename = $order."_".$extensionname.".xml"; - + //delete the public include details. aka. child data if (count($a_public_includes_details) > 0) { $i=0; @@ -81,17 +81,17 @@ if ($_GET['act'] == "del") { //echo "child id: ".$i."<br />\n"; unset($a_public_includes_details[$i]); } - $i++; + $i++; } } } - + //if the public include xml file exists then delete it - if (file_exists("/usr/local/freeswitch/conf/public/default/".$publicincludefilename)) { - unlink("/usr/local/freeswitch/conf/public/default/".$publicincludefilename); + if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) { + unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename); } - - unset($publicincludefilename); + + unset($publicincludefilename); unset($a_public_includes[$_GET['id']]); write_config(); sync_package_freeswitch_public_includes(); @@ -113,21 +113,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -138,7 +125,7 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_public_includes.php" method="post" name="iform" id="iform"> -<?php +<?php //echo "<pre>"; @@ -148,28 +135,28 @@ include("head.inc"); //if ($config_change == 1) { // write_config(); -// $config_change = 0; +// $config_change = 0; //} -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> <br /> <br /> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><span class="vexpl"><span class="red"><strong>Public </strong></span></span> </td> <td align='right'> - <input type='button' value='public.xml' alt='' onclick="document.location.href='/pkg_edit.php?xml=freeswitch_public.xml&id=0';"> - </td> + <input type='button' value='public.xml' alt='' onclick="document.location.href='/packages/freeswitch/freeswitch_public.php';"> + </td> </tr> <tr> <td colspan='2'> @@ -177,14 +164,14 @@ include("head.inc"); The public dialplan is used to route incoming calls to destinations based on conditions and context. It can send incoming calls to IVRs, extensions, external numbers, and scripts. </span> </td> - + </tr> </table> <br /> <br /> - <br /> - + <br /> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Extension Name</td> @@ -201,35 +188,55 @@ include("head.inc"); </td> </tr> - <?php + <?php + //create a temporary id for the array + $i = 0; + if (count($a_public_includes) > 0) { + foreach ($a_public_includes as $ent) { + $a_public_includes[$i]['id'] = $i; + $i++; + } + } + + //order the array + function cmp_number($a, $b) { + if ($a["order"] > $b["order"]) { + return 1; + } + else { + return 0; + } + } + if (count($a_public_includes) > 0) { usort($a_public_includes, "cmp_number"); } + $i = 0; - if (count($a_public_includes) > 0) { + if (count($a_public_includes) > 0) { foreach ($a_public_includes as $ent) { if (strlen($ent['extensionname'].$ent['enabled']) > 0) { ?> <tr> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>'"> + <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>'"> <?=$ent['extensionname']?> </td> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>'"> + <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>'"> <?=$ent['order']?> </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>';"> + <td class="listr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>';"> <?=$ent['enabled'];?> </td> - <td class="listbg" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>';"> + <td class="listbg" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>';"> <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?> </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> - <td valign="middle"><a href="freeswitch_public_includes_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_public_includes.php?type=publicincludes&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="freeswitch_public_includes.php?type=publicincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> </table> </td> </tr> - <?php + <?php } //end if strlen $i++; } //end for each @@ -252,7 +259,7 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> /usr/local/freeswitch/conf/dialplan/public/ @@ -272,4 +279,4 @@ include("head.inc"); <?php include("fend.inc"); ?> </body> -</html> +</html>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_public_includes_details.tmp b/config/freeswitch/freeswitch_public_includes_details.tmp index c28a7647..3b3130b0 100755 --- a/config/freeswitch/freeswitch_public_includes_details.tmp +++ b/config/freeswitch/freeswitch_public_includes_details.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_public_includes_details.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/config/freeswitch/freeswitch_public_includes_details_edit.tmp b/config/freeswitch/freeswitch_public_includes_details_edit.tmp index 821d9097..30d07f99 100755..100644 --- a/config/freeswitch/freeswitch_public_includes_details_edit.tmp +++ b/config/freeswitch/freeswitch_public_includes_details_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_public_includes_details_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -62,9 +61,9 @@ if (isset($_POST['publicincludeid'])) { //tagorder //1-20 //fieldtype - + //fielddata - + if (isset($id) && $a_public_includes_details[$id]) { $pconfig['publicincludeid'] = $a_public_includes_details[$id]['publicincludeid']; @@ -89,7 +88,7 @@ if ($_POST) { if (!$input_errors) { - + $ent = array(); $ent['publicincludeid'] = $_POST['publicincludeid']; $ent['tag'] = $_POST['tag']; @@ -103,7 +102,7 @@ if ($_POST) { $a_public_includes_details[$id] = $ent; } else { - //add + //add $a_public_includes_details[] = $ent; } @@ -130,29 +129,16 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); - + +display_top_tabs(build_menu()); + ?> </td></tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - + <form action="freeswitch_public_includes_details_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> @@ -180,9 +166,9 @@ include("head.inc"); if (tag == "") { document.getElementById("label_fieldtype").innerHTML = "Type"; document.getElementById("label_fielddata").innerHTML = "Data"; - } + } } - </script> + </script> <?php echo " <select name='tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n"; echo " <option></option>\n"; @@ -210,7 +196,7 @@ include("head.inc"); echo " <option>action</option>\n"; echo " <option>anti-action</option>\n"; //echo " <option selected='yes'>param</option>\n"; - break; + break; default: echo " <option>condition</option>\n"; echo " <option>action</option>\n"; @@ -218,31 +204,31 @@ include("head.inc"); //echo " <option>param</option>\n"; } echo " </select>\n"; - + //condition //field expression //action - //application + //application //data //antiaction - //application + //application //data //param //name //value - + ?> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td> - <td width="78%" class="vtable"> - <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>"> + <td width="78%" class="vtable"> + <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>"> </td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>"> <br> <span class="vexpl"></span></td> </tr> @@ -250,9 +236,9 @@ include("head.inc"); <td width="22%" valign="top"> </td> <td width="78%"> <input name="publicincludeid" type="hidden" value="<?=$publicincludeid;?>"> - <input name="parentid" type="hidden" value="<?=$parentid;?>"> + <input name="parentid" type="hidden" value="<?=$parentid;?>"> <?php if (isset($id) && $a_public_includes_details[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> + <input name="id" type="hidden" value="<?=$id;?>"> <?php endif; ?> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> </td> @@ -266,7 +252,7 @@ include("head.inc"); <b>Example</b> <br /> <br /> - If the inbound call matches the DID 12085551234 then proceed to the action. + If the inbound call matches the DID 12085551234 then proceed to the action. <br /> <br /> <table cellpadding='3'> @@ -276,8 +262,8 @@ include("head.inc"); </table> <br /> - <br /> - + <br /> + Transfer the inbound call to an IVR with extension of 5000. <br /> <br /> @@ -285,8 +271,8 @@ include("head.inc"); <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr> <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr> <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">5000 XML default</td></tr> - </table> - + </table> + <br /> <br /> @@ -297,15 +283,15 @@ include("head.inc"); <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr> <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr> <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">1001 XML default</td></tr> - </table> + </table> + - <br /> <br /> <br /> <br /> - - + + <b>Conditions</b> <br /> <br /> @@ -322,49 +308,49 @@ include("head.inc"); <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li> <li><b>source</b> Name of the FreeSwitch module that received the call (e.g. PortAudio)</li> <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li> - <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li> + <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li> </ul> In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args} <br /> <br /> - Variables may be used in either the field or the expression, as follows + Variables may be used in either the field or the expression, as follows <br /> <br /> <br /> <br /> - + <b>Action and Anti-Actions</b> <br /> <br /> Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>. Additional information on applications for Actions and Anti-Actions.<br /> - <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a> + <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a> <br /> <a href='http://wiki.freeswitch.org/wiki/public_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/public_Functions</a> <br /> <br /> <br /> - The following is a partial list of <b>applications</b>. + The following is a partial list of <b>applications</b>. <ul> <li><b>answer</b> answer the call</li> <li><b>bridge</b> bridge the call<li> <li><b>cond</b></li> - <li><b>db</b> is a a runtime database either sqlite by default or odbc</li> + <li><b>db</b> is a a runtime database either sqlite by default or odbc</li> <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li> <li><b>group</b> allows grouping of several extensions for things like ring groups</li> <li><b>expr</b></li> - <li><b>hangup</b> hangs up the call</li> + <li><b>hangup</b> hangs up the call</li> <li><b>info</b> sends call info to the console</li> <li><b>javascript</b> run javascript .js files</li> <li><b>playback</b></li> <li><b>reject</b> reject the call</li> - <li><b>respond</b></li> - <li><b>ring_ready</b></li> + <li><b>respond</b></li> + <li><b>ring_ready</b></li> <li><b>set</b> set a variable</li> <li><b>set_user</b></li> <li><b>sleep</b></li> - <li><b>sofia_contact</b></li> + <li><b>sofia_contact</b></li> <li><b>transfer</b> transfer the call to another extension or number<li> <li><b>voicemail</b> send the call to voicemail</li> </ul> @@ -377,13 +363,13 @@ include("head.inc"); <b>Param</b> Example parameters by name and value <br /> - <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a> + <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a> <ul> - <li><b>codec-ms</b> 20</li> + <li><b>codec-ms</b> 20</li> <li><b>codec-prefs</b> PCMU@20i</li> <li><b>debug</b> 1</li> <li><b>public</b> XML</li> - <li><b>dtmf-duration</b> 100</li> + <li><b>dtmf-duration</b> 100</li> <li><b>rfc2833-pt</b>" 101</li> <li><b>sip-port</b> 5060</li> <li><b>use-rtp-timer</b> true</li> @@ -392,13 +378,13 @@ include("head.inc"); <br /> --> - + <br /> <br /> <br /> <br /> <br /> - + </td> </tr> </table> diff --git a/config/freeswitch/freeswitch_public_includes_edit.tmp b/config/freeswitch/freeswitch_public_includes_edit.tmp index 94454fd3..3e0644c3 100755..100644 --- a/config/freeswitch/freeswitch_public_includes_edit.tmp +++ b/config/freeswitch/freeswitch_public_includes_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_public_includes_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -43,7 +42,7 @@ require("/usr/local/pkg/freeswitch.inc"); //default //enabled //descr - + // @@ -90,11 +89,11 @@ if ($_POST) { if (!$input_errors) { - + $ent = array(); if (strlen($_POST['publicincludeid']) > 0) { //update - $ent['publicincludeid'] = $_POST['publicincludeid']; + $ent['publicincludeid'] = $_POST['publicincludeid']; } else { //add @@ -109,49 +108,49 @@ if ($_POST) { $ent['opt1name'] = $_POST['opt1name']; $ent['opt1value'] = $_POST['opt1value']; - + if (isset($id) && $a_public_includes[$id]) { $a_public_includes = $config['installedpackages']['freeswitchpublicincludes']['config']; if (count($a_public_includes) > 0) { foreach($a_public_includes as $rowhelper) { - + //$rowhelper['publicincludeid']; //$rowhelper['extensionname']; //$rowhelper['context']; //$rowhelper['enabled']; - + $filenamechanged = false; if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) { - + if ($rowhelper['extensionname'] != $_POST['extensionname']) { //if the extension name has changed then remove the current public xml file //to prepare for the new file - $filenamechanged = true; + $filenamechanged = true; } if ($rowhelper['order'] != $_POST['order']) { //if the order has changed then remove the current public xml file //to prepare for the new file - $filenamechanged = true; - } + $filenamechanged = true; + } if ($_POST['enabled'] == "false") { //if the extension name is disabled then remove the public xml file $filenamechanged = true; } - if ($filenamechanged){ + 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); } unset($publicincludefilename); } - + } - unset($filenamechanged); - + unset($filenamechanged); + } //end foreach } //end if count - + //update the config $a_public_includes[$id] = $ent; } @@ -183,21 +182,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -205,8 +191,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Public:<br> </strong></span> @@ -220,27 +206,27 @@ include("head.inc"); <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Extension Name</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>"> <br /> - Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'. + Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'. </td> </tr> <!-- <tr> <td width="22%" valign="top" class="vncellreq">Context</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>"> <br /> e.g. default </td> </tr> --> - + <tr> <td width="22%" valign="top" class="vncellreq">Enabled</td> - <td width="78%" class="vtable"> - <?php + <td width="78%" class="vtable"> + <?php echo " <select name='enabled' class='formfld'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['enabled'])) { @@ -258,30 +244,30 @@ include("head.inc"); echo " <option value='false'>false</option>\n"; } echo " </select>\n"; - ?> + ?> </td> </tr> - + <tr> <td width="22%" valign="top" class="vncellreq">Order</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <?php - + echo " <select name='order' class='formfld'>\n"; echo " <option></option>\n"; if (strlen(htmlspecialchars($pconfig['order']))> 0) { - echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n"; + echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n"; } $i=0; while($i<=999) { - if (strlen($i) == 1) { + if (strlen($i) == 1) { echo " <option value='00$i'>00$i</option>\n"; } if (strlen($i) == 2) { echo " <option value='0$i'>0$i</option>\n"; } if (strlen($i) == 3) { - echo " <option value='$i'>$i</option>\n"; + echo " <option value='$i'>$i</option>\n"; } $i++; @@ -289,24 +275,24 @@ include("head.inc"); echo " </select>\n"; ?> <br /> - Processing of each public include is determined by this order. + Processing of each public include is determined by this order. </td> </tr> - + <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> - </tr> + </tr> <tr> <td width="22%" valign="top"> </td> <td width="78%"> <input name="publicincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['publicincludeid']);?>"> - <?php + <?php if (strlen($id) > 0 && $a_public_includes[$id]) { - echo "\n"; + echo "\n"; echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n"; echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n"; echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n"; @@ -317,36 +303,36 @@ include("head.inc"); </tr> </table> </form> - + <br> <br> <form action="freeswitch_public_includes_edit.php" method="post" name="iform2" id="iform2"> - <?php - + <?php + //echo "<pre>"; //print_r ($a_public_includes); //echo "</pre>"; - - //if ($savemsg) print_info_box($savemsg); + + //if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; - //endif; - + //endif; + ?> - - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br /> </strong></span> - The following conditions, actions and anti-actions are used in the public to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension. + The following conditions, actions and anti-actions are used in the public to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension. </span></p></td> </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Tag</td> @@ -360,13 +346,13 @@ include("head.inc"); </tr> </table> </td> - </tr> - - <?php - + </tr> + + <?php + $i = 0; if (count($a_public_include_details) > 0) { - + foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "condition" && $publicincludeid == $ent['publicincludeid']) { ?> @@ -379,7 +365,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -389,15 +375,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_public_include_details) > 0) { - + foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "action" && $publicincludeid == $ent['publicincludeid']) { ?> @@ -410,7 +396,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -420,15 +406,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_public_include_details) > 0) { - + foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "anti-action" && $publicincludeid == $ent['publicincludeid']) { ?> @@ -441,7 +427,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -451,15 +437,15 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } } - + $i = 0; if (count($a_public_include_details) > 0) { - + foreach ($a_public_include_details as $ent) { if ($ent['tag'] == "param" && $publicincludeid == $ent['publicincludeid']) { ?> @@ -472,7 +458,7 @@ include("head.inc"); </td> <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> <?=$ent['fielddata'];?> - </td> + </td> <td valign="middle" nowrap class="list"> <table border="0" cellspacing="0" cellpadding="1"> <tr> @@ -482,11 +468,11 @@ include("head.inc"); </table> </td> </tr> - <?php + <?php } - $i++; + $i++; } - } + } ?> <tr> <td class="list" colspan="3"></td> @@ -506,12 +492,12 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> - + + <br> <br> - <br> </td> </tr> diff --git a/config/freeswitch/freeswitch_recordings.tmp b/config/freeswitch/freeswitch_recordings.tmp index 7d9b539d..15f3be5e 100755..100644 --- a/config/freeswitch/freeswitch_recordings.tmp +++ b/config/freeswitch/freeswitch_recordings.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_recordings.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -49,7 +49,7 @@ if ($_GET['a'] == "download") { header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); + header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); } else { $file_ext = substr($_GET['filename'], -3); @@ -58,7 +58,7 @@ if ($_GET['a'] == "download") { } if ($file_ext == "mp3") { header("Content-Type: audio/mp3"); - } + } } header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past @@ -66,7 +66,7 @@ if ($_GET['a'] == "download") { fpassthru($fd); } } - + if ($_GET['type'] = "moh") { if (file_exists($dir_music_on_hold_8000.$_GET['filename'])) { $fd = fopen($dir_music_on_hold_8000.$_GET['filename'], "rb"); @@ -75,7 +75,7 @@ if ($_GET['a'] == "download") { header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); + header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); } else { $file_ext = substr($_GET['filename'], -3); @@ -84,7 +84,7 @@ if ($_GET['a'] == "download") { } if ($file_ext == "mp3") { header("Content-Type: audio/mp3"); - } + } } header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past @@ -158,21 +158,8 @@ function EvalSound(soundobj) { <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), true, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -182,29 +169,29 @@ function EvalSound(soundobj) { <tr> <td class="tabcont" > -<?php +<?php //build a list of recordings from the config.xml $config_recording_list = ''; -$i = 0; +$i = 0; if (count($a_recordings) > 0) { foreach ($a_recordings as $recordingent) { $config_recording_list .= $recordingent['filename']."|"; - $i++; + $i++; } } - + $config_change = 0; if (is_dir($dir_recordings)) { if ($dh = opendir($dir_recordings)) { while (($file = readdir($dh)) !== false) { - if (filetype($dir_recordings . $file) == "file") { - + if (filetype($dir_recordings . $file) == "file") { + if (strpos($config_recording_list, $file) === false) { - + //$handle = fopen($dir_recordings.$file,'rb'); //$file_content = fread($handle,filesize($dir_recordings.$file)); //fclose($handle); @@ -217,83 +204,83 @@ if (is_dir($dir_recordings)) { $recordingent['recordingid'] = guid(); //$recordingent['filecontent'] = base64_encode($file_content); $recordingent['descr'] = 'Auto'; - + $a_recordings[] = $recordingent; write_config(); - + unset($file_content); - + } else { //echo "The file was found.<br/>"; } - + } } closedir($dh); } } - -//saved for future use if and when config.xml scales well + +//saved for future use if and when config.xml scales well //enough to save the files inside it //$i = 0; -//if (count($a_recordings) > 0) { +//if (count($a_recordings) > 0) { // foreach ($a_recordings as $recordingent) { // if (!is_file($dir_recordings.$recordingent['filename'])) { //echo "not found: ".$recordingent['filename']."<br />"; - + //recording not found restore the file from the config.xml - //$file_content = $recordingent['filecontent']; + //$file_content = $recordingent['filecontent']; //$handle = fopen($dir_recordings.$recordingent['filename'],'w'); - //fwrite ($handle, base64_decode($file_content)); + //fwrite ($handle, base64_decode($file_content)); //unset($file_content); //fclose($handle); - //$recordingent['filecontent'] = base64_encode($file_content); - - // loop through recordings in the config.xml + //$recordingent['filecontent'] = base64_encode($file_content); + + // loop through recordings in the config.xml // if the file does not exist remove it from the file system. //unset($a_recordings[$i]); - -// $config_change = 1; + +// $config_change = 1; // } // else { - //echo "found: ".$recordingent['filename']."<br />"; + //echo "found: ".$recordingent['filename']."<br />"; // } -// $i++; +// $i++; // } //} if ($config_change == 1) { write_config(); - $config_change = 0; + $config_change = 0; } -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Recordings:<br> </strong></span> - To make a recording dial extension 732673 (record) or you can make a - 16bit 8khz/16khz Mono WAV file then copy it to the - following directory then refresh the page to play it back. - Click on the 'Filename' to download it or the 'Recording Name' to + To make a recording dial *732673 (record) or you can make a + 16bit 8khz/16khz Mono WAV file then copy it to the + following directory then refresh the page to play it back. + Click on the 'Filename' to download it or the 'Recording Name' to play the audio. </span></p></td> </tr> </table> - + <br /> - + <div id="niftyOutter"> <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit=""> <table border='0'> @@ -307,11 +294,11 @@ if ($config_change == 1) { <input name="ulfile" type="file" class="button" id="ulfile"> <input name="submit" type="submit" class="button" id="upload" value="Upload"> </td> - </tr> + </tr> </table> </div> </form> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="30%" class="listhdrr">Filename (download)</td> @@ -329,9 +316,9 @@ if ($config_change == 1) { </td> </tr> - <?php + <?php $i = 0; - if (count($a_recordings) > 0) { + if (count($a_recordings) > 0) { foreach ($a_recordings as $recordingent) { ?> <tr> @@ -343,7 +330,7 @@ if ($config_change == 1) { <td class="listr" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';"> <a href="javascript:void(0);" onclick="window.open('freeswitch_recordings_play.php?a=download&type=rec&filename=<?=$recordingent['filename'];?>', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')"> <?=$recordingent['recordingname'];?> - </a> + </a> </td> <td class="listbg" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';"> <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?> @@ -357,12 +344,12 @@ if ($config_change == 1) { </table> </td> </tr> - <?php + <?php $i++; - } //end for each + } //end for each } //end count ?> - + <!-- <tr> <td class="list" colspan="3"></td> @@ -382,28 +369,28 @@ if ($config_change == 1) { <td class="list"></td> </tr> </table> - + <br /> <br /> <br /> - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Music on Hold:<br> </strong></span> - Music on hold can be in WAV or MP3 format. To play MP3 you must have - mod_shout enabled on the 'Modules' tab. For best performance - upload 16bit 8khz/16khz Mono WAV files. - <!--Click on the 'Filename' to download it or the 'Recording Name' to + Music on hold can be in WAV or MP3 format. To play an MP3 file you must have + mod_shout enabled on the 'Modules' tab. You can adjust the volume of the MP3 + audio from the 'Settings' tab. For best performance upload 16bit 8khz/16khz Mono WAV files. + <!--Click on the 'Filename' to download it or the 'Recording Name' to play the audio.--> </span></p></td> </tr> </table> - + <br /> - + <div id="niftyOutter"> <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit=""> <table border='0'> @@ -416,8 +403,8 @@ if ($config_change == 1) { <td valign="top" class="label"> <input name="ulfile" type="file" class="button" id="ulfile"> <input name="submit" type="submit" class="button" id="upload" value="Upload"> - </td> - </tr> + </td> + </tr> </table> </div> </form> @@ -436,7 +423,7 @@ if ($config_change == 1) { if ($handle = opendir($dir_music_on_hold_8000)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_file($dir_music_on_hold_8000.$file)) { - + $tmp_filesize = filesize($dir_music_on_hold_8000.$file); $tmp_filesize = byte_convert($tmp_filesize); @@ -444,18 +431,18 @@ if ($config_change == 1) { echo " <td class=\"listlr\" ondblclick=\"\">\n"; echo " <a href=\"freeswitch_recordings.php?a=download&type=moh&t=bin&filename=".$file."\">\n"; echo " $file"; - echo " </a>"; + echo " </a>"; echo " </td>\n"; echo " <td class=\"listlr\" ondblclick=\"\">\n"; echo " <a href=\"javascript:void(0);\" onclick=\"window.open('freeswitch_recordings_play.php?a=download&type=moh&filename=".$file."', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')\">\n"; $tmp_file_array = split("\.",$file); echo " ".$tmp_file_array[0]; - echo " </a>"; - echo " </td>\n"; + echo " </a>"; + echo " </td>\n"; echo " <td class=\"listlr\" ondblclick=\"\">\n"; echo date ("F d Y H:i:s", filemtime($dir_music_on_hold_8000.$file)); echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; + echo " <td class=\"listlr\" ondblclick=\"\">\n"; echo " ".$tmp_filesize; echo " </td>\n"; echo " <td valign=\"middle\" nowrap class=\"list\">\n"; @@ -467,7 +454,7 @@ if ($config_change == 1) { echo " </table>\n"; echo " </td>\n"; echo "</tr>\n"; - + } } closedir($handle); diff --git a/config/freeswitch/freeswitch_recordings_edit.tmp b/config/freeswitch/freeswitch_recordings_edit.tmp index 18612b93..1e38d616 100755..100644 --- a/config/freeswitch/freeswitch_recordings_edit.tmp +++ b/config/freeswitch/freeswitch_recordings_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_recordings_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -77,13 +76,13 @@ 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('/usr/local/freeswitch/recordings/'.$_POST['filename_orig'], '/usr/local/freeswitch/recordings/'.$_POST['filename']); } $a_recordings[$id] = $recordingent; } else { //add - $recordingent['filename'] = $_POST['filename']; + $recordingent['filename'] = $_POST['filename']; $a_recordings[] = $recordingent; } @@ -108,21 +107,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), true, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -130,26 +116,26 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - + <form action="freeswitch_recordings_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Filename</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="filename" type="text" class="formfld" id="filename" size="40" value="<?=htmlspecialchars($pconfig['filename']);?>"> <br> <span class="vexpl">Name of the file<br> e.g. <em>example.wav</em></span></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Recording Name</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="recordingname" type="text" class="formfld" id="recordingname" size="40" value="<?=htmlspecialchars($pconfig['recordingname']);?>"> <br> <span class="vexpl">Recording Name<br> e.g. <em>recordingx</em></span></td> </tr> <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> @@ -167,7 +153,7 @@ include("head.inc"); </tr> </table> </form> - + <br> <br> <br> diff --git a/config/freeswitch/freeswitch_recordings_play.tmp b/config/freeswitch/freeswitch_recordings_play.tmp index 8dfb90c2..1c63b592 100755 --- a/config/freeswitch/freeswitch_recordings_play.tmp +++ b/config/freeswitch/freeswitch_recordings_play.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_recordings_play.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -45,11 +44,11 @@ $type = $_GET['type']; //moh //rec <td align='center'> <b>file: <?=$filename?></b> </td> - </tr> + </tr> <tr> <td align='center'> <?php - + $file_ext = substr($_GET['filename'], -3); if ($file_ext == "wav") { echo "<embed src=\"freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename."\" autostart=true width=200 height=40 name=\"sound".$$filename."\" enablejavascript=\"true\">\n"; @@ -60,7 +59,7 @@ $type = $_GET['type']; //moh //rec echo "<param name=\"quality\" value=\"high\"/>\n"; echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n"; echo "</object>\n"; - } + } ?> </td> diff --git a/config/freeswitch/freeswitch_status.tmp b/config/freeswitch/freeswitch_status.tmp index 2d84a6ec..413fbbbd 100755..100644 --- a/config/freeswitch/freeswitch_status.tmp +++ b/config/freeswitch/freeswitch_status.tmp @@ -4,7 +4,7 @@ freeswitch_status.php Copyright (C) 2008 Mark J Crane All rights reserved. - + FreeSWITCH (TM) http://www.freeswitch.org/ @@ -45,9 +45,12 @@ if ($_GET['a'] == "download") { $filename = 'Master.csv'; } if ($_GET['t'] == "backup") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'freeswitch.bak.tgz'; - system('cd /usr/local/;tar cvzf /tmp/freeswitch.bak.tgz freeswitch'); + if (!is_dir('/root/backup/')) { + exec("mkdir /root/backup/"); + } + system('cd /usr/local/;tar cvzf /root/backup/freeswitch.bak.tgz freeswitch'); } session_cache_limiter('public'); $fd = fopen($tmp.$filename, "rb"); @@ -60,32 +63,38 @@ if ($_GET['a'] == "download") { if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { - $tmp = '/tmp/'; + $tmp = '/root/backup/'; $filename = 'freeswitch.bak.tgz'; - + //extract a specific directory to /usr/local/freeswitch - if (file_exists('/tmp/'.$filename)) { + if (file_exists('/root/backup/'.$filename)) { //echo "The file $filename exists"; - //Recommended - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/db/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/log/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/recordings/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/scripts/'); - system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/storage/'); - - //Optional - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/conf/'); - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/grammar/'); - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/htdocs/'); - //system('cd /usr/local; tar xvpfz /tmp/'.$filename.' freeswitch/sounds/'); - - header( 'Location: freeswitch_status.php?savemsg=Backup+has+been+restored.' ) ; + //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'); + + //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/'); + + header( 'Location: freeswitch_status.php?savemsg=Backup+has+been+restored.' ) ; } else { header( 'Location: freeswitch_status.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; - } - + } + exit; } } @@ -102,14 +111,33 @@ $savemsg = $_GET["savemsg"]; if (!pkg_is_service_running('freeswitch')) { $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r"); pclose($handle); + //give freeswitch time to load + sleep(7); } ?> + +<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script> +<script language="Javascript" type="text/javascript"> + // initialisation + editAreaLoader.init({ + id: "log" // id of the textarea to transform + ,start_highlight: false + ,allow_toggle: true + ,display: "later" + ,language: "en" + ,syntax: "html" + ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" + ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql" + ,show_line_colors: true + }); +</script> + <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> <p class="pgtitle">FreeSWITCH: Status</font></p> -<?php +<?php if ($savemsg) { print_info_box($savemsg); } @@ -119,21 +147,8 @@ if ($savemsg) { <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), true, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -156,60 +171,41 @@ 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='/freeswitch/freeswitch_cmd.php?cmd=api+reloadxml';\" />\n"; -echo "</td>\n"; -echo "</tr>\n"; -echo "</table>\n"; -echo "<pre style=\"font-size: 9pt;\">\n"; -echo $response; -echo "</pre>\n"; -fclose($fp); -echo "<br /><br />\n\n"; - - -$fp = event_socket_create($host, $port, $password); -$cmd = "api sofia status profile internal"; -$response = event_socket_request($fp, $cmd); -echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; -echo "<tr>\n"; -echo "<td width='50%'>\n"; -echo " <b>sofia status profile internal</b> \n"; -echo "</td>\n"; -echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='start' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+internal+start';\" />\n"; -echo " <input type='button' value='stop' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+internal+stop';\" />\n"; -echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+internal+flush_inbound_reg';\" />\n"; +echo " <input type='button' value='reloadxml' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+reloadxml';\" />\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<pre style=\"font-size: 9pt;\">\n"; -echo $response; +echo $response; echo "</pre>\n"; -fclose($fp); +fclose($fp); echo "<br /><br />\n\n"; +foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ + + $sip_profile_name = str_replace(".xml", "", $sip_profile_file); + $fp = event_socket_create($host, $port, $password); + $cmd = "api sofia status profile ".$sip_profile_name; + $response = event_socket_request($fp, $cmd); + echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; + echo "<tr>\n"; + echo "<td width='50%'>\n"; + 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/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n"; + echo " <input type='button' value='stop' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n"; + echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n"; + echo "</td>\n"; + echo "</tr>\n"; + echo "</table>\n"; + echo "<pre style=\"font-size: 9pt;\">\n"; + echo $response; + echo "</pre>\n"; + fclose($fp); + echo "<br /><br />\n\n"; -$fp = event_socket_create($host, $port, $password); -$cmd = "api sofia status profile external"; -$response = event_socket_request($fp, $cmd); -echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; -echo "<tr>\n"; -echo "<td width='50%'>\n"; -echo " <b>sofia status profile external</b> \n"; -echo "</td>\n"; -echo "<td width='50%' align='right'>\n"; -echo " <input type='button' value='start' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+external+start+reloadxml';\" />\n"; -echo " <input type='button' value='stop' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+external+stop';\" />\n"; -echo " <input type='button' value='restart' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+external+restart+reloadxml';\" />\n"; -echo " <input type='button' value='rescan' onclick=\"document.location.href='/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+external+rescan+reloadxml';\" />\n"; -echo "</td>\n"; -echo "</tr>\n"; -echo "</table>\n"; -echo "<pre style=\"font-size: 9pt;\">\n"; -echo $response; -echo "</pre>\n"; -fclose($fp); -echo "<br /><br />\n\n"; +} $fp = event_socket_create($host, $port, $password); @@ -217,16 +213,16 @@ $cmd = "api status"; $response = event_socket_request($fp, $cmd); echo "<b>status</b><br />\n"; echo "<pre style=\"font-size: 9pt;\">\n"; -echo $response; +echo $response; echo "</pre>\n"; -fclose($fp); -echo "<br /><br />\n\n"; +fclose($fp); +echo "<br /><br />\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api show channels"; $response = event_socket_request($fp, $cmd); -echo "<b>show channels</b>\n"; +echo "<b>show channels</b><br />\n"; if (strlen($response) > 40) { echo "<textarea cols='85' rows='10' wrap='off'>\n"; echo $response; @@ -237,7 +233,7 @@ else { echo $response; echo "</pre>\n"; } -fclose($fp); +fclose($fp); echo "<br /><br />\n\n"; echo "<br /><br />\n\n"; @@ -245,7 +241,7 @@ echo "<br /><br />\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api show calls"; $response = event_socket_request($fp, $cmd); -echo "<b>show calls</b>\n"; +echo "<b>show calls</b><br />\n"; if (strlen($response) > 40) { echo "<textarea cols='85' rows='10' wrap='off'>\n"; echo $response; @@ -256,7 +252,7 @@ else { echo $response; echo "</pre>\n"; } -fclose($fp); +fclose($fp); echo "<br /><br />\n\n"; echo "<br /><br />\n\n"; @@ -265,15 +261,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 /tmp/freeswitch.bak.tgz it then presents a file to download. \n"; -echo "If the backup file does not exist in /tmp/freeswitch.bak.tgz then the 'restore' button will be hidden. \n"; +echo "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 "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='/freeswitch/freeswitch_status.php?a=download&t=backup';\" />\n"; -if (file_exists('/tmp/freeswitch.bak.tgz')) { - echo " <input type='button' value='restore' onclick=\"document.location.href='/freeswitch/freeswitch_status.php?a=other&t=restore';\" />\n"; +echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/freeswitch/freeswitch_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/freeswitch_status.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; echo "</tr>\n"; @@ -288,7 +284,7 @@ echo "<b>Call Detail Records</b><br />\n"; echo "/usr/local/freeswitch/log/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='/freeswitch/freeswitch_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n"; +echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br /><br />\n\n"; @@ -301,15 +297,15 @@ echo "<b>Logs</b><br />\n"; echo "/usr/local/freeswitch/log/cdr-csv/freeswitch.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='/freeswitch/freeswitch_status.php?a=download&t=logs';\" />\n"; +echo " <input type='button' value='download logs' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=download&t=logs';\" />\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br /><br />\n\n"; -echo "<b>tail -n 100 /usr/local/freeswitch/log/freeswitch.log</b><br />\n"; -echo "<textarea cols='85' rows='30' wrap='off'>\n"; -echo system("tail -n 100 /usr/local/freeswitch/log/freeswitch.log"); +echo "<b>tail -n 500 /usr/local/freeswitch/log/freeswitch.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 "</textarea>\n"; echo "<br /><br />\n\n"; @@ -319,9 +315,9 @@ echo "<br /><br />\n\n"; //$response = event_socket_request($fp, $cmd); //echo "<b>api sofia</b><br />\n"; //echo "<pre style=\"font-size: 9pt;\">\n"; -//echo $response; +//echo $response; //echo "</pre>\n"; -//fclose($fp); +//fclose($fp); //echo "<br /><br />\n\n"; ?> diff --git a/config/freeswitch/freeswitch_time_conditions.tmp b/config/freeswitch/freeswitch_time_conditions.tmp index 617bb5cf..17787ad3 100755..100644 --- a/config/freeswitch/freeswitch_time_conditions.tmp +++ b/config/freeswitch/freeswitch_time_conditions.tmp @@ -2,11 +2,11 @@ /* $Id$ */ /* freeswitch_time_conditions.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -62,21 +62,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -87,32 +74,32 @@ include("head.inc"); <td class="tabcont" > <form action="freeswitch_ivr_options.php" method="post" name="iform" id="iform"> -<?php +<?php //echo "<pre>"; //print_r ($a_ivr); //echo "</pre>"; -//if ($savemsg) print_info_box($savemsg); +//if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); //echo"<br />"; -//endif; +//endif; ?> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td><p><span class="vexpl"><span class="red"><strong>Note:<br> </strong></span> To make a recording dial extension 700 or you can make a - 16bit 8khz/16khz Mono WAV file then copy it to the + 16bit 8khz/16khz Mono WAV file then copy it to the following directory then refresh the page to play it back. </span></p></td> </tr> </table> <br /> - + <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" class="listhdrr">Filename</td> @@ -169,7 +156,7 @@ include("head.inc"); <td class="list"></td> </tr> </table> - + </form> <br> diff --git a/config/freeswitch/freeswitch_time_conditions_edit.tmp b/config/freeswitch/freeswitch_time_conditions_edit.tmp index c40b84f8..45631929 100755..100644 --- a/config/freeswitch/freeswitch_time_conditions_edit.tmp +++ b/config/freeswitch/freeswitch_time_conditions_edit.tmp @@ -1,24 +1,23 @@ -<?php +<?php /* $Id$ */ /* - freeswitch_time_conditions_edit.php - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -89,7 +88,7 @@ if ($_POST) { $a_ivr_options[$id] = $ivroptionent; } else { - //add + //add $a_ivr_options[] = $ivroptionent; } @@ -115,21 +114,8 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabnavtbl"> <?php - - $tab_array = array(); - $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&id=0"); - $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php"); - $tab_array[] = array(gettext("Extensions"), false, "/freeswitch/freeswitch_extensions.php"); - $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&id=0"); - $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php"); - $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&id=0"); - $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php"); - $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&id=0"); - $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php"); - $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php"); - $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php"); - $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&id=0"); - display_top_tabs($tab_array); + +display_top_tabs(build_menu()); ?> </td></tr> @@ -137,19 +123,19 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="tabcont" > - + <form action="freeswitch_ivr_options_edit.php" method="post" name="iform" id="iform"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td width="22%" valign="top" class="vncellreq">Option Number</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optionnumber" type="text" class="formfld" id="optionnumber" size="40" value="<?=htmlspecialchars($pconfig['optionnumber']);?>"> <br> <span class="vexpl">Option Number<br> e.g. <em>1</em></span></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Type</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <?php echo " <select name='optiontype' class='formfld'>\n"; echo " <option></option>\n"; @@ -171,14 +157,14 @@ include("head.inc"); </tr> <tr> <td width="22%" valign="top" class="vncellreq">Destination</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>"> <br> <span class="vexpl">Destination<br> e.g. <em>1001</em></span></td> - </tr> + </tr> <tr> <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="optiondescr" type="text" class="formfld" id="optiondescr" size="40" value="<?=htmlspecialchars($pconfig['optiondescr']);?>"> <br> <span class="vexpl">You may enter a description here for your reference (not parsed).</span></td> @@ -189,21 +175,21 @@ include("head.inc"); <input name="ivrid" type="hidden" value="<?=$ivrid;?>"> <input name="parentid" type="hidden" value="<?=$parentid;?>"> <?php if (isset($id) && $a_ivr_options[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> + <input name="id" type="hidden" value="<?=$id;?>"> <?php endif; ?> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> </td> </tr> </table> </form> - + <br> <br> <br> <br> <br> <br> - + </td> </tr> </table> diff --git a/config/freeswitch/freeswitch_vars.tmp b/config/freeswitch/freeswitch_vars.tmp new file mode 100644 index 00000000..5e7a5744 --- /dev/null +++ b/config/freeswitch/freeswitch_vars.tmp @@ -0,0 +1,162 @@ +<?php +/* $Id$ */ +/* + freeswitch_vars.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + FreeSWITCH (TM) + http://www.freeswitch.org/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/freeswitch.inc"); + +//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config']; + +if ($_GET['a'] == "default") { + conf_mount_rw(); + exec("cp /usr/local/freeswitch/conf.orig/vars.xml /usr/local/freeswitch/conf/vars.xml"); + $savemsg = "Default Restored"; + conf_mount_ro(); +} + +if ($_POST['a'] == "save") { + conf_mount_rw(); + $content = ereg_replace("\r","",$_POST['code']); + $fd = fopen("/usr/local/freeswitch/conf/vars.xml", "w"); + fwrite($fd, $content); + fclose($fd); + $savemsg = "Saved"; + conf_mount_ro(); +} + + +$fd = fopen("/usr/local/freeswitch/conf/vars.xml", "r"); +$content = fread($fd, filesize("/usr/local/freeswitch/conf/vars.xml")); +fclose($fd); + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<script language="Javascript"> +function sf() { document.forms[0].savetopath.focus(); } +</script> +<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script> +<script language="Javascript" type="text/javascript"> + // initialisation + editAreaLoader.init({ + id: "code" // id of the textarea to transform + ,start_highlight: false + ,allow_toggle: false + ,language: "en" + ,syntax: "html" + ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" + ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql" + ,show_line_colors: true + }); +</script> + +<?php include("fbegin.inc"); ?> +<p class="pgtitle">FreeSWITCH: Variables</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> + + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="freeswitch_vars.php" method="post" name="iform" id="iform"> +<?php + +?> + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width='90%'><p><span class="vexpl"><span class="red"><strong>Variables<br> + </strong></span> + Define preprocessor variables here. Can be accessed in the xml configation with $${var_name}. + </p> + </td> + <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td> + </tr> + </table> + <br /> + <br /> + + <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea> + <br /> + <br /> + + <table width="98%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td>/usr/local/freeswitch/conf/vars.xml</td> + <td align='right'> + <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" /> + <input type="hidden" name="a" value="save" /> + <?php + echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_vars.php?a=default&f=vars.xml';\" />"; + ?> + </td> + </tr> + </table> + +</form> + +<br> +<br> + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/freeswitch/freeswitch_vars.xml b/config/freeswitch/freeswitch_vars.xml deleted file mode 100755 index 9a4e172c..00000000 --- a/config/freeswitch/freeswitch_vars.xml +++ /dev/null @@ -1,136 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - - freeswitch_vars.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>freeswitchvars</name> - <version>0.1</version> - <title>FreeSWITCH: Vars</title> - <aftersaveredirect>pkg_edit.php?xml=freeswitch_vars.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>External</text> - <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> - <tab> - <text>Gateways</text> - <url>/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Internal</text> - <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> - <tab> - <text>IVR</text> - <url>/freeswitch/freeswitch_ivr.php</url> - </tab> - <tab> - <text>Modules</text> - <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> - <tab> - <text>Public</text> - <url>/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Rec</text> - <url>/freeswitch/freeswitch_recordings.php</url> - </tab> - <tab> - <text>Status</text> - <url>/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> - <active/> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchvars</configpath> - <fields> - <field> - <fielddescr><b>Vars</b> <br /> <br />Define preprocessor variables here. Can be accessed in the xml configation with $${var_name}.</fielddescr> - <fieldname>vars_xml</fieldname> - <description><br />Path: /usr/local/freeswitch/conf/vars.xml <br /><br /></description> - <type>textarea</type> - <encoding>base64</encoding> - <wrap>off</wrap> - <size>30</size> - <cols>70</cols> - <rows>33</rows> - </field> - </fields> - <custom_php_command_before_form> - </custom_php_command_before_form> - <custom_php_after_head_command> - sync_package_freeswitch_vars(); - </custom_php_after_head_command> - <custom_php_after_form_command> - </custom_php_after_form_command> - <custom_php_validation_command> - </custom_php_validation_command> - <custom_php_resync_config_command> - sync_package_freeswitch_vars(); - </custom_php_resync_config_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch/mod_fax.so.1 b/config/freeswitch/mod_fax.so.1 Binary files differdeleted file mode 100755 index 68bd05d0..00000000 --- a/config/freeswitch/mod_fax.so.1 +++ /dev/null diff --git a/config/freeswitch/mod_shout.so.1 b/config/freeswitch/mod_shout.so.1 Binary files differdeleted file mode 100755 index 26d9b94b..00000000 --- a/config/freeswitch/mod_shout.so.1 +++ /dev/null diff --git a/config/freeswitch/please_enter_the_extension_number.wav b/config/freeswitch/please_enter_the_extension_number.wav Binary files differnew file mode 100644 index 00000000..d9384b0f --- /dev/null +++ b/config/freeswitch/please_enter_the_extension_number.wav diff --git a/config/freeswitch/please_enter_the_phone_number.wav b/config/freeswitch/please_enter_the_phone_number.wav Binary files differnew file mode 100644 index 00000000..9cb4057b --- /dev/null +++ b/config/freeswitch/please_enter_the_phone_number.wav diff --git a/config/freeswitch/please_enter_the_pin_number.wav b/config/freeswitch/please_enter_the_pin_number.wav Binary files differnew file mode 100644 index 00000000..107728a5 --- /dev/null +++ b/config/freeswitch/please_enter_the_pin_number.wav |