if ($action == 'edtPARKING') { parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg_id, $goto); needreload(); redirect_standard(); } } ?> </div> <div class="content"> <?php // get the parkinglot settings if not a submit // if (!$action) { $parkinglot_id = 1; // only 1 lot now but prepare for future $parkingInfo = parking_getconfig($parkinglot_id); if (is_array($parkingInfo)) { extract($parkingInfo); } } ?> <h2><?php echo _("Parking Lot Configuration"); ?> </h2> <form name="parking" action="config.php" method="post" onsubmit="return parking_onsubmit();"> <input type="hidden" name="display" value="parking"/> <input type="hidden" name="action" value="edtPARKING"/> <table> <tr><td colspan="2"><h5><?php echo _("Parking Lot Options");
function parking_get_config($engine) { global $db; global $amp_conf; global $ext; // is this the best way to pass this? global $asterisk_conf; global $core_conf; global $version; switch ($engine) { case "asterisk": $contextname = 'park-dial'; $parkinglot_id = 1; // only 1 parking lot, but prepare for future $results = parking_getconfig($parkinglot_id); // Got the array, let's go work out the required variables // $parkingenabled = isset($results['parkingenabled']) ? $results['parkingenabled'] : ''; $parkext = isset($results['parkext']) ? $results['parkext'] : 70; $numslots = isset($results['numslots']) ? $results['numslots'] : 8; $parkingtime = isset($results['parkingtime']) ? $results['parkingtime'] : ''; $parkingcontext = isset($results['parkingcontext']) ? $results['parkingcontext'] : 'parkedcalls'; $parkalertinfo = isset($results['parkalertinfo']) ? $results['parkalertinfo'] : ''; $parkcid = isset($results['parkcid']) ? $results['parkcid'] : ''; $parkingannmsg_id = isset($results['parkingannmsg_id']) ? $results['parkingannmsg_id'] : ''; $goto = isset($results['goto']) ? $results['goto'] : 'from-pstn,s,1'; $parkpos1 = $parkext + 1; $parkpos2 = $parkpos1 + $numslots - 1; if ($parkingenabled) { // TODO: lookup ampportal.conf variables for this, don't hard code // first write features_additional.inc include file // $core_conf->addFeatureGeneral('parkext', $parkext); $core_conf->addFeatureGeneral('parkpos', $parkpos1 . "-" . $parkpos2); $core_conf->addFeatureGeneral('context', $parkingcontext); if ($parkingtime) { $core_conf->addFeatureGeneral('parkingtime', $parkingtime); } // Now generate dialplan $ext->add($contextname, "t", '', new ext_noop('Parked Call Timed Out and Got Orphaned')); $ext->add($contextname, "_[0-9a-zA-Z*#].", '', new ext_noop('Parked Call Timed Out and Got Orphaned')); // If we have an appropriate Asterisk patch, set paraemters for Asterisk // if (isset($amp_conf["PARKINGPATCH"]) && strtolower($amp_conf["PARKINGPATCH"]) == 'true') { if ($parkalertinfo) { $core_conf->addFeatureGeneral('parkreturnalertinfo', $parkalertinfo); } if ($parkcid) { $core_conf->addFeatureGeneral('parkreturncidprefix', $parkcid); } // No patch, do the default for orphaned calls } else { if ($parkalertinfo) { $ext->add($contextname, "t", '', new ext_setvar('__ALERT_INFO', str_replace(';', '\\;', $parkalertinfo))); $ext->add($contextname, "_[0-9a-zA-Z*#].", '', new ext_setvar('__ALERT_INFO', str_replace(';', '\\;', $parkalertinfo))); } if ($parkcid) { $ext->add($contextname, "t", '', new ext_setvar('CALLERID(name)', $parkcid . '${CALLERID(name)}')); $ext->add($contextname, "_[0-9a-zA-Z*#].", '', new ext_setvar('CALLERID(name)', $parkcid . '${CALLERID(name)}')); } } if ($parkingannmsg_id != '') { $parkingannmsg = recordings_get_file($parkingannmsg_id); $ext->add($contextname, "t", '', new ext_playback($parkingannmsg)); $ext->add($contextname, "_[0-9a-zA-Z*#].", '', new ext_playback($parkingannmsg)); } // goto the destination here // $ext->add($contextname, "t", '', new ext_goto($goto)); $ext->add($contextname, "_[0-9a-zA-Z*#].", '', new ext_goto($goto)); // Asterisk 1.4 requires hints to be generated for parking // if (version_compare($version, "1.4", "ge")) { $parkhints = 'park-hints'; $ext->addInclude('from-internal-additional', $parkhints); // Add the include from from-internal for ($slot = $parkpos1; $slot <= $parkpos2; $slot++) { $ext->addHint($parkhints, $slot, "park:{$slot}@{$parkingcontext}"); $ext->add($parkhints, $slot, '', new ext_parkedcall($slot)); } } } break; } }