diff options
Diffstat (limited to 'config')
40 files changed, 17 insertions, 15617 deletions
diff --git a/config/freeswitch_dev/freeswitch.inc b/config/freeswitch_dev/freeswitch.inc deleted file mode 100644 index f6b46579..00000000 --- a/config/freeswitch_dev/freeswitch.inc +++ /dev/null @@ -1,3763 +0,0 @@ -<?php -/* $Id$ */ -/* -/* ========================================================================== */ -/* - freeswitch.inc - Copyright (C) 2008 Mark J Crane - 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. -*/ - -//ob_start("ob_gzhandler"); -$v_project_label = 'FreeSWITCH'; //FreeSWITCH (TM) http://www.freeswitch.org/ - -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"] == "/packages/freeswitch/freeswitch_settings.php") { $menu_selected = true; } - $tab_array[] = array(gettext("Settings"), $menu_selected, "/packages/freeswitch/freeswitch_settings.php"); - 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_fax.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_fax_edit.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; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations_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.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes_edit.php") { $menu_selected = true; } - if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes_details_edit.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() -{ - if (function_exists('com_create_guid')){ - return com_create_guid(); - }else{ - mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up. - $charid = strtoupper(md5(uniqid(rand(), true))); - $hyphen = chr(45);// "-" - $uuid = chr(123)// "{" - .substr($charid, 0, 8).$hyphen - .substr($charid, 8, 4).$hyphen - .substr($charid,12, 4).$hyphen - .substr($charid,16, 4).$hyphen - .substr($charid,20,12) - .chr(125);// "}" - return $uuid; - } -} -//echo guid(); - - -function pkg_is_service_running($servicename) -{ - exec("/bin/ps ax | awk '{ print $5 }'", $psout); - array_shift($psout); - foreach($psout as $line) { - $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); - } - if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { - return true; - } - else { - return false; - } -} - - -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++) { - $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; - } - - //get the interface ip addresses and try to connect to them - 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 - } - else { - //connected to the socket return the handle - - while (!feof($fp)) { - $buffer = fgets($fp, 1024); - usleep(100); //allow time for reponse - if (trim($buffer) == "Content-Type: auth/request") { - fputs($fp, "auth $password\n\n"); - break; - } - } - return $fp; - } - - } //end if interface_ip_address - } //end foreach -} //end function - - -function event_socket_request($fp, $cmd) -{ - if ($fp) { - fputs($fp, $cmd."\n\n"); - usleep(100); //allow time for reponse - - $response = ""; - $i = 0; - $contentlength = 0; - while (!feof($fp)) { - $buffer = fgets($fp, 4096); - 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)); - if ($temparray[0] == "Content-Length") { - $contentlength = trim($temparray[1]); - } - } - } - - usleep(100); //allow time for reponse - - //optional because of script timeout //don't let while loop become endless - if ($i > 10000) { break; } - - if ($contentlength > 0) { //is contentlength set - //stop reading if all content has been read. - if (strlen($response) >= $contentlength) { - break; - } - } - $i++; - } - - return $response; - } - else { - echo "no handle"; - } -} - - -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']; - $host = $config['interfaces']['lan']['ipaddr']; - - if (pkg_is_service_running('freeswitch')) { - $fp = event_socket_create($host, $port, $password); - $response = event_socket_request($fp, $cmd); - fclose($fp); - } - unset($host, $port, $password); - -} - -function byte_convert( $bytes ) { - - if ($bytes<=0) - return '0 Byte'; - - $convention=1000; //[1000->10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; -} - -function lan_sip_profile() -{ - global $config; - clearstatcache(); - - //if the lan directory does not exist then create it - if (!is_dir('/usr/local/freeswitch/conf/sip_profiles/lan/')) { - exec("mkdir /usr/local/freeswitch/conf/sip_profiles/lan/"); - } - - //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; - $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"; - $tmp .= " //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id\n"; - $tmp .= "\n"; - $tmp .= " var digitmaxlength = 0;\n"; - $tmp .= " var timeoutpin = 7500;\n"; - $tmp .= " var timeouttransfer = 7500;\n"; - $tmp .= " var objdate = new Date();\n"; - $tmp .= "\n"; - $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n"; - $tmp .= " var adjustoperator = \"-\"; //+ or -\n"; - $tmp .= "\n"; - $tmp .= " if (adjustoperator == \"-\") {\n"; - $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= " }\n"; - $tmp .= " if (adjustoperator == \"+\") {\n"; - $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " var Hours = objdate2.getHours();\n"; - $tmp .= " var Mins = objdate2.getMinutes();\n"; - $tmp .= " var Seconds = objdate2.getSeconds();\n"; - $tmp .= " var Month = objdate2.getMonth() + 1;\n"; - $tmp .= " var Date = objdate2.getDate();\n"; - $tmp .= " var Year = objdate2.getYear()\n"; - $tmp .= " var Day = objdate2.getDay()+1;\n"; - $tmp .= " var exit = false;\n"; - $tmp .= "\n"; - $tmp .= "\n"; - $tmp .= " function mycb( session, type, data, arg ) {\n"; - $tmp .= " if ( type == \"dtmf\" ) {\n"; - $tmp .= " //console_log( \"info\", \"digit: \"+data.digit+\"\\n\" );\n"; - $tmp .= " if ( data.digit == \"#\" ) {\n"; - $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n"; - $tmp .= " return( true );\n"; - $tmp .= " }\n"; - $tmp .= " dtmf.digits += data.digit;\n"; - $tmp .= "\n"; - $tmp .= " if ( dtmf.digits.length < digitmaxlength ) {\n"; - $tmp .= " return( true );\n"; - $tmp .= " }\n"; - $tmp .= " }\n"; - $tmp .= " return( false );\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " //console_log( \"info\", \"Recording Request\\n\" );\n"; - $tmp .= "\n"; - $tmp .= " var dtmf = new Object( );\n"; - $tmp .= " dtmf.digits = \"\";\n"; - $tmp .= "\n"; - $tmp .= " if ( session.ready( ) ) {\n"; - $tmp .= " session.answer( );\n"; - $tmp .= "\n"; - - $tmp .= "\n"; - $tmp .= " if (pin.length > 0) {\n"; - //$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 .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; - $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n"; - //$tmp .= " //console_log( \"info\", \"Recordings pin is correct\\n\" );\n"; - //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n"; - //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n"; - //$tmp .= " session.execute(\"speak\", \"Begin recording.\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/begin_recording.wav\", mycb, \"dtmf\");\n"; - $tmp .= " session.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"; - $tmp .= " else {\n"; - $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n"; - //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n"; - //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n"; - //$tmp .= " session.execute(\"speak\", \"Your pin number is incorect, goodbye.\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; - $tmp .= " }\n"; - $tmp .= " session.hangup();\n"; - $tmp .= "\n"; - $tmp .= " }"; - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); - -} - - -function sync_package_freeswitch_settings() -{ - - global $config; - if($config['installedpackages']['freeswitchsettings']['config'] != "") { - - 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); - 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); - - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - } -} - - -function sync_package_freeswitch_dialplan() -{ - - global $config; - - //using backup files rather than pfsense config.xml for this file - $config['installedpackages']['freeswitchpublic']['config'][0]['dialplan_default_xml'] = ""; - - //if(strlen($config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']) == 0) { - /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ - //$filename = "/usr/local/freeswitch/conf/dialplan/default.xml"; - //$fout = fopen($filename,"r"); - //$tmpxml = fread($fout, filesize($filename)); - //$config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml); - //unset($filename, $dialplan); - //fclose($fout); - //} - //else { - /* found the dialplan in the pfsense config.xml save it to default.xml. */ - //$fout = fopen("/usr/local/freeswitch/conf/dialplan/default.xml","w"); - //$tmpxml = $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']; - //fwrite($fout, base64_decode($tmpxml)); - //fclose($fout); - //unset($tmpxml); - //} - - //$cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - //unset($cmd); - -} - - -function sync_package_freeswitch_extensions() -{ - - global $config; - if($config['installedpackages']['freeswitchextensions']['config'] != "") { - - /* delete all old extensions to prepare for new ones */ - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/1*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/2*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/3*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/4*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/5*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/6*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/7*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/8*.xml"); - unlink_if_exists("/usr/local/freeswitch/conf/directory/default/9*.xml"); - - foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) { - if ($rowhelper['enabled'] != "false") { - $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); - - $tmpxml = "<include>\n"; - if (strlen($rowhelper['cidr']) == 0) { - $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\">\n"; - } - else { - $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\" cidr=\"" . $rowhelper['cidr'] . "\">\n"; - } - $tmpxml .= " <params>\n"; - $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n"; - $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"; - break; - case "false": - $tmpxml .= " <param name=\"vm-attach-file\" value=\"false\"/>\n"; - break; - default: - $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n"; - } - switch ($rowhelper['vm-keep-local-after-email']) { - case "true": - $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n"; - break; - case "false": - $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"false\"/>\n"; - break; - default: - $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n"; - } - $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"; - } - $tmpxml .= " </params>\n"; - $tmpxml .= " <variables>\n"; - $tmpxml .= " <variable name=\"toll_allow\" value=\"domestic,international,local\"/>\n"; - $tmpxml .= " <variable name=\"accountcode\" value=\"" . $rowhelper['accountcode'] . "\"/>\n"; - $tmpxml .= " <variable name=\"user_context\" value=\"" . $rowhelper['user_context'] . "\"/>\n"; - if (strlen($rowhelper['effective_caller_id_number']) > 0) { - $tmpxml .= " <variable name=\"effective_caller_id_name\" value=\"" . $rowhelper['effective_caller_id_name'] . "\"/>\n"; - $tmpxml .= " <variable name=\"effective_caller_id_number\" value=\"" . $rowhelper['effective_caller_id_number'] . "\"/>\n"; - } - if (strlen($rowhelper['outbound_caller_id_number']) > 0) { - $tmpxml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $rowhelper['outbound_caller_id_name'] . "\"/>\n"; - $tmpxml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $rowhelper['outbound_caller_id_number'] . "\"/>\n"; - } - if (strlen($rowhelper['sip-force-contact']) > 0) { - $tmpxml .= " <variable name=\"sip-force-contact\" value=\"" . $rowhelper['sip-force-contact'] . "\"/>\n"; - } - $tmpxml .= " </variables>\n"; - $tmpxml .= " </user>\n"; - $tmpxml .= "</include>\n"; - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); - } - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - - } -} - - -function sync_package_freeswitch_gateways() -{ - - global $config; - if($config['installedpackages']['freeswitchgateways']['config'] != "") { - - /* delete all old gateways to prepare for new ones */ - unlink_if_exists("/usr/local/freeswitch/conf/sip_profiles/external/*.xml"); - - foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) { - - if ($rowhelper['enabled'] != "false") { - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external/".$rowhelper['gateway'].".xml","w"); - - $tmpxml .= "<include>\n"; - $tmpxml .= " <gateway name=\"" . $rowhelper['gateway'] . "\">\n"; - if (strlen($rowhelper['username']) > 0) { - $tmpxml .= " <param name=\"username\" value=\"" . $rowhelper['username'] . "\"/>\n"; - } - if (strlen($rowhelper['auth-username']) > 0) { - $tmpxml .= " <param name=\"auth-username\" value=\"" . $rowhelper['auth-username'] . "\"/>\n"; - } - 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"; - } - if (strlen($rowhelper['from-user']) > 0) { - $tmpxml .= " <param name=\"from-user\" value=\"" . $rowhelper['from-user'] . "\"/>\n"; - } - if (strlen($rowhelper['from-domain']) > 0) { - $tmpxml .= " <param name=\"from-domain\" value=\"" . $rowhelper['from-domain'] . "\"/>\n"; - } - if (strlen($rowhelper['proxy']) > 0) { - $tmpxml .= " <param name=\"proxy\" value=\"" . $rowhelper['proxy'] . "\"/>\n"; - } - if (strlen($rowhelper['expire-seconds']) > 0) { - $tmpxml .= " <param name=\"expire-seconds\" value=\"" . $rowhelper['expire-seconds'] . "\"/>\n"; - } - if (strlen($rowhelper['register']) > 0) { - $tmpxml .= " <param name=\"register\" value=\"" . $rowhelper['register'] . "\"/>\n"; - } - - if (strlen($rowhelper['register-transport']) > 0) { - 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"; - } - if (strlen($rowhelper['extension']) > 0) { - $tmpxml .= " <param name=\"extension\" value=\"" . $rowhelper['extension'] . "\"/>\n"; - } - if (strlen($rowhelper['ping']) > 0) { - $tmpxml .= " <param name=\"ping\" value=\"" . $rowhelper['ping'] . "\"/>\n"; - } - if (strlen($rowhelper['context']) > 0) { - $tmpxml .= " <param name=\"context\" value=\"" . $rowhelper['context'] . "\"/>\n"; - } - if (strlen($rowhelper['caller-id-in-from']) > 0) { - $tmpxml .= " <param name=\"caller-id-in-from\" value=\"" . $rowhelper['caller-id-in-from'] . "\"/>\n"; - } - if (strlen($rowhelper['supress-cng']) > 0) { - $tmpxml .= " <param name=\"supress-cng\" value=\"" . $rowhelper['supress-cng'] . "\"/>\n"; - } - - $tmpxml .= " </gateway>\n"; - $tmpxml .= "</include>"; - - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); - } - - } - - $cmd = "api sofia profile external restart reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - - } - -} - - -function sync_package_freeswitch_modules() -{ - - global $config; - - 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"; - $tmpxml .= "\n"; - $tmpxml .= " <!-- Loggers (I'd load these first) -->\n"; - if ($rowhelper['mod_console'] == "enable"){ $tmpxml .= " <load module=\"mod_console\"/>\n"; } - if ($rowhelper['mod_logfile'] == "enable"){ $tmpxml .= " <load module=\"mod_logfile\"/>\n"; } - if ($rowhelper['mod_syslog'] == "enable"){ $tmpxml .= " <load module=\"mod_syslog\"/>\n"; } - $tmpxml .= "\n"; - if ($rowhelper['mod_yaml'] == "enable"){ $tmpxml .= " <load module=\"mod_yaml\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Multi-Faceted -->\n"; - $tmpxml .= " <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->\n"; - if ($rowhelper['mod_enum'] == "enable"){ $tmpxml .= " <load module=\"mod_enum\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- XML Interfaces -->\n"; - if ($rowhelper['mod_xml_rpc'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_rpc\"/>\n"; } - if ($rowhelper['mod_xml_curl'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_curl\"/>\n"; } - if ($rowhelper['mod_xml_cdr'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_cdr\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Event Handlers -->\n"; - if ($rowhelper['mod_cdr_csv'] == "enable"){ $tmpxml .= " <load module=\"mod_cdr_csv\"/>\n"; } - if ($rowhelper['mod_event_multicast'] == "enable"){ $tmpxml .= " <load module=\"mod_event_multicast\"/>\n"; } - if ($rowhelper['mod_event_socket'] == "enable"){ $tmpxml .= " <load module=\"mod_event_socket\"/>\n"; } - if ($rowhelper['mod_zeroconf'] == "enable"){ $tmpxml .= " <load module=\"mod_zeroconf\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Directory Interfaces -->\n"; - if ($rowhelper['mod_ldap'] == "enable"){ $tmpxml .= " <load module=\"mod_ldap\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Endpoints -->\n"; - if ($rowhelper['mod_dingaling'] == "enable"){ $tmpxml .= " <load module=\"mod_dingaling\"/>\n"; } - if ($rowhelper['mod_iax'] == "enable"){ $tmpxml .= " <load module=\"mod_iax\"/>\n"; } - if ($rowhelper['mod_portaudio'] == "enable"){ $tmpxml .= " <load module=\"mod_portaudio\"/>\n"; } - if ($rowhelper['mod_alsa'] == "enable"){ $tmpxml .= " <load module=\"mod_alsa\"/>\n"; } - if ($rowhelper['mod_sofia'] == "enable"){ $tmpxml .= " <load module=\"mod_sofia\"/>\n"; } - if ($rowhelper['mod_loopback'] == "enable"){ $tmpxml .= " <load module=\"mod_loopback\"/>\n"; } - if ($rowhelper['mod_wanpipe'] == "enable"){ $tmpxml .= " <load module=\"mod_wanpipe\"/>\n"; } - if ($rowhelper['mod_woomera'] == "enable"){ $tmpxml .= " <load module=\"mod_woomera\"/>\n"; } - if ($rowhelper['mod_openzap'] == "enable"){ $tmpxml .= " <load module=\"mod_openzap\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Applications -->\n"; - if ($rowhelper['mod_commands'] == "enable"){ $tmpxml .= " <load module=\"mod_commands\"/>\n"; } - if ($rowhelper['mod_conference'] == "enable"){ $tmpxml .= " <load module=\"mod_conference\"/>\n"; } - if ($rowhelper['mod_dptools'] == "enable"){ $tmpxml .= " <load module=\"mod_dptools\"/>\n"; } - if ($rowhelper['mod_expr'] == "enable"){ $tmpxml .= " <load module=\"mod_expr\"/>\n"; } - if ($rowhelper['mod_fax'] == "enable"){ $tmpxml .= " <load module=\"mod_fax\"/>\n"; } - if ($rowhelper['mod_fifo'] == "enable"){ $tmpxml .= " <load module=\"mod_fifo\"/>\n"; } - if ($rowhelper['mod_voicemail'] == "enable"){ $tmpxml .= " <load module=\"mod_voicemail\"/>\n"; } - if ($rowhelper['mod_limit'] == "enable"){ $tmpxml .= " <load module=\"mod_limit\"/>\n"; } - if ($rowhelper['mod_esf'] == "enable"){ $tmpxml .= " <load module=\"mod_esf\"/>\n"; } - if ($rowhelper['mod_fsv'] == "enable"){ $tmpxml .= " <load module=\"mod_fsv\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- SNOM Module -->\n"; - if ($rowhelper['mod_snom'] == "enable"){ $tmpxml .= " <load module=\"mod_snom\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Dialplan Interfaces -->\n"; - if ($rowhelper['mod_dialplan_directory'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_directory\"/>\n"; } - if ($rowhelper['mod_dialplan_xml'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_xml\"/>\n"; } - if ($rowhelper['mod_dialplan_asterisk'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_asterisk\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Codec Interfaces -->\n"; - if ($rowhelper['mod_voipcodecs'] == "enable"){ $tmpxml .= " <load module=\"mod_voipcodecs\"/>\n"; } - if ($rowhelper['mod_g723_1'] == "enable"){ $tmpxml .= " <load module=\"mod_g723_1\"/>\n"; } - if ($rowhelper['mod_g729'] == "enable"){ $tmpxml .= " <load module=\"mod_g729\"/>\n"; } - if ($rowhelper['mod_amr'] == "enable"){ $tmpxml .= " <load module=\"mod_amr\"/>\n"; } - if ($rowhelper['mod_ilbc'] == "enable"){ $tmpxml .= " <load module=\"mod_ilbc\"/>\n"; } - if ($rowhelper['mod_speex'] == "enable"){ $tmpxml .= " <load module=\"mod_speex\"/>\n"; } - if ($rowhelper['mod_siren'] == "enable"){ $tmpxml .= " <load module=\"mod_siren\"/>\n"; } - if ($rowhelper['mod_celt'] == "enable"){ $tmpxml .= " <load module=\"mod_celt\"/>\n"; } - if ($rowhelper['mod_h26x'] == "enable"){ $tmpxml .= " <load module=\"mod_h26x\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- File Format Interfaces -->\n"; - if ($rowhelper['mod_sndfile'] == "enable"){ $tmpxml .= " <load module=\"mod_sndfile\"/>\n"; } - if ($rowhelper['mod_native_file'] == "enable"){ $tmpxml .= " <load module=\"mod_native_file\"/>\n"; } - $tmpxml .= " <!--For icecast/mp3 streams/files-->\n"; - if ($rowhelper['mod_shout'] == "enable"){ $tmpxml .= " <load module=\"mod_shout\"/>\n"; } - $tmpxml .= " <!--For local streams (play all the files in a directory)-->\n"; - if ($rowhelper['mod_local_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_local_stream\"/>\n"; } - if ($rowhelper['mod_tone_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_tone_stream\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Timers -->\n"; - $tmpxml .= "\n"; - $tmpxml .= " <!-- Languages -->\n"; - if ($rowhelper['mod_spidermonkey'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey\"/>\n"; } - if ($rowhelper['mod_spidermonkey_odbc'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_odbc\"/>\n"; } - if ($rowhelper['mod_perl'] == "enable"){ $tmpxml .= " <load module=\"mod_perl\"/>\n"; } - if ($rowhelper['mod_python'] == "enable"){ $tmpxml .= " <load module=\"mod_python\"/>\n"; } - if ($rowhelper['mod_java'] == "enable"){ $tmpxml .= " <load module=\"mod_java\"/>\n"; } - if ($rowhelper['mod_lua'] == "enable"){ $tmpxml .= " <load module=\"mod_lua\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- ASR /TTS -->\n"; - if ($rowhelper['mod_flite'] == "enable"){ $tmpxml .= " <load module=\"mod_flite\"/>\n"; } - if ($rowhelper['mod_pocketsphinx'] == "enable"){ $tmpxml .= " <load module=\"mod_pocketsphinx\"/>\n"; } - if ($rowhelper['mod_cepstral'] == "enable"){ $tmpxml .= " <load module=\"mod_cepstral\"/>\n"; } - if ($rowhelper['mod_openmrcp'] == "enable"){ $tmpxml .= " <load module=\"mod_openmrcp\"/>\n"; } - if ($rowhelper['mod_rss'] == "enable"){ $tmpxml .= " <load module=\"mod_rss\"/>\n"; } - $tmpxml .= "\n"; - $tmpxml .= " <!-- Say -->\n"; - if ($rowhelper['mod_say_en'] == "enable"){ $tmpxml .= " <load module=\"mod_say_en\"/>\n"; } - if ($rowhelper['mod_say_de'] == "enable"){ $tmpxml .= " <load module=\"mod_say_de\"/>\n"; } - if ($rowhelper['mod_say_es'] == "enable"){ $tmpxml .= " <load module=\"mod_say_es\"/>\n"; } - if ($rowhelper['mod_say_fr'] == "enable"){ $tmpxml .= " <load module=\"mod_say_fr\"/>\n"; } - if ($rowhelper['mod_say_it'] == "enable"){ $tmpxml .= " <load module=\"mod_say_it\"/>\n"; } - if ($rowhelper['mod_say_nl'] == "enable"){ $tmpxml .= " <load module=\"mod_say_nl\"/>\n"; } - if ($rowhelper['mod_say_ru'] == "enable"){ $tmpxml .= " <load module=\"mod_say_ru\"/>\n"; } - if ($rowhelper['mod_say_zh'] == "enable"){ $tmpxml .= " <load module=\"mod_say_zh\"/>\n"; } - $tmpxml .= " </modules>\n"; - $tmpxml .= "</configuration>"; - - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - -} - - -function sync_package_freeswitch_public() -{ - - global $config; - - //using backup files rather than pfsense config.xml for this file - $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = ""; - - //if(strlen($config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']) == 0) { - // /* dialplan_public_xml not found in the pfsense config.xml get the default public.xml and save to config.xml. */ - // $filename = "/usr/local/freeswitch/conf/dialplan/public.xml"; - // $fout = fopen($filename,"r"); - // $tmpxml = fread($fout, filesize($filename)); - // $tmpxml = str_replace("<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>", "<!--<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>-->", $tmpxml); - // $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = base64_encode($tmpxml); - - // unset($filename, $tmpxml); - // fclose($fout); - //} - //else { - // /* found dialplan_public_xml in the pfsense config.xml save it to public.xml. */ - // $fout = fopen("/usr/local/freeswitch/conf/dialplan/public.xml","w"); - // $tmpxml = $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']; - // fwrite($fout, base64_decode($tmpxml)); - // fclose($fout); - // unset($tmpxml); - //} - - //$cmd = "api reloadxml"; - ////event_socket_request_cmd($cmd); - //unset($cmd); - -} - - -function sync_package_freeswitch_vars() -{ - - global $config; - - //using backup files rather than pfsense config.xml for this file - $config['installedpackages']['freeswitchpublic']['config'][0]['vars_xml'] = ""; - - //if(strlen($config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']) == 0) { - // /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ - // $filename = "/usr/local/freeswitch/conf/vars.xml"; - // $fout = fopen($filename,"r"); - // $tmpxml = fread($fout, filesize($filename)); - // $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml); - // unset($filename, $dialplan); - // fclose($fout); - //} - //else { - // /* found the dialplan in the pfsense config.xml save it to default.xml. */ - // $fout = fopen("/usr/local/freeswitch/conf/vars.xml","w"); - // $tmpxml = $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']; - // fwrite($fout, base64_decode($tmpxml)); - // fclose($fout); - // unset($tmpxml); - //} - - //$cmd = "api reloadxml"; - ////event_socket_request_cmd($cmd); - //unset($cmd); - -} - - -function sync_package_freeswitch_internal() -{ - global $config; - - if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) { - /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */ - $filename = "/usr/local/freeswitch/conf/sip_profiles/internal.xml"; - $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); - $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml); - unset($filename, $dialplan); - fclose($fout); - } - else { - /* found the internal_xml in the pfsense config.xml save it to internal.xml. */ - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/internal.xml","w"); - $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']; - fwrite($fout, base64_decode($tmpxml)); - fclose($fout); - unset($tmpxml); - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - -} - - -function sync_package_freeswitch_external() -{ - global $config; - - if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) { - /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */ - $filename = "/usr/local/freeswitch/conf/sip_profiles/external.xml"; - $fout = fopen($filename,"r"); - $tmpxml = fread($fout, filesize($filename)); - $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml); - unset($filename, $dialplan); - fclose($fout); - } - else { - /* found the external_xml in the pfsense config.xml save it to external.xml. */ - $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external.xml","w"); - $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']; - fwrite($fout, base64_decode($tmpxml)); - fclose($fout); - unset($tmpxml); - } - - $cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - unset($cmd); - -} - - -function sync_package_freeswitch_hunt_group() -{ - - //Hunt Group Javascript Notes: - //get the domain - //loop through all Hunt Groups - //get the Hunt Group information such as the name and description - //add each Hunt Group to the dialplan - //get the list of destinations then build the Hunt Group javascript - - - global $config; - - //get the domain - $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; - $host = $config['interfaces']['lan']['ipaddr']; - $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; - - if (pkg_is_service_running('freeswitch')) { - $fp = event_socket_create($host, $port, $password); - $cmd = "api global_getvar domain"; - $domain = trim(event_socket_request($fp, $cmd)); - } - - $tmp = ""; - $tmp .= "\n"; - $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n"; - //$tmp .= " var exit = false;\n"; - $tmp .= "\n"; - $tmp .= "\n"; - - //loop through all Hunt Groups - $x = 0; - $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config']; - if (count($a_hunt_group) > 0) { - foreach($a_hunt_group as $rowhelper) { - - //get the Hunt Group information such as the name and description - //$rowhelper['huntgroupid'] - //$rowhelper['huntgroupextension'] - //$rowhelper['huntgroupname'] - //$rowhelper['huntgrouptype'] - //$rowhelper['huntgrouptimeout'] - //$rowhelper['huntgroupcontext'] - //$rowhelper['huntgroupringback'] - //$rowhelper['huntgroupcidnameprefix'] - //$rowhelper['huntgrouppin'] - //$rowhelper['huntgroupcallerannounce'] - //$rowhelper['huntgroupdescr'] - - //add each Hunt Group to the dialplan - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - if (strlen($rowhelper['huntgroupid']) > 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']; - - if ($row['opt1name'] == "huntgroupid" && $row['opt1value'] == $rowhelper['huntgroupid']) { - $action = 'update'; - $dialplanincludeid = $row['dialplanincludeid']; - $extensionname = $row['extensionname']; - $order = $row['order']; - $context = $row['context']; - $enabled = $row['enabled']; - $descr = $row['descr']; - $opt1name = $row['opt1name']; - $opt1value = $row['opt1value']; - $id = $i; - } - $i++; - } - unset($i); - } - - - $ent = array(); - if ($action == 'add') { - //create huntgroup extension in the dialplan - $ent = array(); - $dialplanincludeid = guid(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['huntgroupname']; - $ent['order'] = '9001'; //if update use the existing order number and extension name and desc - $ent['context'] = $rowhelper['huntgroupcontext']; - $ent['enabled'] = 'true'; - $ent['descr'] = 'huntgroup'; - $ent['opt1name'] = 'huntgroupid'; - $ent['opt1value'] = $rowhelper['huntgroupid']; - - $a_dialplan_includes[] = $ent; //add to the config - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^'.$rowhelper['huntgroupextension'].'$'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - $huntgroupid = str_replace(array("{", "}"), "", $rowhelper['huntgroupid']); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'javascript'; - $ent['fielddata'] = 'huntgroup_'.$huntgroupid.'.js'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - unset($huntgroupid); - - } - if ($action == 'update') { - //update the huntgroup - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['huntgroupname']; - $ent['order'] = $order; - $ent['context'] = $context; - $ent['enabled'] = $enabled; - $ent['descr'] = $descr; - $ent['opt1name'] = $opt1name; - $ent['opt1value'] = $opt1value; - - //update the config - $a_dialplan_includes[$id] = $ent; - - unset($ent); - unset($extensionname); - unset($order); - unset($context); - unset($enabled); - unset($descr); - unset($opt1name); - unset($opt1value); - unset($id); - } - unset($action); - unset($dialplanincludeid); - - //check whether the fifo queue exists already - $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']; - - if ($row['opt1name'] == "huntgroupfifoid" && $row['opt1value'] == $rowhelper['huntgroupid']) { - $action = 'update'; - $dialplanincludeid = $row['dialplanincludeid']; - $extensionname = $row['extensionname']; - $order = $row['order']; - $context = $row['context']; - $enabled = $row['enabled']; - $descr = $row['descr']; - $opt1name = $row['opt1name']; - $opt1value = $row['opt1value']; - $id = $i; - } - $i++; - } - unset($i); - } - - if ($action == 'add') { - - //create a fifo queue for each huntgroup - $ent = array(); - $dialplanincludeid = guid(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['huntgroupname'].'.park'; - $ent['order'] = '9999'; //if update use the existing order number and extension name and desc - $ent['context'] = $rowhelper['huntgroupcontext']; - $ent['enabled'] = 'true'; - $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension']; - $ent['opt1name'] = 'huntgroupfifoid'; - $ent['opt1value'] = $rowhelper['huntgroupid']; - $a_dialplan_includes[] = $ent; //add to the config - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$'; - $ent['fieldorder'] = '000'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'fifo_music=$${hold_music}'; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - - $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype']; - $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination']; - if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; } - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout']; - $ent['fieldorder'] = '002'; - $a_dialplan_include_details[] = $ent; - unset($ent); //add to the config - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'fifo'; - $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in'; - $ent['fieldorder'] = '003'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - } - if ($action == 'update') { - //update the huntgroup - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['huntgroupname'].'.park'; - $ent['order'] = $order; - $ent['context'] = $rowhelper['huntgroupcontext']; - $ent['enabled'] = $enabled; - $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension']; - $ent['opt1name'] = $opt1name; - $ent['opt1value'] = $opt1value; - - //update the config - $a_dialplan_includes[$id] = $ent; - - unset($ent); - unset($extensionname); - unset($order); - unset($context); - unset($enabled); - unset($descr); - unset($opt1name); - unset($opt1value); - unset($id); - - //delete dialplan include details - if (count($a_dialplan_include_details) > 0) { - foreach($a_dialplan_include_details as $row) { - if ($row['dialplanincludeid'] == $dialplanincludeid) { - $id = $i; - unset($a_dialplan_include_details[$id]); - } - $i++; - } - unset($i); - } - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$'; - $ent['fieldorder'] = '000'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'fifo_music=$${hold_music}'; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - - $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype']; - $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination']; - if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; } - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout']; - $ent['fieldorder'] = '002'; - $a_dialplan_include_details[] = $ent; - unset($ent); //add to the config - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'fifo'; - $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in'; - $ent['fieldorder'] = '003'; - $a_dialplan_include_details[] = $ent; //add to the config - unset($ent); - } - - write_config(); - sync_package_freeswitch_dialplan_includes(); - unset($dialplanincludeid); - - } //end if strlen huntgroupid; add the Hunt Group to the dialplan - - - - //Get the list of destinations then build the Hunt Group javascript - $tmp = ""; - $tmp .= "\n"; - $tmp .= "session.answer();\n"; - $tmp .= "var domain_name = session.getVariable(\"domain_name\");\n"; - $tmp .= "var extension = '".$rowhelper['huntgroupextension']."';\n"; - $tmp .= "var result;\n"; - $tmp .= "var timeoutpin = 7500;\n"; - $tmp .= "\n"; - $tmp .= "var objdate = new Date();\n"; - $tmp .= "var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n"; - $tmp .= "var adjustoperator = \"-\"; //+ or -\n"; - $tmp .= "if (adjustoperator == \"-\") {\n"; - $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= "}\n"; - $tmp .= "if (adjustoperator == \"+\") {\n"; - $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= "}\n"; - $tmp .= "var Hours = objdate2.getHours();\n"; - $tmp .= "var Mins = objdate2.getMinutes();\n"; - $tmp .= "var Seconds = objdate2.getSeconds();\n"; - $tmp .= "var Month = objdate2.getMonth() + 1;\n"; - $tmp .= "var Date = objdate2.getDate();\n"; - $tmp .= "var Year = objdate2.getYear()\n"; - $tmp .= "var Day = objdate2.getDay()+1;\n"; - $tmp .= "var exit = false;\n"; - $tmp .= "\n"; - - $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n"; - $tmp .= " if (profile == \"auto\") {\n"; - $i = 0; - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ - $sip_profile_name = str_replace(".xml", "", $sip_profile_file); - if ($i == 0) { - $tmp .= " profile = \"".$sip_profile_name."\";\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - } - else { - $tmp .= "\n"; - $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n"; - $tmp .= " profile = \"".$sip_profile_name."\";\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - $tmp .= " }\n"; - } - $i++; - } - unset ($i); - $tmp .= " }\n"; - $tmp .= " else {\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - $tmp .= " }\n"; - $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n"; - $tmp .= " return sofia_contact;\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - - $tmp .= "\n"; - $tmp .= " function mycb( session, type, obj, arg ) {\n"; - $tmp .= " try {\n"; - $tmp .= " if ( type == \"dtmf\" ) {\n"; - $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n"; - $tmp .= " if ( obj.digit == \"#\" ) {\n"; - $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n"; - $tmp .= " exit = true;\n"; - $tmp .= " return( false );\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " dtmf.digits += obj.digit;\n"; - $tmp .= "\n"; - $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n"; - $tmp .= " exit = true;\n"; - $tmp .= " return( false );\n"; - $tmp .= " }\n"; - $tmp .= " }\n"; - $tmp .= " } catch (e) {\n"; - $tmp .= " console_log( \"err\", e+\"\\n\" );\n"; - $tmp .= " }\n"; - $tmp .= " return( true );\n"; - $tmp .= " } //end function mycb\n"; - $tmp .= "\n"; - - $tmp .= "\n"; - $tmp .= "dialed_extension = session.getVariable(\"dialed_extension\");\n"; - $tmp .= "domain_name = session.getVariable(\"domain_name\");\n"; - $tmp .= "domain = session.getVariable(\"domain\");\n"; - $tmp .= "us_ring = session.getVariable(\"us-ring\");\n"; - $tmp .= "caller_id_name = session.getVariable(\"caller_id_name\");\n"; - $tmp .= "caller_id_number = session.getVariable(\"caller_id_number\");\n"; - $tmp .= "effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n"; - $tmp .= "effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n"; - $tmp .= "outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n"; - $tmp .= "outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n"; - $tmp .= "\n"; - - - //pin number requested from caller if provided - if (strlen($rowhelper['huntgrouppin']) > 0) { - $tmp .= "var pin = '".$rowhelper['huntgrouppin']."';\n"; - $tmp .= "if (pin.length > 0) {\n"; - $tmp .= " var dtmf = new Object();\n"; - $tmp .= " dtmf.digits = \"\";\n"; - $tmp .= " digitmaxlength = 6;\n"; - $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n"; - $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n"; - $tmp .= "\n"; - $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n"; - $tmp .= " //continue\n"; - $tmp .= " }\n"; - $tmp .= " else {\n"; - $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n"; - $tmp .= " session.hangup();\n"; - $tmp .= " }\n"; - $tmp .= "}\n"; - $tmp .= "\n"; - } - - //caller announce requested from caller if provided - if ($rowhelper['huntgroupcallerannounce'] == "true") { - $tmp .= "function originate(session, sipuri, extension, caller_announce, caller_id_name, caller_id_number) {\n"; - $tmp .= " caller_id_name = caller_id_name.replace(\" \", \"+\");\n"; - $tmp .= " apiExecute(\"jsrun\", \"originate.js \"+session.uuid+\" \"+sipuri+\" \"+extension+\" \"+caller_announce+\" \"+caller_id_name+\" \"+caller_id_number);\n"; - $tmp .= "}"; - $tmp .= "\n"; - $tmp .= "var caller_announce = extension+\"_\"+Year+Month+Day+Hours+Mins+Seconds+\".wav\";\n"; - $tmp .= "session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_say_your_name_and_reason_for_calling.wav\");\n"; - $tmp .= "session.execute(\"gentones\", \"%(1000, 0, 640)\");\n"; - $tmp .= "session.execute(\"set\", \"playback_terminators=#\");\n"; - $tmp .= "session.execute(\"record\", \"/tmp/\"+caller_announce+\" 180 200\");\n"; - $tmp .= "\n"; - $tmp .= "result = session.setAutoHangup(false);\n"; - $tmp .= "session.execute(\"transfer\", \"*\"+extension+\" XML default\");\n"; - $tmp .= "\n"; - } - - //set caller id prefix - if (strlen($rowhelper['huntgroupcidnameprefix'])> 0) { - $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+caller_id_name);\n"; - $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+effective_caller_id_name);\n"; - $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+outbound_caller_id_name);\n"; - } - - //set ring back - if (isset($rowhelper['huntgroupringback'])){ - if ($rowhelper['huntgroupringback'] == "ring"){ - $tmp .= "session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n"; - $tmp .= "session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n"; - } - if ($rowhelper['huntgroupringback'] == "music"){ - $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n"; - $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n"; - } - } - else { - $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n"; - $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n"; - } - - if ($rowhelper['huntgrouptimeout'] > 0) { - $tmp .= "session.execute(\"set\", \"call_timeout=".$rowhelper['huntgrouptimeout']."\");\n"; - $tmp .= "session.execute(\"set\", \"continue_on_fail=true\");\n"; - } - $tmp .= "session.execute(\"set\", \"hangup_after_bridge=true\");\n"; - $tmp .= "\n"; - $tmp .= "//console_log( \"info\", \"dialed extension:\"+dialed_extension+\".\\n\" );\n"; - $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n"; - $tmp .= "//console_log( \"info\", \"us_ring: \"+us_ring+\".\\n\" );\n"; - $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n"; - $tmp .= "//console_log( \"info\", \"domain_name: \"+domain_name+\".\\n\" );\n"; - $tmp .= "\n"; - - $tmp .= "//console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n"; - if ($rowhelper['huntgroupcallerannounce'] == "true") { - //do nothing - } - else { - $tmp .= "if ( session.ready() ) {\n"; - $tmp .= " session.answer();\n"; - } - $tmp .= "\n"; - - $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config']; - if (isset($id) && $a_hunt_group[0]) { - $huntgrouptimeout = $a_hunt_group[$id]['huntgrouptimeout']; - $huntgrouptimeoutdestination = $a_hunt_group[$id]['huntgrouptimeoutdestination']; - } - - //order the array - if (!function_exists(cmp_hunt_group_order)) { - function cmp_hunt_group_order($a, $b) { - if ($a["destinationorder"] > $b["destinationorder"]) { - return 1; - } - else { - return 0; - } - } - } - - - $a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config']; - if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_hunt_group_order"); } - if (count($a_hunt_group_destinations) > 0) { - - $i = 0; - foreach($a_hunt_group_destinations as $row) { - - /* - $row['huntgroupid'] - $row['destinationnumber'] - $row['destinationtype'] - $row['destinationprofile'] - $row['destinationorder'] - $row['destinationdescr'] - */ - - if ($row['huntgroupid'] == $rowhelper['huntgroupid']) { - - //set the default profile - if (strlen($row['destinationnumber']) == 0) { $row['destinationnumber'] = "internal"; } - - if ($row['destinationtype'] == "extension") { - $tmp .= "sofia_contact_".$row['destinationnumber']." = get_sofia_contact(\"".$row['destinationnumber']."\",domain_name, \"".$row['destinationprofile']."\");\n"; - $tmp_sub_array["application"] = "bridge"; - $tmp_sub_array["data"] = "sofia_contact_".$row['destinationnumber']; - $tmp_array[$i] = $tmp_sub_array; - unset($tmp_sub_array); - } - if ($row['destinationtype'] == "voicemail") { - $tmp_sub_array["application"] = "voicemail"; - $tmp .= "session.execute(\"voicemail\", \"default \${domain} ".$row['destinationnumber']."\");\n"; - //$tmp_sub_array["application"] = "voicemail"; - //$tmp_sub_array["data"] = "default \${domain} ".$row['destinationnumber']; - //$tmp_array[$i] = $tmp_sub_array; - unset($tmp_sub_array); - } - if ($row['destinationtype'] == "sip uri") { - $tmp_sub_array["application"] = "bridge"; - $tmp_sub_array["data"] = "\"".$row['destinationnumber']."\""; - $tmp_array[$i] = $tmp_sub_array; - unset($tmp_sub_array); - } - $i++; - - } //end huntgroupid - - } //end for each - unset($i); - } //if count - - $i = 0; - if(count($tmp_array) > 0) { - foreach ($tmp_array as $row) { - $tmpdata = $row["data"]; - if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; } - if ($i < 1) { - $tmp_buffer = $tmpdata; - } - else { - $tmp_buffer .= "+\",\"+".$tmpdata; - } - $i++; - } - } - unset($i); - $delimiter = ","; - $tmp_application = $tmp_array[0]["application"]; - - switch ($rowhelper['huntgrouptype']) { - case "simultaneous": - //print_r($tmp_array); - if ($rowhelper['huntgroupcallerannounce'] == "true") { - $i = 0; - if (count($tmp_array) > 0) { - foreach ($tmp_array as $row) { - $tmpdata = $row["data"]; - if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; } - $tmp .= " result = originate (session, ".$tmpdata.", extension, caller_announce, caller_id_name, caller_id_number);\n"; - } - } - } - else { - $tmp .= "\n"; - $tmp .= " session.execute(\"".$tmp_application."\", $tmp_buffer);\n"; - //$tmp .= " session.execute(\"bridge\", sofia_contact_100+\",\"+sofia_contact_101+\",\"+sofia_contact_102+\",\"+sofia_contact_103+\",\"+sofia_contact_104);\n"; - //$tmp .= " //session.execute(\"bridge\", \"sofia/gateway/flowroute.com/12081231234,\"+sofia_contact_101);\n"; - } - unset($tmp_array); - break; - case "sequentially": - - $tmp .= "\n"; - //print_r($tmp_array); - $i = 0; - if (count($tmp_array) > 0) { - if ($rowhelper['huntgroupcallerannounce'] == "true") { - $i = 0; - if (count($tmp_array) > 0) { - //foreach ($tmp_array as $row) { - //$tmpdata = $row["data"]; - //if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; } - $tmp .= " result = originate (session, ".$tmp_buffer.", extension, caller_announce, caller_id_name, caller_id_number);\n"; - //} - } - } - else { - foreach ($tmp_array as $row) { - $tmp .= " session.execute(\"".$row["application"]."\", ".$row["data"].");\n"; - } - } - unset($tmp_array); - } - - break; - } - - //set the timeout destination - $huntgrouptimeoutdestination = $a_hunt_group[$x]['huntgrouptimeoutdestination']; - $huntgrouptimeouttype = $a_hunt_group[$x]['huntgrouptimeouttype']; - if ($row['huntgrouptimeouttype'] == "extension") { $huntgrouptimeouttype = "bridge"; } - if ($row['huntgrouptimeouttype'] == "voicemail") { $huntgrouptimeouttype = "voicemail"; } - if ($row['huntgrouptimeouttype'] == "sip uri") { $huntgrouptimeouttype = "bridge"; } - $tmp .= "\n"; - if ($rowhelper['huntgroupcallerannounce'] == "true") { - //do nothing - } - else { - $tmp .= " //timeout\n"; - $tmp .= " session.execute(\"".$huntgrouptimeouttype."\", \"default \${domain} ".$huntgrouptimeoutdestination."\");\n"; - } - - $tmp .= "\n"; - $tmp .= " //clear variables\n"; - $tmp .= " dialed_extension = \"\";\n"; - $tmp .= " new_extension = \"\";\n"; - $tmp .= " domain_name = \"\";\n"; - $tmp .= " domain = \"\";"; - - $tmp .= "\n"; - if ($rowhelper['huntgroupcallerannounce'] == "true") { - //do nothing - } - else { - $tmp .= "} //end if session.ready\n"; - } - $tmp .= "\n"; - - if (strlen($rowhelper['huntgroupid']) > 0) { - $huntgroupfilename = "huntgroup_".str_replace(array("{", "}"), "", $rowhelper['huntgroupid']).".js"; - $fout = fopen("/usr/local/freeswitch/scripts/".$huntgroupfilename,"w"); - fwrite($fout, $tmp); - unset($huntgroupfilename); - fclose($fout); - } - - $x++; - } //end foreach - } //end if count - -} //end function - - -function sync_package_freeswitch_fax() -{ - - global $config; - - //loop through all faxes - $a_fax = &$config['installedpackages']['freeswitchfax']['config']; - if (count($a_fax) > 0) { - foreach($a_fax as $rowhelper) { - - //get the fax information such as the name and description - //$rowhelper['faxid'] - //$rowhelper['faxextension'] - //$rowhelper['faxname'] - //$rowhelper['faxemail'] - //$rowhelper['faxdomain'] - //$rowhelper['faxdescription'] - - //add each fax extension to the dialplan - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - //determine if the entry should be an add, or update to the dialplan - if (strlen($rowhelper['faxid']) > 0) { - $action = 'add'; //set default action to add - $i = 0; - if (count($a_dialplan_includes) > 0) { - - foreach($a_dialplan_includes as $row) { - - //$row['faxid']; - //$row['faxname']; - //$row['context']; - //$row['enabled']; - - if ($row['opt1name'] == "faxid" && $row['opt1value'] == $rowhelper['faxid']) { - //update - $action = 'update'; - - $dialplanincludeid = $rowhelper['dialplanincludeid']; - $extensionname = $row['extensionname']; - $order = $row['order']; - $context = $row['context']; - $enabled = $row['enabled']; - $descr = $row['descr']; - $opt1name = $row['opt1name']; - $opt1value = $row['opt1value']; - $id = $i; - //echo "update".$i."<br />\n"; - - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml"); - } - } - $i++; - - } - } - - $ent = array(); - if ($action == 'add') { - $faxid = $rowhelper['faxid']; - if (strlen($rowhelper['faxname']) > 0) { - $ent['dialplanincludeid'] = $faxid; - $ent['extensionname'] = $rowhelper['faxname']; - $ent['order'] = '9001'; //if update use the existing order number and extension name and desc - $ent['context'] = "default"; - //$ent['context'] = $rowhelper['huntgroupcontext']; - $ent['enabled'] = 'true'; - $ent['descr'] = 'fax'; - $ent['opt1name'] = 'faxid'; - $ent['opt1value'] = $rowhelper['faxid']; - - //add to the config - $a_dialplan_includes[] = $ent; - unset($ent); - - //<!-- default ${domain_name} --> - //<condition field="destination_number" expression="^\*9978$"> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldorder'] = '000'; - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^'.$rowhelper['faxextension'].'$'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="answer" /> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '001'; - $ent['fieldtype'] = 'answer'; - $ent['fielddata'] = ''; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="playback" data="silence_stream://2000"/> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '002'; - $ent['fieldtype'] = 'playback'; - $ent['fielddata'] = 'silence_stream://2000'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="set" data="last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}"/> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '003'; - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="rxfax" data="/usr/local/freeswitch/storage/fax/inbox/${last_fax}.tif"/> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '004'; - $ent['fieldtype'] = 'rxfax'; - $ent['fielddata'] = '/usr/local/freeswitch/storage/fax/'.$rowhelper['faxextension'].'/inbox/${last_fax}.tif'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="system" data="/opt/freeswitch/scripts/emailfax.sh USER DOMAIN /usr/local/freeswitch/storage/fax/inbox/9872/${last_fax}.tif"/> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '005'; - $ent['fieldtype'] = 'system'; - $ent['fielddata'] = '/usr/local/bin/php /usr/local/www/packages/freeswitch/fax_to_email.php email='.$rowhelper['faxemail'].' extension='.$rowhelper['faxextension'].' name=${last_fax} >> /tmp/fax.txt'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - //<action application="hangup"/> - $ent = array(); - $ent['dialplanincludeid'] = $faxid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldorder'] = '006'; - $ent['fieldtype'] = 'hangup'; - $ent['fielddata'] = ''; - $a_dialplan_include_details[] = $ent; - unset($ent); - } - - unset($faxid); - - } - if ($action == 'update') { - - $ent['dialplanincludeid'] = $rowhelper['faxid']; - $ent['extensionname'] = $rowhelper['faxname']; - $ent['order'] = $order; - $ent['context'] = $context; - $ent['enabled'] = $enabled; - $ent['descr'] = $faxdescription; - $ent['opt1name'] = $opt1name; - $ent['opt1value'] = $opt1value; - - //update the config - $a_dialplan_includes[$id] = $ent; - - unset($ent); - unset($extensionname); - unset($order); - unset($context); - unset($enabled); - unset($descr); - unset($opt1name); - unset($opt1value); - unset($id); - } - write_config(); - - sync_package_freeswitch_dialplan_includes(); - unset($dialplanincludeid); - - } //end if strlen faxid; add the fax to the dialplan - - } //end foreach - } //end if count - -} //end function - - -function get_recording_filename($id) -{ - global $config; - $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; - if (count($a_recordings) > 0) { - global $config; - foreach($a_recordings as $rowhelper) { - if ($rowhelper['recordingid'] == $id) { - return $rowhelper['filename']; - } - } - } -} - - -function sync_package_freeswitch_ivr() -{ - - global $config; - - $a_ivr = &$config['installedpackages']['freeswitchivr']['config']; - if (count($a_ivr) > 0) { - foreach($a_ivr as $rowhelper) { - - /* - $rowhelper['ivrid'] - $rowhelper['ivrextension'] - $rowhelper['ivrname'] - $rowhelper['recordingid'] - $rowhelper['ivrtimeout'] - $rowhelper['ivrcalltimeout'] - $rowhelper['ivrcontext'] - $rowhelper['ivrdirectdial'] - $rowhelper['ivrconditionjs'] - $rowhelper['ivrringback'] - $rowhelper['ivrcidnameprefix'] - $rowhelper['ivrdescr'] - */ - - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['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'; - $dialplanincludeid = $row['dialplanincludeid']; - $extensionname = $row['extensionname']; - $order = $row['order']; - $context = $row['context']; - $enabled = $row['enabled']; - $descr = $row['descr']; - $opt1name = $row['opt1name']; - $opt1value = $row['opt1value']; - $id = $i; - //echo "update".$i."<br />\n"; - - } - $i++; - - } //end foreach - } //if count - - - $ent = array(); - if ($action == 'add') { - - $dialplanincludeid = guid(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['ivrextension']; - $ent['order'] = '9001'; //if update use the existing order number and extension name and desc - $ent['context'] = $rowhelper['ivrcontext']; - $ent['enabled'] = 'true'; - $ent['descr'] = 'IVR'; - $ent['opt1name'] = 'ivrid'; - $ent['opt1value'] = $rowhelper['ivrid']; - - //add to the config - $a_dialplan_includes[] = $ent; - unset($ent); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = '^'.$rowhelper['ivrextension'].'$'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - $ivrid = str_replace(array("{", "}"), "", $rowhelper['ivrid']); - - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'javascript'; - $ent['fielddata'] = 'ivr_'.$ivrid.'.js'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - unset($ivrid); - - } - if ($action == 'update') { - - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['extensionname'] = $rowhelper['ivrextension']; - $ent['order'] = $order; - $ent['context'] = $context; - $ent['enabled'] = $enabled; - $ent['descr'] = $descr; - $ent['opt1name'] = $opt1name; - $ent['opt1value'] = $opt1value; - - //update the config - $a_dialplan_includes[$id] = $ent; - - unset($ent); - unset($extensionname); - unset($order); - unset($context); - unset($enabled); - unset($descr); - unset($opt1name); - unset($opt1value); - unset($id); - } - write_config(); - - sync_package_freeswitch_dialplan_includes(); - 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']); - - $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; - $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; - $host = $config['interfaces']['lan']['ipaddr']; - - if (pkg_is_service_running('freeswitch')) { - $fp = event_socket_create($host, $port, $password); - $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"; - $tmp .= "\n"; - $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n"; - $tmp .= " var digitmaxlength = 0;\n"; - $tmp .= " var objdate = new Date();\n"; - $tmp .= "\n"; - $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n"; - $tmp .= " var adjustoperator = \"-\"; //+ or -\n"; - $tmp .= "\n"; - $tmp .= " if (adjustoperator == \"-\") {\n"; - $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= " }\n"; - $tmp .= " if (adjustoperator == \"+\") {\n"; - $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " var Hours = objdate2.getHours();\n"; - $tmp .= " var Mins = objdate2.getMinutes();\n"; - $tmp .= " var Seconds = objdate2.getSeconds();\n"; - $tmp .= " var Month = objdate2.getMonth() + 1;\n"; - $tmp .= " var Date = objdate2.getDate();\n"; - $tmp .= " var Year = objdate2.getYear()\n"; - $tmp .= " var Day = objdate2.getDay()+1;\n"; - $tmp .= " var exit = false;\n"; - $tmp .= "\n"; - $tmp .= " dialed_extension = session.getVariable(\"dialed_extension\");\n"; - $tmp .= " domain_name = session.getVariable(\"domain_name\");\n"; - $tmp .= " domain = session.getVariable(\"domain\");\n"; - $tmp .= " us_ring = session.getVariable(\"us-ring\");\n"; - $tmp .= " caller_id_name = session.getVariable(\"caller_id_name\");\n"; - $tmp .= " caller_id_number = session.getVariable(\"caller_id_number\");\n"; - $tmp .= " effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n"; - $tmp .= " effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n"; - $tmp .= " outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n"; - $tmp .= " outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n"; - $tmp .= "\n"; - - //set caller id prefix - if (strlen($rowhelper['ivrcidnameprefix'])> 0) { - $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+caller_id_name);\n"; - $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+effective_caller_id_name);\n"; - $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+outbound_caller_id_name);\n"; - } - - $tmp .= "\n"; - - $tmp .= " session.execute(\"set\", \"continue_on_fail=true\");\n"; - if (strlen($rowhelper['ivrcalltimeout']) == 0){ - $tmp .= " session.execute(\"set\", \"call_timeout=30\");\n"; //ivrcalltimeout - } - else { - $tmp .= " session.execute(\"set\", \"call_timeout=".$rowhelper['ivrcalltimeout']."\");\n"; //ivrcalltimeout - } - - if (isset($rowhelper['ivrringback'])){ - if ($rowhelper['ivrringback'] == "ring"){ - $tmp .= " session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n"; - $tmp .= " session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n"; - } - if ($rowhelper['ivrringback'] == "music"){ - $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n"; - $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n"; - } - } - else { - $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n"; - $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n"; - } - $tmp .= "\n"; - $tmp .= "//console_log( \"info\", \"IVR Server Time is: \"+Hours+\":\"+Mins+\" \\n\" );\n"; - $tmp .= "\n"; - - $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n"; - $tmp .= " if (profile == \"auto\") {\n"; - $i = 0; - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ - $sip_profile_name = str_replace(".xml", "", $sip_profile_file); - if ($i == 0) { - $tmp .= " profile = \"".$sip_profile_name."\";\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - } - else { - $tmp .= "\n"; - $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n"; - $tmp .= " profile = \"".$sip_profile_name."\";\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - $tmp .= " }\n"; - } - $i++; - } - unset ($i); - $tmp .= " }\n"; - $tmp .= " else {\n"; - $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n"; - $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n"; - $tmp .= " }\n"; - $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n"; - $tmp .= " return sofia_contact;\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - - $tmp .= " function mycb( session, type, obj, arg ) {\n"; - $tmp .= " try {\n"; - $tmp .= " if ( type == \"dtmf\" ) {\n"; - $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n"; - $tmp .= " if ( obj.digit == \"#\" ) {\n"; - $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n"; - $tmp .= " exit = true;\n"; - $tmp .= " return( false );\n"; - $tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " dtmf.digits += obj.digit;\n"; - $tmp .= "\n"; - $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n"; - $tmp .= " exit = true;\n"; - $tmp .= " return( false );\n"; - $tmp .= " }\n"; - $tmp .= " }\n"; - $tmp .= " } catch (e) {\n"; - $tmp .= " console_log( \"err\", e+\"\\n\" );\n"; - $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; - $actiondefault = false; - $actioncount = 0; - 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") { - $actioncount++; - if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf - //echo "now found\n"; - $actiondirect = true; - $actiondirecttype = $row['optiontype']; - $actiondirectprofile = $row['optionprofile']; - $actiondirectdest = $row['optiondest']; - } - if (strtolower($row['optionnumber']) == "d") { //default option used when dtmf doesn't match any other option - //echo "default found\n"; - $actiondefault = true; - $actiondefaulttype = $row['optiontype']; - $actiondefaultprofile = $row['optionprofile']; - $actiondefaultdest = $row['optiondest']; - } - } - } - } - //$tmp .= "action count: ".$actioncount."<br />\n"; - if ($actioncount > 0) { - if ($actiondirect) { - $tmp .= " if (condition) {\n"; - $tmp .= " //direct\n"; - $tmp .= " //console_log( \"info\", \"action direct\\n\" );\n"; - if ($actiondirecttype == "extension") { - $tmp .= " sofia_contact_".$actiondirectdest." = get_sofia_contact(\"".$actiondirectdest."\",domain_name, \"".$actiondirectprofile."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondirectdest."); //".$actiondirectdest."\n"; - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n"; - } - } - if ($actiondirecttype == "voicemail") { - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n"; - } - } - if ($actiondirecttype == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$actiondirectdest."\"); //".$actiondirectdest."\n"; - - } - - $tmp .= "}\n"; - - } - else { - $tmp .= " if (condition) {\n"; - $tmp .= " //action\n"; - $tmp .= "\n"; - $tmp .= " //console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n"; - $tmp .= " var dtmf = new Object( );\n"; - $tmp .= " dtmf.digits = \"\";\n"; - $tmp .= " if ( session.ready( ) ) {\n"; - $tmp .= " session.answer( );\n"; - $tmp .= "\n"; - $tmp .= " digitmaxlength = 1;\n"; - $tmp .= " while (session.ready() && ! exit ) {\n"; - $tmp .= " //session.streamFile( \"C:/Program Files/FreeSWITCH/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; - $tmp .= " if (session.ready()) {\n"; - $tmp .= " if (dtmf.digits.length == 0) {\n"; - $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; - $tmp .= " if (dtmf.digits.length == 0) {\n"; - //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n"; - - $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; - //find the timeout IVR options with the correct action - if (count($a_ivr_options) > 0) { - foreach($a_ivr_options as $row) { - - if ($row['ivrid'] == $rowhelper['ivrid']) { - - if ($row['optionaction'] == "action") { - if (strtolower($row['optionnumber']) == "t") { - if ($row['optiontype'] == "extension") { - $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n"; - if ($row['optionprofile'] == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - } - if ($row['optiontype'] == "voicemail") { - if ($row['optionprofile'] == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - } - if ($row['optiontype'] == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\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 .= " //pickup the remaining digits\n"; - //$tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n"; - //$tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n"; - //$tmp .= " //dtmf.digits += session.getDigits(2, \"#\", 3000); //allow up to 3 digits\n"; - $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000); //allow up to 5 digits\n"; - $tmp .= "\n"; - $tmp .= "\n"; - //$tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n"; - - - //action - $tmpaction = ""; - - $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n"; - $x = 0; - $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'] - */ - - $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": - // break; - //case "d": - // break; - default: - //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; - if ($x == 0) { - $tmpaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; - } - else { - $tmpaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; - } - if ($row['optiontype'] == "extension") { - $tmpaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n"; - $tmpaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n"; - if ($row['optionprofile'] == "auto") { - $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - else { - $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - } - if ($row['optiontype'] == "voicemail") { - if ($row['optionprofile'] == "auto") { - $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - else { - $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - } - if ($row['optiontype'] == "sip uri") { - $tmpaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - - $tmpaction .= " }\n"; - - } - - $x++; - } //end if action - - } //end ivrid - - - } //end foreach - } //end if count - - $tmp .= $tmpaction; - if ($rowhelper['ivrdirectdial'] == "true") { - $tmp .= " else {\n"; - $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n"; - //$tmp .= $tmpactiondefault; - $tmp .= " }\n"; - } - else { - if ($actiondefault) { - $tmp .= " else {\n"; - $tmp .= " //console_log( \"info\", \"default option when there is no matching dtmf found\\n\" );\n"; - if ($actiondefaulttype == "extension") { - $tmp .= " sofia_contact_".$actiondefaultdest." = get_sofia_contact(\"".$actiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondefaultdest."); //".$actiondefaultdest."\n"; - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n"; - } - } - if ($actiondefaulttype == "voicemail") { - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n"; - } - } - if ($actiondefaulttype == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$actiondefaultdest."\"); //".$actiondefaultdest."\n"; - } - $tmp .= " }\n"; - - } - } - - $tmp .= "\n"; - unset($tmpaction); - - - $tmp .= " } \n"; - //$tmp .= " else if ( dtmf.digits.length == \"4\" ) {\n"; - //$tmp .= " //Transfer to the extension the caller\n"; - //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n"; - //$tmp .= " } else {\n"; - //$tmp .= $tmpactiondefault; - //$tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " } //end if session.ready\n"; - $tmp .= "\n"; - $tmp .= " }\n"; //end if condition - - } //if ($actiondirect) - } //actioncount - - $antiactiondirect = false; - $antiactiondefault = false; - $antiactioncount = 0; - 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") { - $antiactioncount++; - if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf - $antiactiondirect = true; - $antiactiondirecttype = $row['optiontype']; - $antiactiondirectdest = $row['optiondest']; - $antiactiondirectprofile = $row['optionprofile']; - } - if (strtolower($row['optionnumber']) == "d") { //default option used when an dtmf doesn't match any option - $antiactiondefault = true; - $antiactiondefaulttype = $row['optiontype']; - $antiactiondefaultdest = $row['optiondest']; - $antiactiondefaultprofile = $row['optionprofile']; - } - } - } - } - //$tmp .= "anti-action count: ".$antiactioncount."<br />\n"; - - - if ($antiactioncount > 0) { - if ($antiactiondirect) { - $tmp .= " else {\n"; - $tmp .= " //console_log( \"info\", \"anti-action call now don't wait for dtmf\\n\" );\n"; - - if ($antiactiondirecttype == "extension") { - $tmp .= " sofia_contact_".$antiactiondirectdest." = get_sofia_contact(\"".$antiactiondirectdest."\",domain_name, \"".$antiactiondirectprofile."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondirectdest."); //".$antiactiondirectdest."\n"; - if ($antiactiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n"; - } - } - if ($antiactiondirecttype == "voicemail") { - if ($antiactiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n"; - } - } - if ($antiactiondirecttype == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$antiactiondirectdest."\"); //".$antiactiondirectdest."\n"; - } - $tmp .= "}\n"; - } - else { - $tmp .= " else {\n"; - $tmp .= " //anti-action\n"; - $tmp .= " //console_log( \"info\", \"anti-action options\\n\" );\n"; - $tmp .= "\n"; - $tmp .= " var dtmf = new Object( );\n"; - $tmp .= " dtmf.digits = \"\";\n"; - $tmp .= " if ( session.ready( ) ) {\n"; - $tmp .= " session.answer( );\n"; - $tmp .= "\n"; - $tmp .= " digitmaxlength = 1;\n"; - $tmp .= " while (session.ready() && ! exit ) {\n"; - $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n"; - $tmp .= " if (session.ready()) {\n"; - $tmp .= " if (dtmf.digits.length == 0) {\n"; - $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n"; - $tmp .= " if (dtmf.digits.length == 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 ($row['optiontype'] == "extension") { - $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n"; - if ($row['optionprofile'] == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - } - if ($row['optiontype'] == "voicemail") { - if ($row['optionprofile'] == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - } - if ($row['optiontype'] == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\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 .= " //pickup the remaining digits\n"; - $tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n"; - $tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n"; - $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000);\n"; - $tmp .= "\n"; - $tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n"; - $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'] - */ - //$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": - // //break; - //case "d": - // //break; - default: - //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n"; - - if ($x == 0) { - $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; - } - else { - $tmpantiaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n"; - } - - if ($row['optiontype'] == "extension") { - $tmpantiaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n"; - $tmpantiaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n"; - if ($row['optionprofile'] == "auto") { - $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - else { - $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n"; - } - } - if ($row['optiontype'] == "voicemail") { - if ($row['optionprofile'] == "auto") { - $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - else { - $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - } - if ($row['optiontype'] == "sip uri") { - $tmpantiaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n"; - } - $tmpantiaction .= " }\n"; - - } //end switch - - $x++; - } //end anti-action - - } //end ivrid - - - } //end for each - } //if count - - $tmp .= $tmpantiaction; - if ($rowhelper['ivrdirectdial'] == "true") { - $tmp .= " else {\n"; - $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n"; - //$tmp .= $tmpantiactiondefault; - $tmp .= " }\n"; - } - else { - if ($antiactiondefault) { - $tmp .= " else {\n"; - $tmp .= " //console_log( \"info\", \"default option used when dtmf doesn't match any other option\\n\" );\n"; - - if ($antiactiondefaulttype == "extension") { - $tmp .= " sofia_contact_".$antiactiondefaultdest." = get_sofia_contact(\"".$antiactiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n"; - $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondefaultdest."); //".$antiactiondefaultdest."\n"; - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n"; - } - } - if ($antiactiondefaulttype == "voicemail") { - if ($actiondirectprofile == "auto") { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n"; - } - else { - $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n"; - } - } - if ($antiactiondefaulttype == "sip uri") { - $tmp .= " session.execute(\"bridge\", \"".$antiactiondefaultdest."\"); //".$antiactiondefaultdest."\n"; - } - $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"; - //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\"); \n"; - //$tmp .= " }\n"; - //$tmp .= " else {\n"; - //$tmp .= $tmpantiactiondefault; - //$tmp .= " }\n"; - $tmp .= "\n"; - $tmp .= " } //end if session.ready\n"; - $tmp .= "\n"; - $tmp .= " } //end if condition"; - - } //if ($antiactiondirect) - } //antiactioncount - unset($tmpactiondefault); - unset($tmpantiactiondefault); - - if (strlen($rowhelper['ivrid']) > 0) { - $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js"; - $fout = fopen("/usr/local/freeswitch/scripts/".$ivrfilename,"w"); - fwrite($fout, $tmp); - unset($ivrfilename); - fclose($fout); - } - - } //end foreach - } //end if count - -} //end function - - - -function sync_package_freeswitch_dialplan_includes() -{ - - global $config; - - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - //order the array - if (!function_exists('cmp_number_dialplan_details')) { - function cmp_number_dialplan_details($a, $b) { - if ($a["fieldorder"] > $b["fieldorder"]) { - return 1; - } - else { - return 0; - } - } - } - - 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) { usort($a_dialplan_include_details, "cmp_number_dialplan_details"); } - - $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 - //start tag - $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; - } - 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 - $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++; - } - } - - 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++; - } - } - - //if (count($a_dialplan_include_details) > 0) { - //foreach ($a_dialplan_include_details as $ent) { - // $i = 0; - // if ($ent['tag'] == "param" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) { - //$ent['tag'] - //$ent['fieldtype'] - //$ent['fielddata'] - // } - // $i++; - // } - //} - - if ($conditioncount > 0) { - $tmp .= " </condition>\n"; - } - unset ($conditioncount); - $tmp .= "</extension>\n"; - - - if ($rowhelper['enabled'] == "true") { - $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - $fout = fopen("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename,"w"); - fwrite($fout, $tmp); - fclose($fout); - } - unset($dialplanincludefilename); - unset($tmp); - - - } //end foreach - } //if array count - -} - - -function sync_package_freeswitch_public_includes() -{ - - global $config; - - $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config']; - $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - - if (count($a_public_includes) > 0) { - - //order the array - function cmp_number_public_include_details($a, $b) { - if ($a["fieldorder"] > $b["fieldorder"]) { - return 1; - } - else { - return 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) { usort($a_public_include_details, "cmp_number_public_include_details"); } - - $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 - //start tag - $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n"; - } - 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 - $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++; - } - } - - 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++; - } - } - - //if (count($a_public_include_details) > 0) { - //foreach ($a_public_include_details as $ent) { - // $i = 0; - // if ($ent['tag'] == "param" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) { - //$ent['tag'] - //$ent['fieldtype'] - //$ent['fielddata'] - // } - // $i++; - // } - //} - - if ($conditioncount > 0) { - $tmp .= " </condition>\n"; - } - unset ($conditioncount); - $tmp .= "</extension>\n"; - - - if ($rowhelper['enabled'] == "true") { - $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - $fout = fopen("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename,"w"); - fwrite($fout, $tmp); - fclose($fout); - } - unset($publicincludefilename); - unset($tmp); - - } //end foreach - } //end count - -} - - -function sync_package_freeswitch() -{ - global $config; - sync_package_freeswitch_settings(); - sync_package_freeswitch_dialplan(); - 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_internal(); - sync_package_freeswitch_external(); - //sync_package_freeswitch_recordings(); - if (pkg_is_service_running('freeswitch')) { - sync_package_freeswitch_ivr(); - } - -} - - -function freeswitch_php_install_command() -{ - global $config; - //exec("/etc/./rc.conf_mount_rw"); - - $freeswitch_package_version = "0.9.5.4"; - $freeswitch_build_version = "1.0.4 pre 10"; - $freeswitch_build_revision = "14306"; - - //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'); - - //used with fax to png, and fax to pdf conversion - exec("pkg_add -r tiff2png"); - - //add sqlite package - exec("pkg_add -r sqlite34"); - - clearstatcache(); - 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.2')) { - // $freebsd_version = "7.2"; - //} - - $download_path = 'http://www.pfsense.com/packages/config/freeswitch_dev/'; - //exec("cd /tmp/;fetch ".$download_path."freeswitch.tgz"); //handled by freeswitch.xml - exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/"); - unlink_if_exists("/tmp/freeswitch.tgz"); - - if (!is_dir('/usr/local/freeswitch/storage/fax/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/"); - } - - if (!is_dir('/usr/local/freeswitch/storage/fax/receive/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/receive/"); - } - - //download the dialplan default.xml - exec("cd /tmp/;fetch ".$download_path."dialplan.default.xml"); - exec("cp /tmp/dialplan.default.xml /usr/local/freeswitch/conf/dialplan/default.xml"); - unlink_if_exists("/tmp/dialplan.default.xml"); - - //download the dialplan public.xml - exec("cd /tmp/;fetch ".$download_path."dialplan.public.xml"); - exec("cp /tmp/dialplan.public.xml /usr/local/freeswitch/conf/dialplan/public.xml"); - unlink_if_exists("/tmp/dialplan.public.xml"); - - //make a backup copy of the default config used with the 'Restore Default' buttons on the text areas. - exec("cp -R /usr/local/freeswitch/conf /usr/local/freeswitch/conf.orig"); - - //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"); - - if (!is_dir('/usr/local/freeswitch/sounds/custom/')) { - exec("mkdir /usr/local/freeswitch/sounds/custom/"); - } - - if (!is_dir('/usr/local/freeswitch/sounds/custom/8000/')) { - exec("mkdir /usr/local/freeswitch/sounds/custom/8000/"); - } - - //copy audio files - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_your_pin_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_pin_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_extension_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_phone_number.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_set.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_deleted.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."begin_recording.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."your_pin_number_is_incorect_goodbye.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_say_your_name_and_reason_for_calling.wav"); - exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."press_1_to_accept_2_to_reject_or_3_for_voicemail.wav"); - - //mod_fax - exec("cd /usr/local/freeswitch/mod/;fetch ".$download_path."mod_fax.so"); - - //download lib files - exec("cd /usr/local/lib/;fetch ".$download_path."libtinfo.so.5.6"); - exec("cd /usr/local/lib/;fetch ".$download_path."libncurses.so.5.6"); - exec("cd /usr/local/lib/;fetch ".$download_path."libncurses.so.5.7"); - exec("cd /usr/local/lib/;fetch ".$download_path."libogg.so.5.3"); - exec("cp /usr/local/lib/libogg.so.5.3 /usr/local/lib/libogg.so.5"); - exec("cd /usr/local/lib/;fetch ".$download_path."libvorbis.so.4"); - exec("cd /usr/local/lib/;fetch ".$download_path."libcurl.so.5"); - exec("cd /usr/local/lib/;fetch ".$download_path."libodbc.so.1"); - exec("cd /usr/local/lib/;fetch ".$download_path."libiconv.so.3"); - exec("cd /usr/local/lib/;fetch ".$download_path."libspandsp.so.1"); - exec("cp /usr/local/lib/libspandsp.so.1 /usr/local/lib/libspandsp.so.2"); - - //download xml package files - exec("cd /usr/local/pkg/;fetch ".$download_path."freeswitch_modules.xml"); - - - //misc files - if (!is_dir('/usr/local/www/edit_area/')) { - exec("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."index.tmp"); - exec("cp /tmp/index.tmp /usr/local/www/packages/freeswitch/index.php"); - unlink_if_exists("/tmp/index.tmp"); - - exec("cd /tmp/;fetch ".$download_path."class.smtp.tmp"); - exec("cp /tmp/class.smtp.tmp /usr/local/www/packages/freeswitch/class.smtp.php"); - unlink_if_exists("/tmp/class.smtp.tmp"); - - exec("cd /tmp/;fetch ".$download_path."class.phpmailer.tmp"); - exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/freeswitch/class.phpmailer.php"); - unlink_if_exists("/tmp/class.phpmailer.tmp"); - - exec("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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 ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."freeswitch_fax.tmp"); - exec("cp /tmp/freeswitch_fax.tmp /usr/local/www/packages/freeswitch/freeswitch_fax.php"); - unlink_if_exists("/tmp/freeswitch_fax.tmp"); - - exec("cd /tmp/;fetch ".$download_path."freeswitch_fax_edit.tmp"); - exec("cp /tmp/freeswitch_fax_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_fax_edit.php"); - unlink_if_exists("/tmp/freeswitch_fax_edit.tmp"); - - exec("cd /tmp/;fetch ".$download_path."fax_to_email.tmp"); - exec("cp /tmp/fax_to_email.tmp /usr/local/www/packages/freeswitch/fax_to_email.php"); - unlink_if_exists("/tmp/fax_to_email.tmp"); - - exec("cd /tmp/;fetch ".$download_path."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 ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group.tmp"); - exec("cp /tmp/freeswitch_hunt_group.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group.php"); - unlink_if_exists("/tmp/freeswitch_hunt_group.tmp"); - - exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_edit.tmp"); - exec("cp /tmp/freeswitch_hunt_group_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_edit.php"); - unlink_if_exists("/tmp/freeswitch_hunt_group_edit.tmp"); - - exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_destinations.tmp"); - exec("cp /tmp/freeswitch_hunt_group_destinations.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations.php"); - unlink_if_exists("/tmp/freeswitch_hunt_group_destinations.tmp"); - - exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_destinations_edit.tmp"); - exec("cp /tmp/freeswitch_hunt_group_destinations_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations_edit.php"); - unlink_if_exists("/tmp/freeswitch_hunt_group_destinations_edit.tmp"); - - exec("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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 ".$download_path."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 ".$download_path."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 ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."freeswitch_settings.tmp"); - exec("cp /tmp/freeswitch_settings.tmp /usr/local/www/packages/freeswitch/freeswitch_settings.php"); - unlink_if_exists("/tmp/freeswitch_settings.tmp"); - - exec("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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("cd /tmp/;fetch ".$download_path."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 ".$download_path."disa.js"); - exec("cd /usr/local/freeswitch/scripts/;fetch ".$download_path."originate.js"); - exec("cp /usr/local/freeswitch/htdocs/slim.swf /usr/local/www/packages/freeswitch/slim.swf"); - - /* freeswitch settings defaults */ - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US"; - } - if(strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "ClueCon"; - } - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'] = "8021"; - } - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'] = "8787"; - } - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = "freeswitch"; - } - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "freeswitch"; - } - if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']) == 0) { - $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "works"; - } - 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']; - $event_socket_port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; - $xml_rpc_http_port = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']; - $xml_rpc_auth_realm = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']; - $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']; - - //delete dialplan recording from the previous install - if (count($a_dialplan_includes) > 0) { - $i = 0; - foreach ($a_dialplan_includes as $ent) { - if ($ent['extensionname'] == "Recordings") { - unset($a_dialplan_includes[$i]); - } - $i++; - } - } - - //delete the recording dialplan details - if (count($a_dialplan_include_details) > 0) { - $i = 0; - foreach ($a_dialplan_include_details as $ent) { - if ($ent['fielddata'] == "^732673$") { - unset($a_dialplan_include_details[$i]); - } - if ($ent['fielddata'] == "recordings.js") { - unset($a_dialplan_include_details[$i]); - } - $i++; - } - } - - //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++; - } - } - - //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"; - $handle = fopen($filename,"rb"); - $contents = fread($handle, filesize($filename)); - fclose($handle); - - $handle = fopen($filename,"w"); - $contents = str_replace("<param name=\"mailer-app\" value=\"sendmail\"/>", "<param name=\"mailer-app\" value=\"/usr/local/bin/php\"/>", $contents); - $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"/usr/local/www/packages/freeswitch/freeswitch_mailto.php\"/>", $contents); - fwrite($handle, $contents); - unset($contents); - fclose($handle); - unset($filename); - - //prepare shout.conf.xml for mod_shout - $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/shout.conf.xml","w"); - $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=\"i586\"/>\n"; - $tmpxml .= " <!--<param name=\"volume\" value=\".1\"/>-->\n"; - $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n"; - $tmpxml .= " </settings>\n"; - $tmpxml .= "</configuration>"; - 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=\"". $config['interfaces']['lan']['ipaddr'] ."\"/>\n"; - $tmpxml .= " <param name=\"listen-port\" value=\"". $event_socket_port ."\"/>\n"; - $tmpxml .= " <param name=\"password\" value=\"". $event_socket_password ."\"/>\n"; - $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n"; - $tmpxml .= " </settings>\n"; - $tmpxml .= "</configuration>"; - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); - - /* freeswitch modules defaults */ - - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_console']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_console'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc'] = "disable"; - } - 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"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729'] = "enable"; - } - 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"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_python']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_python'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_java']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_java'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en'] = "enable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru'] = "disable"; - } - if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh']) == 0) { - $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; - } - - //create the backup directory - 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"; - - 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); - } - - - 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(); - } - - $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; - -} - - -function freeswitch_deinstall_command() -{ - - exec("killall -9 freeswitch"); - unlink_if_exists("/usr/local/pkg/freeswitch.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch.inc"); - unlink_if_exists("/usr/local/pkg/freeswitch_dialplan.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_extensions.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_external.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_internal.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_modules.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_public.xml"); - unlink_if_exists("/usr/local/pkg/freeswitch_vars.xml"); - - 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/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"); - -} - -?> diff --git a/config/freeswitch_dev/freeswitch.xml b/config/freeswitch_dev/freeswitch.xml index f0c06481..fe9d1dfe 100644 --- a/config/freeswitch_dev/freeswitch.xml +++ b/config/freeswitch_dev/freeswitch.xml @@ -44,15 +44,15 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>Settings</name> - <version>0.9.5.4</version> + <version>0.9.5.5</version> <title>Settings</title> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/v_config.inc</include_file> <menu> <name>FreeSWITCH</name> <tooltiptext>Modify FreeSWITCH settings.</tooltiptext> <section>Services</section> <configfile>freeswitch.xml</configfile> - <url>/packages/freeswitch/freeswitch_settings.php</url> + <url>/packages/freeswitch/v_settings.php</url> </menu> <service> <name>freeswitch</name> @@ -63,40 +63,40 @@ <tabs> <tab> <text>Settings</text> - <url>/packages/freeswitch/freeswitch_settings.php</url> + <url>/packages/freeswitch/v_settings.php</url> <active/> </tab> <tab> <text>Dialplan</text> - <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url> + <url>/packages/freeswitch/v_dialplan_includes.php</url> </tab> <tab> <text>Extensions</text> - <url>/packages/freeswitch/freeswitch_extensions.php</url> + <url>/packages/freeswitch/v_extensions.php</url> </tab> <tab> <text>Features</text> - <url>/packages/freeswitch/freeswitch_features.php</url> + <url>/packages/freeswitch/v_features.php</url> </tab> <tab> <text>Gateways</text> - <url>/packages/freeswitch/freeswitch_gateways.php</url> + <url>/packages/freeswitch/v_gateways.php</url> </tab> <tab> <text>Profiles</text> - <url>/packages/freeswitch/freeswitch_profiles.php</url> + <url>/packages/freeswitch/v_profiles.php</url> </tab> <tab> <text>Public</text> - <url>/packages/freeswitch/freeswitch_public_includes.php</url> + <url>/packages/freeswitch/v_public_includes.php</url> </tab> <tab> <text>Status</text> - <url>/packages/freeswitch/freeswitch_status.php</url> + <url>/packages/freeswitch/v_status.php</url> </tab> <tab> <text>Vars</text> - <url>/packages/freeswitch/freeswitch_vars.php</url> + <url>/packages/freeswitch/v_vars.php</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->freeswitchsettings</configpath> @@ -108,7 +108,7 @@ <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch_dev/freeswitch.inc</item> + <item>http://www.pfsense.com/packages/config/v_dev/freeswitch.inc</item> </additional_files_needed> <fields> <field> @@ -253,15 +253,15 @@ <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - sync_package_freeswitch_settings(); + sync_package_v_settings(); </custom_php_resync_config_command> <custom_delete_php_command> - sync_package_freeswitch_settings(); + sync_package_v_settings(); </custom_delete_php_command> <custom_php_install_command> - freeswitch_php_install_command(); + v_php_install_command(); </custom_php_install_command> <custom_php_deinstall_command> - freeswitch_deinstall_command(); + v_deinstall_command(); </custom_php_deinstall_command> </packagegui> diff --git a/config/freeswitch_dev/freeswitch_cmd.tmp b/config/freeswitch_dev/freeswitch_cmd.tmp deleted file mode 100644 index 21dba508..00000000 --- a/config/freeswitch_dev/freeswitch_cmd.tmp +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_cmd.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"); -$cmd = $_GET['cmd']; - - -$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; -$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; -$host = ''; - -$fp = event_socket_create($host, $port, $password); -$response = event_socket_request($fp, $cmd); -fclose($fp); - -header("Location: /packages/freeswitch/freeswitch_status.php?savemsg=".urlencode($response)); - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_dialplan.tmp b/config/freeswitch_dev/freeswitch_dialplan.tmp deleted file mode 100644 index a754d68f..00000000 --- a/config/freeswitch_dev/freeswitch_dialplan.tmp +++ /dev/null @@ -1,165 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan</p>\n"; -?> - -<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_dev/freeswitch_dialplan_includes.tmp b/config/freeswitch_dev/freeswitch_dialplan_includes.tmp deleted file mode 100644 index b64cdfe4..00000000 --- a/config/freeswitch_dev/freeswitch_dialplan_includes.tmp +++ /dev/null @@ -1,281 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_dialplan_includes.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"); - - -//freeswitchdialplanincludes - //dialplanincludeid - //extensionname - //context - //default - //enabled - //descr - -//freeswitchdialplanincludedetails - - //dialplanincludeid - //tag - //condition - //action - //antiaction - //param - //tagorder - //1-20 - //fieldtype - - //fielddata - - -$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; -$a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'dialplanincludes') { - - if ($a_dialplan_includes[$_GET['id']]) { - - $dialplanincludeid = $a_dialplan_includes[$_GET['id']][dialplanincludeid]; - - $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; - foreach($a_dialplan_includes_details as $row) { - if ($row["dialplanincludeid"] == $dialplanincludeid) { - //echo "child id: ".$i."<br />\n"; - unset($a_dialplan_includes_details[$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($a_dialplan_includes[$_GET['id']]); - write_config(); - sync_package_freeswitch_dialplan_includes(); - header("Location: freeswitch_dialplan_includes.php"); - exit; - } - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan</p>\n"; -?> - -<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_includes.php" method="post" name="iform" id="iform"> -<?php - - -//echo "<pre>"; -//print_r ($a_dialplan_includes); -//echo "</pre>"; - - -//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("This has been changed.<br>You must apply the changes in order for them to take effect."); -//echo"<br />"; -//endif; - -?> - - <br /> - <br /> - - <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='/packages/freeswitch/freeswitch_dialplan.php';"> - </td> - </tr> - <tr> - <td colspan='2'> - <span class="vexpl"> - 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 /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr">Extension Name</td> - <td width="25%" class="listhdrr">Order</td> - <td width="25%" class="listhdrr">Enabled</td> - <td width="50%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <?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=<?=$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++; - } - } - ?> - <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"><a href="freeswitch_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - -</form> - -/usr/local/freeswitch/conf/dialplan/default/ -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_dialplan_includes_details.tmp b/config/freeswitch_dev/freeswitch_dialplan_includes_details.tmp deleted file mode 100755 index 1504d590..00000000 --- a/config/freeswitch_dev/freeswitch_dialplan_includes_details.tmp +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_dialplan_includes_details.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_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'dialplanincludedetails') { - if ($a_dialplan_include_details[$_GET['id']]) { - unset($a_dialplan_include_details[$_GET['id']]); - write_config(); - sync_package_freeswitch_dialplan_includes(); - //touch($d_hostsdirty_path); - header("Location: freeswitch_dialplan_includes_edit.php?id=".$_GET['parentid']); - exit; - } - } -} - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_dialplan_includes_details_edit.tmp b/config/freeswitch_dev/freeswitch_dialplan_includes_details_edit.tmp deleted file mode 100644 index d8dccc7a..00000000 --- a/config/freeswitch_dev/freeswitch_dialplan_includes_details_edit.tmp +++ /dev/null @@ -1,392 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_dialplan_includes_details_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_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -$parentid = $_GET['parentid']; -if (isset($_POST['parentid'])) { - $parentid = $_POST['parentid']; -} - -$dialplanincludeid = $_GET['dialplanincludeid']; -if (isset($_POST['dialplanincludeid'])) { - $dialplanincludeid = $_POST['dialplanincludeid']; -} - - - //dialplanincludeid - //tag - //condition - //action - //antiaction - //param - //fieldorder - //1-20 - //fieldtype - - //fielddata - - -if (isset($id) && $a_dialplan_includes_details[$id]) { - $pconfig['dialplanincludeid'] = $a_dialplan_includes_details[$id]['dialplanincludeid']; - $pconfig['tag'] = $a_dialplan_includes_details[$id]['tag']; - $pconfig['fieldorder'] = $a_dialplan_includes_details[$id]['fieldorder']; - $pconfig['fieldtype'] = $a_dialplan_includes_details[$id]['fieldtype']; - $pconfig['fielddata'] = $a_dialplan_includes_details[$id]['fielddata']; -} -//else { -// if (isset($_GET['a'])) { -// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; } -// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; } -// } -//} - - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - $ent = array(); - $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; - $ent['tag'] = $_POST['tag']; - $ent['fieldorder'] = $_POST['fieldorder']; - $ent['fieldtype'] = $_POST['fieldtype']; - $ent['fielddata'] = $_POST['fielddata']; - - - if (isset($id) && $a_dialplan_includes_details[$id]) { - //update - $a_dialplan_includes_details[$id] = $ent; - } - else { - //add - $a_dialplan_includes_details[] = $ent; - } - - write_config(); - sync_package_freeswitch_dialplan_includes(); - - header("Location: freeswitch_dialplan_includes_edit.php?id=".$parentid); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan: Details: Edit</p>\n"; -?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> - -<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" > - <br /> - <form action="freeswitch_dialplan_includes_details_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">Tag</td> - <td width="78%" class="vtable"> - <script type="text/javascript"> - function dialplan_include_details_tag_onchange() { - var tag = document.getElementById("form_tag").value; - if (tag == "condition") { - document.getElementById("label_fieldtype").innerHTML = "Field"; - document.getElementById("label_fielddata").innerHTML = "Expression"; - } - else if (tag == "action") { - document.getElementById("label_fieldtype").innerHTML = "Application"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - else if (tag == "anti-action") { - document.getElementById("label_fieldtype").innerHTML = "Application"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - else if (tag == "param") { - document.getElementById("label_fieldtype").innerHTML = "Name"; - document.getElementById("label_fielddata").innerHTML = "Value"; - } - if (tag == "") { - document.getElementById("label_fieldtype").innerHTML = "Type"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - } - </script> - <?php - echo " <select name='tag' class='formfld' id='form_tag' onchange='dialplan_include_details_tag_onchange();'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['tag'])) { - case "condition": - echo " <option selected='yes'>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "action": - echo " <option>condition</option>\n"; - echo " <option selected='yes'>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "anti-action": - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option selected='yes'>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "param": - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option selected='yes'>param</option>\n"; - break; - default: - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - } - echo " </select>\n"; - - //condition - //field expression - //action - //application - //data - //antiaction - //application - //data - //param - //name - //value - - ?> - </td> - </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> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td> - <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> - <tr> - <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='fieldorder' class='formfld'>\n"; - //echo " <option></option>\n"; - if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) { - echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n"; - } - $i=0; - while($i<=999) { - 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"; - } - - $i++; - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="dialplanincludeid" type="hidden" value="<?=$dialplanincludeid;?>"> - <input name="parentid" type="hidden" value="<?=$parentid;?>"> - <?php if (isset($id) && $a_dialplan_includes_details[$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> - <br /> - <br /> - <a href='http://wiki.freeswitch.org/wiki/Dialplan_XML' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_XML</a> - - <br /> - <br /> - <br /> - <br /> - - <b>Conditions</b> - <br /> - <br /> - Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against. - <ul> - <li><b>context</b></li> - <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li> - <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li> - <li><b>dialplan</b> Name of the dialplan module that are used, the name is provided by each dialplan module. Example: XML</li> - <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li> - <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li> - <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li> - <li><b>ani2</b> The type of device placing the call [1]</li> - <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> - </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 - - <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> - <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>. - <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>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>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>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>transfer</b> transfer the call to another extension or number<li> - <li><b>voicemail</b> send the call to voicemail</li> - </ul> - - - <br /> - <br /> - - <!-- - <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> - <ul> - <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>rfc2833-pt</b>" 101</li> - <li><b>sip-port</b> 5060</li> - <li><b>use-rtp-timer</b> true</li> - </ul> - <br /> - <br /> - --> - - - <br /> - <br /> - <br /> - <br /> - <br /> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_dialplan_includes_edit.tmp b/config/freeswitch_dev/freeswitch_dialplan_includes_edit.tmp deleted file mode 100644 index b852e22b..00000000 --- a/config/freeswitch_dev/freeswitch_dialplan_includes_edit.tmp +++ /dev/null @@ -1,546 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_dialplan_includes_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"); - - -//freeswitchdialplanincludes - //dialplanincludeid - //extensionname - //context - //default - //enabled - //descr - -// - - - -$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; -$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} -$parentid = $id; - - -if (isset($id) && $a_dialplan_includes[$id]) { - $pconfig['dialplanincludeid'] = $a_dialplan_includes[$id]['dialplanincludeid']; - $dialplanincludeid = $a_dialplan_includes[$id]['dialplanincludeid']; - $pconfig['extensionname'] = $a_dialplan_includes[$id]['extensionname']; - $pconfig['order'] = $a_dialplan_includes[$id]['order']; - $pconfig['context'] = $a_dialplan_includes[$id]['context']; - $pconfig['enabled'] = $a_dialplan_includes[$id]['enabled']; - $pconfig['descr'] = $a_dialplan_includes[$id]['descr']; - $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name']; - $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if ($_GET['act'] == "del") { - if ($_GET['type'] == 'dialplanincludedetails') { - if ($a_dialplan_include_details[$_GET['id']]) { - unset($a_dialplan_include_details[$_GET['id']]); - write_config(); - sync_package_freeswitch_dialplan_includes(); - header("Location: freeswitch_dialplan_include_edit.php?id=".$_GET['id']); - exit; - } - } - } - - - if (!$input_errors) { - - $ent = array(); - if (strlen($_POST['dialplanincludeid']) > 0) { - //update - $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; - } - else { - //add - $ent['dialplanincludeid'] = guid(); - } - $ent['extensionname'] = $_POST['extensionname']; - $ent['order'] = $_POST['order']; - //$ent['context'] = $_POST['context']; - $ent['context'] = 'default'; - $ent['enabled'] = $_POST['enabled']; - $ent['descr'] = $_POST['descr']; - $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; - } - 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; - } - if ($_POST['enabled'] == "false") { - //if the extension name is disabled then remove the dialplan xml file - $filenamechanged = true; - } - 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); - - } //end foreach - } //end count - - //update the config - $a_dialplan_includes[$id] = $ent; - } - else { - //add to the config - $a_dialplan_includes[] = $ent; - } - - - write_config(); - sync_package_freeswitch_dialplan_includes(); - - header("Location: freeswitch_dialplan_includes.php"); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Dialplan: Edit</p>\n"; -?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> - - -<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>Dialplan:<br> - </strong></span> - Dialplan Include general settings. - </span></p></td> - </tr> - </table> - <br /> - - <form action="freeswitch_dialplan_includes_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">Extension Name</td> - <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 '.'. - </td> - </tr> - <!-- - <tr> - <td width="22%" valign="top" class="vncellreq">Context</td> - <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 - echo " <select name='enabled' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - 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"> - <?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"; - } - $i=0; - while($i<=999) { - 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"; - } - - $i++; - } - echo " </select>\n"; - ?> - <br /> - 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"> - <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> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="dialplanincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['dialplanincludeid']);?>"> - <?php - if (strlen($id) > 0 && $a_dialplan_includes[$id]) { - 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"; - } - ?> - <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> - - <form action="freeswitch_dialplan_includes_edit.php" method="post" name="iform2" id="iform2"> - <?php - - //echo "<pre>"; - //print_r ($a_dialplan_includes); - //echo "</pre>"; - - //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; - - //create a temporary id for the array - $i = 0; - if (count($a_dialplan_include_details) > 0) { - foreach ($a_dialplan_include_details as $ent) { - $a_dialplan_include_details[$i]['id'] = $i; - $i++; - } - } - - //order the array - function cmp_number($a, $b) { - if ($a["fieldorder"] > $b["fieldorder"]) { - return 1; - } - else { - return 0; - } - } - if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number"); } - - ?> - - - <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. - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="40" class="listhdrr">Tag</td> - <td width="40" class="listhdrr">Type</td> - <td width="50%" class="listhdrr">Data</td> - <td width="40" class="listhdrr">Order</td> - <td width="40" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </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']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" 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 = 0; - if (count($a_dialplan_include_details) > 0) { - - foreach ($a_dialplan_include_details as $ent) { - if ($ent['tag'] == "action" && $dialplanincludeid == $ent['dialplanincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" 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 = 0; - if (count($a_dialplan_include_details) > 0) { - - foreach ($a_dialplan_include_details as $ent) { - if ($ent['tag'] == "anti-action" && $dialplanincludeid == $ent['dialplanincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" 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 = 0; - if (count($a_dialplan_include_details) > 0) { - - foreach ($a_dialplan_include_details as $ent) { - if ($ent['tag'] == "param" && $dialplanincludeid == $ent['dialplanincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" 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"><a href="freeswitch_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - - </form> - - - - - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_extensions.tmp b/config/freeswitch_dev/freeswitch_extensions.tmp deleted file mode 100644 index 45ce9b8d..00000000 --- a/config/freeswitch_dev/freeswitch_extensions.tmp +++ /dev/null @@ -1,223 +0,0 @@ -<?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']]) { - $tmp_file_name = "/usr/local/freeswitch/conf/directory/default/".$_GET['extension'].".xml"; - if (file_exists($tmp_file_name)) { - unlink($tmp_file_name); - } - 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"); -echo "<p class=\"pgtitle\">$v_project_label: Extensions</p>\n"; -?> - -<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_extensions.php" method="post" name="iform" id="iform"> -<?php - -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 extensions 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"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>Extensions<br> - </strong></span> - Use this to configure your SIP extensions. - </p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr">Extension</td> - <td width="25%" class="listhdrr">Mail To</td> - <td width="25%" class="listhdrr">Call Group</td> - <td width="25%" class="listhdr">Description</td> - <td width="10%" class="list"> - - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - - </td> - </tr> - - - <?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=<?=$ent['id'];?>';"> - <?=$ent['extension'];?> - </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=<?=$ent['id'];?>';"> - <?=$ent['callgroup'];?> - </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=<?=$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 - - $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"><a href="freeswitch_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - -</form> - - -/usr/local/freeswitch/conf/directory/default/ -<br> -<br> -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_extensions_edit.tmp b/config/freeswitch_dev/freeswitch_extensions_edit.tmp deleted file mode 100644 index 571492e6..00000000 --- a/config/freeswitch_dev/freeswitch_extensions_edit.tmp +++ /dev/null @@ -1,421 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_extensions_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']['freeswitchextensions']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -if (isset($id) && $a_extensions[$id]) { - - $pconfig['extension'] = $a_extensions[$id]['extension']; - $pconfig['password'] = $a_extensions[$id]['password']; - $pconfig['mailbox'] = $a_extensions[$id]['mailbox']; - $pconfig['vm-password'] = $a_extensions[$id]['vm-password']; - $pconfig['accountcode'] = $a_extensions[$id]['accountcode']; - $pconfig['effective_caller_id_name'] = $a_extensions[$id]['effective_caller_id_name']; - $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number']; - $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number']; - $pconfig['outbound_caller_id_name'] = $a_extensions[$id]['outbound_caller_id_name']; - $pconfig['outbound_caller_id_number'] = $a_extensions[$id]['outbound_caller_id_number']; - $pconfig['vm-mailto'] = $a_extensions[$id]['vm-mailto']; - $pconfig['vm-attach-file'] = $a_extensions[$id]['vm-attach-file']; - $pconfig['vm-keep-local-after-email'] = $a_extensions[$id]['vm-keep-local-after-email']; - $pconfig['user_context'] = $a_extensions[$id]['user_context']; - $pconfig['callgroup'] = $a_extensions[$id]['callgroup']; - $pconfig['auth-acl'] = $a_extensions[$id]['auth-acl']; - $pconfig['cidr'] = $a_extensions[$id]['cidr']; - $pconfig['sip-force-contact'] = $a_extensions[$id]['sip-force-contact']; - $pconfig['enabled'] = $a_extensions[$id]['enabled']; - $pconfig['description'] = $a_extensions[$id]['description']; - -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - $effective_caller_id_number = $_POST['effective_caller_id_number']; - $outbound_caller_id_number = $_POST['outbound_caller_id_number']; - $replace_array = array("(", ")", " ", "-"); - $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number); - $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number); - - $ent = array(); - $ent['extension'] = $_POST['extension']; - $ent['password'] = $_POST['password']; - $ent['mailbox'] = $_POST['mailbox']; - $ent['vm-password'] = $_POST['vm-password']; - $ent['accountcode'] = $_POST['accountcode']; - $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name']; - $ent['effective_caller_id_number'] = $effective_caller_id_number; - $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name']; - $ent['outbound_caller_id_number'] = $outbound_caller_id_number; - $ent['vm-mailto'] = $_POST['vm-mailto']; - $ent['vm-attach-file'] = $_POST['vm-attach-file']; - $ent['vm-keep-local-after-email'] = $_POST['vm-keep-local-after-email']; - $ent['user_context'] = $_POST['user_context']; - $ent['callgroup'] = $_POST['callgroup']; - $ent['auth-acl'] = $_POST['auth-acl']; - $ent['cidr'] = $_POST['cidr']; - $ent['sip-force-contact'] = $_POST['sip-force-contact']; - $ent['enabled'] = $_POST['enabled']; - $ent['description'] = $_POST['description']; - - if (isset($id) && $a_extensions[$id]) { - //update - $a_extensions[$id] = $ent; - } - else { - //add - $a_extensions[] = $ent; - } - - write_config(); - sync_package_freeswitch_extensions(); - - header("Location: freeswitch_extensions.php"); - exit; - } -} - -include("head.inc"); - -?> - -<script type="text/javascript" language="JavaScript"> - -function show_advanced_config() { - document.getElementById("showadvancedbox").innerHTML=''; - aodiv = document.getElementById('showadvanced'); - aodiv.style.display = "block"; -} - -</script> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Extensions: Edit</p>\n"; -?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> - - -<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>Extension Setup<br> - </strong></span> - /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"> - <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>"> - <br><span class="vexpl">Enter the extension here. The default configuration allows 3, 4, or 5 digit extensions.<br></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">Password</td> - <td width="75%" 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="25%" valign="top" class="vncellreq">Mailbox</td> - <td width="75%" class="vtable"> - <input name="mailbox" type="text" class="formfld" 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"> - <input name="vm-password" type="password" class="formfld" 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"> - <input name="accountcode" type="text" class="formfld" 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"> - <input name="effective_caller_id_name" type="text" class="formfld" 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"> - <input name="effective_caller_id_number" type="text" class="formfld" 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> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td> - <td width="75%" class="vtable"> - <input name="vm-mailto" type="text" class="formfld" 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 - echo " <select name='vm-attach-file' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['vm-attach-file'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - 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" nowrap>VM Keep Local After Email</td> - <td width="75%" class="vtable"> - <?php - echo " <select name='vm-keep-local-after-email' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['vm-keep-local-after-email'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - } - echo " </select>\n"; - ?> - Keep local file after sending the email. - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">User Context</td> - <td width="75%" class="vtable"> - <input name="user_context" type="text" class="formfld" 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"> - <input name="callgroup" type="text" class="formfld" 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> - </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"> - <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a> - </td> - </tr> - </table> - </div> - <div id="showadvanced" style="display:none"> - <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"> - <input name="auth-acl" type="text" class="formfld" 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"> - <input name="cidr" type="text" class="formfld" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>"> - <br> <span class="vexpl">Enter the cidr here.<br></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Name</td> - <td width="75%" class="vtable"> - <input name="outbound_caller_id_name" type="text" class="formfld" 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="vncell" nowrap>Outbound Caller ID Number</td> - <td width="75%" class="vtable"> - <input name="outbound_caller_id_number" type="text" class="formfld" 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> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">SIP-Force-Contact</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='sip-force-contact' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['sip-force-contact'])) { - case "NDLB-connectile-dysfunction": - echo " <option value='NDLB-connectile-dysfunction' selected='yes'>Rewrite contact IP and port</option>\n"; - echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n"; - break; - case "NDLB-tls-connectile-dysfunction": - echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n"; - echo " <option value='NDLB-tls-connectile-dysfunction' selected='yes'>Rewrite contact port</option>\n"; - default: - echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n"; - echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n"; - } - echo " </select>\n"; - ?> - <br /> - Choose sip-force-contact can be used to NDLB-connectile-dysfunction rewrites contact IP and port, <br />and NDLB-tls-connectile-dysfunction rewrites the contact port.<br /> - </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 - echo " <select name='enabled' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">Extension Description</td> - <td width="75%" 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 extension here.<br></span> - </td> - </tr> - <tr> - <td valign="top"> </td> - <td> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <?php if (isset($id) && $a_extensions[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> - - <br> - <br> - <br> - <br> - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_fax.tmp b/config/freeswitch_dev/freeswitch_fax.tmp deleted file mode 100644 index 199cd8f3..00000000 --- a/config/freeswitch_dev/freeswitch_fax.tmp +++ /dev/null @@ -1,308 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_fax.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_fax = &$config['installedpackages']['freeswitchfax']['config']; -$dir_fax = '/usr/local/freeswitch/storage/fax/inbox/'; - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'fax') { - if ($a_fax[$_GET['id']]) { - - $faxid = $a_fax[$_GET['id']][faxid]; - $faxname = $a_fax[$_GET['id']][faxname]; - - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - //delete the dialplan include - if (count($a_dialplan_includes) > 0) { - $i=0; - foreach($a_dialplan_includes as $row) { - if ($row["dialplanincludeid"] == $faxid) { - $order = $row['order']; - unset($a_dialplan_includes[$i]); - } - $i++; - } - } - - //delete the dialplan include details. aka. child data - if (count($a_dialplan_includes_details) > 0) { - $i=0; - foreach($a_dialplan_includes_details as $row) { - if ($row["dialplanincludeid"] == $faxid) { - unset($a_dialplan_includes_details[$i]); - } - $i++; - } - } - - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml"); - } - - //remove fax entries - unset($a_fax[$_GET['id']]); - - write_config(); - header("Location: freeswitch_fax.php"); - exit; - } - } -} - -if ($_GET['a'] == "download") { - - session_cache_limiter('public'); - - if ($_GET['type'] = "fax_file") { - if (file_exists($dir_fax.$_GET['filename'])) { - $fd = fopen($dir_fax.$_GET['filename'], "rb"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - $file_ext = substr($_GET['filename'], -3); - if ($file_ext == "png") { - header("Content-Type: image/png"); - } - } - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize($dir_fax.$_GET['filename'])); - fpassthru($fd); - } - } - - exit; -} -else { - //echo $dir_fax.$_GET['filename']; -} - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'fax_file') { - //if ($a_fax[$_GET['id']]) { - $tmp_file_array = split("\.",$_GET['filename']); - $file_name = $tmp_file_array[0]; - $file_ext = $tmp_file_array[1]; - unlink_if_exists($dir_fax.$file_name.".pdf"); - unlink_if_exists($dir_fax.$file_name.".png"); - unlink_if_exists($dir_fax.$file_name.".tif"); - //unset($a_fax[$_GET['id']]); - write_config(); - header("Location: freeswitch_fax.php"); - exit; - //} - } - -} - -include("head.inc"); - -?> - - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: FAX</p>\n"; -?> - -<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_fax.php" method="post" name="iform" id="iform"> -<?php - -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 fax 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"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>FAX<br> - </strong></span> - To receive a FAX setup a fax extension and then direct the incoming FAX with a dedicated number or you can detect the FAX tone by using <a href='http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_tone_detect' target='_blank'>tone detection</a> on the Public tab. - </p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="40" class="listhdrr">Extension</td> - <td width="40" class="listhdrr" nowrap>Name</td> - <td width="40%" class="listhdrr" nowrap>Email</td> - <td width="40" class="listhdrr">Domain</td> - <td width="50%" class="listhdr">Description</td> - <td width="40" class="list"> - - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - - </td> - </tr> - - - <?php - - //create a temporary id for the array - $i = 0; - if (count($a_fax) > 0) { - foreach ($a_fax as $ent) { - $a_fax[$i]['id'] = $i; - $i++; - } - } - - //order the array - function cmp_number($a, $b) { - if ($a["faxextension"] > $b["faxextension"]) { - return 1; - } - else { - return 0; - } - } - if (count($a_fax) > 0) { usort($a_fax, "cmp_number"); } - - $i = 0; - if (count($a_fax) > 0) { - - foreach ($a_fax as $ent) { - if (strlen($ent['faxextension']) > 0) { - ?> - <tr> - <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';"> - <?=$ent['faxextension'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';"> - <?=$ent['faxname'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';"> - <?=$ent['faxemail'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';"> - <?=$ent['faxdomain'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($ent['faxdescription']);?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_fax_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_fax.php?type=fax&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++; - } - } - ?> - - <tr> - <td class="list" colspan="5"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="5"></td> - <td class="list"></td> - </tr> - </table> - -</form> - - -<br /> -<br /> -<br /> -<br /> - - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_fax_edit.tmp b/config/freeswitch_dev/freeswitch_fax_edit.tmp deleted file mode 100644 index 869eae79..00000000 --- a/config/freeswitch_dev/freeswitch_fax_edit.tmp +++ /dev/null @@ -1,726 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_fax_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_fax = &$config['installedpackages']['freeswitchfax']['config']; - -$id = $_GET['id']; -if (strlen($id) == 0) { - $id = $_POST['id']; -} -$parentid = $id; - -if (isset($id) && $a_fax[$id]) { - $pconfig['faxid'] = $a_fax[$id]['faxid']; - $faxid = $a_fax[$id]['faxid']; - $pconfig['faxextension'] = $a_fax[$id]['faxextension']; - $pconfig['faxname'] = $a_fax[$id]['faxname']; - $pconfig['faxemail'] = $a_fax[$id]['faxemail']; - $pconfig['faxdomain'] = $a_fax[$id]['faxdomain']; - $pconfig['faxdescription'] = $a_fax[$id]['faxdescription']; -} - - -$dir_fax_inbox = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/inbox/'; -$dir_fax_sent = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/sent/'; -$dir_fax_temp = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/temp/'; - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'fax') { - if ($a_fax[$_GET['id']]) { - - $faxid = $a_fax[$_GET['id']][faxid]; - $faxname = $a_fax[$_GET['id']][faxname]; - - $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; - $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - - //delete the dialplan include - if (count($a_dialplan_includes) > 0) { - $i=0; - foreach($a_dialplan_includes as $row) { - if ($row["dialplanincludeid"] == $faxid) { - $order = $row['order']; - unset($a_dialplan_includes[$i]); - } - $i++; - } - } - - //delete the dialplan include details. aka. child data - if (count($a_dialplan_includes_details) > 0) { - $i=0; - foreach($a_dialplan_includes_details as $row) { - if ($row["dialplanincludeid"] == $faxid) { - unset($a_dialplan_includes_details[$i]); - } - $i++; - } - } - - if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){ - unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml"); - } - - //remove fax entries - unset($a_fax[$_GET['id']]); - - write_config(); - header("Location: freeswitch_fax.php"); - exit; - } - } -} - -if (($_POST['type'] == "fax_send") && is_uploaded_file($_FILES['fax_file']['tmp_name'])) { - - $fax_number = $_POST['fax_number']; - $fax_name = $_FILES['fax_file']['name']; - $fax_name = str_replace(".tif", "", $fax_name); - $fax_name = str_replace(".tiff", "", $fax_name); - $fax_name = str_replace(".pdf", "", $fax_name); - $fax_gateway = $_POST['fax_gateway']; - - $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; - $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; - $host = $config['interfaces']['lan']['ipaddr']; - - //upload the file - move_uploaded_file($_FILES['fax_file']['tmp_name'], $dir_fax_temp.$_FILES['fax_file']['name']); - - $fax_file_extension = substr($dir_fax_temp.$_FILES['fax_file']['name'], -4); - if ($fax_file_extension == ".pdf") { - exec("cd ".$dir_fax_temp.";gs -q -sDEVICE=tiffg3 -r204x98 -dNOPAUSE -sOutputFile=".$fax_name.".tif -- ".$fax_name.".pdf -c quit"); - //exec("rm ".$dir_fax_temp.$fax_name.".pdf"); - } - if ($fax_file_extension == ".tiff") { - exec("cp ".$dir_fax_temp.$fax_name.".tiff ".$dir_fax_temp.$fax_name.".tif"); - exec("rm ".$dir_fax_temp.$fax_name.".tiff"); - } - - //send the fax - $fp = event_socket_create($host, $port, $password); - $cmd = "api originate [absolute_codec_string=PCMU]sofia/gateway/".$fax_gateway."/".$fax_number." &txfax(".$dir_fax_temp.$fax_name.".tif)"; - $response = event_socket_request($fp, $cmd); - $response = str_replace("\n", "", $response); - $uuid = str_replace("+OK ", "", $response); - fclose($fp); - - //if ($response >= 1) { - // $fp = event_socket_create($host, $port, $password); - // $cmd = "api uuid_getvar ".$uuid." fax_result_text"; - // echo $cmd."\n"; - // $response = event_socket_request($fp, $cmd); - // $response = trim($response); - // fclose($fp); - //} - - sleep(5); - - //copy the .tif to the sent directory - exec("cp ".$dir_fax_temp.$fax_name.".tif ".$dir_fax_sent.$fax_name.".tif"); - - //delete the .tif from the temp directory - //exec("rm ".$dir_fax_temp.$fax_name.".tif"); - - //convert the tif to pdf and png - exec("cd $dir_fax_sent; /usr/local/bin/tiff2png ".$dir_fax_sent.$fax_name.".tif"); - exec("cd $dir_fax_sent; /usr/local/bin/tiff2pdf -f -o ".$fax_name.".pdf ".$dir_fax_sent.$fax_name.".tif"); - - header("Location: freeswitch_fax_edit.php?id=".$id."&msg=".$response); - exit; -} - -if ($_GET['a'] == "download") { - - session_cache_limiter('public'); - - if ($_GET['type'] == "fax_inbox") { - - if (file_exists($dir_fax_inbox.$_GET['filename'])) { - - $fd = fopen($dir_fax_inbox.$_GET['filename'], "rb"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - $file_ext = substr($_GET['filename'], -3); - if ($file_ext == "png") { - header("Content-Type: image/png"); - } - } - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize($dir_fax_inbox.$_GET['filename'])); - fpassthru($fd); - } - else { - echo "not found"; - } - exit; - } - -} -else { - //echo $dir_fax_inbox.$_GET['filename']; -} - - -if ($_GET['a'] == "download") { - - session_cache_limiter('public'); - - if ($_GET['type'] == "fax_sent") { - if (file_exists($dir_fax_sent.$_GET['filename'])) { - $fd = fopen($dir_fax_sent.$_GET['filename'], "rb"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - $file_ext = substr($_GET['filename'], -3); - if ($file_ext == "png") { - header("Content-Type: image/png"); - } - } - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize($dir_fax_sent.$_GET['filename'])); - fpassthru($fd); - } - - } - - exit; -} -else { - //echo $dir_fax_inbox.$_GET['filename']; -} - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'fax_inbox') { - //if ($a_fax[$_GET['id']]) { - $tmp_file_array = split("\.",$_GET['filename']); - $file_name = $tmp_file_array[0]; - $file_ext = $tmp_file_array[1]; - unlink_if_exists($dir_fax_inbox.$file_name.".pdf"); - unlink_if_exists($dir_fax_inbox.$file_name.".png"); - unlink_if_exists($dir_fax_inbox.$file_name.".tif"); - //unset($a_fax[$_GET['id']]); - write_config(); - header("Location: freeswitch_fax.php"); - exit; - //} - } -} - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'fax_sent') { - //if ($a_fax[$_GET['id']]) { - $tmp_file_array = split("\.",$_GET['filename']); - $file_name = $tmp_file_array[0]; - $file_ext = $tmp_file_array[1]; - unlink_if_exists($dir_fax_sent.$file_name.".pdf"); - unlink_if_exists($dir_fax_sent.$file_name.".png"); - unlink_if_exists($dir_fax_sent.$file_name.".tif"); - //unset($a_fax[$_GET['id']]); - write_config(); - header("Location: freeswitch_fax.php"); - exit; - //} - } -} - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if (!$input_errors) { - - $ent = array(); - if (strlen($_POST['faxid']) > 0) { - $ent['faxid'] = $_POST['faxid']; - } - else { - $ent['faxid'] = guid(); - } - $ent['faxextension'] = $_POST['faxextension']; - $ent['faxname'] = $_POST['faxname']; - $ent['faxemail'] = $_POST['faxemail']; - $ent['faxdomain'] = $_POST['faxdomain']; - $ent['faxdescription'] = $_POST['faxdescription']; - - if (isset($id) && $a_fax[$id]) { - //update - $a_fax[$id] = $ent; - } - else { - //add - $a_fax[] = $ent; - } - - if (!is_dir('/usr/local/freeswitch/storage/fax/')) { - exec("mkdir /usr/local/freeswitch/storage/fax/"); - } - - $faxfolder = '/usr/local/freeswitch/storage/fax/'.$_POST['faxextension']; - if (!is_dir($faxfolder)) { - exec('mkdir '.$faxfolder); - } - if (!is_dir($faxfolder.'/inbox/')) { - exec('mkdir '.$faxfolder.'/inbox/'); - } - if (!is_dir($faxfolder.'/sent/')) { - exec('mkdir '.$faxfolder.'/sent/'); - } - if (!is_dir($faxfolder.'/temp/')) { - exec('mkdir '.$faxfolder.'/temp/'); - } - write_config(); - sync_package_freeswitch_fax(); - - header("Location: freeswitch_fax.php"); - exit; - } -} - -include("head.inc"); - -?> - -<script type="text/javascript" language="JavaScript"> - -function show_advanced_config() { - document.getElementById("showadvancedbox").innerHTML=''; - aodiv = document.getElementById('showadvanced'); - aodiv.style.display = "block"; -} - -</script> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: FAX: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); -?> - - -<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>FAX Setup<br> - </strong></span> - </p></td> - </tr> - </table> - <br /> - - <form action="freeswitch_fax_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"> - <input name="faxextension" type="text" class="formfld unknown" id="faxextension" size="40" value="<?=htmlspecialchars($pconfig['faxextension']);?>"> - <br><span class="vexpl">Enter the fax extension here.<br></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">Name</td> - <td width="75%" class="vtable"> - <input name="faxname" type="text" class="formfld unknown" id="faxname" size="40" value="<?=htmlspecialchars($pconfig['faxname']);?>"> - <br><span class="vexpl">Enter the name here.<br></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">Email</td> - <td width="75%" class="vtable"> - <input name="faxemail" type="text" class="formfld unknown" id="faxemail" size="40" value="<?=htmlspecialchars($pconfig['faxemail']);?>"> - <br><span class="vexpl">Optional: Enter the email address to send the FAX to.<br></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncellreq">Domain</td> - <td width="75%" class="vtable"> - <input name="faxdomain" type="text" class="formfld unknown" id="faxdomain" size="40" value="<?=htmlspecialchars($pconfig['faxdomain']);?>"> - <br><span class="vexpl">Enter the domain here.<br></span> - </td> - </tr> - <!-- - <tr> - <td width="25%" valign="top" class="vncellreq" nowrap>Attach File</td> - <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'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - } - echo " </select>\n"; - */ - ?> - Choose whether to attach the file to the email. - </td> - </tr> - --> - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="25%" valign="top" class="vncellreq">Description</td> - <td width="75%" class="vtable"> - <input name="faxdescription" type="text" class="formfld unknown" id="faxdescription" size="40" value="<?=htmlspecialchars($pconfig['faxdescription']);?>"> - <br><span class="vexpl">Enter the description here.<br></span> - </td> - </tr> - <tr> - <td valign="top"> </td> - <td> - <input name="faxid" type="hidden" value="<?=htmlspecialchars($pconfig['faxid']);?>"> - <?php if (isset($id) && $a_fax[$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 /> - - - <table width="100%" border="0" cellpadding="3" cellspacing="0"> - <tr> - <td width='30%'> - <span class="vexpl"><span class="red"><strong>Send</strong></span> - </td> - </tr> - <tr> - <td> - To send a fax you can upload a .tif file or if ghost script has been installed then you can also send a fax by uploading a PDF. (pkg_add -r ghostscript8-nox11; rehash) - When sending a fax you can view status of the transmission by viewing the logs from the Status tab or by watching the response from the FreeSWITCH console. - </td> - </tr> - <tr> - <td align='right' nowrap> - <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit=""> - <table border='0' cellpadding='3' cellspacing='0' width='100%'> - <tr> - <td valign="middle" class="label"> - Fax Number - </td> - <td valign="top" class="label"> - <input type="text" name="fax_number" value=""> - </td> - <td align="left">Upload:</td> - <td valign="top" class="label"> - <input name="id" type="hidden" value="$id"> - <input name="type" type="hidden" value="fax_send"> - <input name="fax_file" type="file" class="button" id="fax_file"> - </td> - <td valign="middle" class="label"> - Gateway - </td> - <td valign="top" class="label"> - - <?php - //create a temporary id for the array - $a_gateways = &$config['installedpackages']['freeswitchgateways']['config']; - - $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"); } - - echo "<select name='fax_gateway' class='formfld'>"; - $i = 0; - if (count($a_gateways) > 0) { - - foreach ($a_gateways as $ent) { - echo "<option>".$ent['gateway']."</option>\n"; - } - } - echo "</select>\n"; - - ?> - </td> - <td> - <input name="submit" type="submit" class="button" id="upload" value="Send FAX"> - </td> - </tr> - </table> - </div> - </form> - </td> - </tr> - </table> - - - - <br /> - <br /> - <br /> - <br /> - - <table width="100%" border="0" cellpadding="5" cellspacing="0"> - <tr> - <td> - <span class="vexpl"><span class="red"><strong>Inbox</strong></span> - </td> - <td align='right'> - <b>location:</b> <?php echo $dir_fax_inbox; ?> - </td> - </tr> - </table> - - <div id="niftyOutter"> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="50%" class="listhdrr">File Name (download)</td> - <td width="10%" class="listhdrr">Download</td> - <td width="10%" class="listhdrr">View</td> - <td width="20%" class="listhdr">Last Modified</td> - <td width="10%" class="listhdr" nowrap>Size</td> - </tr> - - <?php - - if ($handle = opendir($dir_fax_inbox)) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != ".." && is_file($dir_fax_inbox.$file)) { - - $tmp_filesize = filesize($dir_fax_inbox.$file); - $tmp_filesize = byte_convert($tmp_filesize); - - $tmp_file_array = split("\.",$file); - $file_name = $tmp_file_array[0]; - $file_ext = $tmp_file_array[1]; - - if ($file_ext == "tif") { - - echo "<tr>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file."\">\n"; - echo " $file"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file_name.".pdf\">\n"; - echo " pdf"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=png&filename=".$file_name.".png\" target=\"_blank\">\n"; - echo " png"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo date ("F d Y H:i:s", filemtime($dir_fax_inbox.$file)); - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " ".$tmp_filesize; - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - //echo " <td valign=\"middle\"><a href=\"freeswitch_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"freeswitch_fax_edit.php?id=".$id."&type=fax_inbox&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo "</tr>\n"; - } - - } - } - closedir($handle); - } - ?> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - - <br /> - <br /> - <br /> - <br /> - - <table width="100%" border="0" cellpadding="5" cellspacing="0"> - <tr> - <td> - <span class="vexpl"><span class="red"><strong>Sent</strong></span> - </td> - <td align='right'> - <b>location:</b> <?php echo $dir_fax_sent; ?> - </td> - </tr> - </table> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="50%" class="listhdrr">File Name (download)</td> - <td width="10%" class="listhdrr">Download</td> - <td width="10%" class="listhdrr">View</td> - <td width="20%" class="listhdr">Last Modified</td> - <td width="10%" class="listhdr" nowrap>Size</td> - </tr> - - <?php - - if ($handle = opendir($dir_fax_sent)) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != ".." && is_file($dir_fax_sent.$file)) { - - $tmp_filesize = filesize($dir_fax_sent.$file); - $tmp_filesize = byte_convert($tmp_filesize); - - $tmp_file_array = split("\.",$file); - $file_name = $tmp_file_array[0]; - $file_ext = $tmp_file_array[1]; - - if ($file_ext == "tif") { - - echo "<tr>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file."\">\n"; - echo " $file"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file_name.".pdf\">\n"; - echo " pdf"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=png&filename=".$file_name.".png\" target=\"_blank\">\n"; - echo " png"; - echo " </a>"; - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo date ("F d Y H:i:s", filemtime($dir_fax_sent.$file)); - echo " </td>\n"; - echo " <td class=\"listlr\" ondblclick=\"\">\n"; - echo " ".$tmp_filesize; - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - //echo " <td valign=\"middle\"><a href=\"freeswitch_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"freeswitch_fax_edit.php?id=".$id."&type=fax_sent&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo "</tr>\n"; - } - - } - } - closedir($handle); - } - ?> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - - - <br /> - <br /> - <br /> - <br /> - - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_features.tmp b/config/freeswitch_dev/freeswitch_features.tmp deleted file mode 100644 index 9f20916d..00000000 --- a/config/freeswitch_dev/freeswitch_features.tmp +++ /dev/null @@ -1,220 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Features</p>\n"; -?> - - -<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 *3472 (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'>FAX</td> - </tr> - <tr> - <td width='10%' class="vncell"><a href='freeswitch_fax.php'>Open</a></td> - <td class="vtable"> - Transmit and View Received Faxes. - </td> - </tr> - </table> - - <br /> - <br /> - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td class="listtopic" colspan='2'>Hunt Group</td> - </tr> - <tr> - <td width='10%' class="vncell"><a href='freeswitch_hunt_group.php'>Open</a></td> - <td class="vtable"> - Hunt Group is a group of destinations to call at once or in succession. - </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_dev/freeswitch_gateways.tmp b/config/freeswitch_dev/freeswitch_gateways.tmp deleted file mode 100644 index 397646ea..00000000 --- a/config/freeswitch_dev/freeswitch_gateways.tmp +++ /dev/null @@ -1,217 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_gateways.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_gateways = &$config['installedpackages']['freeswitchgateways']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'gateways') { - if ($a_gateways[$_GET['id']]) { - $tmp_file_name = "/usr/local/freeswitch/conf/sip_profiles/external/".$_GET['gateway'].".xml"; - if (file_exists($tmp_file_name)) { - unlink($tmp_file_name); - } - unset($a_gateways[$_GET['id']]); - write_config(); - header("Location: freeswitch_gateways.php"); - exit; - } - } -} - -include("head.inc"); - -?> - - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Gateways</p>\n"; -?> - -<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_gateways.php" method="post" name="iform" id="iform"> -<?php - -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 gateways 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"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>Gateways<br> - </strong></span> - Use this to configure your SIP gateways also known as providers. - </p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr">Gateway</td> - <td width="25%" class="listhdrr">Context</td> - <td width="25%" class="listhdrr">Enabled</td> - <td width="25%" class="listhdr">Description</td> - <td width="10%" class="list"> - - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - - </td> - </tr> - - - <?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=<?=$ent['id'];?>';"> - <?=$ent['gateway'];?> - </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=<?=$ent['id'];?>';"> - <?=$ent['enabled'];?> - </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=<?=$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 - - $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"><a href="freeswitch_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - -</form> - - -/usr/local/freeswitch/conf/sip_profiles/external/ -<br> -<br> -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_gateways_edit.tmp b/config/freeswitch_dev/freeswitch_gateways_edit.tmp deleted file mode 100644 index 2ee6259d..00000000 --- a/config/freeswitch_dev/freeswitch_gateways_edit.tmp +++ /dev/null @@ -1,697 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_gateways_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_gateways = &$config['installedpackages']['freeswitchgateways']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -if (isset($id) && $a_gateways[$id]) { - - $pconfig['gatewayid'] = $a_gateways[$id]['gatewayid']; - $gatewayid = $a_gateways[$id]['gatewayid']; - $pconfig['gateway'] = $a_gateways[$id]['gateway']; - $pconfig['username'] = $a_gateways[$id]['username']; - $pconfig['auth-username'] = $a_gateways[$id]['auth-username']; - $pconfig['password'] = $a_gateways[$id]['password']; - $pconfig['realm'] = $a_gateways[$id]['realm']; - $pconfig['from-user'] = $a_gateways[$id]['from-user']; - $pconfig['from-domain'] = $a_gateways[$id]['from-domain']; - $pconfig['proxy'] = $a_gateways[$id]['proxy']; - $pconfig['expire-seconds'] = $a_gateways[$id]['expire-seconds']; - $pconfig['register'] = $a_gateways[$id]['register']; - $pconfig['register-transport'] = $a_gateways[$id]['register-transport']; - $pconfig['retry-seconds'] = $a_gateways[$id]['retry-seconds']; - $pconfig['extension'] = $a_gateways[$id]['extension']; - $pconfig['ping'] = $a_gateways[$id]['ping']; - $pconfig['caller-id-in-from'] = $a_gateways[$id]['caller-id-in-from']; - $pconfig['supress-cng'] = $a_gateways[$id]['supress-cng']; - - $pconfig['effective_caller_id_name'] = $a_gateways[$id]['effective_caller_id_name']; - $pconfig['effective_caller_id_number'] = $a_gateways[$id]['effective_caller_id_number']; - $pconfig['outbound_caller_id_name'] = $a_gateways[$id]['outbound_caller_id_name']; - $pconfig['outbound_caller_id_number'] = $a_gateways[$id]['outbound_caller_id_number']; - - $pconfig['context'] = $a_gateways[$id]['context']; - $pconfig['enabled'] = $a_gateways[$id]['enabled']; - $pconfig['description'] = $a_gateways[$id]['description']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if (!$input_errors) { - - $effective_caller_id_number = $_POST['effective_caller_id_number']; - $outbound_caller_id_number = $_POST['outbound_caller_id_number']; - $replace_array = array("(", ")", " ", "-"); - $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number); - $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number); - - $ent = array(); - if (strlen($_POST['ivrid']) > 0) { - $ent['gatewayid'] = $_POST['ivrid']; - } - else { - $ent['gatewayid'] = guid(); - } - $ent['gateway'] = $_POST['gateway']; - $ent['username'] = $_POST['username']; - $ent['auth-username'] = $_POST['auth-username']; - $ent['password'] = $_POST['password']; - $ent['realm'] = $_POST['realm']; - $ent['from-user'] = $_POST['from-user']; - $ent['from-domain'] = $_POST['from-domain']; - $ent['proxy'] = $_POST['proxy']; - $ent['expire-seconds'] = $_POST['expire-seconds']; - $ent['register'] = $_POST['register']; - $ent['register-transport'] = $_POST['register-transport']; - $ent['retry-seconds'] = $_POST['retry-seconds']; - $ent['extension'] = $_POST['extension']; - $ent['ping'] = $_POST['ping']; - $ent['caller-id-in-from'] = $_POST['caller-id-in-from']; - $ent['supress-cng'] = $_POST['supress-cng']; - - $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name']; - $ent['effective_caller_id_number'] = $effective_caller_id_number; - $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name']; - $ent['outbound_caller_id_number'] = $outbound_caller_id_number; - - $ent['context'] = $_POST['context']; - $ent['enabled'] = $_POST['enabled']; - $ent['description'] = $_POST['description']; - - if (isset($id) && $a_gateways[$id]) { - //update - $a_gateways[$id] = $ent; - } - else { - //add - $a_gateways[] = $ent; - } - - - if (strlen(trim($_POST['dialplan_expression']))> 0) { - - $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']; - - - $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) { - case "^(\d{7})$": - $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; - $label = "7 digits"; - $abbrv = "7d"; - break; - case "^(\d{10})$": - $action_data = "sofia/gateway/".$gateway."/1\$1"; - $label = "10 digits"; - $abbrv = "10d"; - break; - case "^(\d{11})$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "11 digits"; - $abbrv = "11d"; - break; - case "^(311)$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "311"; - $abbrv = "311"; - break; - case "^(411)$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "411"; - $abbrv = "411"; - break; - case "^(911)$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "911"; - $abbrv = "911"; - break; - case "^9(\d{3})$": - $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; - $label = "dial 9, 3 digits"; - $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; - case "^9(\d{7})$": - $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1"; - $label = "dial 9, 7 digits"; - $abbrv = "9.7d"; - break; - case "^9(\d{10})$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "dial 9, 10 digits"; - $abbrv = "9.10d"; - break; - case "^9(\d{11})$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "dial 9, 11 digits"; - $abbrv = "9.11d"; - break; - case "^1?(8(00|55|66|77|88)[2-9]\d{6})$": - $action_data = "sofia/gateway/".$gateway."/\$1"; - $label = "toll free"; - $abbrv = "tollfree"; - break; - default: - $action_data = "sofia/gateway/".$gateway."/\$1"; - $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 = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'condition'; //condition, action, antiaction - $ent['fieldtype'] = 'destination_number'; - $ent['fielddata'] = $dialplan_expression; - $ent['fieldorder'] = '000'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - if (strlen($effective_caller_id_name) > 0) { - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'effective_caller_id_name='.$effective_caller_id_name; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; - unset($ent); - } - if (strlen($effective_caller_id_number) > 0) { - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'effective_caller_id_number='.$effective_caller_id_number; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; - unset($ent); - } - if (strlen($outbound_caller_id_name) > 0) { - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'outbound_caller_id_name='.$outbound_caller_id_name; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; - unset($ent); - } - if (strlen($outbound_caller_id_number) > 0) { - $ent = array(); - $ent['dialplanincludeid'] = $dialplanincludeid; - $ent['tag'] = 'action'; //condition, action, antiaction - $ent['fieldtype'] = 'set'; - $ent['fielddata'] = 'outbound_caller_id_number='.$outbound_caller_id_number; - $ent['fieldorder'] = '001'; - $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; - $ent['fieldorder'] = '001'; - $a_dialplan_include_details[] = $ent; - unset($ent); - - unset($label); - unset($abbrv); - unset($dialplan_expression); - unset($action_data); - } //if strlen - } //end for each - } - - write_config(); - sync_package_freeswitch_gateways(); - sync_package_freeswitch_dialplan_includes(); - - header("Location: freeswitch_gateways.php"); - exit; - } -} - -include("head.inc"); - -?> - - -<script type="text/javascript" language="JavaScript"> - -function enable_change(enable_over) { - var endis; - endis = !(document.iform.enable.checked || enable_over); - document.iform.range_from.disabled = endis; - document.iform.range_to.disabled = endis; -} - -function show_advanced_config() { - document.getElementById("showadvancedbox").innerHTML=''; - aodiv = document.getElementById('showadvanced'); - aodiv.style.display = "block"; -} - -</script> - - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Gateways: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); -?> - - -<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>Gateway Setup<br> - </strong></span> - The 'SIP Provider Examples' from the FreeSWITCH wiki can be used as reference to get started. <br /> - <a href='http://wiki.freeswitch.org/wiki/SIP_Provider_Examples' target='_blank'>http://wiki.freeswitch.org/wiki/SIP_Provider_Examples</a> - </p></td> - </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"> - <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> - <td width="22%" valign="top" class="vncellreq">Username</td> - <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"> - <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"> - <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"> - <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"> - <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"> - <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> - <td width="22%" valign="top" class="vncellreq">Expire-seconds</td> - <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 - echo " <select name='register' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['register'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - 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"> - <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> - <td width="22%" valign="top" class="vncell">Effective Caller ID Name</td> - <td width="78%" class="vtable"> - <input name="effective_caller_id_name" type="text" class="formfld" 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="22%" valign="top" class="vncell">Effective Caller ID Number</td> - <td width="78%" class="vtable"> - <input name="effective_caller_id_number" type="text" class="formfld" 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> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Outbound Caller ID Name</td> - <td width="78%" class="vtable"> - <input name="outbound_caller_id_name" type="text" class="formfld" 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="22%" valign="top" class="vncell">Outbound Caller ID Number</td> - <td width="78%" class="vtable"> - <input name="outbound_caller_id_number" type="text" class="formfld" 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> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Context</td> - <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> - </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"> - <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a> - </td> - </tr> - </table> - </div> - <div id="showadvanced" style="display:none"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="22%" valign="top" class="vncell">Auth-username</td> - <td width="78%" class="vtable"> - <input name="auth-username" type="text" class="formfld" id="auth-username" size="40" value="<?=htmlspecialchars($pconfig['auth-username']);?>"> - <br> <span class="vexpl">Enter the auth-username here.<br></span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Register-transport</td> - <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. - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Extension</td> - <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">Ping</td> - <td width="78%" class="vtable"> - <input name="ping" type="text" class="formfld" id="ping" size="40" value="<?=htmlspecialchars($pconfig['ping']);?>"> - <br> <span class="vexpl">Enter the ping interval here in seconds.<br></span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Caller-id-in-from</td> - <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'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - 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 - echo " <select name='supress-cng' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['supress-cng'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - 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 - echo " <select name='enabled' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - 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"> - <?php - echo "<textarea name=\"dialplan_expression\" id=\"dialplan_expression\" cols=\"30\" rows=\"4\" wrap=\"off\"></textarea>\n"; - ?> - <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 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> - <option value='^011(.*)$'>011 International</option> - <option value='^311$'>311 information</option> - <option value='^411$'>411 information</option> - <option value='^911$'>911 emergency</option> - <option value='^1?(8(00|55|66|77|88)[2-9]\d{6})$'>toll free</option> - <option value='^9(\d{3})$'>Dial 9 then 3 digits</option> - <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> - </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. - </span></td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncell">Gateway Description</td> - <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> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <?php if (isset($id) && $a_gateways[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <input name="gatewayid" type="hidden" value="<?=htmlspecialchars($pconfig['gatewayid']);?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> - - <br> - <br> - <br> - <br> - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_hunt_group.tmp b/config/freeswitch_dev/freeswitch_hunt_group.tmp deleted file mode 100644 index f7bffe72..00000000 --- a/config/freeswitch_dev/freeswitch_hunt_group.tmp +++ /dev/null @@ -1,209 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_hunt_group.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_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config']; -$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; -$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'huntgroup') { - if ($a_hunt_group[$_GET['id']]) { - if (file_exists("/usr/local/freeswitch/scripts/huntgroup_".$_GET['huntgroupid'].".js")) { - unlink("/usr/local/freeswitch/scripts/huntgroup_".$_GET['huntgroupid'].".js"); - } - /* - //delete dialplan include details - if (count($a_dialplan_includes) > 0) { - $i = 0; - foreach($a_dialplan_includes as $row) { - echo $row['opt1value']." == {".$_GET['huntgroupid']."}<br />\n"; - if ($row['opt1value'] == '{'.$_GET['huntgroupid'].'}') { - $dialplanincludeid = $row['dialplanincludeid']; - $id = $i; - unset($a_dialplan_include_details[$id]); - } - $i++; - } - unset($i); - } - - //delete dialplan include details - if (count($a_dialplan_include_details) > 0) { - $i = 0; - foreach($a_dialplan_include_details as $row) { - if ($row['dialplanincludeid'] == $dialplanincludeid) { - $id = $i; - unset($a_dialplan_include_details[$id]); - } - $i++; - } - unset($i); - } - */ - unset($a_hunt_group[$_GET['id']]); - write_config(); - sync_package_freeswitch_hunt_group(); - header("Location: freeswitch_hunt_group.php"); - exit; - } - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group</p>\n"; -?> - -<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_hunt_group.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>Hunt Group<br /> - </strong></span> - Hunt Group is a group of destinations to call at once or in succession. - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr">Extension</td> - <td width="25%" class="listhdrr">Name</td> - <td width="50%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <?php - $i = 0; - if (count($a_hunt_group) > 0) { - foreach ($a_hunt_group as $ent) { - if (strlen($ent['huntgroupid']) > 0) { - - $huntgroupid = str_replace(array("{", "}"), "", $ent['huntgroupid']); - - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>'"> - <?=$ent['huntgroupextension']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';"> - <?=$ent['huntgroupname'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($ent['huntgroupdescr']);?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_hunt_group_edit.php?id=<?=$i;?>&huntgroupid=<?php echo $ent['huntgroupid'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_hunt_group.php?type=huntgroup&act=del&id=<?=$i;?>&huntgroupid=<?php echo $huntgroupid; ?>" 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="3"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - -</form> - -<br> -<br> -/usr/local/freeswitch/scripts/ -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_hunt_group_destinations.tmp b/config/freeswitch_dev/freeswitch_hunt_group_destinations.tmp deleted file mode 100644 index 7f1adaf0..00000000 --- a/config/freeswitch_dev/freeswitch_hunt_group_destinations.tmp +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_hunt_group_destinations.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_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'huntgroupdestinations') { - if ($a_hunt_group_destinations[$_GET['id']]) { - unset($a_hunt_group_destinations[$_GET['id']]); - write_config(); - sync_package_freeswitch_hunt_group(); - header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['parentid']); - exit; - } - } -} - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_hunt_group_destinations_edit.tmp b/config/freeswitch_dev/freeswitch_hunt_group_destinations_edit.tmp deleted file mode 100644 index 5bc17d3a..00000000 --- a/config/freeswitch_dev/freeswitch_hunt_group_destinations_edit.tmp +++ /dev/null @@ -1,273 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_hunt_group_destinations_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_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config']; - - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -$parentid = $_GET['parentid']; -if (isset($_POST['parentid'])) { - $parentid = $_POST['parentid']; -} - -$huntgroupid = $_GET['huntgroupid']; -if (isset($_POST['huntgroupid'])) { - $huntgroupid = $_POST['huntgroupid']; -} - - -if (isset($id) && $a_hunt_group_destinations[$id]) { - $pconfig['destinationnumber'] = $a_hunt_group_destinations[$id]['destinationnumber']; - $pconfig['destinationtype'] = $a_hunt_group_destinations[$id]['destinationtype']; - $pconfig['destinationprofile'] = $a_hunt_group_destinations[$id]['destinationprofile']; - $pconfig['destinationorder'] = $a_hunt_group_destinations[$id]['destinationorder']; - $pconfig['destinationdescr'] = $a_hunt_group_destinations[$id]['destinationdescr']; -} -else { - if (isset($_GET['a'])) { - //if ($_GET['a'] == "action"){ $pconfig['destinationaction'] = "action"; } - //if ($_GET['a'] == "antiaction"){ $pconfig['destinationaction'] = "anti-action"; } - } -} - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - $huntgroupdestinationent = array(); - $huntgroupdestinationent['huntgroupid'] = $_POST['huntgroupid']; - $huntgroupdestinationent['destinationnumber'] = $_POST['destinationnumber']; - $huntgroupdestinationent['destinationtype'] = $_POST['destinationtype']; - $huntgroupdestinationent['destinationprofile'] = $_POST['destinationprofile']; - $huntgroupdestinationent['destinationorder'] = $_POST['destinationorder']; - $huntgroupdestinationent['destinationdescr'] = $_POST['destinationdescr']; - - if (isset($id) && $a_hunt_group_destinations[$id]) { - //update - $a_hunt_group_destinations[$id] = $huntgroupdestinationent; - } - else { - //add - $a_hunt_group_destinations[] = $huntgroupdestinationent; - } - - - write_config(); - sync_package_freeswitch_hunt_group(); - - header("Location: freeswitch_hunt_group_edit.php?id=".$parentid); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group: Destinations: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); -?> - -<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" > - <br /> - <form action="freeswitch_hunt_group_destinations_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">Destination</td> - <td width="78%" class="vtable"> - <input name="destinationnumber" type="text" class="formfld" id="destinationnumber" size="40" value="<?=htmlspecialchars($pconfig['destinationnumber']);?>"> - <br> - <span class="vexpl"> - <!--<b>examples:</b><br />--> - extension: 1001<br /> - voicemail: 1001<br /> - sip uri (voicemail): sofia/internal/*98@${domain}<br /> - sip uri (external number): sofia/gateway/gatewayname/12081231234<br /> - sip uri (auto attendant): sofia/internal/5002@${domain}<br /> - </span> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Type</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='destinationtype' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['destinationtype']) == "extension") { - echo " <option selected='yes'>extension</option>\n"; - } - else { - echo " <option>extension</option>\n"; - } - if (htmlspecialchars($pconfig['destinationtype']) == "voicemail") { - echo " <option selected='yes'>voicemail</option>\n"; - } - else { - echo " <option>voicemail</option>\n"; - } - if (htmlspecialchars($pconfig['destinationtype']) == "sip uri") { - echo " <option selected='yes'>sip uri</option>\n"; - } - else { - echo " <option>sip uri</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Profile</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='destinationprofile' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['destinationprofile']) == "auto") { - echo " <option selected='yes'>auto</option>\n"; - } - else { - echo " <option>auto</option>\n"; - } - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ - $sip_profile_name = str_replace(".xml", "", $sip_profile_file); - - if (htmlspecialchars($pconfig['destinationprofile']) == $sip_profile_name) { - echo " <option selected='yes'>$sip_profile_name</option>\n"; - } - else { - echo " <option>$sip_profile_name</option>\n"; - } - } - echo " </select>\n"; - - - ?> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncell">Order</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='destinationorder' class='formfld'>\n"; - //echo " <option></option>\n"; - if (strlen(htmlspecialchars($pconfig['destinationorder']))> 0) { - echo " <option selected='yes' value='".htmlspecialchars($pconfig['destinationorder'])."'>".htmlspecialchars($pconfig['destinationorder'])."</option>\n"; - } - $i=0; - while($i<=999) { - 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"; - } - - $i++; - } - echo " </select>\n"; - ?> - <br /> - Processing of each destination is determined by this order. - - <br> <span class="vexpl"></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> - <input name="destinationdescr" type="text" class="formfld" id="destinationdescr" size="40" value="<?=htmlspecialchars($pconfig['destinationdescr']);?>"> - <br> <span class="vexpl">You may enter a description here - for your reference (not parsed).</span></td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="huntgroupid" type="hidden" value="<?=$huntgroupid;?>"> - <input name="parentid" type="hidden" value="<?=$parentid;?>"> - <?php if (isset($id) && $a_hunt_group_destinations[$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> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_hunt_group_edit.tmp b/config/freeswitch_dev/freeswitch_hunt_group_edit.tmp deleted file mode 100644 index bf78206e..00000000 --- a/config/freeswitch_dev/freeswitch_hunt_group_edit.tmp +++ /dev/null @@ -1,514 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_hunt_group_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_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config']; -$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config']; - - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} -$parentid = $id; - - - -if (isset($id) && $a_hunt_group[$id]) { - $pconfig['huntgroupid'] = $a_hunt_group[$id]['huntgroupid']; - $huntgroupid = $a_hunt_group[$id]['huntgroupid']; - $pconfig['huntgroupextension'] = $a_hunt_group[$id]['huntgroupextension']; - $pconfig['huntgroupname'] = $a_hunt_group[$id]['huntgroupname']; - $pconfig['huntgrouptype'] = $a_hunt_group[$id]['huntgrouptype']; - $pconfig['huntgroupcontext'] = $a_hunt_group[$id]['huntgroupcontext']; - $pconfig['huntgrouptimeout'] = $a_hunt_group[$id]['huntgrouptimeout']; - $pconfig['huntgrouptimeoutdestination'] = $a_hunt_group[$id]['huntgrouptimeoutdestination']; - $pconfig['huntgrouptimeouttype'] = $a_hunt_group[$id]['huntgrouptimeouttype']; - $pconfig['huntgroupringback'] = $a_hunt_group[$id]['huntgroupringback']; - $pconfig['huntgroupcidnameprefix'] = $a_hunt_group[$id]['huntgroupcidnameprefix']; - $pconfig['huntgrouppin'] = $a_hunt_group[$id]['huntgrouppin']; - $pconfig['huntgroupcallerannounce'] = $a_hunt_group[$id]['huntgroupcallerannounce']; - $pconfig['huntgroupdescr'] = $a_hunt_group[$id]['huntgroupdescr']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if ($_GET['act'] == "del") { - if ($_GET['type'] == 'destinations') { - if ($a_hunt_group_destinations[$_GET['optionid']]) { - unset($a_hunt_group_destinations[$_GET['optionid']]); - write_config(); - sync_package_freeswitch_hunt_group(); - header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['id']); - exit; - } - } - } - - - if (!$input_errors) { - - $huntgroupent = array(); - if (strlen($_POST['huntgroupid']) > 0) { - $huntgroupent['huntgroupid'] = $_POST['huntgroupid']; - } - else { - $huntgroupent['huntgroupid'] = guid(); - } - $huntgroupent['huntgroupextension'] = $_POST['huntgroupextension']; - $huntgroupent['huntgroupname'] = $_POST['huntgroupname']; - $huntgroupent['huntgrouptype'] = $_POST['huntgrouptype']; - $huntgroupent['huntgroupcontext'] = $_POST['huntgroupcontext']; - $huntgroupent['huntgrouptimeout'] = $_POST['huntgrouptimeout']; - $huntgroupent['huntgrouptimeoutdestination'] = $_POST['huntgrouptimeoutdestination']; - $huntgroupent['huntgrouptimeouttype'] = $_POST['huntgrouptimeouttype']; - $huntgroupent['huntgroupringback'] = $_POST['huntgroupringback']; - $huntgroupent['huntgroupcidnameprefix'] = $_POST['huntgroupcidnameprefix']; - $huntgroupent['huntgrouppin'] = $_POST['huntgrouppin']; - $huntgroupent['huntgroupcallerannounce'] = $_POST['huntgroupcallerannounce']; - $huntgroupent['huntgroupdescr'] = $_POST['huntgroupdescr']; - - if (isset($id) && $a_hunt_group[$id]) { - //update - $a_hunt_group[$id] = $huntgroupent; - } - else { - //add - $a_hunt_group[] = $huntgroupent; - } - - //touch($d_hostsdirty_path); - write_config(); - sync_package_freeswitch_hunt_group(); - - header("Location: freeswitch_hunt_group.php"); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Hunt Group: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); - -?> - - -<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>General Settings:<br> - </strong></span> - Hunt Group general settings. - </span></p></td> - </tr> - </table> - <br /> - - <form action="freeswitch_hunt_group_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">Extension</td> - <td width="78%" class="vtable"> - <input name="huntgroupextension" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupextension']);?>"> - <br> <span class="vexpl">e.g. <em>7002</em></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Hunt Group Name</td> - <td width="78%" class="vtable"> - <input name="huntgroupname" type="text" class="formfld" id="huntgroupname" size="40" value="<?=htmlspecialchars($pconfig['huntgroupname']);?>"> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Type</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='huntgrouptype' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['huntgrouptype']) == "simultaneous") { - echo " <option selected='yes'>simultaneous</option>\n"; - } - else { - echo " <option>simultaneous</option>\n"; - } - if (htmlspecialchars($pconfig['huntgrouptype']) == "sequentially") { - echo " <option selected='yes'>sequentially</option>\n"; - } - else { - echo " <option>sequentially</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - - <?php - if (strlen($pconfig['huntgrouptimeout']) == 0) { - $pconfig['huntgrouptimeout'] = 30; //set a default timeout - } - ?> - <tr> - <td width="22%" valign="top" class="vncell">Context</td> - <td width="78%" class="vtable"> - <input name="huntgroupcontext" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcontext']);?>"> - <br> <span class="vexpl">e.g. <em>default</em></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Timeout</td> - <td width="78%" class="vtable"> - <input name="huntgrouptimeout" type="text" class="formfld" id="huntgrouptimeout" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeout']);?>"> - <br> - <span class="vexpl"> - The timeout sets the time in seconds to continue to call before timing out. - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Timeout Type</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='huntgrouptimeouttype' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "extension") { - echo " <option selected='yes'>extension</option>\n"; - } - else { - echo " <option>extension</option>\n"; - } - if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "voicemail") { - echo " <option selected='yes'>voicemail</option>\n"; - } - else { - echo " <option>voicemail</option>\n"; - } - if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "sip uri") { - echo " <option selected='yes'>sip uri</option>\n"; - } - else { - echo " <option>sip uri</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Timeout Destination</td> - <td width="78%" class="vtable"> - <input name="huntgrouptimeoutdestination" type="text" class="formfld" id="huntgrouptimeoutdestination" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeoutdestination']);?>"> - <br> <span class="vexpl">Destination<br> - e.g. <em>1001</em></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Ring Back</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='huntgroupringback' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['huntgroupringback']) == "ring") { - echo " <option selected='yes'>ring</option>\n"; - } - else { - echo " <option>ring</option>\n"; - } - if (htmlspecialchars($pconfig['huntgroupringback']) == "music") { - echo " <option selected='yes'>music</option>\n"; - } - else { - echo " <option>music</option>\n"; - } - echo " </select>\n"; - ?> - <br> - <span class="vexpl"> - Defines what the caller will hear while destination is being called. The choices are music - (music on hold) ring (ring tone.) default: music - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">CID Prefix</td> - <td width="78%" class="vtable"> - <input name="huntgroupcidnameprefix" type="text" class="formfld" id="huntgroupcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcidnameprefix']);?>"> - <br> - <span class="vexpl"> - Set a prefix on the caller ID name. (optional) - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">PIN</td> - <td width="78%" class="vtable"> - <input name="huntgrouppin" type="text" class="formfld" id="huntgrouppin" size="40" value="<?=htmlspecialchars($pconfig['huntgrouppin']);?>"> - <br> - <span class="vexpl"> - If this is provided then the caller will be required to enter the PIN number. (optional) - </span> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncell">Caller Announce</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='huntgroupcallerannounce' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "true") { - echo " <option selected='yes'>true</option>\n"; - } - else { - echo " <option>true</option>\n"; - } - if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "false") { - echo " <option selected='yes'>false</option>\n"; - } - else { - echo " <option>false</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncell">Description</td> - <td width="78%" class="vtable"> - <input name="huntgroupdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['huntgroupdescr']);?>"> - <br> - <span class="vexpl"> - You may enter a description here for your reference (not parsed). - </span> - </td> - </tr> - - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <input name="huntgroupid" type="hidden" value="<?=htmlspecialchars($pconfig['huntgroupid']);?>"> - <?php if (isset($id) && $a_hunt_group[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> - - <br> - <br> - - <form action="freeswitch_hunt_group_edit.php" method="post" name="iform2" id="iform2"> - <?php - - - //echo "<pre>"; - //print_r ($a_hunt_group); - //echo "</pre>"; - - //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"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>Destinations<br /> - </strong></span> - The following destinations will be called. - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="40%" class="listhdrr">Destination</td> - <td width="40" class="listhdrr">Type</td> - <td width="40" class="listhdrr">Profile</td> - <td width="40" class="listhdrr">Order</td> - <td width="45%" class="listhdr">Description</td> - <td width="30" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($huntgroupid) > 1) { ?> - <a href="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - <?php } ?> - </tr> - </table> - </td> - </tr> - - <?php - //create a temporary id for the array - $i = 0; - if (count($a_hunt_group_destinations) > 0) { - foreach ($a_hunt_group_destinations as $ent) { - $a_hunt_group_destinations[$i]['id'] = $i; - $i++; - } - } - - //order the array - function cmp_number($a, $b) { - if ($a["destinationorder"] > $b["destinationorder"]) { - return 1; - } - else { - return 0; - } - } - if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_number"); } - - $i = 0; - if (count($a_hunt_group_destinations) > 0) { - foreach ($a_hunt_group_destinations as $ent) { - if ($huntgroupid == $ent['huntgroupid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>'"> - <?=$ent['destinationnumber']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';"> - <?=$ent['destinationtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';"> - <?=$ent['destinationprofile'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';"> - <?=$ent['destinationorder'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($ent['destinationdescr']);?> - </td> - <td valign="middle" nowrap class="list"> - <?php - if (strlen($huntgroupid) > 1) { - echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - echo " <td valign=\"middle\"><a href=\"freeswitch_hunt_group_destinations_edit.php?id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"freeswitch_hunt_group_destinations.php?type=huntgroupdestinations&act=del&id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\" onclick=\"return confirm('Do you really want to delete this recording?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo "</table>\n"; - } - ?> - </td> - </tr> - <?php - } - $i++; - } - } - ?> - <tr> - <td class="list" colspan="5"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($huntgroupid) > 1) { ?> - <a href="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a> - <?php } ?> - </td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="5"></td> - <td class="list"></td> - </tr> - </table> - - </form> - - - - - </td> - </tr> - - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - - - - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_ivr.tmp b/config/freeswitch_dev/freeswitch_ivr.tmp deleted file mode 100644 index 5543e755..00000000 --- a/config/freeswitch_dev/freeswitch_ivr.tmp +++ /dev/null @@ -1,180 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_ivr.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_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(); - header("Location: freeswitch_ivr.php"); - exit; - } - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: IVR</p>\n"; -?> - -<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_ivr.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>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 - 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> - <td width="25%" class="listhdrr">Name</td> - <td width="50%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <?php - $i = 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'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($ent['ivrdescr']);?> - </td> - <td valign="middle" nowrap class="list"> - <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;?>&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++; - } - } - ?> - <tr> - <td class="list" colspan="3"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - -</form> - -<br> -<br> -/usr/local/freeswitch/scripts/ -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_ivr_edit.tmp b/config/freeswitch_dev/freeswitch_ivr_edit.tmp deleted file mode 100644 index ddeac557..00000000 --- a/config/freeswitch_dev/freeswitch_ivr_edit.tmp +++ /dev/null @@ -1,702 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_ivr_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_ivr = &$config['installedpackages']['freeswitchivr']['config']; -$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; - - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} -$parentid = $id; - -//set default $ivrconditionjs - $ivrconditionjs = "function isholiday( Month, Date ) {\n"; - $ivrconditionjs .= " var Holiday = 0; //default false\n"; - $ivrconditionjs .= " if (Month == \"12\" && Date == \"25\") {\n"; - $ivrconditionjs .= " Holiday = 1; //true\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " if (Month == \"7\" && Date == \"4\") {\n"; - $ivrconditionjs .= " Holiday = 1; //true\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " if (Month == \"1\" && Date == \"1\") {\n"; - $ivrconditionjs .= " Holiday = 1; //true\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " if (Holiday == 1) {\n"; - $ivrconditionjs .= " return true;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " else {\n"; - $ivrconditionjs .= " return false;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "function isweekday( Day ) {\n"; - $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n"; - $ivrconditionjs .= " return true;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " else {\n"; - $ivrconditionjs .= " return false;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "function isweekend( Day ) {\n"; - $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n"; - $ivrconditionjs .= " return false;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " else {\n"; - $ivrconditionjs .= " return true;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "function isofficehours( Hours ) {\n"; - $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n"; - $ivrconditionjs .= " return true;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " else {\n"; - $ivrconditionjs .= " return false;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "function isafterhours( Hours ) {\n"; - $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n"; - $ivrconditionjs .= " return false;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= " else {\n"; - $ivrconditionjs .= " return true;\n"; - $ivrconditionjs .= " }\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "//set default\n"; - $ivrconditionjs .= "condition = true;\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "//Holiday?\n"; - $ivrconditionjs .= "if (isholiday( Month, Date )) {\n"; - $ivrconditionjs .= " console_log( \"info\", \"holiday\\n\" );\n"; - $ivrconditionjs .= " condition = false;\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "//Weekend?\n"; - $ivrconditionjs .= "if (isweekend( Day )) {\n"; - $ivrconditionjs .= " console_log( \"info\", \"weekend\\n\" );\n"; - $ivrconditionjs .= " condition = false;\n"; - $ivrconditionjs .= "}\n"; - $ivrconditionjs .= "\n"; - $ivrconditionjs .= "// After Hours?\n"; - $ivrconditionjs .= "if (isafterhours( Hours )) {\n"; - $ivrconditionjs .= " console_log( \"info\", \"after hours\\n\" );\n"; - $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']; - $pconfig['ivrextension'] = $a_ivr[$id]['ivrextension']; - $pconfig['ivrname'] = $a_ivr[$id]['ivrname']; - $pconfig['recordingidaction'] = $a_ivr[$id]['recordingidaction']; - $pconfig['recordingidantiaction'] = $a_ivr[$id]['recordingidantiaction']; - $pconfig['ivrtimeout'] = $a_ivr[$id]['ivrtimeout']; - $pconfig['ivrcalltimeout'] = $a_ivr[$id]['ivrcalltimeout']; - $pconfig['ivrcontext'] = $a_ivr[$id]['ivrcontext']; - $pconfig['ivrdirectdial'] = $a_ivr[$id]['ivrdirectdial']; - $pconfig['ivrringback'] = $a_ivr[$id]['ivrringback']; - $pconfig['ivrcidnameprefix'] = $a_ivr[$id]['ivrcidnameprefix']; - $pconfig['ivrconditionjs'] = ($a_ivr[$id]['ivrconditionjs']); - $pconfig['ivrdescr'] = $a_ivr[$id]['ivrdescr']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if ($_GET['act'] == "del") { - if ($_GET['type'] == 'options') { - if ($a_ivroptions[$_GET['optionid']]) { - unset($a_ivr_options[$_GET['optionid']]); - write_config(); - sync_package_freeswitch_ivr(); - header("Location: freeswitch_ivr_edit.php?id=".$_GET['id']); - exit; - } - } - } - - - if (!$input_errors) { - - $ivrent = array(); - if (strlen($_POST['ivrid']) > 0) { - $ivrent['ivrid'] = $_POST['ivrid']; - } - else { - $ivrent['ivrid'] = guid(); - } - $ivrent['ivrextension'] = $_POST['ivrextension']; - $ivrent['ivrname'] = $_POST['ivrname']; - $ivrent['recordingidaction'] = $_POST['recordingidaction']; - $ivrent['recordingidantiaction'] = $_POST['recordingidantiaction']; - $ivrent['ivrtimeout'] = $_POST['ivrtimeout']; - $ivrent['ivrcalltimeout'] = $_POST['ivrcalltimeout']; - $ivrent['ivrcontext'] = $_POST['ivrcontext']; - $ivrent['ivrdirectdial'] = $_POST['ivrdirectdial']; - $ivrent['ivrringback'] = $_POST['ivrringback']; - $ivrent['ivrcidnameprefix'] = $_POST['ivrcidnameprefix']; - $ivrent['ivrconditionjs'] = base64_encode($_POST['ivrconditionjs']); - $ivrent['ivrdescr'] = $_POST['ivrdescr']; - - if (isset($id) && $a_ivr[$id]) { - //update - $a_ivr[$id] = $ivrent; - } - else { - //add - $a_ivr[] = $ivrent; - } - - //touch($d_hostsdirty_path); - write_config(); - sync_package_freeswitch_ivr(); - - header("Location: freeswitch_ivr.php"); - exit; - } -} - -include("head.inc"); - -?> -<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: "ivrconditionjs" // id of the textarea to transform - ,start_highlight: true - ,allow_toggle: false - ,language: "en" - ,syntax: "js" - ,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"); -echo "<p class=\"pgtitle\">$v_project_label: IVR: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); - -?> - - -<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>General Settings:<br> - </strong></span> - Interactive voice response general settings. - </span></p></td> - </tr> - </table> - <br /> - - <form action="freeswitch_ivr_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">Extension</td> - <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"> - <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 - $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; - echo " <select name='recordingidaction' class='formfld'>\n"; - echo " <option></option>\n"; - if (count($a_recordings) > 0) { - foreach ($a_recordings as $ent) { - if (htmlspecialchars($pconfig['recordingidaction']) == $ent['recordingid']) { - echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n"; - } - else { - echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n"; - } - } - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Recording Anti-Action</td> - <td width="78%" class="vtable"> - <?php - //$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; - echo " <select name='recordingidantiaction' class='formfld'>\n"; - echo " <option></option>\n"; - if (count($a_recordings) > 0) { - foreach ($a_recordings as $ent) { - if (htmlspecialchars($pconfig['recordingidantiaction']) == $ent['recordingid']) { - echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n"; - } - else { - echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n"; - } - } - } - 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">IVR Timeout</td> - <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' - timeout option is executed. - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Call Timeout</td> - <td width="78%" class="vtable"> - <input name="ivrcalltimeout" type="text" class="formfld" id="ivrcalltimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrcalltimeout']);?>"> - <br> - <span class="vexpl"> - Call timeout is the time in seconds to ring the destination. After this time is exceeded calls - to extensions will be sent to voicemail. default: 30 seconds - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Context</td> - <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> - <td width="22%" valign="top" class="vncellreq">Direct Dial</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='ivrdirectdial' class='formfld'>\n"; - echo " <option></option>\n"; - if (strlen($pconfig['ivrdirectdial']) == 0) { //set default - echo " <option value='true'>enable</option>\n"; - echo " <option selected='yes' value='false'>disabled</option>\n"; - } - else { - if (htmlspecialchars($pconfig['ivrdirectdial']) == "true") { - echo " <option selected='yes' value='true'>enabled</option>\n"; - } - else { - echo " <option value='true'>enable</option>\n"; - } - if (htmlspecialchars($pconfig['ivrdirectdial']) == "false") { - echo " <option selected='yes' value='false'>disabled</option>\n"; - } - else { - echo " <option value='false'>disable</option>\n"; - } - } - - echo " </select>\n"; - ?> - <br><span class="vexpl">Allows callers to dial directly to extensions and feature codes that are up to 5 digits in length.</span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Ring Back</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='ivrringback' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['ivrringback']) == "ring") { - echo " <option selected='yes'>ring</option>\n"; - } - else { - echo " <option>ring</option>\n"; - } - if (htmlspecialchars($pconfig['ivrringback']) == "music") { - echo " <option selected='yes'>music</option>\n"; - } - else { - echo " <option>music</option>\n"; - } - echo " </select>\n"; - ?> - <br> - <span class="vexpl"> - Defines what the caller will hear while destination is being called. The choices are music - (music on hold) ring (ring tone.) default: music - </span> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">CID Prefix</td> - <td width="78%" class="vtable"> - <input name="ivrcidnameprefix" type="text" class="formfld" id="ivrcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['ivrcidnameprefix']);?>"> - <br> <span class="vexpl">Set a prefix on the caller ID name. (optional)</span></td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Description</td> - <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> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Javascript Condition</td> - <td width="78%" class="vtable"> - <?php - if (strlen(htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))) == 0) { - echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" wrap=\"off\">".$ivrconditionjs."</textarea>\n"; - } - else { - echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" 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, - and Day.</span></td> - </tr> - - - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <input name="ivrid" type="hidden" value="<?=htmlspecialchars($pconfig['ivrid']);?>"> - <?php if (isset($id) && $a_ivr[$id]): ?> - <input name="id" type="hidden" value="<?=$id;?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> - - <br> - <br> - - <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2"> - <?php - - - //echo "<pre>"; - //print_r ($a_ivr); - //echo "</pre>"; - - //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"> - <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 - is directed to the corresponding destination. - </span></p></td> - </tr> - </table> - - - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>Action<br /> - </strong></span> - The options that are executed when the <b>condition matches.</b> - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="30" class="listhdrr">Option</td> - <td width="30" class="listhdrr">Type</td> - <td width="30" class="listhdrr">Profile</td> - <td width="150" class="listhdrr">Destination</td> - <td width="30%" class="listhdr">Description</td> - <td width="40" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($ivrid) > 1) { ?> - <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a> - <?php } ?> - </td> - </tr> - </table> - </td> - </tr> - - <?php - $i = 0; - if (count($a_ivr_options) > 0) { - foreach ($a_ivr_options as $ent) { - if ($ent['optionaction'] == "action" && $ivrid == $ent['ivrid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'"> - <?=$ent['optionnumber']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optiontype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optionprofile'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optiondest'];?> - </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> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_ivr_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><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="5"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($ivrid) > 1) { ?> - <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a> - <?php } ?> - </td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="5"></td> - <td class="list"></td> - </tr> - </table> - - </form> - - - - <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2"> - <?php - - - //echo "<pre>"; - //print_r ($a_ivr); - //echo "</pre>"; - - //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"> - <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> - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="30" class="listhdrr">Option</td> - <td width="30" class="listhdrr">Type</td> - <td width="30" class="listhdrr">Profile</td> - <td width="150" class="listhdrr">Destination</td> - <td width="30%" class="listhdr">Description</td> - <td width="40" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($ivrid) > 1) { ?> - <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a> - <?php } ?> - </td> - </tr> - </table> - </td> - </tr> - - <?php - $i = 0; - if (count($a_ivr_options) > 0) { - foreach ($a_ivr_options as $ent) { - if ($ent['optionaction'] == "anti-action" && $ivrid == $ent['ivrid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'"> - <?=$ent['optionnumber']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optiontype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optionprofile'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';"> - <?=$ent['optiondest'];?> - </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> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_ivr_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><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="5"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"> - <?php if (strlen($ivrid) > 1) { ?> - <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a> - <? } ?> - </td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="5"></td> - <td class="list"></td> - </tr> - </table> - - </form> - - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_ivr_options.tmp b/config/freeswitch_dev/freeswitch_ivr_options.tmp deleted file mode 100755 index 096e5b6e..00000000 --- a/config/freeswitch_dev/freeswitch_ivr_options.tmp +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_ivr_options.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_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'ivroptions') { - if ($a_ivr_options[$_GET['id']]) { - unset($a_ivr_options[$_GET['id']]); - write_config(); - sync_package_freeswitch_ivr(); - header("Location: freeswitch_ivr_edit.php?id=".$_GET['parentid']); - exit; - } - } -} - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_ivr_options_edit.tmp b/config/freeswitch_dev/freeswitch_ivr_options_edit.tmp deleted file mode 100644 index 85bf4dee..00000000 --- a/config/freeswitch_dev/freeswitch_ivr_options_edit.tmp +++ /dev/null @@ -1,252 +0,0 @@ -<?php -/* $Id$ */ -/* - - freeswitch_recordings_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_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -$parentid = $_GET['parentid']; -if (isset($_POST['parentid'])) { - $parentid = $_POST['parentid']; -} - -$ivrid = $_GET['ivrid']; -if (isset($_POST['ivrid'])) { - $ivrid = $_POST['ivrid']; -} - - -if (isset($id) && $a_ivr_options[$id]) { - $pconfig['optionaction'] = $a_ivr_options[$id]['optionaction']; - $pconfig['optionnumber'] = $a_ivr_options[$id]['optionnumber']; - $pconfig['optiontype'] = $a_ivr_options[$id]['optiontype']; - $pconfig['optionprofile'] = $a_ivr_options[$id]['optionprofile']; - $pconfig['optiondest'] = $a_ivr_options[$id]['optiondest']; - $pconfig['optiondescr'] = $a_ivr_options[$id]['optiondescr']; -} -else { - if (isset($_GET['a'])) { - if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; } - if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; } - } -} - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - $ivroptionent = array(); - $ivroptionent['ivrid'] = $_POST['ivrid']; - $ivroptionent['optionnumber'] = $_POST['optionnumber']; - $ivroptionent['optiontype'] = $_POST['optiontype']; - $ivroptionent['optionprofile'] = $_POST['optionprofile']; - $ivroptionent['optionaction'] = $_POST['optionaction']; - $ivroptionent['optiondest'] = $_POST['optiondest']; - $ivroptionent['optiondescr'] = $_POST['optiondescr']; - - if (isset($id) && $a_ivr_options[$id]) { - //update - $a_ivr_options[$id] = $ivroptionent; - } - else { - //add - $a_ivr_options[] = $ivroptionent; - } - - - write_config(); - sync_package_freeswitch_ivr(); - - header("Location: freeswitch_ivr_edit.php?id=".$parentid); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Options: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); - -?> - -<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" > - <br /> - <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"> - <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"> - <?php - echo " <select name='optiontype' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['optiontype']) == "extension") { - echo " <option selected='yes'>extension</option>\n"; - } - else { - echo " <option>extension</option>\n"; - } - if (htmlspecialchars($pconfig['optiontype']) == "voicemail") { - echo " <option selected='yes'>voicemail</option>\n"; - } - else { - echo " <option>voicemail</option>\n"; - } - if (htmlspecialchars($pconfig['optiontype']) == "sip uri") { - echo " <option selected='yes'>sip uri</option>\n"; - } - else { - echo " <option>sip uri</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Profile</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='optionprofile' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['optionprofile']) == "auto") { - echo " <option selected='yes'>auto</option>\n"; - } - else { - echo " <option>auto</option>\n"; - } - foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){ - $sip_profile_name = str_replace(".xml", "", $sip_profile_file); - - if (htmlspecialchars($pconfig['optionprofile']) == $sip_profile_name) { - echo " <option selected='yes'>$sip_profile_name</option>\n"; - } - else { - echo " <option>$sip_profile_name</option>\n"; - } - } - echo " </select>\n"; - - ?> - </td> - </tr> - - <tr> - <td width="22%" valign="top" class="vncellreq">Destination</td> - <td width="78%" class="vtable"> - <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>"> - <br> - <span class="vexpl"> - <!--<b>examples:</b><br />--> - extension: 1001<br /> - voicemail: 1001<br /> - sip uri (voicemail): sofia/internal/*98@${domain}<br /> - sip uri (external number): sofia/gateway/gatewayname/12081231234<br /> - sip uri (auto attendant): sofia/internal/5002@${domain}<br /> - </span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Description</td> - <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> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <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'];?>"> - <?php if (isset($id) && $a_ivr_options[$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> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_mailto.tmp b/config/freeswitch_dev/freeswitch_mailto.tmp deleted file mode 100644 index fa27ff68..00000000 --- a/config/freeswitch_dev/freeswitch_mailto.tmp +++ /dev/null @@ -1,243 +0,0 @@ -<?php -/* $Id$ */ -/* - 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: - - 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_once("/etc/inc/config.inc"); -require_once("/usr/local/pkg/freeswitch.inc"); -global $config; - -$tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost']; -$tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL" -$tmp_smtpsecure = strtolower($tmp_smtpsecure); -$tmp_smtpauth = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpauth']; // SMTP authentication: true or false -$tmp_smtpusername = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpusername']; -$tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'][0]['smtppassword']; -$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"); - -fclose($fd); - -if($fd){ - $fp = fopen("/tmp/voicemailtoemail.txt", "w"); -} - - -ob_end_clean(); -ob_start(); - - -//get main header and body - $tmparray = split("\n\n", $email); - $mainheader = $tmparray[0]; - $maincontent = substr($email, strlen($mainheader), strlen($email)); - -//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" - $contenttmp = $tmparray[1]; - $tmparray = split('=', $contenttmp); //"XXXX_boundary_XXXX" - $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) { - $tmparray = split(': ', $val); - //print_r($tmparray); - $var[$tmparray[0]] = trim($tmparray[1]); - } - - $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); - $tmparray = split("--".$boundary, $maincontent); - -// loop through each mime part - $i=0; - foreach ($tmparray as $mimepart) { - - $mimearray = split("\n\n", $mimepart); - $subheader = $mimearray[0]; - $headermimearray = split("\n", trim($subheader)); - - $x=0; - foreach ($headermimearray as $val) { - if(stristr($val, ':') === FALSE) { - $tmparray = split('=', $val); //':' not found - if (trim($tmparray[0]) == "boundary") { - $subboundary = $tmparray[1]; - $subboundary = trim($subboundary,'"'); - //echo "subboundary: ".$subboundary."\n"; - } - } - 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]); - switch ($subsubcontenttype) { - case "text/plain;": - $textplain = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart))); - //echo "text/plain: $textplain\n"; - break; - case "text/html;": - $texthtml = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart))); - //echo "text/html: $texthtml\n"; - break; - } - } //end if - - - } //end foreach - - break; - case "audio/wav;": - //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 if - - $i++; - - } //end foreach - - -//send the email - - include "/usr/local/www/packages/freeswitch/class.phpmailer.php"; - include "/usr/local/www/packages/freeswitch/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 - if ($tmp_smtpauth == "true") { - $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication - } - $mail->Host = $tmp_smtphost; - if (strlen($tmp_smtpsecure)>0) { - $mail->SMTPSecure = $tmp_smtpsecure; - } - if ($tmp_smtpusername) { - $mail->Username = $tmp_smtpusername; - $mail->Password = $tmp_smtppassword; - } - $mail->SMTPDebug = 2; - - - $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); - foreach($tmp_to_array as $tmp_to_row) { - if (strlen($tmp_to_row) > 0) { - $mail->AddAddress($tmp_to_row); - } - } - - if (strlen($strwav) > 0) { - //$mail->AddAttachment("/usr/local/freeswitch/data/domain/example.wav"); // attachment - $filename='voicemail.wav'; $encoding = "base64"; $type = "audio/wav"; - $mail->AddStringAttachment(base64_decode($strwav),$filename,$encoding,$type); - } - unset($strwav); - - if(!$mail->Send()) { - echo "Mailer Error: " . $mail->ErrorInfo; - } - else { - echo "Message sent!"; - } - - -$content = ob_get_contents(); //get the output from the buffer -ob_end_clean(); //clean the buffer - -fwrite($fp, $content); -fclose($fp); - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_modules.xml b/config/freeswitch_dev/freeswitch_modules.xml deleted file mode 100644 index 8c211820..00000000 --- a/config/freeswitch_dev/freeswitch_modules.xml +++ /dev/null @@ -1,1203 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<packagegui> - <copyright> - <![CDATA[ -/* $Id$ */ -/* ========================================================================== */ -/* - freeswitch_modules.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>FreeSWITCH Modules</name> - <version>0.2</version> - <title>FreeSWITCH: Modules</title> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> - <menu> - <name>FreeSWITCH</name> - <tooltiptext>Modify FreeSWITCH Modules.</tooltiptext> - <section>Services</section> - <configfile>freeswitch.xml</configfile> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </menu> - <service> - <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> - </service> - <tabs> - <tab> - <text>Settings</text> - <url>/pkg_edit.php?xml=freeswitch.xml&id=0</url> - </tab> - <tab> - <text>Dialplan</text> - <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url> - </tab> - <tab> - <text>Extensions</text> - <url>/packages/freeswitch/freeswitch_extensions.php</url> - </tab> - <tab> - <text>Features</text> - <url>/packages/freeswitch/freeswitch_features.php</url> - </tab> - <tab> - <text>Gateways</text> - <url>/packages/freeswitch/freeswitch_gateways.php</url> - </tab> - <tab> - <text>Profiles</text> - <url>/packages/freeswitch/freeswitch_profiles.php</url> - </tab> - <tab> - <text>Public</text> - <url>/packages/freeswitch/freeswitch_public_includes.php</url> - </tab> - <tab> - <text>Status</text> - <url>/packages/freeswitch/freeswitch_status.php</url> - </tab> - <tab> - <text>Vars</text> - <url>/packages/freeswitch/freeswitch_vars.php</url> - </tab> - </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchmodules</configpath> - <fields> - <field> - <fielddescr><b>Loggers</b></fielddescr> - <fieldname>loggers</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_console</fielddescr> - <fieldname>mod_console</fieldname> - <description>Send logs to the console.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_logfile</fielddescr> - <fieldname>mod_logfile</fieldname> - <description>Send logs to the local file system.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_syslog</fielddescr> - <fieldname>mod_syslog</fieldname> - <description>Send logs to a remote syslog server.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Multi-Faceted</b></fielddescr> - <fieldname>multi-faceted</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_enum</fielddescr> - <fieldname>mod_enum</fieldname> - <description>Route PSTN numbers over internet according to ENUM servers, such as e164.org.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>XML Interfaces</b></fielddescr> - <fieldname>xml_interfaces</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_xml_rpc</fielddescr> - <fieldname>mod_xml_rpc</fieldname> - <description>XML Remote Procedure Calls. Issue commands from your web application.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_xml_curl</fielddescr> - <fieldname>mod_xml_curl</fieldname> - <description>XML Gateway Code. Configure FreeSWITCH from a web server on boot and on the fly.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_xml_cdr</fielddescr> - <fieldname>mod_xml_cdr</fieldname> - <description>XML based call detail record handler.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Event Handlers</b></fielddescr> - <fieldname>event_handlers</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_cdr_csv</fielddescr> - <fieldname>mod_cdr_csv</fieldname> - <description>CSV call detail record handler.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_event_multicast</fielddescr> - <fieldname>mod_event_multicast</fieldname> - <description>Broadcasts events to netmask.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_event_socket</fielddescr> - <fieldname>mod_event_socket</fieldname> - <description>Sends events via a single socket.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_zeroconf</fielddescr> - <fieldname>mod_zeroconf</fieldname> - <description>Support for zeroconf.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Directory Interfaces</b></fielddescr> - <fieldname>directory_interfaces</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_ldap</fielddescr> - <fieldname>mod_ldap</fieldname> - <description>LDAP module made to obtain dialplans, user accounts, etc.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Endpoints</b></fielddescr> - <fieldname>endpoints</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_dingaling</fielddescr> - <fieldname>mod_dingaling</fieldname> - <description>Jabber/GoogleTalk Talk integration module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_iax</fielddescr> - <fieldname>mod_iax</fieldname> - <description>IAX2.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_portaudio</fielddescr> - <fieldname>mod_portaudio</fieldname> - <description>Voice through a local soundcard.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_alsa</fielddescr> - <fieldname>mod_alsa</fieldname> - <description></description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_sofia</fielddescr> - <fieldname>mod_sofia</fieldname> - <description>SIP module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_loopback</fielddescr> - <fieldname>mod_loopback</fieldname> - <description>A loopback channel driver to make an outbound call as an inbound call.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_wanpipe</fielddescr> - <fieldname>mod_wanpipe</fieldname> - <description>T1/E1 Sangoma Card module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_woomera</fielddescr> - <fieldname>mod_woomera</fieldname> - <description>H.323/Woomera module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_openzap</fielddescr> - <fieldname>mod_openzap</fieldname> - <description>Interface to Zaptel hardware.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Applications</b></fielddescr> - <fieldname>applications</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_commands</fielddescr> - <fieldname>mod_commands</fieldname> - <description>A mass plethora of API interface commands.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_conference</fielddescr> - <fieldname>mod_conference</fieldname> - <description>Conference room module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_dptools</fielddescr> - <fieldname>mod_dptools</fieldname> - <description>Dialplan Tools: provides a number of apps and utilities for the dialplan.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_expr</fielddescr> - <fieldname>mod_expr</fieldname> - <description>Brian Allen Vanderburgs expression evaluation library.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_fax</fielddescr> - <fieldname>mod_fax</fieldname> - <description>FAX provides fax send and receive.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_fifo</fielddescr> - <fieldname>mod_fifo</fieldname> - <description>FIFO provides custom call queues including call park.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_voicemail</fielddescr> - <fieldname>mod_voicemail</fieldname> - <description>Full featured voicemail module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_limit</fielddescr> - <fieldname>mod_limit</fieldname> - <description>Resource limitation module.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_esf</fielddescr> - <fieldname>mod_esf</fieldname> - <description>Holds the multi cast paging application for SIP.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_fsv</fielddescr> - <fieldname>mod_fsv</fieldname> - <description>FreeSWITCH Video application (Recording and playback).</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>SNOM Module</b></fielddescr> - <fieldname>snom_module</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_snom</fielddescr> - <fieldname>mod_snom</fieldname> - <description></description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Dialplan Interfaces</b></fielddescr> - <fieldname>dialplan_interfaces</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_dialplan_directory</fielddescr> - <fieldname>mod_dialplan_directory</fieldname> - <description>Allows you to obtain a dialplan from a directory resource.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_dialplan_xml</fielddescr> - <fieldname>mod_dialplan_xml</fieldname> - <description>Allows you to program dialplans in XML format.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_dialplan_asterisk</fielddescr> - <fieldname>mod_dialplan_asterisk</fieldname> - <description>Allows you to create dialplans the old-fashioned way.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_yaml</fielddescr> - <fieldname>mod_yaml</fieldname> - <description>Allows you to program dialplans in YAML format.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Codec Interfaces</b></fielddescr> - <fieldname>codec_interfaces</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_voipcodecs</fielddescr> - <fieldname>mod_voipcodecs</fieldname> - <description></description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_g723_1</fielddescr> - <fieldname>mod_g723_1</fieldname> - <description>G.723.1 codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_g729</fielddescr> - <fieldname>mod_g729</fieldname> - <description>G729 codec is only supported in passthrough mode.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_amr</fielddescr> - <fieldname>mod_amr</fieldname> - <description>amr codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_ilbc</fielddescr> - <fieldname>mod_ilbc</fieldname> - <description>ILBC codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_speex</fielddescr> - <fieldname>mod_speex</fieldname> - <description>Speex codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_siren</fielddescr> - <fieldname>mod_siren</fieldname> - <description>Siren codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_celt</fielddescr> - <fieldname>mod_celt</fieldname> - <description>Celt codec.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_h26x</fielddescr> - <fieldname>mod_h26x</fieldname> - <description>H26X signed linear codec. Video Pass-thru.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>File Format Interfaces</b></fielddescr> - <fieldname>file_format_interfaces</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_sndfile</fielddescr> - <fieldname>mod_sndfile</fieldname> - <description>Multi-format file format transcoder (WAV, etc).</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_native_file</fielddescr> - <fieldname>mod_native_file</fieldname> - <description>File interface for codec specific file formats.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Streams/Files</b></fielddescr> - <fieldname>streams_files</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_shout</fielddescr> - <fieldname>mod_shout</fieldname> - <description>mp3 files and shoutcast streams.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_local_stream</fielddescr> - <fieldname>mod_local_stream</fieldname> - <description>For local streams (play all the files in a directory).</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_tone_stream</fielddescr> - <fieldname>mod_tone_stream</fieldname> - <description>Generate tone streams.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Languages</b></fielddescr> - <fieldname>languages</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_spidermonkey</fielddescr> - <fieldname>mod_spidermonkey</fieldname> - <description>JavaScript support.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_perl</fielddescr> - <fieldname>mod_perl</fieldname> - <description>Perl support.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_python</fielddescr> - <fieldname>mod_python</fieldname> - <description>Python support.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_java</fielddescr> - <fieldname>mod_java</fieldname> - <description>Java support.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_lua</fielddescr> - <fieldname>mod_lua</fieldname> - <description>Lua support.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>ASR /TTS</b></fielddescr> - <fieldname>asr_tts</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_flite</fielddescr> - <fieldname>mod_flite</fieldname> - <description>Free open source Text to Speech.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_pocketsphinx</fielddescr> - <fieldname>mod_pocketsphinx</fieldname> - <description>Free open source Speech Recognition.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_cepstral</fielddescr> - <fieldname>mod_cepstral</fieldname> - <description>Links into Cepstral for dynamic sound output. Not available on this build.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_openmrcp</fielddescr> - <fieldname>mod_openmrcp</fieldname> - <description>Module for an open MRCP implementation.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_rss</fielddescr> - <fieldname>mod_rss</fieldname> - <description>Reads RSS feeds via a TTS engine.</description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr><b>Say</b></fielddescr> - <fieldname>say</fieldname> - <description></description> - <type>listtopic</type> - </field> - <field> - <fielddescr>mod_say_en</fielddescr> - <fieldname>mod_say_en</fieldname> - <description></description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - <field> - <fielddescr>mod_say_zh</fielddescr> - <fieldname>mod_say_zh</fieldname> - <description></description> - <type>select</type> - <options> - <option> - <name>enable</name> - <value>enable</value> - </option> - <option> - <name>disable</name> - <value>disable</value> - </option> - </options> - </field> - </fields> - <custom_add_php_command> - </custom_add_php_command> - <custom_php_resync_config_command> - sync_package_freeswitch_modules(); - </custom_php_resync_config_command> - <custom_delete_php_command> - sync_package_freeswitch_modules(); - </custom_delete_php_command> - <custom_php_deinstall_command> - </custom_php_deinstall_command> -</packagegui>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_profile_edit.tmp b/config/freeswitch_dev/freeswitch_profile_edit.tmp deleted file mode 100644 index 84742e8f..00000000 --- a/config/freeswitch_dev/freeswitch_profile_edit.tmp +++ /dev/null @@ -1,145 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Edit Profile</p>\n"; -?> - -<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_dev/freeswitch_profiles.tmp b/config/freeswitch_dev/freeswitch_profiles.tmp deleted file mode 100644 index 3de99c70..00000000 --- a/config/freeswitch_dev/freeswitch_profiles.tmp +++ /dev/null @@ -1,218 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Profiles</p>\n"; -?> - -<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"> - <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_dev/freeswitch_public.tmp b/config/freeswitch_dev/freeswitch_public.tmp deleted file mode 100644 index b82b1718..00000000 --- a/config/freeswitch_dev/freeswitch_public.tmp +++ /dev/null @@ -1,165 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; -?> - -<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_dev/freeswitch_public_includes.tmp b/config/freeswitch_dev/freeswitch_public_includes.tmp deleted file mode 100644 index 7f6d0409..00000000 --- a/config/freeswitch_dev/freeswitch_public_includes.tmp +++ /dev/null @@ -1,285 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_public_includes.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"); - - -//freeswitchpublicincludes - //publicincludeid - //extensionname - //context - //default - //enabled - //descr - -//freeswitchpublicincludedetails - - //publicincludeid - //tag - //condition - //action - //antiaction - //param - //tagorder - //1-20 - //fieldtype - - //fielddata - - -$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config']; -$a_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'publicincludes') { - - if ($a_public_includes[$_GET['id']]) { - - $publicincludeid = $a_public_includes[$_GET['id']][publicincludeid]; - - $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; - if (count($a_public_includes_details) > 0) { - foreach($a_public_includes_details as $row) { - if ($row["publicincludeid"] == $publicincludeid) { - //echo "child id: ".$i."<br />\n"; - unset($a_public_includes_details[$i]); - } - $i++; - } - } - } - - //if the public include xml file exists then delete it - if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) { - unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename); - } - - unset($publicincludefilename); - unset($a_public_includes[$_GET['id']]); - write_config(); - sync_package_freeswitch_public_includes(); - header("Location: freeswitch_public_includes.php"); - exit; - } - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public</p>\n"; -?> - -<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_includes.php" method="post" name="iform" id="iform"> -<?php - - -//echo "<pre>"; -//print_r ($a_public_includes); -//echo "</pre>"; - - -//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; - -?> - - <br /> - <br /> - - <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='/packages/freeswitch/freeswitch_public.php';"> - </td> - </tr> - <tr> - <td colspan='2'> - <span class="vexpl"> - 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 /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr">Extension Name</td> - <td width="25%" class="listhdrr">Order</td> - <td width="25%" class="listhdrr">Enabled</td> - <td width="50%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <?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) { - 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=<?=$ent['id'];?>'"> - <?=$ent['extensionname']?> - </td> - <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=<?=$ent['id'];?>';"> - <?=$ent['enabled'];?> - </td> - <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=<?=$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 - } //end if strlen - $i++; - } //end for each - } //end if count - ?> - <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"><a href="freeswitch_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - -</form> - -/usr/local/freeswitch/conf/dialplan/public/ -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_public_includes_details.tmp b/config/freeswitch_dev/freeswitch_public_includes_details.tmp deleted file mode 100755 index 3b3130b0..00000000 --- a/config/freeswitch_dev/freeswitch_public_includes_details.tmp +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_public_includes_details.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_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'publicincludedetails') { - if ($a_public_include_details[$_GET['id']]) { - unset($a_public_include_details[$_GET['id']]); - write_config(); - sync_package_freeswitch_public_includes(); - //touch($d_hostsdirty_path); - header("Location: freeswitch_public_includes_edit.php?id=".$_GET['parentid']); - exit; - } - } -} - -?>
\ No newline at end of file diff --git a/config/freeswitch_dev/freeswitch_public_includes_details_edit.tmp b/config/freeswitch_dev/freeswitch_public_includes_details_edit.tmp deleted file mode 100644 index feb071cb..00000000 --- a/config/freeswitch_dev/freeswitch_public_includes_details_edit.tmp +++ /dev/null @@ -1,424 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_public_includes_details_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_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -$parentid = $_GET['parentid']; -if (isset($_POST['parentid'])) { - $parentid = $_POST['parentid']; -} - -$publicincludeid = $_GET['publicincludeid']; -if (isset($_POST['publicincludeid'])) { - $publicincludeid = $_POST['publicincludeid']; -} - - - //publicincludeid - //tag - //condition - //action - //antiaction - //param - //fieldtype - //fielddata - //fieldorder - //000-999 - -if (isset($id) && $a_public_includes_details[$id]) { - $pconfig['publicincludeid'] = $a_public_includes_details[$id]['publicincludeid']; - $pconfig['tag'] = $a_public_includes_details[$id]['tag']; - $pconfig['fieldtype'] = $a_public_includes_details[$id]['fieldtype']; - $pconfig['fielddata'] = $a_public_includes_details[$id]['fielddata']; - $pconfig['fieldorder'] = $a_public_includes_details[$id]['fieldorder']; -} -//else { -// if (isset($_GET['a'])) { -// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; } -// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; } -// } -//} - - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if (!$input_errors) { - - $ent = array(); - $ent['publicincludeid'] = $_POST['publicincludeid']; - $ent['tag'] = $_POST['tag']; - $ent['fieldtype'] = $_POST['fieldtype']; - $ent['fielddata'] = $_POST['fielddata']; - $ent['fieldorder'] = $_POST['fieldorder']; - - if (isset($id) && $a_public_includes_details[$id]) { - //update - $a_public_includes_details[$id] = $ent; - } - else { - //add - $a_public_includes_details[] = $ent; - } - - //touch($d_hostsdirty_path); - write_config(); - sync_package_freeswitch_public_includes(); - - header("Location: freeswitch_public_includes_edit.php?id=".$parentid); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public: Details: Edit</p>\n"; - -if ($input_errors) { print_input_errors($input_errors); } - -?> - -<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" > - <br /> - <form action="freeswitch_public_includes_details_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">Tag</td> - <td width="78%" class="vtable"> - <script type="text/javascript"> - function public_include_details_tag_onchange() { - var tag = document.getElementById("form_tag").value; - if (tag == "condition") { - document.getElementById("label_fieldtype").innerHTML = "Field"; - document.getElementById("label_fielddata").innerHTML = "Expression"; - } - else if (tag == "action") { - document.getElementById("label_fieldtype").innerHTML = "Application"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - else if (tag == "anti-action") { - document.getElementById("label_fieldtype").innerHTML = "Application"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - else if (tag == "param") { - document.getElementById("label_fieldtype").innerHTML = "Name"; - document.getElementById("label_fielddata").innerHTML = "Value"; - } - if (tag == "") { - document.getElementById("label_fieldtype").innerHTML = "Type"; - document.getElementById("label_fielddata").innerHTML = "Data"; - } - } - </script> - <?php - echo " <select name='tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['tag'])) { - case "condition": - echo " <option selected='yes'>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "action": - echo " <option>condition</option>\n"; - echo " <option selected='yes'>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "anti-action": - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option selected='yes'>anti-action</option>\n"; - //echo " <option>param</option>\n"; - break; - case "param": - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option selected='yes'>param</option>\n"; - break; - default: - echo " <option>condition</option>\n"; - echo " <option>action</option>\n"; - echo " <option>anti-action</option>\n"; - //echo " <option>param</option>\n"; - } - echo " </select>\n"; - - //condition - //field expression - //action - //application - //data - //antiaction - //application - //data - //param - //name - //value - - ?> - </td> - </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> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td> - <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> - <tr> - <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='fieldorder' class='formfld'>\n"; - //echo " <option></option>\n"; - if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) { - echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n"; - } - $i=0; - while($i<=999) { - 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"; - } - - $i++; - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="publicincludeid" type="hidden" value="<?=$publicincludeid;?>"> - <input name="parentid" type="hidden" value="<?=$parentid;?>"> - <?php if (isset($id) && $a_public_includes_details[$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>Example</b> - <br /> - <br /> - If the inbound call matches the DID 12085551234 then proceed to the action. - <br /> - <br /> - <table cellpadding='3'> - <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">condition</td></tr> - <tr><th class="vncellreq" align="left">Type:</th><td class="vtable">destination_number</td></tr> - <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">^(12085551234)$</td></tr> - </table> - - <br /> - <br /> - - Transfer the inbound call to an IVR with extension of 5000. - <br /> - <br /> - <table cellpadding='3'> - <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> - - <br /> - <br /> - - Or transfer the inbound call to extension 1001. - <br /> - <br /> - <table cellpadding='3'> - <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> - - - <br /> - <br /> - <br /> - <br /> - - - <b>Conditions</b> - <br /> - <br /> - Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against. - <ul> - <li><b>context</b></li> - <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li> - <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li> - <li><b>public</b> Name of the public module that are used, the name is provided by each public module. Example: XML</li> - <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li> - <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li> - <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li> - <li><b>ani2</b> The type of device placing the call [1]</li> - <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> - </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 - - <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> - <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>. - <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>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>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>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>transfer</b> transfer the call to another extension or number<li> - <li><b>voicemail</b> send the call to voicemail</li> - </ul> - - - <br /> - <br /> - - <!-- - <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> - <ul> - <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>rfc2833-pt</b>" 101</li> - <li><b>sip-port</b> 5060</li> - <li><b>use-rtp-timer</b> true</li> - </ul> - <br /> - <br /> - --> - - - <br /> - <br /> - <br /> - <br /> - <br /> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_public_includes_edit.tmp b/config/freeswitch_dev/freeswitch_public_includes_edit.tmp deleted file mode 100644 index f7be0dc8..00000000 --- a/config/freeswitch_dev/freeswitch_public_includes_edit.tmp +++ /dev/null @@ -1,547 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_public_includes_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"); - - - -//freeswitchpublicincludes - //publicincludeid - //extensionname - //context - //default - //enabled - //descr - -// - - - -$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config']; -$a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} -$parentid = $id; - - - -if (isset($id) && $a_public_includes[$id]) { - $pconfig['publicincludeid'] = $a_public_includes[$id]['publicincludeid']; - $publicincludeid = $a_public_includes[$id]['publicincludeid']; - $pconfig['extensionname'] = $a_public_includes[$id]['extensionname']; - $pconfig['order'] = $a_public_includes[$id]['order']; - $pconfig['context'] = $a_public_includes[$id]['context']; - $pconfig['enabled'] = $a_public_includes[$id]['enabled']; - $pconfig['descr'] = $a_public_includes[$id]['descr']; - $pconfig['opt1name'] = $a_public_includes[$id]['opt1name']; - $pconfig['opt1value'] = $a_public_includes[$id]['opt1value']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if ($_GET['act'] == "del") { - if ($_GET['type'] == 'publicincludedetails') { - if ($a_public_include_details[$_GET['id']]) { - unset($a_public_include_details[$_GET['id']]); - write_config(); - sync_package_freeswitch_public_includes(); - header("Location: freeswitch_public_include_edit.php?id=".$_GET['id']); - exit; - } - } - } - - - if (!$input_errors) { - - $ent = array(); - if (strlen($_POST['publicincludeid']) > 0) { - //update - $ent['publicincludeid'] = $_POST['publicincludeid']; - } - else { - //add - $ent['publicincludeid'] = guid(); - } - $ent['extensionname'] = $_POST['extensionname']; - $ent['order'] = $_POST['order']; - //$ent['context'] = $_POST['context']; - $ent['context'] = 'default'; - $ent['enabled'] = $_POST['enabled']; - $ent['descr'] = $_POST['descr']; - $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; - } - 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; - } - if ($_POST['enabled'] == "false") { - //if the extension name is disabled then remove the public xml file - $filenamechanged = true; - } - 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); - - } //end foreach - } //end if count - - //update the config - $a_public_includes[$id] = $ent; - } - else { - //add to the config - $a_public_includes[] = $ent; - } - - - write_config(); - sync_package_freeswitch_public_includes(); - - header("Location: freeswitch_public_includes.php"); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Public: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); - -?> - - -<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>Public:<br> - </strong></span> - Public Include general settings. - </span></p></td> - </tr> - </table> - <br /> - - <form action="freeswitch_public_includes_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">Extension Name</td> - <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 '.'. - </td> - </tr> - <!-- - <tr> - <td width="22%" valign="top" class="vncellreq">Context</td> - <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 - echo " <select name='enabled' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['enabled'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - 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"> - <?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"; - } - $i=0; - while($i<=999) { - 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"; - } - - $i++; - } - echo " </select>\n"; - ?> - <br /> - 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"> - <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> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="publicincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['publicincludeid']);?>"> - <?php - if (strlen($id) > 0 && $a_public_includes[$id]) { - 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"; - } - ?> - <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> - - <form action="freeswitch_public_includes_edit.php" method="post" name="iform2" id="iform2"> - <?php - - //echo "<pre>"; - //print_r ($a_public_includes); - //echo "</pre>"; - - //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; - - //create a temporary id for the array - $i = 0; - if (count($a_public_include_details) > 0) { - foreach ($a_public_include_details as $ent) { - $a_public_include_details[$i]['id'] = $i; - $i++; - } - } - - //order the array - function cmp_number_public_details($a, $b) { - if ($a["fieldorder"] > $b["fieldorder"]) { - return 1; - } - else { - return 0; - } - } - if (count($a_public_include_details) > 0) { usort($a_public_include_details, "cmp_number_public_details"); } - - ?> - - - <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. - </span></p></td> - </tr> - </table> - <br /> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="40" class="listhdrr">Tag</td> - <td width="40" class="listhdrr">Type</td> - <td width="50%" class="listhdrr">Data</td> - <td width="40" class="listhdrr">Order</td> - <td width="40" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </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']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" 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 = 0; - if (count($a_public_include_details) > 0) { - - foreach ($a_public_include_details as $ent) { - if ($ent['tag'] == "action" && $publicincludeid == $ent['publicincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" 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 = 0; - if (count($a_public_include_details) > 0) { - - foreach ($a_public_include_details as $ent) { - if ($ent['tag'] == "anti-action" && $publicincludeid == $ent['publicincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" 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 = 0; - if (count($a_public_include_details) > 0) { - - foreach ($a_public_include_details as $ent) { - if ($ent['tag'] == "param" && $publicincludeid == $ent['publicincludeid']) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'"> - <?=$ent['tag']?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldtype'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fielddata'];?> - </td> - <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';"> - <?=$ent['fieldorder'];?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" 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"><a href="freeswitch_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="4"></td> - <td class="list"></td> - </tr> - </table> - - </form> - - - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_recordings.tmp b/config/freeswitch_dev/freeswitch_recordings.tmp deleted file mode 100644 index 9b9ac9cf..00000000 --- a/config/freeswitch_dev/freeswitch_recordings.tmp +++ /dev/null @@ -1,496 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_recordings.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_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; -$dir_recordings = '/usr/local/freeswitch/recordings/'; -$dir_music_on_hold_8000 = '/usr/local/freeswitch/sounds/music/8000/'; - -if ($_GET['a'] == "download") { - - session_cache_limiter('public'); - - if ($_GET['type'] = "rec") { - if (file_exists($dir_recordings.$_GET['filename'])) { - $fd = fopen($dir_recordings.$_GET['filename'], "rb"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - $file_ext = substr($_GET['filename'], -3); - if ($file_ext == "wav") { - header("Content-Type: audio/x-wav"); - } - 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 - header("Content-Length: " . filesize($dir_recordings.$_GET['filename'])); - 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"); - if ($_GET['t'] == "bin") { - header("Content-Type: application/force-download"); - header("Content-Type: application/octet-stream"); - header("Content-Type: application/download"); - header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"'); - } - else { - $file_ext = substr($_GET['filename'], -3); - if ($file_ext == "wav") { - header("Content-Type: audio/x-wav"); - } - 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 - header("Content-Length: " . filesize($dir_music_on_hold_8000.$_GET['filename'])); - fpassthru($fd); - } - } - - exit; -} -else { - //echo $dir_recordings.$_GET['filename']; -} - -if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { - - if ($_POST['type'] == 'moh') { - move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_music_on_hold_8000 . $_FILES['ulfile']['name']); - $savemsg = "Uploaded file to $dir_music_on_hold_8000" . htmlentities($_FILES['ulfile']['name']); - //system('chmod -R 744 $dir_music_on_hold_8000*'); - unset($_POST['txtCommand']); - } - if ($_POST['type'] == 'rec') { - move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_recordings . $_FILES['ulfile']['name']); - $savemsg = "Uploaded file to $dir_recordings" . htmlentities($_FILES['ulfile']['name']); - //system('chmod -R 744 $dir_recordings*'); - unset($_POST['txtCommand']); - } -} - - - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'rec') { - if ($a_recordings[$_GET['id']]) { - unlink_if_exists('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']); - unset($a_recordings[$_GET['id']]); - write_config(); - header("Location: freeswitch_recordings.php"); - exit; - } - } - - if ($_GET['type'] == 'moh') { - unlink_if_exists($dir_music_on_hold_8000.$_GET['filename']); - header("Location: freeswitch_recordings.php"); - exit; - } - -} - - - -include("head.inc"); - -?> - -<script> -function EvalSound(soundobj) { - var thissound= eval("document."+soundobj); - thissound.Play(); -} -</script> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Recordings</p>\n"; -?> - -<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" > - -<?php - - -//build a list of recordings from the config.xml -$config_recording_list = ''; -$i = 0; -if (count($a_recordings) > 0) { - foreach ($a_recordings as $recordingent) { - $config_recording_list .= $recordingent['filename']."|"; - $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 (strpos($config_recording_list, $file) === false) { - - //$handle = fopen($dir_recordings.$file,'rb'); - //$file_content = fread($handle,filesize($dir_recordings.$file)); - //fclose($handle); - - $a_file = split("\.", $file); - - $recordingent = array(); - $recordingent['filename'] = $file; - $recordingent['recordingname'] = $a_file[0]; - $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 - //enough to save the files inside it -//$i = 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']; - //$handle = fopen($dir_recordings.$recordingent['filename'],'w'); - //fwrite ($handle, base64_decode($file_content)); - //unset($file_content); - //fclose($handle); - //$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; -// } -// else { - //echo "found: ".$recordingent['filename']."<br />"; -// } - -// $i++; -// } -//} - -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"> - <tr> - <td><p><span class="vexpl"><span class="red"><strong>Recordings:<br> - </strong></span> - 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'> - <tr> - <td width='50%'><b>location:</b> <?php echo $dir_recordings; ?></td> - <td valign="top" class="label"> - <input name="type" type="hidden" value="rec"> - </td> - <td align="right">File to upload:</td> - <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> - </table> - </div> - </form> - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="30%" class="listhdrr">Filename (download)</td> - <td width="30%" class="listhdrr">Recording Name (play)</td> - <td width="30%" class="listhdr">Description</td> - <td width="10%" class="list"> - <!-- - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - --> - </td> - </tr> - - <?php - $i = 0; - if (count($a_recordings) > 0) { - foreach ($a_recordings as $recordingent) { - if (strlen($recordingent['filename']) > 0) { - ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>'"> - <a href="freeswitch_recordings.php?a=download&type=rec&t=bin&filename=<?=$recordingent['filename'];?>"> - <?=$recordingent['filename']?> - </a> - </td> - <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> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?> - </td> - <td valign="middle" nowrap class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="freeswitch_recordings_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_recordings.php?type=rec&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 - } - else { - //clean up blank entries - unset($a_recordings[$i]); - write_config(); - } - - $i++; - } //end for each - } //end count - ?> - - <!-- - <tr> - <td class="list" colspan="3"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - --> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - - - - <br /> - <br /> - <br /> - - <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 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'> - <tr> - <td width='50%'><b>location:</b> <?php echo $dir_music_on_hold_8000; ?></td> - <td valign="top" class="label"> - <input name="type" type="hidden" value="moh"> - </td> - <td align="right">File to upload:</td> - <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> - </table> - </div> - </form> - - - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="28%" class="listhdrr">File Name (download)</td> - <td width="28%" class="listhdrr">Name (play)</td> - <td width="25%" class="listhdr">Last Modified</td> - <td width="10%" class="listhdr" nowrap>Size</td> - </tr> - - <?php - - 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); - - echo "<tr>\n"; - 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 " </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 " <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 " ".$tmp_filesize; - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - //echo " <td valign=\"middle\"><a href=\"freeswitch_recordings.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"freeswitch_recordings.php?type=moh&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo "</tr>\n"; - - } - } - closedir($handle); - } - ?> - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_recordings_edit.tmp b/config/freeswitch_dev/freeswitch_recordings_edit.tmp deleted file mode 100644 index 3b0e2e1d..00000000 --- a/config/freeswitch_dev/freeswitch_recordings_edit.tmp +++ /dev/null @@ -1,176 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_recordings_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_recordings = &$config['installedpackages']['freeswitchrecordings']['config']; - - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -if (isset($id) && $a_recordings[$id]) { - $pconfig['filename'] = $a_recordings[$id]['filename']; - $pconfig['recordingname'] = $a_recordings[$id]['recordingname']; - $pconfig['recordingid'] = $a_recordings[$id]['recordingid']; - $pconfig['descr'] = $a_recordings[$id]['descr']; -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - - $recordingent = array(); - $recordingent['recordingname'] = $_POST['recordingname']; - $recordingent['descr'] = $_POST['descr']; - - - if (isset($id) && $a_recordings[$id]) { - //update - if (strlen($_POST['recordingid']) > 0) { - $recordingent['recordingid'] = $_POST['recordingid']; - } - else { - $recordingent['recordingid'] = guid(); - } - - $recordingent['filename'] = $_POST['filename']; - - //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']); - } - $a_recordings[$id] = $recordingent; - } - else { - //add - $recordingent['filename'] = $_POST['filename']; - $a_recordings[] = $recordingent; - } - - write_config(); - - header("Location: freeswitch_recordings.php"); - exit; - } -} - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_labels: Recordings: Edit</p>\n"; -?> - -<?php if ($input_errors) print_input_errors($input_errors); ?> - - -<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" > - <br /> - <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"> - <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"> - <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"> - <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> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <?php if (isset($id) && $a_recordings[$id]): ?> - <input name="filename_orig" type="hidden" value="<?=htmlspecialchars($pconfig['filename']);?>"> - <input name="id" type="hidden" value="<?=$id;?>"> - <input name="recordingid" type="hidden" value="<?=htmlspecialchars($pconfig['recordingid']);?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> - - <br> - <br> - <br> - <br> - <br> - <br> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_recordings_play.tmp b/config/freeswitch_dev/freeswitch_recordings_play.tmp deleted file mode 100755 index 1c63b592..00000000 --- a/config/freeswitch_dev/freeswitch_recordings_play.tmp +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_recordings_play.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. -*/ - -$filename = $_GET['filename']; -$type = $_GET['type']; //moh //rec - -?> -<html> -<head> -</head> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align='center'> - <b>file: <?=$filename?></b> - </td> - </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"; - } - if ($file_ext == "mp3") { - echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($filename)."&song_url=".urlencode("/freeswitch/freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename)."\">\n"; - echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=".urlencode("/freeswitch/freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename)."\" />\n"; - echo "<param name=\"quality\" value=\"high\"/>\n"; - echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n"; - echo "</object>\n"; - } - - ?> - </td> - </tr> -</table> - -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_settings.tmp b/config/freeswitch_dev/freeswitch_settings.tmp deleted file mode 100644 index bfc1d614..00000000 --- a/config/freeswitch_dev/freeswitch_settings.tmp +++ /dev/null @@ -1,393 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_settings.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_settings = &$config['installedpackages']['freeswitchsettings']['config']; - -//$id = $_GET['id']; -//if (isset($_POST['id'])) { -// $id = $_POST['id']; -//} -$id = 0; - -if (isset($id) && $a_settings[$id]) { - - $pconfig['numbering_plan'] = $a_settings[$id]['numbering_plan']; - $pconfig['default_gateway'] = $a_settings[$id]['default_gateway']; - $pconfig['default_area_code'] = $a_settings[$id]['default_area_code']; - $pconfig['event_socket_port'] = $a_settings[$id]['event_socket_port']; - $pconfig['event_socket_password'] = $a_settings[$id]['event_socket_password']; - $pconfig['xml_rpc_http_port'] = $a_settings[$id]['xml_rpc_http_port']; - $pconfig['xml_rpc_auth_realm'] = $a_settings[$id]['xml_rpc_auth_realm']; - $pconfig['xml_rpc_auth_user'] = $a_settings[$id]['xml_rpc_auth_user']; - $pconfig['xml_rpc_auth_pass'] = $a_settings[$id]['xml_rpc_auth_pass']; - $pconfig['admin_pin'] = $a_settings[$id]['admin_pin']; - $pconfig['smtphost'] = $a_settings[$id]['smtphost']; - $pconfig['smtpsecure'] = $a_settings[$id]['smtpsecure']; - $pconfig['smtpauth'] = $a_settings[$id]['smtpauth']; - $pconfig['smtpusername'] = $a_settings[$id]['smtpusername']; - $pconfig['smtppassword'] = $a_settings[$id]['smtppassword']; - $pconfig['smtpfrom'] = $a_settings[$id]['smtpfrom']; - $pconfig['smtpfromname'] = $a_settings[$id]['smtpfromname']; - $pconfig['mod_shout_decoder'] = $a_settings[$id]['mod_shout_decoder']; - $pconfig['mod_shout_volume'] = $a_settings[$id]['mod_shout_volume']; - -} - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - - if (!$input_errors) { - - $ent = array(); - $ent['numbering_plan'] = $_POST['numbering_plan']; - $ent['default_gateway'] = $_POST['default_gateway']; - $ent['default_area_code'] = $_POST['default_area_code']; - $ent['event_socket_port'] = $_POST['event_socket_port']; - $ent['event_socket_password'] = $_POST['event_socket_password']; - $ent['xml_rpc_http_port'] = $_POST['xml_rpc_http_port']; - $ent['xml_rpc_auth_realm'] = $_POST['xml_rpc_auth_realm']; - $ent['xml_rpc_auth_user'] = $_POST['xml_rpc_auth_user']; - $ent['xml_rpc_auth_pass'] = $_POST['xml_rpc_auth_pass']; - $ent['admin_pin'] = $_POST['admin_pin']; - $ent['smtphost'] = $_POST['smtphost']; - $ent['smtpsecure'] = $_POST['smtpsecure']; - $ent['smtpauth'] = $_POST['smtpauth']; - $ent['smtpusername'] = $_POST['smtpusername']; - $ent['smtppassword'] = $_POST['smtppassword']; - $ent['smtpfrom'] = $_POST['smtpfrom']; - $ent['smtpfromname'] = $_POST['smtpfromname']; - $ent['mod_shout_decoder'] = $_POST['mod_shout_decoder']; - $ent['mod_shout_volume'] = $_POST['mod_shout_volume']; - - - if (isset($id) && $a_settings[$id]) { - //update - $a_settings[$id] = $ent; - } - else { - //add - $a_settings[] = $ent; - } - - write_config(); - sync_package_freeswitch_settings(); - - //header("Location: freeswitch_extensions.php"); - //exit; - } -} - -include("head.inc"); - -?> - -<script type="text/javascript" language="JavaScript"> - -function show_advanced_config() { - document.getElementById("showadvancedbox").innerHTML=''; - aodiv = document.getElementById('showadvanced'); - aodiv.style.display = "block"; -} - -</script> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_label: Settings</p>\n"; -?> -<?php if ($input_errors) print_input_errors($input_errors); ?> - - -<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>Settings<br /> - </strong></span> - /usr/local/freeswitch/conf/directory/default/ - </p></td> - </tr> - </table> - --> - <br /> - - <form action="freeswitch_settings.php" method="post" name="iform" id="iform"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - - <tr> - <td width="25%" valign="top" class="vncell">Numbering Plan</td> - <td width="75%" class="vtable"> - <input name="numbering_plan" type="text" class="formfld" id="numbering_plan" size="40" value="<?=htmlspecialchars($pconfig['numbering_plan']);?>"> - <br /><span class="vexpl">Enter the numbering plan here. example: US<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Default Gateway</td> - <td width="75%" class="vtable"> - <input name="default_gateway" type="text" class="formfld" id="default_gateway" size="40" value="<?=htmlspecialchars($pconfig['default_gateway']);?>"> - <br /><span class="vexpl">Enter the default gateway name here.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Default Area Code</td> - <td width="75%" class="vtable"> - <input name="default_area_code" type="text" class="formfld" id="default_area_code" size="40" value="<?=htmlspecialchars($pconfig['default_area_code']);?>"> - <br /><span class="vexpl">Enter the area code here. example: 208<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Event Socket Port</td> - <td width="75%" class="vtable"> - <input name="event_socket_port" type="text" class="formfld" id="event_socket_port" size="40" value="<?=htmlspecialchars($pconfig['event_socket_port']);?>"> - <br /><span class="vexpl">Enter the event socket port here. default: 8021<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Event Socket Password</td> - <td width="75%" class="vtable"> - <input name="event_socket_password" type="password" class="formfld" id="event_socket_password" size="40" value="<?=htmlspecialchars($pconfig['event_socket_password']);?>"> - <br /><span class="vexpl">Enter the event socket password here. default: ClueCon<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">XML RPC HTTP Port</td> - <td width="75%" class="vtable"> - <input name="xml_rpc_http_port" type="text" class="formfld" id="xml_rpc_http_port" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_http_port']);?>"> - <br /><span class="vexpl">Enter the XML RPC HTTP Port here. default: 8787<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">XML RPC Auth Realm</td> - <td width="75%" class="vtable"> - <input name="xml_rpc_auth_realm" type="text" class="formfld" id="xml_rpc_auth_realm" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_realm']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth Realm here. default: freeswitch<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">XML RPC Auth User</td> - <td width="75%" class="vtable"> - <input name="xml_rpc_auth_user" type="text" class="formfld" id="xml_rpc_auth_user" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_user']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth User here. default: freeswitch<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">XML RPC Auth Password</td> - <td width="75%" class="vtable"> - <input name="xml_rpc_auth_pass" type="password" class="formfld" id="xml_rpc_auth_pass" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_pass']);?>"> - <br /><span class="vexpl">Enter the XML RPC Auth Password here. default: works<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Admin PIN Number</td> - <td width="75%" class="vtable"> - <input name="admin_pin" type="password" class="formfld" id="admin_pin" size="40" value="<?=htmlspecialchars($pconfig['admin_pin']);?>"> - <br /><span class="vexpl">Enter a admin pin number. Used to authenticate the admin from the phone.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">SMTP Host</td> - <td width="75%" class="vtable"> - <input name="smtphost" type="text" class="formfld2" id="smtphost" size="40" value="<?=htmlspecialchars($pconfig['smtphost']);?>"> - <br /><span class="vexpl">Enter the SMTP host address. example: smtp.gmail.com:465<br /></span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">SMTP Secure</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='smtpsecure' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['smtpsecure'])) { - case "none": - echo " <option value='none' selected='yes'>none</option>\n"; - echo " <option value='tls'>tls</option>\n"; - echo " <option value='ssl'>ssl</option>\n"; - break; - case "tls": - echo " <option value='none'>none</option>\n"; - echo " <option value='tls' selected='yes'>tls</option>\n"; - echo " <option value='ssl'>ssl</option>\n"; - break; - case "ssl": - echo " <option value='none'>none</option>\n"; - echo " <option value='tls'>tls</option>\n"; - echo " <option value='ssl' selected='yes'>ssl</option>\n"; - break; - default: - echo " <option value='' selected='yes'>none</option>\n"; - echo " <option value='tls'>tls</option>\n"; - echo " <option value='ssl'>ssl</option>\n"; - } - echo " </select><br />\n"; - echo "Select the SMTP security. None, TLS, SSL<br />"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">SMTP Auth</td> - <td width="78%" class="vtable"> - <?php - echo " <select name='smtpauth' class='formfld'>\n"; - echo " <option></option>\n"; - switch (htmlspecialchars($pconfig['smtpauth'])) { - case "true": - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - break; - case "false": - echo " <option value='true'>true</option>\n"; - echo " <option value='false' selected='yes'>false</option>\n"; - - break; - default: - echo " <option value='true' selected='yes'>true</option>\n"; - echo " <option value='false'>false</option>\n"; - } - echo " </select><br />\n"; - echo "Use SMTP Authentication true or false.<br />"; - ?> - </td> - </tr> - - <tr> - <td width="25%" valign="top" class="vncell">SMTP Username</td> - <td width="75%" class="vtable"> - <input name="smtpusername" type="text" class="formfld" id="smtpusername" size="40" value="<?=htmlspecialchars($pconfig['smtpusername']);?>"> - <br /><span class="vexpl">Enter the SMTP authentication username.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">SMTP Password</td> - <td width="75%" class="vtable"> - <input name="smtppassword" type="password" class="formfld" id="smtppassword" size="40" value="<?=htmlspecialchars($pconfig['smtppassword']);?>"> - <br /><span class="vexpl">Enter the SMTP authentication password.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">SMTP From</td> - <td width="75%" class="vtable"> - <input name="smtpfrom" type="text" class="formfld" id="smtpfrom" size="40" value="<?=htmlspecialchars($pconfig['smtpfrom']);?>"> - <br /><span class="vexpl">Enter the SMTP From email address.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">SMTP From Name</td> - <td width="75%" class="vtable"> - <input name="smtpfromname" type="text" class="formfld" id="smtpfromname" size="40" value="<?=htmlspecialchars($pconfig['smtpfromname']);?>"> - <br /><span class="vexpl">Enter the SMTP From Name.<br /></span> - </td> - </tr> - <tr> - <td width="25%" valign="top" class="vncell">Mod Shout Decoder</td> - <td width="75%" class="vtable"> - <input name="mod_shout_decoder" type="text" class="formfld" id="mod_shout_decoder" size="40" value="<?=htmlspecialchars($pconfig['mod_shout_decoder']);?>"> - <br /><span class="vexpl">Enter the Decoder. default: i386<br /></span> - </td> - </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"> - <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a> - </td> - </tr> - </table> - </div> - <div id="showadvanced" style="display:none"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="25%" valign="top" class="vncell">zzz</td> - <td width="75%" class="vtable"> - <input name="zzz" type="text" class="formfld" id="zzz" size="40" value="<?=htmlspecialchars($pconfig['zzz']);?>"> - <br /> <span class="vexpl">zzz<br /></span> - </td> - </tr> - </table> - </div> - --> - <br /><br /> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="25%" valign="top"> </td> - <td> - <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> - <?php - $id = 0; - if (isset($id) && $a_settings[$id]) { - echo "<input name=\"id\" type=\"hidden\" value=\"".$id."\">\n"; - } - ?> - </td> - </tr> - </table> - </form> - - <br /> - <br /> - <br /> - <br /> - <br /> - <br /> - - </td> - </tr> -</table> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_status.tmp b/config/freeswitch_dev/freeswitch_status.tmp deleted file mode 100644 index 355adba3..00000000 --- a/config/freeswitch_dev/freeswitch_status.tmp +++ /dev/null @@ -1,340 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_status.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"); - - -if ($_GET['a'] == "download") { - if ($_GET['t'] == "logs") { - $tmp = '/usr/local/freeswitch/log/'; - $filename = 'freeswitch.log'; - } - if ($_GET['t'] == "cdrcsv") { - $tmp = '/usr/local/freeswitch/log/cdr-csv/'; - $filename = 'Master.csv'; - } - if ($_GET['t'] == "backup") { - $tmp = '/root/backup/'; - $filename = 'freeswitch.bak.tgz'; - if (!is_dir('/root/backup/')) { - exec("mkdir /root/backup/"); - } - system('cd /usr/local/;tar cvzf /root/backup/freeswitch.bak.tgz freeswitch'); - } - session_cache_limiter('public'); - $fd = fopen($tmp.$filename, "rb"); - header("Content-Type: binary/octet-stream"); - header("Content-Length: " . filesize($tmp.$filename)); - header('Content-Disposition: attachment; filename="'.$filename.'"'); - fpassthru($fd); - exit; -} - -if ($_GET['a'] == "other") { - if ($_GET['t'] == "restore") { - $tmp = '/root/backup/'; - $filename = 'freeswitch.bak.tgz'; - - //extract a specific directory to /usr/local/freeswitch - if (file_exists('/root/backup/'.$filename)) { - //echo "The file $filename exists"; - - //Recommended - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml'); - system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml'); - - //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; - } -} - -include("head.inc"); - -$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; -$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; -$host = $config['interfaces']['lan']['ipaddr']; - -$savemsg = $_GET["savemsg"]; - -//if service is not running then start it -if (!pkg_is_service_running('freeswitch')) { - $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r"); - 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"); -echo "<p class=\"pgtitle\">$v_project_label: Status</p>\n"; - - -if ($savemsg) { - print_info_box($savemsg); -} -?> - -<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" > - -<?php - -echo "<br /><br />\n\n"; - - -$fp = event_socket_create($host, $port, $password); -$cmd = "api sofia status"; -$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</b> \n"; -echo "</td>\n"; -echo "<td width='50%' align='right'>\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 "</pre>\n"; -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='restart' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n"; - if ($sip_profile_name == "external") { - echo " <input type='button' value='rescan' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n"; - } - else { - echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/packages/freeswitch/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 status"; -$response = event_socket_request($fp, $cmd); -echo "<b>status</b><br />\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 show channels"; -$response = event_socket_request($fp, $cmd); -echo "<b>show channels</b><br />\n"; -if (strlen($response) > 40) { - echo "<textarea cols='85' rows='10' wrap='off'>\n"; - echo $response; - echo "</textarea>\n"; -} -else { - echo "<pre style=\"font-size: 9pt;\">\n"; - echo $response; - echo "</pre>\n"; -} -fclose($fp); -echo "<br /><br />\n\n"; -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><br />\n"; -if (strlen($response) > 40) { - echo "<textarea cols='85' rows='10' wrap='off'>\n"; - echo $response; - echo "</textarea>\n"; -} -else { - echo "<pre style=\"font-size: 9pt;\">\n"; - echo $response; - echo "</pre>\n"; -} -fclose($fp); -echo "<br /><br />\n\n"; -echo "<br /><br />\n\n"; - - -echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; -echo "<tr>\n"; -echo "<td width='80%'>\n"; -echo "<b>Backup / Restore</b><br />\n"; -echo "The 'backup' button will tar gzip /usr/local/freeswitch/ to /root/backup/freeswitch.bak.tgz it then presents a file to download. \n"; -echo "If the backup file does not exist in /root/backup/freeswitch.bak.tgz then the 'restore' button will be hidden. \n"; -echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n"; -echo "<br /><br />\n"; -echo "</td>\n"; -echo "<td width='20%' valign='middle' align='right'>\n"; -echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/freeswitch/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"; -echo "</table>\n"; -echo "<br /><br />\n\n"; - - -echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; -echo "<tr>\n"; -echo "<td width='50%'>\n"; -echo "<b>Call Detail Records</b><br />\n"; -echo "/usr/local/freeswitch/log/cdr-csv/Master.csv<br /><br />\n"; -echo "</td>\n"; -echo "<td width='50%' align='right'>\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"; - - -echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; -echo "<tr>\n"; -echo "<td width='50%'>\n"; -echo "<b>Logs</b><br />\n"; -echo "/usr/local/freeswitch/log/cdr-csv/freeswitch.log<br /><br />\n"; -echo "</td>\n"; -echo "<td width='50%' align='right'>\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 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"; - - -//$fp = event_socket_create($host, $port, $password); -//$cmd = "api sofia "; -//$response = event_socket_request($fp, $cmd); -//echo "<b>api sofia</b><br />\n"; -//echo "<pre style=\"font-size: 9pt;\">\n"; -//echo $response; -//echo "</pre>\n"; -//fclose($fp); -//echo "<br /><br />\n\n"; - -?> - - </td> - </tr> -</table> - -</div> -<?php include("fend.inc"); ?> - -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_time_conditions.tmp b/config/freeswitch_dev/freeswitch_time_conditions.tmp deleted file mode 100644 index 315d0d72..00000000 --- a/config/freeswitch_dev/freeswitch_time_conditions.tmp +++ /dev/null @@ -1,180 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_time_conditions.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_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config']; - - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'ivroptions') { - if ($a_ivr_options[$_GET['id']]) { - unset($a_ivr_options[$_GET['id']]); - write_config(); - //touch($d_hostsdirty_path); - header("Location: freeswitch_ivr_edit.php?id=".$_GET['parentid']); - exit; - } - } -} - - -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -//include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_labels: IVR Options</p>\n"; -?> - -<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_ivr_options.php" method="post" name="iform" id="iform"> -<?php - - -//echo "<pre>"; -//print_r ($a_ivr); -//echo "</pre>"; - -//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"> - <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 - 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> - <td width="25%" class="listhdrr">Name</td> - <td width="25%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - <?php $i = 0; foreach ($a_ivr as $ivrent): ?> - <tr> - <td class="listlr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>'"> - <a href="javascript:void(0)" onclick="window.open('freeswitch_recordings_play.php?a=download&filename=<?=$recordingent['filename'];?>', 'play',' width=300,height=40,menubar=no,status=no,toolbar=no')"> - <?=$ivrent['filename']?> - </a> - </td> - <td class="listr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';"> - <?=$ivrent['recordingname'];?> - </td> - <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?> - </td> - <td valign="middle" nowrap class="list"> - <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_options.php?type=ivroption&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++; endforeach; ?> - <tr> - <td class="list" colspan="3"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="freeswitch_ivr_options_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - - - <tr> - <td class="list" colspan="3"></td> - <td class="list"></td> - </tr> - </table> - -</form> - -<br> -<br> -<br> -<br> -<br> -<br> - -</td> -</tr> -</table> - -</div> - - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_time_conditions_edit.tmp b/config/freeswitch_dev/freeswitch_time_conditions_edit.tmp deleted file mode 100644 index 4e6cfe47..00000000 --- a/config/freeswitch_dev/freeswitch_time_conditions_edit.tmp +++ /dev/null @@ -1,203 +0,0 @@ -<?php -/* $Id$ */ -/* - freeswitch_time_conditions_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_ivr_options = &$config['installedpackages']['freeswitchtimeconditions']['config']; - -$id = $_GET['id']; -if (isset($_POST['id'])) { - $id = $_POST['id']; -} - -//$parentid = $_GET['parentid']; -//if (isset($_POST['parentid'])) { -// $parentid = $_POST['parentid']; -//} - -//$ivrid = $_GET['ivrid']; -//if (isset($_POST['ivrid'])) { -// $ivrid = $_POST['ivrid']; -//} - -if (isset($id) && $a_ivr_options[$id]) { - $pconfig['conditionname'] = $a_ivr_options[$id]['conditionname']; - $pconfig['conditionstartday'] = $a_ivr_options[$id]['conditionstartday']; - $pconfig['conditionstarthrs'] = $a_ivr_options[$id]['conditionstarthrs']; - $pconfig['conditionstartmin'] = $a_ivr_options[$id]['conditionstartmin']; - - $pconfig['conditionendday'] = $a_ivr_options[$id]['conditionendday']; - $pconfig['conditionendhrs'] = $a_ivr_options[$id]['conditionstarthrs']; - $pconfig['conditionendmin'] = $a_ivr_options[$id]['conditionendmin']; - - $pconfig['conditionaction'] = $a_ivr_options[$id]['conditionaction']; - $pconfig['conditionantiaction'] = $a_ivr_options[$id]['conditionantiaction']; - $pconfig['conditionjavascript'] = $a_ivr_options[$id]['conditionjavascript']; - $pconfig['conditiondescr'] = $a_ivr_options[$id]['conditiondescr']; -} - - - -if ($_POST) { - - unset($input_errors); - $pconfig = $_POST; - - if (!$input_errors) { - - $ivroptionent = array(); - $ivroptionent['ivrid'] = $_POST['ivrid']; - $ivroptionent['optionnumber'] = $_POST['optionnumber']; - $ivroptionent['optiontype'] = $_POST['optiontype']; - $ivroptionent['optiondest'] = $_POST['optiondest']; - $ivroptionent['optiondescr'] = $_POST['optiondescr']; - - if (isset($id) && $a_ivr_options[$id]) { - //update - $a_ivr_options[$id] = $ivroptionent; - } - else { - //add - $a_ivr_options[] = $ivroptionent; - } - - //touch($d_hostsdirty_path); - write_config(); - - header("Location: freeswitch_ivr_edit.php?id=".$parentid); - exit; - } -} - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php -include("head.inc"); -//include("fbegin.inc"); -echo "<p class=\"pgtitle\">$v_project_labels: IVR Options: Edit</p>\n"; - -if ($input_errors) print_input_errors($input_errors); - -?> - -<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_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"> - <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"> - <?php - echo " <select name='optiontype' class='formfld'>\n"; - echo " <option></option>\n"; - if (htmlspecialchars($pconfig['optiontype']) == "extension") { - echo " <option selected='yes'>extension</option>\n"; - } - else { - echo " <option>extension</option>\n"; - } - if (htmlspecialchars($pconfig['optiontype']) == "voicemail") { - echo " <option selected='yes'>voicemail</option>\n"; - } - else { - echo " <option>voicemail</option>\n"; - } - echo " </select>\n"; - ?> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq">Destination</td> - <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> - <td width="22%" valign="top" class="vncell">Description</td> - <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> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <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;?>"> - <?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> - -</div> - -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/config/freeswitch_dev/freeswitch_vars.tmp b/config/freeswitch_dev/freeswitch_vars.tmp deleted file mode 100644 index c1a06999..00000000 --- a/config/freeswitch_dev/freeswitch_vars.tmp +++ /dev/null @@ -1,164 +0,0 @@ -<?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"); -echo "<p class=\"pgtitle\">$v_project_label: Variables</p>\n"; -?> - -<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> |