Index: /contributed_modules/modules/extcfg/functions.inc.php
===================================================================
--- /contributed_modules/modules/extcfg/functions.inc.php (revision 7577)
+++ /contributed_modules/modules/extcfg/functions.inc.php (revision 11299)
@@ -26,9 +26,11 @@
define("CFIM", "CF");
define("YAC", "YAC");
+define("DND", "DND");
require("astman.inc");
function extcfg_init(){
- global $server;
+ global $server, $amp_conf;
+
/* mysql_connect('localhost', 'asteriskuser', 'amp109') or die ("Could not connect to MySQL");
mysql_select_db('asterisk') or die ("Could not select asterisk database" . mysql_error());
@@ -51,15 +53,16 @@
$i++;
}
+
*/
$server[] = array(
- "db_host" => "localhost",
- "db_user" => "asteriskuser",
- "db_passwd" => "amp109",
- "db_db" => "asterisk",
- "astman_host" => "localhost",
- "astman_user" => "admin",
- "astman_passwd" => "amp111",
- "name" => "mlin1",
+ "db_host" => $amp_conf['AMPDBHOST'],
+ "db_user" => $amp_conf['AMPDBUSER'],
+ "db_passwd" => $amp_conf['AMPDBPASS'],
+ "db_db" => $amp_conf['AMPDBNAME'],
+ "astman_host" => 'localhost',
+ "astman_user" => $amp_conf['AMPMGRUSER'],
+ "astman_passwd" => $amp_conf['AMPMGRPASS'],
+ "name" => "localhost",
"astman" => new AstMan
);
@@ -110,20 +113,36 @@
sort($exts);
- echo "
| Ext | DND | Call Waiting | Call Forward All | Call Forward Busy | Call Forward No Answer | IP | port | Status | Device | Tech |
";
+ echo " | Extension | DND | Call Waiting | Call Forward All | Call Forward Busy | Call Forward No Answer | IP | port | Status | Device | Tech |
";
foreach($exts as $ext){
- $status_bg = $status_arr[$ext[0]]['ok'] ? '#8f8' : '#f88';
+ $status_bg = $status_arr[$ext[0]]['ok'] ? '#88ff88' : '#ff8888';
+ $dnd_f = empty($dnd[$ext[1]][$ext[0]]) ? '' : '
';
+ $cw_f = '';
+ if(!empty($cw[$ext[1]][$ext[0]])){
+ if($cw[$ext[1]][$ext[0]] == 'ENABLED'){
+ $cw_f = '
';
+ }
+ }
+ $cfim_f = empty($cfim[$ext[1]][$ext[0]]) ? '' : $cfim[$ext[1]][$ext[0]];
+ $cfbs_f = empty($cfbs[$ext[1]][$ext[0]]) ? '' : $cfbs[$ext[1]][$ext[0]];
+ $cfna_f = empty($cfna[$ext[1]][$ext[0]]) ? '' : $cfna[$ext[1]][$ext[0]];
+ $ip = empty($status_arr[$ext[0]]['ip']) ? '' : $status_arr[$ext[0]]['ip'];
+ $port = empty($status_arr[$ext[0]]['port']) ? '' : $status_arr[$ext[0]]['port'];
+ $status = empty($status_arr[$ext[0]]['status']) ? '' : $status_arr[$ext[0]]['status'];
+ $device = empty($status_arr[$ext[0]]['device']) ? '' : $status_arr[$ext[0]]['device'];
+ $type = empty($status_arr[$ext[0]]['type']) ? '' : $status_arr[$ext[0]]['type'];
echo "
- | {$ext[0]} |
- {$dnd[$ext[1]][$ext[0]]} |
- {$cw[$ext[1]][$ext[0]]} |
- {$cfim[$ext[1]][$ext[0]]} |
- {$cfbs[$ext[1]][$ext[0]]} |
- {$cfna[$ext[1]][$ext[0]]} |
- {$status_arr[$ext[0]]['ip']} |
- {$status_arr[$ext[0]]['port']} |
- {$status_arr[$ext[0]]['status']} |
- {$status_arr[$ext[0]]['device']} |
- {$status_arr[$ext[0]]['type']} |
+  |
+ {$ext[0]} - {$ext[2]} |
+ $dnd_f |
+ $cw_f |
+ $cfim_f |
+ $cfbs_f |
+ $cfna_f |
+ $ip |
+ $port |
+ $status |
+ $device |
+ $type |
";
}
@@ -194,25 +213,21 @@
$serv = $server[$srv];
-/* if ($_REQUEST["YAC"])
- $serv['astman']->PutDB(YAC, $ext, $_REQUEST["YAC"]);
- else
- $serv['astman']->DelDB(YAC, $ext); */
- if ($_REQUEST["DND"])
+ if (isset($_REQUEST["DND"]))
$serv['astman']->PutDB(DND, $ext, "YES");
else
$serv['astman']->DelDB(DND, $ext);
- if ($_REQUEST["CW"])
+ if (isset($_REQUEST["CW"]))
$serv['astman']->PutDB(CW, $ext, "ENABLED");
else
$serv['astman']->DelDB(CW, $ext);
- if ($_REQUEST["CFBS"])
+ if (!empty($_REQUEST["CFBS"]))
$serv['astman']->PutDB(CFBS, $ext, $_REQUEST["CFBS"]);
else
$serv['astman']->DelDB(CFBS, $ext);
- if ($_REQUEST["CFIM"])
+ if (!empty($_REQUEST["CFIM"]))
$serv['astman']->PutDB(CFIM, $ext, $_REQUEST["CFIM"]);
else
$serv['astman']->DelDB(CFIM, $ext);
- if ($_REQUEST["CFNA"])
+ if (!empty($_REQUEST["CFNA"]))
$serv['astman']->PutDB(CFNA, $ext, $_REQUEST["CFNA"]);
else
@@ -224,35 +239,15 @@
$exts = array();
- $sql = "SELECT id FROM devices d WHERE LENGTH(id) < 6 ORDER BY CAST(id AS UNSIGNED);";
- $sql_iax = "SELECT id,data FROM iax WHERE keyword = 'callerid' ORDER BY id";
- $sql_sip = "SELECT id,data FROM sip WHERE keyword = 'callerid' ORDER BY id";
- $sql_zap = "SELECT id,data FROM zap WHERE keyword = 'callerid' ORDER BY id";
+ $sql = "SELECT id, description FROM devices d ORDER BY CAST(id AS UNSIGNED);";
mysql_connect($server, $user, $passwd) or die ("Could not connect to MySQL");
mysql_select_db($db) or die ("Could not select $db database");
- $result = mysql_query($sql) or die ("Query failed");
+ $result = mysql_query($sql) or die ("Query failed");
while ($kolumn = mysql_fetch_array($result)) {
- $exts[] = array($kolumn["id"], $astman_nr);
+ $exts[] = array($kolumn["id"], $astman_nr, $kolumn['description']);
}
return ($exts);
-
- $result = mysql_query($sql_iax) or die ("IAX Query failed");
- while ($kolumn = mysql_fetch_array($result)) {
- $exts[] = array($kolumn["id"],$astman_nr);
- }
-
- $result = mysql_query($sql_sip) or die ("SIP Query failed");
- while ($kolumn = mysql_fetch_array($result)) {
- $exts[] = array($kolumn["id"],$astman_nr);
- }
-
- $result = mysql_query($sql_zap) or die ("ZAP Query failed");
- while ($kolumn = mysql_fetch_array($result)) {
- $exts[] = array($kolumn["id"],$astman_nr);
- }
- sort($exts);
- return ($exts);
}
@@ -336,5 +331,5 @@
$sep = trim(substr($sccp_device, -27, 16));
$ip = trim(substr($sccp_device, -43, 15));
- $extension = $sccp_sep_arr[$sep];
+ $extension = empty($sccp_sep_arr[$sep]) ? null : $sccp_sep_arr[$sep];
$ok = $sep == '--' ? false : true;
if ($extension){
@@ -346,8 +341,10 @@
$mgcp_endpoints_res = $astman->Query("Action: Command\r\nCommand: mgcp show endpoints\r\n\r\n");
+
+ if (strpos($mgcp_endpoints_res, 'Gateway')){
$mgcp_endpoints = get_astman_lines($mgcp_endpoints_res);
unset($mgcp_endpoints[0]);
-
+
foreach($mgcp_endpoints as $mgcp_endpoint){
$extension = '';
@@ -377,4 +374,5 @@
}
}
+ }
return $arr;
@@ -394,7 +392,7 @@
function varBg($i = 0){
if($i%2 == 0)
- return '#fff';
+ return '#ffffff';
else
- return '#eee';
+ return '#eeeeee';
}
?>
Index: /contributed_modules/modules/extcfg/astman.inc
===================================================================
--- /contributed_modules/modules/extcfg/astman.inc (revision 7577)
+++ /contributed_modules/modules/extcfg/astman.inc (revision 11299)
@@ -279,3 +279,2 @@
}
}
-?>