/asterisk-stats/trunk/cdr_list.php |
---|
43,7 → 43,7 |
} |
# Construct Query Here |
$query = BaseQuery(); |
$query = CdrBaseQueryWhere(); |
$params = array(); |
$active = false; |
/asterisk-stats/trunk/originate_form.php |
---|
11,7 → 11,7 |
. " from telbook_entries join telbook_persons on person_id=entry_person" |
. " where entry_title=$1" |
. " order by person_name, entry_title, entry_value", |
array('I')); |
array($g_config['originate_src'])); |
$src_list = ""; |
while($line = $db->fetch_row()) { |
/asterisk-stats/trunk/index.php |
---|
7,7 → 7,7 |
{ |
global $db, $g_display; |
$query = "select count(acctid), sum(billsec) from cdr where" . BaseQuery() |
$query = "select count(acctid), sum(billsec) from cdr where" . CdrBaseQueryWhere() |
. ($interval ? " and date_trunc('" . $interval . "', calldate)" |
. ($diff ? " + interval '$diff $interval'" : "") . " = date_trunc('" |
. $interval . "', current_date)" : ""); |
19,7 → 19,7 |
# active calls |
$db->query("select count(acctid), sum(extract(epoch from date_trunc('second',current_timestamp-linkdate)))" |
. " from activecalls where" . BaseQuery() . " and duration is null"); |
. " from activecalls where" . CdrBaseQueryWhere() . " and duration is null"); |
$db->fetch_row_idx(); |
$g_display->add_variables(array('CS_ACTIVE' => $db->get_field(0), |
'CS_ACTIVE_DUR' => FormatDuration($db->get_field(1)))); |
/asterisk-stats/trunk/originate_call.php |
---|
9,12 → 9,14 |
$dst = $_POST['dst']; |
try { |
$ast = new Net_AsteriskManager(array('server' => $mgr_host, 'port' => $mgr_port)); |
$ast = new Net_AsteriskManager(array( |
'server' => $g_config['mgr_host'], |
'port' => $g_config['mgr_port'])); |
$ast->connect(); |
$ast->login($mgr_user, $mgr_password); |
$ast->login($g_config['mgr_user'], $g_config['mgr_password']); |
$ast->originateCall($dst, "$mgr_channel/$src", $mgr_context, $src); |
$ast->originateCall($dst, $g_config['mgr_channel'] . "/$src", $g_config['mgr_context'], $src); |
$g_display->add_text("A call from $src to $dst is originated"); |
} |
catch(PEAR_Exception $e) { |
/asterisk-stats/trunk/includes/db.php |
---|
12,12 → 12,13 |
# more information. # |
#################################################### |
switch($db_type) { |
switch($g_config['db_type']) { |
case 'PGSQL': |
include('includes/db/postgresql.php'); |
break; |
} |
$db = new db_obj($db_host, $db_user, $db_password, $db_database); |
$db = new db_obj($g_config['db_host'], $g_config['db_user'], |
$g_config['db_password'], $g_config['db_database']); |
?> |
/asterisk-stats/trunk/includes/config.php-dist |
---|
1,22 → 1,24 |
<?php |
$db_type = 'PGSQL'; |
$db_host = 'localhost'; |
$db_user = 'astweb'; |
$db_password = 'password'; |
$db_database = 'asterisk'; |
$g_config['db_type'] = 'PGSQL'; |
$g_config['db_host'] = 'localhost'; |
$g_config['db_user'] = 'astweb'; |
$g_config['db_password'] = 'password1'; |
$g_config['db_database'] = 'asterisk'; |
$mgr_host = 'localhost'; |
$mgr_port = 5038; |
$mgr_user = 'originator'; |
$mgr_password = 'password2'; |
$mgr_channel = 'SIP'; |
$mgr_context = 'default'; |
$g_config['mgr_host'] = 'localhost'; |
$g_config['mgr_port'] = 5038; |
$g_config['mgr_user'] = 'originator'; |
$g_config['mgr_password'] = 'password2'; |
$g_config['mgr_channel'] = 'SIP'; |
$g_config['mgr_context'] = 'default'; |
// any local specific query |
function BaseQuery() |
$g_config['originate_src'] = 'I'; // which 'entry_title' may originate a call |
// any local specific query for list of calls |
function CdrBaseQueryWhere() |
{ |
return " (dstchannel is null or dstchannel != '')"; |
return " (dcontext is null or dcontext != 'incoming_fix_callerid' and dcontext != 'incoming_delayed')"; |
} |
?> |
/asterisk-stats/trunk/includes/defaults.php |
---|
1,12 → 1,14 |
<?php |
$g_site_title = 'Asterisk Web Interface'; |
$g_site_style = 'style.css'; |
$g_config = array( |
'site_title' => 'Asterisk Web Interface', |
'site_style' => 'style.css', |
$db_type = 'PGSQL'; |
$db_host = 'localhost'; |
$db_user = 'astweb'; |
$db_password = 'password'; |
$db_database = 'asterisk'; |
'db_type' => 'PGSQL', |
'db_host' => 'localhost', |
'db_user' => 'astweb', |
'db_password' => 'password', |
'db_database' => 'asterisk', |
); |
?> |
/asterisk-stats/trunk/includes/common.php |
---|
19,14 → 19,14 |
function ShowMenu($display) |
{ |
global $g_site_style, $g_site_title; |
global $g_config; |
$display->add_template('menu'); |
$display->add_variables(array( |
'AST_STYLESHEET' => $g_site_style, |
'AST_SITETITLE' => $g_site_title, |
'AST_DATETIME' => date('Y-m-d H:i:s'), |
'AST_STYLESHEET' => $g_config['site_style'], |
'AST_SITETITLE' => $g_config['site_title'], |
'AST_DATETIME' => date('Y-m-d H:i:s'), |
)); |
} |