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"; $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', 'cidlookup_' . $item['cidlookup_id'], 'cidlookup')); } } } break; } }
} } } ?> </ul></div> <div class="content"> <?php if ($action == 'delete') { echo '<br><h3>' . _("CID Lookup source") . ' ' . $itemid . ' ' . _("deleted") . '!</h3>'; } else { if ($itemid) { //get details for this source $thisItem = cidlookup_get($itemid); $delButton = "\n\t\t\t<form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST>\n\t\t\t\t<input type=\"hidden\" name=\"display\" value=\"{$dispnum}\">\n\t\t\t\t<input type=\"hidden\" name=\"itemid\" value=\"{$itemid}\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"delete\">\n\t\t\t\t<input type=submit value=\"" . _("Delete CID Lookup source") . "\">\n\t\t\t</form>"; $dids_using_arr = cidlookup_did_list($itemid); $dids_using = count($dids_using_arr); if ($dids_using) { $delButton .= '<small>' . sprintf(_("There are %s DIDs using this source that will no longer have lookups if deleted."), $dids_using) . '</small>'; } $thisItem_description = isset($thisItem['description']) ? htmlspecialchars($thisItem['description']) : ''; } else { $thisItem = array('description' => '', 'sourcetype' => null, 'cache' => null); } ?> <h2><?php echo $itemid ? sprintf(_("Source: %s (id %s)"), $thisItem_description, $itemid) : _("Add Source"); ?> </h2> <p style="width: 80%"><?php