/** Moved to BMO hook function fax_hook_core($viewing_itemid, $target_menuid){} */ function fax_hookGet_config($engine) { global $version; $ast_ge_11 = version_compare($version, '11', 'ge'); $fax = fax_detect($version); if ($fax['module']) { $fax_settings['force_detection'] = 'yes'; } else { $fax_settings = fax_get_settings(); } if ($fax_settings['force_detection'] == 'yes') { //dont continue unless we have a fax module in asterisk global $ext; global $engine; $routes = fax_get_incoming(); foreach ($routes as $current => $route) { if ($route['detection'] == 'nvfax' && !$fax['nvfax']) { //TODO: add notificatoin to notification panel that this was skipped because NVFaxdetec not present continue; // skip this one if there is no NVFaxdetect installed on this system } if ($route['extension'] == '' && $route['cidnum']) { //callerID only $extension = 's/' . $route['cidnum']; $context = $route['pricid'] == 'CHECKED' ? 'ext-did-0001' : 'ext-did-0002'; } else { if ($route['extension'] && $route['cidnum'] || $route['extension'] == '' && $route['cidnum'] == '') { //callerid+did / any/any $context = 'ext-did-0001'; } else { //did only $context = 'ext-did-0002'; } $extension = ($route['extension'] != '' ? $route['extension'] : 's') . ($route['cidnum'] == '' ? '' : '/' . $route['cidnum']); } if ($route['legacy_email'] === null) { $ext->splice($context, $extension, 'dest-ext', new ext_setvar('FAX_DEST', str_replace(',', '^', $route['destination']))); } else { $ext->splice($context, $extension, 'dest-ext', new ext_setvar('FAX_DEST', 'ext-fax^s^1')); if ($route['legacy_email']) { $fax_rx_email = $route['legacy_email']; } else { if (!isset($default_fax_rx_email)) { $default_address = sql('SELECT value FROM fax_details WHERE `key` = \'fax_rx_email\'', 'getRow'); $default_fax_rx_email = $default_address[0]; } $fax_rx_email = $default_fax_rx_email; } $ext->splice($context, $extension, 'dest-ext', new ext_setvar('FAX_RX_EMAIL', $fax_rx_email)); } //If we have fax incoming, we need to set fax detection to yes if we are on Asterisk 11 or newer if ($ast_ge_11) { $ext->splice($context, $extension, 'dest-ext', new ext_setvar('FAXOPT(faxdetect)', 'yes')); } $ext->splice($context, $extension, 'dest-ext', new ext_answer('')); if ($route['detection'] == 'nvfax') { $ext->splice($context, $extension, 'dest-ext', new ext_playtones('ring')); $ext->splice($context, $extension, 'dest-ext', new ext_nvfaxdetect($route['detectionwait'] . ",t")); } else { $ext->splice($context, $extension, 'dest-ext', new ext_wait($route['detectionwait'])); } } } }
public function bulkhandlerExport($type) { $data = NULL; switch ($type) { case 'usermanusers': $users = $this->userman->getAllUsers(); foreach ($users as $user) { $en = $this->userman->getModuleSettingByID($user['id'], 'fax', 'enabled', true); $data[$user['id']] = array('fax_enabled' => is_null($en) ? "inherit" : (empty($en) ? 'no' : 'yes'), 'fax_attachformat' => $this->userman->getModuleSettingByID($user['id'], 'fax', 'attachformat')); } break; case 'usermangroups': $groups = $this->userman->getAllGroups(); foreach ($groups as $group) { $en = $this->userman->getModuleSettingByGID($group['id'], 'fax', 'enabled'); $data[$group['id']] = array('fax_enabled' => empty($en) ? 'no' : 'yes', 'fax_attachformat' => $this->userman->getModuleSettingByGID($group['id'], 'fax', 'attachformat')); } break; case "dids": $dids = $this->FreePBX->Core->getAllDIDs(); $data = array(); $this->FreePBX->Modules->loadFunctionsInc("fax"); foreach ($dids as $did) { $key = $did['extension'] . "/" . $did["cidnum"]; $fax = fax_get_incoming($did['extension'], $did["cidnum"]); if (!empty($fax)) { $data[$key] = array("fax_enable" => "yes", "fax_detection" => $fax['detection'], "fax_detectionwait" => $fax['detectionwait'], "fax_destination" => $fax['destination']); } else { array("fax_enable" => "", "fax_detection" => "", "fax_detectionwait" => "", "fax_destination" => ""); } } break; } return $data; }