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;
}
}
include("head.inc");
?>
FreeSWITCH: IVR: Edit
General Settings:
Interactive voice response general settings.
|
|