aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/freeswitch/begin_recording.wavbin0 -> 19480 bytes
-rw-r--r--packages/freeswitch/freeswitch.inc939
-rw-r--r--packages/freeswitch/freeswitch.xml111
-rw-r--r--packages/freeswitch/freeswitch_dialplan.xml19
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes.tmp269
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes_details.tmp53
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes_details_edit.tmp376
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes_edit.tmp523
-rw-r--r--packages/freeswitch/freeswitch_extensions.xml17
-rw-r--r--packages/freeswitch/freeswitch_external.xml17
-rw-r--r--packages/freeswitch/freeswitch_gateways.tmp211
-rw-r--r--packages/freeswitch/freeswitch_gateways_edit.tmp565
-rw-r--r--packages/freeswitch/freeswitch_internal.xml19
-rw-r--r--packages/freeswitch/freeswitch_ivr.tmp217
-rw-r--r--packages/freeswitch/freeswitch_ivr_edit.tmp577
-rw-r--r--packages/freeswitch/freeswitch_ivr_options.tmp52
-rw-r--r--packages/freeswitch/freeswitch_ivr_options_edit.tmp217
-rw-r--r--packages/freeswitch/freeswitch_modules.xml16
-rw-r--r--packages/freeswitch/freeswitch_public.xml19
-rw-r--r--packages/freeswitch/freeswitch_public_includes.tmp272
-rw-r--r--packages/freeswitch/freeswitch_public_includes_details.tmp53
-rw-r--r--packages/freeswitch/freeswitch_public_includes_details_edit.tmp411
-rw-r--r--packages/freeswitch/freeswitch_public_includes_edit.tmp523
-rw-r--r--packages/freeswitch/freeswitch_recordings.tmp315
-rw-r--r--packages/freeswitch/freeswitch_recordings_edit.tmp187
-rw-r--r--packages/freeswitch/freeswitch_recordings_play.tmp54
-rw-r--r--packages/freeswitch/freeswitch_status.tmp184
-rw-r--r--packages/freeswitch/freeswitch_time_conditions.tmp196
-rw-r--r--packages/freeswitch/freeswitch_time_conditions_edit.tmp226
-rw-r--r--packages/freeswitch/freeswitch_vars.xml19
-rw-r--r--packages/freeswitch/please_enter_your_pin_number.wavbin0 -> 28212 bytes
-rw-r--r--packages/freeswitch/your_pin_number_is_incorect_goodbye.wavbin0 -> 43420 bytes
-rw-r--r--pkg_config.7.xml2
33 files changed, 6496 insertions, 163 deletions
diff --git a/packages/freeswitch/begin_recording.wav b/packages/freeswitch/begin_recording.wav
new file mode 100644
index 00000000..9e4992ca
--- /dev/null
+++ b/packages/freeswitch/begin_recording.wav
Binary files differ
diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc
index 83c169f2..7560ce04 100644
--- a/packages/freeswitch/freeswitch.inc
+++ b/packages/freeswitch/freeswitch.inc
@@ -3,7 +3,7 @@
/*
/* ========================================================================== */
/*
- freeswitch.xml
+ freeswitch.inc
Copyright (C) 2008 Mark J Crane
All rights reserved.
@@ -35,6 +35,26 @@
*/
+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);
@@ -137,7 +157,98 @@ function event_socket_request_cmd($cmd)
unset($host, $port, $password);
}
-
+
+
+function recording_js() {
+
+ $fout = fopen("/usr/local/freeswitch/scripts/recordings.js","w");
+ $tmp = " var pin = \"".$rowhelper['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 .= " 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 .= " session.execute(\"set\", \"playback_terminators=#\");\n";
+ $tmp .= "\n";
+ $tmp .= " if (pin.length > 0) {\n";
+ $tmp .= " digitmaxlength = 6;\n";
+ $tmp .= " session.streamFile( \"custom/pin.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 your recording now.\");\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 .= " }\n";
+ $tmp .= " session.hangup();\n";
+ $tmp .= "\n";
+ $tmp .= " }";
+ fwrite($fout, $tmp);
+ unset($tmp);
+ fclose($fout);
+
+}
+
function sync_package_freeswitch_settings()
{
@@ -194,11 +305,13 @@ function sync_package_freeswitch_settings()
unset($tmpxml, $event_socket_password);
fclose($fout);
+ recording_js();
+
}
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
}
@@ -230,7 +343,7 @@ function sync_package_freeswitch_dialplan()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -300,7 +413,7 @@ function sync_package_freeswitch_extensions()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -321,7 +434,7 @@ function sync_package_freeswitch_gateways()
foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) {
- if ($rowhelper['disabled'] != "on") {
+ if ($rowhelper['enabled'] != "false") {
$fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external/".$rowhelper['gateway'].".xml","w");
$tmpxml .= "<include>\n";
@@ -381,7 +494,7 @@ function sync_package_freeswitch_gateways()
conf_mount_ro();
$cmd = "api sofia profile external restart reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -504,7 +617,7 @@ function sync_package_freeswitch_modules()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -535,7 +648,7 @@ function sync_package_freeswitch_public()
}
conf_mount_ro();
- $cmd = "api reloadxml";
+ //$cmd = "api reloadxml";
event_socket_request_cmd($cmd);
unset($cmd);
@@ -568,7 +681,7 @@ function sync_package_freeswitch_vars()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -600,7 +713,7 @@ function sync_package_freeswitch_internal()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
@@ -632,12 +745,657 @@ function sync_package_freeswitch_external()
conf_mount_ro();
$cmd = "api reloadxml";
- event_socket_request_cmd($cmd);
+ //event_socket_request_cmd($cmd);
unset($cmd);
}
-
+
+function get_recording_filename($id) {
+ global $config;
+ foreach($config['installedpackages']['freeswitchrecordings']['config'] as $rowhelper) {
+ if ($rowhelper['recordingid'] == $id) {
+ return $rowhelper['filename'];
+ }
+ }
+}
+
+
+function sync_package_freeswitch_ivr() {
+
+ global $config;
+ conf_mount_rw();
+ config_lock();
+
+
+ foreach($config['installedpackages']['freeswitchivr']['config'] as $rowhelper) {
+
+ /*
+ $rowhelper['ivrid']
+ $rowhelper['ivrextension']
+ $rowhelper['ivrname']
+ $rowhelper['recordingid']
+ $rowhelper['ivrtimeout']
+ $rowhelper['ivrcontext']
+ $rowhelper['ivrconditionjs']
+ $rowhelper['ivrdescr']
+ */
+
+
+ //add the IVR to the dialplan
+
+ $action = 'add'; //set default action to add
+ $i = 0;
+ foreach($config['installedpackages']['freeswitchdialplanincludes']['config'] 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++;
+
+ }
+
+ $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
+ $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
+
+
+ $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);
+
+ $ent = array();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['tag'] = 'action'; //condition, action, antiaction
+ $ent['fieldtype'] = 'javascript';
+ $ent['fielddata'] = 'ivr_'.$rowhelper['ivrid'].'.js';
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
+
+ }
+ 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);
+
+
+ // 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'];
+
+ $fp = event_socket_create($host, $port, $password);
+ $cmd = "api global_getvar domain";
+ $domain = trim(event_socket_request($fp, $cmd));
+
+ $tmp .= "\n";
+ $tmp .= " var condition = true;\n";
+ $tmp .= "\n";
+ $tmp .= " var dtmftimeout = 3;\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 .= "//console_log( \"info\", \"IVR Server Time is: \"+Hours+\":\"+Mins+\" \\n\" );\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";
+ $tmp .= " if (condition) {\n";
+ $tmp .= " //action\n";
+ $tmp .= "\n";
+ $tmp .= " //console_log( \"info\", \"office hours\\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 .= " //session.collectInput( mycb, dtmf, dtmftimeout );\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(3, \"#\", 3000); //allow up to 4 digits\n";
+ $tmp .= "\n";
+ $tmp .= "\n";
+ //$tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
+
+ //$actioncount = 0;
+ //foreach($config['freeswitchivroptions']['config'] as $row) {
+ // //find the correct IVR options with the correct action
+ // if ($row['ivrid'] == $rowhelper['ivrid']) {
+ // if ($row['optionaction'] == "action") {
+ // $actioncount++;
+ // }
+ // }
+ //}
+ //$tmp .= "action count: ".$actioncount."<br />\n";
+
+ //action
+ $tmpaction = "";
+
+ $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
+ $x = 0;
+ foreach($config['installedpackages']['freeswitchivroptions']['config'] 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":
+
+ if ($row['optiontype'] == "extension") {
+ $tmpactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmpactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmpactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+
+ break;
+ default:
+ //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
+ 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 .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\");\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmpaction .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmpaction .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+ $tmpaction .= " }\n";
+
+
+ }
+
+ $x++;
+ } //end if action
+
+ } //end ivrid
+
+
+ } //end foreach
+
+ $tmp .= $tmpaction;
+ $tmp .= " else {\n";
+ $tmp .= $tmpactiondefault;
+ $tmp .= " }\n";
+ $tmp .= "\n";
+ unset($tmpaction);
+
+
+ $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 .= " } else {\n";
+ //$tmp .= $tmpactiondefault;
+ //$tmp .= " }\n";
+ $tmp .= "\n";
+ $tmp .= " } //end if session.ready\n";
+ $tmp .= "\n";
+ $tmp .= " }\n";
+ $tmp .= " else {\n";
+ $tmp .= " //anti-action\n";
+ $tmp .= " //console_log( \"info\", \"After hours\\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 .= " //session.collectInput( mycb, dtmf, dtmftimeout );\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);\n";
+ $tmp .= "\n";
+ $tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
+ $tmp .= "\n";
+
+
+ //$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++;
+ // }
+ // }
+ //}
+ //$tmp .= "anti-action count: ".$antiactioncount."<br />\n";
+
+
+ $tmpantiaction = "";
+ $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
+
+ $x = 0;
+ foreach($config['installedpackages']['freeswitchivroptions']['config'] 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":
+
+ if ($row['optiontype'] == "extension") {
+ $tmpantiactiondefault .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmpantiactiondefault .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmpantiactiondefault .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+
+ break;
+ default:
+ //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
+
+ if ($x == 0) {
+ $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
+ }
+ else {
+ $tmpantiaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
+ }
+
+ if ($row['optiontype'] == "extension") {
+ $tmpantiaction .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\");\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmpantiaction .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmpantiaction .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+ $tmpantiaction .= " }\n";
+
+
+ } //end switch
+
+ $x++;
+ } //end anti-action
+
+ } //end ivrid
+
+
+ } //end for each
+
+ $tmp .= $tmpantiaction;
+ $tmp .= " else {\n";
+ $tmp .= $tmpantiactiondefault;
+ $tmp .= " }\n";
+ $tmp .= "\n";
+ unset($tmpantiaction);
+
+ $tmp .= " } \n";
+ //$tmp .= " else if ( dtmf.digits.length == \"3\" ) {\n";
+ //$tmp .= " //Transfer to the extension the caller chose\n";
+ //$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";
+
+ unset($tmpactiondefault);
+ unset($tmpantiactiondefault);
+
+ $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js";
+ $fout = fopen("/usr/local/freeswitch/scripts/".$ivrfilename,"w");
+ fwrite($fout, $tmp);
+ unset($ivrfilename);
+ unset($tmpxml);
+ fclose($fout);
+
+ } //end foreach
+
+ conf_mount_ro();
+ config_unlock();
+
+} //end function
+
+
+function sync_package_freeswitch_dialplan_includes() {
+ global $config;
+ conf_mount_rw();
+ config_lock();
+
+ $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
+ $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
+
+ if (count($a_dialplan_includes) > 0) {
+ foreach($config['installedpackages']['freeswitchdialplanincludes']['config'] as $rowhelper) {
+ $tmp = "";
+ $tmp .= "\n";
+
+ //$rowhelper['dialplanincludeid'];
+ //$rowhelper['extensionname'];
+ //$rowhelper['context'];
+ //$rowhelper['enabled'];
+
+ $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
+
+ if (count($a_dialplan_include_details) > 0) {
+ $conditioncount = 0;
+ $i = 0;
+ foreach ($a_dialplan_include_details as $ent) {
+ if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
+ if ($i == 0) {
+ $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
+ }
+ else {
+ $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
+ }
+ $conditioncount++;
+ $i++;
+ }
+
+ }
+ }
+
+ 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";
+ }
+ $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
+
+ conf_mount_ro();
+ config_unlock();
+
+}
+
+
+function sync_package_freeswitch_public_includes() {
+ global $config;
+ conf_mount_rw();
+ config_lock();
+
+ $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
+ $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
+
+ foreach($config['installedpackages']['freeswitchpublicincludes']['config'] 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) {
+ $conditioncount = 0;
+ $i = 0;
+ foreach ($a_public_include_details as $ent) {
+ if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
+ if ($i == 0) {
+ $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
+ }
+ else {
+ $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
+ }
+ $conditioncount++;
+ $i++;
+ }
+
+ }
+ }
+
+ 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";
+ }
+ $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
+
+ conf_mount_ro();
+ config_unlock();
+
+}
+
+
function sync_package_freeswitch()
{
global $config;
@@ -650,7 +1408,9 @@ function sync_package_freeswitch()
sync_package_freeswitch_vars();
sync_package_freeswitch_internal();
sync_package_freeswitch_external();
-
+ //sync_package_freeswitch_recordings();
+ sync_package_freeswitch_ivr();
+ sync_package_freeswitch_dialplan_includes();
}
@@ -664,15 +1424,78 @@ function freeswitch_php_install_command()
if (!is_dir('/usr/local/www/freeswitch/')) {
exec("mkdir /usr/local/www/freeswitch/");
}
- exec("cp /tmp/freeswitch_status.tmp /usr/local/www/freeswitch/freeswitch_status.php");
- unlink_if_exists("/tmp/freeswitch_status.tmp");
-
+
+
exec("cp /tmp/freeswitch_cmd.tmp /usr/local/www/freeswitch/freeswitch_cmd.php");
unlink_if_exists("/tmp/freeswitch_cmd.tmp");
+ exec("cp /tmp/freeswitch_dialplan_includes_details.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_details.php");
+ unlink_if_exists("/tmp/freeswitch_dialplan_includes_details.tmp");
+
+ exec("cp /tmp/freeswitch_dialplan_includes_details_edit.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_details_edit.php");
+ unlink_if_exists("/tmp/freeswitch_dialplan_includes_details_edit.tmp");
+
+ exec("cp /tmp/freeswitch_dialplan_includes.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes.php");
+ unlink_if_exists("/tmp/freeswitch_dialplan_includes.tmp");
+
+ exec("cp /tmp/freeswitch_dialplan_includes_edit.tmp /usr/local/www/freeswitch/freeswitch_dialplan_includes_edit.php");
+ unlink_if_exists("/tmp/freeswitch_dialplan_includes_edit.tmp");
+
+ exec("cp /tmp/freeswitch_ivr.tmp /usr/local/www/freeswitch/freeswitch_ivr.php");
+ unlink_if_exists("/tmp/freeswitch_ivr.tmp");
+
+ exec("cp /tmp/freeswitch_ivr_edit.tmp /usr/local/www/freeswitch/freeswitch_ivr_edit.php");
+ unlink_if_exists("/tmp/freeswitch_ivr_edit.tmp");
+
+ exec("cp /tmp/freeswitch_ivr_options.tmp /usr/local/www/freeswitch/freeswitch_ivr_options.php");
+ unlink_if_exists("/tmp/freeswitch_ivr_options.tmp");
+
+ exec("cp /tmp/freeswitch_ivr_options_edit.tmp /usr/local/www/freeswitch/freeswitch_ivr_options_edit.php");
+ unlink_if_exists("/tmp/freeswitch_ivr_options_edit.tmp");
+
+ exec("cp /tmp/freeswitch_public_includes_details.tmp /usr/local/www/freeswitch/freeswitch_public_includes_details.php");
+ unlink_if_exists("/tmp/freeswitch_public_includes_details.tmp");
+
+ exec("cp /tmp/freeswitch_public_includes_details_edit.tmp /usr/local/www/freeswitch/freeswitch_public_includes_details_edit.php");
+ unlink_if_exists("/tmp/freeswitch_public_includes_details_edit.tmp");
+
+ exec("cp /tmp/freeswitch_public_includes.tmp /usr/local/www/freeswitch/freeswitch_public_includes.php");
+ unlink_if_exists("/tmp/freeswitch_public_includes.tmp");
+
+ exec("cp /tmp/freeswitch_public_includes_edit.tmp /usr/local/www/freeswitch/freeswitch_public_includes_edit.php");
+ unlink_if_exists("/tmp/freeswitch_public_includes_edit.tmp");
+
+ exec("cp /tmp/freeswitch_recordings_edit.tmp /usr/local/www/freeswitch/freeswitch_recordings_edit.php");
+ unlink_if_exists("/tmp/freeswitch_recordings_edit.tmp");
+
+ exec("cp /tmp/freeswitch_recordings_play.tmp /usr/local/www/freeswitch/freeswitch_recordings_play.php");
+ unlink_if_exists("/tmp/freeswitch_recordings_play.tmp");
+
+ exec("cp /tmp/freeswitch_recordings.tmp /usr/local/www/freeswitch/freeswitch_recordings.php");
+ unlink_if_exists("/tmp/freeswitch_recordings.tmp");
+
+ exec("cp /tmp/freeswitch_time_conditions.tmp /usr/local/www/freeswitch/freeswitch_time_conditions.php");
+ unlink_if_exists("/tmp/freeswitch_time_conditions.tmp");
+
+ exec("cp /tmp/freeswitch_time_conditions_edit.tmp /usr/local/www/freeswitch/freeswitch_time_conditions_edit.php");
+ unlink_if_exists("/tmp/freeswitch_time_conditions_edit.tmp");
+
+ exec("cp /tmp/freeswitch_status.tmp /usr/local/www/freeswitch/freeswitch_status.php");
+ unlink_if_exists("/tmp/freeswitch_status.tmp");
+
exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/");
unlink_if_exists("/tmp/freeswitch.tgz");
-
+
+ exec("cp /tmp/please_enter_your_pin_number.wav /usr/local/www/freeswitch/please_enter_your_pin_number.wav");
+ unlink_if_exists("/tmp/please_enter_your_pin_number.wav");
+
+ exec("cp /tmp/begin_recording.wav /usr/local/www/freeswitch/begin_recording.wav");
+ unlink_if_exists("/tmp/begin_recording.wav");
+
+ exec("cp /tmp/your_pin_number_is_incorect_goodbye.wav /usr/local/www/freeswitch/your_pin_number_is_incorect_goodbye.wav");
+ unlink_if_exists("/tmp/your_pin_number_is_incorect_goodbye.wav");
+
+
/* freeswitch settings defaults */
if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) {
$config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US";
@@ -695,7 +1518,10 @@ function freeswitch_php_install_command()
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";
+ }
+
$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'];
@@ -703,7 +1529,47 @@ function freeswitch_php_install_command()
$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'];
+ $dialplanincludeid = guid();
+
+ $ent = array();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['extensionname'] = 'Recordings';
+ $ent['order'] = '9000';
+ $ent['context'] = 'default';
+ $ent['enabled'] = 'true';
+ $ent['descr'] = 'Default system recordings tool';
+ $a_dialplan_includes[] = $ent;
+ unset($dialplanincludeid);
+
+ $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);
+
+ write_config();
+ sync_package_freeswitch_dialplan_includes();
+ unset($dialplanincludeid);
+
+
$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";
@@ -911,15 +1777,14 @@ function freeswitch_php_install_command()
pclose($handle);
$config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 9759.";
- $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.1.1";
+ $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.3";
conf_mount_ro();
config_unlock();
}
-function freeswitch_deinstall_command()
-{
+function freeswitch_deinstall_command() {
conf_mount_rw();
config_lock();
@@ -929,13 +1794,34 @@ function freeswitch_deinstall_command()
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_gateways.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/freeswitch/freeswitch_status.xml");
- unlink_if_exists("/usr/local/www/freeswitch/freeswitch_cmd.xml");
+
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_cmd.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_details.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_dialplan_includes_details_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_options_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_ivr_options.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_gateways.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_gateways_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_details.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_public_includes_details_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_recordings_play.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_time_conditions.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_time_conditions_edit.php");
+ unlink_if_exists("/usr/local/www/freeswitch/freeswitch_status.php");
+
+
exec("rm -R /usr/local/freeswitch/");
exec("rm -R /usr/local/www/freeswitch/");
unlink_if_exists("/usr/local/etc/rc.d/freeswitch.sh");
@@ -946,5 +1832,4 @@ function freeswitch_deinstall_command()
}
-
?> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml
index fc3a6c6d..8cb05d0e 100644
--- a/packages/freeswitch/freeswitch.xml
+++ b/packages/freeswitch/freeswitch.xml
@@ -68,7 +68,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -80,19 +80,27 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
@@ -118,26 +126,86 @@
<prefix>/tmp/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_cmd.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_edit.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_play.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions_edit.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr.tmp</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.xml</item>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_edit.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_edit.tmp</item>
</additional_files_needed>
<additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options_edit.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions.xml</item>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_external.xml</item>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways.xml</item>
+ <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_external.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
@@ -173,7 +241,22 @@
<prefix>/usr/local/lib/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/freeswitch/libncurses.so.5.6</item>
- </additional_files_needed>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/please_enter_your_pin_number.wav</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/begin_recording.wav</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/freeswitch/your_pin_number_is_incorect_goodbye.wav</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Numbering Plan</fielddescr>
@@ -228,7 +311,13 @@
<fieldname>xml_rpc_auth_pass</fieldname>
<description>Enter the XML RPC Auth Password here. default: works</description>
<type>input</type>
- </field>
+ </field>
+ <field>
+ <fielddescr>Admin PIN Number</fielddescr>
+ <fieldname>admin_pin</fieldname>
+ <description>Enter a admin pin number. Used to authenticate the admin from the phone.</description>
+ <type>input</type>
+ </field>
</fields>
<custom_add_php_command>
</custom_add_php_command>
diff --git a/packages/freeswitch/freeswitch_dialplan.xml b/packages/freeswitch/freeswitch_dialplan.xml
index 5559c3b6..a4c8b929 100644
--- a/packages/freeswitch/freeswitch_dialplan.xml
+++ b/packages/freeswitch/freeswitch_dialplan.xml
@@ -63,7 +63,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
<active/>
</tab>
<tab>
@@ -76,21 +76,29 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
</tab>
<tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
+ </tab>
+ <tab>
<text>Status</text>
<url>/freeswitch/freeswitch_status.php</url>
</tab>
@@ -125,5 +133,4 @@
<custom_php_resync_config_command>
sync_package_freeswitch_dialplan();
</custom_php_resync_config_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch_dialplan_includes.tmp b/packages/freeswitch/freeswitch_dialplan_includes.tmp
new file mode 100644
index 00000000..c1f582f2
--- /dev/null
+++ b/packages/freeswitch/freeswitch_dialplan_includes.tmp
@@ -0,0 +1,269 @@
+<?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
+ $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;
+ }
+ }
+}
+
+$pgtitle = "FreeSWITCH: Dialplan";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_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("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>Dialplan
+ </strong></span></span>
+ </td>
+ <td align='right'>
+ <input type='button' value='default.xml' onclick="document.location.href='/pkg_edit.php?xml=freeswitch_dialplan.xml&id=0';">
+ </td>
+ </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
+ $i = 0;
+ if (count($a_dialplan_includes) > 0) {
+ foreach ($a_dialplan_includes as $ent) {
+ ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>'">
+ <?=$ent['extensionname']?>
+ </td>
+ <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>'">
+ <?=$ent['order']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>';">
+ <?=$ent['enabled'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td><a href="freeswitch_dialplan_includes.php?type=dialplanincludes&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this 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="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>
+
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_dialplan_includes_details.tmp b/packages/freeswitch/freeswitch_dialplan_includes_details.tmp
new file mode 100644
index 00000000..7b14dae4
--- /dev/null
+++ b/packages/freeswitch/freeswitch_dialplan_includes_details.tmp
@@ -0,0 +1,53 @@
+<?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/packages/freeswitch/freeswitch_dialplan_includes_details_edit.tmp b/packages/freeswitch/freeswitch_dialplan_includes_details_edit.tmp
new file mode 100644
index 00000000..fa6935fb
--- /dev/null
+++ b/packages/freeswitch/freeswitch_dialplan_includes_details_edit.tmp
@@ -0,0 +1,376 @@
+<?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
+ //tagorder
+ //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['tagorder'] = $a_dialplan_includes_details[$id]['tagorder'];
+ $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['tagorder'] = $_POST['tagorder'];
+ $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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Dialplan: Details: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <form action="freeswitch_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 "antiaction":
+ 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">&nbsp;</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/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
new file mode 100644
index 00000000..74b17272
--- /dev/null
+++ b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
@@ -0,0 +1,523 @@
+<?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]) {
+
+ foreach($config['freeswitchdialplanincludes']['config'] 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
+
+ //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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Dialplan: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), true, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</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">&nbsp;</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;
+
+ ?>
+
+
+ <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="20%" class="listhdrr">Tag</td>
+ <td width="20%" class="listhdrr">Type</td>
+ <td width="50%" class="listhdrr">Data</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_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=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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="3"></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="3"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+ </form>
+
+
+
+
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_extensions.xml b/packages/freeswitch/freeswitch_extensions.xml
index 635bf309..e30567f0 100644
--- a/packages/freeswitch/freeswitch_extensions.xml
+++ b/packages/freeswitch/freeswitch_extensions.xml
@@ -62,7 +62,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -75,19 +75,27 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
</tab>
<tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
+ <tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
@@ -191,5 +199,4 @@
</custom_delete_php_command>
<custom_php_deinstall_command>
</custom_php_deinstall_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch_external.xml b/packages/freeswitch/freeswitch_external.xml
index 9e4a733d..4b9fd5bd 100644
--- a/packages/freeswitch/freeswitch_external.xml
+++ b/packages/freeswitch/freeswitch_external.xml
@@ -63,7 +63,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -76,19 +76,27 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
</tab>
<tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
+ <tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
@@ -125,5 +133,4 @@
<custom_php_resync_config_command>
sync_package_freeswitch_external();
</custom_php_resync_config_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch_gateways.tmp b/packages/freeswitch/freeswitch_gateways.tmp
new file mode 100644
index 00000000..9956ae60
--- /dev/null
+++ b/packages/freeswitch/freeswitch_gateways.tmp
@@ -0,0 +1,211 @@
+<?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']]) {
+ unset($a_gateways[$_GET['id']]);
+ write_config();
+ header("Location: freeswitch_gateways.php");
+ exit;
+ }
+ }
+}
+
+$pgtitle = "FreeSWITCH: Gateways";
+include("head.inc");
+
+?>
+
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), true, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_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
+
+ $i = 0;
+ if (count($a_gateways) > 0) {
+
+ foreach ($a_gateways as $ent) {
+
+ ?>
+ <tr>
+ <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';">
+ <?=$ent['gateway'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';">
+ <?=$ent['context'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';">
+ <?=$ent['enabled'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="freeswitch_gateways_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td><a href="freeswitch_gateways.php?type=gateways&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this 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="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>
diff --git a/packages/freeswitch/freeswitch_gateways_edit.tmp b/packages/freeswitch/freeswitch_gateways_edit.tmp
new file mode 100644
index 00000000..bdd4f2c3
--- /dev/null
+++ b/packages/freeswitch/freeswitch_gateways_edit.tmp
@@ -0,0 +1,565 @@
+<?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['password'] = $a_gateways[$id]['password'];
+ $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['context'] = $a_gateways[$id]['context'];
+ $pconfig['caller-id-in-from'] = $a_gateways[$id]['caller-id-in-from'];
+ $pconfig['supress-cng'] = $a_gateways[$id]['supress-cng'];
+ $pconfig['enabled'] = $a_gateways[$id]['enabled'];
+ $pconfig['description'] = $a_gateways[$id]['description'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+
+ if (!$input_errors) {
+
+ $ent = array();
+ if (strlen($_POST['ivrid']) > 0) {
+ $ent['gatewayid'] = $_POST['ivrid'];
+ }
+ else {
+ $ent['gatewayid'] = guid();
+ }
+ $ent['gateway'] = $_POST['gateway'];
+ $ent['username'] = $_POST['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['context'] = $_POST['context'];
+ $ent['caller-id-in-from'] = $_POST['caller-id-in-from'];
+ $ent['supress-cng'] = $_POST['supress-cng'];
+ $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 "^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;
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
+
+ $ent = array();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['tag'] = 'action'; //condition, action, antiaction
+ $ent['fieldtype'] = 'bridge';
+ $ent['fielddata'] = $action_data;
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
+
+ unset($label);
+ unset($abbrv);
+ unset($dialplan_expression);
+ unset($action_data);
+ } //if strlen
+ } //end for each
+ }
+
+ write_config();
+ sync_package_freeswitch_gateways();
+
+ header("Location: freeswitch_gateways.php");
+ exit;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Gateways: Edit";
+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"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), true, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</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="text" 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="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">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";
+ break;
+ case "tcp":
+ echo " <option value='udp'>udp</option>\n";
+ echo " <option value='tcp' selected='yes'>tcp</option>\n";
+
+ break;
+ default:
+ echo " <option value='udp'>udp</option>\n";
+ echo " <option value='tcp'>tcp</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">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='^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>
+
+ </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">&nbsp;</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/packages/freeswitch/freeswitch_internal.xml b/packages/freeswitch/freeswitch_internal.xml
index 12d828a5..f97e4d8c 100644
--- a/packages/freeswitch/freeswitch_internal.xml
+++ b/packages/freeswitch/freeswitch_internal.xml
@@ -63,7 +63,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -75,20 +75,28 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
<active/>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
@@ -125,5 +133,4 @@
<custom_php_resync_config_command>
sync_package_freeswitch_internal();
</custom_php_resync_config_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch_ivr.tmp b/packages/freeswitch/freeswitch_ivr.tmp
new file mode 100644
index 00000000..89496a70
--- /dev/null
+++ b/packages/freeswitch/freeswitch_ivr.tmp
@@ -0,0 +1,217 @@
+<?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']]) {
+ unset($a_ivr[$_GET['id']]);
+ write_config();
+ sync_package_freeswitch_ivr();
+ header("Location: freeswitch_ivr.php");
+ exit;
+ }
+ }
+}
+
+$pgtitle = "FreeSWITCH: IVR";
+include("head.inc");
+
+?>
+
+
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_ivr.php" method="post" name="iform" id="iform">
+<?php
+
+
+//echo "<pre>";
+//print_r ($a_ivr);
+//echo "</pre>";
+
+//build a list of recordings from the config.xml
+//$config_recording_list = '';
+//$i = 0;
+//if (count($a_ivr) > 0) {
+// foreach ($a_ivr as $ivrent) {
+// $config_recording_list .= $ivrent['filename']."|";
+// $i++;
+// }
+//}
+//echo "config recording list: ".$config_recording_list."<br />\n";
+
+
+//if ($config_change == 1) {
+// write_config();
+// $config_change = 0;
+//}
+
+//if ($savemsg) print_info_box($savemsg);
+//if (file_exists($d_hostsdirty_path)): echo"<p>";
+//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
+//echo"<br />";
+//endif;
+
+?>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <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) {
+ ?>
+ <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'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['ivrdescr']);?>&nbsp;
+ </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;?>" 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="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>
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_ivr_edit.tmp b/packages/freeswitch/freeswitch_ivr_edit.tmp
new file mode 100644
index 00000000..a196e931
--- /dev/null
+++ b/packages/freeswitch/freeswitch_ivr_edit.tmp
@@ -0,0 +1,577 @@
+<?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 = &$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['ivrcontext'] = $a_ivr[$id]['ivrcontext'];
+ $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();
+ //touch($d_hostsdirty_path);
+ 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['ivrcontext'] = $_POST['ivrcontext'];
+ $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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: IVR: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</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>5001</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>
+ <!-- reserved for future use -->
+ <!--
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Timeout</td>
+ <td width="78%" class="vtable">
+ <input name="ivrtimeout" type="text" class="formfld" id="ivrtimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrtimeout']);?>">
+ </td>
+ </tr>
+ -->
+ <tr>
+ <td width="22%" valign="top" class="vncell">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="vncell">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="vncell">Javascript Condition</td>
+ <td width="78%" class="vtable">
+ <?php
+ if (strlen(htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))) == 0) {
+ echo "<textarea name=\"ivrconditionjs\" cols=\"50\" rows=\"7\" wrap=\"off\">".$ivrconditionjs."</textarea>\n";
+ }
+ else {
+ echo "<textarea name=\"ivrconditionjs\" cols=\"50\" rows=\"7\" wrap=\"off\">".htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))."</textarea>\n";
+ }
+ ?>
+ <br> <span class="vexpl">A simple valid condition is:
+ condition=true; To re-populate the default simply empty the
+ textarea and click on save. The following javascript variables
+ have been defined: Hours, Mins, Seconds, Month, Date, Year,
+ and Day.</span></td>
+ </tr>
+
+
+ <tr>
+ <td width="22%" valign="top">&nbsp;</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="20%" class="listhdrr">Option</td>
+ <td width="25%" class="listhdrr">Type</td>
+ <td width="25%" class="listhdrr">Destination</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_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&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_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'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
+ <?=$ent['optiondest'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
+ </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="4"></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?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&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>
+
+
+
+ <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="20%" class="listhdrr">Option</td>
+ <td width="25%" class="listhdrr">Type</td>
+ <td width="25%" class="listhdrr">Destination</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_options_edit.php?id=<?=$id;?>&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>
+
+ <?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'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
+ <?=$ent['optiondest'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
+ </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="4"></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?id=<?=$id;?>&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="4"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+ </form>
+
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_ivr_options.tmp b/packages/freeswitch/freeswitch_ivr_options.tmp
new file mode 100644
index 00000000..8356bc58
--- /dev/null
+++ b/packages/freeswitch/freeswitch_ivr_options.tmp
@@ -0,0 +1,52 @@
+<?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/packages/freeswitch/freeswitch_ivr_options_edit.tmp b/packages/freeswitch/freeswitch_ivr_options_edit.tmp
new file mode 100644
index 00000000..5ffd94e2
--- /dev/null
+++ b/packages/freeswitch/freeswitch_ivr_options_edit.tmp
@@ -0,0 +1,217 @@
+<?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['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['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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: IVR: Options: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <form action="freeswitch_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">&nbsp;</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/packages/freeswitch/freeswitch_modules.xml b/packages/freeswitch/freeswitch_modules.xml
index cad927fd..76f51b14 100644
--- a/packages/freeswitch/freeswitch_modules.xml
+++ b/packages/freeswitch/freeswitch_modules.xml
@@ -74,7 +74,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -86,12 +86,16 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
@@ -99,7 +103,11 @@
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
diff --git a/packages/freeswitch/freeswitch_public.xml b/packages/freeswitch/freeswitch_public.xml
index 21e01812..afd7590f 100644
--- a/packages/freeswitch/freeswitch_public.xml
+++ b/packages/freeswitch/freeswitch_public.xml
@@ -62,7 +62,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -74,22 +74,30 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
<active/>
</tab>
<tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
+ </tab>
+ <tab>
<text>Status</text>
<url>/freeswitch/freeswitch_status.php</url>
</tab>
@@ -124,5 +132,4 @@
<custom_php_resync_config_command>
sync_package_freeswitch_public();
</custom_php_resync_config_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/freeswitch_public_includes.tmp b/packages/freeswitch/freeswitch_public_includes.tmp
new file mode 100644
index 00000000..2bd97da1
--- /dev/null
+++ b/packages/freeswitch/freeswitch_public_includes.tmp
@@ -0,0 +1,272 @@
+<?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
+ $i=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/public/default/".$publicincludefilename)) {
+ unlink("/usr/local/freeswitch/conf/public/default/".$publicincludefilename);
+ }
+
+ unset($publicincludefilename);
+ unset($a_public_includes[$_GET['id']]);
+ write_config();
+ sync_package_freeswitch_public_includes();
+ header("Location: freeswitch_public_includes.php");
+ exit;
+ }
+ }
+}
+
+$pgtitle = "FreeSWITCH: Public";
+include("head.inc");
+
+?>
+
+
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_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='deprecated xml' alt='deprecated' onclick="document.location.href='/pkg_edit.php?xml=freeswitch_public.xml&id=0';">
+ </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
+ $i = 0;
+ if (count($a_public_includes) > 0) {
+ foreach ($a_public_includes as $ent) {
+ ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>'">
+ <?=$ent['extensionname']?>
+ </td>
+ <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>'">
+ <?=$ent['order']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>';">
+ <?=$ent['enabled'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="freeswitch_public_includes_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td><a href="freeswitch_public_includes.php?type=publicincludes&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this 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="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>
+
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_public_includes_details.tmp b/packages/freeswitch/freeswitch_public_includes_details.tmp
new file mode 100644
index 00000000..c28a7647
--- /dev/null
+++ b/packages/freeswitch/freeswitch_public_includes_details.tmp
@@ -0,0 +1,53 @@
+<?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/packages/freeswitch/freeswitch_public_includes_details_edit.tmp b/packages/freeswitch/freeswitch_public_includes_details_edit.tmp
new file mode 100644
index 00000000..0350fdd4
--- /dev/null
+++ b/packages/freeswitch/freeswitch_public_includes_details_edit.tmp
@@ -0,0 +1,411 @@
+<?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
+ //tagorder
+ //1-20
+ //fieldtype
+
+ //fielddata
+
+
+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['tagorder'] = $a_public_includes_details[$id]['tagorder'];
+ $pconfig['fieldtype'] = $a_public_includes_details[$id]['fieldtype'];
+ $pconfig['fielddata'] = $a_public_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['publicincludeid'] = $_POST['publicincludeid'];
+ $ent['tag'] = $_POST['tag'];
+ //$ent['tagorder'] = $_POST['tagorder'];
+ $ent['fieldtype'] = $_POST['fieldtype'];
+ $ent['fielddata'] = $_POST['fielddata'];
+
+
+ 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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Public: Details: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <form action="freeswitch_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 "antiaction":
+ 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">&nbsp;</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/packages/freeswitch/freeswitch_public_includes_edit.tmp b/packages/freeswitch/freeswitch_public_includes_edit.tmp
new file mode 100644
index 00000000..c7301db6
--- /dev/null
+++ b/packages/freeswitch/freeswitch_public_includes_edit.tmp
@@ -0,0 +1,523 @@
+<?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]) {
+
+ foreach($config['installedpackages']['freeswitchpublicincludes']['config'] 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
+
+ //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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Public: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), true, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</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">&nbsp;</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;
+
+ ?>
+
+
+ <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="20%" class="listhdrr">Tag</td>
+ <td width="20%" class="listhdrr">Type</td>
+ <td width="50%" class="listhdrr">Data</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_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=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
+ <?=$ent['tag']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fieldtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
+ <?=$ent['fielddata'];?>&nbsp;
+ </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=<?=$i;?>&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=<?=$i;?>&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="3"></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="3"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+ </form>
+
+
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_recordings.tmp b/packages/freeswitch/freeswitch_recordings.tmp
new file mode 100644
index 00000000..53c285fe
--- /dev/null
+++ b/packages/freeswitch/freeswitch_recordings.tmp
@@ -0,0 +1,315 @@
+<?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");
+
+$recording_dir = '/usr/local/freeswitch/recordings/';
+
+if (($_GET['a'] == "download") && file_exists($recording_dir.$_GET['filename'])) {
+ session_cache_limiter('public');
+ $fd = fopen($recording_dir.$_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 {
+ header("Content-Type: audio/x-wav");
+ }
+ 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($recording_dir.$_GET['filename']));
+ fpassthru($fd);
+ exit;
+}
+else {
+ //echo $recording_dir.$_GET['filename'];
+}
+
+
+$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
+
+
+if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'recordings') {
+ if ($a_recordings[$_GET['id']]) {
+ unlink('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']);
+ unset($a_recordings[$_GET['id']]);
+ write_config();
+ header("Location: freeswitch_recordings.php");
+ exit;
+ }
+ }
+}
+
+$pgtitle = "FreeSWITCH: Recordings";
+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"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), true, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_recordings.php" method="post" name="iform" id="iform">
+<?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($recording_dir)) {
+ if ($dh = opendir($recording_dir)) {
+ while (($file = readdir($dh)) !== false) {
+ if (filetype($recording_dir . $file) == "file") {
+
+ if (strpos($config_recording_list, $file) === false) {
+
+ //$handle = fopen($recording_dir.$file,'rb');
+ //$file_content = fread($handle,filesize($recording_dir.$file));
+ //fclose($handle);
+
+ $a_file = split("\.", $file);
+
+ $recordingent = array();
+ $recordingent['filename'] = $file;
+ $recordingent['recordingname'] = $a_file[0];
+ //$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);
+ }
+}
+
+
+
+
+$i = 0;
+foreach ($a_recordings as $recordingent) {
+
+ if (!is_file($recording_dir.$recordingent['filename'])) {
+ //echo "not found: ".$recordingent['filename']."<br />";
+
+ //recording not found restore the file from the config.xml
+ $file_content = $recordingent['filecontent'];
+ $handle = fopen($recording_dir.$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>Note:<br>
+ </strong></span>
+ To make a recording dial extension 732673 (record) or you can make a
+ 16bit 8khz/16khz Mono WAV file then copy it to the
+ following directory then refresh the page to play it back.
+ Click on the 'Filename' to download it or the 'Recording Name' to
+ play the audio.
+ <br>
+ <br>
+ /usr/local/freeswitch/recordings/
+ </span></p></td>
+ </tr>
+ </table>
+ <br />
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr">Filename (download)</td>
+ <td width="25%" class="listhdrr">Recording Name (play)</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_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; foreach ($a_recordings as $recordingent): ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>'">
+ <a href="freeswitch_recordings.php?a=download&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&t=wav&filename=<?=$recordingent['filename'];?>', 'play',' width=300,height=40,menubar=no,status=no,toolbar=no')">
+ <?=$recordingent['recordingname'];?>&nbsp;
+ </a>
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?>&nbsp;
+ </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=recordings&act=del&id=<?=$i;?>" 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++; 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_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>
+
+</form>
+
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_recordings_edit.tmp b/packages/freeswitch/freeswitch_recordings_edit.tmp
new file mode 100644
index 00000000..309d0ae9
--- /dev/null
+++ b/packages/freeswitch/freeswitch_recordings_edit.tmp
@@ -0,0 +1,187 @@
+<?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['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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: Recordings: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), true, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <form action="freeswitch_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">&nbsp;</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/packages/freeswitch/freeswitch_recordings_play.tmp b/packages/freeswitch/freeswitch_recordings_play.tmp
new file mode 100644
index 00000000..aa837c58
--- /dev/null
+++ b/packages/freeswitch/freeswitch_recordings_play.tmp
@@ -0,0 +1,54 @@
+<?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'];
+
+?>
+<html>
+<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'>
+ <embed src="freeswitch_recordings.php?a=download&filename=<?=$filename;?>" autostart=true width=200 height=40 name="sound<?=$$filename;?>" enablejavascript="true">
+ </td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/packages/freeswitch/freeswitch_status.tmp b/packages/freeswitch/freeswitch_status.tmp
index af97cb3e..91fe2852 100644
--- a/packages/freeswitch/freeswitch_status.tmp
+++ b/packages/freeswitch/freeswitch_status.tmp
@@ -32,77 +32,28 @@
*/
require("guiconfig.inc");
+require("/usr/local/pkg/freeswitch.inc");
-function event_socket_create($host, $port, $password) {
- $fp = fsockopen($host, $port, $errno, $errdesc)
- or die("Connection to $host failed");
- socket_set_blocking($fp,false);
-
- if ($fp) {
- 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;
- }
- else {
- return false;
- }
+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';
+ }
+ 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;
}
-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";
- }
-}
-
-
-
include("head.inc");
$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
@@ -127,13 +78,15 @@ if ($savemsg) {
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
- $tab_array[] = array(gettext("Dialplan"), false, "/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
$tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
$tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
- $tab_array[] = array(gettext("Gateways"), false, "/pkg.php?xml=freeswitch_gateways.xml");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
$tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
$tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
- $tab_array[] = array(gettext("Public"), false, "/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
$tab_array[] = array(gettext("Status"), true, "/freeswitch/freeswitch_status.php");
$tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
display_top_tabs($tab_array);
@@ -149,6 +102,7 @@ if ($savemsg) {
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status";
$response = event_socket_request($fp, $cmd);
@@ -168,6 +122,7 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status profile internal";
$response = event_socket_request($fp, $cmd);
@@ -189,6 +144,7 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status profile external";
$response = event_socket_request($fp, $cmd);
@@ -211,6 +167,7 @@ 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);
@@ -221,32 +178,87 @@ 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";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-/*
-$response = "<table border='0'><tr><td>".$response;
-$response = str_replace("\n", "</td></tr>\n<tr><td>", $response);
-$response = str_replace(",", "</td><td>", $response);
-$response = $response."</td></tr>\n<table>\n";
-echo $response;
-*/
+echo "<b>show channels</b>\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";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
+echo "<b>show calls</b>\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='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='/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='/freeswitch/freeswitch_status.php?a=download&t=logs';\" />\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<br /><br />\n\n";
+
+
+echo "<b>tail -n 100 /usr/local/freeswitch/log/freeswitch.log</b><br />\n";
+echo "<textarea cols='85' rows='30' wrap='off'>\n";
+echo system("tail -n 100 /usr/local/freeswitch/log/freeswitch.log");
+echo "</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";
?>
@@ -256,6 +268,6 @@ echo "<br /><br />\n\n";
</div>
<?php include("fend.inc"); ?>
-<meta http-equiv="refresh" content="60;url=<?php print $_SERVER['SCRIPT_NAME']; ?>">
+
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/packages/freeswitch/freeswitch_time_conditions.tmp b/packages/freeswitch/freeswitch_time_conditions.tmp
new file mode 100644
index 00000000..f876be95
--- /dev/null
+++ b/packages/freeswitch/freeswitch_time_conditions.tmp
@@ -0,0 +1,196 @@
+<?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;
+ }
+ }
+}
+
+
+$pgtitle = "FreeSWITCH: IVR: Options";
+include("head.inc");
+
+?>
+
+
+
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="freeswitch_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'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?>&nbsp;
+ </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 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++; 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/packages/freeswitch/freeswitch_time_conditions_edit.tmp b/packages/freeswitch/freeswitch_time_conditions_edit.tmp
new file mode 100644
index 00000000..63f66b09
--- /dev/null
+++ b/packages/freeswitch/freeswitch_time_conditions_edit.tmp
@@ -0,0 +1,226 @@
+<?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;
+
+ /* check for overlaps */
+ //foreach ($a_recordings as $recordingent) {
+ // if (isset($id) && ($a_recordings[$id]) && ($a_recordings[$id] === $recordingent))
+ // continue;
+
+ // if (($recordingent['filename'] == $_POST['filename']) && ($recordingent['recordingname'] == $_POST['recordingname'])) {
+ // $input_errors[] = "This filename and recording name already exists.";
+ // break;
+ // }
+ //}
+
+ 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;
+ }
+}
+
+$pgtitle = "FreeSWITCH: IVR: Options: Edit";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?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
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
+ $tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
+ $tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
+ $tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), true, "/freeswitch/freeswitch_ivr.php");
+ $tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
+ $tab_array[] = array(gettext("Status"), false, "/freeswitch/freeswitch_status.php");
+ $tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <form action="freeswitch_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">&nbsp;</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/packages/freeswitch/freeswitch_vars.xml b/packages/freeswitch/freeswitch_vars.xml
index 47f97401..3efd6241 100644
--- a/packages/freeswitch/freeswitch_vars.xml
+++ b/packages/freeswitch/freeswitch_vars.xml
@@ -63,7 +63,7 @@
</tab>
<tab>
<text>Dialplan</text>
- <url>/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_dialplan_includes.php</url>
</tab>
<tab>
<text>Extensions</text>
@@ -75,19 +75,27 @@
</tab>
<tab>
<text>Gateways</text>
- <url>/pkg.php?xml=freeswitch_gateways.xml</url>
+ <url>/freeswitch/freeswitch_gateways.php</url>
</tab>
<tab>
<text>Internal</text>
<url>/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0</url>
- </tab>
+ </tab>
+ <tab>
+ <text>IVR</text>
+ <url>/freeswitch/freeswitch_ivr.php</url>
+ </tab>
<tab>
<text>Modules</text>
<url>/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0</url>
</tab>
<tab>
<text>Public</text>
- <url>/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0</url>
+ <url>/freeswitch/freeswitch_public_includes.php</url>
+ </tab>
+ <tab>
+ <text>Rec</text>
+ <url>/freeswitch/freeswitch_recordings.php</url>
</tab>
<tab>
<text>Status</text>
@@ -125,5 +133,4 @@
<custom_php_resync_config_command>
sync_package_freeswitch_vars();
</custom_php_resync_config_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file
diff --git a/packages/freeswitch/please_enter_your_pin_number.wav b/packages/freeswitch/please_enter_your_pin_number.wav
new file mode 100644
index 00000000..46263917
--- /dev/null
+++ b/packages/freeswitch/please_enter_your_pin_number.wav
Binary files differ
diff --git a/packages/freeswitch/your_pin_number_is_incorect_goodbye.wav b/packages/freeswitch/your_pin_number_is_incorect_goodbye.wav
new file mode 100644
index 00000000..5683bb8e
--- /dev/null
+++ b/packages/freeswitch/your_pin_number_is_incorect_goodbye.wav
Binary files differ
diff --git a/pkg_config.7.xml b/pkg_config.7.xml
index 737d6ab1..506481be 100644
--- a/pkg_config.7.xml
+++ b/pkg_config.7.xml
@@ -46,7 +46,7 @@
<category>Services</category>
<config_file>http://www.pfsense.com/packages/config/freeswitch/freeswitch.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url>
- <version>0.2.4</version>
+ <version>0.3</version>
<status>Beta</status>
<required_version>1.2.1</required_version>
<maintainer>markjcrane@gmail.com</maintainer>