function blacklist_hookGet_config($engine) { global $ext; switch ($engine) { case "asterisk": // Code from modules/core/functions.inc.php core_get_config inbound routes $didlist = core_did_list(); if (is_array($didlist)) { foreach ($didlist as $item) { $exten = trim($item['extension']); $cidnum = trim($item['cidnum']); if ($cidnum != '' && $exten == '') { $exten = 's'; $pricid = $item['pricid'] ? true : false; } else { if ($cidnum != '' && $exten != '' || $cidnum == '' && $exten == '') { $pricid = true; } else { $pricid = false; } } $context = $pricid ? "ext-did-0001" : "ext-did-0002"; if (function_exists("empty_freepbx")) { $exten = empty_freepbx($exten) ? "s" : $exten; } else { $exten = empty($exten) ? "s" : $exten; } $exten = $exten . (empty($cidnum) ? "" : "/" . $cidnum); //if a CID num is defined, add it $ext->splice($context, $exten, 1, new ext_gosub('1', 's', 'app-blacklist-check')); } } // else no DID's defined. Not even a catchall. break; } }
function cidlookup_hookGet_config($engine) { // TODO: integrating with direct extension <-> DID association // TODO: add option to avoid CallerID lookup if the telco already supply a CallerID name (GosubIf) global $ext; // is this the best way to pass this? switch ($engine) { case "asterisk": $pairing = cidlookup_did_list(); if (is_array($pairing)) { foreach ($pairing as $item) { if ($item['cidlookup_id'] != 0) { // Code from modules/core/functions.inc.php core_get_config inbound routes $exten = trim($item['extension']); $cidnum = trim($item['cidnum']); if ($cidnum != '' && $exten == '') { $exten = 's'; $pricid = $item['pricid'] ? true : false; } else { if ($cidnum != '' && $exten != '' || $cidnum == '' && $exten == '') { $pricid = true; } else { $pricid = false; } } $context = $pricid ? "ext-did-0001" : "ext-did-0002"; if (function_exists('empty_freepbx')) { $exten = empty_freepbx($exten) ? "s" : $exten; } else { $exten = empty($exten) ? "s" : $exten; } $exten = $exten . (empty($cidnum) ? "" : "/" . $cidnum); //if a CID num is defined, add it $ext->splice($context, $exten, 'dest-ext', new ext_gosub('1', 'cidlookup_' . $item['cidlookup_id'], 'cidlookup')); } } } break; } }