function getSip_sib($searchext) { global $db; sipexists(); $sql = "SELECT id,data FROM sip 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[] = 'sip'; $sip[] = $result; } return $sip; }
<?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 addsip($account, $callerid, $action) { sipexists(); 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 SIP Extension [") . $device[0] . "] is already in use" . "');</script>"; return false; } } } } $sipfields = array(array($account, 'account', $account), array($account, 'accountcode', isset($_REQUEST['accountcode']) ? $_REQUEST['accountcode'] : ''), array($account, 'secret', isset($_REQUEST['secret']) ? $_REQUEST['secret'] : ''), array($account, 'canreinvite', isset($_REQUEST['canreinvite']) ? $_REQUEST['canreinvite'] : 'no'), array($account, 'context', isset($_REQUEST['context']) ? $_REQUEST['context'] : 'from-internal'), array($account, 'dtmfmode', isset($_REQUEST['dtmfmode']) ? $_REQUEST['dtmfmode'] : 'rfc2833'), 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, 'nat', isset($_REQUEST['nat']) ? $_REQUEST['nat'] : 'no'), array($account, 'port', isset($_REQUEST['port']) ? $_REQUEST['port'] : '5060'), array($account, 'qualify', !empty($_REQUEST['qualify']) ? $_REQUEST['qualify'] : 'no'), array($account, 'callgroup', isset($_REQUEST['callgroup']) ? $_REQUEST['callgroup'] : ''), array($account, 'pickupgroup', isset($_REQUEST['pickupgroup']) ? $_REQUEST['pickupgroup'] : ''), 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, 'subscribecontext', isset($_REQUEST['subscribecontext']) ? $_REQUEST['subscribecontext'] : 'ext-local'), array($account, 'rob', isset($_REQUEST['rob']) ? $_REQUEST['rob'] : 'Never'), array($account, 'cw', isset($_REQUEST['cw']) ? $_REQUEST['cw'] : 'Never'), array($account, 'allowsubscribe', isset($_REQUEST['allowsubscribe']) ? $_REQUEST['allowsubscribe'] : ''), array($account, 'call-limit', !empty($_REQUEST['calllimit']) ? $_REQUEST['calllimit'] : '99'), array($account, 'videosupport', isset($_REQUEST['videosupport']) ? $_REQUEST['videosupport'] : ''), array($account, 't38pt_udptl', isset($_REQUEST['t38pt_udptl']) ? $_REQUEST['t38pt_udptl'] : ''), array($account, 'language', isset($_REQUEST['language']) ? $_REQUEST['language'] : ''), array($account, 'callerid', $callerid)); $compiled = $db->prepare('INSERT INTO sip (id, keyword, data) values (?,?,?)'); $result = $db->executeMultiple($compiled, $sipfields); if (DB::IsError($result)) { die($result->getMessage() . "<br><br>" . 'error adding to SIP table'); } $sql = "INSERT INTO globals VALUES ('E{$account}', 'SIP')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . "<br><br>" . 'error adding to Globals table'); } 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() . "<br><br>" . 'error adding to Globals table'); } } if ($_REQUEST['ringtime'] != '') { $ringtime = $_REQUEST['ringtime']; $sql = "INSERT INTO globals VALUES ('RINGTIME{$account}', '{$ringtime}')"; $result = $db->query($sql); if (DB::IsError($result)) { die($result->getMessage() . "<br><br>" . 'error adding to Globals table'); } } return true; }