aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorMark Crane <mcrane@pfsense.org>2008-12-06 20:37:47 +0000
committerMark Crane <mcrane@pfsense.org>2008-12-06 20:37:47 +0000
commit93ffc598a13083537270b701c6d1b94e8434ce4d (patch)
tree774154ced423b46a0411f9b2e9c7e599b383b350 /packages
parentbee461d20120b86962980f0e441e9c42e6682d90 (diff)
downloadpfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.tar.gz
pfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.tar.bz2
pfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.zip
FreeSWITCH package check array size and tab adjustments
Diffstat (limited to 'packages')
-rw-r--r--packages/freeswitch/freeswitch.inc1062
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes_edit.tmp97
-rw-r--r--packages/freeswitch/freeswitch_gateways_edit.tmp170
-rw-r--r--packages/freeswitch/freeswitch_ivr_edit.tmp16
-rw-r--r--packages/freeswitch/freeswitch_ivr_options_edit.tmp6
-rw-r--r--packages/freeswitch/freeswitch_public_includes.tmp14
-rw-r--r--packages/freeswitch/freeswitch_public_includes_details_edit.tmp6
-rw-r--r--packages/freeswitch/freeswitch_public_includes_edit.tmp100
-rw-r--r--packages/freeswitch/freeswitch_recordings.tmp61
-rw-r--r--packages/freeswitch/freeswitch_recordings_edit.tmp31
-rw-r--r--packages/freeswitch/freeswitch_time_conditions_edit.tmp6
11 files changed, 788 insertions, 781 deletions
diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc
index 7560ce04..227e7f2d 100644
--- a/packages/freeswitch/freeswitch.inc
+++ b/packages/freeswitch/freeswitch.inc
@@ -752,10 +752,13 @@ function sync_package_freeswitch_external()
function get_recording_filename($id) {
- global $config;
- foreach($config['installedpackages']['freeswitchrecordings']['config'] as $rowhelper) {
- if ($rowhelper['recordingid'] == $id) {
- return $rowhelper['filename'];
+ $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
+ if (count($a_recordings) > 0) {
+ global $config;
+ foreach($a_recordings as $rowhelper) {
+ if ($rowhelper['recordingid'] == $id) {
+ return $rowhelper['filename'];
+ }
}
}
}
@@ -767,443 +770,439 @@ function sync_package_freeswitch_ivr() {
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
-
+ $a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
+ if (count($a_ivr) > 0) {
+ foreach($a_ivr as $rowhelper) {
+
+ /*
+ $rowhelper['ivrid']
+ $rowhelper['ivrextension']
+ $rowhelper['ivrname']
+ $rowhelper['recordingid']
+ $rowhelper['ivrtimeout']
+ $rowhelper['ivrcontext']
+ $rowhelper['ivrconditionjs']
+ $rowhelper['ivrdescr']
+ */
+
+ $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
+ $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
+
+
+ //add the IVR to the dialplan
+
+ $action = 'add'; //set default action to add
+ $i = 0;
+ if (count($a_dialplan_includes) > 0) {
+ foreach($a_dialplan_includes as $row) {
+
+ //$row['dialplanincludeid'];
+ //$row['extensionname'];
+ //$row['context'];
+ //$row['enabled'];
+ //echo "if (".$row['opt1name']." == \"ivrid\" && ".$row['opt1value']." == ".$rowhelper['ivrid'].") {\n";
+
+ if ($row['opt1name'] == "ivrid" && $row['opt1value'] == $rowhelper['ivrid']) {
+ //update
+ $action = 'update';
+ $dialplanincludeid = $row['dialplanincludeid'];
+ $extensionname = $row['extensionname'];
+ $order = $row['order'];
+ $context = $row['context'];
+ $enabled = $row['enabled'];
+ $descr = $row['descr'];
+ $opt1name = $row['opt1name'];
+ $opt1value = $row['opt1value'];
+ $id = $i;
+ //echo "update".$i."<br />\n";
+
+ }
+ $i++;
+
+ }
+ }
+
+
+ $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";
+
+
+ //action
+ $tmpaction = "";
+
+ $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
+ $x = 0;
+ $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
+ if (count($a_ivr_options) > 0) {
+ foreach($a_ivr_options as $row) {
+
+ /*
+ $row['ivrid']
+ $row['optionnumber']
+ $row['optiontype']
+ $row['optionaction']
+ $row['optiondest']
+ $row['optiondescr']
+ */
+
+ $tmpactiondefault = "";
+
+ //find the correct IVR options with the correct action
+ if ($row['ivrid'] == $rowhelper['ivrid']){
+
+ if ($row['optionaction'] == "action") {
+ //$tmpaction .= "\n";
+
+ switch ($row['optionnumber']) {
+ case "t":
+
+ 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
+ } //end if count
+
+ $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
+ } //end if count
conf_mount_ro();
- config_unlock();
+ config_unlock();
} //end function
@@ -1308,101 +1307,102 @@ function sync_package_freeswitch_public_includes() {
conf_mount_rw();
config_lock();
- $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
+ $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
-
+ if (count($a_public_includes) > 0) {
+ foreach($a_public_includes as $rowhelper) {
+ $tmp = "";
+ $tmp .= "\n";
+
+ //$rowhelper['publicincludeid'];
+ //$rowhelper['extensionname'];
+ //$rowhelper['context'];
+ //$rowhelper['enabled'];
+
+ $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
+
+ if (count($a_public_include_details) > 0) {
+ $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
+ } //end if count
conf_mount_ro();
- config_unlock();
+ config_unlock();
}
function sync_package_freeswitch()
{
- global $config;
+ global $config;
sync_package_freeswitch_settings();
sync_package_freeswitch_dialplan();
- sync_package_freeswitch_extensions();
- sync_package_freeswitch_gateways();
+ sync_package_freeswitch_extensions();
+ sync_package_freeswitch_gateways();
sync_package_freeswitch_modules();
sync_package_freeswitch_public();
sync_package_freeswitch_vars();
@@ -1420,8 +1420,8 @@ function freeswitch_php_install_command()
global $config;
conf_mount_rw();
config_lock();
-
- if (!is_dir('/usr/local/www/freeswitch/')) {
+
+ if (!is_dir('/usr/local/www/freeswitch/')) {
exec("mkdir /usr/local/www/freeswitch/");
}
@@ -1772,13 +1772,13 @@ function freeswitch_php_install_command()
exec("rm -R /freeswitch");
- sync_package_freeswitch();
- $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r");
- pclose($handle);
+ sync_package_freeswitch();
+ $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r");
+ pclose($handle);
$config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 9759.";
$config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.3";
- conf_mount_ro();
+ conf_mount_ro();
config_unlock();
}
@@ -1816,7 +1816,7 @@ function freeswitch_deinstall_command() {
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_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");
diff --git a/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
index 74b17272..93c40082 100644
--- a/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
+++ b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
@@ -60,13 +60,13 @@ $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['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'];
+ $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name'];
+ $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value'];
}
if ($_POST) {
@@ -96,59 +96,62 @@ if ($_POST) {
}
else {
//add
- $ent['dialplanincludeid'] = guid();
- }
+ $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['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;
+
+ $a_dialplan_includes = $config['freeswitchdialplanincludes']['config'];
+ if (count($a_dialplan_includes)>0) {
+ foreach($a_dialplan_includes as $rowhelper) {
+
+ //$rowhelper['dialplanincludeid'];
+ //$rowhelper['extensionname'];
+ //$rowhelper['context'];
+ //$rowhelper['enabled'];
+
+ $filenamechanged = false;
+ if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) {
+
+ if ($rowhelper['extensionname'] != $_POST['extensionname']) {
+ //if the extension name has changed then remove the current dialplan xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($rowhelper['order'] != $_POST['order']) {
+ //if the order has changed then remove the current dialplan xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($_POST['enabled'] == "false") {
+ //if the extension name is disabled then remove the dialplan xml file
+ $filenamechanged = true;
+ }
+ if ($filenamechanged){
+ $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
+ if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) {
+ unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename);
+ }
+ unset($dialplanincludefilename);
+ }
+
+ }
+ unset($filenamechanged);
+
+ } //end foreach
+ } //end count
+
+ //update the config
+ $a_dialplan_includes[$id] = $ent;
}
else {
//add to the config
diff --git a/packages/freeswitch/freeswitch_gateways_edit.tmp b/packages/freeswitch/freeswitch_gateways_edit.tmp
index bdd4f2c3..c13269a6 100644
--- a/packages/freeswitch/freeswitch_gateways_edit.tmp
+++ b/packages/freeswitch/freeswitch_gateways_edit.tmp
@@ -99,11 +99,11 @@ if ($_POST) {
if (isset($id) && $a_gateways[$id]) {
- //update
- $a_gateways[$id] = $ent;
+ //update
+ $a_gateways[$id] = $ent;
}
else {
- //add
+ //add
$a_gateways[] = $ent;
}
@@ -115,94 +115,94 @@ if ($_POST) {
$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'];
+ $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
+ $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();
diff --git a/packages/freeswitch/freeswitch_ivr_edit.tmp b/packages/freeswitch/freeswitch_ivr_edit.tmp
index a196e931..6eaf8216 100644
--- a/packages/freeswitch/freeswitch_ivr_edit.tmp
+++ b/packages/freeswitch/freeswitch_ivr_edit.tmp
@@ -127,7 +127,7 @@ $parentid = $id;
if (isset($id) && $a_ivr[$id]) {
$pconfig['ivrid'] = $a_ivr[$id]['ivrid'];
$ivrid = $a_ivr[$id]['ivrid'];
- $pconfig['ivrextension'] = $a_ivr[$id]['ivrextension'];
+ $pconfig['ivrextension'] = $a_ivr[$id]['ivrextension'];
$pconfig['ivrname'] = $a_ivr[$id]['ivrname'];
$pconfig['recordingidaction'] = $a_ivr[$id]['recordingidaction'];
$pconfig['recordingidantiaction'] = $a_ivr[$id]['recordingidantiaction'];
@@ -161,26 +161,26 @@ if ($_POST) {
$ivrent = array();
if (strlen($_POST['ivrid']) > 0) {
- $ivrent['ivrid'] = $_POST['ivrid'];
+ $ivrent['ivrid'] = $_POST['ivrid'];
}
else {
- $ivrent['ivrid'] = guid();
- }
+ $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['ivrconditionjs'] = base64_encode($_POST['ivrconditionjs']);
$ivrent['ivrdescr'] = $_POST['ivrdescr'];
if (isset($id) && $a_ivr[$id]) {
- //update
- $a_ivr[$id] = $ivrent;
+ //update
+ $a_ivr[$id] = $ivrent;
}
else {
- //add
+ //add
$a_ivr[] = $ivrent;
}
diff --git a/packages/freeswitch/freeswitch_ivr_options_edit.tmp b/packages/freeswitch/freeswitch_ivr_options_edit.tmp
index 5ffd94e2..a7bb3e8d 100644
--- a/packages/freeswitch/freeswitch_ivr_options_edit.tmp
+++ b/packages/freeswitch/freeswitch_ivr_options_edit.tmp
@@ -85,11 +85,11 @@ if ($_POST) {
$ivroptionent['optiondescr'] = $_POST['optiondescr'];
if (isset($id) && $a_ivr_options[$id]) {
- //update
- $a_ivr_options[$id] = $ivroptionent;
+ //update
+ $a_ivr_options[$id] = $ivroptionent;
}
else {
- //add
+ //add
$a_ivr_options[] = $ivroptionent;
}
diff --git a/packages/freeswitch/freeswitch_public_includes.tmp b/packages/freeswitch/freeswitch_public_includes.tmp
index 2bd97da1..8b2586fc 100644
--- a/packages/freeswitch/freeswitch_public_includes.tmp
+++ b/packages/freeswitch/freeswitch_public_includes.tmp
@@ -74,12 +74,14 @@ if ($_GET['act'] == "del") {
//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 (count($a_public_includes_details) > 0) {
+ foreach($a_public_includes_details as $row) {
+ if ($row["publicincludeid"] == $publicincludeid) {
+ //echo "child id: ".$i."<br />\n";
+ unset($a_public_includes_details[$i]);
+ }
+ $i++;
+ }
}
//if the public include xml file exists then delete it
diff --git a/packages/freeswitch/freeswitch_public_includes_details_edit.tmp b/packages/freeswitch/freeswitch_public_includes_details_edit.tmp
index 0350fdd4..8a6d8c2d 100644
--- a/packages/freeswitch/freeswitch_public_includes_details_edit.tmp
+++ b/packages/freeswitch/freeswitch_public_includes_details_edit.tmp
@@ -99,11 +99,11 @@ if ($_POST) {
if (isset($id) && $a_public_includes_details[$id]) {
- //update
- $a_public_includes_details[$id] = $ent;
+ //update
+ $a_public_includes_details[$id] = $ent;
}
else {
- //add
+ //add
$a_public_includes_details[] = $ent;
}
diff --git a/packages/freeswitch/freeswitch_public_includes_edit.tmp b/packages/freeswitch/freeswitch_public_includes_edit.tmp
index c7301db6..7c5b2158 100644
--- a/packages/freeswitch/freeswitch_public_includes_edit.tmp
+++ b/packages/freeswitch/freeswitch_public_includes_edit.tmp
@@ -62,13 +62,13 @@ $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['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'];
+ $pconfig['opt1name'] = $a_public_includes[$id]['opt1name'];
+ $pconfig['opt1value'] = $a_public_includes[$id]['opt1value'];
}
if ($_POST) {
@@ -94,64 +94,66 @@ if ($_POST) {
$ent = array();
if (strlen($_POST['publicincludeid']) > 0) {
//update
- $ent['publicincludeid'] = $_POST['publicincludeid'];
+ $ent['publicincludeid'] = $_POST['publicincludeid'];
}
else {
- //add
- $ent['publicincludeid'] = guid();
- }
+ //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['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;
+ $a_public_includes = $config['installedpackages']['freeswitchpublicincludes']['config'];
+ if (count($a_public_includes) > 0) {
+ foreach($a_public_includes as $rowhelper) {
+
+ //$rowhelper['publicincludeid'];
+ //$rowhelper['extensionname'];
+ //$rowhelper['context'];
+ //$rowhelper['enabled'];
+
+ $filenamechanged = false;
+ if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) {
+
+ if ($rowhelper['extensionname'] != $_POST['extensionname']) {
+ //if the extension name has changed then remove the current public xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($rowhelper['order'] != $_POST['order']) {
+ //if the order has changed then remove the current public xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($_POST['enabled'] == "false") {
+ //if the extension name is disabled then remove the public xml file
+ $filenamechanged = true;
+ }
+ if ($filenamechanged){
+ $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
+ if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) {
+ unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename);
+ }
+ unset($publicincludefilename);
+ }
+
+ }
+ unset($filenamechanged);
+
+ } //end foreach
+ } //end if count
+
+ //update the config
+ $a_public_includes[$id] = $ent;
}
else {
//add to the config
diff --git a/packages/freeswitch/freeswitch_recordings.tmp b/packages/freeswitch/freeswitch_recordings.tmp
index 53c285fe..6d4dbbdd 100644
--- a/packages/freeswitch/freeswitch_recordings.tmp
+++ b/packages/freeswitch/freeswitch_recordings.tmp
@@ -50,9 +50,9 @@ if (($_GET['a'] == "download") && file_exists($recording_dir.$_GET['filename']))
}
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;
+ header("Content-Length: " . filesize($recording_dir.$_GET['filename']));
+ fpassthru($fd);
+ exit;
}
else {
//echo $recording_dir.$_GET['filename'];
@@ -175,34 +175,35 @@ if (is_dir($recording_dir)) {
-$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++;
+$i = 0;
+if (count($a_recordings) > 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;
@@ -250,7 +251,7 @@ if ($config_change == 1) {
</tr>
<?php $i = 0; foreach ($a_recordings as $recordingent): ?>
- <tr>
+ <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']?>
diff --git a/packages/freeswitch/freeswitch_recordings_edit.tmp b/packages/freeswitch/freeswitch_recordings_edit.tmp
index 309d0ae9..f41c5abc 100644
--- a/packages/freeswitch/freeswitch_recordings_edit.tmp
+++ b/packages/freeswitch/freeswitch_recordings_edit.tmp
@@ -64,26 +64,25 @@ if ($_POST) {
if (isset($id) && $a_recordings[$id]) {
- //update
-
- if (strlen($_POST['recordingid']) > 0) {
- $recordingent['recordingid'] = $_POST['recordingid'];
- }
- else {
- $recordingent['recordingid'] = guid();
- }
-
- $recordingent['filename'] = $_POST['filename'];
+ //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']);
+ //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;
+ $a_recordings[$id] = $recordingent;
}
else {
- //add
- $recordingent['filename'] = $_POST['filename'];
+ //add
+ $recordingent['filename'] = $_POST['filename'];
$a_recordings[] = $recordingent;
}
diff --git a/packages/freeswitch/freeswitch_time_conditions_edit.tmp b/packages/freeswitch/freeswitch_time_conditions_edit.tmp
index 63f66b09..b6e32392 100644
--- a/packages/freeswitch/freeswitch_time_conditions_edit.tmp
+++ b/packages/freeswitch/freeswitch_time_conditions_edit.tmp
@@ -96,11 +96,11 @@ if ($_POST) {
$ivroptionent['optiondescr'] = $_POST['optiondescr'];
if (isset($id) && $a_ivr_options[$id]) {
- //update
- $a_ivr_options[$id] = $ivroptionent;
+ //update
+ $a_ivr_options[$id] = $ivroptionent;
}
else {
- //add
+ //add
$a_ivr_options[] = $ivroptionent;
}