function getIax_sib($searchext) { global $db; iaxexists(); $sql = "SELECT id,data FROM iax WHERE keyword = 'callerid' AND data LIKE '%" . $searchext . "%' ORDER BY id"; $results = $db->getAll($sql); if (DB::IsError($results)) { $results = null; } foreach ($results as $result) { $result[] = 'iax'; $iax[] = $result; } return $iax; }
<?php session_start(); require_once 'functions.php'; $amp_conf = parse_amportal_conf("/etc/amportal.conf"); require_once 'common/db_connect.php'; sipexists(); iaxexists(); zapexists(); backuptableexists(); if (isset($_REQUEST['display'])) { $display = $_REQUEST['display']; } else { $display = ''; } if (isset($_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } else { $mode = 'pbx'; } include 'header.php'; $pbx_sections = array(9 => _("Incoming Calls"), 3 => _("Extensions"), 20 => _("Extensions Search"), 21 => _("Extensions Auto"), 4 => _("Ring Groups"), 11 => _("Queues"), 2 => _("Digital Receptionist"), 6 => _("Trunks"), 7 => _("Inbound Routing"), 8 => _("Outbound Routing"), 1 => _("On Hold Music"), 12 => _("System Recordings"), 22 => _("Conferences"), 14 => _("Speeddial/Forward"), 19 => _("Misc Destinations"), 16 => _("Trunk Tone")); $settings_sections = array(1 => _("General Settings"), 2 => _("Sip Settings"), 3 => _("Iax Settings"), 6 => _("VM Settings"), 7 => _("Feature Settings"), 4 => _("Manager Settings"), 5 => _("PHPAgi Settings"), 8 => _("Cti Settings"), 9 => _("BI4Data Settings")); $file_sections = array(1 => _("Recorded Files"), 2 => _("Fax Files")); $tools_sections = array(1 => _("Backup & Restore"), 2 => _("Cti Users"), 6 => _("Phonebook"), 3 => _("Csv Import"), 4 => _("Csv Export"), 5 => _("Asterisk Info")); if ($mode == 'pbx') { echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>"; echo "<div class=\"nav\">"; foreach ($pbx_sections as $key => $value) { echo "<li><a id=\"" . ($display == $key ? 'current' : '') . "\" href=\"config.php?display=" . $key . "&mode=" . $mode . "\" onFocus=\"this.blur()\">+ " . _($value) . "</a></li>"; }
function addiax($account, $callerid, $action) { iaxexists(); global $db; if ($action == "add") { $devices = extension_list(); if (is_array($devices)) { foreach ($devices as $device) { if ($device[0] === $account) { echo "<script>javascript:alert('" . _("This IAX Extension [") . $device[0] . "] is already in use" . "');</script>"; return false; } } } } $iaxfields = array(array($account, 'account', $account), array($account, 'accountcode', isset($_REQUEST['accountcode']) ? $_REQUEST['accountcode'] : ''), array($account, 'secret', isset($_REQUEST['secret']) ? $_REQUEST['secret'] : ''), array($account, 'transfer', isset($_REQUEST['transfer']) ? $_REQUEST['transfer'] : 'yes'), array($account, 'context', isset($_REQUEST['context']) ? $_REQUEST['context'] : ''), array($account, 'host', isset($_REQUEST['host']) ? $_REQUEST['host'] : 'dynamic'), array($account, 'type', isset($_REQUEST['type']) ? $_REQUEST['type'] : 'friend'), array($account, 'mailbox', isset($_REQUEST['mailbox']) ? $_REQUEST['mailbox'] : ''), array($account, 'username', isset($_REQUEST['username']) ? $_REQUEST['username'] : ''), array($account, 'port', isset($_REQUEST['port']) ? $_REQUEST['port'] : '4569'), array($account, 'qualify', !empty($_REQUEST['qualify']) ? $_REQUEST['qualify'] : 'no'), array($account, 'disallow', isset($_REQUEST['disallow']) ? $_REQUEST['disallow'] : ''), array($account, 'allow', isset($_REQUEST['allow']) ? $_REQUEST['allow'] : ''), array($account, 'record_in', isset($_REQUEST['record_in']) ? $_REQUEST['record_in'] : 'Never'), array($account, 'record_out', isset($_REQUEST['record_out']) ? $_REQUEST['record_out'] : 'Never'), array($account, 'nocall', isset($_REQUEST['nocall']) ? $_REQUEST['nocall'] : ''), array($account, 'allowcall', isset($_REQUEST['allowcall']) ? $_REQUEST['allowcall'] : ''), array($account, 'language', isset($_REQUEST['language']) ? $_REQUEST['language'] : ''), array($account, 'callerid', $callerid)); $compiled = $db->prepare('INSERT INTO iax (id, keyword, data) values (?,?,?)'); $result = $db->executeMultiple($compiled, $iaxfields); if (DB::IsError($result)) { die($result->getMessage() . "<br><br>error adding to IAX table"); } //add E<enten>=IAX2 to global vars (appears in extensions_additional.conf) $sql = "INSERT INTO globals VALUES ('E{$account}', 'IAX2')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . $sql); } //add ECID<enten> to global vars if using outbound CID if ($_REQUEST['outcid'] != '') { $outcid = $_REQUEST['outcid']; $sql = "INSERT INTO globals VALUES ('ECID{$account}', '{$outcid}')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . $sql); } } return true; }