function callback_get_config($engine) { global $ext; // is this the best way to pass this? global $asterisk_conf; switch ($engine) { case "asterisk": $timelist = callback_list(); if (is_array($timelist)) { foreach ($timelist as $item) { //$thisitem = callback_get(ltrim($item['callback_id'])); // add dialplan // use callbacknum if avail, otherwise use cidnum $callback_num = empty($item['callbacknum']) ? '${CALLERID(number)}' : $item['callbacknum']; $ext->add('callback', $item['callback_id'], '', new ext_setvar("CALL", $callback_num)); //substitute commas with periods to keep asterisk dialplan variables happy $callback_destination = str_replace(",", ".", $item['destination']); $ext->add('callback', $item['callback_id'], '', new ext_setvar("DESTINATION", $callback_destination)); // set sleep time $sleep = empty($item['sleep']) ? '0' : $item['sleep']; $ext->add('callback', $item['callback_id'], '', new ext_setvar("SLEEP", $sleep)); // kick off the callback script - run in background (&) so we can hangup $ext->add('callback', $item['callback_id'], '', new ext_system((empty($asterisk_conf['astvarlib']) ? '/var/lib/asterisk' : $asterisk_conf['astvarlib']) . '/bin/callback ${CALL} ${DESTINATION} ${SLEEP} &')); //hangup $ext->add('callback', $item['callback_id'], '', new ext_hangup('')); } } break; } }
redirect_standard(); break; case "delete": callback_del($itemid); needreload(); redirect_standard(); break; case "edit": callback_edit($itemid, $_POST); needreload(); redirect_standard('itemid'); break; } } //get list of time conditions $callbacks = callback_list(); ?> </div> <!-- end content div so we can display rnav properly--> <!-- right side menu --> <div class="rnav"><ul> <li><a id="<?php echo $itemid == '' ? 'current' : ''; ?> " href="config.php?display=<?php echo urlencode($dispnum); ?> "><?php echo _("Add Callback"); ?>
echo "<p>" . _QXZ("enable_callback_entry_date") . " = {$enable_callback_entry_date} | " . _QXZ("enable_callback_callback_date") . " = {$enable_callback_callback_date} | " . _QXZ("callback_entry_start_date") . " = {$callback_entry_start_date} | " . _QXZ("callback_entry_end_date") . " = {$callback_entry_end_date} | " . _QXZ("callback_callback_start_date") . " = {$callback_callback_start_date} | " . _QXZ("callback_callback_end_date") . " = {$callback_callback_end_date} | " . _QXZ("callback_list") . " = {$callback_list}</p>"; } # filter out anything bad $enable_callback_entry_date = preg_replace('/[^a-zA-Z]/', '', $enable_callback_entry_date); $enable_callback_callback_date = preg_replace('/[^a-zA-Z]/', '', $enable_callback_callback_date); $callback_entry_start_date = preg_replace('/[^-_%0-9a-zA-Z]/', '', $callback_entry_start_date); $callback_entry_end_date = preg_replace('/[^-_%0-9a-zA-Z]/', '', $callback_entry_end_date); $callback_callback_start_date = preg_replace('/[^-_%0-9a-zA-Z]/', '', $callback_callback_start_date); $callback_callback_end_date = preg_replace('/[^-_%0-9a-zA-Z]/', '', $callback_callback_end_date); $callback_list = preg_replace('/[^0-9]/', '', $callback_list); if ($DB) { echo "<p>" . _QXZ("enable_callback_entry_date") . " = {$enable_callback_entry_date} | " . _QXZ("enable_callback_callback_date") . " = {$enable_callback_callback_date} | " . _QXZ("callback_entry_start_date") . " = {$callback_entry_start_date} | " . _QXZ("callback_entry_end_date") . " = {$callback_entry_end_date} | " . _QXZ("callback_callback_start_date") . " = {$callback_callback_start_date} | " . _QXZ("callback_callback_end_date") . " = {$callback_callback_end_date} | " . _QXZ("callback_list") . " = {$callback_list}</p>"; } # make sure the required fields are set if ($callback_list == '') { callback_list('List'); } # build the sql query's where phrase and the callback phrase $sql_where = ""; $callback_parm = ""; if ($enable_callback_entry_date == "enabled" && $callback_entry_start_date != '') { $sql_where = $sql_where . " and entry_time >= '{$callback_entry_start_date} 00:00:00' "; $callback_parm = $callback_parm . " " . _QXZ("entry time greater than") . " {$callback_entry_start_date} 00:00:00<br />"; } elseif ($enable_callback_entry_date == "enabled") { blank_field('Entry Start Date', false); } if ($enable_callback_entry_date == "enabled" && $callback_entry_end_date != '') { $sql_where = $sql_where . " and entry_time <= '{$callback_entry_end_date} 23:59:59' "; $callback_parm = $callback_parm . " " . _QXZ("entry time less than") . " {$callback_entry_end_date} 23:59:59<br />"; } elseif ($enable_callback_entry_date == "enabled") { blank_field('Entry End Date', false);